56#include <SolverCore/AdvDiffusion/AdvWeakDGDiffusionIP/AdvWeakDGDiffusionIPOp.hpp>
57#include <SolverCore/TimeOps/TimeOp.hpp>
61using namespace MultiRegions;
66 "Navier-Stokes equations in conservative variables.");
71 : UnsteadySystem(pSession, pGraph)
73 ASSERTL0(m_projectionType == MultiRegions::eDiscontinuous,
74 "The NavierStokesCFE is only implemented for projectionType "
82void NavierStokesCFE::v_InitObject(
bool declareExpansionLists)
85 UnsteadySystem::v_InitObject(declareExpansionLists);
87 ASSERTL0(m_session->DefinesSolverInfo(
"UPWINDTYPE"),
88 "No UPWINDTYPE defined in session.");
94 v_InitialiseOperators();
99 UnsteadySystem::v_GenerateSummary(s);
104 std::stringstream ss;
108| \| | ___| | _| |_ __ _ _ __ _| |_ _| |_
109| . ` |/ _ \ |/ / __/ _` | '__|_ _|_ _|
110| |\ | __/ <| || (_| | | |_| |_|
111\_| \_/\___|_|\_\\__\__,_|_|
114 _ __ ___ __| | ___ ___ _ __ _ _ __ ___ __| |
115| '__/ _ \/ _` |/ _ \/ __| |/ _` | '_ \ / _ \/ _` |
116| | | __/ (_| | __/\__ \ | (_| | | | | __/ (_| |
117|_| \___|\__,_|\___||___/_|\__, |_| |_|\___|\__,_|
136void NavierStokesCFE::DoOdeRhs(
142 m_advDiffusionOp->UpdateBndPhys(time);
143 m_advDiffusionOp->SetScale(dt);
144 m_advDiffusionOp->Apply(in, out);
150void NavierStokesCFE::DoProjection(
153 [[maybe_unused]]
const double &time)
157 m_math.copy(in, out);
164void NavierStokesCFE::v_InitialiseOperators()
167 m_iProductWRTBaseOp =
170 m_expansionLists[0], m_variables[0]);
172 std::string execName =
177 m_expansionLists[0], m_variables[0]);
179 std::string riemannMethod = m_session->GetSolverInfo(
"UpwindType");
181 std::string EqnOfState =
182 StringUtils::ToUpperCopy(m_session->GetEquationOfState().type);
184 std::string AdvDiffMethod =
"AdvDiffTraceFluxCFE" + riemannMethod +
187 m_expansionLists[0], m_variables[0], AdvDiffMethod);
188 advDiffusionTraceFluxOp->SetViscousTraceForm(ReadViscousTraceForm());
189 m_advDiffusionOp->SetAdvDiffTraceFlux(advDiffusionTraceFluxOp);
191 auto eulerVolFluxOp =
193 m_advDiffusionOp->SetAdvVolFlux(eulerVolFluxOp);
196 m_expansionLists[0], m_variables[0]);
197 m_advDiffusionOp->SetDiffVolFlux(diffusionVolFluxOp);
201 const bool avgNormalFlux =
202 advDiffusionTraceFluxOp->GetViscousTraceForm() ==
204 double>::ViscousTraceForm::AverageOfNormalFluxes;
208 m_expansionLists[0], m_variables[0]));
214 m_advDiffusionOp->SetFusedElmtOp(
215 CreateAdvDiffFusedElmtCFEOp<SolverCore::AdvDiffFusedElmtOp>(
216 m_expansionLists[0], m_variables[0], avgNormalFlux,
217 "needs ViscousTraceFlux=AverageOfNormalFluxes."));
220 m_timeOp = TimeOp<double>::Create(m_expansionLists[0], m_variables[0]);
221 m_timeOp->DefineProjection(&NavierStokesCFE::DoProjection,
this);
222 m_timeOp->DefineExplicitRhs(&NavierStokesCFE::DoOdeRhs,
this);
224 SetUpBoundaryConditions();
236 ReadViscousTraceForm()
240 m_session->LoadSolverInfo(
"ViscousTraceFlux", form,
"FluxOfAverages");
241 if (StringUtils::IEquals(form,
"AverageOfNormalFluxes"))
243 return Form::AverageOfNormalFluxes;
245 ASSERTL0(StringUtils::IEquals(form,
"FluxOfAverages"),
246 "Unknown ViscousTraceFlux '" + form +
247 "'; expected FluxOfAverages or AverageOfNormalFluxes.");
248 return Form::FluxOfAverages;
251CoefficientFieldViews NavierStokesCFE::v_GetOutputFieldViews()
256 m_iProductWRTBaseOp->Apply(m_phys[0], m_wsp_coeff[0]);
257 m_multiplyByElmtInvMassOp->Apply(m_wsp_coeff[0], m_coeff[0]);
259 return UnsteadySystem::v_GetOutputFieldViews();
268void NavierStokesCFE::SetUpBoundaryConditions()
277 m_advDiffusionOp->AddBndCondUpdateOp(bndCondWallOp);
283 m_expansionLists[0], m_variables[0]);
284 m_advDiffusionOp->AddBndCondUpdateOp(bndCondPressureOutflowOp);
288 auto bndCondEntropyVelocityOp =
291 m_advDiffusionOp->AddBndCondUpdateOp(bndCondEntropyVelocityOp);
295 auto bndCondEntropyPressureOp =
298 m_advDiffusionOp->AddBndCondUpdateOp(bndCondEntropyPressureOp);
300 auto bndCondEntropyTotalEnthalpyOp =
302 m_expansionLists[0], m_variables[0]);
303 m_advDiffusionOp->AddBndCondUpdateOp(bndCondEntropyTotalEnthalpyOp);
309 m_expansionLists[0], m_variables[0]);
310 m_advDiffusionOp->AddBndCondUpdateOp(bndCondSlipWallOp);
313 m_expansionLists[0], m_variables[0]);
314 m_advDiffusionOp->AddBndCondUpdateOp(bndCondExtrapOrder0Op);
318 auto bndCondRiemannInvariantOp =
321 m_advDiffusionOp->AddBndCondUpdateOp(bndCondRiemannInvariantOp);
325 auto bndCondStagnationInflowOp =
328 m_advDiffusionOp->AddBndCondUpdateOp(bndCondStagnationInflowOp);
339UnsteadySystem::CFLVelocity NavierStokesCFE::v_GetCFLVelocity()
341 std::vector<std::string> components;
342 for (
unsigned int i = 0; i < m_coordim; ++i)
344 components.push_back(
"u" + std::to_string(i));
346 components.push_back(
"c");
348 if (!m_cflVelocityOp)
353 ASSERTL0(m_expansionLists[0]->GetExp(0)->GetShapeDimension() ==
355 "The Courant estimate expects the shape and coordinate "
356 "dimensions to agree.");
359 CFLVelocityCFEOp<double>::Create(m_expansionLists[0], components);
362 MultiRegions::GetBlockAttributes<double, FieldState::Phys>(
363 m_expansionLists[0]);
365 m_cflVelocity = LibUtilities::Field<double, FieldState::Phys>(
366 "cflVelocity", bAtr_phys, m_coordim + 1, m_npointsZ);
369 m_cflVelocityOp->Apply(m_phys[0], m_cflVelocity);
372 return {&m_cflVelocity, 0, components, 1.0};
#define ASSERTL0(condition, msg)
Whole-field interface of the IProductWRTBase element operator, which takes a physical-space field to ...
Whole-field interface of the MultiplyByElmtInvMass element operator, which multiplies a coefficient-s...
The Navier-Stokes volume flux with the viscous flux on its own (see SolverCore::AdvDiffVolumeFluxOp):...
Subsonic Riemann boundary holding the entropy and the pressure.
Subsonic Riemann boundary holding the entropy and the total enthalpy.
Subsonic Riemann inflow holding the entropy and the velocity.
Subsonic pressure outflow, as a boundary state.
Characteristic farfield boundary from the Riemann invariants.
Inviscid slip wall and symmetry plane.
Subsonic inflow from a stagnation state and a flow direction.
Viscous wall states for the compressible flow solver.
A Field represents expansion data to be operated on.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Whole-field interface of the inner product with the basis: integrates a physical-space field against ...
Whole-field interface of the element-wise inverse mass operator: replaces every element's coefficient...
Common base class of the operator family interfaces: holds the expansion list, component names and da...
static std::string className
Name of class.
NavierStokesCFE(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
static SolverUtils::EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::vector< std::pair< std::string, std::string > > SummaryList
EquationSystemFactory & GetEquationSystemFactory()
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
std::shared_ptr< MeshGraph > MeshGraphSharedPtr