49 Loki::NoDestroy > Type;
50 return Type::Instance();
73 m_substeps = pSession->GetParameter(
"Substeps");
79 std::set<enum LibUtilities::ShapeType> s;
80 for (
unsigned int i = 0; i <
m_field->GetNumElmts(); ++i)
82 s.insert(
m_field->GetExp(i)->DetShapeType());
96 m_nq = pField->GetNcoeffs();
97 int order =
m_field->GetExp(0)->GetBasis(0)->GetNumModes();
117 m_nq = pField->GetTotPoints();
127 ASSERTL1(
m_nvar > 0,
"Cell model must have at least 1 variable.");
130 m_wsp = Array<OneD, Array<OneD, NekDouble> >(
m_nvar);
131 for (
unsigned int i = 0; i <
m_nvar; ++i)
134 m_wsp[i] = Array<OneD, NekDouble>(
m_nq);
137 for (
unsigned int i = 0; i <
m_gates.size(); ++i)
142 if (
m_session->DefinesFunction(
"CellModelInitialConditions"))
161 const Array<
OneD,
const Array<OneD, NekDouble> > &inarray,
162 Array<
OneD, Array<OneD, NekDouble> > &outarray,
167 int nvar = inarray.num_elements();
168 Array<OneD, NekDouble> tmp;
176 m_nodalTmp = Array<OneD, Array<OneD, NekDouble> >(nvar);
177 for (
unsigned int k = 0; k < nvar; ++k)
186 for (
unsigned int k = 0; k < nvar; ++k)
188 for (
unsigned int i = 0; i <
m_field->GetNumElmts(); ++i)
190 phys_offset =
m_field->GetPhys_Offset(i);
191 coef_offset =
m_field->GetCoeff_Offset(i);
194 m_field->GetExp(0)->FwdTrans(inarray[k] + phys_offset, tmpCoeffs);
199 m_field->GetExp(0)->FwdTrans(inarray[k] + phys_offset, tmpCoeffs);
218 for (
unsigned int i = 0; i <
m_substeps - 1; ++i)
229 for (
unsigned int j = 0; j <
m_gates.size(); ++j)
247 for (
unsigned int k = 0; k < nvar; ++k)
249 for (
unsigned int i = 0; i <
m_field->GetNumElmts(); ++i)
251 int phys_offset =
m_field->GetPhys_Offset(i);
252 int coef_offset =
m_field->GetCoeff_Offset(i);
256 m_field->GetExp(0)->BwdTrans(tmpCoeffs, tmp=outarray[k] + phys_offset);
261 m_field->GetExp(0)->BwdTrans(tmpCoeffs, tmp=outarray[k] + phys_offset);
278 for (
unsigned int j = 0; j <
m_gates.size(); ++j)
293 Array<OneD, NekDouble> outarray(
m_field->GetNcoeffs());
294 Array<OneD, NekDouble> tmp;
298 for (
unsigned int i = 0; i <
m_field->GetNumElmts(); ++i)
300 int coef_offset =
m_field->GetCoeff_Offset(i);
326 const bool root = (
m_session->GetComm()->GetRank() == 0);
327 const std::string fncName =
"CellModelInitialConditions";
329 Array<OneD, NekDouble> coeffs(
m_field->GetNcoeffs());
330 Array<OneD, NekDouble> tmp;
336 cout <<
"Cell model initial conditions: " << endl;
342 for(
int j = 1; j <
m_cellSol.num_elements(); ++j)
348 if (
m_session->GetFunctionType(fncName, varName) ==
351 const std::string file =
352 m_session->GetFunctionFilename(fncName, varName);
356 cout <<
" - Field " << varName <<
": from file "
360 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
361 std::vector<std::vector<NekDouble> > FieldData;
366 fld->Import(file, FieldDef, FieldData);
370 fld->ImportFieldMetaData(file,fieldMetaDataMap);
371 iter = fieldMetaDataMap.find(
"Time");
372 if(iter != fieldMetaDataMap.end())
378 for(
int i = 0; i < FieldDef.size(); ++i)
380 m_field->ExtractDataToCoeffs(FieldDef[i],
390 for (
unsigned int i = 0; i <
m_field->GetNumElmts(); ++i)
392 int coef_offset =
m_field->GetCoeff_Offset(i);
393 if (
m_field->GetExp(0)->DetShapeType() ==
411 else if (
m_session->GetFunctionType(fncName, varName) ==
415 m_session->GetFunction(fncName, varName);
419 cout <<
" - Field " << varName <<
": "
420 << equ->GetExpression() << endl;
423 const unsigned int nphys =
m_field->GetNpoints();
424 Array<OneD, NekDouble> x0(nphys);
425 Array<OneD, NekDouble> x1(nphys);
426 Array<OneD, NekDouble> x2(nphys);
431 Array<OneD, NekDouble> phys(nphys);
434 equ->Evaluate(x0, x1, x2, phys);
435 for (
unsigned int i = 0; i <
m_field->GetNumElmts(); ++i)
437 int phys_offset =
m_field->GetPhys_Offset(i);
438 int coef_offset =
m_field->GetCoeff_Offset(i);
439 if (
m_field->GetExp(0)->DetShapeType() ==
443 phys + phys_offset, tmpCoeffs);
451 phys + phys_offset, tmpCoeffs);