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
42using namespace Nektar::SolverUtils;
43
44namespace Nektar
45{
46
48{
49 eNotSetPulse, ///< flux not defined
50 eUpwindPulse, ///< simple upwinding scheme
51 SIZE_UpwindTypePulse ///< Length of enum list
52};
53
54const char *const UpwindTypeMapPulse[] = {
55 "NoSetPulse",
56 "UpwindPulse",
57};
58
60{
61 InterfacePoint(const int vid, const int domain, const int elmt,
62 const int elmtVert, const int traceId, const int bcpos)
63 : m_vid(vid), m_domain(domain), m_elmt(elmt), m_elmtVert(elmtVert),
64 m_traceId(traceId), m_bcPosition(bcpos){};
65 int m_vid; // Global Vid of interface point
66 int m_domain; // domain interface point belongs to
67 int m_elmt; // element id of vertex
68 int m_elmtVert; // vertex id within local element
69 int m_traceId; // Element id within the trace
70 int m_bcPosition; // Position of boundary condition in region
71 int m_riemannOrd; // order of point in Riemann solve
72};
73
74typedef std::shared_ptr<InterfacePoint> InterfacePointShPtr;
75
76/// Base class for unsteady solvers.
78{
79public:
80 /// Destructor
81 ~PulseWaveSystem() override;
82
84 {
85 return m_nDomains;
86 }
87
89 {
90 return m_vessels;
91 }
92
93protected:
95 size_t m_nDomains;
99
103
107
116
117 // keep local copy so can be reordered in parallle
118 std::map<int, SpatialDomains::CompositeMap> m_domain;
119 std::vector<int> m_domOrder;
120
123
124 // Extra Fields
125 bool extraFields = false;
129
130 std::vector<std::vector<InterfacePointShPtr>> m_vesselIntfcs;
131 std::vector<std::vector<InterfacePointShPtr>> m_bifurcations;
132 std::vector<std::vector<InterfacePointShPtr>> m_mergingJcts;
133
134 /// Initialises PulseWaveSystem class members.
137
138 void v_InitObject(bool DeclareField = false) override;
139
140 /// Sets up initial conditions.
141 void v_DoInitialise(bool dumpInitialConditions = false) override;
142
143 /// Solves an unsteady problem.
144 void v_DoSolve() override;
145
146 /// Links the subdomains
149
150 /// Riemann Problem for Bifurcation
156
157 /// Riemann Problem for Merging Flow
162
163 /// Riemann Problem for Interface/Junction
169
170 // Ouptut field information
171 void v_Output(void) override;
172
173 // Checkpoint field output
174 void CheckPoint_Output(const int n);
175
176 /// Compute the L2 error between fields and a given exact solution.
178 unsigned int field,
180 bool Normalised = false) override;
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 =
185 NullNekDouble1DArray) override;
186
187 /// Write input fields to the given filename.
188 void WriteVessels(const std::string &outname);
189
191 const Array<OneD, const Array<OneD, NekDouble>> &fields);
192
193private:
194 /// Communicator for interfaces
196
197 void SetUpDomainInterfaces(void);
201 NekDouble &u, NekDouble &beta, NekDouble &A_0, NekDouble &alpha);
202
203 /// Set and retrn a series of communicators for each partition
204 void GetCommArray(std::map<int, LibUtilities::CommSharedPtr> &retval);
205
208 std::map<int, LibUtilities::CommSharedPtr> &domComm);
209};
210
211typedef std::shared_ptr<PulseWaveSystem> PulseWaveSystemSharedPtr;
212} // namespace Nektar
213
214#endif
Base class for unsteady solvers.
Array< OneD, Array< OneD, NekDouble > > m_A_0
Array< OneD, int > m_fieldPhysOffset
void v_DoInitialise(bool dumpInitialConditions=false) override
Sets up initial conditions.
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
void CheckPoint_Output(const int n)
Array< OneD, Array< OneD, NekDouble > > m_W1
void v_InitObject(bool DeclareField=false) override
std::vector< int > m_domOrder
void MergingRiemann(Array< OneD, NekDouble > &Au, Array< OneD, NekDouble > &uu, Array< OneD, NekDouble > &beta, Array< OneD, NekDouble > &A_0, Array< OneD, NekDouble > &alpha)
Riemann Problem for Merging Flow.
Array< OneD, MultiRegions::ExpListSharedPtr > UpdateVessels(void)
void InterfaceRiemann(Array< OneD, NekDouble > &Au, Array< OneD, NekDouble > &uu, Array< OneD, NekDouble > &beta, Array< OneD, NekDouble > &A_0, Array< OneD, NekDouble > &alpha)
Riemann Problem for Interface/Junction.
Array< OneD, Array< OneD, NekDouble > > m_alpha_trace
std::map< int, SpatialDomains::CompositeMap > m_domain
UpwindTypePulse m_upwindTypePulse
Array< OneD, Array< OneD, NekDouble > > m_A_0_trace
Array< OneD, Array< OneD, NekDouble > > m_pressure
NekDouble v_LinfError(unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray) override
Compute the L_inf error between fields and a given exact solution.
Array< OneD, Array< OneD, NekDouble > > m_gamma
void WriteVessels(const std::string &outname)
Write input fields to the given filename.
void GetCommArray(std::map< int, LibUtilities::CommSharedPtr > &retval)
Set and retrn a series of communicators for each partition.
Array< OneD, Array< OneD, NekDouble > > m_alpha
Gs::gs_data * m_intComm
Communicator for interfaces.
std::vector< std::vector< InterfacePointShPtr > > m_vesselIntfcs
Array< OneD, Array< OneD, NekDouble > > m_PWV
void v_Output(void) override
Array< OneD, MultiRegions::ExpListSharedPtr > m_vessels
~PulseWaveSystem() override
Destructor.
void FillDataFromInterfacePoint(InterfacePointShPtr &I, const Array< OneD, const Array< OneD, NekDouble > > &field, NekDouble &A, NekDouble &u, NekDouble &beta, NekDouble &A_0, NekDouble &alpha)
std::vector< std::vector< InterfacePointShPtr > > m_bifurcations
void SetUpDomainInterfaceBCs(SpatialDomains::BoundaryConditions &AllBcs, std::map< int, LibUtilities::CommSharedPtr > &domComm)
std::vector< std::vector< InterfacePointShPtr > > m_mergingJcts
NekDouble v_L2Error(unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray, bool Normalised=false) override
Compute the L2 error between fields and a given exact solution.
void v_DoSolve() override
Solves an unsteady problem.
void EnforceInterfaceConditions(const Array< OneD, const Array< OneD, NekDouble > > &fields)
Array< OneD, Array< OneD, NekDouble > > m_beta
PulseWaveSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Initialises PulseWaveSystem class members.
void BifurcationRiemann(Array< OneD, NekDouble > &Au, Array< OneD, NekDouble > &uu, Array< OneD, NekDouble > &beta, Array< OneD, NekDouble > &A_0, Array< OneD, NekDouble > &alpha)
Riemann Problem for Bifurcation.
void LinkSubdomains(Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &fields)
Links the subdomains.
Base class for unsteady solvers.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
@ beta
Gauss Radau pinned at x=-1,.
Definition: PointsType.h:59
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
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)