57 #include <boost/format.hpp>
58 # include <boost/function.hpp>
88 Loki::ClassLevelLockable> Type;
89 return Type::Instance();
97 EquationSystem::EquationSystem(
99 : m_comm (pSession->GetComm()),
100 m_session (pSession),
105 const vector<std::string> filenames =
m_session->GetFilenames();
107 for(
int i = 0; i < filenames.size(); ++i)
109 string sessionname =
"SessionName";
110 sessionname += boost::lexical_cast<std::string>(i);
150 if (
m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
152 std::string HomoStr =
m_session->GetSolverInfo(
"HOMOGENEOUS");
155 if ((HomoStr ==
"HOMOGENEOUS1D") || (HomoStr ==
"Homogeneous1D")
156 || (HomoStr ==
"1D") || (HomoStr ==
"Homo1D"))
162 if(
m_session->DefinesSolverInfo(
"ModeType"))
164 m_session->MatchSolverInfo(
"ModeType",
"SingleMode",
166 m_session->MatchSolverInfo(
"ModeType",
"HalfMode",
168 m_session->MatchSolverInfo(
"ModeType",
"MultipleModes",
173 if (
m_session->DefinesSolverInfo(
"ModeType"))
189 ASSERTL0(
false,
"SolverInfo ModeType not valid");
198 if ((HomoStr ==
"HOMOGENEOUS2D") || (HomoStr ==
"Homogeneous2D")
199 || (HomoStr ==
"2D") || (HomoStr ==
"Homo2D"))
209 if ((HomoStr ==
"HOMOGENEOUS3D") || (HomoStr ==
"Homogeneous3D")
210 || (HomoStr ==
"3D") || (HomoStr ==
"Homo3D"))
222 m_session->MatchSolverInfo(
"DEALIASING",
"True",
226 m_session->MatchSolverInfo(
"DEALIASING",
"On",
237 m_session->MatchSolverInfo(
"SPECTRALHPDEALIASING",
"True",
241 m_session->MatchSolverInfo(
"SPECTRALHPDEALIASING",
"On",
247 if (
m_session->DefinesSolverInfo(
"PROJECTION"))
249 std::string ProjectStr =
m_session->GetSolverInfo(
"PROJECTION");
251 if ((ProjectStr ==
"Continuous") || (ProjectStr ==
"Galerkin") ||
252 (ProjectStr ==
"CONTINUOUS") || (ProjectStr ==
"GALERKIN"))
256 else if ((ProjectStr ==
"MixedCGDG") ||
257 (ProjectStr ==
"Mixed_CG_Discontinuous"))
261 else if(ProjectStr ==
"DisContinuous")
267 ASSERTL0(
false,
"PROJECTION value not recognised");
272 cerr <<
"Projection type not specified in SOLVERINFO,"
273 "defaulting to continuous Galerkin" << endl;
281 int nvariables =
m_session->GetVariables().size();
282 bool DeclareCoeffPhysArrays =
true;
287 m_expdim = m_graph->GetMeshDimension();
309 for (i = 0; i <
m_fields.num_elements(); i++)
322 for (i = 0; i <
m_fields.num_elements(); i++)
349 for(i = 0; i <
m_fields.num_elements(); i++)
377 for (i = 0; i <
m_fields.num_elements(); i++)
379 if(
m_session->GetVariable(i).compare(
"w")
416 for (i = 0; i <
m_fields.num_elements(); i++)
437 DeclareCoeffPhysArrays,
440 for (i = 1; i < m_fields.num_elements(); i++)
443 SameExpansions(
m_session->GetVariable(0),
448 *firstfield, m_graph,
450 DeclareCoeffPhysArrays,
459 DeclareCoeffPhysArrays,
478 m_fields[0]->GetTrace()->
496 for (i = 1; i < m_fields.num_elements(); i++)
498 if(m_graph->SameExpansions(
504 *firstfield, m_graph,
533 for(i = 1; i < m_fields.num_elements(); ++i)
535 m_fields[i]->GetTrace();
541 ASSERTL0(
false,
"Expansion dimension not recognised");
564 for (i = 0; i <
m_fields.num_elements(); i++)
577 for (i = 0; i <
m_fields.num_elements(); i++)
597 for (i = 0; i <
m_fields.num_elements(); i++)
609 for (i = 0; i <
m_fields.num_elements(); i++)
625 "3D fully periodic problems not implemented yet");
629 for (i = 0; i <
m_fields.num_elements(); i++)
640 ASSERTL0(
false,
"Expansion dimension not recognised");
664 m_session->LoadParameter(
"NumQuadPointsError",
692 std::string pFunctionName,
697 "Function '" + pFunctionName +
"' does not exist.");
699 std::vector<std::string> vFieldNames =
m_session->GetVariables();
701 for(
int i = 0 ; i < vFieldNames.size(); i++)
714 std::vector<std::string> pFieldNames,
716 const std::string& pFunctionName,
720 ASSERTL1(pFieldNames.size() == pFields.num_elements(),
721 "Function '" + pFunctionName
722 +
"' variable list size mismatch with array storage.");
724 "Function '" + pFunctionName +
"' does not exist.");
726 for(
int i = 0; i < pFieldNames.size(); i++)
738 std::vector<std::string> pFieldNames,
740 const std::string& pFunctionName,
745 "Function '" + pFunctionName +
"' does not exist.");
746 ASSERTL0(pFieldNames.size() == pFields.num_elements(),
747 "Field list / name list size mismatch.");
749 for(
int i = 0; i < pFieldNames.size(); i++)
752 pFunctionName, pTime, domain);
753 pFields[i]->FwdTrans_IterPerExp(pFields[i]->GetPhys(),
754 pFields[i]->UpdateCoeffs());
761 std::string pFieldName,
763 const std::string& pFunctionName,
768 "Function '" + pFunctionName +
"' does not exist.");
770 unsigned int nq =
m_fields[0]->GetNpoints();
771 if (pArray.num_elements() < nq)
777 vType =
m_session->GetFunctionType(pFunctionName, pFieldName,domain);
788 =
m_session->GetFunction(pFunctionName, pFieldName,domain);
790 ffunc->Evaluate(x0,x1,x2,pTime,pArray);
798 std::string loadedKey = pFunctionName + pFieldName;
805 std::string filename =
m_session->GetFunctionFilename(
806 pFunctionName, pFieldName, domain);
807 std::string fileVar =
m_session->GetFunctionFilenameVariable(
808 pFunctionName, pFieldName, domain);
810 if (fileVar.length() == 0)
812 fileVar = pFieldName;
815 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
816 std::vector<std::vector<NekDouble> > FieldData;
820 int numexp =
m_fields[0]->GetExpSize();
824 for(
int i = 0; i < numexp; ++i)
826 ElementGIDs[i] =
m_fields[0]->GetExp(i)->GetGeom()->GetGlobalID();
835 #if (defined _WIN32 && _MSC_VER < 1900)
838 unsigned int old_exponent_format;
839 old_exponent_format = _set_output_format(_TWO_DIGIT_EXPONENT);
840 filename = boost::str(boost::format(filename) %
m_time);
841 _set_output_format(old_exponent_format);
843 filename = boost::str(boost::format(filename) % m_time);
848 ASSERTL0(
false,
"Invalid Filename in function \""
849 + pFunctionName +
"\", variable \"" + fileVar +
"\"")
853 if (boost::filesystem::path(filename).extension() !=
".pts")
855 m_fld->Import(filename, FieldDef, FieldData,
862 for (
int i = 0; i < FieldDef.size(); ++i)
866 for (
int j = 0; j < FieldDef[i]->m_fields.size(); ++j)
868 if (FieldDef[i]->
m_fields[j] == fileVar)
877 FieldDef[i], FieldData[i],
878 FieldDef[i]->
m_fields[idx], vCoeffs);
882 cout <<
"Field " + fileVar +
" not found." << endl;
886 m_fields[0]->BwdTrans_IterPerExp(vCoeffs, pArray);
892 ptsIO.
Import(filename, ptsField);
898 m_fields[0]->GetCoords(coords[0], coords[1], coords[2]);
901 std::string weightsKey =
m_session->GetFunctionFilename(pFunctionName, pFieldName, domain);
909 if (
m_session->GetComm()->GetRank() == 0)
912 cout <<
"Interpolating: ";
914 ptsField->CalcWeights(coords);
915 if (
m_session->GetComm()->GetRank() == 0)
923 ptsField->Interpolate(intFields);
926 vector<string> fieldNames = ptsField->GetFieldNames();
927 for (fieldInd = 0; fieldInd < fieldNames.size(); ++fieldInd)
929 if (ptsField->GetFieldName(fieldInd) == pFieldName)
934 ASSERTL0(fieldInd != fieldNames.size(),
"field not found");
936 pArray = intFields[fieldInd];
949 std::string pFieldName,
950 const std::string &pFunctionName,
954 "Function '" + pFunctionName +
"' does not exist.");
959 vType =
m_session->GetFunctionType(pFunctionName, pFieldName);
963 =
m_session->GetFunction(pFunctionName, pFieldName,domain);
964 retVal = ffunc->GetExpression();
969 =
m_session->GetFunctionFilename(pFunctionName, pFieldName,domain);
970 retVal =
"from file " + filename;
984 int nvariables =
m_fields.num_elements();
985 for (
int i = 0; i < nvariables; ++i)
988 m_fields[i]->EvaluateBoundaryConditions(time, varName);
1008 if (
m_fields[field]->GetPhysState() ==
false)
1014 if (exactsoln.num_elements())
1018 else if (
m_session->DefinesFunction(
"ExactSolution"))
1024 "ExactSolution",
m_time);
1033 if (Normalised ==
true)
1041 L2error = sqrt(L2error*L2error/Vol);
1067 if (
m_fields[field]->GetPhysState() ==
false)
1073 if (exactsoln.num_elements())
1077 else if (
m_session->DefinesFunction(
"ExactSolution"))
1083 "ExactSolution",
m_time);
1096 Linferror = L2INF[1];
1135 int ErrorCoordim = ErrorExp->GetCoordim(0);
1136 int ErrorNq = ErrorExp->GetTotPoints();
1142 switch(ErrorCoordim)
1145 ErrorExp->GetCoords(ErrorXc0);
1148 ErrorExp->GetCoords(ErrorXc0, ErrorXc1);
1151 ErrorExp->GetCoords(ErrorXc0, ErrorXc1, ErrorXc2);
1155 m_session->GetFunction(
"ExactSolution", field);
1160 exSol->Evaluate(ErrorXc0,ErrorXc1,ErrorXc2,
m_time,ErrorSol);
1164 ErrorExp->BwdTrans_IterPerExp(
m_fields[field]->GetCoeffs(),
1165 ErrorExp->UpdatePhys());
1167 L2INF[0] = ErrorExp->L2 (ErrorExp->GetPhys(), ErrorSol);
1168 L2INF[1] = ErrorExp->Linf(ErrorExp->GetPhys(), ErrorSol);
1181 bool dumpInitialConditions,
1184 if (
m_session->GetComm()->GetRank() == 0)
1186 cout <<
"Initial Conditions:" << endl;
1189 if (
m_session->DefinesFunction(
"InitialConditions"))
1192 "InitialConditions",
m_time, domain);
1194 if (
m_session->GetComm()->GetRank() == 0)
1197 for (
int i = 0; i <
m_fields.num_elements(); ++i)
1199 std::string varName =
m_session->GetVariable(i);
1200 cout <<
" - Field " << varName <<
": "
1208 int nq =
m_fields[0]->GetNpoints();
1209 for (
int i = 0; i <
m_fields.num_elements(); i++)
1215 if (
m_session->GetComm()->GetRank() == 0)
1217 cout <<
" - Field " <<
m_session->GetVariable(i)
1218 <<
": 0 (default)" << endl;
1237 "ExactSolution array size mismatch.");
1238 Vmath::Zero(outfield.num_elements(), outfield, 1);
1239 if (
m_session->DefinesFunction(
"ExactSolution"))
1242 "ExactSolution", time);
1260 std::vector<std::string> vel;
1261 vel.push_back(
"Vx");
1262 vel.push_back(
"Vy");
1263 vel.push_back(
"Vz");
1276 int nvariables =
m_session->GetVariables().size();
1285 for(i = 0; i <
m_base.num_elements(); i++)
1305 for (i = 0 ; i <
m_base.num_elements(); i++)
1309 ::AllocateSharedPtr(
1314 m_base[i]->SetWaveSpace(
true);
1326 for (i = 0 ; i <
m_base.num_elements(); i++)
1330 ::AllocateSharedPtr(
1335 m_base[i]->SetWaveSpace(
true);
1346 for (i = 0 ; i <
m_base.num_elements(); i++)
1350 ::AllocateSharedPtr(
1355 m_base[i]->SetWaveSpace(
false);
1368 for (i = 1 ; i < m_base.num_elements(); i++)
1385 for (i = 1 ; i < m_base.num_elements(); i++)
1394 ASSERTL0(
false,
"Expansion dimension not recognised");
1406 for(i = 0 ; i <
m_base.num_elements(); i++)
1417 for(i = 0 ; i <
m_base.num_elements(); i++)
1429 ASSERTL0(
false,
"Expansion dimension not recognised");
1437 std::string pInfile,
1440 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
1441 std::vector<std::vector<NekDouble> > FieldData;
1444 m_fld->Import(pInfile,FieldDef,FieldData);
1446 int nvar =
m_session->GetVariables().size();
1447 if (
m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
1449 std::string HomoStr =
m_session->GetSolverInfo(
"HOMOGENEOUS");
1452 for (
int j = 0; j < nvar; ++j)
1454 for(
int i = 0; i < FieldDef.size(); ++i)
1456 bool flag = FieldDef[i]->m_fields[j] ==
1458 ASSERTL0(flag, (std::string(
"Order of ") + pInfile
1459 + std::string(
" data and that defined in "
1460 "the session differs")).c_str());
1462 m_base[j]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
1464 m_base[j]->UpdateCoeffs());
1525 for (
int i = 0; i <
m_fields.num_elements(); i++)
1537 for (
int i = 0; i <
m_fields.num_elements(); i++)
1559 m_fields[0]->IProductWRTDerivBase(F,outarray);
1573 int ndim = F.num_elements();
1574 int nPointsTot =
m_fields[0]->GetNpoints();
1579 for (
int i = 0; i < ndim; ++i)
1586 m_fields[0]->IProductWRTBase(div, outarray);
1603 int ndim = V.num_elements();
1605 int nPointsTot =
m_fields[0]->GetNpoints();
1613 m_fields[0]->IProductWRTBase(tmp, outarray,
1618 m_fields[0]->IProductWRTBase_IterPerExp(tmp, outarray);
1636 int ndim = V.num_elements();
1641 int nPointsTot =
m_fields[0]->GetNpoints();
1645 if (wk.num_elements())
1659 Vmath::Vmul(nPointsTot, grad0, 1, V[0], 1, outarray,1);
1663 m_fields[0]->PhysDeriv(u, grad0, grad1);
1664 Vmath::Vmul (nPointsTot, grad0, 1, V[0], 1, outarray, 1);
1666 outarray, 1, outarray, 1);
1671 m_fields[0]->PhysDeriv(u,grad0,grad1,grad2);
1672 Vmath::Vmul (nPointsTot, grad0, 1, V[0], 1, outarray, 1);
1674 outarray, 1, outarray, 1);
1676 outarray, 1, outarray, 1);
1679 ASSERTL0(
false,
"dimension unknown");
1696 bool NumericalFluxIncludesNormal,
1697 bool InFieldIsInPhysSpace,
1708 nvariables =
m_fields.num_elements();
1714 for(i = 0; i < nVelDim; ++i)
1721 if (InFieldIsInPhysSpace ==
true)
1723 for (i = 0; i < nvariables; ++i)
1725 physfield[i] = InField[i];
1731 for(i = 0; i < nvariables; ++i)
1735 m_fields[i]->BwdTrans(InField[i],physfield[i]);
1740 for (i = 0; i < nvariables; ++i)
1752 if (NumericalFluxIncludesNormal ==
true)
1756 for (i = 0; i < nvariables; ++i)
1766 for (i = 0; i < nvariables; ++i)
1769 m_fields[i]->AddTraceIntegral(numflux[i],OutField[i]);
1780 for (i = 0; i < nvariables; ++i)
1791 for(i = 0; i < nvariables; ++i)
1794 m_fields[i]->AddTraceIntegral(numfluxX[i], numfluxY[i],
1810 bool NumericalFluxIncludesNormal,
1811 bool InFieldIsInPhysSpace)
1817 int nvariables =
m_fields.num_elements();
1829 for (j = 0; j < nqvar; ++j)
1834 for (i = 0; i< nvariables; ++i)
1848 if (InFieldIsInPhysSpace ==
true)
1850 for (i = 0; i < nvariables; ++i)
1852 ufield[i] = InField[i];
1858 for (i = 0; i < nvariables; ++i)
1862 m_fields[i]->BwdTrans(InField[i],ufield[i]);
1872 for (j = 0; j < nqvar; ++j)
1874 for (i = 0; i < nvariables; ++i)
1884 ufield[i], 1, fluxvector[k], 1);
1896 m_fields[i]->AddTraceIntegral(flux[j][i], qcoeffs);
1911 m_fields[i]->MultiplyByElmtInvMass(qcoeffs, qcoeffs);
1914 m_fields[i]->BwdTrans(qcoeffs, qfield[j][i]);
1926 for (i = 0; i < nvariables; ++i)
1934 for (j = 0; j < nqvar; ++j)
1939 qfield[j][i], 1, fluxvector[k], 1);
1960 m_fields[i]->AddTraceIntegral(flux[0][i], OutField[i]);
1972 boost::lexical_cast<std::string>(n);
1985 std::vector<std::string> &variables)
1987 char chkout[16] =
"";
1988 sprintf(chkout,
"%d", n);
1989 std::string outname =
m_sessionName +
"_" + chkout +
".chk";
1990 WriteFld(outname, field, fieldcoeffs, variables);
2000 boost::lexical_cast<std::string>(n);
2011 std::vector<Array<OneD, NekDouble> > fieldcoeffs(
2013 std::vector<std::string> variables(
m_fields.num_elements());
2015 for (
int i = 0; i <
m_fields.num_elements(); ++i)
2019 fieldcoeffs[i] =
m_fields[i]->UpdateCoeffs();
2047 const std::string &outname,
2050 std::vector<std::string> &variables)
2052 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
2053 = field->GetFieldDefinitions();
2054 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
2057 for(
int j = 0; j < fieldcoeffs.size(); ++j)
2059 for(
int i = 0; i < FieldDef.size(); ++i)
2062 FieldDef[i]->m_fields.push_back(variables[j]);
2063 field->AppendFieldData(FieldDef[i], FieldData[i],
2081 mapping->Output( fieldMetaDataMap, outname);
2083 m_fld->Write(outname, FieldDef, FieldData, fieldMetaDataMap);
2094 const std::string &infile,
2097 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
2098 std::vector<std::vector<NekDouble> > FieldData;
2100 m_fld->Import(infile,FieldDef,FieldData);
2103 for(
int j = 0; j < pFields.num_elements(); ++j)
2106 pFields[j]->UpdateCoeffs(),1);
2108 for(
int i = 0; i < FieldDef.size(); ++i)
2112 std::string(
"Order of ") + infile
2113 + std::string(
" data and that defined in "
2114 "m_boundaryconditions differs"));
2116 pFields[j]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
2118 pFields[j]->UpdateCoeffs());
2120 pFields[j]->BwdTrans(pFields[j]->GetCoeffs(),
2121 pFields[j]->UpdatePhys());
2135 const std::string &infile,
2139 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
2140 std::vector<std::vector<NekDouble> > FieldData;
2146 ASSERTL0(ndomains*nvariables == pFields.num_elements(),
"Number of fields does not match the number of variables and domains");
2149 for(
int j = 0; j < ndomains; ++j)
2151 for(
int i = 0; i < nvariables; ++i)
2155 for(
int n = 0; n < FieldDef.size(); ++n)
2158 std::string(
"Order of ") + infile
2159 + std::string(
" data and that defined in "
2160 "m_boundaryconditions differs"));
2162 pFields[j*nvariables+i]->ExtractDataToCoeffs(FieldDef[n], FieldData[n],
2164 pFields[j*nvariables+i]->UpdateCoeffs());
2166 pFields[j*nvariables+i]->BwdTrans(pFields[j*nvariables+i]->GetCoeffs(),
2167 pFields[j*nvariables+i]->UpdatePhys());
2178 const std::string &infile,
2180 std::string &pFieldName)
2182 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
2183 std::vector<std::vector<NekDouble> > FieldData;
2185 m_fld->Import(infile,FieldDef,FieldData);
2188 Vmath::Zero(pField->GetNcoeffs(),pField->UpdateCoeffs(),1);
2190 for(
int i = 0; i < FieldDef.size(); ++i)
2193 for(
int j = 0; j < FieldData.size(); ++j)
2195 if (FieldDef[i]->
m_fields[j] == pFieldName)
2200 ASSERTL1(idx >= 0,
"Field " + pFieldName +
" not found.");
2202 pField->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
2204 pField->UpdateCoeffs());
2206 pField->BwdTrans(pField->GetCoeffs(), pField->UpdatePhys());
2217 const std::string &infile,
2218 std::vector< std::string> &fieldStr,
2222 ASSERTL0(fieldStr.size() <= coeffs.num_elements(),
2223 "length of fieldstr should be the same as pFields");
2225 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
2226 std::vector<std::vector<NekDouble> > FieldData;
2228 m_fld->Import(infile,FieldDef,FieldData);
2231 for(
int j = 0; j < fieldStr.size(); ++j)
2233 Vmath::Zero(coeffs[j].num_elements(),coeffs[j],1);
2234 for(
int i = 0; i < FieldDef.size(); ++i)
2236 m_fields[0]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
2237 fieldStr[j], coeffs[j]);
2253 if (
m_session->GetComm()->GetSize() > 1)
2294 if (
m_session->DefinesSolverInfo(
"UpwindType"))
2297 m_session->GetSolverInfo(
"UpwindType"));
2300 if (
m_session->DefinesSolverInfo(
"AdvectionType"))
2302 std::string AdvectionType;
2303 AdvectionType =
m_session->GetSolverInfo(
"AdvectionType");
2305 GetClassDescription(AdvectionType));
2319 "Mixed Continuous Galerkin and Discontinuous");
2322 if (
m_session->DefinesSolverInfo(
"DiffusionType"))
2324 std::string DiffusionType;
2325 DiffusionType =
m_session->GetSolverInfo(
"DiffusionType");
2327 GetClassDescription(DiffusionType));
2344 string::const_iterator it1=s1.begin();
2345 string::const_iterator it2=s2.begin();
2348 while ( (it1!=s1.end()) && (it2!=s2.end()) )
2350 if(::toupper(*it1) != ::toupper(*it2))
2353 return (::toupper(*it1) < ::toupper(*it2)) ? -1 : 1;
2361 size_t size1=s1.size();
2362 size_t size2=s2.size();
2370 return (size1 < size2) ? -1 : 1;
2383 ASSERTL0(
false,
"v_GetFluxVector: This function is not valid "
2384 "for the Base class");
2388 const int i,
const int j,
2392 ASSERTL0(
false,
"v_GetqFluxVector: This function is not valid "
2393 "for the Base class");
2402 ASSERTL0(
false,
"v_GetFluxVector: This function is not valid "
2403 "for the Base class");
2410 ASSERTL0(
false,
"v_NumericalFlux: This function is not valid "
2411 "for the Base class");
2419 ASSERTL0(
false,
"v_NumericalFlux: This function is not valid "
2420 "for the Base class");
2427 ASSERTL0(
false,
"v_NumFluxforScalar: This function is not valid "
2428 "for the Base class");
2436 ASSERTL0(
false,
"v_NumFluxforVector: This function is not valid "
2437 "for the Base class");
2442 ASSERTL0(
false,
"This function is not valid for the Base class");
2449 std::vector<std::string> &variables)
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary(SummaryList &l)
Virtual function for generating summary information.
bool m_singleMode
Flag to determine if single homogeneous mode is used.
SOLVER_UTILS_EXPORT void NumFluxforScalar(const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
f SOLVER_UTILS_EXPORT void AdvectionNonConservativeForm(const Array< OneD, Array< OneD, NekDouble > > &V, const Array< OneD, const NekDouble > &u, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wk=NullNekDouble1DArray)
Compute the non-conservative advection.
#define ASSERTL0(condition, msg)
SOLVER_UTILS_EXPORT void InitialiseBaseFlow(Array< OneD, Array< OneD, NekDouble > > &base)
Perform initialisation of the base flow.
LibUtilities::NekFactory< std::string, EquationSystem, const LibUtilities::SessionReaderSharedPtr & > EquationSystemFactory
Datatype of the NekFactory used to instantiate classes derived from the EquationSystem class...
SOLVER_UTILS_EXPORT std::string DescribeFunction(std::string pFieldName, const std::string &pFunctionName, const int domain)
Provide a description of a function for a given field name.
static boost::shared_ptr< MeshGraph > Read(const LibUtilities::SessionReaderSharedPtr &pSession, DomainRangeShPtr &rng=NullDomainRangeShPtr)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
NekDouble m_time
Current time of simulation.
SOLVER_UTILS_EXPORT void WeakAdvectionNonConservativeForm(const Array< OneD, Array< OneD, NekDouble > > &V, const Array< OneD, const NekDouble > &u, Array< OneD, NekDouble > &outarray, bool UseContCoeffs=false)
Compute the inner product .
NekDouble m_timestep
Time step size.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
SOLVER_UTILS_EXPORT int NoCaseStringCompare(const std::string &s1, const std::string &s2)
Perform a case-insensitive string comparison.
std::vector< std::pair< std::string, std::string > > SummaryList
SOLVER_UTILS_EXPORT int GetNvariables()
bool m_halfMode
Flag to determine if half homogeneous mode is used.
NekDouble m_LhomZ
physical length in Z direction (if homogeneous)
virtual SOLVER_UTILS_EXPORT NekDouble v_L2Error(unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray, bool Normalised=false)
Virtual function for the L_2 error computation between fields and a given exact solution.
Array< OneD, bool > m_checkIfSystemSingular
Flag to indicate if the fields should be checked for singularity.
int m_expdim
Expansion dimension.
SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n)
Write checkpoint file of m_fields.
DiffusionFactory & GetDiffusionFactory()
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
Principle Modified Functions .
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > ErrorExtraPoints(unsigned int field)
Compute error (L2 and L_inf) over an larger set of quadrature points return [L2 Linf].
SOLVER_UTILS_EXPORT void WeakAdvectionGreensDivergenceForm(const Array< OneD, Array< OneD, NekDouble > > &F, Array< OneD, NekDouble > &outarray)
Compute the inner product .
NekDouble m_checktime
Time between checkpoints.
bool m_useFFT
Flag to determine if FFT is used for homogeneous transform.
NekDouble m_LhomY
physical length in Y direction (if homogeneous)
boost::shared_ptr< ContField2D > ContField2DSharedPtr
bool m_specHP_dealiasing
Flag to determine if dealisising is usde for the Spectral/hp element discretisation.
SOLVER_UTILS_EXPORT int GetNumExpModes()
virtual SOLVER_UTILS_EXPORT void v_ExtraFldOutput(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
SOLVER_UTILS_EXPORT void PrintProgressbar(const int position, const int goal) const
virtual SOLVER_UTILS_EXPORT NekDouble v_LinfError(unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
Virtual function for the L_inf error computation between fields and a given exact solution...
int m_npointsZ
number of points in Z direction (if homogeneous)
virtual SOLVER_UTILS_EXPORT ~EquationSystem()
Destructor.
std::string m_sessionName
Name of the session.
int m_nchk
Number of checkpoints written so far.
SOLVER_UTILS_EXPORT void WeakAdvectionDivergenceForm(const Array< OneD, Array< OneD, NekDouble > > &F, Array< OneD, NekDouble > &outarray)
Compute the inner product .
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
std::map< std::string, std::string > FieldMetaDataMap
int m_checksteps
Number of steps between checkpoints.
std::map< std::string, Array< OneD, Array< OneD, float > > > m_interpWeights
Map of the interpolation weights for a specific filename.
boost::shared_ptr< PtsField > PtsFieldSharedPtr
LibUtilities::CommSharedPtr m_comm
Communicator.
void Import(const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, FieldMetaDataMap &fieldinfomap, const Array< OneD, int > ElementiDs)
Imports an FLD file.
Gauss Radau pinned at x=-1, .
NekDouble m_fintime
Finish time of the simulation.
virtual SOLVER_UTILS_EXPORT void v_InitObject()
Initialisation object for EquationSystem.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_tanbasis
2 x m_spacedim x nq
int m_steps
Number of steps to take.
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
int m_HomoDirec
number of homogenous directions
SOLVER_UTILS_EXPORT void FwdTransFields()
SOLVER_UTILS_EXPORT void WeakDGDiffusion(const Array< OneD, Array< OneD, NekDouble > > &InField, Array< OneD, Array< OneD, NekDouble > > &OutField, bool NumericalFluxIncludesNormal=true, bool InFieldIsInPhysSpace=false)
Calculate weak DG Diffusion in the LDG form.
1D Evenly-spaced points using Fourier Fit
bool m_multipleModes
Flag to determine if use multiple homogenenous modes are used.
Fourier Modified expansions with just the real part of the first mode .
virtual SOLVER_UTILS_EXPORT Array< OneD, bool > v_GetSystemSingularChecks()
SOLVER_UTILS_EXPORT void NumericalFlux(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numflux)
SOLVER_UTILS_EXPORT void SetUpBaseFields(SpatialDomains::MeshGraphSharedPtr &mesh)
This class is the abstraction of a global continuous two- dimensional spectral/hp element expansion w...
int m_npointsY
number of points in Y direction (if homogeneous)
Abstraction of a global continuous one-dimensional spectral/hp element expansion which approximates t...
NekMatrix< NekMatrix< NekMatrix< NekDouble, StandardMatrixTag >, ScaledMatrixTag >, BlockMatrixTag > DNekScalBlkMat
virtual SOLVER_UTILS_EXPORT void v_TransPhysToCoeff()
Virtual function for transformation to coefficient space.
virtual SOLVER_UTILS_EXPORT void v_GetFluxVector(const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
Principle Modified Functions .
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
virtual SOLVER_UTILS_EXPORT void v_Output(void)
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
Pointer to boundary conditions object.
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
int m_spacedim
Spatial dimension (>= expansion dim).
This class is the abstraction of a global discontinuous two- dimensional spectral/hp element expansio...
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
Map to identify relevant solver info to dump in output fields.
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
Defines a specification for a set of points.
void Neg(int n, T *x, const int incx)
Negate x = -x.
virtual SOLVER_UTILS_EXPORT void v_SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
std::set< std::string > m_loadedFields
SOLVER_UTILS_EXPORT void GetFluxVector(const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
boost::shared_ptr< ExpList2D > ExpList2DSharedPtr
Shared pointer to an ExpList2D object.
SOLVER_UTILS_EXPORT void EvaluateFunction(Array< OneD, Array< OneD, NekDouble > > &pArray, std::string pFunctionName, const NekDouble pTime=0.0, const int domain=0)
Evaluates a function as specified in the session file.
GLOBAL_MAPPING_EXPORT typedef boost::shared_ptr< Mapping > MappingSharedPtr
A shared pointer to a Mapping object.
void Import(const string &inFile, PtsFieldSharedPtr &ptsField, FieldMetaDataMap &fieldmetadatamap=NullFieldMetaDataMap)
Import a pts field from file.
boost::shared_ptr< Equation > EquationSharedPtr
virtual SOLVER_UTILS_EXPORT void v_DoInitialise()
Virtual function for initialisation implementation.
bool m_homogen_dealiasing
Flag to determine if dealiasing is used for homogeneous simulations.
EquationSystemFactory & GetEquationSystemFactory()
Fourier Modified expansions with just the imaginary part of the first mode .
SOLVER_UTILS_EXPORT void ImportFldToMultiDomains(const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const int ndomains)
Input field data from the given file to multiple domains.
SOLVER_UTILS_EXPORT void SetBoundaryConditions(NekDouble time)
Evaluates the boundary conditions at the given time.
std::map< std::string, Array< OneD, Array< OneD, unsigned int > > > m_interpInds
Map of the interpolation indices for a specific filename.
MultiRegions::Direction const DirCartesianMap[]
SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname)
Write field data to the given filename.
SOLVER_UTILS_EXPORT int GetNpoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
Fourier ModifiedExpansion with just the first mode .
Array< OneD, MultiRegions::ExpListSharedPtr > m_base
Base fields.
SOLVER_UTILS_EXPORT int GetTraceNpoints()
SOLVER_UTILS_EXPORT int GetNcoeffs()
1D Non Evenly-spaced points for Single Mode analysis
LibUtilities::FieldIOSharedPtr m_fld
Field input/output.
virtual SOLVER_UTILS_EXPORT void v_NumFluxforVector(const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
virtual SOLVER_UTILS_EXPORT bool v_NegatedOp()
Virtual function to identify if operator is negated in DoSolve.
virtual SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr v_GetPressure(void)
SOLVER_UTILS_EXPORT void NumFluxforVector(const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
SOLVER_UTILS_EXPORT void ZeroPhysFields()
SOLVER_UTILS_EXPORT void SessionSummary(SummaryList &vSummary)
Write out a session summary.
SpatialDomains::MeshGraphSharedPtr m_graph
Pointer to graph defining mesh.
virtual SOLVER_UTILS_EXPORT void v_NumFluxforScalar(const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
SOLVER_UTILS_EXPORT void WeakDGAdvection(const Array< OneD, Array< OneD, NekDouble > > &InField, Array< OneD, Array< OneD, NekDouble > > &OutField, bool NumericalFluxIncludesNormal=true, bool InFieldIsInPhysSpace=false, int nvariables=0)
Calculate the weak discontinuous Galerkin advection.
Used to lookup the create function in NekManager.
SOLVER_UTILS_EXPORT void Checkpoint_BaseFlow(const int n)
Write base flow file of m_fields.
SOLVER_UTILS_EXPORT void ImportFldBase(std::string pInfile, SpatialDomains::MeshGraphSharedPtr pGraph)
virtual SOLVER_UTILS_EXPORT void v_DoSolve()
Virtual function for solve implementation.
boost::shared_ptr< ContField3D > ContField3DSharedPtr
void Zero(int n, T *x, const int incx)
Zero vector.
int m_NumQuadPointsError
Number of Quadrature points used to work out the error.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
static FieldMetaDataMap NullFieldMetaDataMap
NekMatrix< NekMatrix< NekDouble, StandardMatrixTag >, ScaledMatrixTag > DNekScalMat
static GLOBAL_MAPPING_EXPORT MappingSharedPtr Load(const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
Return a pointer to the mapping, creating it on first call.
virtual SOLVER_UTILS_EXPORT void v_EvaluateExactSolution(unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
virtual SOLVER_UTILS_EXPORT void v_TransCoeffToPhys()
Virtual function for transformation to physical space.
Describes the specification for a Basis.
virtual SOLVER_UTILS_EXPORT void v_NumericalFlux(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numflux)
enum HomogeneousType m_HomogeneousType
1D Gauss-Lobatto-Legendre quadrature points
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Provides a generic Factory class.
SOLVER_UTILS_EXPORT void ImportFld(const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
Input field data from the given file.