Nektar++
CompressibleFlowSystem.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: CompressibleFlowSystem.h
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Auxiliary functions for the compressible flow system
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_EQUATIONSYSTEMS_COMPRESSIBLEFLOWSYSTEM_H
36#define NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_EQUATIONSYSTEMS_COMPRESSIBLEFLOWSYSTEM_H
37
50
51namespace Nektar
52{
53/**
54 *
55 */
58{
59public:
61
62 ~CompressibleFlowSystem() override = default;
63
64 /// Function to calculate the stability limit for DG/CG.
66
67 /// Function to calculate the stability limit for DG/CG
68 /// (a vector of them).
70 const Array<OneD, int> &ExpOrder);
71
72protected:
77 std::string m_shockCaptureType;
78
79 // Parameters for exponential filtering
84
85 // Parameters for local time-stepping
87
88 // Store physical artificial viscosity
90
91 // Store physical artificial viscosity
93
94 // Auxiliary object to convert variables
96
97 // User defined boundary conditions
98 std::vector<CFSBndCondSharedPtr> m_bndConds;
99
101
102 // Forcing term
103 std::vector<SolverUtils::ForcingSharedPtr> m_forcing;
104
107
108 void v_InitObject(bool DeclareFields = true) override;
109
110 void v_GetPressure(
111 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
113
114 void v_GetDensity(
115 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
116 Array<OneD, NekDouble> &density) override;
117
118 bool v_HasConstantDensity() override
119 {
120 return false;
121 }
122
123 void v_GetVelocity(
124 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
125 Array<OneD, Array<OneD, NekDouble>> &velocity) override;
126
127 void v_ALEInitObject(
128 int spaceDim,
130
132
133 void InitAdvection();
134
135 void DoOdeRhs(const Array<OneD, const Array<OneD, NekDouble>> &inarray,
137 const NekDouble time);
138 void DoOdeProjection(
139 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
140 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
141
142 void DoAdvection(const Array<OneD, Array<OneD, NekDouble>> &inarray,
144 const NekDouble time,
145 const Array<OneD, Array<OneD, NekDouble>> &pFwd,
146 const Array<OneD, Array<OneD, NekDouble>> &pBwd);
147
148 void DoDiffusion(const Array<OneD, Array<OneD, NekDouble>> &inarray,
150 const Array<OneD, Array<OneD, NekDouble>> &pFwd,
151 const Array<OneD, Array<OneD, NekDouble>> &pBwd);
152
153 void GetFluxVector(
154 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
157 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
159
161 NekDouble time);
162
164
165 void GetElmtTimeStep(
166 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
168
170 const Array<OneD, const Array<OneD, NekDouble>> &inarray) override;
171
172 /// Print a summary of time stepping parameters.
174
175 void v_SetInitialConditions(NekDouble initialtime = 0.0,
176 bool dumpInitialConditions = true,
177 const int domain = 0) override;
178
179 void v_EvaluateExactSolution(unsigned int field,
180 Array<OneD, NekDouble> &outfield,
181 const NekDouble time = 0.0) override;
183 {
184 return m_gamma;
185 }
186
188 {
189 return m_vecLocs;
190 }
191
193 {
194 return m_traceNormals;
195 }
196
198 {
199 ASSERTL0(false, "This function is not valid for this class");
201 return null;
202 }
203
204 void v_ExtraFldOutput(std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
205 std::vector<std::string> &variables) override;
206
207 virtual void v_DoDiffusion(
208 const Array<OneD, Array<OneD, NekDouble>> &inarray,
210 const Array<OneD, Array<OneD, NekDouble>> &pFwd,
211 const Array<OneD, Array<OneD, NekDouble>> &pBwd) = 0;
212
214 const NekDouble SpeedSoundFactor) override;
215
216 void v_SteadyStateResidual(int step, Array<OneD, NekDouble> &L2) override;
217
218 // Virtual function that returns true if derived class supports a given
219 // shock capturing method
220 virtual bool v_SupportsShockCaptType(const std::string type) const = 0;
221
222private:
223 /// Isentropic Vortex Test Case.
224 void EvaluateIsentropicVortex(unsigned int field,
225 Array<OneD, NekDouble> &outfield,
226 NekDouble time, const int o = 0);
227
228 /// Ringleb Flow Test Case.
230};
231} // namespace Nektar
232#endif
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
void GetFluxVector(const Array< OneD, const Array< OneD, NekDouble > > &physfield, TensorOfArray3D< NekDouble > &flux)
Return the flux vector for the compressible Euler equations.
CompressibleFlowSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
void v_ALEInitObject(int spaceDim, Array< OneD, MultiRegions::ExpListSharedPtr > &fields) override
void GetElmtTimeStep(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, NekDouble > &tstep)
Calculate the maximum timestep on each element subject to CFL restrictions.
void SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble > > &physarray, NekDouble time)
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Compute the projection and call the method for imposing the boundary conditions in case of discontinu...
Array< OneD, NekDouble > m_muavTrace
virtual bool v_SupportsShockCaptType(const std::string type) const =0
MultiRegions::ExpListSharedPtr v_GetPressure() override
Array< OneD, NekDouble > GetStabilityLimitVector(const Array< OneD, int > &ExpOrder)
Function to calculate the stability limit for DG/CG (a vector of them).
void InitAdvection()
Create advection and diffusion objects for CFS.
NekDouble v_GetTimeStep(const Array< OneD, const Array< OneD, NekDouble > > &inarray) override
Calculate the maximum timestep subject to CFL restrictions.
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals()
void v_GenerateSummary(SolverUtils::SummaryList &s) override
Print a summary of time stepping parameters.
SolverUtils::DiffusionSharedPtr m_diffusion
virtual void v_DoDiffusion(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const Array< OneD, Array< OneD, NekDouble > > &pFwd, const Array< OneD, Array< OneD, NekDouble > > &pBwd)=0
void v_SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0) override
Set up logic for residual calculation.
~CompressibleFlowSystem() override=default
void GetExactRinglebFlow(int field, Array< OneD, NekDouble > &outarray)
Ringleb Flow Test Case.
void v_InitObject(bool DeclareFields=true) override
Initialization object for CompressibleFlowSystem class.
void v_GetDensity(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &density) override
void EvaluateIsentropicVortex(unsigned int field, Array< OneD, NekDouble > &outfield, NekDouble time, const int o=0)
Isentropic Vortex Test Case.
NekDouble GetStabilityLimit(int n)
Function to calculate the stability limit for DG/CG.
void GetFluxVectorDeAlias(const Array< OneD, const Array< OneD, NekDouble > > &physfield, TensorOfArray3D< NekDouble > &flux)
Return the flux vector for the compressible Euler equations by using the de-aliasing technique.
std::vector< CFSBndCondSharedPtr > m_bndConds
Array< OneD, Array< OneD, NekDouble > > m_vecLocs
void v_ExtraFldOutput(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables) override
VariableConverterSharedPtr m_varConv
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs()
void SetBoundaryConditionsBwdWeight()
Set up a weight on physical boundaries for boundary condition applications.
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
ArtificialDiffusionSharedPtr m_artificialDiffusion
Array< OneD, NekDouble > v_GetMaxStdVelocity(const NekDouble SpeedSoundFactor) override
Compute the advection velocity in the standard space for each element of the expansion.
void DoAdvection(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time, const Array< OneD, Array< OneD, NekDouble > > &pFwd, const Array< OneD, Array< OneD, NekDouble > > &pBwd)
Compute the advection terms for the right-hand side.
void InitialiseParameters()
Load CFS parameters from the session file.
void DoDiffusion(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const Array< OneD, Array< OneD, NekDouble > > &pFwd, const Array< OneD, Array< OneD, NekDouble > > &pBwd)
Add the diffusions terms to the right-hand side.
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Compute the right-hand side.
void v_SteadyStateResidual(int step, Array< OneD, NekDouble > &L2) override
void v_EvaluateExactSolution(unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time=0.0) override
void v_GetVelocity(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity) override
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
A base class for PDEs which include an advection component.
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::shared_ptr< Diffusion > DiffusionSharedPtr
A shared pointer to an EquationSystem object.
Definition: Diffusion.h:55
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:46
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
std::shared_ptr< VariableConverter > VariableConverterSharedPtr
std::shared_ptr< ArtificialDiffusion > ArtificialDiffusionSharedPtr
A shared pointer to a artificial diffusion object.
double NekDouble