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());
97 m_nq = pField->GetNcoeffs();
98 int order =
m_field->GetExp(0)->GetBasis(0)->GetNumModes();
118 m_nq = pField->GetTotPoints();
128 ASSERTL1(
m_nvar > 0,
"Cell model must have at least 1 variable.");
131 m_wsp = Array<OneD, Array<OneD, NekDouble> >(
m_nvar);
132 for (
unsigned int i = 0; i <
m_nvar; ++i)
135 m_wsp[i] = Array<OneD, NekDouble>(
m_nq);
138 for (
unsigned int i = 0; i <
m_gates.size(); ++i)
143 if (
m_session->DefinesFunction(
"CellModelInitialConditions"))
162 const Array<
OneD,
const Array<OneD, NekDouble> > &inarray,
163 Array<
OneD, Array<OneD, NekDouble> > &outarray,
168 int nvar = inarray.num_elements();
169 Array<OneD, NekDouble> tmp;
177 m_nodalTmp = Array<OneD, Array<OneD, NekDouble> >(nvar);
178 for (
unsigned int k = 0; k < nvar; ++k)
187 for (
unsigned int k = 0; k < nvar; ++k)
189 for (
unsigned int i = 0; i <
m_field->GetNumElmts(); ++i)
191 phys_offset =
m_field->GetPhys_Offset(i);
192 coef_offset =
m_field->GetCoeff_Offset(i);
195 m_field->GetExp(0)->FwdTrans(inarray[k] + phys_offset, tmpCoeffs);
200 m_field->GetExp(0)->FwdTrans(inarray[k] + phys_offset, tmpCoeffs);
219 for (
unsigned int i = 0; i <
m_substeps - 1; ++i)
230 for (
unsigned int j = 0; j <
m_gates.size(); ++j)
248 for (
unsigned int k = 0; k < nvar; ++k)
250 for (
unsigned int i = 0; i <
m_field->GetNumElmts(); ++i)
252 int phys_offset =
m_field->GetPhys_Offset(i);
253 int coef_offset =
m_field->GetCoeff_Offset(i);
257 m_field->GetExp(0)->BwdTrans(tmpCoeffs, tmp=outarray[k] + phys_offset);
262 m_field->GetExp(0)->BwdTrans(tmpCoeffs, tmp=outarray[k] + phys_offset);
279 for (
unsigned int j = 0; j <
m_gates.size(); ++j)
294 Array<OneD, NekDouble> outarray(
m_field->GetNcoeffs());
295 Array<OneD, NekDouble> tmp;
299 for (
unsigned int i = 0; i <
m_field->GetNumElmts(); ++i)
301 int coef_offset =
m_field->GetCoeff_Offset(i);
327 const bool root = (
m_session->GetComm()->GetRank() == 0);
328 const std::string fncName =
"CellModelInitialConditions";
330 Array<OneD, NekDouble> coeffs(
m_field->GetNcoeffs());
331 Array<OneD, NekDouble> tmp;
337 cout <<
"Cell model initial conditions: " << endl;
343 for(
int j = 1; j <
m_cellSol.num_elements(); ++j)
349 if (
m_session->GetFunctionType(fncName, varName) ==
352 const std::string file =
353 m_session->GetFunctionFilename(fncName, varName);
357 cout <<
" - Field " << varName <<
": from file "
361 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
362 std::vector<std::vector<NekDouble> > FieldData;
367 fld->Import(file, FieldDef, FieldData);
371 fld->ImportFieldMetaData(file,fieldMetaDataMap);
372 iter = fieldMetaDataMap.find(
"Time");
373 if(iter != fieldMetaDataMap.end())
379 for(
int i = 0; i < FieldDef.size(); ++i)
381 m_field->ExtractDataToCoeffs(FieldDef[i],
391 for (
unsigned int i = 0; i <
m_field->GetNumElmts(); ++i)
393 int coef_offset =
m_field->GetCoeff_Offset(i);
394 if (
m_field->GetExp(0)->DetShapeType() ==
412 else if (
m_session->GetFunctionType(fncName, varName) ==
416 m_session->GetFunction(fncName, varName);
420 cout <<
" - Field " << varName <<
": "
421 << equ->GetExpression() << endl;
424 const unsigned int nphys =
m_field->GetNpoints();
425 Array<OneD, NekDouble> x0(nphys);
426 Array<OneD, NekDouble> x1(nphys);
427 Array<OneD, NekDouble> x2(nphys);
432 Array<OneD, NekDouble> phys(nphys);
435 equ->Evaluate(x0, x1, x2, phys);
436 for (
unsigned int i = 0; i <
m_field->GetNumElmts(); ++i)
438 int phys_offset =
m_field->GetPhys_Offset(i);
439 int coef_offset =
m_field->GetCoeff_Offset(i);
440 if (
m_field->GetExp(0)->DetShapeType() ==
444 phys + phys_offset, tmpCoeffs);
452 phys + phys_offset, tmpCoeffs);