Nektar++
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 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: AUSM2 Riemann solver.
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
36 
37 namespace Nektar
38 {
39  std::string AUSM2Solver::solverName =
41  "AUSM2",
43  "AUSM2 Riemann solver");
44 
47  : CompressibleSolver(pSession)
48  {
49 
50  }
51 
52  /**
53  * @brief AUSM2 Riemann solver
54  *
55  * @param rhoL Density left state.
56  * @param rhoR Density right state.
57  * @param rhouL x-momentum component left state.
58  * @param rhouR x-momentum component right state.
59  * @param rhovL y-momentum component left state.
60  * @param rhovR y-momentum component right state.
61  * @param rhowL z-momentum component left state.
62  * @param rhowR z-momentum component right state.
63  * @param EL Energy left state.
64  * @param ER Energy right state.
65  * @param rhof Computed Riemann flux for density.
66  * @param rhouf Computed Riemann flux for x-momentum component
67  * @param rhovf Computed Riemann flux for y-momentum component
68  * @param rhowf Computed Riemann flux for z-momentum component
69  * @param Ef Computed Riemann flux for energy.
70  */
72  double rhoL, double rhouL, double rhovL, double rhowL, double EL,
73  double rhoR, double rhouR, double rhovR, double rhowR, double ER,
74  double &rhof, double &rhouf, double &rhovf, double &rhowf, double &Ef)
75  {
76  // Left and Right velocities
77  NekDouble uL = rhouL / rhoL;
78  NekDouble vL = rhovL / rhoL;
79  NekDouble wL = rhowL / rhoL;
80  NekDouble uR = rhouR / rhoR;
81  NekDouble vR = rhovR / rhoR;
82  NekDouble wR = rhowR / rhoR;
83 
84  // Internal energy (per unit mass)
85  NekDouble eL =
86  (EL - 0.5 * (rhouL * uL + rhovL * vL + rhowL * wL)) / rhoL;
87  NekDouble eR =
88  (ER - 0.5 * (rhouR * uR + rhovR * vR + rhowR * wR)) / rhoR;
89  // Pressure
90  NekDouble pL = m_eos->GetPressure(rhoL, eL);
91  NekDouble pR = m_eos->GetPressure(rhoR, eR);
92  // Speed of sound
93  NekDouble cL = m_eos->GetSoundSpeed(rhoL, eL);
94  NekDouble cR = m_eos->GetSoundSpeed(rhoR, eR);
95 
96  // Average speeds of sound
97  NekDouble cA = 0.5 * (cL + cR);
98 
99  // Local Mach numbers
100  NekDouble ML = uL / cA;
101  NekDouble MR = uR / cA;
102 
103  // Parameters for specify the upwinding
104  NekDouble beta = 0.125;
105  NekDouble alpha = 0.1875;
106  NekDouble sigma = 1.0;
107  NekDouble Kp = 0.25;
108  NekDouble Ku = 0.75;
109  NekDouble Mtilde = 0.5 * (ML * ML + MR * MR);
110  NekDouble rhoA = 0.5 * (rhoL + rhoR);
111  NekDouble Mp = -Kp * ((pR - pL) / (rhoA * cA * cA)) *
112  std::max(1.0 - sigma * Mtilde, 0.0);
113 
114  NekDouble Mbar = M4Function(0, beta, ML) +
115  M4Function(1, beta, MR) + Mp;
116 
117  NekDouble pu = -2.0 * Ku * rhoA * cA * cA * (MR - ML) *
118  P5Function(0, alpha, ML) * P5Function(1, alpha, MR);
119 
120  NekDouble pbar = pL * P5Function(0, alpha, ML) +
121  pR * P5Function(1, alpha, MR) + pu;
122 
123  if (Mbar >= 0.0)
124  {
125  rhof = cA * Mbar * rhoL;
126  rhouf = cA * Mbar * rhoL * uL + pbar;
127  rhovf = cA * Mbar * rhoL * vL;
128  rhowf = cA * Mbar * rhoL * wL;
129  Ef = cA * Mbar * (EL + pL);
130  }
131  else
132  {
133  rhof = cA * Mbar * rhoR;
134  rhouf = cA * Mbar * rhoR * uR + pbar;
135  rhovf = cA * Mbar * rhoR * vR;
136  rhowf = cA * Mbar * rhoR * wR;
137  Ef = cA * Mbar * (ER + pR);
138  }
139  }
140 
141  double AUSM2Solver::M1Function(int A, double M)
142  {
143  double out;
144 
145  if (A == 0)
146  {
147  out = 0.5 * (M + fabs(M));
148  }
149  else
150  {
151  out = 0.5 * (M - fabs(M));
152  }
153 
154  return out;
155  }
156 
157  double AUSM2Solver::M2Function(int A, double M)
158  {
159  double out;
160 
161  if (A == 0)
162  {
163  out = 0.25 * (M + 1.0) * (M + 1.0);
164  }
165  else
166  {
167  out = -0.25 * (M - 1.0) * (M - 1.0);
168  }
169 
170  return out;
171  }
172 
173  double AUSM2Solver::M4Function(int A, double beta, double M)
174  {
175  double out;
176 
177  if (fabs(M) >= 1.0)
178  {
179  out = M1Function(A, M);
180  }
181  else
182  {
183  out = M2Function(A, M);
184 
185  if (A == 0)
186  {
187  out *= 1.0 - 16.0 * beta * M2Function(1, M);
188  }
189  else
190  {
191  out *= 1.0 + 16.0 * beta * M2Function(0, M);
192  }
193  }
194 
195  return out;
196  }
197 
198  double AUSM2Solver::P5Function(int A, double alpha, double M)
199  {
200  double out;
201 
202  if (fabs(M) >= 1.0)
203  {
204  out = (1.0 / M) * M1Function(A, M);
205  }
206  else
207  {
208  out = M2Function(A, M);
209 
210  if (A == 0)
211  {
212  out *= (2.0 - M) - 16.0 * alpha * M * M2Function(1, M);
213  }
214  else
215  {
216  out *= (-2.0 - M) + 16.0 * alpha * M * M2Function(0, M);
217  }
218  }
219 
220  return out;
221  }
222 }
double M2Function(int A, double M)
static RiemannSolverSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession)
Definition: AUSM2Solver.h:45
double P5Function(int A, double alpha, 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:71
static std::string solverName
Definition: AUSM2Solver.h:52
double M4Function(int A, double beta, double M)
double M1Function(int A, double M)
AUSM2Solver(const LibUtilities::SessionReaderSharedPtr &pSession)
Definition: AUSM2Solver.cpp:45
EquationOfStateSharedPtr m_eos
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:200
std::shared_ptr< SessionReader > SessionReaderSharedPtr
RiemannSolverFactory & GetRiemannSolverFactory()
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
double NekDouble