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