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

The RiemannSolver class provides an abstract interface under which solvers for various Riemann problems can be implemented. More...

#include <RiemannSolver.h>

Inheritance diagram for Nektar::SolverUtils::RiemannSolver:
Inheritance graph
[legend]
Collaboration diagram for Nektar::SolverUtils::RiemannSolver:
Collaboration graph
[legend]

Public Member Functions

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

int m_spacedim
 

Protected Member Functions

SOLVER_UTILS_EXPORT RiemannSolver ()
 
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)=0
 
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...
 

Protected Attributes

bool m_requiresRotation
 Indicates whether the Riemann solver requires a rotation to be applied to the velocity fields. More...
 
std::map< std::string,
RSScalarFuncType
m_scalars
 Map of scalar function types. More...
 
std::map< std::string,
RSVecFuncType
m_vectors
 Map of vector function types. More...
 
std::map< std::string,
RSParamFuncType
m_params
 Map of parameter function types. More...
 
std::map< std::string,
RSScalarFuncType
m_auxScal
 Map of auxiliary scalar function types. More...
 
std::map< std::string,
RSVecFuncType
m_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

The RiemannSolver class provides an abstract interface under which solvers for various Riemann problems can be implemented.

Definition at line 62 of file RiemannSolver.h.

Constructor & Destructor Documentation

Nektar::SolverUtils::RiemannSolver::RiemannSolver ( )
protected

Definition at line 79 of file RiemannSolver.cpp.

79  : m_requiresRotation(false),
80  m_rotStorage (3)
81  {
82 
83  }
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_rotStorage
Rotation storage.
bool m_requiresRotation
Indicates whether the Riemann solver requires a rotation to be applied to the velocity fields...

Member Function Documentation

bool Nektar::SolverUtils::RiemannSolver::CheckAuxScal ( std::string  name)
protected

Determine whether a scalar has been defined in m_auxScal.

Parameters
nameScalar name.

Definition at line 375 of file RiemannSolver.cpp.

References Nektar::iterator, and m_auxScal.

376  {
378  m_auxScal.find(name);
379 
380  return it != m_auxScal.end();
381  }
std::map< std::string, RSScalarFuncType > m_auxScal
Map of auxiliary scalar function types.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
bool Nektar::SolverUtils::RiemannSolver::CheckAuxVec ( std::string  name)
protected

Determine whether a vector has been defined in m_auxVec.

Parameters
nameVector name.

Definition at line 388 of file RiemannSolver.cpp.

References Nektar::iterator, and m_auxVec.

Referenced by Solve().

389  {
391  m_auxVec.find(name);
392 
393  return it != m_auxVec.end();
394  }
std::map< std::string, RSVecFuncType > m_auxVec
Map of auxiliary vector function types.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
bool Nektar::SolverUtils::RiemannSolver::CheckParams ( std::string  name)
protected

Determine whether a parameter has been defined in m_params.

Parameters
nameParameter name.

Definition at line 362 of file RiemannSolver.cpp.

References Nektar::iterator, and m_params.

Referenced by Nektar::LaxFriedrichsSolver::v_PointSolve(), and Nektar::UpwindSolver::v_PointSolve().

363  {
365  m_params.find(name);
366 
367  return it != m_params.end();
368  }
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
std::map< std::string, RSParamFuncType > m_params
Map of parameter function types.
bool Nektar::SolverUtils::RiemannSolver::CheckScalars ( std::string  name)
protected

Determine whether a scalar has been defined in m_scalars.

Parameters
nameScalar name.

Definition at line 336 of file RiemannSolver.cpp.

References Nektar::iterator, and m_scalars.

Referenced by Nektar::SolverUtils::UpwindLDGSolver::v_Solve(), and Nektar::SolverUtils::UpwindSolver::v_Solve().

337  {
339  m_scalars.find(name);
340 
341  return it != m_scalars.end();
342  }
std::map< std::string, RSScalarFuncType > m_scalars
Map of scalar function types.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
bool Nektar::SolverUtils::RiemannSolver::CheckVectors ( std::string  name)
protected

Determine whether a vector has been defined in m_vectors.

Parameters
nameVector name.

Definition at line 349 of file RiemannSolver.cpp.

References Nektar::iterator, and m_vectors.

Referenced by Nektar::APESolver::GetRotBasefield(), and Solve().

350  {
352  m_vectors.find(name);
353 
354  return it != m_vectors.end();
355  }
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
std::map< std::string, RSVecFuncType > m_vectors
Map of vector function types.
void Nektar::SolverUtils::RiemannSolver::FromToRotation ( Array< OneD, const NekDouble > &  from,
Array< OneD, const NekDouble > &  to,
NekDouble mat 
)
protected

A function for creating a rotation matrix that rotates a vector from into another vector to.

Authors: Tomas Möller, John Hughes "Efficiently Building a Matrix to Rotate One Vector to Another" Journal of Graphics Tools, 4(4):1-4, 1999

Parameters
fromNormalised 3-vector to rotate from.
toNormalised 3-vector to rotate to.
outResulting 3x3 rotation matrix (row-major order).

Definition at line 444 of file RiemannSolver.cpp.

References CROSS, DOT, and EPSILON.

Referenced by GenerateRotationMatrices().

448  {
449  NekDouble v[3];
450  NekDouble e, h, f;
451 
452  CROSS(v, from, to);
453  e = DOT(from, to);
454  f = (e < 0)? -e:e;
455  if (f > 1.0 - EPSILON)
456  {
457  NekDouble u[3], v[3];
458  NekDouble x[3];
459  NekDouble c1, c2, c3;
460  int i, j;
461 
462  x[0] = (from[0] > 0.0)? from[0] : -from[0];
463  x[1] = (from[1] > 0.0)? from[1] : -from[1];
464  x[2] = (from[2] > 0.0)? from[2] : -from[2];
465 
466  if (x[0] < x[1])
467  {
468  if (x[0] < x[2])
469  {
470  x[0] = 1.0; x[1] = x[2] = 0.0;
471  }
472  else
473  {
474  x[2] = 1.0; x[0] = x[1] = 0.0;
475  }
476  }
477  else
478  {
479  if (x[1] < x[2])
480  {
481  x[1] = 1.0; x[0] = x[2] = 0.0;
482  }
483  else
484  {
485  x[2] = 1.0; x[0] = x[1] = 0.0;
486  }
487  }
488 
489  u[0] = x[0] - from[0];
490  u[1] = x[1] - from[1];
491  u[2] = x[2] - from[2];
492  v[0] = x[0] - to [0];
493  v[1] = x[1] - to [1];
494  v[2] = x[2] - to [2];
495 
496  c1 = 2.0 / DOT(u, u);
497  c2 = 2.0 / DOT(v, v);
498  c3 = c1 * c2 * DOT(u, v);
499 
500  for (i = 0; i < 3; i++) {
501  for (j = 0; j < 3; j++) {
502  mat[3*i+j] = - c1 * u[i] * u[j]
503  - c2 * v[i] * v[j]
504  + c3 * v[i] * u[j];
505  }
506  mat[i+3*i] += 1.0;
507  }
508  }
509  else
510  {
511  NekDouble hvx, hvz, hvxy, hvxz, hvyz;
512  h = 1.0/(1.0 + e);
513  hvx = h * v[0];
514  hvz = h * v[2];
515  hvxy = hvx * v[1];
516  hvxz = hvx * v[2];
517  hvyz = hvz * v[1];
518  mat[0] = e + hvx * v[0];
519  mat[1] = hvxy - v[2];
520  mat[2] = hvxz + v[1];
521  mat[3] = hvxy + v[2];
522  mat[4] = e + h * v[1] * v[1];
523  mat[5] = hvyz - v[0];
524  mat[6] = hvxz - v[1];
525  mat[7] = hvyz + v[0];
526  mat[8] = e + hvz * v[2];
527  }
528  }
#define CROSS(dest, v1, v2)
double NekDouble
#define EPSILON
#define DOT(v1, v2)
void Nektar::SolverUtils::RiemannSolver::GenerateRotationMatrices ( const Array< OneD, const Array< OneD, NekDouble > > &  normals)
protected

Generate rotation matrices for 3D expansions.

Definition at line 399 of file RiemannSolver.cpp.

References FromToRotation(), and m_rotMat.

Referenced by rotateToNormal().

401  {
402  Array<OneD, NekDouble> xdir(3,0.0);
403  Array<OneD, NekDouble> tn (3);
404  NekDouble tmp[9];
405  const int nq = normals[0].num_elements();
406  int i, j;
407  xdir[0] = 1.0;
408 
409  // Allocate storage for rotation matrices.
410  m_rotMat = Array<OneD, Array<OneD, NekDouble> >(9);
411 
412  for (i = 0; i < 9; ++i)
413  {
414  m_rotMat[i] = Array<OneD, NekDouble>(nq);
415  }
416  for (i = 0; i < normals[0].num_elements(); ++i)
417  {
418  // Generate matrix which takes us from (1,0,0) vector to trace
419  // normal.
420  tn[0] = normals[0][i];
421  tn[1] = normals[1][i];
422  tn[2] = normals[2][i];
423  FromToRotation(tn, xdir, tmp);
424 
425  for (j = 0; j < 9; ++j)
426  {
427  m_rotMat[j][i] = tmp[j];
428  }
429  }
430  }
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...
double NekDouble
Array< OneD, Array< OneD, NekDouble > > m_rotMat
Rotation matrices for each trace quadrature point.
std::map<std::string, RSParamFuncType>& Nektar::SolverUtils::RiemannSolver::GetParams ( )
inline

Definition at line 136 of file RiemannSolver.h.

References m_params.

137  {
138  return m_params;
139  }
std::map< std::string, RSParamFuncType > m_params
Map of parameter function types.
std::map<std::string, RSScalarFuncType>& Nektar::SolverUtils::RiemannSolver::GetScalars ( )
inline

Definition at line 126 of file RiemannSolver.h.

References m_scalars.

127  {
128  return m_scalars;
129  }
std::map< std::string, RSScalarFuncType > m_scalars
Map of scalar function types.
std::map<std::string, RSVecFuncType>& Nektar::SolverUtils::RiemannSolver::GetVectors ( )
inline

Definition at line 131 of file RiemannSolver.h.

References m_vectors.

132  {
133  return m_vectors;
134  }
std::map< std::string, RSVecFuncType > m_vectors
Map of vector function types.
void Nektar::SolverUtils::RiemannSolver::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 
)
protected

Rotate a vector field from trace normal.

This function performs a rotation of the triad of vector components provided in inarray so that the first component aligns with the Cartesian components; it performs the inverse operation of RiemannSolver::rotateToNormal.

Definition at line 255 of file RiemannSolver.cpp.

References ASSERTL1, m_rotMat, Vmath::Vcopy(), Vmath::Vmul(), Vmath::Vvtvm(), Vmath::Vvtvp(), and Vmath::Vvtvvtp().

Referenced by Solve().

260  {
261  for (int i = 0; i < inarray.num_elements(); ++i)
262  {
263  Vmath::Vcopy(inarray[i].num_elements(), inarray[i], 1,
264  outarray[i], 1);
265  }
266 
267  for (int i = 0; i < vecLocs.num_elements(); i++)
268  {
269  ASSERTL1(vecLocs[i].num_elements() == normals.num_elements(),
270  "vecLocs[i] element count mismatch");
271 
272  switch (normals.num_elements())
273  {
274  case 1:
275  { // do nothing
276  const int nq = normals[0].num_elements();
277  const int vx = (int)vecLocs[i][0];
278  Vmath::Vmul (nq, inarray [vx], 1, normals [0], 1,
279  outarray[vx], 1);
280  break;
281  }
282  case 2:
283  {
284  const int nq = normals[0].num_elements();
285  const int vx = (int)vecLocs[i][0];
286  const int vy = (int)vecLocs[i][1];
287 
288  Vmath::Vmul (nq, inarray [vy], 1, normals [1], 1,
289  outarray[vx], 1);
290  Vmath::Vvtvm(nq, inarray [vx], 1, normals [0], 1,
291  outarray[vx], 1, outarray[vx], 1);
292  Vmath::Vmul (nq, inarray [vx], 1, normals [1], 1,
293  outarray[vy], 1);
294  Vmath::Vvtvp(nq, inarray [vy], 1, normals [0], 1,
295  outarray[vy], 1, outarray[vy], 1);
296  break;
297  }
298 
299  case 3:
300  {
301  const int nq = normals[0].num_elements();
302  const int vx = (int)vecLocs[i][0];
303  const int vy = (int)vecLocs[i][1];
304  const int vz = (int)vecLocs[i][2];
305 
306  Vmath::Vvtvvtp(nq, inarray [vx], 1, m_rotMat[0], 1,
307  inarray [vy], 1, m_rotMat[3], 1,
308  outarray[vx], 1);
309  Vmath::Vvtvp (nq, inarray [vz], 1, m_rotMat[6], 1,
310  outarray[vx], 1, outarray[vx], 1);
311  Vmath::Vvtvvtp(nq, inarray [vx], 1, m_rotMat[1], 1,
312  inarray [vy], 1, m_rotMat[4], 1,
313  outarray[vy], 1);
314  Vmath::Vvtvp (nq, inarray [vz], 1, m_rotMat[7], 1,
315  outarray[vy], 1, outarray[vy], 1);
316  Vmath::Vvtvvtp(nq, inarray [vx], 1, m_rotMat[2], 1,
317  inarray [vy], 1, m_rotMat[5], 1,
318  outarray[vz], 1);
319  Vmath::Vvtvp (nq, inarray [vz], 1, m_rotMat[8], 1,
320  outarray[vz], 1, outarray[vz], 1);
321  break;
322  }
323 
324  default:
325  ASSERTL1(false, "Invalid space dimension.");
326  break;
327  }
328  }
329  }
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:428
Array< OneD, Array< OneD, NekDouble > > m_rotMat
Rotation matrices for each trace quadrature point.
void Vvtvvtp(int n, const T *v, int incv, const T *w, int incw, const T *x, int incx, const T *y, int incy, T *z, int incz)
vvtvvtp (vector times vector plus vector times vector):
Definition: Vmath.cpp:523
void Vvtvm(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvm (vector times vector plus vector): z = w*x - y
Definition: Vmath.cpp:451
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:218
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:169
void Nektar::SolverUtils::RiemannSolver::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 
)
protected

Rotate a vector field to trace normal.

This function performs a rotation of a vector so that the first component aligns with the trace normal direction.

The vectors components are stored in inarray. Their locations must be specified in the "vecLocs" array. vecLocs[0] contains the locations of the first vectors components, vecLocs[1] those of the second and so on.

In 2D, this is accomplished through the transform:

\[ (u_x, u_y) = (n_x u_x + n_y u_y, -n_x v_x + n_y v_y) \]

In 3D, we generate a (non-unique) transformation using RiemannSolver::fromToRotation.

Definition at line 164 of file RiemannSolver.cpp.

References ASSERTL1, GenerateRotationMatrices(), m_rotMat, Vmath::Vcopy(), Vmath::Vmul(), Vmath::Vvtvm(), Vmath::Vvtvp(), and Vmath::Vvtvvtp().

Referenced by Nektar::APESolver::GetRotBasefield(), and Solve().

169  {
170  for (int i = 0; i < inarray.num_elements(); ++i)
171  {
172  Vmath::Vcopy(inarray[i].num_elements(), inarray[i], 1,
173  outarray[i], 1);
174  }
175 
176  for (int i = 0; i < vecLocs.num_elements(); i++)
177  {
178  ASSERTL1(vecLocs[i].num_elements() == normals.num_elements(),
179  "vecLocs[i] element count mismatch");
180 
181  switch (normals.num_elements())
182  {
183  case 1:
184  { // do nothing
185  const int nq = inarray[0].num_elements();
186  const int vx = (int)vecLocs[i][0];
187  Vmath::Vmul (nq, inarray [vx], 1, normals [0], 1,
188  outarray[vx], 1);
189  break;
190  }
191  case 2:
192  {
193  const int nq = inarray[0].num_elements();
194  const int vx = (int)vecLocs[i][0];
195  const int vy = (int)vecLocs[i][1];
196 
197  Vmath::Vmul (nq, inarray [vx], 1, normals [0], 1,
198  outarray[vx], 1);
199  Vmath::Vvtvp(nq, inarray [vy], 1, normals [1], 1,
200  outarray[vx], 1, outarray[vx], 1);
201  Vmath::Vmul (nq, inarray [vx], 1, normals [1], 1,
202  outarray[vy], 1);
203  Vmath::Vvtvm(nq, inarray [vy], 1, normals [0], 1,
204  outarray[vy], 1, outarray[vy], 1);
205  break;
206  }
207 
208  case 3:
209  {
210  const int nq = inarray[0].num_elements();
211  const int vx = (int)vecLocs[i][0];
212  const int vy = (int)vecLocs[i][1];
213  const int vz = (int)vecLocs[i][2];
214 
215  // Generate matrices if they don't already exist.
216  if (m_rotMat.num_elements() == 0)
217  {
218  GenerateRotationMatrices(normals);
219  }
220 
221  // Apply rotation matrices.
222  Vmath::Vvtvvtp(nq, inarray [vx], 1, m_rotMat[0], 1,
223  inarray [vy], 1, m_rotMat[1], 1,
224  outarray[vx], 1);
225  Vmath::Vvtvp (nq, inarray [vz], 1, m_rotMat[2], 1,
226  outarray[vx], 1, outarray[vx], 1);
227  Vmath::Vvtvvtp(nq, inarray [vx], 1, m_rotMat[3], 1,
228  inarray [vy], 1, m_rotMat[4], 1,
229  outarray[vy], 1);
230  Vmath::Vvtvp (nq, inarray [vz], 1, m_rotMat[5], 1,
231  outarray[vy], 1, outarray[vy], 1);
232  Vmath::Vvtvvtp(nq, inarray [vx], 1, m_rotMat[6], 1,
233  inarray [vy], 1, m_rotMat[7], 1,
234  outarray[vz], 1);
235  Vmath::Vvtvp (nq, inarray [vz], 1, m_rotMat[8], 1,
236  outarray[vz], 1, outarray[vz], 1);
237  break;
238  }
239 
240  default:
241  ASSERTL1(false, "Invalid space dimension.");
242  break;
243  }
244  }
245  }
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:428
void GenerateRotationMatrices(const Array< OneD, const Array< OneD, NekDouble > > &normals)
Generate rotation matrices for 3D expansions.
Array< OneD, Array< OneD, NekDouble > > m_rotMat
Rotation matrices for each trace quadrature point.
void Vvtvvtp(int n, const T *v, int incv, const T *w, int incw, const T *x, int incx, const T *y, int incy, T *z, int incz)
vvtvvtp (vector times vector plus vector times vector):
Definition: Vmath.cpp:523
void Vvtvm(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvm (vector times vector plus vector): z = w*x - y
Definition: Vmath.cpp:451
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:218
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:169
template<typename FuncPointerT , typename ObjectPointerT >
void Nektar::SolverUtils::RiemannSolver::SetAuxScal ( std::string  name,
FuncPointerT  func,
ObjectPointerT  obj 
)
inline

Definition at line 111 of file RiemannSolver.h.

References m_auxScal.

114  {
115  m_auxScal[name] = boost::bind(func, obj);
116  }
std::map< std::string, RSScalarFuncType > m_auxScal
Map of auxiliary scalar function types.
template<typename FuncPointerT , typename ObjectPointerT >
void Nektar::SolverUtils::RiemannSolver::SetAuxVec ( std::string  name,
FuncPointerT  func,
ObjectPointerT  obj 
)
inline

Definition at line 119 of file RiemannSolver.h.

References m_auxVec.

122  {
123  m_auxVec[name] = boost::bind(func, obj);
124  }
std::map< std::string, RSVecFuncType > m_auxVec
Map of auxiliary vector function types.
template<typename FuncPointerT , typename ObjectPointerT >
void Nektar::SolverUtils::RiemannSolver::SetParam ( std::string  name,
FuncPointerT  func,
ObjectPointerT  obj 
)
inline

Definition at line 98 of file RiemannSolver.h.

References m_params.

101  {
102  m_params[name] = boost::bind(func, obj);
103  }
std::map< std::string, RSParamFuncType > m_params
Map of parameter function types.
void Nektar::SolverUtils::RiemannSolver::SetParam ( std::string  name,
RSParamFuncType  fp 
)
inline

Definition at line 105 of file RiemannSolver.h.

References m_params.

106  {
107  m_params[name] = fp;
108  }
std::map< std::string, RSParamFuncType > m_params
Map of parameter function types.
template<typename FuncPointerT , typename ObjectPointerT >
void Nektar::SolverUtils::RiemannSolver::SetScalar ( std::string  name,
FuncPointerT  func,
ObjectPointerT  obj 
)
inline

Definition at line 72 of file RiemannSolver.h.

References m_scalars.

75  {
76  m_scalars[name] = boost::bind(func, obj);
77  }
std::map< std::string, RSScalarFuncType > m_scalars
Map of scalar function types.
void Nektar::SolverUtils::RiemannSolver::SetScalar ( std::string  name,
RSScalarFuncType  fp 
)
inline

Definition at line 79 of file RiemannSolver.h.

References m_scalars.

80  {
81  m_scalars[name] = fp;
82  }
std::map< std::string, RSScalarFuncType > m_scalars
Map of scalar function types.
template<typename FuncPointerT , typename ObjectPointerT >
void Nektar::SolverUtils::RiemannSolver::SetVector ( std::string  name,
FuncPointerT  func,
ObjectPointerT  obj 
)
inline

Definition at line 85 of file RiemannSolver.h.

References m_vectors.

88  {
89  m_vectors[name] = boost::bind(func, obj);
90  }
std::map< std::string, RSVecFuncType > m_vectors
Map of vector function types.
void Nektar::SolverUtils::RiemannSolver::SetVector ( std::string  name,
RSVecFuncType  fp 
)
inline

Definition at line 92 of file RiemannSolver.h.

References m_vectors.

93  {
94  m_vectors[name] = fp;
95  }
std::map< std::string, RSVecFuncType > m_vectors
Map of vector function types.
void Nektar::SolverUtils::RiemannSolver::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.

This routine calls the virtual function v_Solve to perform the Riemann solve. If the flag m_requiresRotation is set, then the velocity field is rotated to the normal direction to perform dimensional splitting, and the resulting fluxes are rotated back to the Cartesian directions before being returned. For the Rotation to work, the normal vectors "N" and the location of the vector components in Fwd "vecLocs"must be set via the SetAuxVec() method.

Parameters
FwdForwards trace space.
BwdBackwards trace space.
fluxResultant flux along trace space.

Definition at line 101 of file RiemannSolver.cpp.

References ASSERTL1, CheckAuxVec(), CheckVectors(), m_auxVec, m_requiresRotation, m_rotStorage, m_vectors, rotateFromNormal(), rotateToNormal(), and v_Solve().

106  {
107  if (m_requiresRotation)
108  {
109  ASSERTL1(CheckVectors("N"), "N not defined.");
110  ASSERTL1(CheckAuxVec("vecLocs"), "vecLocs not defined.");
111  const Array<OneD, const Array<OneD, NekDouble> > normals =
112  m_vectors["N"]();
113  const Array<OneD, const Array<OneD, NekDouble> > vecLocs =
114  m_auxVec["vecLocs"]();
115 
116  int nFields = Fwd .num_elements();
117  int nPts = Fwd[0].num_elements();
118 
119  if (m_rotStorage[0].num_elements() != nFields ||
120  m_rotStorage[0][0].num_elements() != nPts)
121  {
122  for (int i = 0; i < 3; ++i)
123  {
124  m_rotStorage[i] =
125  Array<OneD, Array<OneD, NekDouble> >(nFields);
126  for (int j = 0; j < nFields; ++j)
127  {
128  m_rotStorage[i][j] = Array<OneD, NekDouble>(nPts);
129  }
130  }
131  }
132 
133  rotateToNormal (Fwd, normals, vecLocs, m_rotStorage[0]);
134  rotateToNormal (Bwd, normals, vecLocs, m_rotStorage[1]);
135  v_Solve (nDim, m_rotStorage[0], m_rotStorage[1],
136  m_rotStorage[2]);
137  rotateFromNormal(m_rotStorage[2], normals, vecLocs, flux);
138  }
139  else
140  {
141  v_Solve(nDim, Fwd, Bwd, flux);
142  }
143  }
SOLVER_UTILS_EXPORT bool CheckVectors(std::string name)
Determine whether a vector has been defined in m_vectors.
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.
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)=0
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_rotStorage
Rotation storage.
SOLVER_UTILS_EXPORT bool CheckAuxVec(std::string name)
Determine whether a vector has been defined in m_auxVec.
std::map< std::string, RSVecFuncType > m_auxVec
Map of auxiliary vector function types.
bool m_requiresRotation
Indicates whether the Riemann solver requires a rotation to be applied to the velocity fields...
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:218
std::map< std::string, RSVecFuncType > m_vectors
Map of vector function types.
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.
virtual void Nektar::SolverUtils::RiemannSolver::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 
)
protectedpure virtual

Member Data Documentation

std::map<std::string, RSScalarFuncType> Nektar::SolverUtils::RiemannSolver::m_auxScal
protected

Map of auxiliary scalar function types.

Definition at line 154 of file RiemannSolver.h.

Referenced by CheckAuxScal(), and SetAuxScal().

std::map<std::string, RSVecFuncType> Nektar::SolverUtils::RiemannSolver::m_auxVec
protected

Map of auxiliary vector function types.

Definition at line 156 of file RiemannSolver.h.

Referenced by CheckAuxVec(), SetAuxVec(), and Solve().

std::map<std::string, RSParamFuncType > Nektar::SolverUtils::RiemannSolver::m_params
protected
bool Nektar::SolverUtils::RiemannSolver::m_requiresRotation
protected

Indicates whether the Riemann solver requires a rotation to be applied to the velocity fields.

Definition at line 146 of file RiemannSolver.h.

Referenced by Nektar::APESolver::APESolver(), Nektar::CompressibleSolver::CompressibleSolver(), Nektar::LinearSWESolver::LinearSWESolver(), Nektar::NonlinearSWESolver::NonlinearSWESolver(), and Solve().

Array<OneD, Array<OneD, NekDouble> > Nektar::SolverUtils::RiemannSolver::m_rotMat
protected

Rotation matrices for each trace quadrature point.

Definition at line 158 of file RiemannSolver.h.

Referenced by GenerateRotationMatrices(), rotateFromNormal(), and rotateToNormal().

Array<OneD, Array<OneD, Array<OneD, NekDouble> > > Nektar::SolverUtils::RiemannSolver::m_rotStorage
protected

Rotation storage.

Definition at line 160 of file RiemannSolver.h.

Referenced by Solve().

std::map<std::string, RSScalarFuncType> Nektar::SolverUtils::RiemannSolver::m_scalars
protected
int Nektar::SolverUtils::RiemannSolver::m_spacedim

Definition at line 141 of file RiemannSolver.h.

std::map<std::string, RSVecFuncType> Nektar::SolverUtils::RiemannSolver::m_vectors
protected

Map of vector function types.

Definition at line 150 of file RiemannSolver.h.

Referenced by CheckVectors(), Nektar::APESolver::GetRotBasefield(), GetVectors(), SetVector(), and Solve().