Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AUSM1Solver.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: AUSM1Solver.cpp
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: AUSM1 Riemann solver.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
37 
38 namespace Nektar
39 {
40  std::string AUSM1Solver::solverName =
42  "AUSM1",
44  "AUSM1 Riemann solver");
45 
47  {
48 
49  }
50 
51  /**
52  * @brief AUSM1 Riemann solver
53  *
54  * @param rhoL Density left state.
55  * @param rhoR Density right state.
56  * @param rhouL x-momentum component left state.
57  * @param rhouR x-momentum component right state.
58  * @param rhovL y-momentum component left state.
59  * @param rhovR y-momentum component right state.
60  * @param rhowL z-momentum component left state.
61  * @param rhowR z-momentum component right state.
62  * @param EL Energy left state.
63  * @param ER Energy right state.
64  * @param rhof Computed Riemann flux for density.
65  * @param rhouf Computed Riemann flux for x-momentum component
66  * @param rhovf Computed Riemann flux for y-momentum component
67  * @param rhowf Computed Riemann flux for z-momentum component
68  * @param Ef Computed Riemann flux for energy.
69  */
71  double rhoL, double rhouL, double rhovL, double rhowL, double EL,
72  double rhoR, double rhouR, double rhovR, double rhowR, double ER,
73  double &rhof, double &rhouf, double &rhovf, double &rhowf, double &Ef)
74  {
75  static NekDouble gamma = m_params["gamma"]();
76 
77  // Left and Right velocities
78  NekDouble uL = rhouL / rhoL;
79  NekDouble vL = rhovL / rhoL;
80  NekDouble wL = rhowL / rhoL;
81  NekDouble uR = rhouR / rhoR;
82  NekDouble vR = rhovR / rhoR;
83  NekDouble wR = rhowR / rhoR;
84 
85  // Left and right pressures
86  NekDouble pL = (gamma - 1.0) *
87  (EL - 0.5 * (rhouL * uL + rhovL * vL + rhowL * wL));
88  NekDouble pR = (gamma - 1.0) *
89  (ER - 0.5 * (rhouR * uR + rhovR * vR + rhowR * wR));
90  NekDouble cL = sqrt(gamma * pL / rhoL);
91  NekDouble cR = sqrt(gamma * pR / rhoR);
92 
93  // Average speeds of sound
94  NekDouble cA = 0.5 * (cL + cR);
95 
96  // Local Mach numbers
97  NekDouble ML = uL / cA;
98  NekDouble MR = uR / cA;
99 
100  // Parameters for specify the upwinding
101  NekDouble beta = 0.125;
102  NekDouble alpha = 0.1875;
103  NekDouble Mbar = M4Function(0, beta, ML) + M4Function(1, beta, MR);
104  NekDouble pbar = pL * P5Function(0, alpha, ML) +
105  pR * P5Function(1, alpha, MR);
106 
107  if (Mbar >= 0.0)
108  {
109  rhof = cA * Mbar * rhoL;
110  rhouf = cA * Mbar * rhoL * uL + pbar;
111  rhovf = cA * Mbar * rhoL * vL;
112  rhowf = cA * Mbar * rhoL * wL;
113  Ef = cA * Mbar * (EL + pL);
114  }
115  else
116  {
117  rhof = cA * Mbar * rhoR;
118  rhouf = cA * Mbar * rhoR * uR + pbar;
119  rhovf = cA * Mbar * rhoR * vR;
120  rhowf = cA * Mbar * rhoR * wR;
121  Ef = cA * Mbar * (ER + pR);
122  }
123  }
124 
125  double AUSM1Solver::M1Function(int A, double M)
126  {
127  double out;
128 
129  if (A == 0)
130  {
131  out = 0.5 * (M + fabs(M));
132  }
133  else
134  {
135  out = 0.5 * (M - fabs(M));
136  }
137 
138  return out;
139  }
140 
141  double AUSM1Solver::M2Function(int A, double M)
142  {
143  double out;
144 
145  if (A == 0)
146  {
147  out = 0.25 * (M + 1.0) * (M + 1.0);
148  }
149  else
150  {
151  out = -0.25 * (M - 1.0) * (M - 1.0);
152  }
153 
154  return out;
155  }
156 
157  double AUSM1Solver::M4Function(int A, double beta, double M)
158  {
159  double out;
160 
161  if (fabs(M) >= 1.0)
162  {
163  out = M1Function(A, M);
164  }
165  else
166  {
167  out = M2Function(A, M);
168 
169  if (A == 0)
170  {
171  out *= 1.0 - 16.0 * beta * M2Function(1, M);
172  }
173  else
174  {
175  out *= 1.0 + 16.0 * beta * M2Function(0, M);
176  }
177  }
178 
179  return out;
180  }
181 
182  double AUSM1Solver::P5Function(int A, double alpha, double M)
183  {
184  double out;
185 
186  if (fabs(M) >= 1.0)
187  {
188  out = (1.0 / M) * M1Function(A, M);
189  }
190  else
191  {
192  out = M2Function(A, M);
193 
194  if (A == 0)
195  {
196  out *= (2.0 - M) - 16.0 * alpha * M * M2Function(1, M);
197  }
198  else
199  {
200  out *= (-2.0 - M) + 16.0 * alpha * M * M2Function(0, M);
201  }
202  }
203 
204  return out;
205  }
206 }
static std::string solverName
Definition: AUSM1Solver.h:52
double M2Function(int A, double M)
static RiemannSolverSharedPtr create()
Definition: AUSM1Solver.h:46
double P5Function(int A, double alpha, double M)
double M4Function(int A, double beta, double M)
RiemannSolverFactory & GetRiemannSolverFactory()
double NekDouble
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)
AUSM1 Riemann solver.
Definition: AUSM1Solver.cpp:70
double M1Function(int A, double M)
std::map< std::string, RSParamFuncType > m_params
Map of parameter function types.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:215