Nektar++
MMFSWE.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: MMFSWE.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: MMF advection solve routines
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_SOLVERS_ADRSOLVER_EQUATIONSYSTEMS_MMFSWE_H
36#define NEKTAR_SOLVERS_ADRSOLVER_EQUATIONSYSTEMS_MMFSWE_H
37
39
40namespace Nektar
41{
42
44{
51 SIZE_TestType ///< Length of enum list
52};
53
54const char *const TestTypeMap[] = {
55 "TestPlane", "TestSteadyZonal",
56 "TestUnsteadyZonal", "TestIsolatedMountain",
57 "TestUnstableJet", "TestRossbyWave",
58};
59
61{
62public:
63 friend class MemoryManager<MMFSWE>;
64
65 /// Creates an instance of this class
69 {
72 p->InitObject();
73 return p;
74 }
75 /// Name of class
76 static std::string className;
77
79
80 /// Destructor
81 ~MMFSWE() override = default;
82
83protected:
84 /// Still water depth
87
88 /// Coriolis force
90
92
93 NekDouble m_g; // Gravity
94 NekDouble m_alpha, m_u0, m_Omega, m_H0, m_Hvar; // TestSteadyZonal
95 NekDouble m_k2; // eTestUnsteadyZonal
96 NekDouble m_hs0; // eTestIsolatedMountain
98 NekDouble m_angfreq, m_K; // eTestRossbyWave
99
101
102 /// Indicates if variables are primitive or conservative
104
105 /// Advection velocity
109
110 // Plane (used only for Discontinous projection
111 // with 3DHomogenoeus1D expansion)
113
114 /// Session reader
117
118 /// Compute the RHS
119 void DoOdeRhs(const Array<OneD, const Array<OneD, NekDouble>> &inarray,
121 const NekDouble time);
122
123 /// Compute the projection
124 void DoOdeProjection(
125 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
126 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
127
128 void SteadyZonalFlow(unsigned int field, Array<OneD, NekDouble> &outfield);
129
130 void UnsteadyZonalFlow(unsigned int field, const NekDouble time,
131 Array<OneD, NekDouble> &outfield);
132
133 void IsolatedMountainFlow(unsigned int field, const NekDouble time,
134 Array<OneD, NekDouble> &outfield);
135
136 void UnstableJetFlow(unsigned int field, const NekDouble time,
137 Array<OneD, NekDouble> &outfield);
138
139 void RossbyWave(unsigned int field, Array<OneD, NekDouble> &outfield);
140
142
144
146
150
154
157 Array<OneD, NekDouble> &Vorticity);
158
160
162 const Array<OneD, const Array<OneD, NekDouble>> &physin,
164
166 const Array<OneD, const Array<OneD, NekDouble>> &physin,
168
171
173 Array<OneD, Array<OneD, NekDouble>> &OutField);
174
176 Array<OneD, Array<OneD, NekDouble>> &outarray);
177
179 Array<OneD, Array<OneD, NekDouble>> &numfluxFwd,
180 Array<OneD, Array<OneD, NekDouble>> &numfluxBwd);
181
182 void GetSWEFluxVector(
183 const int i, const Array<OneD, const Array<OneD, NekDouble>> &physfield,
185
186 void RiemannSolverHLLC(const int index, NekDouble hL, NekDouble uL,
187 NekDouble vL, NekDouble hR, NekDouble uR,
188 NekDouble vR, Array<OneD, NekDouble> &numfluxF,
189 Array<OneD, NekDouble> &numfluxB);
190
192 NekDouble hR, NekDouble uR, NekDouble vR,
193 NekDouble hstar, NekDouble &hflux, NekDouble &huflux,
194 NekDouble &hvflux);
195
196 void AverageFlux(const int index, NekDouble hL, NekDouble uL, NekDouble vL,
197 NekDouble hR, NekDouble uR, NekDouble vR,
198 Array<OneD, NekDouble> &numfluxF,
199 Array<OneD, NekDouble> &numfluxB);
200
201 void LaxFriedrichFlux(const int index, NekDouble hL, NekDouble uL,
202 NekDouble vL, NekDouble hR, NekDouble uR,
203 NekDouble vR, Array<OneD, NekDouble> &numfluxF,
204 Array<OneD, NekDouble> &numfluxB);
205
206 void RusanovFlux(const int index, NekDouble hL, NekDouble uL, NekDouble vL,
207 NekDouble hR, NekDouble uR, NekDouble vR,
208 Array<OneD, NekDouble> &numfluxF,
209 Array<OneD, NekDouble> &numfluxB);
210
211 void ComputeMagAndDot(const int index, NekDouble &MageF1, NekDouble &MageF2,
212 NekDouble &MageB1, NekDouble &MageB2,
213 NekDouble &eF1_cdot_eB1, NekDouble &eF1_cdot_eB2,
214 NekDouble &eF2_cdot_eB1, NekDouble &eF2_cdot_eB2);
215
217 Array<OneD, Array<OneD, NekDouble>> &outarray);
218
220 Array<OneD, Array<OneD, NekDouble>> &outarray);
221
223 Array<OneD, Array<OneD, NekDouble>> &outarray);
224
226 const int indm, const int indk,
227 const Array<OneD, const Array<OneD, NekDouble>> &physarray,
228 Array<OneD, NekDouble> &outarray);
229
231
232 void EvaluateWaterDepth(void);
233
234 void EvaluateCoriolis(void);
237
239 NekDouble time);
240 void WallBoundary2D(int bcRegion, int cnt,
241 Array<OneD, Array<OneD, NekDouble>> &physarray);
242
243 /// Initialise the object
244 void v_InitObject(bool DeclareFields = true) override;
245
246 void v_DoSolve() override;
247
248 void v_DoInitialise(bool dumpInitialConditions = false) override;
249
250 /// Print Summary
252
253 void v_SetInitialConditions(const NekDouble initialtime = 0.0,
254 bool dumpInitialConditions = true,
255 const int domain = 0) override;
256
257 void v_EvaluateExactSolution(unsigned int field,
258 Array<OneD, NekDouble> &outfield,
259 const NekDouble time) override;
260
261 NekDouble v_L2Error(unsigned int field,
262 const Array<OneD, NekDouble> &exactsoln,
263 bool Normalised) override;
264
265 NekDouble v_LinfError(unsigned int field,
266 const Array<OneD, NekDouble> &exactsoln) override;
267
268private:
271
272 void TestSWE2Dproblem(const NekDouble time, unsigned int field,
273 Array<OneD, NekDouble> &outfield);
274
275 void Checkpoint_Output_Cartesian(std::string outname);
276};
277} // namespace Nektar
278
279#endif
void ComputeVorticity(const Array< OneD, const NekDouble > &u, const Array< OneD, const NekDouble > &v, Array< OneD, NekDouble > &Vorticity)
Definition: MMFSWE.cpp:2213
void AddDivForGradient(Array< OneD, Array< OneD, NekDouble > > &physarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: MMFSWE.cpp:542
void AddCoriolis(Array< OneD, Array< OneD, NekDouble > > &physarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: MMFSWE.cpp:1206
void UnstableJetFlow(unsigned int field, const NekDouble time, Array< OneD, NekDouble > &outfield)
Definition: MMFSWE.cpp:2483
void v_InitObject(bool DeclareFields=true) override
Initialise the object.
Definition: MMFSWE.cpp:61
int m_PurturbedJet
Definition: MMFSWE.h:270
NekDouble m_k2
Definition: MMFSWE.h:95
NekDouble ComputeUnstableJetuphi(const NekDouble theta)
Definition: MMFSWE.cpp:2749
MMFSWE(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Session reader.
Definition: MMFSWE.cpp:51
Array< OneD, NekDouble > m_vellc
Definition: MMFSWE.h:108
void v_SetInitialConditions(const NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0) override
Definition: MMFSWE.cpp:1791
NekDouble m_alpha
Definition: MMFSWE.h:94
bool m_primitive
Indicates if variables are primitive or conservative.
Definition: MMFSWE.h:103
static SolverUtils::EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
Definition: MMFSWE.h:66
void WeakDGSWEDirDeriv(const Array< OneD, Array< OneD, NekDouble > > &InField, Array< OneD, Array< OneD, NekDouble > > &OutField)
Definition: MMFSWE.cpp:472
NekDouble m_en
Definition: MMFSWE.h:97
void RossbyWave(unsigned int field, Array< OneD, NekDouble > &outfield)
Definition: MMFSWE.cpp:2592
void ComputeNablaCdotVelocity(Array< OneD, NekDouble > &vellc)
Definition: MMFSWE.cpp:2234
NekDouble v_L2Error(unsigned int field, const Array< OneD, NekDouble > &exactsoln, bool Normalised) override
Virtual function for the L_2 error computation between fields and a given exact solution.
Definition: MMFSWE.cpp:3032
NekDouble m_Energy0
Definition: MMFSWE.h:100
void EvaluateStandardCoriolis(Array< OneD, NekDouble > &outarray)
Definition: MMFSWE.cpp:1764
static std::string className
Name of class.
Definition: MMFSWE.h:76
void GetSWEFluxVector(const int i, const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
Definition: MMFSWE.cpp:572
NekDouble m_theta0
Definition: MMFSWE.h:97
void PrimitiveToConservative()
Definition: MMFSWE.cpp:2929
void v_EvaluateExactSolution(unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time) override
Definition: MMFSWE.cpp:3218
void SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble > > &inarray, NekDouble time)
Definition: MMFSWE.cpp:1382
void IsolatedMountainFlow(unsigned int field, const NekDouble time, Array< OneD, NekDouble > &outfield)
Definition: MMFSWE.cpp:2395
NekDouble m_hbar
Definition: MMFSWE.h:97
NekDouble m_K
Definition: MMFSWE.h:98
Array< OneD, NekDouble > m_coriolis
Coriolis force.
Definition: MMFSWE.h:89
void ComputeMagAndDot(const int index, NekDouble &MageF1, NekDouble &MageF2, NekDouble &MageB1, NekDouble &MageB2, NekDouble &eF1_cdot_eB1, NekDouble &eF1_cdot_eB2, NekDouble &eF2_cdot_eB1, NekDouble &eF2_cdot_eB2)
Definition: MMFSWE.cpp:1168
NekDouble m_Hvar
Definition: MMFSWE.h:94
void AddRotation(Array< OneD, Array< OneD, NekDouble > > &physarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: MMFSWE.cpp:1280
TestType m_TestType
Definition: MMFSWE.h:78
void AverageFlux(const int index, NekDouble hL, NekDouble uL, NekDouble vL, NekDouble hR, NekDouble uR, NekDouble vR, Array< OneD, NekDouble > &numfluxF, Array< OneD, NekDouble > &numfluxB)
Definition: MMFSWE.cpp:961
NekDouble m_Vorticity0
Definition: MMFSWE.h:100
void AddElevationEffect(Array< OneD, Array< OneD, NekDouble > > &physarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: MMFSWE.cpp:1251
void Checkpoint_Output_Cartesian(std::string outname)
Definition: MMFSWE.cpp:2767
void Computehhuhvflux(NekDouble hL, NekDouble uL, NekDouble vL, NekDouble hR, NekDouble uR, NekDouble vR, NekDouble hstar, NekDouble &hflux, NekDouble &huflux, NekDouble &hvflux)
Definition: MMFSWE.cpp:883
NekDouble v_LinfError(unsigned int field, const Array< OneD, NekDouble > &exactsoln) override
Virtual function for the L_inf error computation between fields and a given exact solution.
Definition: MMFSWE.cpp:3128
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Compute the RHS.
Definition: MMFSWE.cpp:418
void TestVorticityComputation()
Definition: MMFSWE.cpp:2946
void NumericalSWEFlux(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numfluxFwd, Array< OneD, Array< OneD, NekDouble > > &numfluxBwd)
Definition: MMFSWE.cpp:667
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Compute the projection.
Definition: MMFSWE.cpp:1363
void RiemannSolverHLLC(const int index, NekDouble hL, NekDouble uL, NekDouble vL, NekDouble hR, NekDouble uR, NekDouble vR, Array< OneD, NekDouble > &numfluxF, Array< OneD, NekDouble > &numfluxB)
Definition: MMFSWE.cpp:838
NekDouble ComputeEnstrophy(const Array< OneD, const NekDouble > &eta, const Array< OneD, const NekDouble > &u, const Array< OneD, const NekDouble > &v)
Definition: MMFSWE.cpp:2182
void v_GenerateSummary(SolverUtils::SummaryList &s) override
Print Summary.
Definition: MMFSWE.cpp:3265
NekDouble m_uthetamax
Definition: MMFSWE.h:97
NekDouble ComputeMass(const Array< OneD, const NekDouble > &eta)
Definition: MMFSWE.cpp:2143
void EvaluateWaterDepth(void)
Definition: MMFSWE.cpp:1562
void UnsteadyZonalFlow(unsigned int field, const NekDouble time, Array< OneD, NekDouble > &outfield)
Definition: MMFSWE.cpp:2294
Array< OneD, Array< OneD, NekDouble > > m_veldotMF
Definition: MMFSWE.h:107
NekDouble ComputeEnergy(const Array< OneD, const NekDouble > &eta, const Array< OneD, const NekDouble > &u, const Array< OneD, const NekDouble > &v)
Definition: MMFSWE.cpp:2153
void LaxFriedrichFlux(const int index, NekDouble hL, NekDouble uL, NekDouble vL, NekDouble hR, NekDouble uR, NekDouble vR, Array< OneD, NekDouble > &numfluxF, Array< OneD, NekDouble > &numfluxB)
Definition: MMFSWE.cpp:1015
NekDouble ComputeUnstableJetEta(const NekDouble theta)
Definition: MMFSWE.cpp:2737
NekDouble m_Mass0
Definition: MMFSWE.h:100
void EvaluateCoriolis(void)
Definition: MMFSWE.cpp:1702
void EvaluateCoriolisForZonalFlow(Array< OneD, NekDouble > &outarray)
Definition: MMFSWE.cpp:1732
void v_DoInitialise(bool dumpInitialConditions=false) override
Sets up initial conditions.
Definition: MMFSWE.cpp:1545
NekDouble m_theta1
Definition: MMFSWE.h:97
~MMFSWE() override=default
Destructor.
int m_AddRotation
Definition: MMFSWE.h:91
Array< OneD, Array< OneD, NekDouble > > m_velocity
Advection velocity.
Definition: MMFSWE.h:106
int m_planeNumber
Definition: MMFSWE.h:112
void v_DoSolve() override
Solves an unsteady problem.
Definition: MMFSWE.cpp:241
NekDouble m_angfreq
Definition: MMFSWE.h:98
void Compute_demdt_cdot_ek(const int indm, const int indk, const Array< OneD, const Array< OneD, NekDouble > > &physarray, Array< OneD, NekDouble > &outarray)
Definition: MMFSWE.cpp:1327
void WallBoundary2D(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &physarray)
Definition: MMFSWE.cpp:1432
void TestSWE2Dproblem(const NekDouble time, unsigned int field, Array< OneD, NekDouble > &outfield)
Definition: MMFSWE.cpp:1988
NekDouble m_Omega
Definition: MMFSWE.h:94
int m_RossbyDisturbance
Definition: MMFSWE.h:269
NekDouble m_H0
Definition: MMFSWE.h:94
int m_AddCoriolis
Definition: MMFSWE.h:91
Array< OneD, Array< OneD, NekDouble > > m_Derivdepth
Definition: MMFSWE.h:86
NekDouble m_u0
Definition: MMFSWE.h:94
void ConservativeToPrimitive()
Definition: MMFSWE.cpp:2912
NekDouble m_Enstrophy0
Definition: MMFSWE.h:100
void SteadyZonalFlow(unsigned int field, Array< OneD, NekDouble > &outfield)
Definition: MMFSWE.cpp:2052
void RusanovFlux(const int index, NekDouble hL, NekDouble uL, NekDouble vL, NekDouble hR, NekDouble uR, NekDouble vR, Array< OneD, NekDouble > &numfluxF, Array< OneD, NekDouble > &numfluxB)
Definition: MMFSWE.cpp:1090
Array< OneD, NekDouble > m_depth
Still water depth.
Definition: MMFSWE.h:85
NekDouble m_g
Definition: MMFSWE.h:93
NekDouble m_hs0
Definition: MMFSWE.h:96
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.
A base class for PDEs which include an advection component.
Definition: MMFSystem.h:144
std::shared_ptr< SessionReader > SessionReaderSharedPtr
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
@ eTestUnstableJet
Definition: MMFSWE.h:49
@ eTestSteadyZonal
Definition: MMFSWE.h:46
@ eTestPlane
Definition: MMFDiffusion.h:48
@ eTestUnsteadyZonal
Definition: MMFSWE.h:47
@ SIZE_TestType
Length of enum list.
Definition: MMFDiffusion.h:55
@ eTestIsolatedMountain
Definition: MMFSWE.h:48
@ eTestRossbyWave
Definition: MMFSWE.h:50
const char *const TestTypeMap[]
Definition: MMFDiffusion.h:58
double NekDouble