Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
40 
41 using namespace Nektar::SolverUtils;
42 
43 namespace Nektar
44 {
45 
47  {
48  eNotSetPulse, ///< flux not defined
49  eUpwindPulse, ///< simple upwinding scheme
50  SIZE_UpwindTypePulse ///< Length of enum list
51  };
52 
53  const char* const UpwindTypeMapPulse[] =
54  {
55  "NoSetPulse",
56  "UpwindPulse",
57  };
58 
60  {
61  InterfacePoint(const int vid,
62  const int domain,
63  const int elmt,
64  const int elmtVert,
65  const int traceId,
66  const int bcpos):
67  m_vid(vid),
68  m_domain(domain),
69  m_elmt(elmt),
70  m_elmtVert(elmtVert),
71  m_traceId(traceId),
72  m_bcPosition(bcpos)
73  {
74  };
75  int m_vid; // Global Vid of interface point
76  int m_domain; // domain interface point belongs to
77  int m_elmt; // element id of vertex
78  int m_elmtVert; // vertex id within local element
79  int m_traceId; // Element id within the trace
80  int m_bcPosition; // Position of boundary condition in region
81  };
82 
83  typedef boost::shared_ptr<InterfacePoint> InterfacePointShPtr;
84 
85  /// Base class for unsteady solvers.
87  {
88  public:
89  /// Destructor
90  virtual ~PulseWaveSystem();
91 
93  {
94  return m_nDomains;
95  }
96 
98  {
99  return m_vessels;
100  }
101 
102  void CalcCharacteristicVariables(int omega);
103 
104  protected:
110 
114 
118 
124 
125 
126  std::vector<std::vector<InterfacePointShPtr> > m_vesselJcts;
127  std::vector<std::vector<InterfacePointShPtr> > m_bifurcations;
128  std::vector<std::vector<InterfacePointShPtr> > m_mergingJcts;
129 
130  /// Initialises PulseWaveSystem class members.
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 boost::shared_ptr<PulseWaveSystem> PulseWaveSystemSharedPtr;
187 
188 
189 }
190 
191 #endif
boost::shared_ptr< PulseWaveSystem > PulseWaveSystemSharedPtr
Array< OneD, int > m_fieldPhysOffset
Array< OneD, Array< OneD, NekDouble > > m_beta_trace
UpwindTypePulse m_upwindTypePulse
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
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
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
flux not defined
Array< OneD, Array< OneD, NekDouble > > m_beta
Array< OneD, MultiRegions::ExpListSharedPtr > m_vessels
std::vector< std::vector< InterfacePointShPtr > > m_mergingJcts
boost::shared_ptr< InterfacePoint > InterfacePointShPtr
simple upwinding scheme