Nektar++
AcousticSystem.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: AcousticSystem.h
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2018 Kilian Lackhove
10// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
11// Department of Aeronautics, Imperial College London (UK), and Scientific
12// Computing and Imaging Institute, University of Utah (USA).
13//
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: AcousticSystem base class
33//
34///////////////////////////////////////////////////////////////////////////////
35
36#ifndef NEKTAR_SOLVERS_ACOUSTICSOLVER_EQUATIONSYSTEMS_ACOUSTICSYSTEM_H
37#define NEKTAR_SOLVERS_ACOUSTICSOLVER_EQUATIONSYSTEMS_ACOUSTICSYSTEM_H
38
39// Define variable to avoid deprecated warning in Boost 1.69.
40#include <boost/version.hpp>
41#if BOOST_VERSION >= 106900 && BOOST_VERSION < 107000
42#define BOOST_ALLOW_DEPRECATED_HEADERS
43#endif
44
45#include <boost/random/mersenne_twister.hpp>
46
53
54using namespace Nektar::SolverUtils;
55
56namespace Nektar
57{
58
60{
61public:
62 friend class MemoryManager<AcousticSystem>;
63
64 /// Destructor
65 ~AcousticSystem() override;
66
67protected:
68 /// indices of the fields
70 /// we are dealing with a conservative formualtion
74 std::vector<SolverUtils::ForcingSharedPtr> m_forcing;
79 std::vector<std::string> m_bfNames;
80
81 /// Initialises UnsteadySystem class members.
84
85 void v_InitObject(bool DeclareFields = true) override;
86
87 void DoOdeRhs(const Array<OneD, const Array<OneD, NekDouble>> &inarray,
89 const NekDouble time);
90
91 void DoOdeProjection(
92 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
93 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
94
95 virtual void v_AddLinTerm(
96 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>>
97 &inarray,
98 [[maybe_unused]] Array<OneD, Array<OneD, NekDouble>> &outarray)
99 {
100 }
101
102 virtual void v_GetFluxVector(
103 const Array<OneD, Array<OneD, NekDouble>> &physfield,
105
107 int bcRegion, int cnt, Array<OneD, Array<OneD, NekDouble>> &Fwd,
109 Array<OneD, Array<OneD, NekDouble>> &physarray) = 0;
110
111 bool v_PreIntegrate(int step) override;
112
113 void v_Output() override;
114
116 const NekDouble SpeedSoundFactor) override;
117
118 void v_ExtraFldOutput(std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
119 std::vector<std::string> &variables) override;
120
122
124
126
127private:
128 std::map<int, boost::mt19937> m_rng;
131
133
135 NekDouble time);
136
137 void WallBC(int bcRegion, int cnt, Array<OneD, Array<OneD, NekDouble>> &Fwd,
138 Array<OneD, Array<OneD, NekDouble>> &physarray);
139
140 void WhiteNoiseBC(int bcRegion, int cnt,
143 Array<OneD, Array<OneD, NekDouble>> &physarray);
144
147
149};
150} // namespace Nektar
151
152#endif
SolverUtils::CouplingSharedPtr m_coupling
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Compute the right-hand side.
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs()
Get the locations of the components of the directed fields within the fields array.
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals()
Get the normal vectors.
void v_Output() override
Array< OneD, NekDouble > v_GetMaxStdVelocity(const NekDouble SpeedSoundFactor) override
Compute the advection velocity in the standard space for each element of the expansion.
std::vector< std::string > m_bfNames
Array< OneD, Array< OneD, NekDouble > > m_vecLocs
NekDouble GetCFLEstimate()
void CopyBoundaryTrace(const Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
bool m_conservative
we are dealing with a conservative formualtion
void v_ExtraFldOutput(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables) override
virtual void v_RiemannInvariantBC(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &BfFwd, Array< OneD, Array< OneD, NekDouble > > &physarray)=0
SolverUtils::AdvectionSharedPtr m_advection
void WallBC(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &physarray)
Wall boundary conditions for the AcousticSystem equations.
AcousticSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Initialises UnsteadySystem class members.
void WhiteNoiseBC(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &BfFwd, Array< OneD, Array< OneD, NekDouble > > &physarray)
Wall boundary conditions for the AcousticSystem equations.
int m_ip
indices of the fields
virtual void v_GetFluxVector(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)=0
std::map< int, boost::mt19937 > m_rng
Array< OneD, Array< OneD, NekDouble > > m_bfFwdBwd
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Compute the projection and call the method for imposing the boundary conditions in case of discontinu...
Array< OneD, Array< OneD, NekDouble > > m_bf
void v_InitObject(bool DeclareFields=true) override
Initialization object for the AcousticSystem class.
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
const Array< OneD, const Array< OneD, NekDouble > > & GetBasefieldFwdBwd()
Get the baseflow field.
SolverUtils::RiemannSolverSharedPtr m_riemannSolver
virtual void v_AddLinTerm(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
NekDouble m_whiteNoiseBC_lastUpdate
~AcousticSystem() override
Destructor.
void SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble > > &physarray, NekDouble time)
Apply the Boundary Conditions to the AcousticSystem equations.
bool v_PreIntegrate(int step) override
v_PreIntegrate
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
A base class for PDEs which include an advection component.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< RiemannSolver > RiemannSolverSharedPtr
A shared pointer to an EquationSystem object.
SOLVER_UTILS_EXPORT typedef std::shared_ptr< Coupling > CouplingSharedPtr
Definition: Coupling.h:45
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