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 
40 namespace Nektar
41 {
43 {
44 public:
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 
65  virtual ~VelocityCorrectionScheme();
66 
67  virtual 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,
90  Array<OneD, Array<OneD, NekDouble>> &outarray,
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 
102  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
103  Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time)
104  {
105  v_EvaluateAdvection_SetPressureBCs(inarray, outarray, time);
106  }
107 
108 protected:
109  /// bool to identify if spectral vanishing viscosity is active.
111  /// bool to identify if spectral vanishing viscosity is active.
113  /// bool to identify if GJP semi-implicit is active.
115  /// bool to identify if GJP normal Velocity should be applied
116  /// in explicit approach
118  // scaling factor for GJP penalisation, default = 1.0
120  /// cutt off ratio from which to start decayhing modes
122  /// Diffusion coefficient of SVV modes
125  /// Diffusion coefficient of SVV modes in homogeneous 1D Direction
127  /// Array of coefficient if power kernel is used in SVV
129  /// Identifier for Power Kernel otherwise DG kernel
131  /// Diffusion coefficients (will be kinvis for velocities)
133 
134  /// Variable Coefficient map for the Laplacian which can be activated as
135  /// part of SVV or otherwise
137 
138  /// Desired volumetric flowrate
140  /// Area of the boundary through which we are measuring the flowrate
142  // Bool to identify 3D1HD with forcing explicitly defined
144  /// Flux of the Stokes function solution
146  /// Current flowrate correction
148  /// Boundary ID of the flowrate reference surface
150  /// Plane ID for cases with homogeneous expansion
152  /// Flowrate reference surface
154  /// Stokes solution used to impose flowrate
156  /// Output stream to record flowrate
157  std::ofstream m_flowrateStream;
158  /// Interval at which to record flowrate data
160  /// Value of aii_dt used to compute Stokes flowrate solution.
162 
163  void SetupFlowrate(NekDouble aii_dt);
165  const Array<OneD, Array<OneD, NekDouble>> &inarray);
166 
167  // Virtual functions
168  virtual bool v_PostIntegrate(int step) override;
169 
170  virtual void v_GenerateSummary(SolverUtils::SummaryList &s) override;
171 
172  virtual void v_TransCoeffToPhys(void) override;
173 
174  virtual void v_TransPhysToCoeff(void) override;
175 
176  virtual void v_DoInitialise(void) override;
177 
178  virtual Array<OneD, bool> v_GetSystemSingularChecks() override;
179 
180  virtual int v_GetForceDimension() override;
181 
182  virtual void v_SetUpPressureForcing(
183  const Array<OneD, const Array<OneD, NekDouble>> &fields,
185 
186  virtual void v_SetUpViscousForcing(
187  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
189 
190  virtual void v_SolvePressure(const Array<OneD, NekDouble> &Forcing);
191 
192  virtual void v_SolveViscous(
193  const Array<OneD, const Array<OneD, NekDouble>> &Forcing,
194  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
195  Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble aii_Dt);
196 
198  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
199  Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
200 
201  virtual bool v_RequireFwdTrans() override
202  {
203  return false;
204  }
205 
206  virtual std::string v_GetExtrapolateStr(void)
207  {
208  return "Standard";
209  }
210 
211  virtual std::string v_GetSubSteppingExtrapolateStr(const std::string &instr)
212  {
213  return instr;
214  }
215 
217 
218  void SetUpSVV(void);
219  void SetUpExtrapolation(void);
220 
221  void SVVVarDiffCoeff(const NekDouble velmag,
222  Array<OneD, NekDouble> &diffcoeff,
223  const Array<OneD, Array<OneD, NekDouble>> &vel =
226  MultiRegions::VarFactorsMap &varFactorsMap);
227 
228 private:
229 };
230 
231 typedef std::shared_ptr<VelocityCorrectionScheme>
233 
234 } // namespace Nektar
235 
236 #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:73
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.
virtual void v_TransCoeffToPhys(void) override
Virtual function for transformation to physical space.
void SetUpPressureForcing(const Array< OneD, const Array< OneD, NekDouble >> &fields, Array< OneD, Array< OneD, NekDouble >> &Forcing, const NekDouble aii_Dt)
void EvaluateAdvection_SetPressureBCs(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time)
NekDouble m_sVVDiffCoeffHomo1D
Diffusion coefficient of SVV modes in homogeneous 1D Direction.
virtual 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.
NekDouble MeasureFlowrate(const Array< OneD, Array< OneD, NekDouble >> &inarray)
Measure the volumetric flow rate through the volumetric flow rate reference surface.
virtual bool v_PostIntegrate(int step) override
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.
virtual void v_GenerateSummary(SolverUtils::SummaryList &s) override
Print a summary of time stepping parameters.
void SolveUnsteadyStokesSystem(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time, const NekDouble a_iixDt)
Array< OneD, Array< OneD, NekDouble > > m_flowrateStokes
Stokes solution used to impose flowrate.
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)
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)
void SetUpViscousForcing(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &Forcing, const NekDouble aii_Dt)
VelocityCorrectionScheme(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Constructor.
Array< OneD, Array< OneD, NekDouble > > m_F
virtual void v_EvaluateAdvection_SetPressureBCs(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time)
void SetupFlowrate(NekDouble aii_dt)
Set up the Stokes solution used to impose constant flowrate through a boundary.
bool m_useSpecVanVisc
bool to identify if spectral vanishing viscosity is active.
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_SetUpPressureForcing(const Array< OneD, const Array< OneD, NekDouble >> &fields, Array< OneD, Array< OneD, NekDouble >> &Forcing, const NekDouble aii_Dt)
void SVVVarDiffCoeff(const NekDouble velmag, Array< OneD, NekDouble > &diffcoeff, const Array< OneD, Array< OneD, NekDouble >> &vel=NullNekDoubleArrayOfArray)
Array< OneD, NekDouble > m_diffCoeff
Diffusion coefficients (will be kinvis for velocities)
int m_flowrateSteps
Interval at which to record flowrate data.
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_InitObject(bool DeclareField=true) override
Init object for UnsteadySystem class.
void AppendSVVFactors(StdRegions::ConstFactorMap &factors, MultiRegions::VarFactorsMap &varFactorsMap)
NekDouble m_flowrateAiidt
Value of aii_dt used to compute Stokes flowrate solution.
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)
void SolvePressure(const Array< OneD, NekDouble > &Forcing)
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
virtual Array< OneD, bool > v_GetSystemSingularChecks() override
int m_flowrateBndID
Boundary ID of the flowrate reference surface.
virtual void v_DoInitialise(void) override
Sets up initial conditions.
virtual std::string v_GetSubSteppingExtrapolateStr(const std::string &instr)
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:48
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:172
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:399
std::map< StdRegions::VarCoeffType, VarCoeffEntry > VarCoeffMap
Definition: StdRegions.hpp:343
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
std::shared_ptr< VelocityCorrectionScheme > VelocityCorrectionSchemeSharedPtr
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayOfArray
double NekDouble