Nektar++
AUSM1Solver.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: AUSM1Solver.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: AUSM1 Riemann solver.
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
36 
37 namespace Nektar
38 {
39  std::string AUSM1Solver::solverName =
41  "AUSM1",
43  "AUSM1 Riemann solver");
44 
47  : CompressibleSolver(pSession)
48  {
49 
50  }
51 
52  /**
53  * @brief AUSM1 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 Mbar = M4Function(0, beta, ML) + M4Function(1, beta, MR);
107  NekDouble pbar = pL * P5Function(0, alpha, ML) +
108  pR * P5Function(1, alpha, MR);
109 
110  if (Mbar >= 0.0)
111  {
112  rhof = cA * Mbar * rhoL;
113  rhouf = cA * Mbar * rhoL * uL + pbar;
114  rhovf = cA * Mbar * rhoL * vL;
115  rhowf = cA * Mbar * rhoL * wL;
116  Ef = cA * Mbar * (EL + pL);
117  }
118  else
119  {
120  rhof = cA * Mbar * rhoR;
121  rhouf = cA * Mbar * rhoR * uR + pbar;
122  rhovf = cA * Mbar * rhoR * vR;
123  rhowf = cA * Mbar * rhoR * wR;
124  Ef = cA * Mbar * (ER + pR);
125  }
126  }
127 
128  double AUSM1Solver::M1Function(int A, double M)
129  {
130  double out;
131 
132  if (A == 0)
133  {
134  out = 0.5 * (M + fabs(M));
135  }
136  else
137  {
138  out = 0.5 * (M - fabs(M));
139  }
140 
141  return out;
142  }
143 
144  double AUSM1Solver::M2Function(int A, double M)
145  {
146  double out;
147 
148  if (A == 0)
149  {
150  out = 0.25 * (M + 1.0) * (M + 1.0);
151  }
152  else
153  {
154  out = -0.25 * (M - 1.0) * (M - 1.0);
155  }
156 
157  return out;
158  }
159 
160  double AUSM1Solver::M4Function(int A, double beta, double M)
161  {
162  double out;
163 
164  if (fabs(M) >= 1.0)
165  {
166  out = M1Function(A, M);
167  }
168  else
169  {
170  out = M2Function(A, M);
171 
172  if (A == 0)
173  {
174  out *= 1.0 - 16.0 * beta * M2Function(1, M);
175  }
176  else
177  {
178  out *= 1.0 + 16.0 * beta * M2Function(0, M);
179  }
180  }
181 
182  return out;
183  }
184 
185  double AUSM1Solver::P5Function(int A, double alpha, double M)
186  {
187  double out;
188 
189  if (fabs(M) >= 1.0)
190  {
191  out = (1.0 / M) * M1Function(A, M);
192  }
193  else
194  {
195  out = M2Function(A, M);
196 
197  if (A == 0)
198  {
199  out *= (2.0 - M) - 16.0 * alpha * M * M2Function(1, M);
200  }
201  else
202  {
203  out *= (-2.0 - M) + 16.0 * alpha * M * M2Function(0, M);
204  }
205  }
206 
207  return out;
208  }
209 }
static std::string solverName
Definition: AUSM1Solver.h:52
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)
AUSM1 Riemann solver.
Definition: AUSM1Solver.cpp:71
double P5Function(int A, double alpha, double M)
double M1Function(int A, double M)
static RiemannSolverSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession)
Definition: AUSM1Solver.h:45
double M2Function(int A, double M)
AUSM1Solver(const LibUtilities::SessionReaderSharedPtr &pSession)
Definition: AUSM1Solver.cpp:45
double M4Function(int A, double beta, double M)
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