Skip to content

Commit 1f1e6e3

Browse files
authored
Merge pull request #1139 from su2code/feature_NEMO_primitive_limiter
NEMO - transition to primitive limiter
2 parents d4da6ed + 29de261 commit 1f1e6e3

21 files changed

Lines changed: 604 additions & 542 deletions

SU2_CFD/include/numerics/NEMO/NEMO_diffusion.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* \brief Class for computing viscous term using the average of gradients.
3535
* \ingroup ViscDiscr
3636
* \author S.R. Copeland, W. Maier, C. Garbacz
37-
* \version 7.0.6 "falcon"
37+
* \version 7.0.8 "Blackbird"
3838
*/
3939
class CAvgGrad_NEMO : public CNEMONumerics {
4040
private:

SU2_CFD/include/numerics/NEMO/convection/ausm.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,17 @@
3434
* \brief Class for solving an approximate Riemann AUSM.
3535
* \ingroup ConvDiscr
3636
* \author F. Palacios, S.R. Copeland, W. Maier, C. Garbacz
37-
* \version 7.0.6 'Falcon'
37+
* \version 7.0.8 'Blackbird'
3838
*/
3939
class CUpwAUSM_NEMO : public CNEMONumerics {
4040
private:
41-
su2double *FcL, *FcR, *FcLR;
42-
su2double *dmLP, *dmRM, *dpLP, *dpRM;
43-
su2double *daL, *daR;
41+
su2double *FcL, *FcR;
42+
//su2double *FcLR;
43+
//su2double *dmLP, *dmRM, *dpLP, *dpRM;
44+
//su2double *daL, *daR;
4445
su2double ProjVel_i, ProjVel_j;
45-
su2double sq_vel, Proj_ModJac_Tensor_ij;
46+
su2double sq_vel;
47+
//su2double Proj_ModJac_Tensor_ij;
4648

4749
public:
4850

@@ -64,4 +66,4 @@ class CUpwAUSM_NEMO : public CNEMONumerics {
6466
* \param[in] config - Definition of the particular problem.
6567
*/
6668
ResidualType<> ComputeResidual(const CConfig* config) final;
67-
};
69+
};

SU2_CFD/include/numerics/NEMO/convection/ausmplusup2.hpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,14 @@
3838
class CUpwAUSMPLUSUP2_NEMO : public CNEMONumerics {
3939
private:
4040
su2double *FcL, *FcR, *FcLR;
41-
su2double *dmLP, *dmRM, *dpLP, *dpRM;
42-
su2double *daL, *daR;
41+
//su2double *dmLP, *dmRM, *dpLP, *dpRM;
42+
//su2double *daL, *daR;
4343
su2double ProjVel_i, ProjVel_j;
44-
su2double sq_vel, Proj_ModJac_Tensor_ij;
4544
su2double mL, mR, mLP, mRM, mF, pLP, pRM, pFi, pF, Phi;
4645
su2double CstarL, CstarR, ChatL, ChatR, aF, rhoF, MFsq, Mrefsq, Mp, fa;
4746
su2double Kp, sigma, alpha, beta, param1, mfP, mfM;
4847
su2double rhoCvtr_i, rhoCvtr_j, rhoCvve_i, rhoCvve_j;
4948

50-
/*--- Roe Only ---*/
51-
su2double *Diff_U;
52-
su2double *RoeU, *RoeV, *RoeEve;
53-
su2double *ProjFlux_i, *ProjFlux_j;
54-
su2double *Lambda, *Epsilon;
55-
su2double **P_Tensor, **invP_Tensor;
56-
su2double RoeSoundSpeed;
57-
su2double ProjVelocity, ProjVelocity_i, ProjVelocity_j;
58-
su2double R;
59-
su2double *RoedPdU;
60-
6149
public:
6250

6351
/*!

SU2_CFD/include/numerics/NEMO/convection/lax.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,18 @@
3434
* \brief Class for computing the Lax-Friedrich centered scheme.
3535
* \ingroup ConvDiscr
3636
* \author F. Palacios, S.R. Copeland, W. Maier, C. Garbacz
37-
* \version 2.0.6
37+
* \version 7.0.8
3838
*/
3939
class CCentLax_NEMO : public CNEMONumerics {
4040
private:
41-
unsigned short iDim, iVar, jVar; /*!< \brief Iteration on dimension and variables. */
41+
unsigned short iDim, iVar; /*!< \brief Iteration on dimension and variables. */
4242
su2double *Diff_U; /*!< \brief Difference of conservative variables. */
4343
su2double *MeanU, *MeanV;
44-
vector<su2double> mean_eves;
45-
su2double *MeandPdU;
4644
su2double *ProjFlux; /*!< \brief Projected inviscid flux tensor. */
4745
su2double Param_p, Param_Kappa_0; /*!< \brief Artificial dissipation parameters. */
4846
su2double Local_Lambda_i, Local_Lambda_j, MeanLambda; /*!< \brief Local eigenvalues. */
4947
su2double Phi_i, Phi_j, sc0, StretchingFactor; /*!< \brief Streching parameters. */
50-
su2double Epsilon_0, cte; /*!< \brief Artificial dissipation values. */
51-
bool stretching;
48+
su2double Epsilon_0; /*!< \brief Artificial dissipation values. */
5249

5350
public:
5451

SU2_CFD/include/solvers/CNEMOEulerSolver.hpp

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ class CNEMOEulerSolver : public CFVMFlowSolverBase<CNEMOEulerVariable, COMPRESSI
5656

5757
unsigned long ErrorCounter = 0; /*!< \brief Counter for number of un-physical states. */
5858

59+
su2double Global_Delta_Time = 0.0, /*!< \brief Time-step for TIME_STEPPING time marching strategy. */
60+
Global_Delta_UnstTimeND = 0.0; /*!< \brief Unsteady time step for the dual time strategy. */
61+
5962
CNEMOGas *FluidModel; /*!< \brief fluid model used in the solver */
6063

6164
CNEMOEulerVariable* node_infty = nullptr;
@@ -75,30 +78,27 @@ class CNEMOEulerSolver : public CFVMFlowSolverBase<CNEMOEulerVariable, COMPRESSI
7578
CNEMOEulerSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh, const bool navier_stokes = false);
7679

7780
/*!
78-
* \brief Destructor of the class.
79-
*/
81+
* \brief Destructor of the class.
82+
*/
8083
~CNEMOEulerSolver(void) override;
8184

8285
/*!
83-
* \brief Set the maximum value of the eigenvalue.
84-
* \param[in] geometry - Geometrical definition of the problem.
85-
* \param[in] config - Definition of the particular problem.
86-
*/
86+
* \brief Set the maximum value of the eigenvalue.
87+
* \param[in] geometry - Geometrical definition of the problem.
88+
* \param[in] config - Definition of the particular problem.
89+
*/
8790
void SetMax_Eigenvalue(CGeometry *geometry, CConfig *config);
8891

89-
/*!
90-
* \brief Compute the time step for solving the Euler equations.
91-
* \param[in] geometry - Geometrical definition of the problem.
92-
* \param[in] solver_container - Container vector with all the solutions.
93-
* \param[in] config - Definition of the particular problem.
94-
* \param[in] iMesh - Index of the mesh in multigrid computations.
95-
* \param[in] Iteration - Value of the current iteration.
96-
*/
97-
void SetTime_Step(CGeometry *geometry,
98-
CSolver **solver_container,
99-
CConfig *config,
100-
unsigned short iMesh,
101-
unsigned long Iteration) final;
92+
/*!
93+
* \brief Compute the time step for solving the Euler equations.
94+
* \param[in] geometry - Geometrical definition of the problem.
95+
* \param[in] solver_container - Container vector with all the solutions.
96+
* \param[in] config - Definition of the particular problem.
97+
* \param[in] iMesh - Index of the mesh in multigrid computations.
98+
* \param[in] Iteration - Value of the current iteration.
99+
*/
100+
void SetTime_Step(CGeometry *geometry, CSolver **solver_container,
101+
CConfig *config, unsigned short iMesh, unsigned long Iteration) final;
102102

103103
/*!
104104
* \brief Set the initial condition for the Euler Equations.
@@ -138,12 +138,21 @@ class CNEMOEulerSolver : public CFVMFlowSolverBase<CNEMOEulerVariable, COMPRESSI
138138
* \param[in] config - Definition of the particular problem.
139139
* \param[in] iMesh - Index of the mesh in multigrid computations.
140140
*/
141-
void Upwind_Residual(CGeometry *geometry,
142-
CSolver **solver_container,
143-
CNumerics **numerics_container,
144-
CConfig *config,
145-
unsigned short iMesh) final;
141+
void Upwind_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container,
142+
CConfig *config, unsigned short iMesh) final;
146143

144+
/*!
145+
* \brief Recompute the extrapolated quantities, after MUSCL reconstruction,
146+
* in a more thermodynamically consistent way.
147+
* \param[in] V - primitve variables.
148+
* \param[out] d*dU - reconstructed secondaryvariables.
149+
* \param[out] val_eves - reconstructed eve per species.
150+
* \param[out] val_cvves - reconstructed cvve per species.
151+
* \param[out] Gamma - reconstructed gamma.
152+
*/
153+
static su2double ComputeConsistentExtrapolation(CNEMOGas *fluidmodel, unsigned short nSpecies, su2double *V,
154+
su2double* dPdU, su2double* dTdU, su2double* dTvedU,
155+
su2double* val_eves, su2double* val_cvves);
147156
/*!
148157
* \brief Source term integration.
149158
* \param[in] geometry - Geometrical definition of the problem.
@@ -153,11 +162,8 @@ class CNEMOEulerSolver : public CFVMFlowSolverBase<CNEMOEulerVariable, COMPRESSI
153162
* \param[in] config - Definition of the particular problem.
154163
* \param[in] iMesh - Index of the mesh in multigrid computations.
155164
*/
156-
void Source_Residual(CGeometry *geometry,
157-
CSolver **solver_container,
158-
CNumerics **numerics_container,
159-
CConfig *config,
160-
unsigned short iMesh) final;
165+
void Source_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container,
166+
CConfig *config, unsigned short iMesh) final;
161167

162168
/*!
163169
* \brief Preprocessing actions common to the Euler and NS solvers.
@@ -199,6 +205,23 @@ class CNEMOEulerSolver : public CFVMFlowSolverBase<CNEMOEulerVariable, COMPRESSI
199205
*/
200206
void SetNondimensionalization(CConfig *config, unsigned short iMesh) final;
201207

208+
/*!
209+
* \brief Set all the conserved variables from the primitive vector..
210+
*/
211+
void RecomputeConservativeVector(su2double *U, const su2double *V) const;
212+
213+
/*!
214+
* \brief Check for unphysical points.
215+
* \return Boolean value of physical point
216+
*/
217+
bool CheckNonPhys(const su2double *V) const;
218+
219+
/*!
220+
* \brief Compute the pressure at the infinity.
221+
* \return Value of the pressure at the infinity.
222+
*/
223+
inline CNEMOGas* GetFluidModel(void) const final { return FluidModel;}
224+
202225
/*!
203226
* \brief Impose the far-field boundary condition using characteristics.
204227
* \param[in] geometry - Geometrical definition of the problem.

SU2_CFD/include/solvers/CNEMONSSolver.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
* \brief Main class for defining the NEMO Navier-Stokes flow solver.
3939
* \ingroup Navier_Stokes_Equations
4040
* \author S. R. Copeland, F. Palacios, W. Maier.
41-
* \version 6.1
41+
* \version 7.0.8
42+
*
4243
*/
4344
class CNEMONSSolver final : public CNEMOEulerSolver {
4445
private:

SU2_CFD/include/variables/CNEMOEulerVariable.hpp

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* \brief Main class for defining the variables of the NEMO Euler's solver.
3636
* \ingroup Euler_Equations
3737
* \author S. R. Copeland, F. Palacios, W. Maier, C. Garbacz
38-
* \version 7.0.6
38+
* \version 7.0.8
3939
*/
4040
class CNEMOEulerVariable : public CVariable {
4141
public:
@@ -157,12 +157,29 @@ class CNEMOEulerVariable : public CVariable {
157157
* \brief Get the primitive variables limiter.
158158
* \return Primitive variables limiter for the entire domain.
159159
*/
160-
inline MatrixType& GetLimiter_Primitive(void) {
160+
inline MatrixType& GetLimiter_Primitive(void) {return Limiter_Primitive; }
161161

162-
SU2_MPI::Error(string("Limiters (associated to MUSCL) are computed for conserved variables in the NEMO solver.") +
163-
string("Limiters for primitive variables are not allocated/computed."),
164-
CURRENT_FUNCTION);
165-
return Primitive;
162+
/*!
163+
* \brief Set the gradient of the primitive variables.
164+
* \param[in] iVar - Index of the variable.
165+
* \param[in] iDim - Index of the dimension.
166+
* \param[in] value - Value of the gradient.
167+
*/
168+
inline su2double GetLimiter_Primitive(unsigned long iPoint, unsigned long iVar) const final {return Limiter_Primitive(iPoint,iVar); }
169+
170+
/*!
171+
* \brief Get the value of the primitive variables gradient.
172+
* \return Value of the primitive variables gradient.
173+
*/
174+
inline su2double *GetLimiter_Primitive(unsigned long iPoint) final { return Limiter_Primitive[iPoint]; }
175+
176+
/*!
177+
* \brief Set the gradient of the primitive variables.
178+
* \param[in] iVar - Index of the variable.
179+
* \param[in] value - Value of the gradient.
180+
*/
181+
inline void SetLimiter_Primitive(unsigned long iPoint, unsigned long iVar, su2double value) final {
182+
Limiter_Primitive(iPoint,iVar) = value;
166183
}
167184

168185
/*!
@@ -332,21 +349,13 @@ class CNEMOEulerVariable : public CVariable {
332349
*/
333350
bool SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel) override;
334351

335-
/*!
336-
* \brief Set all the conserved variables.
352+
/*!
353+
* \brief Set all the primitive and secondary variables from the conserved vector.
337354
*/
338355
bool Cons2PrimVar(su2double *U, su2double *V, su2double *dPdU,
339356
su2double *dTdU, su2double *dTvedU, su2double *val_eves,
340357
su2double *val_Cvves);
341358

342-
/*!
343-
* \brief Check for unphysical points.
344-
* \return Boolean value of physical point
345-
*/
346-
bool CheckNonPhys(su2double *U, su2double *V, su2double *dPdU,
347-
su2double *dTdU, su2double *dTvedU, su2double *val_eves,
348-
su2double *val_Cvves);
349-
350359
/*---------------------------------------*/
351360
/*--- Specific variable routines ---*/
352361
/*---------------------------------------*/

SU2_CFD/include/variables/CNEMONSVariable.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* \brief Main class for defining the variables of the NEMO Navier-Stokes' solver.
3535
* \ingroup Navier_Stokes_Equations
3636
* \author C. Garbacz, W. Maier, S.R. Copeland.
37-
* \version 7.0.6
37+
* \version 7.0.8
3838
*/
3939
class CNEMONSVariable final : public CNEMOEulerVariable {
4040
private:

SU2_CFD/include/variables/CVariable.hpp

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,16 +1426,6 @@ class CVariable {
14261426
*/
14271427
inline virtual void SetSecondaryVar(unsigned long iPoint, CFluidModel *FluidModel) {}
14281428

1429-
/*!
1430-
* \brief A virtual member.
1431-
*/
1432-
inline virtual bool Cons2PrimVar(CConfig *config, unsigned long iPoint, su2double *U, su2double *V, su2double *dPdU,
1433-
su2double *dTdU, su2double *dTvedU) { return false; }
1434-
/*!
1435-
* \brief A virtual member.
1436-
*/
1437-
inline virtual void Prim2ConsVar(CConfig *config, unsigned long iPoint, su2double *V, su2double *U) { }
1438-
14391429
/*!
14401430
* \brief A virtual member.
14411431
*/
@@ -1590,45 +1580,6 @@ class CVariable {
15901580
*/
15911581
inline virtual bool SetPressure(unsigned long iPoint, su2double Gamma, su2double turb_ke) { return false; }
15921582

1593-
/*!
1594-
* \brief Calculates vib.-el. energy per mass, \f$e^{vib-el}_s\f$, for input species (not including KE)
1595-
*/
1596-
inline virtual su2double CalcEve(unsigned long iPoint, su2double *V, CConfig *config, unsigned long val_Species) { return 0.0; }
1597-
1598-
/*!
1599-
* \brief Calculates enthalpy per mass, \f$h_s\f$, for input species (not including KE)
1600-
*/
1601-
inline virtual su2double CalcHs(unsigned long iPoint, su2double *V, CConfig *config, unsigned long val_Species) { return 0.0; }
1602-
1603-
/*!
1604-
* \brief Calculates enthalpy per mass, \f$Cv_s\f$, for input species (not including KE)
1605-
*/
1606-
inline virtual su2double CalcCvve(unsigned long iPoint, su2double val_Tve, CConfig *config, unsigned long val_Species) { return 0.0; }
1607-
1608-
/*!
1609-
* \brief A virtual member.
1610-
* \param[in] V
1611-
* \param[in] config - Configuration settings
1612-
* \param[in] dPdU
1613-
*/
1614-
inline virtual void CalcdPdU(unsigned long iPoint, su2double *V, CConfig *config, su2double *dPdU) {}
1615-
1616-
/*!
1617-
* \brief Set partial derivative of temperature w.r.t. density \f$\frac{\partial P}{\partial \rho_s}\f$
1618-
* \param[in] V
1619-
* \param[in] config - Configuration settings
1620-
* \param[in] dTdU
1621-
*/
1622-
inline virtual void CalcdTdU(unsigned long iPoint, su2double *V, CConfig *config, su2double *dTdU) {}
1623-
1624-
/*!
1625-
* \brief Set partial derivative of temperature w.r.t. density \f$\frac{\partial P}{\partial \rho_s}\f$
1626-
* \param[in] V
1627-
* \param[in] config - Configuration settings
1628-
* \param[in] dTdU
1629-
*/
1630-
inline virtual void CalcdTvedU(unsigned long iPoint, su2double *V, CConfig *config, su2double *dTdU) {}
1631-
16321583
/*!
16331584
* \brief A virtual member.
16341585
*/

SU2_CFD/src/fluid/CNEMOGas.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ void CNEMOGas::ComputedPdU(su2double *V, vector<su2double>& val_eves, su2double
176176

177177
/*--- Necessary indexes to assess primitive variables ---*/
178178
unsigned long RHOS_INDEX = 0;
179+
unsigned long T_INDEX = nSpecies;
179180
unsigned long VEL_INDEX = nSpecies+2;
180181
unsigned long RHOCVTR_INDEX = nSpecies+nDim+6;
181182
unsigned long RHOCVVE_INDEX = nSpecies+nDim+7;
@@ -191,6 +192,7 @@ void CNEMOGas::ComputedPdU(su2double *V, vector<su2double>& val_eves, su2double
191192
/*--- Rename for convenience ---*/
192193
rhoCvtr = V[RHOCVTR_INDEX];
193194
rhoCvve = V[RHOCVVE_INDEX];
195+
T = V[T_INDEX];
194196

195197
/*--- Pre-compute useful quantities ---*/
196198
CvtrBAR = 0.0;
@@ -249,10 +251,12 @@ void CNEMOGas::ComputedTdU(su2double *V, su2double *val_dTdU){
249251
su2double Vel[3] = {0.0};
250252

251253
/*--- Necessary indexes to assess primitive variables ---*/
254+
unsigned long T_INDEX = nSpecies;
252255
unsigned long VEL_INDEX = nSpecies+2;
253256
unsigned long RHOCVTR_INDEX = nSpecies+nDim+6;
254257

255258
/*--- Rename for convenience ---*/
259+
T = V[T_INDEX];
256260
rhoCvtr = V[RHOCVTR_INDEX];
257261

258262
Cvtrs = GetSpeciesCvTraRot();

0 commit comments

Comments
 (0)