Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Nektar::RCROutflow Class Reference

A global linear system. More...

#include <RCROutflow.h>

Inheritance diagram for Nektar::RCROutflow:
Inheritance graph
[legend]
Collaboration diagram for Nektar::RCROutflow:
Collaboration graph
[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, 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)
 Creates an instance of this class. More...
 

Static Public Attributes

static std::string className
 Name of class. More...
 

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, 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 pout, NekDouble &A_u, NekDouble &u_u)
 

Protected Attributes

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

Detailed Description

A global linear system.

Definition at line 51 of file RCROutflow.h.

Constructor & Destructor Documentation

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

Definition at line 51 of file RCROutflow.cpp.

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

54  : PulseWaveBoundary(pVessel,pSession,pressureArea)
55  {
56  m_session->LoadParameter("TimeStep", m_timestep);
57  }
PulseWaveBoundary(Array< OneD, MultiRegions::ExpListSharedPtr > &pVessel, const LibUtilities::SessionReaderSharedPtr &pSession, PulseWavePressureAreaSharedPtr &pressureArea)
NekDouble m_timestep
Definition: RCROutflow.h:81
LibUtilities::SessionReaderSharedPtr m_session
Nektar::RCROutflow::~RCROutflow ( )
virtual

Definition at line 62 of file RCROutflow.cpp.

63  {
64 
65  }

Member Function Documentation

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

Creates an instance of this class.

Definition at line 55 of file RCROutflow.h.

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

58  {
59  return MemoryManager<RCROutflow>::AllocateSharedPtr(pVessel,pSession,pressureArea);
60  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void Nektar::RCROutflow::R_RiemannSolver ( NekDouble  R,
NekDouble  A_l,
NekDouble  u_l,
NekDouble  A_0,
NekDouble  beta,
NekDouble  pout,
NekDouble A_u,
NekDouble u_u 
)
protected

Definition at line 124 of file RCROutflow.cpp.

References Nektar::PulseWaveBoundary::m_pext, and Nektar::PulseWaveBoundary::m_rho.

Referenced by v_DoBoundary().

127  {
128  NekDouble W1 = 0.0;
129  NekDouble c_l = 0.0;
130  NekDouble pext = m_pext;
131  NekDouble A_calc = 0.0;
132  NekDouble fa = 0.0;
133  NekDouble dfa = 0.0;
134  NekDouble delta_A_calc = 0.0;
135  NekDouble rho = m_rho;
136 
137  int proceed = 1;
138  int iter = 0;
139  int MAX_ITER = 200;
140 
141  // Tolerances for the algorithm
142  NekDouble Tol = 1.0e-10;
143 
144  // Calculate the wave speed
145  c_l = sqrt(beta/(2*rho))*sqrt(sqrt(A_l));
146 
147  // Riemann invariant \f$W_1(Al,ul)\f$
148  W1 = u_l + 4*c_l;
149 
150  // Newton Iteration (Area only)
151  A_calc = A_l;
152  while ((proceed) && (iter < MAX_ITER))
153  {
154  iter =iter+1;
155 
156  fa = R*W1*A_calc-4*R*sqrt(beta/(2*rho))*A_calc*sqrt(sqrt(A_calc))-pext-beta*(sqrt(A_calc)-sqrt(A_0))+pout;
157  dfa = R*W1-5*R*sqrt(beta/(2*rho))*sqrt(sqrt(A_calc))-beta/(2*sqrt(A_calc));
158  delta_A_calc = fa/dfa;
159  A_calc = A_calc - delta_A_calc;
160 
161  if (sqrt(delta_A_calc*delta_A_calc) < Tol)
162  proceed = 0;
163  }
164 
165  // Obtain u_u and A_u
166  //u_u = W1 - 4*sqrt(beta/(2*rho))*(sqrt(sqrt(A_calc)));
167  u_u=(pext+beta*(sqrt(A_calc)-sqrt(A_0))-pout)/(R*A_calc);
168  A_u = A_calc;
169  }
double NekDouble
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,
const NekDouble  time,
int  omega,
int  offset,
int  n 
)
protectedvirtual

Implements Nektar::PulseWaveBoundary.

Definition at line 67 of file RCROutflow.cpp.

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

73  {
74  NekDouble A_r, u_r;
75  NekDouble A_u, u_u;
76  NekDouble A_l, u_l, c_0;
77 
79 
80  vessel[0] = m_vessels[2*omega];
81  vessel[1] = m_vessels[2*omega+1];
82 
83  /* Find the terminal RCR boundary condition and calculates
84  the updated velocity and area as well as the updated
85  boundary conditions */
86 
87  NekDouble RT=((vessel[0]->GetBndCondExpansions())[n])->GetCoeffs()[0];
88  NekDouble C=((vessel[1]->GetBndCondExpansions())[n])->GetCoeffs()[0];
89 
90  m_session->LoadParameter("pout", m_pout);
91 
92  NekDouble R1;
93  NekDouble R2;
94  NekDouble pout = m_pout;
95 
96  NekDouble rho = m_rho;
97  int nq = vessel[0]->GetTotPoints();
98 
99  A_l = inarray[0][offset+nq-1];
100  u_l = inarray[1][offset+nq-1];
101 
102  // Goes through the first resistance Calculate c_0
103  c_0 = sqrt(beta[omega][nq-1]/(2*m_rho))*sqrt(sqrt(A_0[omega][nq-1]));
104 
105  // Calculate R1 and R2, R1 being calculated so as
106  // to eliminate reflections in the vessel
107  R1 = rho*c_0/A_0[omega][nq-1];
108  R2 = RT-R1;
109 
110  // Call the R RiemannSolver
111  R_RiemannSolver(R1,A_l,u_l,A_0[omega][nq-1],beta[omega][nq-1],m_pc,A_u,u_u);
112  A_r = A_l;
113  u_r = 2*u_u-u_l;
114 
115  // Goes through the CR system, it consists in
116  // updating the pressure pc
117  m_pc = m_pc + m_timestep/C*(A_u*u_u-(m_pc-pout)/R2);
118 
119  // Store the updated values in the boundary condition
120  (vessel[0]->UpdateBndCondExpansion(n))->UpdatePhys()[0] = A_r;
121  (vessel[1]->UpdateBndCondExpansion(n))->UpdatePhys()[0] = u_r;
122  }
NekDouble m_timestep
Definition: RCROutflow.h:81
LibUtilities::SessionReaderSharedPtr m_session
Array< OneD, MultiRegions::ExpListSharedPtr > m_vessels
NekDouble m_pc
Definition: RCROutflow.h:83
double NekDouble
void R_RiemannSolver(NekDouble R, NekDouble A_l, NekDouble u_l, NekDouble A_0, NekDouble beta, NekDouble pout, NekDouble &A_u, NekDouble &u_u)
Definition: RCROutflow.cpp:124

Member Data Documentation

std::string Nektar::RCROutflow::className
static
Initial value:
"RCR-terminal",
"RCR outflow boundary condition")

Name of class.

Definition at line 63 of file RCROutflow.h.

NekDouble Nektar::RCROutflow::m_pc
protected

Definition at line 83 of file RCROutflow.h.

Referenced by v_DoBoundary().

NekDouble Nektar::RCROutflow::m_timestep
protected

Definition at line 81 of file RCROutflow.h.

Referenced by RCROutflow(), and v_DoBoundary().