Nektar++
PulseWaveSystem.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File PulseWaveSystem.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 // 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: Generic timestepping for PulseWaveSolver
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_SOLVERS_PULSEWAVESOLVER_EQUATIONSYSTEMS_PULSEWAVESYSTEM_H
37 #define NEKTAR_SOLVERS_PULSEWAVESOLVER_EQUATIONSYSTEMS_PULSEWAVESYSTEM_H
38 
41 
42 using namespace Nektar::SolverUtils;
43 
44 namespace Nektar
45 {
46 
48  {
49  eNotSetPulse, ///< flux not defined
50  eUpwindPulse, ///< simple upwinding scheme
51  SIZE_UpwindTypePulse ///< Length of enum list
52  };
53 
54  const char* const UpwindTypeMapPulse[] =
55  {
56  "NoSetPulse",
57  "UpwindPulse",
58  };
59 
61  {
62  InterfacePoint(const int vid,
63  const int domain,
64  const int elmt,
65  const int elmtVert,
66  const int traceId,
67  const int bcpos):
68  m_vid(vid),
69  m_domain(domain),
70  m_elmt(elmt),
71  m_elmtVert(elmtVert),
72  m_traceId(traceId),
73  m_bcPosition(bcpos)
74  {
75  };
76  int m_vid; // Global Vid of interface point
77  int m_domain; // domain interface point belongs to
78  int m_elmt; // element id of vertex
79  int m_elmtVert; // vertex id within local element
80  int m_traceId; // Element id within the trace
81  int m_bcPosition; // Position of boundary condition in region
82  };
83 
84  typedef std::shared_ptr<InterfacePoint> InterfacePointShPtr;
85 
86  /// Base class for unsteady solvers.
88  {
89  public:
90  /// Destructor
91  virtual ~PulseWaveSystem();
92 
94  {
95  return m_nDomains;
96  }
97 
99  {
100  return m_vessels;
101  }
102 
103  protected:
109 
113 
117 
126 
129 
130  // Extra Fields
131  bool extraFields = false;
135 
136  std::vector<std::vector<InterfacePointShPtr> > m_vesselJcts;
137  std::vector<std::vector<InterfacePointShPtr> > m_bifurcations;
138  std::vector<std::vector<InterfacePointShPtr> > m_mergingJcts;
139 
140  /// Initialises PulseWaveSystem class members.
142  const SpatialDomains::MeshGraphSharedPtr& pGraph);
143 
144  virtual void v_InitObject();
145 
146  /// Sets up initial conditions.
147  virtual void v_DoInitialise();
148 
149  /// Solves an unsteady problem.
150  virtual void v_DoSolve();
151 
152  /// Links the subdomains
154  &fields);
155 
156  /// Riemann Problem for Bifurcation
157  void BifurcationRiemann(Array<OneD, NekDouble> &Au, Array<OneD, NekDouble> &uu,
159  Array<OneD, NekDouble> &alpha);
160 
161  /// Riemann Problem for Merging Flow
162  void MergingRiemann(Array<OneD, NekDouble> &Au, Array<OneD, NekDouble> &uu,
164  Array<OneD, NekDouble> &alpha);
165 
166  /// Riemann Problem for Junction
167  void JunctionRiemann(Array<OneD, NekDouble> &Au, Array<OneD, NekDouble> &uu,
169  Array<OneD, NekDouble> &alpha);
170 
171  // Ouptut field information
172  virtual void v_Output(void);
173 
174  // Checkpoint field output
175  void CheckPoint_Output(const int n);
176 
177  /// Compute the L2 error between fields and a given exact solution.
178  NekDouble v_L2Error(unsigned int field,
179  const Array<OneD,NekDouble> &exactsoln = NullNekDouble1DArray,
180  bool Normalised = false);
181 
182  /// Compute the L_inf error between fields and a given exact solution.
183  NekDouble v_LinfError(unsigned int field,
184  const Array<OneD,NekDouble> &exactsoln = NullNekDouble1DArray);
185 
186  /// Write input fields to the given filename.
187  void WriteVessels(const std::string &outname);
188 
189  void EnforceInterfaceConditions(const Array<OneD, const Array<OneD, NekDouble> > &fields);
190 
191  private:
192  void SetUpDomainInterfaces(void);
193  void FillDataFromInterfacePoint(InterfacePointShPtr &I,
194  const Array<OneD, const Array<OneD, NekDouble> >&field, NekDouble &A,
195  NekDouble &u, NekDouble &beta, NekDouble &A_0, NekDouble &alpha);
196  };
197 
198  typedef std::shared_ptr<PulseWaveSystem> PulseWaveSystemSharedPtr;
199 }
200 
201 #endif
Base class for unsteady solvers.
Array< OneD, Array< OneD, NekDouble > > m_A_0
Array< OneD, int > m_fieldPhysOffset
Array< OneD, Array< OneD, NekDouble > > m_beta_trace
Array< OneD, Array< OneD, NekDouble > > m_W2
Array< OneD, Array< OneD, NekDouble > > m_trace_fwd_normal
PulseWavePressureAreaSharedPtr m_pressureArea
Array< OneD, MultiRegions::ExpListSharedPtr > UpdateVessels(void)
Array< OneD, Array< OneD, NekDouble > > m_W1
Array< OneD, Array< OneD, NekDouble > > m_alpha_trace
UpwindTypePulse m_upwindTypePulse
Array< OneD, Array< OneD, NekDouble > > m_A_0_trace
Array< OneD, Array< OneD, NekDouble > > m_pressure
Array< OneD, Array< OneD, NekDouble > > m_gamma
Array< OneD, Array< OneD, NekDouble > > m_alpha
Array< OneD, Array< OneD, NekDouble > > m_PWV
Array< OneD, MultiRegions::ExpListSharedPtr > m_vessels
std::vector< std::vector< InterfacePointShPtr > > m_bifurcations
std::vector< std::vector< InterfacePointShPtr > > m_vesselJcts
std::vector< std::vector< InterfacePointShPtr > > m_mergingJcts
Array< OneD, Array< OneD, NekDouble > > m_beta
void LinkSubdomains(Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &fields)
Links the subdomains.
Base class for unsteady solvers.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
std::shared_ptr< PulseWavePressureArea > PulseWavePressureAreaSharedPtr
std::shared_ptr< InterfacePoint > InterfacePointShPtr
std::shared_ptr< PulseWaveSystem > PulseWaveSystemSharedPtr
@ eUpwindPulse
simple upwinding scheme
@ eNotSetPulse
flux not defined
@ SIZE_UpwindTypePulse
Length of enum list.
const char *const UpwindTypeMapPulse[]
static Array< OneD, NekDouble > NullNekDouble1DArray
double NekDouble
InterfacePoint(const int vid, const int domain, const int elmt, const int elmtVert, const int traceId, const int bcpos)