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:
46
47 /// Creates an instance of this class
51 {
54 pGraph);
55 p->InitObject();
56 return p;
57 }
58
59 /// Name of class
60 static std::string className;
61
63 const Array<OneD, const Array<OneD, NekDouble>> &fields,
65 {
66 v_SetUpPressureForcing(fields, Forcing, aii_Dt);
67 }
68
70 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
72 {
73 v_SetUpViscousForcing(inarray, Forcing, aii_Dt);
74 }
75
77 {
79 }
80
82 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
84 const NekDouble aii_Dt)
85 {
86 v_SolveViscous(Forcing, inarray, outarray, aii_Dt);
87 }
88
90 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
91 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time,
92 const NekDouble a_iixDt)
93 {
94 v_SolveUnsteadyStokesSystem(inarray, outarray, time, a_iixDt);
95 }
96
98 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
99 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time)
100 {
101 v_EvaluateAdvection_SetPressureBCs(inarray, outarray, time);
102 }
103
104protected:
105 /// bool to identify if spectral vanishing viscosity is active.
107 /// bool to identify if spectral vanishing viscosity is active.
109 /// bool to identify if GJP semi-implicit is active.
111 /// bool to identify if GJP normal Velocity should be applied
112 /// in explicit approach
114 // scaling factor for GJP penalisation, default = 1.0
116 /// cutt off ratio from which to start decayhing modes
118 /// Diffusion coefficient of SVV modes
121 /// Diffusion coefficient of SVV modes in homogeneous 1D Direction
123 /// Array of coefficient if power kernel is used in SVV
125 /// Identifier for Power Kernel otherwise DG kernel
127 /// Diffusion coefficients (will be kinvis for velocities)
129
130 /// Variable Coefficient map for the Laplacian which can be activated as
131 /// part of SVV or otherwise
133
134 /// Desired volumetric flowrate
136 /// Area of the boundary through which we are measuring the flowrate
138 // Bool to identify 3D1HD with forcing explicitly defined
140 /// Flux of the Stokes function solution
142 /// Current flowrate correction
144 /// Boundary ID of the flowrate reference surface
146 /// Plane ID for cases with homogeneous expansion
148 /// Flowrate reference surface
150 /// Stokes solution used to impose flowrate
152 /// Output stream to record flowrate
153 std::ofstream m_flowrateStream;
154 /// Interval at which to record flowrate data
156 /// Value of aii_dt used to compute Stokes flowrate solution.
158
160
161 static std::string solverTypeLookupId;
162
166
167 ~VelocityCorrectionScheme() override = default;
168
169 void v_InitObject(bool DeclareField = true) override;
170
171 void SetupFlowrate(NekDouble aii_dt);
173 const Array<OneD, Array<OneD, NekDouble>> &inarray);
174
175 // Virtual functions
176 bool v_PostIntegrate(int step) override;
177
179
180 void v_TransCoeffToPhys(void) override;
181
182 void v_TransPhysToCoeff(void) override;
183
184 void v_DoInitialise(bool dumpInitialConditions = true) override;
185
187
188 int v_GetForceDimension() override;
189
190 virtual void v_SetUpPressureForcing(
191 const Array<OneD, const Array<OneD, NekDouble>> &fields,
193
194 virtual void v_SetUpViscousForcing(
195 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
197
199
200 virtual void v_SolveViscous(
202 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
203 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble aii_Dt);
204
205 virtual void v_SolveUnsteadyStokesSystem(
206 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
207 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time,
208 const NekDouble a_iixDt);
209
211 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
212 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
213
214 bool v_RequireFwdTrans() override
215 {
216 return false;
217 }
218
219 virtual std::string v_GetExtrapolateStr(void)
220 {
221 return "Standard";
222 }
223
224 virtual std::string v_GetSubSteppingExtrapolateStr(const std::string &instr)
225 {
226 return instr;
227 }
228
229 void SetUpSVV(void);
230 void SetUpExtrapolation(void);
231
232 void SVVVarDiffCoeff(const NekDouble velmag,
233 Array<OneD, NekDouble> &diffcoeff,
234 const Array<OneD, Array<OneD, NekDouble>> &vel =
237 MultiRegions::VarFactorsMap &varFactorsMap);
238
240 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
241 StdRegions::VarCoeffMap &varcoeffs);
242
243private:
244};
245
246typedef std::shared_ptr<VelocityCorrectionScheme>
248
249} // namespace Nektar
250
251#endif // VELOCITY_CORRECTION_SCHEME_H
This class is the base class for Navier Stokes problems.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
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.
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)
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)
static std::string className
Name of class.
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)
~VelocityCorrectionScheme() override=default
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