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

#include <ROutflow.h>

Inheritance diagram for Nektar::ROutflow:
[legend]

Public Member Functions

 ROutflow (Array< OneD, MultiRegions::ExpListSharedPtr > pVessel, const LibUtilities::SessionReaderSharedPtr pSession, PulseWavePressureAreaSharedPtr pressureArea)
 
 ~ROutflow () override
 
- 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

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
 

Additional Inherited Members

- 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 ROutflow.h.

Constructor & Destructor Documentation

◆ ROutflow()

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

Definition at line 46 of file ROutflow.cpp.

49 : PulseWaveBoundary(pVessel, pSession, pressureArea)
50{
51}
PulseWaveBoundary(Array< OneD, MultiRegions::ExpListSharedPtr > &pVessel, const LibUtilities::SessionReaderSharedPtr &pSession, PulseWavePressureAreaSharedPtr &pressureArea)

◆ ~ROutflow()

Nektar::ROutflow::~ROutflow ( )
override

Definition at line 53 of file ROutflow.cpp.

54{
55}

Member Function Documentation

◆ create()

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

Definition at line 56 of file ROutflow.h.

60 {
61 return MemoryManager<ROutflow>::AllocateSharedPtr(pVessel, pSession,
62 pressureArea);
63 }
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::ROutflow::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 105 of file ROutflow.cpp.

108{
109 NekDouble W1 = 0.0;
110 NekDouble c = 0.0;
111 NekDouble cL = 0.0;
112 NekDouble I = 0.0;
113 NekDouble A_calc = 0.0;
114 NekDouble FA = 0.0;
115 NekDouble dFdA = 0.0;
116 NekDouble delta_A_calc = 0.0;
117 NekDouble P = 0.0;
118 NekDouble rho = m_rho;
119
120 int proceed = 1;
121 int iter = 0;
122 int MAX_ITER = 200;
123
124 // Tolerances for the algorithm
125 NekDouble Tol = 1.0E-10;
126
127 // Calculate the wave speed
128 m_pressureArea->GetC(cL, beta, A_l, A_0, alpha);
129
130 // Riemann invariant \f$W_1(Al,ul)\f$
131 m_pressureArea->GetW1(W1, u_l, beta, A_l, A_0, alpha);
132
133 // Newton Iteration (Area only)
134 A_calc = A_l;
135 while ((proceed) && (iter < MAX_ITER))
136 {
137 iter += 1;
138
139 m_pressureArea->GetPressure(P, beta, A_calc, A_0, 0, 0, alpha);
140 m_pressureArea->GetC(c, beta, A_calc, A_0, alpha);
141 m_pressureArea->GetCharIntegral(I, beta, A_calc, A_0, alpha);
142
143 FA = R * A_calc * (W1 - I) - P + POut;
144 dFdA = R * (W1 - I - c) - c * c * rho / A_calc;
145 delta_A_calc = FA / dFdA;
146 A_calc -= delta_A_calc;
147
148 if (sqrt(delta_A_calc * delta_A_calc) < Tol)
149 {
150 proceed = 0;
151 }
152 }
153
154 m_pressureArea->GetPressure(P, beta, A_calc, A_0, 0, 0, alpha);
155
156 // Obtain u_u and A_u
157 u_u = (P - POut) / (R * A_calc);
158 A_u = A_calc;
159}
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:294

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::ROutflow::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 57 of file ROutflow.cpp.

63{
64 NekDouble A_r = 0.0;
65 NekDouble u_r = 0.0;
66 NekDouble A_u = 0.0;
67 NekDouble u_u = 0.0;
68 NekDouble A_l = 0.0;
69 NekDouble u_l = 0.0;
70 NekDouble POut = m_pout;
71
72 Array<OneD, MultiRegions::ExpListSharedPtr> vessel(2);
73
74 // Pointers to the domains
75 vessel[0] = m_vessels[2 * omega];
76 vessel[1] = m_vessels[2 * omega + 1];
77
78 /* Find the terminal R boundary condition and
79 calculates the updated velocity and area as
80 well as the updated boundary conditions */
81
82 /* Load terminal resistance
83 and number of points from the input file */
84 NekDouble RT = ((vessel[0]->GetBndCondExpansions())[n])->GetCoeffs()[0];
85 int nq = vessel[0]->GetTotPoints();
86
87 // Get the values of all variables needed for the Riemann problem
88 A_l = inarray[0][offset + nq - 1];
89 u_l = inarray[1][offset + nq - 1];
90
91 // Call the R RiemannSolver
92 R_RiemannSolver(RT, A_l, u_l, A_0[omega][nq - 1], beta[omega][nq - 1],
93 alpha[omega][nq - 1], POut, A_u, u_u);
94
95 /* Fix the boundary conditions in the virtual region to ensure
96 upwind state matches the boundary condition at the next time step */
97 A_r = A_l;
98 u_r = 2 * u_u - u_l;
99
100 // Store the updated values
101 (vessel[0]->UpdateBndCondExpansion(n))->UpdatePhys()[0] = A_r;
102 (vessel[1]->UpdateBndCondExpansion(n))->UpdatePhys()[0] = u_r;
103}
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: ROutflow.cpp:105

References Nektar::LibUtilities::beta, Nektar::PulseWaveBoundary::m_pout, Nektar::PulseWaveBoundary::m_vessels, and R_RiemannSolver().

Member Data Documentation

◆ className

std::string Nektar::ROutflow::className
static
Initial value:
"R-terminal", ROutflow::create, "Resistive 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: ROutflow.h:56
BoundaryFactory & GetBoundaryFactory()

Definition at line 66 of file ROutflow.h.