55 #include <boost/format.hpp>
86 Loki::NoDestroy > Type;
87 return Type::Instance();
97 : m_comm (pSession->GetComm()),
136 if (
m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
138 std::string HomoStr =
m_session->GetSolverInfo(
"HOMOGENEOUS");
141 if ((HomoStr ==
"HOMOGENEOUS1D") || (HomoStr ==
"Homogeneous1D")
142 || (HomoStr ==
"1D") || (HomoStr ==
"Homo1D"))
148 if(
m_session->DefinesSolverInfo(
"ModeType"))
150 m_session->MatchSolverInfo(
"ModeType",
"SingleMode",
152 m_session->MatchSolverInfo(
"ModeType",
"HalfMode",
154 m_session->MatchSolverInfo(
"ModeType",
"MultipleModes",
159 if (
m_session->DefinesSolverInfo(
"ModeType"))
175 ASSERTL0(
false,
"SolverInfo ModeType not valid");
184 if ((HomoStr ==
"HOMOGENEOUS2D") || (HomoStr ==
"Homogeneous2D")
185 || (HomoStr ==
"2D") || (HomoStr ==
"Homo2D"))
195 if ((HomoStr ==
"HOMOGENEOUS3D") || (HomoStr ==
"Homogeneous3D")
196 || (HomoStr ==
"3D") || (HomoStr ==
"Homo3D"))
208 m_session->MatchSolverInfo(
"DEALIASING",
"True",
212 m_session->MatchSolverInfo(
"DEALIASING",
"On",
223 m_session->MatchSolverInfo(
"SPECTRALHPDEALIASING",
"True",
227 m_session->MatchSolverInfo(
"SPECTRALHPDEALIASING",
"On",
233 if (
m_session->DefinesSolverInfo(
"PROJECTION"))
235 std::string ProjectStr =
m_session->GetSolverInfo(
"PROJECTION");
237 if ((ProjectStr ==
"Continuous") || (ProjectStr ==
"Galerkin") ||
238 (ProjectStr ==
"CONTINUOUS") || (ProjectStr ==
"GALERKIN"))
242 else if ((ProjectStr ==
"MixedCGDG") ||
243 (ProjectStr ==
"Mixed_CG_Discontinuous"))
247 else if(ProjectStr ==
"DisContinuous")
253 ASSERTL0(
false,
"PROJECTION value not recognised");
258 cerr <<
"Projection type not specified in SOLVERINFO,"
259 "defaulting to continuous Galerkin" << endl;
267 int nvariables =
m_session->GetVariables().size();
268 bool DeclareCoeffPhysArrays =
true;
271 m_fields = Array<OneD, MultiRegions::ExpListSharedPtr>(nvariables);
273 m_expdim = m_graph->GetMeshDimension();
295 for (i = 0; i <
m_fields.num_elements(); i++)
308 for (i = 0; i <
m_fields.num_elements(); i++)
335 for(i = 0; i <
m_fields.num_elements(); i++)
363 for (i = 0; i <
m_fields.num_elements(); i++)
365 if(
m_session->GetVariable(i).compare(
"w")
401 for (i = 0; i <
m_fields.num_elements(); i++)
422 DeclareCoeffPhysArrays,
425 for (i = 1; i < m_fields.num_elements(); i++)
428 SameExpansions(
m_session->GetVariable(0),
433 *firstfield, m_graph,
435 DeclareCoeffPhysArrays,
444 DeclareCoeffPhysArrays,
454 Array<OneD, Array<OneD, NekDouble> >
463 m_fields[0]->GetTrace()->
481 for (i = 1; i < m_fields.num_elements(); i++)
483 if(m_graph->SameExpansions(
489 *firstfield, m_graph,
508 Array<OneD, Array<OneD, NekDouble> >
518 for(i = 1; i < m_fields.num_elements(); ++i)
520 m_fields[i]->GetTrace();
526 ASSERTL0(
false,
"Expansion dimension not recognised");
549 for (i = 0; i <
m_fields.num_elements(); i++)
562 for (i = 0; i <
m_fields.num_elements(); i++)
582 for (i = 0; i <
m_fields.num_elements(); i++)
594 for (i = 0; i <
m_fields.num_elements(); i++)
610 "3D fully periodic problems not implemented yet");
614 for (i = 0; i <
m_fields.num_elements(); i++)
625 ASSERTL0(
false,
"Expansion dimension not recognised");
631 Array<OneD, Array<OneD, NekDouble> >(
m_spacedim);
649 m_session->LoadParameter(
"NumQuadPointsError",
674 Array<
OneD, Array<OneD, NekDouble> >& pArray,
675 std::string pFunctionName,
680 "Function '" + pFunctionName +
"' does not exist.");
682 std::vector<std::string> vFieldNames =
m_session->GetVariables();
684 for(
int i = 0 ; i < vFieldNames.size(); i++)
697 std::vector<std::string> pFieldNames,
698 Array<
OneD, Array<OneD, NekDouble> > &pFields,
699 const std::string& pFunctionName,
702 ASSERTL1(pFieldNames.size() == pFields.num_elements(),
703 "Function '" + pFunctionName
704 +
"' variable list size mismatch with array storage.");
706 "Function '" + pFunctionName +
"' does not exist.");
708 for(
int i = 0; i < pFieldNames.size(); i++)
720 std::vector<std::string> pFieldNames,
721 Array<OneD, MultiRegions::ExpListSharedPtr> &pFields,
722 const std::string& pFunctionName,
726 "Function '" + pFunctionName +
"' does not exist.");
727 ASSERTL0(pFieldNames.size() == pFields.num_elements(),
728 "Field list / name list size mismatch.");
730 for(
int i = 0; i < pFieldNames.size(); i++)
733 pFunctionName, 0.0, domain);
734 pFields[i]->FwdTrans_IterPerExp(pFields[i]->GetPhys(),
735 pFields[i]->UpdateCoeffs());
742 std::string pFieldName,
743 Array<OneD, NekDouble>& pArray,
744 const std::string& pFunctionName,
749 "Function '" + pFunctionName +
"' does not exist.");
751 unsigned int nq =
m_fields[0]->GetNpoints();
752 if (pArray.num_elements() < nq)
754 pArray = Array<OneD, NekDouble>(nq);
758 vType =
m_session->GetFunctionType(pFunctionName, pFieldName,domain);
761 Array<OneD,NekDouble> x0(nq);
762 Array<OneD,NekDouble> x1(nq);
763 Array<OneD,NekDouble> x2(nq);
769 =
m_session->GetFunction(pFunctionName, pFieldName,domain);
771 ffunc->Evaluate(x0,x1,x2,pTime,pArray);
776 std::string filename =
m_session->GetFunctionFilename(
777 pFunctionName, pFieldName, domain);
778 std::string fileVar =
m_session->GetFunctionFilenameVariable(
779 pFunctionName, pFieldName, domain);
781 if (fileVar.length() == 0)
783 fileVar = pFieldName;
786 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
787 std::vector<std::vector<NekDouble> > FieldData;
791 int numexp =
m_fields[0]->GetExpSize();
792 Array<OneD,int> ElementGIDs(numexp);
795 for(
int i = 0; i < numexp; ++i)
797 ElementGIDs[i] =
m_fields[0]->GetExp(i)->GetGeom()->GetGlobalID();
804 filename = boost::str(boost::format(filename) %
m_time);
808 ASSERTL0(
false,
"Invalid Filename in function \""
809 + pFunctionName +
"\", variable \"" + fileVar +
"\"")
813 m_fld->Import(filename, FieldDef, FieldData,
820 for (
int i = 0; i < FieldDef.size(); ++i)
824 for(
int j = 0; j < FieldDef[i]->m_fields.size(); ++j)
826 if (FieldDef[i]->
m_fields[j] == fileVar)
835 FieldDef[i], FieldData[i],
836 FieldDef[i]->
m_fields[idx], vCoeffs);
840 cout <<
"Field " + fileVar +
" not found." << endl;
844 m_fields[0]->BwdTrans_IterPerExp(vCoeffs, pArray);
855 std::string pFieldName,
856 const std::string &pFunctionName,
860 "Function '" + pFunctionName +
"' does not exist.");
865 vType =
m_session->GetFunctionType(pFunctionName, pFieldName);
869 =
m_session->GetFunction(pFunctionName, pFieldName,domain);
870 retVal = ffunc->GetExpression();
875 =
m_session->GetFunctionFilename(pFunctionName, pFieldName,domain);
876 retVal =
"from file " + filename;
890 int nvariables =
m_fields.num_elements();
891 for (
int i = 0; i < nvariables; ++i)
894 m_fields[i]->EvaluateBoundaryConditions(time, varName);
907 const Array<OneD, NekDouble> &exactsoln,
914 if (
m_fields[field]->GetPhysState() ==
false)
920 if (exactsoln.num_elements())
924 else if (
m_session->DefinesFunction(
"ExactSolution"))
926 Array<OneD, NekDouble>
939 if (Normalised ==
true)
947 L2error = sqrt(L2error*L2error/Vol);
952 Array<OneD,NekDouble> L2INF(2);
967 const Array<OneD, NekDouble> &exactsoln)
973 if (
m_fields[field]->GetPhysState() ==
false)
979 if (exactsoln.num_elements())
983 else if (
m_session->DefinesFunction(
"ExactSolution"))
985 Array<OneD, NekDouble>
1000 Array<OneD,NekDouble> L2INF(2);
1002 Linferror = L2INF[1];
1018 Array<OneD,NekDouble> L2INF(2);
1041 int ErrorCoordim = ErrorExp->GetCoordim(0);
1042 int ErrorNq = ErrorExp->GetTotPoints();
1044 Array<OneD,NekDouble> ErrorXc0(ErrorNq, 0.0);
1045 Array<OneD,NekDouble> ErrorXc1(ErrorNq, 0.0);
1046 Array<OneD,NekDouble> ErrorXc2(ErrorNq, 0.0);
1048 switch(ErrorCoordim)
1051 ErrorExp->GetCoords(ErrorXc0);
1054 ErrorExp->GetCoords(ErrorXc0, ErrorXc1);
1057 ErrorExp->GetCoords(ErrorXc0, ErrorXc1, ErrorXc2);
1061 m_session->GetFunction(
"ExactSolution", field);
1064 Array<OneD,NekDouble> ErrorSol(ErrorNq);
1066 exSol->Evaluate(ErrorXc0,ErrorXc1,ErrorXc2,
m_time,ErrorSol);
1070 ErrorExp->BwdTrans_IterPerExp(
m_fields[field]->GetCoeffs(),
1071 ErrorExp->UpdatePhys());
1073 L2INF[0] = ErrorExp->L2 (ErrorExp->GetPhys(), ErrorSol);
1074 L2INF[1] = ErrorExp->Linf(ErrorExp->GetPhys(), ErrorSol);
1087 bool dumpInitialConditions,
1090 if (
m_session->GetComm()->GetRank() == 0)
1092 cout <<
"Initial Conditions:" << endl;
1095 if (
m_session->DefinesFunction(
"InitialConditions"))
1098 "InitialConditions",domain);
1100 if (
m_session->GetComm()->GetRank() == 0)
1103 for (
int i = 0; i <
m_fields.num_elements(); ++i)
1105 std::string varName =
m_session->GetVariable(i);
1106 cout <<
" - Field " << varName <<
": "
1114 int nq =
m_fields[0]->GetNpoints();
1115 for (
int i = 0; i <
m_fields.num_elements(); i++)
1121 if (
m_session->GetComm()->GetRank() == 0)
1123 cout <<
" - Field " <<
m_session->GetVariable(i)
1124 <<
": 0 (default)" << endl;
1139 Array<OneD, NekDouble> &outfield,
1143 "ExactSolution array size mismatch.");
1144 Vmath::Zero(outfield.num_elements(), outfield, 1);
1145 if (
m_session->DefinesFunction(
"ExactSolution"))
1148 "ExactSolution", time);
1163 Array<
OneD, Array<OneD, NekDouble> > &base)
1165 base = Array<OneD, Array<OneD, NekDouble> >(
m_spacedim);
1166 std::vector<std::string> vel;
1167 vel.push_back(
"Vx");
1168 vel.push_back(
"Vy");
1169 vel.push_back(
"Vz");
1182 int nvariables =
m_session->GetVariables().size();
1183 m_base = Array<OneD, MultiRegions::ExpListSharedPtr>(nvariables);
1191 for(i = 0; i <
m_base.num_elements(); i++)
1211 for (i = 0 ; i <
m_base.num_elements(); i++)
1215 ::AllocateSharedPtr(
1220 m_base[i]->SetWaveSpace(
true);
1232 for (i = 0 ; i <
m_base.num_elements(); i++)
1236 ::AllocateSharedPtr(
1241 m_base[i]->SetWaveSpace(
true);
1252 for (i = 0 ; i <
m_base.num_elements(); i++)
1256 ::AllocateSharedPtr(
1261 m_base[i]->SetWaveSpace(
false);
1274 for (i = 1 ; i < m_base.num_elements(); i++)
1291 for (i = 1 ; i < m_base.num_elements(); i++)
1300 ASSERTL0(
false,
"Expansion dimension not recognised");
1312 for(i = 0 ; i <
m_base.num_elements(); i++)
1323 for(i = 0 ; i <
m_base.num_elements(); i++)
1335 ASSERTL0(
false,
"Expansion dimension not recognised");
1343 std::string pInfile,
1346 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
1347 std::vector<std::vector<NekDouble> > FieldData;
1350 m_fld->Import(pInfile,FieldDef,FieldData);
1352 int nvar =
m_session->GetVariables().size();
1353 if (
m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
1355 std::string HomoStr =
m_session->GetSolverInfo(
"HOMOGENEOUS");
1358 for (
int j = 0; j < nvar; ++j)
1360 for(
int i = 0; i < FieldDef.size(); ++i)
1362 bool flag = FieldDef[i]->m_fields[j] ==
1364 ASSERTL0(flag, (std::string(
"Order of ") + pInfile
1365 + std::string(
" data and that defined in "
1366 "the session differs")).c_str());
1368 m_base[j]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
1370 m_base[j]->UpdateCoeffs());
1420 for (
int i = 0; i <
m_fields.num_elements(); i++)
1432 for (
int i = 0; i <
m_fields.num_elements(); i++)
1451 const Array<
OneD, Array<OneD, NekDouble> > &F,
1452 Array<OneD, NekDouble> &outarray)
1455 int ndim = F.num_elements();
1456 int nCoeffs =
m_fields[0]->GetNcoeffs();
1458 Array<OneD, NekDouble> iprod(nCoeffs);
1461 for (
int i = 0; i < ndim; ++i)
1463 m_fields[0]->IProductWRTDerivBase(i, F[i], iprod);
1464 Vmath::Vadd(nCoeffs, iprod, 1, outarray, 1, outarray, 1);
1475 const Array<
OneD, Array<OneD, NekDouble> > &F,
1476 Array<OneD, NekDouble> &outarray)
1479 int ndim = F.num_elements();
1480 int nPointsTot =
m_fields[0]->GetNpoints();
1481 Array<OneD, NekDouble> tmp(nPointsTot);
1482 Array<OneD, NekDouble> div(nPointsTot, 0.0);
1485 for (
int i = 0; i < ndim; ++i)
1492 m_fields[0]->IProductWRTBase(div, outarray);
1503 const Array<
OneD, Array<OneD, NekDouble> > &V,
1504 const Array<OneD, const NekDouble> &u,
1505 Array<OneD, NekDouble> &outarray,
1509 int ndim = V.num_elements();
1511 int nPointsTot =
m_fields[0]->GetNpoints();
1512 Array<OneD, NekDouble> tmp(nPointsTot);
1513 Array<OneD, NekDouble> wk(ndim * nPointsTot, 0.0);
1519 m_fields[0]->IProductWRTBase(tmp, outarray,
1524 m_fields[0]->IProductWRTBase_IterPerExp(tmp, outarray);
1536 const Array<
OneD, Array<OneD, NekDouble> > &V,
1537 const Array<OneD, const NekDouble> &u,
1538 Array<OneD, NekDouble> &outarray,
1539 Array<OneD, NekDouble> &wk)
1542 int ndim = V.num_elements();
1547 int nPointsTot =
m_fields[0]->GetNpoints();
1548 Array<OneD, NekDouble> grad0,grad1,grad2;
1551 if (wk.num_elements())
1557 grad0 = Array<OneD, NekDouble> (nPointsTot);
1565 Vmath::Vmul(nPointsTot, grad0, 1, V[0], 1, outarray,1);
1568 grad1 = Array<OneD, NekDouble> (nPointsTot);
1569 m_fields[0]->PhysDeriv(u, grad0, grad1);
1570 Vmath::Vmul (nPointsTot, grad0, 1, V[0], 1, outarray, 1);
1572 outarray, 1, outarray, 1);
1575 grad1 = Array<OneD, NekDouble> (nPointsTot);
1576 grad2 = Array<OneD, NekDouble> (nPointsTot);
1577 m_fields[0]->PhysDeriv(u,grad0,grad1,grad2);
1578 Vmath::Vmul (nPointsTot, grad0, 1, V[0], 1, outarray, 1);
1580 outarray, 1, outarray, 1);
1582 outarray, 1, outarray, 1);
1585 ASSERTL0(
false,
"dimension unknown");
1600 const Array<
OneD, Array<OneD, NekDouble> >& InField,
1601 Array<
OneD, Array<OneD, NekDouble> >& OutField,
1602 bool NumericalFluxIncludesNormal,
1603 bool InFieldIsInPhysSpace,
1614 nvariables =
m_fields.num_elements();
1617 Array<OneD, Array<OneD, NekDouble> > fluxvector(nVelDim);
1618 Array<OneD, Array<OneD, NekDouble> > physfield (nvariables);
1620 for(i = 0; i < nVelDim; ++i)
1622 fluxvector[i] = Array<OneD, NekDouble>(nPointsTot);
1627 if (InFieldIsInPhysSpace ==
true)
1629 for (i = 0; i < nvariables; ++i)
1631 physfield[i] = InField[i];
1637 for(i = 0; i < nvariables; ++i)
1640 physfield[i] = Array<OneD, NekDouble>(nPointsTot);
1641 m_fields[i]->BwdTrans(InField[i],physfield[i]);
1646 for (i = 0; i < nvariables; ++i)
1658 if (NumericalFluxIncludesNormal ==
true)
1660 Array<OneD, Array<OneD, NekDouble> > numflux (nvariables);
1662 for (i = 0; i < nvariables; ++i)
1664 numflux[i] = Array<OneD, NekDouble>(nTracePointsTot);
1672 for (i = 0; i < nvariables; ++i)
1675 m_fields[i]->AddTraceIntegral(numflux[i],OutField[i]);
1683 Array<OneD, Array<OneD, NekDouble> > numfluxX (nvariables);
1684 Array<OneD, Array<OneD, NekDouble> > numfluxY (nvariables);
1686 for (i = 0; i < nvariables; ++i)
1688 numfluxX[i] = Array<OneD, NekDouble>(nTracePointsTot);
1689 numfluxY[i] = Array<OneD, NekDouble>(nTracePointsTot);
1697 for(i = 0; i < nvariables; ++i)
1700 m_fields[i]->AddTraceIntegral(numfluxX[i], numfluxY[i],
1714 const Array<
OneD, Array<OneD, NekDouble> >& InField,
1715 Array<
OneD, Array<OneD, NekDouble> >& OutField,
1716 bool NumericalFluxIncludesNormal,
1717 bool InFieldIsInPhysSpace)
1723 int nvariables =
m_fields.num_elements();
1726 Array<OneD, NekDouble> qcoeffs (ncoeffs);
1727 Array<OneD, NekDouble> temp (ncoeffs);
1729 Array<OneD, Array<OneD, NekDouble> > fluxvector (
m_spacedim);
1730 Array<OneD, Array<OneD, NekDouble> > ufield (nvariables);
1732 Array<OneD, Array<OneD, Array<OneD, NekDouble> > > flux (nqvar);
1733 Array<OneD, Array<OneD, Array<OneD, NekDouble> > > qfield (nqvar);
1735 for (j = 0; j < nqvar; ++j)
1737 qfield[j] = Array<OneD, Array<OneD, NekDouble> >(nqvar);
1738 flux[j] = Array<OneD, Array<OneD, NekDouble> >(nqvar);
1740 for (i = 0; i< nvariables; ++i)
1742 ufield[i] = Array<OneD, NekDouble>(nPointsTot, 0.0);
1743 qfield[j][i] = Array<OneD, NekDouble>(nPointsTot, 0.0);
1744 flux[j][i] = Array<OneD, NekDouble>(nTracePointsTot, 0.0);
1750 fluxvector[k] = Array<OneD, NekDouble>(nPointsTot, 0.0);
1754 if (InFieldIsInPhysSpace ==
true)
1756 for (i = 0; i < nvariables; ++i)
1758 ufield[i] = InField[i];
1764 for (i = 0; i < nvariables; ++i)
1767 ufield[i] = Array<OneD, NekDouble>(nPointsTot);
1768 m_fields[i]->BwdTrans(InField[i],ufield[i]);
1778 for (j = 0; j < nqvar; ++j)
1780 for (i = 0; i < nvariables; ++i)
1790 ufield[i], 1, fluxvector[k], 1);
1802 m_fields[i]->AddTraceIntegral(flux[j][i], qcoeffs);
1817 m_fields[i]->MultiplyByElmtInvMass(qcoeffs, qcoeffs);
1820 m_fields[i]->BwdTrans(qcoeffs, qfield[j][i]);
1832 for (i = 0; i < nvariables; ++i)
1835 OutField[i] = Array<OneD, NekDouble>(ncoeffs, 0.0);
1836 temp = Array<OneD, NekDouble>(ncoeffs, 0.0);
1840 for (j = 0; j < nqvar; ++j)
1845 qfield[j][i], 1, fluxvector[k], 1);
1866 m_fields[i]->AddTraceIntegral(flux[0][i], OutField[i]);
1878 boost::lexical_cast<std::string>(n);
1890 std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
1891 std::vector<std::string> &variables)
1893 char chkout[16] =
"";
1894 sprintf(chkout,
"%d", n);
1895 std::string outname =
m_sessionName +
"_" + chkout +
".chk";
1896 WriteFld(outname, field, fieldcoeffs, variables);
1906 boost::lexical_cast<std::string>(n);
1917 std::vector<Array<OneD, NekDouble> > fieldcoeffs(
1919 std::vector<std::string> variables(
m_fields.num_elements());
1921 for (
int i = 0; i <
m_fields.num_elements(); ++i)
1925 fieldcoeffs[i] =
m_fields[i]->UpdateCoeffs();
1929 fieldcoeffs[i] = Array<OneD,NekDouble>(
m_fields[0]->
1953 const std::string &outname,
1955 std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
1956 std::vector<std::string> &variables)
1958 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
1959 = field->GetFieldDefinitions();
1960 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
1963 for(
int j = 0; j < fieldcoeffs.size(); ++j)
1965 for(
int i = 0; i < FieldDef.size(); ++i)
1968 FieldDef[i]->m_fields.push_back(variables[j]);
1969 field->AppendFieldData(FieldDef[i], FieldData[i],
1991 const std::string &infile,
1992 Array<OneD, MultiRegions::ExpListSharedPtr> &pFields)
1994 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
1995 std::vector<std::vector<NekDouble> > FieldData;
1997 m_fld->Import(infile,FieldDef,FieldData);
2000 for(
int j = 0; j < pFields.num_elements(); ++j)
2003 pFields[j]->UpdateCoeffs(),1);
2005 for(
int i = 0; i < FieldDef.size(); ++i)
2009 std::string(
"Order of ") + infile
2010 + std::string(
" data and that defined in "
2011 "m_boundaryconditions differs"));
2013 pFields[j]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
2015 pFields[j]->UpdateCoeffs());
2017 pFields[j]->BwdTrans(pFields[j]->GetCoeffs(),
2018 pFields[j]->UpdatePhys());
2032 const std::string &infile,
2033 Array<OneD, MultiRegions::ExpListSharedPtr> &pFields,
2036 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
2037 std::vector<std::vector<NekDouble> > FieldData;
2043 ASSERTL0(ndomains*nvariables == pFields.num_elements(),
"Number of fields does not match the number of variables and domains");
2046 for(
int j = 0; j < ndomains; ++j)
2048 for(
int i = 0; i < nvariables; ++i)
2052 for(
int n = 0; n < FieldDef.size(); ++n)
2055 std::string(
"Order of ") + infile
2056 + std::string(
" data and that defined in "
2057 "m_boundaryconditions differs"));
2059 pFields[j*nvariables+i]->ExtractDataToCoeffs(FieldDef[n], FieldData[n],
2061 pFields[j*nvariables+i]->UpdateCoeffs());
2063 pFields[j*nvariables+i]->BwdTrans(pFields[j*nvariables+i]->GetCoeffs(),
2064 pFields[j*nvariables+i]->UpdatePhys());
2075 const std::string &infile,
2077 std::string &pFieldName)
2079 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
2080 std::vector<std::vector<NekDouble> > FieldData;
2082 m_fld->Import(infile,FieldDef,FieldData);
2085 Vmath::Zero(pField->GetNcoeffs(),pField->UpdateCoeffs(),1);
2087 for(
int i = 0; i < FieldDef.size(); ++i)
2090 for(
int j = 0; j < FieldData.size(); ++j)
2092 if (FieldDef[i]->
m_fields[j] == pFieldName)
2097 ASSERTL1(idx >= 0,
"Field " + pFieldName +
" not found.");
2099 pField->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
2101 pField->UpdateCoeffs());
2103 pField->BwdTrans(pField->GetCoeffs(), pField->UpdatePhys());
2114 const std::string &infile,
2115 std::vector< std::string> &fieldStr,
2116 Array<
OneD, Array<OneD, NekDouble> > &coeffs)
2119 ASSERTL0(fieldStr.size() <= coeffs.num_elements(),
2120 "length of fieldstr should be the same as pFields");
2122 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
2123 std::vector<std::vector<NekDouble> > FieldData;
2125 m_fld->Import(infile,FieldDef,FieldData);
2128 for(
int j = 0; j < fieldStr.size(); ++j)
2130 Vmath::Zero(coeffs[j].num_elements(),coeffs[j],1);
2131 for(
int i = 0; i < FieldDef.size(); ++i)
2133 m_fields[0]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
2134 fieldStr[j], coeffs[j]);
2157 ? boost::lexical_cast<string>(
m_NumMode) :
"ALL");
2174 if (
m_session->DefinesSolverInfo(
"UpwindType"))
2177 m_session->GetSolverInfo(
"UpwindType"));
2180 if (
m_session->DefinesSolverInfo(
"AdvectionType"))
2182 std::string AdvectionType;
2183 AdvectionType =
m_session->GetSolverInfo(
"AdvectionType");
2185 GetClassDescription(AdvectionType));
2199 "Mixed Continuous Galerkin and Discontinuous");
2202 if (
m_session->DefinesSolverInfo(
"DiffusionType"))
2204 std::string DiffusionType;
2205 DiffusionType =
m_session->GetSolverInfo(
"DiffusionType");
2207 GetClassDescription(DiffusionType));
2224 string::const_iterator it1=s1.begin();
2225 string::const_iterator it2=s2.begin();
2228 while ( (it1!=s1.end()) && (it2!=s2.end()) )
2230 if(::toupper(*it1) != ::toupper(*it2))
2233 return (::toupper(*it1) < ::toupper(*it2)) ? -1 : 1;
2241 size_t size1=s1.size();
2242 size_t size2=s2.size();
2250 return (size1 < size2) ? -1 : 1;
2255 return Array<OneD, bool>(
m_session->GetVariables().size(),
false);
2259 const int i, Array<
OneD,
2260 Array<OneD, NekDouble> > &physfield,
2261 Array<
OneD, Array<OneD, NekDouble> > &flux)
2263 ASSERTL0(
false,
"v_GetFluxVector: This function is not valid "
2264 "for the Base class");
2268 const int i,
const int j,
2269 Array<
OneD, Array<OneD, NekDouble> > &physfield,
2270 Array<
OneD, Array<OneD, NekDouble> > &flux)
2272 ASSERTL0(
false,
"v_GetqFluxVector: This function is not valid "
2273 "for the Base class");
2277 const int i, Array<
OneD,
2278 Array<OneD, NekDouble> > &physfield,
2279 Array<
OneD, Array<OneD, NekDouble> > &fluxX,
2280 Array<
OneD, Array<OneD, NekDouble> > &fluxY)
2282 ASSERTL0(
false,
"v_GetFluxVector: This function is not valid "
2283 "for the Base class");
2287 Array<
OneD, Array<OneD, NekDouble> > &physfield,
2288 Array<
OneD, Array<OneD, NekDouble> > &numflux)
2290 ASSERTL0(
false,
"v_NumericalFlux: This function is not valid "
2291 "for the Base class");
2295 Array<
OneD, Array<OneD, NekDouble> > &physfield,
2296 Array<
OneD, Array<OneD, NekDouble> > &numfluxX,
2297 Array<
OneD, Array<OneD, NekDouble> > &numfluxY )
2299 ASSERTL0(
false,
"v_NumericalFlux: This function is not valid "
2300 "for the Base class");
2304 const Array<
OneD, Array<OneD, NekDouble> > &ufield,
2305 Array<
OneD, Array<
OneD, Array<OneD, NekDouble> > > &uflux)
2307 ASSERTL0(
false,
"v_NumFluxforScalar: This function is not valid "
2308 "for the Base class");
2312 const Array<
OneD, Array<OneD, NekDouble> > &ufield,
2313 Array<
OneD, Array<
OneD, Array<OneD, NekDouble> > > &qfield,
2314 Array<
OneD, Array<OneD, NekDouble > > &qflux)
2316 ASSERTL0(
false,
"v_NumFluxforVector: This function is not valid "
2317 "for the Base class");
2322 ASSERTL0(
false,
"This function is not valid for the Base class");
2328 std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
2329 std::vector<std::string> &variables)