Nektar++
VelocityCorrectionSchemeWeakPressure.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: VelocityCorrectionSchemeWeakPressure.cpp
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 for the Incompressible
32 // Navier Stokes equations using Weak Pressure formulation
33 ///////////////////////////////////////////////////////////////////////////////
34 
37 #include <SolverUtils/Core/Misc.h>
38 
39 #include <boost/algorithm/string.hpp>
40 
41 using namespace std;
42 
43 namespace Nektar
44 {
45 string VCSWeakPressure::className =
47  "VCSWeakPressure", VCSWeakPressure::create);
48 
49 /**
50  * Constructor. Creates ...
51  *
52  * \param
53  * \param
54  */
55 VCSWeakPressure::VCSWeakPressure(
58  : UnsteadySystem(pSession, pGraph),
59  VelocityCorrectionScheme(pSession, pGraph)
60 {
61 }
62 
63 /**
64  * Destructor
65  */
67 {
68 }
69 
70 /**
71  *
72  */
74 {
76 
77  SolverUtils::AddSummaryItem(s, "Splitting Scheme",
78  "Velocity correction (weak press. form)");
79 
80  if (m_extrapolation->GetSubStepName().size())
81  {
82  SolverUtils::AddSummaryItem(s, "Substepping",
83  m_extrapolation->GetSubStepName());
84  }
85 
86  string dealias = m_homogen_dealiasing ? "Homogeneous1D" : "";
88  {
89  dealias += (dealias == "" ? "" : " + ") + string("spectral/hp");
90  }
91  if (dealias != "")
92  {
93  SolverUtils::AddSummaryItem(s, "Dealiasing", dealias);
94  }
95 
96  string smoothing = m_useSpecVanVisc ? "spectral/hp" : "";
98  {
99  smoothing += (smoothing == "" ? "" : " + ") + string("Homogeneous1D");
100  }
101  if (smoothing != "")
102  {
104  s, "Smoothing",
105  "SVV (" + smoothing + " SVV (cut-off = " +
106  boost::lexical_cast<string>(m_sVVCutoffRatio) +
107  ", diff coeff = " +
108  boost::lexical_cast<string>(m_sVVDiffCoeff) + ")");
109  }
110 }
111 
112 /**
113  * Weak Forcing term for Poisson solver solver
114  */
116  const Array<OneD, const Array<OneD, NekDouble>> &fields,
118 {
119  int ncoeffs = m_pressure->GetNcoeffs();
120 
121  m_pressure->IProductWRTDerivBase(fields, Forcing[0]);
122 
123  // aii required since time integration scheme normalises against aii
124  Vmath::Smul(ncoeffs, -1.0 / aii_Dt, Forcing[0], 1, Forcing[0], 1);
125 }
126 
127 /**
128  * Solve pressure system
129  */
131 {
133  // Setup coefficient for equation
134  factors[StdRegions::eFactorLambda] = 0.0;
135 
136  // Solver Pressure Poisson Equation
137  m_pressure->HelmSolve(Forcing, m_pressure->UpdateCoeffs(), factors,
140  false);
141 
142  // Add presure to outflow bc if using convective like BCs
143  m_extrapolation->AddPressureToOutflowBCs(m_kinvis);
144 }
145 
146 } // namespace Nektar
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
NekDouble m_kinvis
Kinematic viscosity.
ExtrapolateSharedPtr m_extrapolation
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:198
bool m_specHP_dealiasing
Flag to determine if dealisising is usde for the Spectral/hp element discretisation.
enum HomogeneousType m_HomogeneousType
bool m_homogen_dealiasing
Flag to determine if dealiasing is used for homogeneous simulations.
Defines a forcing term to be explicitly applied.
Definition: Forcing.h:73
Base class for unsteady solvers.
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary(SummaryList &s) override
Print a summary of time stepping parameters.
virtual void v_SetUpPressureForcing(const Array< OneD, const Array< OneD, NekDouble >> &fields, Array< OneD, Array< OneD, NekDouble >> &Forcing, const NekDouble aii_Dt) override
virtual void v_GenerateSummary(SolverUtils::SummaryList &s) override
Print a summary of time stepping parameters.
virtual void v_SolvePressure(const Array< OneD, NekDouble > &Forcing) override
NekDouble m_sVVCutoffRatio
cutt off ratio from which to start decayhing modes
NekDouble m_sVVDiffCoeff
Diffusion coefficient of SVV modes.
bool m_useSpecVanVisc
bool to identify if spectral vanishing viscosity is active.
bool m_useHomo1DSpecVanVisc
bool to identify if spectral vanishing viscosity is active.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
static VarFactorsMap NullVarFactorsMap
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:48
EquationSystemFactory & GetEquationSystemFactory()
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
Definition: Misc.cpp:49
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:172
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:399
static VarCoeffMap NullVarCoeffMap
Definition: StdRegions.hpp:344
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
static Array< OneD, NekDouble > NullNekDouble1DArray
double NekDouble
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition: Vmath.cpp:248