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

#include <RoeSolver.h>

Inheritance diagram for Nektar::RoeSolver:
Inheritance graph
[legend]
Collaboration diagram for Nektar::RoeSolver:
Collaboration graph
[legend]

Static Public Member Functions

static RiemannSolverSharedPtr create ()
 

Static Public Attributes

static std::string solverName
 

Protected Member Functions

 RoeSolver ()
 
virtual void v_PointSolve (double rhoL, double rhouL, double rhovL, double rhowL, double EL, double rhoR, double rhouR, double rhovR, double rhowR, double ER, double &rhof, double &rhouf, double &rhovf, double &rhowf, double &Ef)
 Roe Riemann solver. More...
 
- Protected Member Functions inherited from Nektar::CompressibleSolver
 CompressibleSolver ()
 
virtual void v_Solve (const int nDim, const Array< OneD, const Array< OneD, NekDouble > > &Fwd, const Array< OneD, const Array< OneD, NekDouble > > &Bwd, Array< OneD, Array< OneD, NekDouble > > &flux)
 
virtual void v_ArraySolve (const Array< OneD, const Array< OneD, NekDouble > > &Fwd, const Array< OneD, const Array< OneD, NekDouble > > &Bwd, Array< OneD, Array< OneD, NekDouble > > &flux)
 
virtual void v_PointSolveVisc (NekDouble rhoL, NekDouble rhouL, NekDouble rhovL, NekDouble rhowL, NekDouble EL, NekDouble EpsL, NekDouble rhoR, NekDouble rhouR, NekDouble rhovR, NekDouble rhowR, NekDouble ER, NekDouble EpsR, NekDouble &rhof, NekDouble &rhouf, NekDouble &rhovf, NekDouble &rhowf, NekDouble &Ef, NekDouble &Epsf)
 
- Protected Member Functions inherited from Nektar::SolverUtils::RiemannSolver
SOLVER_UTILS_EXPORT RiemannSolver ()
 
void GenerateRotationMatrices (const Array< OneD, const Array< OneD, NekDouble > > &normals)
 Generate rotation matrices for 3D expansions. More...
 
void FromToRotation (Array< OneD, const NekDouble > &from, Array< OneD, const NekDouble > &to, NekDouble *mat)
 A function for creating a rotation matrix that rotates a vector from into another vector to. More...
 
SOLVER_UTILS_EXPORT void rotateToNormal (const Array< OneD, const Array< OneD, NekDouble > > &inarray, const Array< OneD, const Array< OneD, NekDouble > > &normals, const Array< OneD, const Array< OneD, NekDouble > > &vecLocs, Array< OneD, Array< OneD, NekDouble > > &outarray)
 Rotate a vector field to trace normal. More...
 
SOLVER_UTILS_EXPORT void rotateFromNormal (const Array< OneD, const Array< OneD, NekDouble > > &inarray, const Array< OneD, const Array< OneD, NekDouble > > &normals, const Array< OneD, const Array< OneD, NekDouble > > &vecLocs, Array< OneD, Array< OneD, NekDouble > > &outarray)
 Rotate a vector field from trace normal. More...
 
SOLVER_UTILS_EXPORT bool CheckScalars (std::string name)
 Determine whether a scalar has been defined in m_scalars. More...
 
SOLVER_UTILS_EXPORT bool CheckVectors (std::string name)
 Determine whether a vector has been defined in m_vectors. More...
 
SOLVER_UTILS_EXPORT bool CheckParams (std::string name)
 Determine whether a parameter has been defined in m_params. More...
 
SOLVER_UTILS_EXPORT bool CheckAuxScal (std::string name)
 Determine whether a scalar has been defined in m_auxScal. More...
 
SOLVER_UTILS_EXPORT bool CheckAuxVec (std::string name)
 Determine whether a vector has been defined in m_auxVec. More...
 

Additional Inherited Members

- Public Member Functions inherited from Nektar::SolverUtils::RiemannSolver
SOLVER_UTILS_EXPORT void Solve (const int nDim, const Array< OneD, const Array< OneD, NekDouble > > &Fwd, const Array< OneD, const Array< OneD, NekDouble > > &Bwd, Array< OneD, Array< OneD, NekDouble > > &flux)
 Perform the Riemann solve given the forwards and backwards spaces. More...
 
template<typename FuncPointerT , typename ObjectPointerT >
void SetScalar (std::string name, FuncPointerT func, ObjectPointerT obj)
 
void SetScalar (std::string name, RSScalarFuncType fp)
 
template<typename FuncPointerT , typename ObjectPointerT >
void SetVector (std::string name, FuncPointerT func, ObjectPointerT obj)
 
void SetVector (std::string name, RSVecFuncType fp)
 
template<typename FuncPointerT , typename ObjectPointerT >
void SetParam (std::string name, FuncPointerT func, ObjectPointerT obj)
 
void SetParam (std::string name, RSParamFuncType fp)
 
template<typename FuncPointerT , typename ObjectPointerT >
void SetAuxScal (std::string name, FuncPointerT func, ObjectPointerT obj)
 
template<typename FuncPointerT , typename ObjectPointerT >
void SetAuxVec (std::string name, FuncPointerT func, ObjectPointerT obj)
 
std::map< std::string, RSScalarFuncType > & GetScalars ()
 
std::map< std::string, RSVecFuncType > & GetVectors ()
 
std::map< std::string, RSParamFuncType > & GetParams ()
 
- Public Attributes inherited from Nektar::SolverUtils::RiemannSolver
int m_spacedim
 
- Protected Attributes inherited from Nektar::CompressibleSolver
bool m_pointSolve
 
- Protected Attributes inherited from Nektar::SolverUtils::RiemannSolver
bool m_requiresRotation
 Indicates whether the Riemann solver requires a rotation to be applied to the velocity fields. More...
 
std::map< std::string, RSScalarFuncTypem_scalars
 Map of scalar function types. More...
 
std::map< std::string, RSVecFuncTypem_vectors
 Map of vector function types. More...
 
std::map< std::string, RSParamFuncTypem_params
 Map of parameter function types. More...
 
std::map< std::string, RSScalarFuncTypem_auxScal
 Map of auxiliary scalar function types. More...
 
std::map< std::string, RSVecFuncTypem_auxVec
 Map of auxiliary vector function types. More...
 
Array< OneD, Array< OneD, NekDouble > > m_rotMat
 Rotation matrices for each trace quadrature point. More...
 
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_rotStorage
 Rotation storage. More...
 

Detailed Description

Definition at line 43 of file RoeSolver.h.

Constructor & Destructor Documentation

Nektar::RoeSolver::RoeSolver ( )
protected

Definition at line 46 of file RoeSolver.cpp.

Referenced by create().

47  {
48 
49  }

Member Function Documentation

static RiemannSolverSharedPtr Nektar::RoeSolver::create ( )
inlinestatic

Definition at line 46 of file RoeSolver.h.

References RoeSolver().

47  {
49  new RoeSolver());
50  }
boost::shared_ptr< RiemannSolver > RiemannSolverSharedPtr
A shared pointer to an EquationSystem object.
void Nektar::RoeSolver::v_PointSolve ( double  rhoL,
double  rhouL,
double  rhovL,
double  rhowL,
double  EL,
double  rhoR,
double  rhouR,
double  rhovR,
double  rhowR,
double  ER,
double &  rhof,
double &  rhouf,
double &  rhovf,
double &  rhowf,
double &  Ef 
)
protectedvirtual

Roe Riemann solver.

Stated equations numbers are from:

"Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction", E. F. Toro (3rd edition, 2009).

We follow the algorithm prescribed following equation 11.70.

Parameters
rhoLDensity left state.
rhoRDensity right state.
rhouLx-momentum component left state.
rhouRx-momentum component right state.
rhovLy-momentum component left state.
rhovRy-momentum component right state.
rhowLz-momentum component left state.
rhowRz-momentum component right state.
ELEnergy left state.
EREnergy right state.
rhofComputed Riemann flux for density.
rhoufComputed Riemann flux for x-momentum component
rhovfComputed Riemann flux for y-momentum component
rhowfComputed Riemann flux for z-momentum component
EfComputed Riemann flux for energy.

Reimplemented from Nektar::CompressibleSolver.

Definition at line 77 of file RoeSolver.cpp.

References Nektar::SolverUtils::RiemannSolver::m_params.

81  {
82  static NekDouble gamma = m_params["gamma"]();
83 
84  // Left and right velocities
85  NekDouble uL = rhouL / rhoL;
86  NekDouble vL = rhovL / rhoL;
87  NekDouble wL = rhowL / rhoL;
88  NekDouble uR = rhouR / rhoR;
89  NekDouble vR = rhovR / rhoR;
90  NekDouble wR = rhowR / rhoR;
91 
92  // Left and right pressures
93  NekDouble pL = (gamma - 1.0) *
94  (EL - 0.5 * (rhouL * uL + rhovL * vL + rhowL * wL));
95  NekDouble pR = (gamma - 1.0) *
96  (ER - 0.5 * (rhouR * uR + rhovR * vR + rhowR * wR));
97 
98  // Left and right enthalpy
99  NekDouble hL = (EL + pL) / rhoL;
100  NekDouble hR = (ER + pR) / rhoR;
101 
102  // Square root of rhoL and rhoR.
103  NekDouble srL = sqrt(rhoL);
104  NekDouble srR = sqrt(rhoR);
105  NekDouble srLR = srL + srR;
106 
107  // Velocity, enthalpy and sound speed Roe averages (equation 11.60).
108  NekDouble uRoe = (srL * uL + srR * uR) / srLR;
109  NekDouble vRoe = (srL * vL + srR * vR) / srLR;
110  NekDouble wRoe = (srL * wL + srR * wR) / srLR;
111  NekDouble hRoe = (srL * hL + srR * hR) / srLR;
112  NekDouble URoe = (uRoe * uRoe + vRoe * vRoe + wRoe * wRoe);
113  NekDouble cRoe = sqrt((gamma - 1.0)*(hRoe - 0.5 * URoe));
114 
115  // Compute eigenvectors (equation 11.59).
116  NekDouble k[5][5] = {
117  {1, uRoe - cRoe, vRoe, wRoe, hRoe - uRoe * cRoe},
118  {1, uRoe, vRoe, wRoe, 0.5 * URoe},
119  {0, 0, 1, 0, vRoe},
120  {0, 0, 0, 1, wRoe},
121  {1, uRoe+cRoe, vRoe, wRoe, hRoe + uRoe*cRoe}
122  };
123 
124  // Calculate jumps \Delta u_i (defined preceding equation 11.67).
125  NekDouble jump[5] = {
126  rhoR - rhoL,
127  rhouR - rhouL,
128  rhovR - rhovL,
129  rhowR - rhowL,
130  ER - EL
131  };
132 
133  // Define \Delta u_5 (equation 11.70).
134  NekDouble jumpbar = jump[4] - (jump[2]-vRoe*jump[0])*vRoe -
135  (jump[3]-wRoe*jump[0])*wRoe;
136 
137  // Compute wave amplitudes (equations 11.68, 11.69).
138  NekDouble alpha[5];
139  alpha[1] = (gamma-1.0)*(jump[0]*(hRoe - uRoe*uRoe) + uRoe*jump[1] -
140  jumpbar)/(cRoe*cRoe);
141  alpha[0] = (jump[0]*(uRoe + cRoe) - jump[1] - cRoe*alpha[1])/(2.0*cRoe);
142  alpha[4] = jump[0] - (alpha[0] + alpha[1]);
143  alpha[2] = jump[2] - vRoe * jump[0];
144  alpha[3] = jump[3] - wRoe * jump[0];
145 
146  // Compute average of left and right fluxes needed for equation 11.29.
147  rhof = 0.5*(rhoL*uL + rhoR*uR);
148  rhouf = 0.5*(pL + rhoL*uL*uL + pR + rhoR*uR*uR);
149  rhovf = 0.5*(rhoL*uL*vL + rhoR*uR*vR);
150  rhowf = 0.5*(rhoL*uL*wL + rhoR*uR*wR);
151  Ef = 0.5*(uL*(EL + pL) + uR*(ER + pR));
152 
153  // Compute eigenvalues \lambda_i (equation 11.58).
154  NekDouble uRoeAbs = fabs(uRoe);
155  NekDouble lambda[5] = {
156  fabs(uRoe - cRoe),
157  uRoeAbs,
158  uRoeAbs,
159  uRoeAbs,
160  fabs(uRoe + cRoe)
161  };
162 
163  // Finally perform summation (11.29).
164  for (int i = 0; i < 5; ++i)
165  {
166  NekDouble ahat = 0.5*alpha[i]*lambda[i];
167  rhof -= ahat*k[i][0];
168  rhouf -= ahat*k[i][1];
169  rhovf -= ahat*k[i][2];
170  rhowf -= ahat*k[i][3];
171  Ef -= ahat*k[i][4];
172  }
173  }
double NekDouble
std::map< std::string, RSParamFuncType > m_params
Map of parameter function types.

Member Data Documentation

std::string Nektar::RoeSolver::solverName
static
Initial value:

Definition at line 52 of file RoeSolver.h.