Skip to content

Commit 958302f

Browse files
committed
Merge remote-tracking branch 'origin/develop' into minor_chores
2 parents 1d50d53 + 680fb8b commit 958302f

31 files changed

Lines changed: 1364 additions & 1215 deletions

Common/include/linear_algebra/CSysMatrix.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class CSysMatrix {
111111
const int rank; /*!< \brief MPI Rank. */
112112
const int size; /*!< \brief MPI Size. */
113113

114-
enum : size_t { MAXNVAR = 8 }; /*!< \brief Maximum number of variables the matrix can handle. The static
114+
enum : size_t { MAXNVAR = 20 }; /*!< \brief Maximum number of variables the matrix can handle. The static
115115
size is needed for fast, per-thread, static memory allocation. */
116116

117117
enum { OMP_MAX_SIZE_L = 8192 }; /*!< \brief Max. chunk size used in light parallel for loops. */

Common/src/CConfig.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6457,8 +6457,8 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
64576457
break;
64586458
case EULER_IMPLICIT:
64596459
cout << "Euler implicit method for the flow equations." << endl;
6460-
if((Kind_Solver == NEMO_EULER) || (Kind_Solver == NEMO_NAVIER_STOKES))
6461-
SU2_MPI::Error("Implicit time scheme is not working with NEMO. Use EULER_EXPLICIT.", CURRENT_FUNCTION);
6460+
if (Kind_Solver == NEMO_NAVIER_STOKES)
6461+
SU2_MPI::Error("Implicit time scheme is not working with NEMO for viscous problems. Use EULER_EXPLICIT.", CURRENT_FUNCTION);
64626462
switch (Kind_Linear_Solver) {
64636463
case BCGSTAB:
64646464
case FGMRES:

SU2_CFD/include/fluid/CMutationTCLib.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class CMutationTCLib : public CNEMOGas {
7777
/*!
7878
* \brief Compute species V-E specific heats at constant volume.
7979
*/
80-
vector<su2double>& ComputeSpeciesCvVibEle() final;
80+
vector<su2double>& ComputeSpeciesCvVibEle(su2double val_T) final;
8181

8282
/*!
8383
* \brief Compute mixture energies (total internal energy and vibrational energy).
@@ -92,7 +92,9 @@ class CMutationTCLib : public CNEMOGas {
9292
/*!
9393
* \brief Compute species net production rates.
9494
*/
95-
vector<su2double>& ComputeNetProductionRates() final;
95+
vector<su2double>& ComputeNetProductionRates(bool implicit, const su2double *V, const su2double* eve,
96+
const su2double* cvve, const su2double* dTdU, const su2double* dTvedU,
97+
su2double **val_jacobian) final;
9698

9799
/*!
98100
* \brief Compute vibrational energy source term.

SU2_CFD/include/fluid/CNEMOGas.hpp

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class CNEMOGas : public CFluidModel {
7979
hs, /*!< \brief Species enthalpies */
8080
MolarFractions, /*!< \brief Species molar fractions */
8181
ws, /*!< \brief Species net production rates */
82+
taus, /*!< \brief Relaxtion time scales */
8283
DiffusionCoeff, /*!< \brief Species diffusion coefficients*/
8384
Enthalpy_Formation, /*!< \brief Enthalpy of formation */
8485
Ref_Temperature; /*!< \brief Reference temperature for thermodynamic relations */
@@ -101,6 +102,7 @@ class CNEMOGas : public CFluidModel {
101102
/*!
102103
* \brief Set mixture thermodynamic state.
103104
* \param[in] P - Pressure.
105+
* \param[in] Ms - Mass fractions of the gas.
104106
* \param[in] T - Translational/Rotational temperature.
105107
* \param[in] Tve - Vibrational/Electronic temperature.
106108
*/
@@ -114,7 +116,7 @@ class CNEMOGas : public CFluidModel {
114116
/*!
115117
* \brief Compute species V-E specific heats at constant volume.
116118
*/
117-
virtual vector<su2double>& ComputeSpeciesCvVibEle() = 0;
119+
virtual vector<su2double>& ComputeSpeciesCvVibEle(su2double val_T) = 0;
118120

119121
/*!
120122
* \brief Compute mixture energies (total internal energy and vibrational energy).
@@ -124,13 +126,29 @@ class CNEMOGas : public CFluidModel {
124126
/*!
125127
* \brief Compute species net production rates.
126128
*/
127-
virtual vector<su2double>& ComputeNetProductionRates() = 0;
129+
virtual vector<su2double>& ComputeNetProductionRates(bool implicit, const su2double *V, const su2double* eve,
130+
const su2double* cvve, const su2double* dTdU, const su2double* dTvedU,
131+
su2double **val_jacobian) = 0;
132+
133+
/*!
134+
* \brief Populate chemical source term jacobian.
135+
*/
136+
virtual void ChemistryJacobian(unsigned short iReaction, const su2double *V, const su2double* eve,
137+
const su2double* cvve, const su2double* dTdU, const su2double* dTvedU,
138+
su2double **val_jacobian){};
128139

129140
/*!
130141
* \brief Compute vibrational energy source term.
131142
*/
132143
virtual su2double ComputeEveSourceTerm() { return 0; }
133144

145+
/*!
146+
* \brief Compute vibration enery source term jacobian.
147+
*/
148+
virtual void GetEveSourceTermJacobian(const su2double *V, const su2double *eve, const su2double *cvve,
149+
const su2double *dTdU, const su2double* dTvedU,
150+
su2double **val_jacobian){};
151+
134152
/*!
135153
* \brief Compute vector of species V-E energy.
136154
*/
@@ -184,17 +202,17 @@ class CNEMOGas : public CFluidModel {
184202
/*!
185203
* \brief Compute derivative of pressure w.r.t. conservative variables.
186204
*/
187-
void ComputedPdU(su2double *V, vector<su2double>& val_eves, su2double *val_dPdU);
205+
void ComputedPdU(const su2double *V, const vector<su2double>& val_eves, su2double *val_dPdU);
188206

189207
/*!
190208
* \brief Compute derivative of temperature w.r.t. conservative variables.
191209
*/
192-
void ComputedTdU(su2double *V, su2double *val_dTdU);
210+
void ComputedTdU(const su2double *V, su2double *val_dTdU);
193211

194212
/*!
195213
* \brief Compute derivative of vibrational temperature w.r.t. conservative variables.
196214
*/
197-
void ComputedTvedU(su2double *V, vector<su2double>& val_eves, su2double *val_dTvedU);
215+
void ComputedTvedU(const su2double *V, const vector<su2double>& val_eves, su2double *val_dTvedU);
198216

199217
/*!
200218
* \brief Set the translational temperature.

SU2_CFD/include/fluid/CSU2TCLib.hpp

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class CSU2TCLib : public CNEMOGas {
5555
Tcf_b, /*!< \brief Rate controlling temperature exponent (fwd) */
5656
Tcb_a, /*!< \brief Rate controlling temperature exponent (bkw) */
5757
Tcb_b, /*!< \brief Rate controlling temperature exponent (bkw) */
58+
taus, /*!< \brief Relaxtion time scales */
5859
Diss, /*!< \brief Dissociation potential. */
5960
MassFrac_FreeStream, /*!< \brief Mixture mass fractions of the fluid. */
6061
Wall_Catalycity, /*!< \brief Specified wall species mass-fractions for catalytic boundaries. */
@@ -72,6 +73,25 @@ class CSU2TCLib : public CNEMOGas {
7273
C3DDoubleMatrix Omega00, /*!< \brief Collision integrals (Omega(0,0)) */
7374
Omega11; /*!< \brief Collision integrals (Omega(1,1)) */
7475

76+
/*--- Implicit variables ---*/
77+
su2double /*!< \brief Derivatives w.r.t. conservative variables */
78+
*dPdU, *dTdU, *dTvedU;
79+
80+
su2double fwdRxn, bkwRxn,
81+
kf,kfb,kb,
82+
coeff, eta, epsilon, T_min,
83+
Trxnf, Trxnb,
84+
Thf, Thb, dThf, dThb,
85+
theta, af, bf, ab, bb;
86+
87+
vector<su2double>
88+
dkf, dkb,
89+
dRfok, dRbok,
90+
eve, eve_eq, cvve, cvve_eq;
91+
92+
vector<int>
93+
alphak, betak;
94+
7595
public:
7696

7797
/*!
@@ -105,7 +125,7 @@ class CSU2TCLib : public CNEMOGas {
105125
/*!
106126
* \brief Compute species V-E specific heats at constant volume.
107127
*/
108-
vector<su2double>& ComputeSpeciesCvVibEle() final;
128+
vector<su2double>& ComputeSpeciesCvVibEle(su2double val_T) final;
109129

110130
/*!
111131
* \brief Compute mixture energies (total internal energy and vibrational energy).
@@ -120,13 +140,29 @@ class CSU2TCLib : public CNEMOGas {
120140
/*!
121141
* \brief Compute species net production rates.
122142
*/
123-
vector<su2double>& ComputeNetProductionRates() final;
143+
vector<su2double>& ComputeNetProductionRates(bool implicit, const su2double *V, const su2double* eve,
144+
const su2double* cvve, const su2double* dTdU, const su2double* dTvedU,
145+
su2double **val_jacobian) final;
146+
147+
/*!
148+
* \brief Compute chemical source term jacobian.
149+
*/
150+
void ChemistryJacobian(unsigned short iReaction, const su2double *V, const su2double* eve,
151+
const su2double* cvve, const su2double* dTdU, const su2double* dTvedU,
152+
su2double **val_jacobian) final;
124153

125154
/*!
126155
* \brief Compute vibrational energy source term.
127156
*/
128157
su2double ComputeEveSourceTerm() final;
129158

159+
/*!
160+
* \brief Compute relaxation source term jacobian.
161+
*/
162+
void GetEveSourceTermJacobian(const su2double *V, const su2double *eve, const su2double *cvve,
163+
const su2double *dTdU, const su2double* dTvedU,
164+
su2double **val_jacobian) final;
165+
130166
/*!
131167
* \brief Compute species enthalpies.
132168
*/

SU2_CFD/include/numerics/CNumerics.hpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,31 @@ class CNumerics {
14001400
* \param[out] val_Jacobian_i - Jacobian of the source terms
14011401
*/
14021402
inline virtual ResidualType<> ComputeChemistry(const CConfig* config) { return ResidualType<>(nullptr,nullptr,nullptr); }
1403+
1404+
/*!
1405+
* \brief Check if residual constains a NaN value
1406+
* \param[in] config - Definition of the particular problem.
1407+
* \param[in] val_residual - residual of the numeric function.
1408+
* \param[out] ERR - Presencse of NaN in vector
1409+
*/
1410+
static bool CheckResidualNaNs(bool implicit, int nVar, const ResidualType<> residual) {
1411+
1412+
bool ERR = false;
1413+
const bool jac_j = residual.jacobian_j != nullptr;
1414+
1415+
for (auto iVar = 0; iVar<nVar; iVar++){
1416+
if (std::isnan(SU2_TYPE::GetValue(residual[iVar]))) ERR = true;
1417+
1418+
if (implicit) {
1419+
for (auto jVar = 0; jVar < nVar; jVar++){
1420+
if (std::isnan(SU2_TYPE::GetValue(residual.jacobian_i[iVar][jVar]))) ERR = true;
1421+
if ((jac_j) && (std::isnan(SU2_TYPE::GetValue(residual.jacobian_j[iVar][jVar])))) ERR = true;
1422+
}
1423+
}
1424+
}
1425+
return ERR;
1426+
}
1427+
14031428
/*!
14041429
* \brief Set intermittency for numerics (used in SA with LM transition model)
14051430
*/

SU2_CFD/include/numerics/NEMO/CNEMONumerics.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,28 @@ class CNEMONumerics : public CNumerics {
4444
su2double *rhos_j, *u_j;
4545
su2double a_i, P_i, h_i;
4646
su2double a_j, P_j, h_j;
47+
su2double rho_i, rho_j;
48+
su2double e_ve_i, e_ve_j;
49+
su2double rhoCvtr_i, rhoCvtr_j;
50+
su2double rhoCvve_i, rhoCvve_j;
4751
unsigned short nPrimVar, nPrimVarGrad;
4852

4953
su2double* Flux = nullptr; /*!< \brief The flux / residual across the edge. */
54+
su2double** Jacobian_i = nullptr;
55+
su2double** Jacobian_j = nullptr;
5056

5157
unsigned short nSpecies, nHeavy, nEl; /*!< \brief Number of species present in plasma */
5258

59+
/*--- Graidents w.r.t. conservative variables. ---*/
5360
su2double *dPdU_i, *dPdU_j;
5461
su2double *dTdU_i, *dTdU_j;
5562
su2double *dTvedU_i, *dTvedU_j;
5663
su2double Gamma_i, Gamma_j;
5764

5865
vector<su2double> hs;
66+
vector<su2double> Cvtr;
5967
su2double *eve_i, *eve_j, *Cvve_i, *Cvve_j;
68+
su2double *Ys, *Ys_i, *Ys_j;
6069

6170
unsigned short RHOS_INDEX, T_INDEX, TVE_INDEX, VEL_INDEX, P_INDEX,
6271
RHO_INDEX, H_INDEX, A_INDEX, RHOCVTR_INDEX, RHOCVVE_INDEX,

SU2_CFD/include/numerics/NEMO/NEMO_diffusion.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class CAvgGrad_NEMO : public CNEMONumerics {
5454
Mean_Eddy_Viscosity, /*!< \brief Mean value of the eddy viscosity. */
5555
Mean_Thermal_Conductivity, /*!< \brief Mean value of the thermal conductivity. */
5656
Mean_Thermal_Conductivity_ve, /*!< \brief Mean value of the vib-el. thermal conductivity. */
57+
*ProjFlux, /*!< \brief Projection of the viscous fluxes. */
5758
dist_ij; /*!< \brief Length of the edge and face. */
5859

5960
public:
@@ -108,6 +109,7 @@ class CAvgGradCorrected_NEMO : public CNEMONumerics {
108109
Mean_Eddy_Viscosity, /*!< \brief Mean value of the eddy viscosity. */
109110
Mean_Thermal_Conductivity, /*!< \brief Mean value of the thermal conductivity. */
110111
Mean_Thermal_Conductivity_ve, /*!< \brief Mean value of the vib-el. thermal conductivity. */
112+
*ProjFlux, /*!< \brief Projection of the viscous fluxes. */
111113
dist_ij; /*!< \brief Length of the edge and face. */
112114
bool implicit; /*!< \brief Implicit calculus. */
113115

SU2_CFD/include/numerics/NEMO/NEMO_sources.hpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,10 @@
3939
class CSource_NEMO : public CNEMONumerics {
4040
private:
4141

42-
int *alphak, *betak;
43-
su2double *X; // Mole fraction
44-
su2double *Y, **dYdr; // Mass fraction
45-
su2double *dkf, *dkb, *dRfok, *dRbok;
46-
vector<su2double> Cvvsst, ws;
47-
48-
su2double* residual = nullptr; /*!< \brief The source residual. */
42+
su2double *Y, **dYdr; // Mass fraction
4943

44+
su2double* residual = nullptr; /*!< \brief The source residual. */
45+
su2double** jacobian = nullptr;
5046
public:
5147

5248
/*!

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,19 @@
3737
*/
3838
class CUpwAUSM_NEMO : public CNEMONumerics {
3939
private:
40-
su2double *FcL, *FcR;
41-
//su2double *FcLR;
42-
//su2double *dmLP, *dmRM, *dpLP, *dpRM;
43-
//su2double *daL, *daR;
40+
su2double *FcL, *FcR, *FcLR;
41+
su2double *dmLP, *dmRM, *dpLP, *dpRM;
42+
su2double *daL, *daR;
4443
su2double ProjVel_i, ProjVel_j;
45-
su2double sq_vel;
46-
//su2double Proj_ModJac_Tensor_ij;
4744

4845
public:
4946

5047
/*!
5148
* \brief Constructor of the class.
5249
* \param[in] val_nDim - Number of dimensions of the problem.
5350
* \param[in] val_nVar - Number of variables of the problem.
51+
* \param[in] val_nPrimVar - Number of primitive variables of the problem
52+
* \param[in] val_nPrimVarGrad - Number of grad primitive variables of the problem
5453
* \param[in] config - Definition of the particular problem.
5554
*/
5655
CUpwAUSM_NEMO(unsigned short val_nDim, unsigned short val_nVar, unsigned short val_nPrimVar, unsigned short val_nPrimVarGrad, CConfig *config);

0 commit comments

Comments
 (0)