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