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

#include <RCROutflow.h>

Inheritance diagram for Nektar::RCROutflow:
[legend]

Public Member Functions

 RCROutflow (Array< OneD, MultiRegions::ExpListSharedPtr > pVessel, const LibUtilities::SessionReaderSharedPtr pSession, PulseWavePressureAreaSharedPtr pressureArea)
 
virtual ~RCROutflow ()
 
- Public Member Functions inherited from Nektar::PulseWaveBoundary
 PulseWaveBoundary (Array< OneD, MultiRegions::ExpListSharedPtr > &pVessel, const LibUtilities::SessionReaderSharedPtr &pSession, PulseWavePressureAreaSharedPtr &pressureArea)
 
virtual ~PulseWaveBoundary ()
 
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)
 

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

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)
 
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)
 

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
 

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 
)

Definition at line 48 of file RCROutflow.cpp.

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

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

◆ ~RCROutflow()

Nektar::RCROutflow::~RCROutflow ( )
virtual

Definition at line 56 of file RCROutflow.cpp.

57 {
58 }

Member Function Documentation

◆ create()

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

Definition at line 57 of file RCROutflow.h.

60  {
62  pSession,
63  pressureArea);
64  }
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 132 of file RCROutflow.cpp.

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

References Nektar::PulseWaveBoundary::m_pressureArea, Nektar::PulseWaveBoundary::m_rho, main::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 
)
protectedvirtual

Implements Nektar::PulseWaveBoundary.

Definition at line 60 of file RCROutflow.cpp.

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

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

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.
Definition: NekFactory.hpp:200
static PulseWaveBoundarySharedPtr create(Array< OneD, MultiRegions::ExpListSharedPtr > &pVessel, const LibUtilities::SessionReaderSharedPtr &pSession, PulseWavePressureAreaSharedPtr &pressureArea)
Definition: RCROutflow.h:57
BoundaryFactory & GetBoundaryFactory()

Definition at line 67 of file RCROutflow.h.

◆ m_pc

NekDouble Nektar::RCROutflow::m_pc = 0.0
protected

Definition at line 88 of file RCROutflow.h.

Referenced by v_DoBoundary().

◆ m_timestep

NekDouble Nektar::RCROutflow::m_timestep
protected

Definition at line 87 of file RCROutflow.h.

Referenced by RCROutflow(), and v_DoBoundary().