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