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 
46  /// Creates an instance of this class
50  {
53  pSession, pGraph);
54  p->InitObject();
55  return p;
56  }
57 
58  /// Name of class
59  static std::string className;
60 
61  /// Constructor.
65 
66  virtual ~VelocityCorrectionScheme();
67 
68  virtual void v_InitObject();
69 
71  const Array<OneD, const Array<OneD, NekDouble> > &fields,
73  const NekDouble aii_Dt)
74  {
75  v_SetUpPressureForcing( fields, Forcing, aii_Dt);
76  }
77 
79  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
81  const NekDouble aii_Dt)
82  {
83  v_SetUpViscousForcing( inarray, Forcing, aii_Dt);
84  }
85 
87  {
89  }
90 
92  const Array<OneD, const Array<OneD, NekDouble> > &Forcing,
93  Array<OneD, Array<OneD, NekDouble> > &outarray,
94  const NekDouble aii_Dt)
95  {
96  v_SolveViscous( Forcing, outarray, aii_Dt);
97  }
98 
100  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
101  Array<OneD, Array<OneD, NekDouble> > &outarray,
102  const NekDouble time,
103  const NekDouble a_iixDt);
104 
106  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
107  Array<OneD, Array<OneD, NekDouble> > &outarray,
108  const NekDouble time)
109  {
110  v_EvaluateAdvection_SetPressureBCs( inarray, outarray, time);
111  }
112 
113  protected:
114  /// bool to identify if spectral vanishing viscosity is active.
116  /// bool to identify if spectral vanishing viscosity is active.
118  /// cutt off ratio from which to start decayhing modes
120  /// Diffusion coefficient of SVV modes
123  /// Diffusion coefficient of SVV modes in homogeneous 1D Direction
125  /// Array of coefficient if power kernel is used in SVV
127  /// Identifier for Power Kernel otherwise DG kernel
129  /// Diffusion coefficients (will be kinvis for velocities)
131 
132  /// Variable Coefficient map for the Laplacian which can be activated as part of SVV or otherwise
134 
135  /// Desired volumetric flowrate
137  /// Area of the boundary through which we are measuring the flowrate
139  // Bool to identify 3D1HD with forcing explicitly defined
141  /// Flux of the Stokes function solution
143  /// Current flowrate correction
145  /// Boundary ID of the flowrate reference surface
147  /// Plane ID for cases with homogeneous expansion
149  /// Flowrate reference surface
151  /// Stokes solution used to impose flowrate
153  /// Output stream to record flowrate
154  std::ofstream m_flowrateStream;
155  /// Interval at which to record flowrate data
157  /// Value of aii_dt used to compute Stokes flowrate solution.
159 
160  void SetupFlowrate(NekDouble aii_dt);
162  const Array<OneD, Array<OneD, NekDouble> > &inarray);
163 
164  // Virtual functions
165  virtual bool v_PostIntegrate(int step);
166 
168 
169  virtual void v_TransCoeffToPhys(void);
170 
171  virtual void v_TransPhysToCoeff(void);
172 
173  virtual void v_DoInitialise(void);
174 
176 
177  virtual int v_GetForceDimension();
178 
179  virtual void v_SetUpPressureForcing(
180  const Array<OneD, const Array<OneD, NekDouble> > &fields,
182  const NekDouble aii_Dt);
183 
184  virtual void v_SetUpViscousForcing(
185  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
187  const NekDouble aii_Dt);
188 
189  virtual void v_SolvePressure( const Array<OneD, NekDouble> &Forcing);
190 
191  virtual void v_SolveViscous(
192  const Array<OneD, const Array<OneD, NekDouble> > &Forcing,
193  Array<OneD, Array<OneD, NekDouble> > &outarray,
194  const NekDouble aii_Dt);
195 
197  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
198  Array<OneD, Array<OneD, NekDouble> > &outarray,
199  const NekDouble time);
200 
201  virtual bool v_RequireFwdTrans()
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(
212  const std::string &instr)
213  {
214  return instr;
215  }
216 
218 
219  void SetUpSVV(void);
220  void SetUpExtrapolation(void);
221 
222  void SVVVarDiffCoeff(const NekDouble velmag,
223  Array<OneD, NekDouble> &diffcoeff,
226  void AppendSVVFactors(
228  MultiRegions::VarFactorsMap &varFactorsMap);
229  private:
230 
231  };
232 
233  typedef std::shared_ptr<VelocityCorrectionScheme>
235 
236 } //end of namespace
237 
238 
239 #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.
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.
static std::string className
Name of class.
virtual void v_InitObject()
Init object for UnsteadySystem class.
NekDouble m_flowrate
Desired volumetric flowrate.
bool m_IsSVVPowerKernel
Identifier for Power Kernel otherwise DG kernel.
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of time stepping parameters.
StdRegions::VarCoeffMap m_varCoeffLap
Variable Coefficient map for the Laplacian which can be activated as part of SVV or otherwise.
virtual void v_SolveViscous(const Array< OneD, const Array< OneD, NekDouble > > &Forcing, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble aii_Dt)
virtual void v_DoInitialise(void)
Sets up initial conditions.
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 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.
virtual Array< OneD, bool > v_GetSystemSingularChecks()
virtual void v_TransPhysToCoeff(void)
Virtual function for transformation to coefficient space.
Array< OneD, Array< OneD, NekDouble > > m_F
virtual void v_SolvePressure(const Array< OneD, NekDouble > &Forcing)
VelocityCorrectionScheme(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Constructor.
virtual void v_TransCoeffToPhys(void)
Virtual function for transformation to physical space.
void SetUpViscousForcing(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &Forcing, const NekDouble aii_Dt)
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)
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.
void SolveViscous(const Array< OneD, const Array< OneD, NekDouble > > &Forcing, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble aii_Dt)
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)
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 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)
int m_planeID
Plane ID for cases with homogeneous expansion.
bool m_useHomo1DSpecVanVisc
bool to identify if spectral vanishing viscosity is active.
int m_flowrateBndID
Boundary ID of the flowrate reference surface.
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:46
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:272
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:314
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
std::shared_ptr< VelocityCorrectionScheme > VelocityCorrectionSchemeSharedPtr
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayOfArray
double NekDouble