Nektar++
Loading...
Searching...
No Matches
EquationSystems/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
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
80
82 {
83 v_SolveSolid(time);
84 }
85
87 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
89 const NekDouble aii_Dt)
90 {
91 v_SolveViscous(Forcing, inarray, outarray, aii_Dt);
92 }
93
95 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
96 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time,
97 const NekDouble a_iixDt)
98 {
99 v_SolveUnsteadyStokesSystem(inarray, outarray, time, a_iixDt);
100 }
101
103 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
104 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time)
105 {
106 v_EvaluateAdvection_SetPressureBCs(inarray, outarray, time);
107 }
108
109 void SolveEfield(const Array<OneD, Array<OneD, NekDouble>> &movEfield,
110 Array<OneD, Array<OneD, NekDouble>> &totEfield);
111
113 {
114 ASSERTL0(damping >= 0.0,
115 "The implicit Lorentz damping coefficient must be "
116 "non-negative.");
117 m_MHD.implicitLorentzDamping = damping;
118 }
119
120protected:
121 /// bool to identify if spectral vanishing viscosity is active.
123 /// bool to identify if spectral vanishing viscosity is active.
125 /// bool to identify if GJP semi-implicit is active.
127 /// bool to identify if GJP normal Velocity should be applied
128 /// in explicit approach
130 // scaling factor for GJP penalisation, default = 1.0
132 /// cutt off ratio from which to start decayhing modes
134 /// Diffusion coefficient of SVV modes
137 /// Diffusion coefficient of SVV modes in homogeneous 1D Direction
139 /// Array of coefficient if power kernel is used in SVV
141 /// Identifier for Power Kernel otherwise DG kernel
143 /// Diffusion coefficients (will be kinvis for velocities)
145
146 /// Variable Coefficient map for the Laplacian which can be activated as
147 /// part of SVV or otherwise
149
150 /// Desired volumetric flowrate
152 /// Area of the boundary through which we are measuring the flowrate
154 // Bool to identify 3D1HD with forcing explicitly defined
156 /// Flux of the Stokes function solution
158 /// Current flowrate correction
160 /// Boundary ID of the flowrate reference surface
162 /// Plane ID for cases with homogeneous expansion
164 /// Flowrate reference surface
166 /// Stokes solution used to impose flowrate
168 /// Output stream to record flowrate
169 std::ofstream m_flowrateStream;
170 /// Interval at which to record flowrate data
172 /// Decimal precision of flow rate (alpha)
174 /// Value of aii_dt used to compute Stokes flowrate solution.
176 /// Pointer to field holding electric potential field
178 /// Quasi-static MHD configuration.
179 struct
180 {
181 /// Whether ForcingLorentz is defined.
182 bool hasLorentzForce = false;
183 /// Coefficient sigma |B|^2 treated in the velocity Helmholtz solve.
186
188
189 static std::string solverTypeLookupId;
190
194
195 ~VelocityCorrectionScheme() override = default;
196
197 void v_InitObject(bool DeclareField = true) override;
198
199 void SetupFlowrate(NekDouble aii_dt);
201 const Array<OneD, Array<OneD, NekDouble>> &inarray);
202
203 // Virtual functions
204 bool v_PostIntegrate(int step) override;
205
207
208 void v_TransCoeffToPhys(void) override;
209
210 void v_TransPhysToCoeff(void) override;
211
212 void v_DoInitialise(bool dumpInitialConditions = true) override;
213
215
216 int v_GetForceDimension() override;
217
218 virtual void v_SetUpPressureForcing(
219 const Array<OneD, const Array<OneD, NekDouble>> &fields,
221
222 virtual void v_SetUpViscousForcing(
223 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
225
227
228 virtual void v_SolveSolid(NekDouble time);
229
230 virtual void v_SolveViscous(
232 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
233 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble aii_Dt);
234
235 virtual void v_SolveUnsteadyStokesSystem(
236 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
237 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time,
238 const NekDouble a_iixDt);
239
241 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
242 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
243
244 bool v_RequireFwdTrans() override
245 {
246 return false;
247 }
248
249 virtual std::string v_GetExtrapolateStr(void)
250 {
251 return "Standard";
252 }
253
254 virtual std::string v_GetSubSteppingExtrapolateStr(const std::string &instr)
255 {
256 return instr;
257 }
258
259 void SetUpSVV(void);
260 void SetUpExtrapolation(void);
261
262 void SVVVarDiffCoeff(const NekDouble velmag,
263 Array<OneD, NekDouble> &diffcoeff,
264 const Array<OneD, Array<OneD, NekDouble>> &vel =
267 StdRegions::VarFactorsMap &varFactorsMap);
268
270 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
271 StdRegions::VarCoeffMap &varcoeffs);
272 void UpdateVelocityBCs(NekDouble time);
273
275 const std::vector<std::string> &strFrameData,
276 const Array<OneD, NekDouble> &movingFrameData,
277 std::map<std::string, NekDouble> &params);
278
280 const Array<OneD, Array<OneD, NekDouble>> &movEfield);
281
282private:
283};
284
285typedef std::shared_ptr<VelocityCorrectionScheme>
287
288} // namespace Nektar
289
290#endif // VELOCITY_CORRECTION_SCHEME_H
#define ASSERTL0(condition, msg)
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:72
NekDouble m_greenFlux
Flux of the Stokes function solution.
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.
bool hasLorentzForce
Whether ForcingLorentz is defined.
MultiRegions::ExpListSharedPtr m_epotential
Pointer to field holding electric potential field.
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)
int m_flowrateStepsPrecision
Decimal precision of flow rate (alpha)
bool m_useGJPStabilisation
bool to identify if GJP semi-implicit is active.
virtual void v_SolvePressure(const Array< OneD, NekDouble > &Forcing)
void AddMovingFrameDataToParams(const std::vector< std::string > &strFrameData, const Array< OneD, NekDouble > &movingFrameData, std::map< std::string, NekDouble > &params)
void AppendSVVFactors(StdRegions::ConstFactorMap &factors, StdRegions::VarFactorsMap &varFactorsMap)
void SolveEfield(const Array< OneD, Array< OneD, NekDouble > > &movEfield, Array< OneD, Array< OneD, NekDouble > > &totEfield)
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.
struct Nektar::VelocityCorrectionScheme::@2 m_MHD
Quasi-static MHD configuration.
NekDouble implicitLorentzDamping
Coefficient sigma |B|^2 treated in the velocity Helmholtz solve.
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 SetEPInsulatorBCs(const Array< OneD, Array< OneD, NekDouble > > &movEfield)
void v_InitObject(bool DeclareField=true) override
Initialisation object for the unsteady diffusion problem.
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
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::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:287
std::map< StdRegions::ConstFactorType, Array< OneD, NekDouble > > VarFactorsMap
std::map< ConstFactorType, NekDouble > ConstFactorMap
std::map< StdRegions::VarCoeffType, VarCoeffEntry > VarCoeffMap
std::shared_ptr< VelocityCorrectionScheme > VelocityCorrectionSchemeSharedPtr
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayOfArray