52 const std::map<std::string, std::string> &pParams) :
55 if (pParams.find(
"OutputFile") == pParams.end())
61 ASSERTL0(!(pParams.find(
"OutputFile")->second.empty()),
62 "Missing parameter 'OutputFile'.");
71 if (pParams.find(
"OutputFrequency") == pParams.end())
78 atoi(pParams.find(
"OutputFrequency")->second.c_str());
82 m_session->MatchSolverInfo(
"Homogeneous",
"1D",
84 m_session->MatchSolverInfo(
"Homogeneous",
"2D",
86 m_session->MatchSolverInfo(
"CalculatePerturbationEnergy",
"True",
88 m_session->LoadParameter (
"NumQuadPointsError",
95 if (pParams.find(
"OutputPlane") == pParams.end())
102 atoi(pParams.find(
"OutputPlane")->second.c_str());
122 const Array<OneD, const MultiRegions::ExpListSharedPtr> &pFields,
127 if (vComm->GetRank() == 0)
153 const Array<OneD, const MultiRegions::ExpListSharedPtr> &pFields,
167 int colrank = vComm->GetColumnComm()->GetRank();
168 int nproc = vComm->GetColumnComm()->GetSize();
172 Array<OneD, NekDouble> energy (locsize,0.0);
173 Array<OneD, NekDouble> energy_tmp(locsize,0.0);
174 Array<OneD, NekDouble> tmp;
182 string file =
m_session->GetFunctionFilename(
"BaseFlow", 0);
185 for(
int i = 0; i < pFields.num_elements()-1; ++i)
188 pFields[i]->GetCoeffs(),1,
189 m_base [i]->GetCoeffs(),1,
190 pFields[i]->UpdateCoeffs(),1);
192 energy_tmp = pFields[i]->HomogeneousEnergy();
193 Vmath::Vadd(locsize,energy_tmp,1,energy,1,energy,1);
196 pFields[i]->GetCoeffs(),1,
198 pFields[i]->UpdateCoeffs(),1);
203 for(
int i = 0; i < pFields.num_elements()-1; ++i)
205 energy_tmp =pFields[i]->HomogeneousEnergy();
206 Vmath::Vadd(locsize,energy_tmp,1,energy,1,energy,1);
215 for (j = 0; j < energy.num_elements(); ++j, ++m)
219 << setw(18) << energy[j] << endl;
222 for (
int i = 1; i < nproc; ++i)
224 vComm->GetColumnComm()->Recv(i, energy);
226 for (j = 0; j < energy.num_elements(); ++j, ++m)
230 << setw(18) << energy[j] << endl;
236 vComm->GetColumnComm()->Send(0, energy);
241 ASSERTL0(
false,
"3D Homogeneous 2D energy dumping not implemented yet");
246 for(
int i = 0; i < pFields.num_elements()-1; ++i)
248 pFields[i]->SetPhysState(
true);
263 const Array<OneD, const MultiRegions::ExpListSharedPtr> &pFields,
266 if (pFields[0]->GetComm()->GetRank() == 0)
273 const Array<OneD, const MultiRegions::ExpListSharedPtr> &pFields,
282 if(pFields[field]->GetPhysState() ==
false)
284 pFields[field]->BwdTrans(pFields[field]->GetCoeffs(),
285 pFields[field]->UpdatePhys());
289 L2error = pFields[field]->L2(pFields[field]->GetPhys());
297 int m_expdim = graphShrPtr->GetMeshDimension();
300 if(
m_session->DefinesSolverInfo(
"PROJECTION"))
302 std::string ProjectStr =
m_session->GetSolverInfo(
"PROJECTION");
304 if((ProjectStr ==
"Continuous") || (ProjectStr ==
"Galerkin")
305 || (ProjectStr ==
"CONTINUOUS") || (ProjectStr ==
"GALERKIN"))
309 else if((ProjectStr ==
"MixedCGDG")||(ProjectStr ==
"Mixed_CG_Discontinuous"))
313 else if(ProjectStr ==
"DisContinuous")
319 ASSERTL0(
false,
"PROJECTION value not recognised");
324 cerr <<
"Projection type not specified in SOLVERINFO,"
325 "defaulting to continuous Galerkin" << endl;
329 if(
m_session->DefinesSolverInfo(
"ModeType"))
331 m_session->MatchSolverInfo(
"ModeType",
"SingleMode",
333 m_session->MatchSolverInfo(
"ModeType",
"HalfMode",
335 m_session->MatchSolverInfo(
"ModeType",
"MultipleModes",
347 if(
m_session->DefinesSolverInfo(
"ModeType"))
363 ASSERTL0(
false,
"SolverInfo ModeType not valid");
378 for(i = 0; i <
m_base.num_elements(); i++)
398 for(i = 0 ; i <
m_base.num_elements(); i++)
401 m_base[i]->SetWaveSpace(
true);
413 for(i = 0 ; i <
m_base.num_elements(); i++)
417 m_base[i]->SetWaveSpace(
true);
428 for(i = 0 ; i <
m_base.num_elements(); i++)
432 m_base[i]->SetWaveSpace(
false);
445 for(i = 1 ; i < m_base.num_elements(); i++)
461 for(i = 1 ; i < m_base.num_elements(); i++)
470 ASSERTL0(
false,
"Expansion dimension not recognised");
482 for(i = 0 ; i <
m_base.num_elements(); i++)
486 ::AllocateSharedPtr(
m_session, graphShrPtr,
493 for(i = 0 ; i <
m_base.num_elements(); i++)
504 ASSERTL0(
false,
"Expansion dimension not recognised");
514 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
515 std::vector<std::vector<NekDouble> > FieldData;
518 m_fld->Import(pInfile,FieldDef,FieldData);
520 int nvar =
m_session->GetVariables().size();
521 if(
m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
523 std::string HomoStr =
m_session->GetSolverInfo(
"HOMOGENEOUS");
526 for(
int j = 0; j < nvar; ++j)
528 for(
int i = 0; i < FieldDef.size(); ++i)
530 bool flag = FieldDef[i]->m_fields[j] ==
532 ASSERTL1(flag, (std::string(
"Order of ") + pInfile
533 + std::string(
" data and that defined in "
534 "m_boundaryconditions differs")).c_str());
536 m_base[j]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
537 FieldDef[i]->m_fields[j],
538 m_base[j]->UpdateCoeffs());