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) 2014 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,
61  Array<OneD, Array<OneD, NekDouble> > &flux)
62 {
63  Array< OneD, Array< OneD, NekDouble > > basefield = GetRotBasefield();
64 
65  int expDim = nDim;
66  NekDouble uF, vF;
67 
68  if (expDim == 1)
69  {
70  for (int i = 0; i < Fwd[0].num_elements(); ++i)
71  {
73  Fwd[0][i], Fwd[1][i], 0.0, 0.0,
74  Bwd[0][i], Bwd[1][i], 0.0, 0.0,
75  basefield[0][i], basefield[1][i], 0.0, 0.0,
76  flux[0][i], flux[1][i], uF, vF);
77  }
78  }
79  else if (expDim == 2)
80  {
81  for (int i = 0; i < Fwd[0].num_elements(); ++i)
82  {
84  Fwd[0][i], Fwd[1][i], Fwd[2][i], 0.0,
85  Bwd[0][i], Bwd[1][i], Bwd[2][i], 0.0,
86  basefield[0][i], basefield[1][i], basefield[2][i], 0.0,
87  flux[0][i], flux[1][i], flux[2][i], vF);
88  }
89  }
90  else if (expDim == 3)
91  {
92  for (int i = 0; i < Fwd[0].num_elements(); ++i)
93  {
95  Fwd[0][i], Fwd[1][i], Fwd[2][i], Fwd[3][i],
96  Bwd[0][i], Bwd[1][i], Bwd[2][i], Bwd[3][i],
97  basefield[0][i], basefield[1][i], basefield[2][i], basefield[3][i],
98  flux[0][i], flux[1][i], flux[2][i], flux[3][i]);
99 
100  }
101  }
102 }
103 
104 
105 /**
106 *
107 */
108 Array< OneD, Array< OneD, NekDouble > > APESolver::GetRotBasefield()
109 {
110  ASSERTL1(CheckVectors("N"), "N not defined.");
111  ASSERTL1(CheckVectors("basefield"), "basefield not defined.");
112  const Array<OneD, const Array<OneD, NekDouble> > normals = m_vectors["N"]();
113  const Array<OneD, const Array<OneD, NekDouble> > basefield =
114  m_vectors["basefield"]();
115 
116  int nTracePts = normals[0].num_elements();
117  int nDim = normals.num_elements();
118 
119  Array< OneD, Array< OneD, NekDouble > > rotBasefield(nDim+1);
120  for (int i = 0; i < nDim + 1; i++)
121  {
122  rotBasefield[i] = Array<OneD, NekDouble>(nTracePts);
123  }
124  Array<OneD, Array<OneD, NekDouble> > baseVecLocs(1);
125  baseVecLocs[0] = Array<OneD, NekDouble>(nDim);
126  for (int i = 0; i < nDim; ++i)
127  {
128  baseVecLocs[0][i] = 1+i;
129  }
130  rotateToNormal(basefield, normals, baseVecLocs, rotBasefield);
131 
132  return rotBasefield;
133 }
134 
135 }