Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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.
- 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.
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.
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.
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.
bool CheckScalars (std::string name)
 Determine whether a scalar has been defined in m_scalars.
bool CheckVectors (std::string name)
 Determine whether a vector has been defined in m_vectors.
bool CheckParams (std::string name)
 Determine whether a parameter has been defined in m_params.
bool CheckAuxScal (std::string name)
 Determine whether a scalar has been defined in m_auxScal.
bool CheckAuxVec (std::string name)
 Determine whether a vector has been defined in m_auxVec.

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

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

Member Function Documentation

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

Definition at line 46 of file RoeSolver.h.

References RoeSolver().

{
new RoeSolver());
}
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.

{
static NekDouble gamma = m_params["gamma"]();
// Left and right velocities
NekDouble uL = rhouL / rhoL;
NekDouble vL = rhovL / rhoL;
NekDouble wL = rhowL / rhoL;
NekDouble uR = rhouR / rhoR;
NekDouble vR = rhovR / rhoR;
NekDouble wR = rhowR / rhoR;
// Left and right pressures
NekDouble pL = (gamma - 1.0) *
(EL - 0.5 * (rhouL * uL + rhovL * vL + rhowL * wL));
NekDouble pR = (gamma - 1.0) *
(ER - 0.5 * (rhouR * uR + rhovR * vR + rhowR * wR));
// Left and right enthalpy
NekDouble hL = (EL + pL) / rhoL;
NekDouble hR = (ER + pR) / rhoR;
// Square root of rhoL and rhoR.
NekDouble srL = sqrt(rhoL);
NekDouble srR = sqrt(rhoR);
NekDouble srLR = srL + srR;
// Velocity, enthalpy and sound speed Roe averages (equation 11.60).
NekDouble uRoe = (srL * uL + srR * uR) / srLR;
NekDouble vRoe = (srL * vL + srR * vR) / srLR;
NekDouble wRoe = (srL * wL + srR * wR) / srLR;
NekDouble hRoe = (srL * hL + srR * hR) / srLR;
NekDouble URoe = (uRoe * uRoe + vRoe * vRoe + wRoe * wRoe);
NekDouble cRoe = sqrt((gamma - 1.0)*(hRoe - 0.5 * URoe));
// Compute eigenvectors (equation 11.59).
NekDouble k[5][5] = {
{1, uRoe - cRoe, vRoe, wRoe, hRoe - uRoe * cRoe},
{1, uRoe, vRoe, wRoe, 0.5 * URoe},
{0, 0, 1, 0, vRoe},
{0, 0, 0, 1, wRoe},
{1, uRoe+cRoe, vRoe, wRoe, hRoe + uRoe*cRoe}
};
// Calculate jumps \Delta u_i (defined preceding equation 11.67).
NekDouble jump[5] = {
rhoR - rhoL,
rhouR - rhouL,
rhovR - rhovL,
rhowR - rhowL,
ER - EL
};
// Define \Delta u_5 (equation 11.70).
NekDouble jumpbar = jump[4] - (jump[2]-vRoe*jump[0])*vRoe -
(jump[3]-wRoe*jump[0])*wRoe;
// Compute wave amplitudes (equations 11.68, 11.69).
NekDouble alpha[5];
alpha[1] = (gamma-1.0)*(jump[0]*(hRoe - uRoe*uRoe) + uRoe*jump[1] -
jumpbar)/(cRoe*cRoe);
alpha[0] = (jump[0]*(uRoe + cRoe) - jump[1] - cRoe*alpha[1])/(2.0*cRoe);
alpha[4] = jump[0] - (alpha[0] + alpha[1]);
alpha[2] = jump[2] - vRoe * jump[0];
alpha[3] = jump[3] - wRoe * jump[0];
// Compute average of left and right fluxes needed for equation 11.29.
rhof = 0.5*(rhoL*uL + rhoR*uR);
rhouf = 0.5*(pL + rhoL*uL*uL + pR + rhoR*uR*uR);
rhovf = 0.5*(rhoL*uL*vL + rhoR*uR*vR);
rhowf = 0.5*(rhoL*uL*wL + rhoR*uR*wR);
Ef = 0.5*(uL*(EL + pL) + uR*(ER + pR));
// Compute eigenvalues \lambda_i (equation 11.58).
NekDouble uRoeAbs = fabs(uRoe);
NekDouble lambda[5] = {
fabs(uRoe - cRoe),
uRoeAbs,
uRoeAbs,
uRoeAbs,
fabs(uRoe + cRoe)
};
// Finally perform summation (11.29).
for (int i = 0; i < 5; ++i)
{
NekDouble ahat = 0.5*alpha[i]*lambda[i];
rhof -= ahat*k[i][0];
rhouf -= ahat*k[i][1];
rhovf -= ahat*k[i][2];
rhowf -= ahat*k[i][3];
Ef -= ahat*k[i][4];
}
}

Member Data Documentation

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

Definition at line 52 of file RoeSolver.h.