Nektar++
Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
Nektar::RCROutflow Class Reference

#include <RCROutflow.h>

Inheritance diagram for Nektar::RCROutflow:
[legend]

Static Public Member Functions

static PulseWaveBoundarySharedPtr create (Array< OneD, MultiRegions::ExpListSharedPtr > &pVessel, const LibUtilities::SessionReaderSharedPtr &pSession, PulseWavePressureAreaSharedPtr &pressureArea)
 

Static Public Attributes

static std::string className
 

Protected Member Functions

 RCROutflow (Array< OneD, MultiRegions::ExpListSharedPtr > pVessel, const LibUtilities::SessionReaderSharedPtr pSession, PulseWavePressureAreaSharedPtr pressureArea)
 
 ~RCROutflow () override=default
 
void v_DoBoundary (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &A_0, Array< OneD, Array< OneD, NekDouble > > &beta, Array< OneD, Array< OneD, NekDouble > > &alpha, const NekDouble time, int omega, int offset, int n) override
 
void R_RiemannSolver (NekDouble R, NekDouble A_l, NekDouble u_l, NekDouble A_0, NekDouble beta, NekDouble alpha, NekDouble POut, NekDouble &A_u, NekDouble &u_u)
 
virtual void v_DoBoundary (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &A_0, Array< OneD, Array< OneD, NekDouble > > &beta, Array< OneD, Array< OneD, NekDouble > > &alpha, const NekDouble time, int omega, int offset, int n)=0
 

Protected Attributes

NekDouble m_timestep
 
NekDouble m_pc = 0.0
 
- Protected Attributes inherited from Nektar::PulseWaveBoundary
Array< OneD, MultiRegions::ExpListSharedPtrm_vessels
 
LibUtilities::SessionReaderSharedPtr m_session
 
PulseWavePressureAreaSharedPtr m_pressureArea
 
NekDouble m_pext
 
NekDouble m_pout
 
NekDouble m_rho
 

Friends

class MemoryManager< RCROutflow >
 

Additional Inherited Members

- Public Member Functions inherited from Nektar::PulseWaveBoundary
 PulseWaveBoundary (Array< OneD, MultiRegions::ExpListSharedPtr > &pVessel, const LibUtilities::SessionReaderSharedPtr &pSession, PulseWavePressureAreaSharedPtr &pressureArea)
 
virtual ~PulseWaveBoundary ()=default
 
void DoBoundary (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &A_0, Array< OneD, Array< OneD, NekDouble > > &beta, Array< OneD, Array< OneD, NekDouble > > &alpha, const NekDouble time, int omega, int offset, int n)
 

Detailed Description

Definition at line 52 of file RCROutflow.h.

Constructor & Destructor Documentation

◆ RCROutflow()

Nektar::RCROutflow::RCROutflow ( Array< OneD, MultiRegions::ExpListSharedPtr pVessel,
const LibUtilities::SessionReaderSharedPtr  pSession,
PulseWavePressureAreaSharedPtr  pressureArea 
)
protected

Definition at line 46 of file RCROutflow.cpp.

49 : PulseWaveBoundary(pVessel, pSession, pressureArea)
50{
51 m_session->LoadParameter("TimeStep", m_timestep);
52}
PulseWaveBoundary(Array< OneD, MultiRegions::ExpListSharedPtr > &pVessel, const LibUtilities::SessionReaderSharedPtr &pSession, PulseWavePressureAreaSharedPtr &pressureArea)
LibUtilities::SessionReaderSharedPtr m_session
NekDouble m_timestep
Definition: RCROutflow.h:71

References Nektar::PulseWaveBoundary::m_session, and m_timestep.

◆ ~RCROutflow()

Nektar::RCROutflow::~RCROutflow ( )
overrideprotecteddefault

Member Function Documentation

◆ create()

static PulseWaveBoundarySharedPtr Nektar::RCROutflow::create ( Array< OneD, MultiRegions::ExpListSharedPtr > &  pVessel,
const LibUtilities::SessionReaderSharedPtr pSession,
PulseWavePressureAreaSharedPtr pressureArea 
)
inlinestatic

Definition at line 58 of file RCROutflow.h.

62 {
63 return MemoryManager<RCROutflow>::AllocateSharedPtr(pVessel, pSession,
64 pressureArea);
65 }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

◆ R_RiemannSolver()

void Nektar::RCROutflow::R_RiemannSolver ( NekDouble  R,
NekDouble  A_l,
NekDouble  u_l,
NekDouble  A_0,
NekDouble  beta,
NekDouble  alpha,
NekDouble  POut,
NekDouble A_u,
NekDouble u_u 
)
protected

Definition at line 127 of file RCROutflow.cpp.

130{
131 NekDouble W1 = 0.0;
132 NekDouble c = 0.0;
133 NekDouble cL = 0.0;
134 NekDouble I = 0.0;
135 NekDouble A_calc = 0.0;
136 NekDouble FA = 0.0;
137 NekDouble dFdA = 0.0;
138 NekDouble delta_A_calc = 0.0;
139 NekDouble P = 0.0;
140 NekDouble rho = m_rho;
141
142 int proceed = 1;
143 int iter = 0;
144 int MAX_ITER = 100;
145
146 // Tolerances for the algorithm
147 NekDouble Tol = 1.0E-10;
148
149 // Calculate the wave speed
150 m_pressureArea->GetC(cL, beta, A_l, A_0, alpha);
151
152 // Riemann invariant \f$W_1(Al,ul)\f$
153 m_pressureArea->GetW1(W1, u_l, beta, A_l, A_0, alpha);
154
155 // Newton Iteration (Area only)
156 A_calc = A_l;
157 while ((proceed) && (iter < MAX_ITER))
158 {
159 iter += 1;
160
161 m_pressureArea->GetPressure(P, beta, A_calc, A_0, 0, 0, alpha);
162 m_pressureArea->GetC(c, beta, A_calc, A_0, alpha);
163 m_pressureArea->GetCharIntegral(I, beta, A_calc, A_0, alpha);
164
165 FA = R * A_calc * (W1 - I) - P + POut;
166 dFdA = R * (W1 - I - c) - c * c * rho / A_calc;
167 delta_A_calc = FA / dFdA;
168 A_calc -= delta_A_calc;
169
170 if (sqrt(delta_A_calc * delta_A_calc) < Tol)
171 {
172 proceed = 0;
173 }
174 }
175
176 m_pressureArea->GetPressure(P, beta, A_calc, A_0, 0, 0, alpha);
177
178 // Obtain u_u and A_u
179 u_u = (P - POut) / (R * A_calc);
180 A_u = A_calc;
181}
PulseWavePressureAreaSharedPtr m_pressureArea
@ beta
Gauss Radau pinned at x=-1,.
Definition: PointsType.h:59
@ P
Monomial polynomials .
Definition: BasisType.h:62
double NekDouble
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:285

References Nektar::LibUtilities::beta, Nektar::PulseWaveBoundary::m_pressureArea, Nektar::PulseWaveBoundary::m_rho, Nektar::LibUtilities::P, and tinysimd::sqrt().

Referenced by v_DoBoundary().

◆ v_DoBoundary()

void Nektar::RCROutflow::v_DoBoundary ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  A_0,
Array< OneD, Array< OneD, NekDouble > > &  beta,
Array< OneD, Array< OneD, NekDouble > > &  alpha,
const NekDouble  time,
int  omega,
int  offset,
int  n 
)
overrideprotectedvirtual

Implements Nektar::PulseWaveBoundary.

Definition at line 54 of file RCROutflow.cpp.

60{
61 NekDouble A_r = 0.0;
62 NekDouble u_r = 0.0;
63 NekDouble A_u = 0.0;
64 NekDouble u_u = 0.0;
65 NekDouble A_l = 0.0;
66 NekDouble u_l = 0.0;
67 NekDouble c_0 = 0.0;
68 NekDouble R1 = 0.0;
69 NekDouble R2 = 0.0;
70 NekDouble POut = m_pout;
71 NekDouble rho = m_rho;
72
73 Array<OneD, MultiRegions::ExpListSharedPtr> vessel(2);
74
75 // Pointers to the domains
76 vessel[0] = m_vessels[2 * omega];
77 vessel[1] = m_vessels[2 * omega + 1];
78
79 /* Find the terminal RCR boundary condition and calculates
80 the updated velocity and area as well as the updated
81 boundary conditions */
82
83 /* Load terminal resistance, capacitance, outflow pressure,
84 and number of points from the input file */
85 NekDouble RT = ((vessel[0]->GetBndCondExpansions())[n])->GetCoeffs()[0];
86 NekDouble C = ((vessel[1]->GetBndCondExpansions())[n])->GetCoeffs()[0];
87 int nq = vessel[0]->GetTotPoints();
88
89 // Get the values of all variables needed for the Riemann problem
90 A_l = inarray[0][offset + nq - 1];
91 u_l = inarray[1][offset + nq - 1];
92
93 // Goes through the first resistance; calculates c_0
94 m_pressureArea->GetC(c_0, beta[omega][nq - 1], A_0[omega][nq - 1],
95 A_0[omega][nq - 1], alpha[omega][nq - 1]);
96
97 /* Calculate R1 and R2, R1 being calculated so as
98 to eliminate reflections in the vessel */
99 R1 = rho * c_0 / A_0[omega][nq - 1];
100
101 if (R1 > 0.9 * RT)
102 {
103 // In case the resistance is lower than the characteristic impedance.
104 R1 = 0.9 * RT;
105 }
106
107 R2 = RT - R1;
108
109 // Call the R RiemannSolver
110 R_RiemannSolver(R1, A_l, u_l, A_0[omega][nq - 1], beta[omega][nq - 1],
111 alpha[omega][nq - 1], m_pc, A_u, u_u);
112
113 /* Fix the boundary conditions in the virtual region to ensure
114 upwind state matches the boundary condition at the next time step */
115 A_r = A_l;
116 u_r = 2 * u_u - u_l;
117
118 /* Goes through the CR system, which
119 just updates the pressure pc */
120 m_pc += (m_timestep / C) * (A_u * u_u - (m_pc - POut) / R2);
121
122 // Store the updated values
123 (vessel[0]->UpdateBndCondExpansion(n))->UpdatePhys()[0] = A_r;
124 (vessel[1]->UpdateBndCondExpansion(n))->UpdatePhys()[0] = u_r;
125}
Array< OneD, MultiRegions::ExpListSharedPtr > m_vessels
void R_RiemannSolver(NekDouble R, NekDouble A_l, NekDouble u_l, NekDouble A_0, NekDouble beta, NekDouble alpha, NekDouble POut, NekDouble &A_u, NekDouble &u_u)
Definition: RCROutflow.cpp:127
NekDouble m_pc
Definition: RCROutflow.h:72

References Nektar::LibUtilities::beta, m_pc, Nektar::PulseWaveBoundary::m_pout, Nektar::PulseWaveBoundary::m_pressureArea, Nektar::PulseWaveBoundary::m_rho, m_timestep, Nektar::PulseWaveBoundary::m_vessels, and R_RiemannSolver().

Friends And Related Function Documentation

◆ MemoryManager< RCROutflow >

friend class MemoryManager< RCROutflow >
friend

Definition at line 49 of file RCROutflow.h.

Member Data Documentation

◆ className

std::string Nektar::RCROutflow::className
static
Initial value:
=
"RCR-terminal", RCROutflow::create, "RCR outflow boundary condition")
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static PulseWaveBoundarySharedPtr create(Array< OneD, MultiRegions::ExpListSharedPtr > &pVessel, const LibUtilities::SessionReaderSharedPtr &pSession, PulseWavePressureAreaSharedPtr &pressureArea)
Definition: RCROutflow.h:58
BoundaryFactory & GetBoundaryFactory()

Definition at line 68 of file RCROutflow.h.

◆ m_pc

NekDouble Nektar::RCROutflow::m_pc = 0.0
protected

Definition at line 72 of file RCROutflow.h.

Referenced by v_DoBoundary().

◆ m_timestep

NekDouble Nektar::RCROutflow::m_timestep
protected

Definition at line 71 of file RCROutflow.h.

Referenced by RCROutflow(), and v_DoBoundary().