53 const std::map<std::string, std::string> &pParams) :
56 if (pParams.find(
"OutputFile") == pParams.end())
62 ASSERTL0(!(pParams.find(
"OutputFile")->second.empty()),
63 "Missing parameter 'OutputFile'.");
72 if (pParams.find(
"OutputFrequency") == pParams.end())
79 atoi(pParams.find(
"OutputFrequency")->second.c_str());
83 m_session->MatchSolverInfo(
"Homogeneous",
"1D",
85 m_session->MatchSolverInfo(
"Homogeneous",
"2D",
87 m_session->MatchSolverInfo(
"CalculatePerturbationEnergy",
"True",
89 m_session->LoadParameter (
"NumQuadPointsError",
98 if (pParams.find(
"OutputPlane") == pParams.end())
105 atoi(pParams.find(
"OutputPlane")->second.c_str());
126 const Array<OneD, const MultiRegions::ExpListSharedPtr> &pFields,
131 if (vComm->GetRank() == 0)
158 const Array<OneD, const MultiRegions::ExpListSharedPtr> &pFields,
172 int colrank = vComm->GetColumnComm()->GetRank();
173 int nproc = vComm->GetColumnComm()->GetSize();
177 Array<OneD, NekDouble> energy (locsize, 0.0);
178 Array<OneD, NekDouble> energy_tmp(locsize, 0.0);
179 Array<OneD, NekDouble> tmp;
190 ASSERTL0(
false,
"Stability analysis module not "
191 "implemented for the Compressible Flow "
192 "Solver. Please remove the function BaseFlow "
193 "from your .xml file");
202 GetFunctionFilename(
"BaseFlow", 0);
205 for (
int i = 0; i < pFields.num_elements()-1; ++i)
208 pFields[i]->GetCoeffs(), 1,
209 m_base [i]->GetCoeffs(), 1,
210 pFields[i]->UpdateCoeffs(), 1);
212 energy_tmp = pFields[i]->HomogeneousEnergy();
214 energy, 1, energy, 1);
217 pFields[i]->GetCoeffs(), 1,
218 m_base[i]->GetCoeffs(), 1,
219 pFields[i]->UpdateCoeffs(), 1);
232 for (
int i = 1; i < pFields.num_elements()-1; ++i)
234 energy_tmp = pFields[i]->HomogeneousEnergy();
236 energy, 1, energy, 1);
243 for (
int i = 0; i < pFields.num_elements()-1; ++i)
245 energy_tmp = pFields[i]->HomogeneousEnergy();
247 energy, 1, energy, 1);
257 for (j = 0; j < energy.num_elements(); ++j, ++m)
261 << setw(18) << energy[j] << endl;
264 for (
int i = 1; i < nproc; ++i)
266 vComm->GetColumnComm()->Recv(i, energy);
268 for (j = 0; j < energy.num_elements(); ++j, ++m)
272 << setw(18) << energy[j] << endl;
278 vComm->GetColumnComm()->Send(0, energy);
284 ASSERTL0(
false,
"3D Homogeneous 2D energy "
285 "dumping not implemented yet");
297 for (
int i = 1; i < pFields.num_elements()-1; ++i)
299 pFields[i]->SetPhysState(
true);
301 energy += norm * norm;
314 for (
int i = 0; i < pFields.num_elements()-1; ++i)
316 pFields[i]->SetPhysState(
true);
318 energy += norm * norm;
332 const Array<OneD, const MultiRegions::ExpListSharedPtr> &pFields,
335 if (pFields[0]->GetComm()->GetRank() == 0)
346 const Array<OneD, const MultiRegions::ExpListSharedPtr> &pFields,
355 if (pFields[field]->GetPhysState() ==
false)
357 pFields[field]->BwdTrans(pFields[field]->GetCoeffs(),
358 pFields[field]->UpdatePhys());
362 L2error = pFields[field]->L2(pFields[field]->GetPhys());
373 int m_expdim = graphShrPtr->GetMeshDimension();
376 if(
m_session->DefinesSolverInfo(
"PROJECTION"))
378 std::string ProjectStr =
m_session->GetSolverInfo(
"PROJECTION");
380 if ((ProjectStr ==
"Continuous") ||
381 (ProjectStr ==
"Galerkin") ||
382 (ProjectStr ==
"CONTINUOUS") ||
383 (ProjectStr ==
"GALERKIN"))
387 else if ((ProjectStr ==
"MixedCGDG") ||
388 (ProjectStr ==
"Mixed_CG_Discontinuous"))
392 else if(ProjectStr ==
"DisContinuous")
398 ASSERTL0(
false,
"PROJECTION value not recognised");
403 cerr <<
"Projection type not specified in SOLVERINFO,"
404 "defaulting to continuous Galerkin" << endl;
408 if (
m_session->DefinesSolverInfo(
"ModeType"))
410 m_session->MatchSolverInfo(
"ModeType",
"SingleMode",
412 m_session->MatchSolverInfo(
"ModeType",
"HalfMode",
414 m_session->MatchSolverInfo(
"ModeType",
"MultipleModes",
419 m_session->MatchSolverInfo(
"DEALIASING",
"True",
424 m_session->MatchSolverInfo(
"DEALIASING",
"On",
429 if (
m_session->DefinesSolverInfo(
"ModeType"))
445 ASSERTL0(
false,
"SolverInfo ModeType not valid");
460 for(i = 0; i <
m_base.num_elements(); i++)
481 for (i = 0 ; i <
m_base.num_elements(); i++)
491 m_base[i]->SetWaveSpace(
true);
504 for (i = 0 ; i <
m_base.num_elements(); i++)
514 m_base[i]->SetWaveSpace(
true);
525 for (i = 0 ; i <
m_base.num_elements(); i++)
535 m_base[i]->SetWaveSpace(
false);
550 for (i = 1 ; i < m_base.num_elements(); i++)
554 *firstbase, graphShrPtr,
567 for (i = 1 ; i < m_base.num_elements(); i++)
571 *firstbase, graphShrPtr,
577 ASSERTL0(
false,
"Expansion dimension not recognised");
589 for (i = 0 ; i <
m_base.num_elements(); i++)
600 for (i = 0 ; i <
m_base.num_elements(); i++)
612 ASSERTL0(
false,
"Expansion dimension not recognised");
625 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
626 std::vector<std::vector<NekDouble> > FieldData;
629 m_fld->Import(pInfile,FieldDef,FieldData);
631 int nvar =
m_session->GetVariables().size();
632 if(
m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
634 std::string HomoStr =
m_session->GetSolverInfo(
"HOMOGENEOUS");
637 for (
int j = 0; j < nvar; ++j)
639 for (
int i = 0; i < FieldDef.size(); ++i)
642 FieldDef[i]->m_fields[j] ==
m_session->GetVariable(j);
644 ASSERTL0(flag, (std::string(
"Order of ") + pInfile
645 + std::string(
" data and that defined in "
646 "m_boundaryconditions differs")).c_str());
648 m_base[j]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
649 FieldDef[i]->m_fields[j],
650 m_base[j]->UpdateCoeffs());