Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Velocity Correction Scheme for the Incompressible
33 // Navier Stokes equations using Weak Pressure formulation
34 ///////////////////////////////////////////////////////////////////////////////
35 
38 #include <SolverUtils/Core/Misc.h>
39 
40 #include <boost/algorithm/string.hpp>
41 
42 using namespace std;
43 
44 namespace Nektar
45 {
46  string VCSWeakPressure::className =
48  "VCSWeakPressure",
49  VCSWeakPressure::create);
50 
51  /**
52  * Constructor. Creates ...
53  *
54  * \param
55  * \param
56  */
57  VCSWeakPressure::VCSWeakPressure(
59  : UnsteadySystem(pSession),
60  VelocityCorrectionScheme(pSession)
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  if (m_extrapolation->GetSubStepIntegrationMethod() !=
82  {
83  SolverUtils::AddSummaryItem(s, "Substepping",
85  m_extrapolation->GetSubStepIntegrationMethod()]);
86  }
87 
88  string dealias = m_homogen_dealiasing ? "Homogeneous1D" : "";
90  {
91  dealias += (dealias == "" ? "" : " + ") + string("spectral/hp");
92  }
93  if (dealias != "")
94  {
95  SolverUtils::AddSummaryItem(s, "Dealiasing", dealias);
96  }
97 
98  string smoothing = m_useSpecVanVisc ? "spectral/hp" : "";
100  {
101  smoothing += (smoothing == "" ? "" : " + ") + string("Homogeneous1D");
102  }
103  if (smoothing != "")
104  {
106  s, "Smoothing", "SVV (" + smoothing + " SVV (cut-off = "
107  + boost::lexical_cast<string>(m_sVVCutoffRatio)
108  + ", diff coeff = "
109  + boost::lexical_cast<string>(m_sVVDiffCoeff)+")");
110  }
111 
112  }
113 
114  /**
115  * Weak Forcing term for Poisson solver solver
116  */
118  const Array<OneD, const Array<OneD, NekDouble> > &fields,
120  const NekDouble aii_Dt)
121  {
122  int ncoeffs = m_fields[0]->GetNcoeffs();
123 
124  m_fields[0]->IProductWRTDerivBase(fields,Forcing[0]);
125 
126  // aii required since time integration scheme normalises against aii
127  Vmath::Smul(ncoeffs,-1.0/aii_Dt,Forcing[0],1,Forcing[0],1);
128  }
129 
130  /**
131  * Solve pressure system
132  */
135  {
137  // Setup coefficient for equation
138  factors[StdRegions::eFactorLambda] = 0.0;
139 
140  // Solver Pressure Poisson Equation
141  m_pressure->HelmSolve(Forcing, m_pressure->UpdateCoeffs(),
142  NullFlagList,
144  NullNekDouble1DArray, false);
145 
146  // Add presure to outflow bc if using convective like BCs
147  m_extrapolation->AddPressureToOutflowBCs(m_kinvis);
148  }
149 
150 } //end of namespace
virtual void v_SetUpPressureForcing(const Array< OneD, const Array< OneD, NekDouble > > &fields, Array< OneD, Array< OneD, NekDouble > > &Forcing, const NekDouble aii_Dt)
static Array< OneD, NekDouble > NullNekDouble1DArray
NekDouble m_kinvis
Kinematic viscosity.
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:47
bool m_useHomo1DSpecVanVisc
bool to identify if spectral vanishing viscosity is active.
NekDouble m_sVVDiffCoeff
Diffusion coefficient of SVV modes.
ExtrapolateSharedPtr m_extrapolation
STL namespace.
bool m_specHP_dealiasing
Flag to determine if dealisising is usde for the Spectral/hp element discretisation.
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:252
const char *const TimeIntegrationMethodMap[]
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary(SummaryList &s)
Print a summary of time stepping parameters.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Definition: Vmath.cpp:213
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of time stepping parameters.
Base class for unsteady solvers.
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
Definition: Misc.cpp:50
virtual void v_SolvePressure(const Array< OneD, NekDouble > &Forcing)
double NekDouble
bool m_homogen_dealiasing
Flag to determine if dealiasing is used for homogeneous simulations.
EquationSystemFactory & GetEquationSystemFactory()
NekDouble m_sVVCutoffRatio
cutt off ratio from which to start decayhing modes
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
bool m_useSpecVanVisc
bool to identify if spectral vanishing viscosity is active.
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
Defines a forcing term to be explicitly applied.
Definition: Forcing.h:70
enum HomogeneousType m_HomogeneousType
static FlagList NullFlagList
An empty flag list.
static VarCoeffMap NullVarCoeffMap
Definition: StdRegions.hpp:228
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:215