Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RiemannSolvers/APESolver.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: APESolver.cpp
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2015 Kilian Lackhove
10 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
11 // Department of Aeronautics, Imperial College London (UK), and Scientific
12 // Computing and Imaging Institute, University of Utah (USA).
13 //
14 // License for the specific language governing rights and limitations under
15 // Permission is hereby granted, free of charge, to any person obtaining a
16 // copy of this software and associated documentation files (the "Software"),
17 // to deal in the Software without restriction, including without limitation
18 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 // and/or sell copies of the Software, and to permit persons to whom the
20 // Software is furnished to do so, subject to the following conditions:
21 //
22 // The above copyright notice and this permission notice shall be included
23 // in all copies or substantial portions of the Software.
24 //
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
28 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
31 // DEALINGS IN THE SOFTWARE.
32 //
33 // Description: Riemann solver base classs for the APE equations.
34 //
35 ///////////////////////////////////////////////////////////////////////////////
36 
38 
39 using namespace std;
40 
41 namespace Nektar
42 {
43 
44 /**
45 *
46 */
47 APESolver::APESolver() :
49 {
50  m_requiresRotation = true;
51 }
52 
53 
54 /**
55 *
56 */
58  const int nDim,
59  const Array<OneD, const Array<OneD, NekDouble> > &Fwd,
60  const Array<OneD, const Array<OneD, NekDouble> > &Bwd,
62 {
64 
65  int expDim = nDim;
66  NekDouble vF, wF, rhoF;
67 
68  if (expDim == 1)
69  {
70  for (int i = 0; i < Fwd[0].num_elements(); ++i)
71  {
73  Fwd[0][i], 0.0, Fwd[1][i], 0.0, 0.0,
74  Bwd[0][i], 0.0, Bwd[1][i], 0.0, 0.0,
75  bf[0][i], bf[1][i], bf[2][i], 0.0, 0.0,
76  flux[0][i], rhoF, flux[1][i], vF, wF);
77  }
78  }
79  else if (expDim == 2)
80  {
81  for (int i = 0; i < Fwd[0].num_elements(); ++i)
82  {
84  Fwd[0][i], 0.0, Fwd[1][i], Fwd[2][i], 0.0,
85  Bwd[0][i], 0.0, Bwd[1][i], Bwd[2][i], 0.0,
86  bf[0][i], bf[1][i], bf[2][i], bf[3][i], 0.0,
87  flux[0][i], rhoF, flux[1][i], flux[2][i], wF);
88  }
89  }
90  else if (expDim == 3)
91  {
92  for (int i = 0; i < Fwd[0].num_elements(); ++i)
93  {
95  Fwd[0][i], 0.0, Fwd[1][i], Fwd[2][i], Fwd[3][i],
96  Bwd[0][i], 0.0, Bwd[1][i], Bwd[2][i], Bwd[3][i],
97  bf[0][i], bf[1][i], bf[2][i], bf[3][i], bf[4][i],
98  flux[0][i], rhoF, flux[1][i], flux[2][i], flux[3][i]);
99  }
100  }
101 }
102 
103 
104 /**
105 *
106 */
108 {
109  ASSERTL1(CheckVectors("N"), "N not defined.");
110  ASSERTL1(CheckVectors("basefield"), "basefield not defined.");
111  const Array<OneD, const Array<OneD, NekDouble> > normals = m_vectors["N"]();
112  const Array<OneD, const Array<OneD, NekDouble> > basefield =
113  m_vectors["basefield"]();
114 
115  int nTracePts = normals[0].num_elements();
116  int nDim = normals.num_elements();
117 
118  Array< OneD, Array< OneD, NekDouble > > rotBasefield(nDim+2);
119  for (int i = 0; i < nDim + 2; i++)
120  {
121  rotBasefield[i] = Array<OneD, NekDouble>(nTracePts);
122  }
123  Array<OneD, Array<OneD, NekDouble> > baseVecLocs(1);
124  baseVecLocs[0] = Array<OneD, NekDouble>(nDim);
125  for (int i = 0; i < nDim; ++i)
126  {
127  baseVecLocs[0][i] = i + 2;
128  }
129  rotateToNormal(basefield, normals, baseVecLocs, rotBasefield);
130 
131  return rotBasefield;
132 }
133 
134 }
Array< OneD, Array< OneD, NekDouble > > GetRotBasefield()
STL namespace.
SOLVER_UTILS_EXPORT bool CheckVectors(std::string name)
Determine whether a vector has been defined in m_vectors.
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)
double NekDouble
bool m_requiresRotation
Indicates whether the Riemann solver requires a rotation to be applied to the velocity fields...
The RiemannSolver class provides an abstract interface under which solvers for various Riemann proble...
Definition: RiemannSolver.h:62
virtual void v_PointSolve(NekDouble pL, NekDouble rhoL, NekDouble uL, NekDouble vL, NekDouble wL, NekDouble pR, NekDouble rhoR, NekDouble uR, NekDouble vR, NekDouble wR, NekDouble p0, NekDouble rho0, NekDouble u0, NekDouble v0, NekDouble w0, NekDouble &pF, NekDouble &rhoF, NekDouble &uF, NekDouble &vF, NekDouble &wF)
Definition: APESolver.h:59
#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.