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",
48  VCSWeakPressure::create);
49 
50  /**
51  * Constructor. Creates ...
52  *
53  * \param
54  * \param
55  */
56  VCSWeakPressure::VCSWeakPressure(
59  : UnsteadySystem(pSession, pGraph),
60  VelocityCorrectionScheme(pSession, pGraph)
61  {
62 
63  }
64 
65  /**
66  * Destructor
67  */
69  {
70  }
71 
72  /**
73  *
74  */
76  {
78 
79  SolverUtils::AddSummaryItem(s, "Splitting Scheme", "Velocity correction (weak press. form)");
80 
81  if( m_extrapolation->GetSubStepName().size() )
82  {
83  SolverUtils::AddSummaryItem( s, "Substepping",
84  m_extrapolation->GetSubStepName() );
85  }
86 
87  string dealias = m_homogen_dealiasing ? "Homogeneous1D" : "";
89  {
90  dealias += (dealias == "" ? "" : " + ") + string("spectral/hp");
91  }
92  if (dealias != "")
93  {
94  SolverUtils::AddSummaryItem(s, "Dealiasing", dealias);
95  }
96 
97  string smoothing = m_useSpecVanVisc ? "spectral/hp" : "";
99  {
100  smoothing += (smoothing == "" ? "" : " + ") + string("Homogeneous1D");
101  }
102  if (smoothing != "")
103  {
105  s, "Smoothing", "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  /**
114  * Weak Forcing term for Poisson solver solver
115  */
117  const Array<OneD, const Array<OneD, NekDouble> > &fields,
119  const NekDouble aii_Dt)
120  {
121  int ncoeffs = m_fields[0]->GetNcoeffs();
122 
123  m_fields[0]->IProductWRTDerivBase(fields,Forcing[0]);
124 
125  // aii required since time integration scheme normalises against aii
126  Vmath::Smul(ncoeffs,-1.0/aii_Dt,Forcing[0],1,Forcing[0],1);
127  }
128 
129  /**
130  * Solve pressure system
131  */
134  {
136  // Setup coefficient for equation
137  factors[StdRegions::eFactorLambda] = 0.0;
138 
139  // Solver Pressure Poisson Equation
140  m_pressure->HelmSolve(Forcing, m_pressure->UpdateCoeffs(),
143  NullNekDouble1DArray, false);
144 
145  // Add presure to outflow bc if using convective like BCs
146  m_extrapolation->AddPressureToOutflowBCs(m_kinvis);
147  }
148 
149 } //end of namespace
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:200
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
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)
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)
virtual void v_SolvePressure(const Array< OneD, NekDouble > &Forcing)
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of time stepping parameters.
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:46
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:47
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:314
static VarCoeffMap NullVarCoeffMap
Definition: StdRegions.hpp:273
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
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:225