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/core/ignore_unused.hpp>
46 #include <boost/random/mersenne_twister.hpp>
47 
54 
55 using namespace Nektar::SolverUtils;
56 
57 namespace Nektar
58 {
59 
61 {
62 public:
64 
65  /// Destructor
66  virtual ~AcousticSystem();
67 
68 protected:
69  /// indices of the fields
70  int m_ip, m_irho, m_iu;
71  /// we are dealing with a conservative formualtion
75  std::vector<SolverUtils::ForcingSharedPtr> m_forcing;
80  std::vector<std::string> m_bfNames;
81 
82  /// Initialises UnsteadySystem class members.
85 
86  virtual void v_InitObject();
87 
88  void DoOdeRhs(const Array<OneD, const Array<OneD, NekDouble>> &inarray,
89  Array<OneD, Array<OneD, NekDouble>> &outarray,
90  const NekDouble time);
91 
92  void DoOdeProjection(
93  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
94  Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
95 
96  virtual void v_GetFluxVector(
97  const Array<OneD, Array<OneD, NekDouble>> &physfield,
99 
100  virtual void v_AddLinTerm(
101  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
102  Array<OneD, Array<OneD, NekDouble>> &outarray)
103  {
104  boost::ignore_unused(inarray, outarray);
105  }
106 
107  virtual bool v_PreIntegrate(int step);
108 
109  virtual void v_Output();
110 
111  virtual Array<OneD, NekDouble> v_GetMaxStdVelocity();
112 
113  virtual void v_ExtraFldOutput(
114  std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
115  std::vector<std::string> &variables);
116 
117  const Array<OneD, const Array<OneD, NekDouble>> &GetNormals();
118 
119  const Array<OneD, const Array<OneD, NekDouble>> &GetVecLocs();
120 
121  const Array<OneD, const Array<OneD, NekDouble>> &GetBasefieldFwdBwd();
122 
123 private:
124  std::map<int, boost::mt19937> m_rng;
127 
128  NekDouble GetCFLEstimate();
129 
130  void SetBoundaryConditions(Array<OneD, Array<OneD, NekDouble>> &physarray,
131  NekDouble time);
132 
133  virtual void v_WallBC(int bcRegion, int cnt,
135  Array<OneD, Array<OneD, NekDouble>> &physarray);
136 
137  virtual void v_RiemannInvariantBC(
138  int bcRegion, int cnt, Array<OneD, Array<OneD, NekDouble>> &Fwd,
140  Array<OneD, Array<OneD, NekDouble>> &physarray) = 0;
141 
142  virtual void v_WhiteNoiseBC(int bcRegion, int cnt,
145  Array<OneD, Array<OneD, NekDouble>> &physarray);
146 
147  void CopyBoundaryTrace(const Array<OneD, NekDouble> &Fwd,
149 
150  void UpdateBasefieldFwdBwd();
151 };
152 } // namespace Nektar
153 
154 #endif
Array< OneD, Array< OneD, NekDouble > > m_bf
SolverUtils::RiemannSolverSharedPtr m_riemannSolver
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:163
std::vector< std::string > m_bfNames
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
std::shared_ptr< Advection > AdvectionSharedPtr
A shared pointer to an Advection object.
Definition: Advection.h:170
bool m_conservative
we are dealing with a conservative formualtion
std::shared_ptr< RiemannSolver > RiemannSolverSharedPtr
A shared pointer to an EquationSystem object.
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
double NekDouble
SOLVER_UTILS_EXPORT typedef std::shared_ptr< Coupling > CouplingSharedPtr
Definition: Coupling.h:45
Array< OneD, Array< OneD, NekDouble > > m_bfFwdBwd
SolverUtils::CouplingSharedPtr m_coupling
std::map< int, boost::mt19937 > m_rng
virtual void v_AddLinTerm(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray)
NekDouble m_whiteNoiseBC_lastUpdate
A base class for PDEs which include an advection component.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
Array< OneD, Array< OneD, NekDouble > > m_vecLocs
SolverUtils::AdvectionSharedPtr m_advection