Nektar++
ShallowWaterSystem.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: ShallowWaterSystem.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: Generic timestepping for shallow water solvers
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_SOLVERS_SHALLOWWATERSOLVER_EQUATIONSYSTEMS_SHALLOWWATERSYSTEM_H
36#define NEKTAR_SOLVERS_SHALLOWWATERSOLVER_EQUATIONSYSTEMS_SHALLOWWATERSYSTEM_H
37
42
43namespace Nektar
44{
45
46/// Base class for unsteady solvers.
48{
49public:
51
52 /// Creates an instance of this class
56 {
59 pGraph);
60 p->InitObject();
61 return p;
62 }
63
64 /// Name of class
65 static std::string className;
66
67 /// Destructor
68 ~ShallowWaterSystem() override = default;
69
70protected:
74
75 // Implicit solver parameters
77 int m_TotLinIts = 0;
83
85
86 /// Indicates if constant depth case
88 /// Acceleration of gravity
90 /// Still water depth
92 // Bottom slopes
94 /// Coriolis force
96 // Location of velocity vector.
98
99 /// Initialises UnsteadySystem class members.
102
103 void v_InitObject(bool DeclareFields = true) override;
104
105 virtual void v_DoOdeRhs(
106 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
107 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
108
110
111 void InitialiseNonlinSysSolver(void);
112
113 void DoImplicitSolve(
114 const Array<OneD, const Array<OneD, NekDouble>> &inpnts,
115 Array<OneD, Array<OneD, NekDouble>> &outpnt, const NekDouble time,
116 const NekDouble lambda);
117
120
121 void CalcRefValues(const Array<OneD, const NekDouble> &inarray);
122
125 [[maybe_unused]] const bool &flag);
126
128 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
130
133 [[maybe_unused]] const bool &flag);
134
135 void DoNullPrecon(const Array<OneD, const NekDouble> &inarray,
136 Array<OneD, NekDouble> &outarray, const bool &flag);
137
138 void DoOdeProjection(
139 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
140 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
141
143 const Array<OneD, const Array<OneD, NekDouble>> &physarray,
144 NekDouble time);
145
146 void WallBoundary2D(int bcRegion, int cnt,
148
149 void AddCoriolis(const Array<OneD, const Array<OneD, NekDouble>> &physarray,
150 Array<OneD, Array<OneD, NekDouble>> &outarray);
151
153
155
157 {
158 return m_g;
159 }
160
162 {
163 return m_vecLocs;
164 }
165
167 {
168 return m_traceNormals;
169 }
170
172 {
173 return m_depth;
174 }
175
177 {
178 return m_constantDepth;
179 }
180
181private:
182 void EvaluateWaterDepth(void);
183
184 void EvaluateCoriolis(void);
185};
186} // namespace Nektar
187
188#endif
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
Base class for unsteady solvers.
NekDouble m_g
Acceleration of gravity.
void MatrixMultiplyMatrixFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out, const bool &flag)
static std::string className
Name of class.
void WallBoundary2D(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd)
SolverUtils::RiemannSolverSharedPtr m_riemannSolver
Array< OneD, Array< OneD, NekDouble > > m_bottomSlope
const Array< OneD, NekDouble > & GetDepth()
~ShallowWaterSystem() override=default
Destructor.
SolverUtils::DiffusionSharedPtr m_diffusion
void DoImplicitSolve1D(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out)
void SetBoundaryConditions(const Array< OneD, const Array< OneD, NekDouble > > &physarray, NekDouble time)
void AddCoriolis(const Array< OneD, const Array< OneD, NekDouble > > &physarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
LibUtilities::NekNonlinSysIterSharedPtr m_nonlinsol
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
SolverUtils::AdvectionSharedPtr m_advection
void NonlinSysEvaluator(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &out)
void DoNullPrecon(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const bool &flag)
virtual void v_DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
bool m_constantDepth
Indicates if constant depth case.
void v_GenerateSummary(SolverUtils::SummaryList &s) override
Print a summary of time stepping parameters.
ShallowWaterSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Initialises UnsteadySystem class members.
Array< OneD, NekDouble > m_coriolis
Coriolis force.
void NonlinSysEvaluator1D(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out, const bool &flag)
void DoImplicitSolve(const Array< OneD, const Array< OneD, NekDouble > > &inpnts, Array< OneD, Array< OneD, NekDouble > > &outpnt, const NekDouble time, const NekDouble lambda)
Array< OneD, Array< OneD, NekDouble > > m_vecLocs
Array< OneD, NekDouble > m_depth
Still water depth.
static SolverUtils::EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
void v_InitObject(bool DeclareFields=true) override
Init object for UnsteadySystem class.
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals()
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs()
void CalcRefValues(const Array< OneD, const NekDouble > &inarray)
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
Base class for unsteady solvers.
std::shared_ptr< NekNonlinSysIter > NekNonlinSysIterSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< RiemannSolver > RiemannSolverSharedPtr
A shared pointer to an EquationSystem object.
std::shared_ptr< Diffusion > DiffusionSharedPtr
A shared pointer to an EquationSystem object.
Definition: Diffusion.h:55
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< Advection > AdvectionSharedPtr
A shared pointer to an Advection object.
Definition: Advection.h:54
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
double NekDouble