Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AUSM2Solver.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: AUSM2Solver.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: AUSM2 Riemann solver.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
37 
38 namespace Nektar
39 {
40  std::string AUSM2Solver::solverName =
42  "AUSM2",
44  "AUSM2 Riemann solver");
45 
47  {
48 
49  }
50 
51  /**
52  * @brief AUSM2 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 sigma = 1.0;
104  NekDouble Kp = 0.25;
105  NekDouble Ku = 0.75;
106  NekDouble Mtilde = 0.5 * (ML * ML + MR * MR);
107  NekDouble rhoA = 0.5 * (rhoL + rhoR);
108  NekDouble Mp = -Kp * ((pR - pL) / (rhoA * cA * cA)) *
109  std::max(1.0 - sigma * Mtilde, 0.0);
110 
111  NekDouble Mbar = M4Function(0, beta, ML) +
112  M4Function(1, beta, MR) + Mp;
113 
114  NekDouble pu = -2.0 * Ku * rhoA * cA * cA * (MR - ML) *
115  P5Function(0, alpha, ML) * P5Function(1, alpha, MR);
116 
117  NekDouble pbar = pL * P5Function(0, alpha, ML) +
118  pR * P5Function(1, alpha, MR) + pu;
119 
120  if (Mbar >= 0.0)
121  {
122  rhof = cA * Mbar * rhoL;
123  rhouf = cA * Mbar * rhoL * uL + pbar;
124  rhovf = cA * Mbar * rhoL * vL;
125  rhowf = cA * Mbar * rhoL * wL;
126  Ef = cA * Mbar * (EL + pL);
127  }
128  else
129  {
130  rhof = cA * Mbar * rhoR;
131  rhouf = cA * Mbar * rhoR * uR + pbar;
132  rhovf = cA * Mbar * rhoR * vR;
133  rhowf = cA * Mbar * rhoR * wR;
134  Ef = cA * Mbar * (ER + pR);
135  }
136  }
137 
138  double AUSM2Solver::M1Function(int A, double M)
139  {
140  double out;
141 
142  if (A == 0)
143  {
144  out = 0.5 * (M + fabs(M));
145  }
146  else
147  {
148  out = 0.5 * (M - fabs(M));
149  }
150 
151  return out;
152  }
153 
154  double AUSM2Solver::M2Function(int A, double M)
155  {
156  double out;
157 
158  if (A == 0)
159  {
160  out = 0.25 * (M + 1.0) * (M + 1.0);
161  }
162  else
163  {
164  out = -0.25 * (M - 1.0) * (M - 1.0);
165  }
166 
167  return out;
168  }
169 
170  double AUSM2Solver::M4Function(int A, double beta, double M)
171  {
172  double out;
173 
174  if (fabs(M) >= 1.0)
175  {
176  out = M1Function(A, M);
177  }
178  else
179  {
180  out = M2Function(A, M);
181 
182  if (A == 0)
183  {
184  out *= 1.0 - 16.0 * beta * M2Function(1, M);
185  }
186  else
187  {
188  out *= 1.0 + 16.0 * beta * M2Function(0, M);
189  }
190  }
191 
192  return out;
193  }
194 
195  double AUSM2Solver::P5Function(int A, double alpha, double M)
196  {
197  double out;
198 
199  if (fabs(M) >= 1.0)
200  {
201  out = (1.0 / M) * M1Function(A, M);
202  }
203  else
204  {
205  out = M2Function(A, M);
206 
207  if (A == 0)
208  {
209  out *= (2.0 - M) - 16.0 * alpha * M * M2Function(1, M);
210  }
211  else
212  {
213  out *= (-2.0 - M) + 16.0 * alpha * M * M2Function(0, M);
214  }
215  }
216 
217  return out;
218  }
219 }
double M1Function(int A, double M)
static std::string solverName
Definition: AUSM2Solver.h:52
RiemannSolverFactory & GetRiemannSolverFactory()
double NekDouble
double M4Function(int A, double beta, double M)
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)
AUSM2 Riemann solver.
Definition: AUSM2Solver.cpp:70
static RiemannSolverSharedPtr create()
Definition: AUSM2Solver.h:46
std::map< std::string, RSParamFuncType > m_params
Map of parameter function types.
double P5Function(int A, double alpha, double M)
double M2Function(int A, double M)
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:215