Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2047109
fixe scalar restart, update psi case
bigfooted Dec 22, 2025
348dee9
reduce y+ warning
bigfooted Dec 22, 2025
1a600ed
Update SU2_CFD/src/solvers/CTurbSolver.cpp
bigfooted Dec 22, 2025
080ce79
Merge branch 'fix_restart_scalars' of https://github.com/su2code/su2 …
bigfooted Dec 22, 2025
5a0a2f6
fix weakly coupled heat restart
bigfooted Dec 22, 2025
5ba6371
Apply suggestion from @bigfooted
bigfooted Dec 22, 2025
03b9484
Apply suggestion from @bigfooted
bigfooted Dec 22, 2025
43af712
remove unused var
bigfooted Dec 22, 2025
21bbaa5
Merge branch 'fix_restart_scalars' of https://github.com/su2code/su2 …
bigfooted Dec 22, 2025
ae9d43f
fix mass diffusivity MPI bug
bigfooted Dec 22, 2025
3ac3d64
use enthalpy for computing temperature also when energy is off
bigfooted Dec 23, 2025
0e0d08a
fix sensible enthalpy
bigfooted Dec 23, 2025
8f55465
remove temperatureInc
bigfooted Dec 23, 2025
b3f60e1
Merge branch 'develop' into fix_restart_scalars
bigfooted Dec 23, 2025
b64c12d
remove unused variable
bigfooted Dec 23, 2025
90ad903
Merge branch 'develop' into fix_restart_scalars
bigfooted Dec 24, 2025
9a3fd9e
change viscosity call
bigfooted Dec 24, 2025
99da494
Merge branch 'fix_restart_scalars' of https://github.com/su2code/su2 …
bigfooted Dec 24, 2025
1c3b778
Merge branch 'develop' into fix_restart_scalars
bigfooted Dec 25, 2025
894536c
Merge branch 'develop' into fix_restart_scalars
bigfooted Dec 27, 2025
ef55690
fix some regression
bigfooted Dec 27, 2025
eaf54d6
fix some regression
bigfooted Dec 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,6 @@ class CConfig {
Initial_BCThrust, /*!< \brief Ratio of turbulent to laminar viscosity at the actuator disk. */
Pressure_FreeStream, /*!< \brief Total pressure of the fluid. */
Pressure_Thermodynamic, /*!< \brief Thermodynamic pressure of the fluid. */
Standard_Ref_Temperature, /*!< \brief Standard reference temperature for multicomponent flows. */
Temperature_FreeStream, /*!< \brief Total temperature of the fluid. */
Temperature_ve_FreeStream; /*!< \brief Total vibrational-electronic temperature of the fluid. */
unsigned short wallModel_MaxIter; /*!< \brief maximum number of iterations for the Newton method for the wall model */
Expand Down Expand Up @@ -1960,12 +1959,6 @@ class CConfig {
*/
su2double GetPressure_Thermodynamic(void) const { return Pressure_Thermodynamic; }

/*!
* \brief Get the value of the standard reference temperature for multicomponent flows.
* \return Standard reference temperature, Non-dimensionalized if it is needed for Non-Dimensional problems.
*/
su2double GetStandard_RefTemperatureND(void) const { return Standard_Ref_Temperature / Temperature_Ref; }

/*!
* \brief Get the value of the non-dimensionalized thermodynamic pressure.
* \return Non-dimensionalized thermodynamic pressure.
Expand Down
2 changes: 1 addition & 1 deletion Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const su2double UNIVERSAL_GAS_CONSTANT = 8.3144598; /*!< \brief Universal gas
const su2double BOLTZMANN_CONSTANT = 1.3806503E-23; /*!< \brief Boltzmann's constant [J K^-1] */
const su2double AVOGAD_CONSTANT = 6.0221415E26; /*!< \brief Avogadro's constant, number of particles in one kmole. */
const su2double FUND_ELEC_CHARGE_CGS = 4.8032047E-10; /*!< \brief Fundamental electric charge in CGS units, cm^(3/2) g^(1/2) s^(-1). */

const su2double STD_REF_TEMP = 298.15; /*!< \brief Standard reference temperature for enthalpy in Kelvin. */
const su2double EPS = 1.0E-16; /*!< \brief Error scale. */
const su2double TURB_EPS = 1.0E-16; /*!< \brief Turbulent Error scale. */

Expand Down
3 changes: 0 additions & 3 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1229,9 +1229,6 @@ void CConfig::SetConfig_Options() {
addDoubleOption("GAMMA_VALUE", Gamma, 1.4);
/*!\brief THERMODYNAMIC_PRESSURE \n DESCRIPTION: Thermodynamics(operating) Pressure (101325 Pa), only for incompressible flows) \ingroup Config*/
addDoubleOption("THERMODYNAMIC_PRESSURE", Pressure_Thermodynamic, 101325.0);
/*!\brief STANDARD_REFERENCE_TEMPERATURE \n DESCRIPTION: Standard reference temperature (298.15K), only for
* multicomponent incompressible flows) \ingroup Config*/
addDoubleOption("STANDARD_REFERENCE_TEMPERATURE", Standard_Ref_Temperature, 298.15);
/*!\brief CP_VALUE \n DESCRIPTION: Specific heat at constant pressure, Cp (1004.703 J/kg*K (air), constant density incompressible fluids only) \ingroup Config*/
addDoubleListOption("SPECIFIC_HEAT_CP", nSpecific_Heat_Cp, Specific_Heat_Cp);
/*!\brief THERMAL_EXPANSION_COEFF \n DESCRIPTION: Thermal expansion coefficient (0.00347 K^-1 (air), used for Boussinesq approximation for liquids/non-ideal gases) \ingroup Config*/
Expand Down
6 changes: 3 additions & 3 deletions SU2_CFD/include/fluid/CConstantDensity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ class CConstantDensity final : public CFluidModel {
decoupled equation. Hence, we update the value.
Note Cp = Cv, (gamma = 1).*/
Temperature = t;
Enthalpy = Cp * Temperature;
Enthalpy = Cp * (Temperature - STD_REF_TEMP); // Sensible enthalpy relative to STD_REF_TEMP
}

/*!
* \brief Set the Dimensionless State using Enthalpy.
* \param[in] val_enthalpy - Enthalpy value at the point.
* \param[in] val_scalars - not used here.
* \param[in] val_scalars - not used here.
*/
void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) override {
Enthalpy = val_enthalpy;
Temperature = Enthalpy / Cp;
Temperature = Enthalpy / Cp + STD_REF_TEMP; // Temperature from sensible enthalpy
}
};
3 changes: 1 addition & 2 deletions SU2_CFD/include/fluid/CFluidScalar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class CFluidScalar final : public CFluidModel {
const int n_species_mixture; /*!< \brief Number of species in mixture. */
su2double Gas_Constant; /*!< \brief Specific gas constant. */
const su2double Pressure_Thermodynamic; /*!< \brief Constant pressure thermodynamic. */
const su2double Ref_Temperature; /*!< \brief Standard Reference temperature, usually set to 298.15 K. */
const su2double GasConstant_Ref; /*!< \brief Gas constant reference needed for Nondimensional problems. */
const su2double Prandtl_Turb_Number; /*!< \brief Prandlt turbulent number.*/
const su2double Schmidt_Turb_Number; /*!< \brief Schmidt turbulent number.*/
Expand Down Expand Up @@ -177,7 +176,7 @@ class CFluidScalar final : public CFluidModel {
/*!
* \brief Virtual member.
* \param[in] val_enthalpy - Enthalpy value at the point.
* \param[in] val_scalars - Scalar mass fractions.
* \param[in] val_scalars - Scalar mass fractions.
*/
void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) override;
};
4 changes: 2 additions & 2 deletions SU2_CFD/include/fluid/CIncIdealGas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class CIncIdealGas final : public CFluidModel {
/*--- The EoS only depends upon temperature. ---*/
Temperature = t;
Density = Pressure / (Temperature * Gas_Constant);
Enthalpy = Cp * Temperature;
Enthalpy = Cp * (Temperature - STD_REF_TEMP); // Sensible enthalpy relative to REF_TEMP
}

/*!
Expand All @@ -67,7 +67,7 @@ class CIncIdealGas final : public CFluidModel {
*/
void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) override {
Enthalpy = val_enthalpy;
Temperature = Enthalpy / Cp;
Temperature = Enthalpy / Cp + STD_REF_TEMP; // Temperature from sensible enthalpy
Density = Pressure / (Temperature * Gas_Constant);
}

Expand Down
3 changes: 1 addition & 2 deletions SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ class CIncIdealGasPolynomial final : public CFluidModel {
* \param[in] config - configuration container for the problem.
*/
void SetCpModel(const CConfig* config) override {
const su2double t_ref = config->GetStandard_RefTemperatureND();
Enthalpy_Ref = 0.0;
su2double t_i = 1.0;
for (int i = 0; i < N; ++i) {
t_i *= t_ref;
t_i *= STD_REF_TEMP;
coeffs_[i] = config->GetCp_PolyCoeffND(i);
Enthalpy_Ref += coeffs_[i] * t_i / (i + 1);
}
Expand Down
1 change: 0 additions & 1 deletion SU2_CFD/include/variables/CIncEulerVariable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class CIncEulerVariable : public CFlowVariable {
VectorType Streamwise_Periodic_RecoveredPressure, /*!< \brief Recovered/Physical pressure [Pa] for streamwise periodic flow. */
Streamwise_Periodic_RecoveredTemperature; /*!< \brief Recovered/Physical temperature [K] for streamwise periodic flow. */
su2double TemperatureLimits[2]; /*!< \brief Temperature limits [K]. */
su2double TemperatureInc = 0.0; /*!< \brief Temperature [K] imposed when energy equation is switch off. */
public:
/*!
* \brief Constructor of the class.
Expand Down
10 changes: 5 additions & 5 deletions SU2_CFD/src/fluid/CFluidScalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ CFluidScalar::CFluidScalar(su2double value_pressure_operating, const CConfig* co
: CFluidModel(),
n_species_mixture(config->GetnSpecies() + 1),
Pressure_Thermodynamic(value_pressure_operating),
Ref_Temperature(config->GetStandard_RefTemperatureND()),
GasConstant_Ref(config->GetGas_Constant_Ref()),
Prandtl_Turb_Number(config->GetPrandtl_Turb()),
Schmidt_Turb_Number(config->GetSchmidt_Number_Turbulent()),
Expand Down Expand Up @@ -219,14 +218,14 @@ su2double CFluidScalar::ComputeEnthalpyFromT(const su2double val_temperature, co
* depend on temperature, but it does depend on mixture composition, enthalpy is directly computed from
* the expression h_s = Cp(T - T_ref).
*/
su2double val_Enthalpy = Cp * (val_temperature - Ref_Temperature);
su2double val_Enthalpy = Cp * (val_temperature - STD_REF_TEMP);
return val_Enthalpy;
}

void CFluidScalar::GetEnthalpyDiffusivity(su2double* enthalpy_diffusions) const {
const su2double enthalpy_species_N = specificHeat[n_species_mixture - 1] * (Temperature - Ref_Temperature);
const su2double enthalpy_species_N = specificHeat[n_species_mixture - 1] * (Temperature - STD_REF_TEMP);
for (int iVar = 0; iVar < n_species_mixture - 1; iVar++) {
const su2double enthalpy_species_i = specificHeat[iVar] * (Temperature - Ref_Temperature);
const su2double enthalpy_species_i = specificHeat[iVar] * (Temperature - STD_REF_TEMP);
enthalpy_diffusions[iVar] = Density * (enthalpy_species_i * massDiffusivity[iVar] -
enthalpy_species_N * massDiffusivity[n_species_mixture - 1]);
enthalpy_diffusions[iVar] += Mu_Turb * (enthalpy_species_i - enthalpy_species_N) / Schmidt_Turb_Number;
Expand Down Expand Up @@ -271,7 +270,7 @@ void CFluidScalar::SetTDState_h(const su2double val_enthalpy, const su2double* v
* depend on temperature, but it does depend on mixture composition, temperature is directly solved from the
* expression h_s = Cp(T - T_ref).
*/
Temperature = val_enthalpy / Cp + Ref_Temperature;
Temperature = val_enthalpy / Cp + STD_REF_TEMP;
Density = Pressure_Thermodynamic / (Temperature * Gas_Constant);
Cv = Cp - Gas_Constant;

Expand All @@ -282,4 +281,5 @@ void CFluidScalar::SetTDState_h(const su2double val_enthalpy, const su2double* v
}

Kt = WilkeConductivity(val_scalars);
ComputeMassDiffusivity();
}
8 changes: 5 additions & 3 deletions SU2_CFD/src/output/CFlowIncOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){
AddVolumeOutput("LAMINAR_VISCOSITY", "Laminar_Viscosity", "PRIMITIVE", "Laminar viscosity");
AddVolumeOutput("HEAT_CAPACITY", "Heat_Capacity", "PRIMITIVE", "Heat capacity");
AddVolumeOutput("THERMAL_CONDUCTIVITY", "Thermal_Conductivity", "PRIMITIVE", "Thermal conductivity");
if (heat || flamelet) AddVolumeOutput("TEMPERATURE", "Temperature", "PRIMITIVE", "Temperature");
if (!weakly_coupled_heat)
AddVolumeOutput("TEMPERATURE", "Temperature", "PRIMITIVE", "Temperature");

AddVolumeOutput("SKIN_FRICTION-X", "Skin_Friction_Coefficient_x", "PRIMITIVE", "x-component of the skin friction vector");
AddVolumeOutput("SKIN_FRICTION-Y", "Skin_Friction_Coefficient_y", "PRIMITIVE", "y-component of the skin friction vector");
Expand All @@ -354,7 +355,7 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){
AddVolumeOutput("RES_VELOCITY-Y", "Residual_Velocity_y", "RESIDUAL", "Residual of the y-velocity component");
if (nDim == 3)
AddVolumeOutput("RES_VELOCITY-Z", "Residual_Velocity_z", "RESIDUAL", "Residual of the z-velocity component");
if (config->GetEnergy_Equation()){
if (heat){
AddVolumeOutput("RES_ENTHALPY", "Residual_Enthalpy", "RESIDUAL", "Residual of the enthalpy");
}
SetVolumeOutputFieldsScalarResidual(config);
Expand Down Expand Up @@ -440,7 +441,8 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve
SetVolumeOutputValue("LAMINAR_VISCOSITY", iPoint, Node_Flow->GetLaminarViscosity(iPoint));
SetVolumeOutputValue("HEAT_CAPACITY", iPoint, Node_Flow->GetSpecificHeatCp(iPoint));
SetVolumeOutputValue("THERMAL_CONDUCTIVITY", iPoint, Node_Flow->GetThermalConductivity(iPoint));
if (heat || flamelet) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetTemperature(iPoint));
if (!weakly_coupled_heat)
SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetTemperature(iPoint));
}

SetVolumeOutputValue("RES_PRESSURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 0));
Expand Down
4 changes: 2 additions & 2 deletions SU2_CFD/src/solvers/CIncEulerSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2145,9 +2145,9 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo
Therefore, we build inv(Precon) here and multiply by the residual
later in the R-K and Euler Explicit time integration schemes. ---*/


Preconditioner[0][0] = Enthalpy * BetaInc2 * dRhodh / Density + BetaInc2;

for (iDim = 0; iDim < nDim; iDim++) Preconditioner[iDim + 1][0] = -1.0 * Velocity[iDim] / Density;

if (energy) {
Expand Down
7 changes: 4 additions & 3 deletions SU2_CFD/src/solvers/CIncNSSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,14 +892,15 @@ void CIncNSSolver::SetTau_Wall_WF(CGeometry *geometry, CSolver **solver_containe
SU2_MPI::Allreduce(&globalCounter1, &notConvergedCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm());
SU2_MPI::Allreduce(&globalCounter2, &smallYPlusCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm());

if (rank == MASTER_NODE) {
const bool write_iter = (config->GetTimeIter() % config->GetVolumeOutputFrequency(0) == 0);
if (rank == MASTER_NODE && write_iter) {
if (notConvergedCounter)
cout << "Warning: Computation of wall coefficients (y+) did not converge in "
<< notConvergedCounter << " points." << endl;

if (smallYPlusCounter)
cout << "Warning: y+ < " << config->GetwallModel_MinYPlus() << " in " << smallYPlusCounter
<< " points, for which the wall model is not active." << endl;
cout << "y+ < " << config->GetwallModel_MinYPlus() << " in " << smallYPlusCounter
<< " points. No problem, but you can increase your near-wall mesh size." << endl;
}
}
END_SU2_OMP_SAFE_GLOBAL_ACCESS
Expand Down
8 changes: 5 additions & 3 deletions SU2_CFD/src/solvers/CNSSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1028,14 +1028,16 @@ void CNSSolver::SetTau_Wall_WF(CGeometry *geometry, CSolver **solver_container,
SU2_MPI::Allreduce(&globalCounter1, &notConvergedCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm());
SU2_MPI::Allreduce(&globalCounter2, &smallYPlusCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm());

if (rank == MASTER_NODE) {
const bool write_iter = (config->GetInnerIter() % config->GetVolumeOutputFrequency(0) == 0);

if (rank == MASTER_NODE && write_iter) {
if (notConvergedCounter)
cout << "Warning: Computation of wall coefficients (y+) did not converge in "
<< notConvergedCounter << " points." << endl;

if (smallYPlusCounter)
cout << "Warning: y+ < " << config->GetwallModel_MinYPlus() << " in " << smallYPlusCounter
<< " points, for which the wall model is not active." << endl;
cout << "y+ < " << config->GetwallModel_MinYPlus() << " in " << smallYPlusCounter
<< " points. No problem, but you can increase your near-wallmesh size." << endl;
}
}
END_SU2_OMP_SAFE_GLOBAL_ACCESS
Expand Down
10 changes: 5 additions & 5 deletions SU2_CFD/src/solvers/CSpeciesSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,11 @@ void CSpeciesSolver::LoadRestart(CGeometry** geometry, CSolver*** solver, CConfi

const bool incompressible = (config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE);
const bool energy = config->GetEnergy_Equation();
const bool flamelet = (config->GetKind_FluidModel() == FLUID_FLAMELET);
const bool weakly_coupled_heat = config->GetWeakly_Coupled_Heat();

/*--- for the flamelet model, the temperature is saved to file, but the energy equation is off ---*/

if (incompressible && ((!energy) && (!weakly_coupled_heat) && (!flamelet))) skipVars--;
if (incompressible && ((!energy) && (!weakly_coupled_heat))) skipVars--;

/*--- Load data from the restart into correct containers. ---*/

Expand Down Expand Up @@ -296,22 +295,23 @@ void CSpeciesSolver::Preprocessing(CGeometry* geometry, CSolver** solver_contain
bool Output) {
SU2_OMP_SAFE_GLOBAL_ACCESS(config->SetGlobalParam(config->GetKind_Solver(), RunTime_EqSystem);)

/*--- Set the laminar mass Diffusivity for the species solver. ---*/
SU2_OMP_FOR_STAT(omp_chunk_size)
for (auto iPoint = 0u; iPoint < nPoint; iPoint++) {
const su2double temperature = solver_container[FLOW_SOL]->GetNodes()->GetTemperature(iPoint);
const su2double* scalar = solver_container[SPECIES_SOL]->GetNodes()->GetSolution(iPoint);
solver_container[FLOW_SOL]->GetFluidModel()->SetMassDiffusivityModel(config);
solver_container[FLOW_SOL]->GetFluidModel()->SetTDState_T(temperature, scalar);
/*--- Recompute viscosity, important to get diffusivity correct across MPI ranks. ---*/
nodes->SetLaminarViscosity(iPoint, solver_container[FLOW_SOL]->GetFluidModel()->GetLaminarViscosity());
/*--- Set the laminar mass Diffusivity for the species solver. ---*/
for (auto iVar = 0u; iVar <= nVar; iVar++) {
const su2double mass_diffusivity = solver_container[FLOW_SOL]->GetFluidModel()->GetMassDiffusivity(iVar);
nodes->SetDiffusivity(iPoint, mass_diffusivity, iVar);
}

} // iPoint
END_SU2_OMP_FOR

/*--- Clear Residual and Jacobian. Upwind second order reconstruction and gradients ---*/
/*--- Clear Residual and Jacobian. Upwind second order reconstruction and gradients. ---*/
CommonPreprocessing(geometry, config, Output);
}

Expand Down
11 changes: 5 additions & 6 deletions SU2_CFD/src/solvers/CTurbSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,8 @@ void CTurbSolver::LoadRestart(CGeometry** geometry, CSolver*** solver, CConfig*
const bool incompressible = (config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE);
const bool energy = config->GetEnergy_Equation();
const bool weakly_coupled_heat = config->GetWeakly_Coupled_Heat();
const bool flamelet = (config->GetKind_FluidModel() == FLUID_FLAMELET);

if (incompressible && ((!energy) && (!weakly_coupled_heat) && (!flamelet))) skipVars--;
if (incompressible && ((!energy) && (!weakly_coupled_heat))) skipVars--;

/*--- Load data from the restart into correct containers. ---*/

Expand Down Expand Up @@ -252,7 +251,7 @@ void CTurbSolver::ComputeUnderRelaxationFactorHelper(su2double allowableRatio) {

/* Loop over the solution update given by relaxing the linear
system for this nonlinear iteration. */

SU2_OMP_FOR_STAT(omp_chunk_size)
for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) {
su2double localUnderRelaxation = 1.0;
Expand All @@ -265,16 +264,16 @@ void CTurbSolver::ComputeUnderRelaxationFactorHelper(su2double allowableRatio) {
turbulence variables can change over a nonlinear iteration. */
if (ratio > allowableRatio) {
localUnderRelaxation = min(allowableRatio / ratio, localUnderRelaxation);

}
}

/* Threshold the relaxation factor in the event that there is
a very small value. This helps avoid catastrophic crashes due
to non-realizable states by canceling the update. */

if (localUnderRelaxation < 1e-10) localUnderRelaxation = 0.0;

/* Store the under-relaxation factor for this point. */

nodes->SetUnderRelaxation(iPoint, localUnderRelaxation);
Expand Down
11 changes: 6 additions & 5 deletions SU2_CFD/src/variables/CIncEulerVariable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@ bool CIncEulerVariable::SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel

SetPressure(iPoint);

/*--- Set the value of the enthalpy directly ---*/

su2double Enthalpy = Solution(iPoint, nDim +1);
FluidModel->SetTDState_h(Enthalpy);
su2double Temperature = FluidModel->GetTemperature();

const auto check_temp = SetTemperature(iPoint, Temperature, TemperatureLimits);

/*--- Use the fluid model to compute the new value of density.
Expand All @@ -103,8 +102,7 @@ bool CIncEulerVariable::SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel

Enthalpy = Solution(iPoint, nDim+1);
FluidModel->SetTDState_h(Enthalpy);
Temperature = FluidModel->GetTemperature();
SetTemperature(iPoint, Temperature, TemperatureLimits);
SetTemperature(iPoint, FluidModel->GetTemperature(), TemperatureLimits);
SetDensity(iPoint, FluidModel->GetDensity());

/*--- Flag this point as non-physical. ---*/
Expand All @@ -117,10 +115,13 @@ bool CIncEulerVariable::SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel

SetVelocity(iPoint);

/*--- Set enthalpy and specific heats (only necessary for consistency with preconditioning). ---*/
/*--- Set specific heats ---*/

SetSpecificHeatCp(iPoint, FluidModel->GetCp());
SetSpecificHeatCv(iPoint, FluidModel->GetCv());

/*--- Set enthalpy ---*/

SetEnthalpy(iPoint, FluidModel->GetEnthalpy());

return physical;
Expand Down
Loading