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", AUSM2Solver::create, "AUSM2 Riemann solver");
42 
44  : CompressibleSolver(pSession)
45 {
46 }
47 
48 /**
49  * @brief AUSM2 Riemann solver
50  *
51  * @param rhoL Density left state.
52  * @param rhoR Density right state.
53  * @param rhouL x-momentum component left state.
54  * @param rhouR x-momentum component right state.
55  * @param rhovL y-momentum component left state.
56  * @param rhovR y-momentum component right state.
57  * @param rhowL z-momentum component left state.
58  * @param rhowR z-momentum component right state.
59  * @param EL Energy left state.
60  * @param ER Energy right state.
61  * @param rhof Computed Riemann flux for density.
62  * @param rhouf Computed Riemann flux for x-momentum component
63  * @param rhovf Computed Riemann flux for y-momentum component
64  * @param rhowf Computed Riemann flux for z-momentum component
65  * @param Ef Computed Riemann flux for energy.
66  */
67 void AUSM2Solver::v_PointSolve(double rhoL, double rhouL, double rhovL,
68  double rhowL, double EL, double rhoR,
69  double rhouR, double rhovR, double rhowR,
70  double ER, double &rhof, double &rhouf,
71  double &rhovf, double &rhowf, double &Ef)
72 {
73  // Left and Right velocities
74  NekDouble uL = rhouL / rhoL;
75  NekDouble vL = rhovL / rhoL;
76  NekDouble wL = rhowL / rhoL;
77  NekDouble uR = rhouR / rhoR;
78  NekDouble vR = rhovR / rhoR;
79  NekDouble wR = rhowR / rhoR;
80 
81  // Internal energy (per unit mass)
82  NekDouble eL = (EL - 0.5 * (rhouL * uL + rhovL * vL + rhowL * wL)) / rhoL;
83  NekDouble eR = (ER - 0.5 * (rhouR * uR + rhovR * vR + rhowR * wR)) / rhoR;
84  // Pressure
85  NekDouble pL = m_eos->GetPressure(rhoL, eL);
86  NekDouble pR = m_eos->GetPressure(rhoR, eR);
87  // Speed of sound
88  NekDouble cL = m_eos->GetSoundSpeed(rhoL, eL);
89  NekDouble cR = m_eos->GetSoundSpeed(rhoR, eR);
90 
91  // Average speeds of sound
92  NekDouble cA = 0.5 * (cL + cR);
93 
94  // Local Mach numbers
95  NekDouble ML = uL / cA;
96  NekDouble MR = uR / cA;
97 
98  // Parameters for specify the upwinding
99  NekDouble beta = 0.125;
100  NekDouble alpha = 0.1875;
101  NekDouble sigma = 1.0;
102  NekDouble Kp = 0.25;
103  NekDouble Ku = 0.75;
104  NekDouble Mtilde = 0.5 * (ML * ML + MR * MR);
105  NekDouble rhoA = 0.5 * (rhoL + rhoR);
106  NekDouble Mp = -Kp * ((pR - pL) / (rhoA * cA * cA)) *
107  std::max(1.0 - sigma * Mtilde, 0.0);
108 
109  NekDouble Mbar = M4Function(0, beta, ML) + M4Function(1, beta, MR) + Mp;
110 
111  NekDouble pu = -2.0 * Ku * rhoA * cA * cA * (MR - ML) *
112  P5Function(0, alpha, ML) * P5Function(1, alpha, MR);
113 
114  NekDouble pbar =
115  pL * P5Function(0, alpha, ML) + pR * P5Function(1, alpha, MR) + pu;
116 
117  if (Mbar >= 0.0)
118  {
119  rhof = cA * Mbar * rhoL;
120  rhouf = cA * Mbar * rhoL * uL + pbar;
121  rhovf = cA * Mbar * rhoL * vL;
122  rhowf = cA * Mbar * rhoL * wL;
123  Ef = cA * Mbar * (EL + pL);
124  }
125  else
126  {
127  rhof = cA * Mbar * rhoR;
128  rhouf = cA * Mbar * rhoR * uR + pbar;
129  rhovf = cA * Mbar * rhoR * vR;
130  rhowf = cA * Mbar * rhoR * wR;
131  Ef = cA * Mbar * (ER + pR);
132  }
133 }
134 
135 double AUSM2Solver::M1Function(int A, double M)
136 {
137  double out;
138 
139  if (A == 0)
140  {
141  out = 0.5 * (M + fabs(M));
142  }
143  else
144  {
145  out = 0.5 * (M - fabs(M));
146  }
147 
148  return out;
149 }
150 
151 double AUSM2Solver::M2Function(int A, double M)
152 {
153  double out;
154 
155  if (A == 0)
156  {
157  out = 0.25 * (M + 1.0) * (M + 1.0);
158  }
159  else
160  {
161  out = -0.25 * (M - 1.0) * (M - 1.0);
162  }
163 
164  return out;
165 }
166 
167 double AUSM2Solver::M4Function(int A, double beta, double M)
168 {
169  double out;
170 
171  if (fabs(M) >= 1.0)
172  {
173  out = M1Function(A, M);
174  }
175  else
176  {
177  out = M2Function(A, M);
178 
179  if (A == 0)
180  {
181  out *= 1.0 - 16.0 * beta * M2Function(1, M);
182  }
183  else
184  {
185  out *= 1.0 + 16.0 * beta * M2Function(0, M);
186  }
187  }
188 
189  return out;
190 }
191 
192 double AUSM2Solver::P5Function(int A, double alpha, double M)
193 {
194  double out;
195 
196  if (fabs(M) >= 1.0)
197  {
198  out = (1.0 / M) * M1Function(A, M);
199  }
200  else
201  {
202  out = M2Function(A, M);
203 
204  if (A == 0)
205  {
206  out *= (2.0 - M) - 16.0 * alpha * M * M2Function(1, M);
207  }
208  else
209  {
210  out *= (-2.0 - M) + 16.0 * alpha * M * M2Function(0, M);
211  }
212  }
213 
214  return out;
215 }
216 } // namespace Nektar
double M2Function(int A, double M)
static RiemannSolverSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession)
Definition: AUSM2Solver.h:45
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) override
AUSM2 Riemann solver.
Definition: AUSM2Solver.cpp:67
double P5Function(int A, double alpha, double M)
static std::string solverName
Definition: AUSM2Solver.h:51
double M4Function(int A, double beta, double M)
double M1Function(int A, double M)
AUSM2Solver(const LibUtilities::SessionReaderSharedPtr &pSession)
Definition: AUSM2Solver.cpp:43
EquationOfStateSharedPtr m_eos
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:198
std::shared_ptr< SessionReader > SessionReaderSharedPtr
@ beta
Gauss Radau pinned at x=-1,.
Definition: PointsType.h:61
RiemannSolverFactory & GetRiemannSolverFactory()
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble