Nektar++
VelocityCorrectionScheme.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: VelocityCorrectionScheme.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: Velocity Correction Scheme header
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_SOLVERS_VELOCITYCORRECTIONSCHEME_H
36#define NEKTAR_SOLVERS_VELOCITYCORRECTIONSCHEME_H
37
39
40namespace Nektar
41{
43{
44public:
45 /// Creates an instance of this class
49 {
52 pGraph);
53 p->InitObject();
54 return p;
55 }
56
57 /// Name of class
58 static std::string className;
59
60 /// Constructor.
64
66
67 void v_InitObject(bool DeclareField = true) override;
68
70 const Array<OneD, const Array<OneD, NekDouble>> &fields,
72 {
73 v_SetUpPressureForcing(fields, Forcing, aii_Dt);
74 }
75
77 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
79 {
80 v_SetUpViscousForcing(inarray, Forcing, aii_Dt);
81 }
82
84 {
86 }
87
89 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
91 const NekDouble aii_Dt)
92 {
93 v_SolveViscous(Forcing, inarray, outarray, aii_Dt);
94 }
95
97 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
98 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time,
99 const NekDouble a_iixDt)
100 {
101 v_SolveUnsteadyStokesSystem(inarray, outarray, time, a_iixDt);
102 }
103
105 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
106 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time)
107 {
108 v_EvaluateAdvection_SetPressureBCs(inarray, outarray, time);
109 }
110
111protected:
112 /// bool to identify if spectral vanishing viscosity is active.
114 /// bool to identify if spectral vanishing viscosity is active.
116 /// bool to identify if GJP semi-implicit is active.
118 /// bool to identify if GJP normal Velocity should be applied
119 /// in explicit approach
121 // scaling factor for GJP penalisation, default = 1.0
123 /// cutt off ratio from which to start decayhing modes
125 /// Diffusion coefficient of SVV modes
128 /// Diffusion coefficient of SVV modes in homogeneous 1D Direction
130 /// Array of coefficient if power kernel is used in SVV
132 /// Identifier for Power Kernel otherwise DG kernel
134 /// Diffusion coefficients (will be kinvis for velocities)
136
137 /// Variable Coefficient map for the Laplacian which can be activated as
138 /// part of SVV or otherwise
140
141 /// Desired volumetric flowrate
143 /// Area of the boundary through which we are measuring the flowrate
145 // Bool to identify 3D1HD with forcing explicitly defined
147 /// Flux of the Stokes function solution
149 /// Current flowrate correction
151 /// Boundary ID of the flowrate reference surface
153 /// Plane ID for cases with homogeneous expansion
155 /// Flowrate reference surface
157 /// Stokes solution used to impose flowrate
159 /// Output stream to record flowrate
160 std::ofstream m_flowrateStream;
161 /// Interval at which to record flowrate data
163 /// Value of aii_dt used to compute Stokes flowrate solution.
165
166 static std::string solverTypeLookupId;
167
168 void SetupFlowrate(NekDouble aii_dt);
170 const Array<OneD, Array<OneD, NekDouble>> &inarray);
171
172 // Virtual functions
173 bool v_PostIntegrate(int step) override;
174
176
177 void v_TransCoeffToPhys(void) override;
178
179 void v_TransPhysToCoeff(void) override;
180
181 void v_DoInitialise(bool dumpInitialConditions = true) override;
182
184
185 int v_GetForceDimension() override;
186
187 virtual void v_SetUpPressureForcing(
188 const Array<OneD, const Array<OneD, NekDouble>> &fields,
190
191 virtual void v_SetUpViscousForcing(
192 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
194
196
197 virtual void v_SolveViscous(
199 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
200 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble aii_Dt);
201
202 virtual void v_SolveUnsteadyStokesSystem(
203 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
204 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time,
205 const NekDouble a_iixDt);
206
208 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
209 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
210
211 bool v_RequireFwdTrans() override
212 {
213 return false;
214 }
215
216 virtual std::string v_GetExtrapolateStr(void)
217 {
218 return "Standard";
219 }
220
221 virtual std::string v_GetSubSteppingExtrapolateStr(const std::string &instr)
222 {
223 return instr;
224 }
225
227
228 void SetUpSVV(void);
229 void SetUpExtrapolation(void);
230
231 void SVVVarDiffCoeff(const NekDouble velmag,
232 Array<OneD, NekDouble> &diffcoeff,
233 const Array<OneD, Array<OneD, NekDouble>> &vel =
236 MultiRegions::VarFactorsMap &varFactorsMap);
237
239 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
240 StdRegions::VarCoeffMap &varcoeffs);
241
242private:
243};
244
245typedef std::shared_ptr<VelocityCorrectionScheme>
247
248} // namespace Nektar
249
250#endif // VELOCITY_CORRECTION_SCHEME_H
This class is the base class for Navier Stokes problems.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
Defines a forcing term to be explicitly applied.
Definition: Forcing.h:71
NekDouble m_greenFlux
Flux of the Stokes function solution.
virtual std::string v_GetExtrapolateStr(void)
MultiRegions::ExpListSharedPtr m_flowrateBnd
Flowrate reference surface.
Array< OneD, NekDouble > m_svvVarDiffCoeff
Array of coefficient if power kernel is used in SVV.
void v_TransCoeffToPhys(void) override
Virtual function for transformation to physical space.
NekDouble MeasureFlowrate(const Array< OneD, Array< OneD, NekDouble > > &inarray)
Measure the volumetric flow rate through the volumetric flow rate reference surface.
NekDouble m_sVVDiffCoeffHomo1D
Diffusion coefficient of SVV modes in homogeneous 1D Direction.
void v_TransPhysToCoeff(void) override
Virtual function for transformation to coefficient space.
static std::string className
Name of class.
NekDouble m_flowrate
Desired volumetric flowrate.
bool m_IsSVVPowerKernel
Identifier for Power Kernel otherwise DG kernel.
StdRegions::VarCoeffMap m_varCoeffLap
Variable Coefficient map for the Laplacian which can be activated as part of SVV or otherwise.
static SolverUtils::EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
NekDouble m_sVVCutoffRatio
cutt off ratio from which to start decayhing modes
NekDouble m_sVVDiffCoeff
Diffusion coefficient of SVV modes.
void v_GenerateSummary(SolverUtils::SummaryList &s) override
Print a summary of time stepping parameters.
void EvaluateAdvection_SetPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Array< OneD, Array< OneD, NekDouble > > m_flowrateStokes
Stokes solution used to impose flowrate.
void SolveUnsteadyStokesSystem(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time, const NekDouble a_iixDt)
NekDouble m_alpha
Current flowrate correction.
bool m_useGJPStabilisation
bool to identify if GJP semi-implicit is active.
virtual void v_SolvePressure(const Array< OneD, NekDouble > &Forcing)
VelocityCorrectionScheme(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Constructor.
Array< OneD, Array< OneD, NekDouble > > m_F
void SetUpViscousForcing(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &Forcing, const NekDouble aii_Dt)
virtual void v_SolveUnsteadyStokesSystem(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time, const NekDouble a_iixDt)
void SetupFlowrate(NekDouble aii_dt)
Set up the Stokes solution used to impose constant flowrate through a boundary.
void SetUpPressureForcing(const Array< OneD, const Array< OneD, NekDouble > > &fields, Array< OneD, Array< OneD, NekDouble > > &Forcing, const NekDouble aii_Dt)
void SolveViscous(const Array< OneD, const Array< OneD, NekDouble > > &Forcing, const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble aii_Dt)
virtual void v_SetUpPressureForcing(const Array< OneD, const Array< OneD, NekDouble > > &fields, Array< OneD, Array< OneD, NekDouble > > &Forcing, const NekDouble aii_Dt)
bool m_useSpecVanVisc
bool to identify if spectral vanishing viscosity is active.
Array< OneD, NekDouble > m_diffCoeff
Diffusion coefficients (will be kinvis for velocities)
int m_flowrateSteps
Interval at which to record flowrate data.
void SVVVarDiffCoeff(const NekDouble velmag, Array< OneD, NekDouble > &diffcoeff, const Array< OneD, Array< OneD, NekDouble > > &vel=NullNekDoubleArrayOfArray)
virtual void v_SolveViscous(const Array< OneD, const Array< OneD, NekDouble > > &Forcing, const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble aii_Dt)
NekDouble m_flowrateArea
Area of the boundary through which we are measuring the flowrate.
std::ofstream m_flowrateStream
Output stream to record flowrate.
virtual void v_SetUpViscousForcing(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &Forcing, const NekDouble aii_Dt)
virtual void v_EvaluateAdvection_SetPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
void v_InitObject(bool DeclareField=true) override
Initialisation object for EquationSystem.
void AppendSVVFactors(StdRegions::ConstFactorMap &factors, MultiRegions::VarFactorsMap &varFactorsMap)
NekDouble m_flowrateAiidt
Value of aii_dt used to compute Stokes flowrate solution.
void SolvePressure(const Array< OneD, NekDouble > &Forcing)
void v_DoInitialise(bool dumpInitialConditions=true) override
Sets up initial conditions.
int m_planeID
Plane ID for cases with homogeneous expansion.
bool m_useHomo1DSpecVanVisc
bool to identify if spectral vanishing viscosity is active.
bool m_useGJPNormalVel
bool to identify if GJP normal Velocity should be applied in explicit approach
Array< OneD, bool > v_GetSystemSingularChecks() override
int m_flowrateBndID
Boundary ID of the flowrate reference surface.
virtual std::string v_GetSubSteppingExtrapolateStr(const std::string &instr)
void ComputeGJPNormalVelocity(const Array< OneD, const Array< OneD, NekDouble > > &inarray, StdRegions::VarCoeffMap &varcoeffs)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::map< StdRegions::ConstFactorType, Array< OneD, NekDouble > > VarFactorsMap
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:46
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:430
std::map< StdRegions::VarCoeffType, VarCoeffEntry > VarCoeffMap
Definition: StdRegions.hpp:375
StdRegions::ConstFactorMap factors
std::shared_ptr< VelocityCorrectionScheme > VelocityCorrectionSchemeSharedPtr
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayOfArray
double NekDouble