From ca9083e80334f989577eb45d54e6e9de7d17ae5e Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Tue, 22 Oct 2024 13:43:16 +0200 Subject: [PATCH 01/97] solving for enthalpy --- SU2_CFD/include/fluid/CFluidModel.hpp | 14 ++ SU2_CFD/include/fluid/CFluidScalar.hpp | 10 ++ SU2_CFD/include/numerics/CNumerics.hpp | 2 + SU2_CFD/include/output/CFlowIncOutput.hpp | 1 + .../include/solvers/CFVMFlowSolverBase.hpp | 3 +- .../include/variables/CIncEulerVariable.hpp | 18 ++- SU2_CFD/include/variables/CIncNSVariable.hpp | 1 + SU2_CFD/src/fluid/CFluidScalar.cpp | 13 ++ SU2_CFD/src/numerics/CNumerics.cpp | 53 ++++++-- SU2_CFD/src/numerics/flow/convection/fds.cpp | 57 +++++++-- SU2_CFD/src/output/CFlowIncOutput.cpp | 61 +++++++-- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 120 ++++++++++++++---- SU2_CFD/src/variables/CIncEulerVariable.cpp | 2 +- SU2_CFD/src/variables/CIncNSVariable.cpp | 36 ++++-- SU2_PY/SU2/io/historyMap.py | 18 +++ 15 files changed, 332 insertions(+), 77 deletions(-) diff --git a/SU2_CFD/include/fluid/CFluidModel.hpp b/SU2_CFD/include/fluid/CFluidModel.hpp index 30766e7b5431..29cb44fcc033 100644 --- a/SU2_CFD/include/fluid/CFluidModel.hpp +++ b/SU2_CFD/include/fluid/CFluidModel.hpp @@ -47,6 +47,7 @@ class CLookUpTable; class CFluidModel { protected: su2double StaticEnergy{0.0}; /*!< \brief Internal Energy. */ + su2double Enthalpy{0.0}; /*!<*\brief Enthalpy. */ su2double Entropy{0.0}; /*!< \brief Entropy. */ su2double Density{0.0}; /*!< \brief Density. */ su2double Pressure{0.0}; /*!< \brief Pressure. */ @@ -113,6 +114,11 @@ class CFluidModel { */ su2double GetStaticEnergy() const { return StaticEnergy; } + /*! + * \brief Get fluid enthalpy. + */ + su2double GetEnthalpy() const { return Enthalpy; } + /*! * \brief Get fluid density. */ @@ -339,6 +345,14 @@ class CFluidModel { */ virtual void SetTDState_T(su2double val_Temperature, const su2double* val_scalars = nullptr) {} + /*! + * \brief Virtual member. + * \param[in] val_enthalpy - Enthalpy value at the point. + */ + inline virtual su2double ComputeTempFromEnthalpy(su2double val_enthalpy, const su2double* val_scalars = nullptr) { + 0.0; + } + /*! * \brief Set fluid eddy viscosity provided by a turbulence model needed for computing effective thermal conductivity. */ diff --git a/SU2_CFD/include/fluid/CFluidScalar.hpp b/SU2_CFD/include/fluid/CFluidScalar.hpp index 206de692ae08..527adbf6ffad 100644 --- a/SU2_CFD/include/fluid/CFluidScalar.hpp +++ b/SU2_CFD/include/fluid/CFluidScalar.hpp @@ -91,6 +91,11 @@ class CFluidScalar final : public CFluidModel { */ su2double ComputeMeanSpecificHeatCp(const su2double* val_scalars); + /*! + * \brief Compute Enthalpy given the temperature and scalars. + */ + su2double ComputeEnthalpyFromT(const su2double val_enthalpy, const su2double* val_scalars); + /*! * \brief Compute gas constant for mixture. */ @@ -137,6 +142,11 @@ class CFluidScalar final : public CFluidModel { */ inline su2double GetMassDiffusivity(int ivar) override { return massDiffusivity[ivar]; } + /*! + * \brief Compute Temperature from Enthalpy and scalars. + */ + inline su2double ComputeTempFromEnthalpy(const su2double val_temperature, const su2double* val_scalars) override; + /*! * \brief Set the Dimensionless State using Temperature. * \param[in] t - Temperature value at the point. diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 535335947caf..f5b0634030fc 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -188,6 +188,8 @@ class CNumerics { bool nemo; /*!< \brief Flag for NEMO problems */ + bool multicomponent_energy = false; /*!< \brief Flag for multicomponent and reacting flow */ + bool bounded_scalar = false; /*!< \brief Flag for bounded scalar problem */ public: diff --git a/SU2_CFD/include/output/CFlowIncOutput.hpp b/SU2_CFD/include/output/CFlowIncOutput.hpp index fe7d78744274..f9c18d3d776a 100644 --- a/SU2_CFD/include/output/CFlowIncOutput.hpp +++ b/SU2_CFD/include/output/CFlowIncOutput.hpp @@ -40,6 +40,7 @@ class CFlowIncOutput final: public CFlowOutput { private: TURB_MODEL turb_model; /*!< \brief The kind of turbulence model*/ bool heat; /*!< \brief Boolean indicating whether have a heat problem*/ + bool multicomponent; /*!< \brief Boolean indicating whether have a multicomponent problem*/ bool weakly_coupled_heat; /*!< \brief Boolean indicating whether have a weakly coupled heat equation*/ bool flamelet; /*!< \brief Boolean indicating whether we solve the flamelet equations */ unsigned short streamwisePeriodic; /*!< \brief Boolean indicating whether it is a streamwise periodic simulation. */ diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp index 2aa31880baea..6f548e3ad312 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp @@ -69,7 +69,8 @@ class CFVMFlowSolverBase : public CSolver { su2double Mach_Inf = 0.0; /*!< \brief Mach number at the infinity. */ su2double Density_Inf = 0.0; /*!< \brief Density at the infinity. */ su2double Energy_Inf = 0.0; /*!< \brief Energy at the infinity. */ - su2double Temperature_Inf = 0.0; /*!< \brief Energy at the infinity. */ + su2double Temperature_Inf = 0.0; /*!< \brief Temperature at the infinity. */ + su2double Enthalpy_Inf = 0.0; /*!< \brief Enthalpy at the infinity. */ su2double Pressure_Inf = 0.0; /*!< \brief Pressure at the infinity. */ su2double* Velocity_Inf = nullptr; /*!< \brief Flow Velocity vector at the infinity. */ diff --git a/SU2_CFD/include/variables/CIncEulerVariable.hpp b/SU2_CFD/include/variables/CIncEulerVariable.hpp index 7f398351f04f..628ac40b5773 100644 --- a/SU2_CFD/include/variables/CIncEulerVariable.hpp +++ b/SU2_CFD/include/variables/CIncEulerVariable.hpp @@ -40,7 +40,7 @@ */ class CIncEulerVariable : public CFlowVariable { public: - static constexpr size_t MAXNVAR = 12; + static constexpr size_t MAXNVAR = 13; template struct CIndices { @@ -59,11 +59,11 @@ class CIncEulerVariable : public CFlowVariable { inline IndexType ThermalConductivity() const { return nDim+6; } inline IndexType CpTotal() const { return nDim+7; } inline IndexType CvTotal() const { return nDim+8; } + inline IndexType Enthalpy() const { return nDim + 9; } /*--- For compatible interface with NEMO. ---*/ inline IndexType SpeciesDensities() const { return std::numeric_limits::max(); } inline IndexType Temperature_ve() const { return std::numeric_limits::max(); } - inline IndexType Enthalpy() const { return std::numeric_limits::max(); } }; protected: @@ -121,6 +121,14 @@ class CIncEulerVariable : public CFlowVariable { return val_temperature <= 0.0; } + /*! + * \brief Set the value of the enthalpy for multicomponent incompressible flows with energy equation. + * \param[in] iPoint - Point index. + */ + inline void SetEnthalpy(unsigned long iPoint, su2double val_enthalpy) { + Primitive(iPoint, indices.Enthalpy()) = val_enthalpy; + } + /*! * \brief Set the value of the beta coeffient for incompressible flows. * \param[in] iPoint - Point index. @@ -153,6 +161,12 @@ class CIncEulerVariable : public CFlowVariable { */ inline su2double GetTemperature(unsigned long iPoint) const final { return Primitive(iPoint, indices.Temperature()); } + /*! + * \brief Get the enthalpy of the flow. + * \return Value of the enthalpy of the flow. + */ + inline su2double GetEnthalpy(unsigned long iPoint) const final { return Primitive(iPoint, indices.Enthalpy()); } + /*! * \brief Get the velocity of the flow. * \param[in] iDim - Index of the dimension. diff --git a/SU2_CFD/include/variables/CIncNSVariable.hpp b/SU2_CFD/include/variables/CIncNSVariable.hpp index 138026140b5e..14d5e6bd7ace 100644 --- a/SU2_CFD/include/variables/CIncNSVariable.hpp +++ b/SU2_CFD/include/variables/CIncNSVariable.hpp @@ -40,6 +40,7 @@ class CIncNSVariable final : public CIncEulerVariable { private: VectorType Tau_Wall; /*!< \brief Magnitude of the wall shear stress from a wall function. */ VectorType DES_LengthScale; + bool Energy_Multicomponent = false; public: /*! diff --git a/SU2_CFD/src/fluid/CFluidScalar.cpp b/SU2_CFD/src/fluid/CFluidScalar.cpp index a57ddc7797ef..e8c50c1f38ea 100644 --- a/SU2_CFD/src/fluid/CFluidScalar.cpp +++ b/SU2_CFD/src/fluid/CFluidScalar.cpp @@ -212,6 +212,18 @@ su2double CFluidScalar::ComputeMeanSpecificHeatCp(const su2double* val_scalars) return mean_cp; } +su2double CFluidScalar::ComputeEnthalpyFromT(const su2double val_temperature, const su2double* val_scalars){ + su2double val_Enthalpy = Cp * (val_temperature - 298.15); + return val_Enthalpy; +} + +su2double CFluidScalar::ComputeTempFromEnthalpy(const su2double val_enthalpy, const su2double* val_scalars){ + MassToMoleFractions(val_scalars); + su2double val_cp = ComputeMeanSpecificHeatCp(val_scalars); + su2double val_Temperature = val_enthalpy / val_cp + 298.15; + return val_Temperature; +} + void CFluidScalar::SetTDState_T(const su2double val_temperature, const su2double* val_scalars) { MassToMoleFractions(val_scalars); ComputeGasConstant(); @@ -219,6 +231,7 @@ void CFluidScalar::SetTDState_T(const su2double val_temperature, const su2double Density = Pressure_Thermodynamic / (Temperature * Gas_Constant); Cp = ComputeMeanSpecificHeatCp(val_scalars); Cv = Cp - Gas_Constant; + Enthalpy = ComputeEnthalpyFromT(Temperature, val_scalars); if (wilke) { Mu = WilkeViscosity(val_scalars); diff --git a/SU2_CFD/src/numerics/CNumerics.cpp b/SU2_CFD/src/numerics/CNumerics.cpp index 2c36556f8089..379276fa83a1 100644 --- a/SU2_CFD/src/numerics/CNumerics.cpp +++ b/SU2_CFD/src/numerics/CNumerics.cpp @@ -54,6 +54,8 @@ CNumerics::CNumerics(unsigned short val_nDim, unsigned short val_nVar, Prandtl_Lam = config->GetPrandtl_Lam(); Prandtl_Turb = config->GetPrandtl_Turb(); Gas_Constant = config->GetGas_ConstantND(); + multicomponent_energy = + (config->GetKind_Species_Model() == SPECIES_MODEL::SPECIES_TRANSPORT) && (config->GetEnergy_Equation()); tau = new su2double* [nDim]; for (iDim = 0; iDim < nDim; iDim++) @@ -278,10 +280,20 @@ void CNumerics::GetInviscidIncProjJac(const su2double *val_density, const su2dou val_Proj_Jac_Tensor[2][2] = val_scale*((*val_density)*(proj_vel + val_normal[1]*val_velocity[1])); val_Proj_Jac_Tensor[2][3] = val_scale*((*val_dRhodT)*val_velocity[1]*proj_vel); - val_Proj_Jac_Tensor[3][0] = val_scale*((*val_cp)*(*val_temperature)*proj_vel/(*val_betainc2)); - val_Proj_Jac_Tensor[3][1] = val_scale*((*val_cp)*(*val_temperature)*val_normal[0]*(*val_density)); - val_Proj_Jac_Tensor[3][2] = val_scale*((*val_cp)*(*val_temperature)*val_normal[1]*(*val_density)); - val_Proj_Jac_Tensor[3][3] = val_scale*((*val_cp)*((*val_temperature)*(*val_dRhodT) + (*val_density))*proj_vel); + if (multicomponent_energy) { + val_Proj_Jac_Tensor[3][0] = val_scale * ((*val_temperature) * proj_vel / (*val_betainc2)); + val_Proj_Jac_Tensor[3][1] = val_scale * ((*val_temperature) * val_normal[0] * (*val_density)); + val_Proj_Jac_Tensor[3][2] = val_scale * ((*val_temperature) * val_normal[1] * (*val_density)); + val_Proj_Jac_Tensor[3][3] = + val_scale * ((*val_temperature) * (*val_dRhodT) + (*val_density)) * proj_vel; + + } else { + val_Proj_Jac_Tensor[3][0] = val_scale * ((*val_cp) * (*val_temperature) * proj_vel / (*val_betainc2)); + val_Proj_Jac_Tensor[3][1] = val_scale * ((*val_cp) * (*val_temperature) * val_normal[0] * (*val_density)); + val_Proj_Jac_Tensor[3][2] = val_scale * ((*val_cp) * (*val_temperature) * val_normal[1] * (*val_density)); + val_Proj_Jac_Tensor[3][3] = + val_scale * ((*val_cp) * ((*val_temperature) * (*val_dRhodT) + (*val_density)) * proj_vel); + } } else { @@ -309,12 +321,21 @@ void CNumerics::GetInviscidIncProjJac(const su2double *val_density, const su2dou val_Proj_Jac_Tensor[3][3] = val_scale*((*val_density)*(proj_vel + val_normal[2]*val_velocity[2])); val_Proj_Jac_Tensor[3][4] = val_scale*((*val_dRhodT)*val_velocity[2]*proj_vel); - val_Proj_Jac_Tensor[4][0] = val_scale*((*val_cp)*(*val_temperature)*proj_vel/(*val_betainc2)); - val_Proj_Jac_Tensor[4][1] = val_scale*((*val_cp)*(*val_temperature)*val_normal[0]*(*val_density)); - val_Proj_Jac_Tensor[4][2] = val_scale*((*val_cp)*(*val_temperature)*val_normal[1]*(*val_density)); - val_Proj_Jac_Tensor[4][3] = val_scale*((*val_cp)*(*val_temperature)*val_normal[2]*(*val_density)); - val_Proj_Jac_Tensor[4][4] = val_scale*((*val_cp)*((*val_temperature)*(*val_dRhodT) + (*val_density))*proj_vel); - + if (multicomponent_energy) { + val_Proj_Jac_Tensor[4][0] = val_scale * ((*val_temperature) * proj_vel / (*val_betainc2)); + val_Proj_Jac_Tensor[4][1] = val_scale * ((*val_temperature) * val_normal[0] * (*val_density)); + val_Proj_Jac_Tensor[4][2] = val_scale * ((*val_temperature) * val_normal[1] * (*val_density)); + val_Proj_Jac_Tensor[4][3] = val_scale * ((*val_temperature) * val_normal[2] * (*val_density)); + val_Proj_Jac_Tensor[4][4] = + val_scale * ((*val_temperature) * (*val_dRhodT) + (*val_density)) * proj_vel; + } else { + val_Proj_Jac_Tensor[4][0] = val_scale * ((*val_cp) * (*val_temperature) * proj_vel / (*val_betainc2)); + val_Proj_Jac_Tensor[4][1] = val_scale * ((*val_cp) * (*val_temperature) * val_normal[0] * (*val_density)); + val_Proj_Jac_Tensor[4][2] = val_scale * ((*val_cp) * (*val_temperature) * val_normal[1] * (*val_density)); + val_Proj_Jac_Tensor[4][3] = val_scale * ((*val_cp) * (*val_temperature) * val_normal[2] * (*val_density)); + val_Proj_Jac_Tensor[4][4] = + val_scale * ((*val_cp) * ((*val_temperature) * (*val_dRhodT) + (*val_density)) * proj_vel); + } } AD::EndPassive(wasActive); } @@ -328,7 +349,11 @@ void CNumerics::GetPreconditioner(const su2double *val_density, const su2double val_Precon[0][0] = 1.0/(*val_betainc2); for (iDim = 0; iDim < nDim; iDim++) val_Precon[iDim+1][0] = val_velocity[iDim]/(*val_betainc2); - val_Precon[nDim+1][0] = (*val_cp)*(*val_temperature)/(*val_betainc2); + if (multicomponent_energy){ + val_Precon[nDim+1][0] = (*val_temperature)/(*val_betainc2); + }else{ + val_Precon[nDim+1][0] = (*val_cp)*(*val_temperature)/(*val_betainc2); + } for (jDim = 0; jDim < nDim; jDim++) { val_Precon[0][jDim+1] = 0.0; @@ -342,7 +367,11 @@ void CNumerics::GetPreconditioner(const su2double *val_density, const su2double val_Precon[0][nDim+1] = (*val_drhodt); for (iDim = 0; iDim < nDim; iDim++) val_Precon[iDim+1][nDim+1] = val_velocity[iDim]*(*val_drhodt); - val_Precon[nDim+1][nDim+1] = (*val_cp)*((*val_drhodt)*(*val_temperature) + (*val_density)); + if (multicomponent_energy){ + val_Precon[nDim+1][nDim+1] = (*val_drhodt)*(*val_temperature) + (*val_density); + }else{ + val_Precon[nDim+1][nDim+1] = (*val_cp)*((*val_drhodt)*(*val_temperature) + (*val_density)); + } } diff --git a/SU2_CFD/src/numerics/flow/convection/fds.cpp b/SU2_CFD/src/numerics/flow/convection/fds.cpp index ae48e59f3365..de1963e3fb30 100644 --- a/SU2_CFD/src/numerics/flow/convection/fds.cpp +++ b/SU2_CFD/src/numerics/flow/convection/fds.cpp @@ -94,7 +94,7 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config su2double ProjGridVel = 0.0; AD::StartPreacc(); - AD::SetPreaccIn(V_i, nDim+9); AD::SetPreaccIn(V_j, nDim+9); AD::SetPreaccIn(Normal, nDim); + AD::SetPreaccIn(V_i, nDim+10); AD::SetPreaccIn(V_j, nDim+10); AD::SetPreaccIn(Normal, nDim); if (dynamic_grid) { AD::SetPreaccIn(GridVel_i, nDim); AD::SetPreaccIn(GridVel_j, nDim); @@ -118,7 +118,13 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config DensityInc_i = V_i[nDim+2]; DensityInc_j = V_j[nDim+2]; BetaInc2_i = V_i[nDim+3]; BetaInc2_j = V_j[nDim+3]; Cp_i = V_i[nDim+7]; Cp_j = V_j[nDim+7]; - Enthalpy_i = Cp_i*Temperature_i; Enthalpy_j = Cp_j*Temperature_j; + if (multicomponent_energy) { + Enthalpy_i = V_i[nDim + 9]; + Enthalpy_j = V_j[nDim + 9]; + } else { + Enthalpy_i = Cp_i * Temperature_i; + Enthalpy_j = Cp_j * Temperature_j; + } ProjVelocity = 0.0; for (iDim = 0; iDim < nDim; iDim++) { @@ -157,9 +163,15 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config MeandRhodT = 0.0; dRhodT_i = 0.0; dRhodT_j = 0.0; if (variable_density) { - MeandRhodT = -MeanDensity/MeanTemperature; - dRhodT_i = -DensityInc_i/Temperature_i; - dRhodT_j = -DensityInc_j/Temperature_j; + if (multicomponent_energy) { + MeandRhodT = -MeanDensity / (MeanCp * MeanTemperature); + dRhodT_i = -DensityInc_i / (Cp_i * Temperature_i); + dRhodT_j = -DensityInc_j / (Cp_j * Temperature_j); + } else { + MeandRhodT = -MeanDensity / MeanTemperature; + dRhodT_i = -DensityInc_i / Temperature_i; + dRhodT_j = -DensityInc_j / Temperature_j; + } } /*--- Compute ProjFlux_i ---*/ @@ -192,8 +204,11 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config Lambda[iVar] = fabs(Lambda[iVar]); /*--- Build the preconditioning matrix using mean values ---*/ - - GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanTemperature, &MeandRhodT, Precon); + if (multicomponent_energy) { + GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanEnthalpy, &MeandRhodT, Precon); + } else { + GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanTemperature, &MeandRhodT, Precon); + } /*--- Build the absolute value of the preconditioned Jacobian, i.e., |A_precon| = P x |Lambda| x inv(P), where P diagonalizes the matrix @@ -206,13 +221,26 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config Diff_V[0] = Pressure_j - Pressure_i; for (iDim = 0; iDim < nDim; iDim++) Diff_V[iDim+1] = Velocity_j[iDim] - Velocity_i[iDim]; - Diff_V[nDim+1] = Temperature_j - Temperature_i; + if (multicomponent_energy){ + Diff_V[nDim+1] = Enthalpy_j - Enthalpy_i; + }else{ + Diff_V[nDim+1] = Temperature_j - Temperature_i; + } /*--- Build the inviscid Jacobian w.r.t. the primitive variables ---*/ if (implicit) { - GetInviscidIncProjJac(&DensityInc_i, Velocity_i, &BetaInc2_i, &Cp_i, &Temperature_i, &dRhodT_i, Normal, 0.5, Jacobian_i); - GetInviscidIncProjJac(&DensityInc_j, Velocity_j, &BetaInc2_j, &Cp_j, &Temperature_j, &dRhodT_j, Normal, 0.5, Jacobian_j); + if (multicomponent_energy) { + GetInviscidIncProjJac(&DensityInc_i, Velocity_i, &BetaInc2_i, &Cp_i, &Enthalpy_i, &dRhodT_i, Normal, 0.5, + Jacobian_i); + GetInviscidIncProjJac(&DensityInc_j, Velocity_j, &BetaInc2_j, &Cp_j, &Enthalpy_j, &dRhodT_j, Normal, 0.5, + Jacobian_j); + } else { + GetInviscidIncProjJac(&DensityInc_i, Velocity_i, &BetaInc2_i, &Cp_i, &Temperature_i, &dRhodT_i, Normal, 0.5, + Jacobian_i); + GetInviscidIncProjJac(&DensityInc_j, Velocity_j, &BetaInc2_j, &Cp_j, &Temperature_j, &dRhodT_j, Normal, 0.5, + Jacobian_j); + } } /*--- Compute dissipation as Precon x |A_precon| x dV. If implicit, @@ -258,8 +286,13 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config Jacobian_i[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_i; Jacobian_j[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_j; } - Jacobian_i[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_i*Cp_i; - Jacobian_j[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_j*Cp_j; + if (multicomponent_energy){ + Jacobian_i[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_i; + Jacobian_j[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_j; + } else { + Jacobian_i[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_i*Cp_i; + Jacobian_j[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_j*Cp_j; + } } } } diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index eeffb6a3486c..ac61e806092d 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -37,6 +37,8 @@ CFlowIncOutput::CFlowIncOutput(CConfig *config, unsigned short nDim) : CFlowOutp heat = config->GetEnergy_Equation(); + multicomponent = config->GetKind_Species_Model()==SPECIES_MODEL::SPECIES_TRANSPORT; + weakly_coupled_heat = config->GetWeakly_Coupled_Heat(); flamelet = (config->GetKind_Species_Model() == SPECIES_MODEL::FLAMELET); @@ -108,7 +110,13 @@ void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ /// DESCRIPTION: Root-mean square residual of the velocity z-component. if (nDim == 3) AddHistoryOutput("RMS_VELOCITY-Z", "rms[W]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the velocity z-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the temperature. - if (heat || weakly_coupled_heat) AddHistoryOutput("RMS_TEMPERATURE", "rms[T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the temperature.", HistoryFieldType::RESIDUAL); + if (heat || weakly_coupled_heat){ + if (multicomponent){ + AddHistoryOutput("RMS_ENTHALPY", "rms[h]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the enthalpy.", HistoryFieldType::RESIDUAL); + } else { + AddHistoryOutput("RMS_TEMPERATURE", "rms[T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the temperature.", HistoryFieldType::RESIDUAL); + } + } AddHistoryOutputFields_ScalarRMS_RES(config); @@ -128,7 +136,11 @@ void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ AddHistoryOutput("MAX_VELOCITY-Z", "max[W]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the velocity z-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the temperature. if (heat || weakly_coupled_heat) - AddHistoryOutput("MAX_TEMPERATURE", "max[T]", ScreenOutputFormat::FIXED, "MAX_RES", "Root-mean square residual of the temperature.", HistoryFieldType::RESIDUAL); + if (multicomponent){ + AddHistoryOutput("MAX_ENTHALPY", "max[h]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the enthalpy.", HistoryFieldType::RESIDUAL); + } else { + AddHistoryOutput("MAX_TEMPERATURE", "max[T]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the temperature.", HistoryFieldType::RESIDUAL); + } AddHistoryOutputFields_ScalarMAX_RES(config); /// END_GROUP @@ -145,7 +157,11 @@ void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ AddHistoryOutput("BGS_VELOCITY-Z", "bgs[W]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the velocity z-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the temperature. if (heat || weakly_coupled_heat) - AddHistoryOutput("BGS_TEMPERATURE", "bgs[T]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the temperature.", HistoryFieldType::RESIDUAL); + if (multicomponent){ + AddHistoryOutput("BGS_ENTHALPY", "bgs[h]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the enthalpy.", HistoryFieldType::RESIDUAL); + } else { + AddHistoryOutput("BGS_TEMPERATURE", "bgs[T]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the temperature.", HistoryFieldType::RESIDUAL); + } AddHistoryOutputFields_ScalarBGS_RES(config); @@ -232,10 +248,18 @@ void CFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolv if (heat) { SetHeatCoefficients(config, flow_solver); SetHistoryOutputValue("AVG_TEMPERATURE", flow_solver->GetTotal_AvgTemperature()); - SetHistoryOutputValue("RMS_TEMPERATURE", log10(flow_solver->GetRes_RMS(nDim + 1))); - SetHistoryOutputValue("MAX_TEMPERATURE", log10(flow_solver->GetRes_Max(nDim + 1))); - if (multiZone) { - SetHistoryOutputValue("BGS_TEMPERATURE", log10(flow_solver->GetRes_BGS(nDim + 1))); + if (multicomponent){ + SetHistoryOutputValue("RMS_ENTHALPY", log10(flow_solver->GetRes_RMS(nDim + 1))); + SetHistoryOutputValue("MAX_ENTHALPY", log10(flow_solver->GetRes_Max(nDim + 1))); + if (multiZone) { + SetHistoryOutputValue("BGS_ENTHALPY", log10(flow_solver->GetRes_BGS(nDim + 1))); + } + } else { + SetHistoryOutputValue("RMS_TEMPERATURE", log10(flow_solver->GetRes_RMS(nDim + 1))); + SetHistoryOutputValue("MAX_TEMPERATURE", log10(flow_solver->GetRes_Max(nDim + 1))); + if (multiZone) { + SetHistoryOutputValue("BGS_TEMPERATURE", log10(flow_solver->GetRes_BGS(nDim + 1))); + } } } @@ -295,8 +319,10 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("VELOCITY-Y", "Velocity_y", "SOLUTION", "y-component of the velocity vector"); if (nDim == 3) AddVolumeOutput("VELOCITY-Z", "Velocity_z", "SOLUTION", "z-component of the velocity vector"); - if (heat || weakly_coupled_heat || flamelet) - AddVolumeOutput("TEMPERATURE", "Temperature","SOLUTION", "Temperature"); + if (heat || weakly_coupled_heat || flamelet){ + if (multicomponent) AddVolumeOutput("ENTHALPY", "Enthalpy", "SOLUTION", "Enthalpy"); + else AddVolumeOutput("TEMPERATURE", "Temperature","SOLUTION", "Temperature"); + } SetVolumeOutputFieldsScalarSolution(config); @@ -320,6 +346,7 @@ 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 && multicomponent) 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"); @@ -343,9 +370,10 @@ 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()) - AddVolumeOutput("RES_TEMPERATURE", "Residual_Temperature", "RESIDUAL", "Residual of the temperature"); - + if (config->GetEnergy_Equation()){ + if (multicomponent) AddVolumeOutput("RES_ENTHALPY", "Residual_Enthalpy", "RESIDUAL", "Residual of the enthalpy"); + else AddVolumeOutput("RES_TEMPERATURE", "Residual_Temperature", "RESIDUAL", "Residual of the temperature"); + } SetVolumeOutputFieldsScalarResidual(config); if (config->GetKind_SlopeLimit_Flow() != LIMITER::NONE && config->GetKind_SlopeLimit_Flow() != LIMITER::VAN_ALBADA_EDGE) { @@ -399,7 +427,10 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve if (nDim == 3) SetVolumeOutputValue("VELOCITY-Z", iPoint, Node_Flow->GetSolution(iPoint, 3)); - if (heat || flamelet) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetSolution(iPoint, nDim+1)); + if (heat || flamelet) { + if (multicomponent) SetVolumeOutputValue("ENTHALPY", iPoint, Node_Flow->GetSolution(iPoint, nDim+1)); + else SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetSolution(iPoint, nDim+1)); + } if (weakly_coupled_heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Heat->GetSolution(iPoint, 0)); // Radiation solver @@ -423,6 +454,7 @@ 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 (multicomponent) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetTemperature(iPoint)); } SetVolumeOutputValue("RES_PRESSURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 0)); @@ -431,7 +463,8 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve if (nDim == 3) SetVolumeOutputValue("RES_VELOCITY-Z", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 3)); if (config->GetEnergy_Equation()) - SetVolumeOutputValue("RES_TEMPERATURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, nDim+1)); + if (multicomponent) SetVolumeOutputValue("RES_ENTHALPY", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, nDim+1)); + else SetVolumeOutputValue("RES_TEMPERATURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, nDim+1)); if (config->GetKind_SlopeLimit_Flow() != LIMITER::NONE && config->GetKind_SlopeLimit_Flow() != LIMITER::VAN_ALBADA_EDGE) { SetVolumeOutputValue("LIMITER_PRESSURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 0)); diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index 6aaf09a51835..64b0f2cc91ff 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -57,6 +57,7 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned bool time_stepping = config->GetTime_Marching() == TIME_MARCHING::TIME_STEPPING; bool adjoint = (config->GetContinuous_Adjoint()) || (config->GetDiscrete_Adjoint()); const bool centered = config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED; + bool Energy_Multicomponent = (config->GetKind_Species_Model()==SPECIES_MODEL::SPECIES_TRANSPORT) && config->GetEnergy_Equation(); /* A grid is defined as dynamic if there's rigid grid movement or grid deformation AND the problem is time domain */ dynamic_grid = config->GetDynamic_Grid(); @@ -119,7 +120,7 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned /*--- Make sure to align the sizes with the constructor of CIncEulerVariable. ---*/ nVar = nDim + 2; - nPrimVar = nDim + 9; + nPrimVar = nDim + 10; /*--- Centered schemes only need gradients for viscous fluxes (T and v, but we need also to include P). ---*/ nPrimVarGrad = nDim + (centered ? 2 : 4); @@ -178,6 +179,12 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned Pressure_Inf = config->GetPressure_FreeStreamND(); Velocity_Inf = config->GetVelocity_FreeStreamND(); Temperature_Inf = config->GetTemperature_FreeStreamND(); + if (Energy_Multicomponent){ + CFluidModel *auxFluidModel = new CFluidScalar(config->GetPressure_Thermodynamic(), config); + const su2double *scalar_init = config->GetSpecies_Init(); + auxFluidModel->SetTDState_T(Temperature_Inf,scalar_init); // compute total enthalpy from temperature + Enthalpy_Inf = auxFluidModel->GetEnthalpy(); + } /*--- Initialize the secondary values for direct derivative approxiations ---*/ @@ -208,7 +215,11 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned /*--- Initialize the solution to the far-field state everywhere. ---*/ if (navier_stokes) { - nodes = new CIncNSVariable(Pressure_Inf, Velocity_Inf, Temperature_Inf, nPoint, nDim, nVar, config); + if (Energy_Multicomponent){ + nodes = new CIncNSVariable(Pressure_Inf, Velocity_Inf, Enthalpy_Inf, nPoint, nDim, nVar, config); + }else{ + nodes = new CIncNSVariable(Pressure_Inf, Velocity_Inf, Temperature_Inf, nPoint, nDim, nVar, config); + } } else { nodes = new CIncEulerVariable(Pressure_Inf, Velocity_Inf, Temperature_Inf, nPoint, nDim, nVar, config); } @@ -1977,12 +1988,13 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo unsigned short iDim, jDim, iVar, jVar; - su2double BetaInc2, Density, dRhodT, Temperature, oneOverCp, Cp; + su2double BetaInc2, Density, dRhodT, Temperature, oneOverCp, Cp, Enthalpy; su2double Velocity[MAXNDIM] = {0.0}; bool variable_density = (config->GetVariable_Density_Model()); bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); bool energy = config->GetEnergy_Equation(); + bool multicomponent = config->GetKind_Species_Model()==SPECIES_MODEL::SPECIES_TRANSPORT; /*--- Access the primitive variables at this node. ---*/ @@ -1991,6 +2003,7 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo Cp = nodes->GetSpecificHeatCp(iPoint); oneOverCp = 1.0/Cp; Temperature = nodes->GetTemperature(iPoint); + if (energy && multicomponent) Enthalpy = nodes->GetEnthalpy(iPoint); for (iDim = 0; iDim < nDim; iDim++) Velocity[iDim] = nodes->GetVelocity(iPoint,iDim); @@ -2000,7 +2013,11 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo law, but in the future, dRhodT should be in the fluid model. ---*/ if (variable_density) { - dRhodT = -Density/Temperature; + if (multicomponent && energy){ + dRhodT = -Density / (Cp * Temperature); + } else { + dRhodT = -Density/Temperature; + } } else { dRhodT = 0.0; } @@ -2017,8 +2034,15 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo for (iDim = 0; iDim < nDim; iDim++) Preconditioner[iDim+1][0] = Velocity[iDim]/BetaInc2; - if (energy) Preconditioner[nDim+1][0] = Cp*Temperature/BetaInc2; - else Preconditioner[nDim+1][0] = 0.0; + if (energy) { + if (multicomponent) { + Preconditioner[nDim + 1][0] = Enthalpy / BetaInc2; + } else { + Preconditioner[nDim + 1][0] = Cp * Temperature / BetaInc2; + } + } else { + Preconditioner[nDim + 1][0] = 0.0; + } for (jDim = 0; jDim < nDim; jDim++) { Preconditioner[0][jDim+1] = 0.0; @@ -2033,46 +2057,72 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo for (iDim = 0; iDim < nDim; iDim++) Preconditioner[iDim+1][nDim+1] = Velocity[iDim]*dRhodT; - if (energy) Preconditioner[nDim+1][nDim+1] = Cp*(dRhodT*Temperature + Density); - else Preconditioner[nDim+1][nDim+1] = 1.0; + if (energy) { + if (multicomponent) { + Preconditioner[nDim + 1][nDim + 1] = dRhodT * Enthalpy + Density; + } else { + Preconditioner[nDim + 1][nDim + 1] = Cp * (dRhodT * Temperature + Density); + } + } else { + Preconditioner[nDim + 1][nDim + 1] = 1.0; + } for (iVar = 0; iVar < nVar; iVar ++ ) for (jVar = 0; jVar < nVar; jVar ++ ) Preconditioner[iVar][jVar] = delta*Preconditioner[iVar][jVar]; } else { - /*--- For explicit calculations, we move the residual to the right-hand side and pre-multiply by the preconditioner inverse. 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] = Temperature*BetaInc2*dRhodT/Density + BetaInc2; - for (iDim = 0; iDim < nDim; iDim ++) - Preconditioner[iDim+1][0] = -1.0*Velocity[iDim]/Density; - - if (energy) Preconditioner[nDim+1][0] = -1.0*Temperature/Density; - else Preconditioner[nDim+1][0] = 0.0; + if (multicomponent && energy) { + Preconditioner[0][0] = Enthalpy * BetaInc2 * dRhodT / Density + BetaInc2; + } else { + Preconditioner[0][0] = Temperature * BetaInc2 * dRhodT / Density + BetaInc2; + } + for (iDim = 0; iDim < nDim; iDim++) Preconditioner[iDim + 1][0] = -1.0 * Velocity[iDim] / Density; + if (energy) { + if (multicomponent) { + Preconditioner[nDim + 1][0] = -1.0 * Enthalpy / Density; + } else { + Preconditioner[nDim + 1][0] = -1.0 * Temperature / Density; + } + } else { + Preconditioner[nDim + 1][0] = 0.0; + } for (jDim = 0; jDim < nDim; jDim++) { - Preconditioner[0][jDim+1] = 0.0; + Preconditioner[0][jDim + 1] = 0.0; for (iDim = 0; iDim < nDim; iDim++) { - if (iDim == jDim) Preconditioner[iDim+1][jDim+1] = 1.0/Density; - else Preconditioner[iDim+1][jDim+1] = 0.0; + if (iDim == jDim) + Preconditioner[iDim + 1][jDim + 1] = 1.0 / Density; + else + Preconditioner[iDim + 1][jDim + 1] = 0.0; } - Preconditioner[nDim+1][jDim+1] = 0.0; + Preconditioner[nDim + 1][jDim + 1] = 0.0; } - Preconditioner[0][nDim+1] = -1.0*BetaInc2*dRhodT*oneOverCp/Density; - for (iDim = 0; iDim < nDim; iDim ++) - Preconditioner[iDim+1][nDim+1] = 0.0; + if (multicomponent && energy) { + Preconditioner[0][nDim + 1] = -1.0 * BetaInc2 * dRhodT / Density; + } else { + Preconditioner[0][nDim + 1] = -1.0 * BetaInc2 * dRhodT * oneOverCp / Density; + } + for (iDim = 0; iDim < nDim; iDim++) Preconditioner[iDim + 1][nDim + 1] = 0.0; - if (energy) Preconditioner[nDim+1][nDim+1] = oneOverCp/Density; - else Preconditioner[nDim+1][nDim+1] = 0.0; + if (energy) { + if (multicomponent) { + Preconditioner[nDim + 1][nDim + 1] = 1.0 / Density; + } else { + Preconditioner[nDim + 1][nDim + 1] = oneOverCp / Density; + } + } else { + Preconditioner[nDim + 1][nDim + 1] = 0.0; + } } - } void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, @@ -2217,6 +2267,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool viscous = config->GetViscous(); + bool Energy_Multicomponent = (config->GetKind_Species_Model()==SPECIES_MODEL::SPECIES_TRANSPORT) && config->GetEnergy_Equation(); string Marker_Tag = config->GetMarker_All_TagBound(val_marker); @@ -2380,6 +2431,15 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, V_inlet[prim_idx.Pressure()] = nodes->GetPressure(iPoint); } + /*-- Enthalpy is needed for energy equation in multicomponent and reacting flows. ---*/ + if (Energy_Multicomponent) { + CFluidModel* auxFluidModel = solver_container[FLOW_SOL]->GetFluidModel(); + const su2double* scalar_inlet = config->GetInlet_SpeciesVal(config->GetMarker_All_TagBound(val_marker)); + auxFluidModel->SetTDState_T(V_inlet[prim_idx.Temperature()], + scalar_inlet); // compute total enthalpy from temperature + V_inlet[prim_idx.Enthalpy()] = auxFluidModel->GetEnthalpy(); + } + /*--- Access density at the node. This is either constant by construction, or will be set fixed implicitly by the temperature and equation of state. ---*/ @@ -2469,6 +2529,7 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool viscous = config->GetViscous(); + bool Energy_Multicomponent = (config->GetKind_Species_Model()==SPECIES_MODEL::SPECIES_TRANSPORT) && config->GetEnergy_Equation(); string Marker_Tag = config->GetMarker_All_TagBound(val_marker); su2double Normal[MAXNDIM] = {0.0}; @@ -2591,6 +2652,15 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, V_outlet[prim_idx.CpTotal()] = nodes->GetSpecificHeatCp(iPoint); + /*-- Enthalpy is needed for energy equation in multicomponent and reacting flows. ---*/ + if (Energy_Multicomponent) { + CFluidModel* auxFluidModel = solver_container[FLOW_SOL]->GetFluidModel();; + const su2double* scalar_outlet = solver_container[SPECIES_SOL]->GetNodes()->GetSolution(iPoint); + auxFluidModel->SetTDState_T(nodes->GetTemperature(iPoint), + scalar_outlet); // compute total enthalpy from temperature + V_outlet[prim_idx.Enthalpy()] = auxFluidModel->GetEnthalpy(); + } + /*--- Set various quantities in the solver class ---*/ conv_numerics->SetPrimitive(V_domain, V_outlet); diff --git a/SU2_CFD/src/variables/CIncEulerVariable.cpp b/SU2_CFD/src/variables/CIncEulerVariable.cpp index 089845f6eb31..b2c6d8489717 100644 --- a/SU2_CFD/src/variables/CIncEulerVariable.cpp +++ b/SU2_CFD/src/variables/CIncEulerVariable.cpp @@ -30,7 +30,7 @@ CIncEulerVariable::CIncEulerVariable(su2double pressure, const su2double *velocity, su2double temperature, unsigned long npoint, unsigned long ndim, unsigned long nvar, const CConfig *config) - : CFlowVariable(npoint, ndim, nvar, ndim + 9, + : CFlowVariable(npoint, ndim, nvar, ndim + 10, ndim + (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED ? 2 : 4), config), indices(ndim, 0) { diff --git a/SU2_CFD/src/variables/CIncNSVariable.cpp b/SU2_CFD/src/variables/CIncNSVariable.cpp index cbcfa3b0aad6..7e2c80b9909d 100644 --- a/SU2_CFD/src/variables/CIncNSVariable.cpp +++ b/SU2_CFD/src/variables/CIncNSVariable.cpp @@ -46,19 +46,27 @@ CIncNSVariable::CIncNSVariable(su2double pressure, const su2double *velocity, su AuxVar.resize(nPoint,nAuxVar) = su2double(0.0); Grad_AuxVar.resize(nPoint,nAuxVar,nDim); } + if ((config->GetKind_Species_Model()==SPECIES_MODEL::SPECIES_TRANSPORT) && config->GetEnergy_Equation()){ + Energy_Multicomponent = true; + } } bool CIncNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel, const su2double *scalar) { bool physical = true; + su2double Temperature; /*--- Set the value of the pressure ---*/ SetPressure(iPoint); - /*--- Set the value of the temperature directly ---*/ - - su2double Temperature = Solution(iPoint, indices.Temperature()); + if(Energy_Multicomponent){ + su2double Enthalpy = Solution(iPoint, nDim +1); + Temperature = FluidModel->ComputeTempFromEnthalpy(Enthalpy, scalar); + } else { + /*--- Set the value of the temperature directly ---*/ + Temperature = Solution(iPoint, indices.Temperature()); + } auto check_temp = SetTemperature(iPoint, Temperature); /*--- Use the fluid model to compute the new value of density. @@ -69,11 +77,13 @@ bool CIncNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2do FluidModel->SetTDState_T(Temperature, scalar); - /*--- for FLAMELET: copy the LUT temperature into the solution ---*/ - Solution(iPoint,nDim+1) = FluidModel->GetTemperature(); - /*--- for FLAMELET: update the local temperature using LUT variables ---*/ - Temperature = Solution(iPoint,indices.Temperature()); - check_temp = SetTemperature(iPoint, Temperature); + if (!Energy_Multicomponent) { + /*--- for FLAMELET: copy the LUT temperature into the solution ---*/ + Solution(iPoint, nDim + 1) = FluidModel->GetTemperature(); + /*--- for FLAMELET: update the local temperature using LUT variables ---*/ + Temperature = Solution(iPoint, indices.Temperature()); + check_temp = SetTemperature(iPoint, Temperature); + } /*--- Set the value of the density ---*/ @@ -90,9 +100,14 @@ bool CIncNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2do /*--- Recompute the primitive variables ---*/ - Temperature = Solution(iPoint, indices.Temperature()); + if (Energy_Multicomponent) { + su2double Enthalpy = Solution(iPoint, nDim + 1); + Temperature = FluidModel->ComputeTempFromEnthalpy(Enthalpy, scalar); + } else { + Temperature = Solution(iPoint, indices.Temperature()); + FluidModel->SetTDState_T(Temperature, scalar); + } SetTemperature(iPoint, Temperature); - FluidModel->SetTDState_T(Temperature, scalar); SetDensity(iPoint, FluidModel->GetDensity()); /*--- Flag this point as non-physical. ---*/ @@ -122,6 +137,7 @@ bool CIncNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2do SetSpecificHeatCp(iPoint, FluidModel->GetCp()); SetSpecificHeatCv(iPoint, FluidModel->GetCv()); + if (Energy_Multicomponent) SetEnthalpy(iPoint, FluidModel->GetEnthalpy()); return physical; diff --git a/SU2_PY/SU2/io/historyMap.py b/SU2_PY/SU2/io/historyMap.py index a477478359c0..be17da146431 100644 --- a/SU2_PY/SU2/io/historyMap.py +++ b/SU2_PY/SU2/io/historyMap.py @@ -244,6 +244,12 @@ "HEADER": "bgs[T]", "TYPE": "RESIDUAL", }, + "BGS_ENTHALPY": { + "DESCRIPTION": "Block-Gauss-Seidel residual of the " "enthalpy", + "GROUP": "BGS_RES", + "HEADER": "bgs[h]", + "TYPE": "RESIDUAL", + }, "BGS_TKE": { "DESCRIPTION": "BGS residual of kinetic energy (SST model).", "GROUP": "BGS_RES", @@ -894,6 +900,12 @@ "HEADER": "max[T]", "TYPE": "RESIDUAL", }, + "MAX_ENTHALPY": { + "DESCRIPTION": "Maximum residual of the enthalpy", + "GROUP": "MAX_RES", + "HEADER": "max[h]", + "TYPE": "RESIDUAL", + }, "MAX_TKE": { "DESCRIPTION": "Maximum residual of kinetic energy (SST model).", "GROUP": "MAX_RES", @@ -1154,6 +1166,12 @@ "HEADER": "rms[T]", "TYPE": "RESIDUAL", }, + "RMS_ENTHALPY": { + "DESCRIPTION": "Root mean square residual of the " "enthalpy", + "GROUP": "RMS_RES", + "HEADER": "rms[h]", + "TYPE": "RESIDUAL", + }, "RMS_TKE": { "DESCRIPTION": "Root-mean square residual of kinetic energy (SST " "model).", "GROUP": "RMS_RES", From 0487a68c028ac1f3ba4ceb77927222b0152144b8 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Fri, 25 Oct 2024 10:36:21 +0200 Subject: [PATCH 02/97] fixing flux jacobian --- SU2_CFD/include/numerics/flow/flow_diffusion.hpp | 1 + SU2_CFD/src/numerics/flow/flow_diffusion.cpp | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/include/numerics/flow/flow_diffusion.hpp b/SU2_CFD/include/numerics/flow/flow_diffusion.hpp index 654bc91e6ac7..558d035eb1b1 100644 --- a/SU2_CFD/include/numerics/flow/flow_diffusion.hpp +++ b/SU2_CFD/include/numerics/flow/flow_diffusion.hpp @@ -287,6 +287,7 @@ class CAvgGrad_Flow final : public CAvgGrad_Base { class CAvgGradInc_Flow final : public CAvgGrad_Base { private: su2double Mean_Thermal_Conductivity; /*!< \brief Mean value of the effective thermal conductivity. */ + su2double Mean_Heat_Capacity; /*!< \brief Mean value of the heat capacity. */ bool energy; /*!< \brief computation with the energy equation. */ /*! diff --git a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp index a2cdb8935339..2e95a6ea0204 100644 --- a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp +++ b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp @@ -583,6 +583,10 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi Laminar_Viscosity_i = V_i[nDim+4]; Laminar_Viscosity_j = V_j[nDim+4]; Eddy_Viscosity_i = V_i[nDim+5]; Eddy_Viscosity_j = V_j[nDim+5]; Thermal_Conductivity_i = V_i[nDim+6]; Thermal_Conductivity_j = V_j[nDim+6]; + if (multicomponent_energy) { + Cp_i = V_i[nDim + 7]; + Cp_j = V_j[nDim + 7]; + } /*--- Mean transport properties ---*/ @@ -590,6 +594,7 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi Mean_Eddy_Viscosity = 0.5*(Eddy_Viscosity_i + Eddy_Viscosity_j); Mean_turb_ke = 0.5*(turb_ke_i + turb_ke_j); Mean_Thermal_Conductivity = 0.5*(Thermal_Conductivity_i + Thermal_Conductivity_j); + if (multicomponent_energy) Mean_Heat_Capacity = 0.5 * (Cp_i + Cp_j); /*--- Mean gradient approximation ---*/ @@ -649,8 +654,13 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi proj_vector_ij += (Coord_j[iDim]-Coord_i[iDim])*Normal[iDim]; } proj_vector_ij = proj_vector_ij/dist_ij_2; - Jacobian_i[nDim+1][nDim+1] = -Mean_Thermal_Conductivity*proj_vector_ij; - Jacobian_j[nDim+1][nDim+1] = Mean_Thermal_Conductivity*proj_vector_ij; + if (multicomponent_energy){ + Jacobian_i[nDim + 1][nDim + 1] = -Mean_Thermal_Conductivity * proj_vector_ij / Mean_Heat_Capacity; + Jacobian_j[nDim + 1][nDim + 1] = Mean_Thermal_Conductivity * proj_vector_ij / Mean_Heat_Capacity; + } else { + Jacobian_i[nDim + 1][nDim + 1] = -Mean_Thermal_Conductivity * proj_vector_ij; + Jacobian_j[nDim + 1][nDim + 1] = Mean_Thermal_Conductivity * proj_vector_ij; + } } } From 5076f9d3aea689a4de5104b8afd6095e39e44ce6 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sat, 26 Oct 2024 18:00:46 +0200 Subject: [PATCH 03/97] fix output error --- SU2_CFD/src/output/CFlowIncOutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index ac61e806092d..022af8869527 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -454,7 +454,7 @@ 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 (multicomponent) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetTemperature(iPoint)); + if (multicomponent && heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetTemperature(iPoint)); } SetVolumeOutputValue("RES_PRESSURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 0)); From 09fe6f4e4e8bb8496e14344a7319206957cf2de4 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Thu, 31 Oct 2024 21:36:03 +0100 Subject: [PATCH 04/97] adding enthalpy diffusion --- SU2_CFD/include/fluid/CFluidModel.hpp | 10 +++++ SU2_CFD/include/fluid/CFluidScalar.hpp | 30 ++++++++++++- SU2_CFD/include/numerics/CNumerics.hpp | 28 ++++++++++++ .../include/numerics/flow/flow_diffusion.hpp | 9 ++-- .../include/solvers/CFVMFlowSolverBase.inl | 37 +++++++++++++++- SU2_CFD/src/numerics/flow/flow_diffusion.cpp | 44 ++++++++++++++++--- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 4 +- 7 files changed, 150 insertions(+), 12 deletions(-) diff --git a/SU2_CFD/include/fluid/CFluidModel.hpp b/SU2_CFD/include/fluid/CFluidModel.hpp index 29cb44fcc033..2ed618eff339 100644 --- a/SU2_CFD/include/fluid/CFluidModel.hpp +++ b/SU2_CFD/include/fluid/CFluidModel.hpp @@ -192,6 +192,16 @@ class CFluidModel { return mass_diffusivity; } + /*! + * \brief Get heat diffusivity. + */ + inline virtual su2double GetEnthalpyDiffusivity(const su2double* val_scalars = nullptr) { return 0.0; } + + /*! + * \brief Get gradient heat diffusivity. + */ + inline virtual su2double GetGradEnthalpyDiffusivity(const su2double* val_scalars = nullptr) { return 0.0; } + /*! * \brief Get fluid pressure partial derivative. */ diff --git a/SU2_CFD/include/fluid/CFluidScalar.hpp b/SU2_CFD/include/fluid/CFluidScalar.hpp index 527adbf6ffad..70faa111b473 100644 --- a/SU2_CFD/include/fluid/CFluidScalar.hpp +++ b/SU2_CFD/include/fluid/CFluidScalar.hpp @@ -44,6 +44,8 @@ class CFluidScalar final : public CFluidModel { const su2double Pressure_Thermodynamic; /*!< \brief Constant pressure thermodynamic. */ const su2double GasConstant_Ref; /*!< \brief Gas constant reference needed for Nondimensional problems. */ const su2double Prandtl_Number; /*!< \brief Prandlt number.*/ + su2double enthalpyDiffusivity; /*!< \brief enthalpy diffusion coefficient. */ + su2double gradEnthalpyDiffusivity; /*!< \brief gradient enthalpy diffusion coefficient. */ const bool wilke; const bool davidson; @@ -94,7 +96,7 @@ class CFluidScalar final : public CFluidModel { /*! * \brief Compute Enthalpy given the temperature and scalars. */ - su2double ComputeEnthalpyFromT(const su2double val_enthalpy, const su2double* val_scalars); + su2double ComputeEnthalpyFromT(const su2double val_temperature, const su2double* val_scalars); /*! * \brief Compute gas constant for mixture. @@ -142,6 +144,32 @@ class CFluidScalar final : public CFluidModel { */ inline su2double GetMassDiffusivity(int ivar) override { return massDiffusivity[ivar]; } + /*! + * \brief Get enthalpy diffusivity. + */ + inline su2double GetEnthalpyDiffusivity(const su2double* val_scalars) override { + enthalpyDiffusivity = 0.0; + for (int iVar = 0; iVar < n_species_mixture - 1; iVar++) { + enthalpyDiffusivity += (specificHeat[iVar] * massDiffusivity[iVar] - + specificHeat[n_species_mixture - 1] * massDiffusivity[n_species_mixture - 1]) * + (Temperature - 298.15) * val_scalars[iVar]; + } + return enthalpyDiffusivity; + } + + /*! + * \brief Get gradient enthalpy diffusivity. + */ + inline su2double GetGradEnthalpyDiffusivity(const su2double* val_scalars) override { + gradEnthalpyDiffusivity = 0.0; + for (int iVar = 0; iVar < n_species_mixture - 1; iVar++) { + gradEnthalpyDiffusivity += Density * (specificHeat[iVar] * massDiffusivity[iVar] - + specificHeat[n_species_mixture - 1] * massDiffusivity[n_species_mixture - 1]) * + val_scalars[iVar]; + } + return gradEnthalpyDiffusivity; + } + /*! * \brief Compute Temperature from Enthalpy and scalars. */ diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index f5b0634030fc..da6f64fa23bc 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -131,6 +131,12 @@ class CNumerics { *ScalarVar_i, /*!< \brief Vector of scalar variables at point i. */ *ScalarVar_j; /*!< \brief Vector of scalar variables at point j. */ const su2double + *HeatDiffusion_i, /*!< \brief Vector of heat diffusion for multicomponent at point i. */ + *HeatDiffusion_j; /*!< \brief Vector of heat diffusion for multicomponent at point j. */ + const su2double + *GradHeatDiffusion_i, /*!< \brief Vector of heat diffusion for multicomponent at point i. */ + *GradHeatDiffusion_j; /*!< \brief Vector of heat diffusion for multicomponent at point j. */ + const su2double *TransVar_i, /*!< \brief Vector of turbulent variables at point i. */ *TransVar_j; /*!< \brief Vector of turbulent variables at point j. */ const su2double @@ -753,6 +759,28 @@ class CNumerics { Diffusion_Coeff_j = val_diffusioncoeff_j; } + /*! + * \brief Set the heat diffusion + * \param[in] val_heatdiffusion_i - Value of the heat diffusion at i. + * \param[in] val_heatdiffusion_j - Value of the heat diffusion at j + */ + inline void SetHeatDiffusion(const su2double* val_heatdiffusion_i, + const su2double* val_heatdiffusion_j) { + HeatDiffusion_i = val_heatdiffusion_i; + HeatDiffusion_j = val_heatdiffusion_j; + } + + /*! + * \brief Set the heat diffusion + * \param[in] val_gradheatdiffusion_i - Value of the heat diffusion at i. + * \param[in] val_gradheatdiffusion_j - Value of the heat diffusion at j + */ + inline void SetGradHeatDiffusion(const su2double* val_gradheatdiffusion_i, + const su2double* val_gradheatdiffusion_j) { + GradHeatDiffusion_i = val_gradheatdiffusion_i; + GradHeatDiffusion_j = val_gradheatdiffusion_j; + } + /*! * \brief Set the laminar viscosity. * \param[in] val_laminar_viscosity_i - Value of the laminar viscosity at point i. diff --git a/SU2_CFD/include/numerics/flow/flow_diffusion.hpp b/SU2_CFD/include/numerics/flow/flow_diffusion.hpp index 558d035eb1b1..be24cddb6e11 100644 --- a/SU2_CFD/include/numerics/flow/flow_diffusion.hpp +++ b/SU2_CFD/include/numerics/flow/flow_diffusion.hpp @@ -51,6 +51,8 @@ class CAvgGrad_Base : public CNumerics { *heat_flux_jac_i = nullptr, /*!< \brief Jacobian of the molecular + turbulent heat flux vector, projected onto the normal vector. */ **tau_jacobian_i = nullptr; /*!< \brief Jacobian of the viscous + turbulent stress tensor, projected onto the normal vector. */ su2double *Mean_PrimVar = nullptr; /*!< \brief Mean primitive variables. */ + su2double *Mean_GradSecVar = nullptr; /*!< \brief Mean gradient secundary variable for multicomponent flows. */ + su2double *Mean_JacSecVar = nullptr; /*!< \brief Mean jacobian secundary variables for multicomponent flows. */ const su2double *PrimVar_i = nullptr, *PrimVar_j = nullptr; /*!< \brief Primitives variables at point i and j. */ @@ -288,6 +290,7 @@ class CAvgGradInc_Flow final : public CAvgGrad_Base { private: su2double Mean_Thermal_Conductivity; /*!< \brief Mean value of the effective thermal conductivity. */ su2double Mean_Heat_Capacity; /*!< \brief Mean value of the heat capacity. */ + su2double Mean_Density; /*!< \brief Mean value of the density. */ bool energy; /*!< \brief computation with the energy equation. */ /*! @@ -299,10 +302,10 @@ class CAvgGradInc_Flow final : public CAvgGrad_Base { * \param[in] val_gradprimvar - Gradient of the primitive variables. * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face. * \param[in] val_thermal_conductivity - Thermal conductivity. + * \param[in] val_heatDiffusion - Heat diffusion */ - void GetViscousIncProjFlux(const su2double* const *val_gradprimvar, - const su2double *val_normal, - su2double val_thermal_conductivity); + void GetViscousIncProjFlux(const su2double* const* val_gradprimvar, const su2double* val_normal, + su2double val_thermal_conductivity, const su2double* val_heatDiffusion = nullptr); /*! * \brief Compute the projection of the viscous Jacobian matrices. diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 4797293529f6..499478c18285 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -31,6 +31,7 @@ #include "../limiters/computeLimiters.hpp" #include "../numerics_simd/CNumericsSIMD.hpp" #include "CFVMFlowSolverBase.hpp" +#include "../../include/variables/CSpeciesVariable.hpp" template void CFVMFlowSolverBase::AeroCoeffsArray::allocate(int size) { @@ -433,9 +434,14 @@ void CFVMFlowSolverBase::Viscous_Residual_impl(unsigned long iEdge, CGeome const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST); + const bool speciesEnergy = (config->GetKind_Species_Model()==SPECIES_MODEL::SPECIES_TRANSPORT) && config->GetEnergy_Equation(); - CVariable* turbNodes = nullptr; + CVariable* turbNodes = nullptr; + //CVariable* speciesNodes = nullptr; if (tkeNeeded) turbNodes = solver_container[TURB_SOL]->GetNodes(); + //if (speciesEnergy) speciesNodes = solver_container[SPECIES_SOL]->GetNodes(); + + auto* speciesNodes = su2staticcast_p(solver_container[SPECIES_SOL]->GetNodes()); /*--- Points, coordinates and normal vector in edge ---*/ @@ -465,6 +471,35 @@ void CFVMFlowSolverBase::Viscous_Residual_impl(unsigned long iEdge, CGeome if (tkeNeeded) numerics->SetTurbKineticEnergy(turbNodes->GetSolution(iPoint,0), turbNodes->GetSolution(jPoint,0)); + /*--- Conservative variables w/o reconstruction ---*/ + + if (speciesEnergy) { + CFluidModel* FluidModel = solver_container[FLOW_SOL]->GetFluidModel(); + FluidModel->SetTDState_T(nodes->GetPrimitive(iPoint)[prim_idx.Temperature()], speciesNodes->GetSolution(iPoint)); + const int n_species = config->GetnSpecies(); + su2double GradientScalar[n_species]; + su2double HeatDiffusion_i[nDim]; + su2double GradDiffusion_i[nDim]; + for (int i = 0; i < nDim; i++) { + for (int i_species = 0; i_species < n_species; i_species++) { + GradientScalar[i_species] = speciesNodes->GetGradient(iPoint)[i_species][i]; + } + HeatDiffusion_i[i] = FluidModel->GetEnthalpyDiffusivity(GradientScalar); + GradDiffusion_i[i] = FluidModel->GetGradEnthalpyDiffusivity(GradientScalar); + } + FluidModel->SetTDState_T(nodes->GetPrimitive(jPoint)[prim_idx.Temperature()], speciesNodes->GetSolution(jPoint)); + su2double HeatDiffusion_j[nDim]; + su2double GradDiffusion_j[nDim]; + for (int i = 0; i < nDim; i++) { + for (int i_species = 0; i_species < n_species; i_species++) { + GradientScalar[i_species] = speciesNodes->GetGradient(iPoint)[i_species][i]; + } + HeatDiffusion_j[i] = FluidModel->GetEnthalpyDiffusivity(GradientScalar); + GradDiffusion_j[i] = FluidModel->GetGradEnthalpyDiffusivity(GradientScalar); + } + numerics->SetHeatDiffusion(HeatDiffusion_i, HeatDiffusion_j); + numerics->SetGradHeatDiffusion(GradDiffusion_i, GradDiffusion_j); + } /*--- Wall shear stress values (wall functions) ---*/ diff --git a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp index 2e95a6ea0204..5661e75d7016 100644 --- a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp +++ b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp @@ -50,6 +50,9 @@ CAvgGrad_Base::CAvgGrad_Base(unsigned short val_nDim, for (iVar = 0; iVar < nPrimVar; iVar++) Mean_GradPrimVar[iVar] = new su2double [nDim]; + Mean_GradSecVar = new su2double[nDim]; + Mean_JacSecVar = new su2double[nDim]; + Proj_Mean_GradPrimVar_Edge = new su2double[val_nPrimVar]; tau_jacobian_i = new su2double* [nDim]; @@ -71,6 +74,8 @@ CAvgGrad_Base::CAvgGrad_Base(unsigned short val_nDim, CAvgGrad_Base::~CAvgGrad_Base() { delete [] Mean_PrimVar; + delete [] Mean_GradSecVar; + delete [] Mean_JacSecVar; if (Mean_GradPrimVar != nullptr) { for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) @@ -586,6 +591,8 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi if (multicomponent_energy) { Cp_i = V_i[nDim + 7]; Cp_j = V_j[nDim + 7]; + Density_i = V_i[nDim + 2]; + Density_j = V_i[nDim + 2]; } /*--- Mean transport properties ---*/ @@ -594,7 +601,10 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi Mean_Eddy_Viscosity = 0.5*(Eddy_Viscosity_i + Eddy_Viscosity_j); Mean_turb_ke = 0.5*(turb_ke_i + turb_ke_j); Mean_Thermal_Conductivity = 0.5*(Thermal_Conductivity_i + Thermal_Conductivity_j); - if (multicomponent_energy) Mean_Heat_Capacity = 0.5 * (Cp_i + Cp_j); + if (multicomponent_energy) { + Mean_Heat_Capacity = 0.5 * (Cp_i + Cp_j); + Mean_Density = 0.5 * (Density_i + Density_j); + } /*--- Mean gradient approximation ---*/ @@ -628,7 +638,14 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi if (config->GetSAParsedOptions().qcr2000) AddQCR(nDim, &Mean_GradPrimVar[1], tau); if (Mean_TauWall > 0) AddTauWall(UnitNormal, Mean_TauWall); - GetViscousIncProjFlux(Mean_GradPrimVar, Normal, Mean_Thermal_Conductivity); + if (multicomponent_energy) { + for (iDim = 0; iDim < nDim; iDim++) { + Mean_GradSecVar[iDim] = 0.5 * (HeatDiffusion_i[iDim] + HeatDiffusion_j[iDim]) * Mean_Density; + Mean_JacSecVar[iDim] = 0.5 * (GradHeatDiffusion_i[iDim] + GradHeatDiffusion_j[iDim]); + } + } + + GetViscousIncProjFlux(Mean_GradPrimVar, Normal, Mean_Thermal_Conductivity, Mean_GradSecVar); /*--- Implicit part ---*/ @@ -655,8 +672,14 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi } proj_vector_ij = proj_vector_ij/dist_ij_2; if (multicomponent_energy){ - Jacobian_i[nDim + 1][nDim + 1] = -Mean_Thermal_Conductivity * proj_vector_ij / Mean_Heat_Capacity; - Jacobian_j[nDim + 1][nDim + 1] = Mean_Thermal_Conductivity * proj_vector_ij / Mean_Heat_Capacity; + su2double projJacGradSecVar= 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + projJacGradSecVar += Mean_JacSecVar[iDim] * Normal[iDim]; + } + Jacobian_i[nDim + 1][nDim + 1] = + -(Mean_Thermal_Conductivity * proj_vector_ij + projJacGradSecVar) / Mean_Heat_Capacity; + Jacobian_j[nDim + 1][nDim + 1] = + (Mean_Thermal_Conductivity * proj_vector_ij + projJacGradSecVar) / Mean_Heat_Capacity; } else { Jacobian_i[nDim + 1][nDim + 1] = -Mean_Thermal_Conductivity * proj_vector_ij; Jacobian_j[nDim + 1][nDim + 1] = Mean_Thermal_Conductivity * proj_vector_ij; @@ -687,7 +710,8 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi void CAvgGradInc_Flow::GetViscousIncProjFlux(const su2double* const *val_gradprimvar, const su2double *val_normal, - su2double val_thermal_conductivity) { + su2double val_thermal_conductivity, + const su2double *val_heatDiffusion) { /*--- Gradient of primitive variables -> [Pressure vel_x vel_y vel_z Temperature] ---*/ @@ -703,6 +727,10 @@ void CAvgGradInc_Flow::GetViscousIncProjFlux(const su2double* const *val_gradpri Flux_Tensor[1][1] = tau[1][0]; Flux_Tensor[2][1] = tau[1][1]; Flux_Tensor[3][1] = val_thermal_conductivity*val_gradprimvar[nDim+1][1]; + if (multicomponent_energy) { + Flux_Tensor[3][0] += val_heatDiffusion[0]; + Flux_Tensor[3][1] += val_heatDiffusion[1]; + } } else { @@ -724,6 +752,12 @@ void CAvgGradInc_Flow::GetViscousIncProjFlux(const su2double* const *val_gradpri Flux_Tensor[3][2] = tau[2][2]; Flux_Tensor[4][2] = val_thermal_conductivity*val_gradprimvar[nDim+1][2]; + if (multicomponent_energy) { + Flux_Tensor[4][0] += val_heatDiffusion[0]; + Flux_Tensor[4][1] += val_heatDiffusion[1]; + Flux_Tensor[4][2] += val_heatDiffusion[2]; + } + } for (unsigned short iVar = 0; iVar < nVar; iVar++) { diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index 64b0f2cc91ff..f3de80979363 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -2477,7 +2477,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Viscous contribution, commented out because serious convergence problems ---*/ - if (!viscous) continue; + if (!viscous || Energy_Multicomponent) continue; /*--- Set transport properties at the inlet ---*/ @@ -2685,7 +2685,7 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, /*--- Viscous contribution, commented out because serious convergence problems ---*/ - if (!viscous) continue; + if (!viscous || Energy_Multicomponent) continue; /*--- Set transport properties at the outlet. ---*/ From f258308fbf96a6dc39ab698ba9dbfc90354eeae8 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sun, 3 Nov 2024 10:52:03 +0100 Subject: [PATCH 05/97] moving enthalpy diffusion terms to CIncNSSolver.cpp --- .../include/solvers/CFVMFlowSolverBase.inl | 35 --------------- SU2_CFD/src/solvers/CIncNSSolver.cpp | 45 ++++++++++++++++++- 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 499478c18285..fe207611f7d5 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -31,7 +31,6 @@ #include "../limiters/computeLimiters.hpp" #include "../numerics_simd/CNumericsSIMD.hpp" #include "CFVMFlowSolverBase.hpp" -#include "../../include/variables/CSpeciesVariable.hpp" template void CFVMFlowSolverBase::AeroCoeffsArray::allocate(int size) { @@ -434,14 +433,9 @@ void CFVMFlowSolverBase::Viscous_Residual_impl(unsigned long iEdge, CGeome const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST); - const bool speciesEnergy = (config->GetKind_Species_Model()==SPECIES_MODEL::SPECIES_TRANSPORT) && config->GetEnergy_Equation(); CVariable* turbNodes = nullptr; - //CVariable* speciesNodes = nullptr; if (tkeNeeded) turbNodes = solver_container[TURB_SOL]->GetNodes(); - //if (speciesEnergy) speciesNodes = solver_container[SPECIES_SOL]->GetNodes(); - - auto* speciesNodes = su2staticcast_p(solver_container[SPECIES_SOL]->GetNodes()); /*--- Points, coordinates and normal vector in edge ---*/ @@ -471,35 +465,6 @@ void CFVMFlowSolverBase::Viscous_Residual_impl(unsigned long iEdge, CGeome if (tkeNeeded) numerics->SetTurbKineticEnergy(turbNodes->GetSolution(iPoint,0), turbNodes->GetSolution(jPoint,0)); - /*--- Conservative variables w/o reconstruction ---*/ - - if (speciesEnergy) { - CFluidModel* FluidModel = solver_container[FLOW_SOL]->GetFluidModel(); - FluidModel->SetTDState_T(nodes->GetPrimitive(iPoint)[prim_idx.Temperature()], speciesNodes->GetSolution(iPoint)); - const int n_species = config->GetnSpecies(); - su2double GradientScalar[n_species]; - su2double HeatDiffusion_i[nDim]; - su2double GradDiffusion_i[nDim]; - for (int i = 0; i < nDim; i++) { - for (int i_species = 0; i_species < n_species; i_species++) { - GradientScalar[i_species] = speciesNodes->GetGradient(iPoint)[i_species][i]; - } - HeatDiffusion_i[i] = FluidModel->GetEnthalpyDiffusivity(GradientScalar); - GradDiffusion_i[i] = FluidModel->GetGradEnthalpyDiffusivity(GradientScalar); - } - FluidModel->SetTDState_T(nodes->GetPrimitive(jPoint)[prim_idx.Temperature()], speciesNodes->GetSolution(jPoint)); - su2double HeatDiffusion_j[nDim]; - su2double GradDiffusion_j[nDim]; - for (int i = 0; i < nDim; i++) { - for (int i_species = 0; i_species < n_species; i_species++) { - GradientScalar[i_species] = speciesNodes->GetGradient(iPoint)[i_species][i]; - } - HeatDiffusion_j[i] = FluidModel->GetEnthalpyDiffusivity(GradientScalar); - GradDiffusion_j[i] = FluidModel->GetGradEnthalpyDiffusivity(GradientScalar); - } - numerics->SetHeatDiffusion(HeatDiffusion_i, HeatDiffusion_j); - numerics->SetGradHeatDiffusion(GradDiffusion_i, GradDiffusion_j); - } /*--- Wall shear stress values (wall functions) ---*/ diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index 41cedcdb5f59..9971a2a2ddc9 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -275,7 +275,50 @@ void CIncNSSolver::Compute_Streamwise_Periodic_Recovered_Values(CConfig *config, void CIncNSSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config) { - + const bool speciesEnergy = + (config->GetKind_Species_Model() == SPECIES_MODEL::SPECIES_TRANSPORT) && config->GetEnergy_Equation(); + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + + /*--- Contribution to heat flux due to enthalpy diffusion for multicomponent and reacting flows ---*/ + if (speciesEnergy) { + CVariable* speciesNodes = solver_container[SPECIES_SOL]->GetNodes(); + /*--- Points in edge ---*/ + + auto iPoint = geometry->edges->GetNode(iEdge, 0); + auto jPoint = geometry->edges->GetNode(iEdge, 1); + CFluidModel* FluidModel = solver_container[FLOW_SOL]->GetFluidModel(); + FluidModel->SetTDState_T(nodes->GetPrimitive(iPoint)[prim_idx.Temperature()], speciesNodes->GetSolution(iPoint)); + const int n_species = config->GetnSpecies(); + static constexpr size_t MAXNVAR_SPECIES = 20UL; + su2double GradientScalar[MAXNVAR_SPECIES]; + su2double HeatDiffusion_i[MAXNDIM]; + su2double GradDiffusion_i[MAXNDIM]; + /*--- Loop over spatial dimensions to fill in the enthalpy diffusion with the gradient of scalar species. ---*/ + /*--- The gradients of species with respect to the i-spatial dimension are stored in GradientScalars. ---*/ + for (int i = 0; i < nDim; i++) { + for (int i_species = 0; i_species < n_species; i_species++) { + GradientScalar[i_species] = speciesNodes->GetGradient(iPoint)[i_species][i]; + } + /*--- The gradients due to enthalpy diffusion depend on the fluid model, in particular if we are solving for total + * enthalpy or sensible enthalpy. ---*/ + HeatDiffusion_i[i] = FluidModel->GetEnthalpyDiffusivity(GradientScalar); + if (implicit) GradDiffusion_i[i] = FluidModel->GetGradEnthalpyDiffusivity(GradientScalar); + } + /*--- Repeat the above computations for jPoint. ---*/ + FluidModel->SetTDState_T(nodes->GetPrimitive(jPoint)[prim_idx.Temperature()], speciesNodes->GetSolution(jPoint)); + su2double HeatDiffusion_j[MAXNDIM]; + su2double GradDiffusion_j[MAXNDIM]; + for (int i = 0; i < nDim; i++) { + for (int i_species = 0; i_species < n_species; i_species++) { + GradientScalar[i_species] = speciesNodes->GetGradient(iPoint)[i_species][i]; + } + HeatDiffusion_j[i] = FluidModel->GetEnthalpyDiffusivity(GradientScalar); + if (implicit) GradDiffusion_j[i] = FluidModel->GetGradEnthalpyDiffusivity(GradientScalar); + } + /*--- Enthalpy diffusion and gradient (for implicit iterations) ---*/ + numerics->SetHeatDiffusion(HeatDiffusion_i, HeatDiffusion_j); + if (implicit) numerics->SetGradHeatDiffusion(GradDiffusion_i, GradDiffusion_j); + } Viscous_Residual_impl(iEdge, geometry, solver_container, numerics, config); } From 63a8f372d378aa7a7064f0be17dfe743f5b41e87 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sun, 3 Nov 2024 13:57:03 +0100 Subject: [PATCH 06/97] small fix --- SU2_CFD/include/fluid/CFluidModel.hpp | 5 ++--- SU2_CFD/include/fluid/CFluidScalar.hpp | 3 ++- SU2_CFD/src/fluid/CFluidScalar.cpp | 6 +++--- SU2_CFD/src/variables/CIncNSVariable.cpp | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/SU2_CFD/include/fluid/CFluidModel.hpp b/SU2_CFD/include/fluid/CFluidModel.hpp index 2ed618eff339..2d80d373b0ee 100644 --- a/SU2_CFD/include/fluid/CFluidModel.hpp +++ b/SU2_CFD/include/fluid/CFluidModel.hpp @@ -359,9 +359,8 @@ class CFluidModel { * \brief Virtual member. * \param[in] val_enthalpy - Enthalpy value at the point. */ - inline virtual su2double ComputeTempFromEnthalpy(su2double val_enthalpy, const su2double* val_scalars = nullptr) { - 0.0; - } + virtual void ComputeTempFromEnthalpy(su2double val_enthalpy, su2double* val_temperature, + const su2double* val_scalars = nullptr) {} /*! * \brief Set fluid eddy viscosity provided by a turbulence model needed for computing effective thermal conductivity. diff --git a/SU2_CFD/include/fluid/CFluidScalar.hpp b/SU2_CFD/include/fluid/CFluidScalar.hpp index 70faa111b473..516b44579060 100644 --- a/SU2_CFD/include/fluid/CFluidScalar.hpp +++ b/SU2_CFD/include/fluid/CFluidScalar.hpp @@ -173,7 +173,8 @@ class CFluidScalar final : public CFluidModel { /*! * \brief Compute Temperature from Enthalpy and scalars. */ - inline su2double ComputeTempFromEnthalpy(const su2double val_temperature, const su2double* val_scalars) override; + void ComputeTempFromEnthalpy(const su2double val_enthalpy, su2double* val_temperature, + const su2double* val_scalars) override; /*! * \brief Set the Dimensionless State using Temperature. diff --git a/SU2_CFD/src/fluid/CFluidScalar.cpp b/SU2_CFD/src/fluid/CFluidScalar.cpp index e8c50c1f38ea..60b57df5ea43 100644 --- a/SU2_CFD/src/fluid/CFluidScalar.cpp +++ b/SU2_CFD/src/fluid/CFluidScalar.cpp @@ -217,11 +217,11 @@ su2double CFluidScalar::ComputeEnthalpyFromT(const su2double val_temperature, co return val_Enthalpy; } -su2double CFluidScalar::ComputeTempFromEnthalpy(const su2double val_enthalpy, const su2double* val_scalars){ +void CFluidScalar::ComputeTempFromEnthalpy(const su2double val_enthalpy, su2double* val_temperature, + const su2double* val_scalars) { MassToMoleFractions(val_scalars); su2double val_cp = ComputeMeanSpecificHeatCp(val_scalars); - su2double val_Temperature = val_enthalpy / val_cp + 298.15; - return val_Temperature; + *val_temperature = val_enthalpy / val_cp + 298.15; } void CFluidScalar::SetTDState_T(const su2double val_temperature, const su2double* val_scalars) { diff --git a/SU2_CFD/src/variables/CIncNSVariable.cpp b/SU2_CFD/src/variables/CIncNSVariable.cpp index 7e2c80b9909d..c2aae3bc8c88 100644 --- a/SU2_CFD/src/variables/CIncNSVariable.cpp +++ b/SU2_CFD/src/variables/CIncNSVariable.cpp @@ -62,7 +62,7 @@ bool CIncNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2do if(Energy_Multicomponent){ su2double Enthalpy = Solution(iPoint, nDim +1); - Temperature = FluidModel->ComputeTempFromEnthalpy(Enthalpy, scalar); + FluidModel->ComputeTempFromEnthalpy(Enthalpy, &Temperature, scalar); } else { /*--- Set the value of the temperature directly ---*/ Temperature = Solution(iPoint, indices.Temperature()); @@ -102,12 +102,12 @@ bool CIncNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2do if (Energy_Multicomponent) { su2double Enthalpy = Solution(iPoint, nDim + 1); - Temperature = FluidModel->ComputeTempFromEnthalpy(Enthalpy, scalar); + FluidModel->ComputeTempFromEnthalpy(Enthalpy, &Temperature, scalar); } else { Temperature = Solution(iPoint, indices.Temperature()); - FluidModel->SetTDState_T(Temperature, scalar); } SetTemperature(iPoint, Temperature); + FluidModel->SetTDState_T(Temperature, scalar); SetDensity(iPoint, FluidModel->GetDensity()); /*--- Flag this point as non-physical. ---*/ From 30d0b88f8707c2697123f5b1880f2e0040425740 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sat, 9 Nov 2024 16:12:22 +0100 Subject: [PATCH 07/97] cleaning and rewritting some functions --- SU2_CFD/include/fluid/CFluidModel.hpp | 8 +- SU2_CFD/include/fluid/CFluidScalar.hpp | 26 +----- SU2_CFD/include/numerics/CNumerics.hpp | 32 +++---- .../include/numerics/flow/flow_diffusion.hpp | 7 +- SU2_CFD/src/fluid/CFluidScalar.cpp | 17 ++++ SU2_CFD/src/numerics/flow/flow_diffusion.cpp | 40 ++------- SU2_CFD/src/solvers/CIncNSSolver.cpp | 84 ++++++++++++------- subprojects/MLPCpp | 2 +- 8 files changed, 105 insertions(+), 111 deletions(-) diff --git a/SU2_CFD/include/fluid/CFluidModel.hpp b/SU2_CFD/include/fluid/CFluidModel.hpp index 2d80d373b0ee..15dc1a83cc7e 100644 --- a/SU2_CFD/include/fluid/CFluidModel.hpp +++ b/SU2_CFD/include/fluid/CFluidModel.hpp @@ -193,14 +193,14 @@ class CFluidModel { } /*! - * \brief Get heat diffusivity. + * \brief Get heat diffusivity terms. */ - inline virtual su2double GetEnthalpyDiffusivity(const su2double* val_scalars = nullptr) { return 0.0; } + virtual void GetEnthalpyDiffusivity(su2double* enthalpy_diffusions = nullptr) {} /*! - * \brief Get gradient heat diffusivity. + * \brief Get gradient heat diffusivity terms. */ - inline virtual su2double GetGradEnthalpyDiffusivity(const su2double* val_scalars = nullptr) { return 0.0; } + virtual void GetGradEnthalpyDiffusivity(su2double* grad_enthalpy_diffusions = nullptr) {} /*! * \brief Get fluid pressure partial derivative. diff --git a/SU2_CFD/include/fluid/CFluidScalar.hpp b/SU2_CFD/include/fluid/CFluidScalar.hpp index 516b44579060..1db6307cd46e 100644 --- a/SU2_CFD/include/fluid/CFluidScalar.hpp +++ b/SU2_CFD/include/fluid/CFluidScalar.hpp @@ -44,8 +44,6 @@ class CFluidScalar final : public CFluidModel { const su2double Pressure_Thermodynamic; /*!< \brief Constant pressure thermodynamic. */ const su2double GasConstant_Ref; /*!< \brief Gas constant reference needed for Nondimensional problems. */ const su2double Prandtl_Number; /*!< \brief Prandlt number.*/ - su2double enthalpyDiffusivity; /*!< \brief enthalpy diffusion coefficient. */ - su2double gradEnthalpyDiffusivity; /*!< \brief gradient enthalpy diffusion coefficient. */ const bool wilke; const bool davidson; @@ -145,30 +143,14 @@ class CFluidScalar final : public CFluidModel { inline su2double GetMassDiffusivity(int ivar) override { return massDiffusivity[ivar]; } /*! - * \brief Get enthalpy diffusivity. + * \brief Get enthalpy diffusivity terms. */ - inline su2double GetEnthalpyDiffusivity(const su2double* val_scalars) override { - enthalpyDiffusivity = 0.0; - for (int iVar = 0; iVar < n_species_mixture - 1; iVar++) { - enthalpyDiffusivity += (specificHeat[iVar] * massDiffusivity[iVar] - - specificHeat[n_species_mixture - 1] * massDiffusivity[n_species_mixture - 1]) * - (Temperature - 298.15) * val_scalars[iVar]; - } - return enthalpyDiffusivity; - } + void GetEnthalpyDiffusivity(su2double* enthalpy_diffusions) override; /*! - * \brief Get gradient enthalpy diffusivity. + * \brief Get gradient enthalpy diffusivity terms. */ - inline su2double GetGradEnthalpyDiffusivity(const su2double* val_scalars) override { - gradEnthalpyDiffusivity = 0.0; - for (int iVar = 0; iVar < n_species_mixture - 1; iVar++) { - gradEnthalpyDiffusivity += Density * (specificHeat[iVar] * massDiffusivity[iVar] - - specificHeat[n_species_mixture - 1] * massDiffusivity[n_species_mixture - 1]) * - val_scalars[iVar]; - } - return gradEnthalpyDiffusivity; - } + void GetGradEnthalpyDiffusivity(su2double* grad_enthalpy_diffusions) override; /*! * \brief Compute Temperature from Enthalpy and scalars. diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index da6f64fa23bc..b59bb99982f7 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -130,12 +130,10 @@ class CNumerics { const su2double *ScalarVar_i, /*!< \brief Vector of scalar variables at point i. */ *ScalarVar_j; /*!< \brief Vector of scalar variables at point j. */ - const su2double - *HeatDiffusion_i, /*!< \brief Vector of heat diffusion for multicomponent at point i. */ - *HeatDiffusion_j; /*!< \brief Vector of heat diffusion for multicomponent at point j. */ - const su2double - *GradHeatDiffusion_i, /*!< \brief Vector of heat diffusion for multicomponent at point i. */ - *GradHeatDiffusion_j; /*!< \brief Vector of heat diffusion for multicomponent at point j. */ + su2double + HeatFluxDiffusion; /*!< \brief Heat flux due to enthalpy diffusion for multicomponent. */ + su2double + Jac_HeatFluxDiffusion; /*!< \brief Heat flux jacobian due to enthalpy diffusion for multicomponent. */ const su2double *TransVar_i, /*!< \brief Vector of turbulent variables at point i. */ *TransVar_j; /*!< \brief Vector of turbulent variables at point j. */ @@ -760,25 +758,17 @@ class CNumerics { } /*! - * \brief Set the heat diffusion - * \param[in] val_heatdiffusion_i - Value of the heat diffusion at i. - * \param[in] val_heatdiffusion_j - Value of the heat diffusion at j + * \brief Set the heat flux due to enthalpy diffusion + * \param[in] val_heatfluxdiffusion - Value of the heat flux due to enthalpy diffusion. */ - inline void SetHeatDiffusion(const su2double* val_heatdiffusion_i, - const su2double* val_heatdiffusion_j) { - HeatDiffusion_i = val_heatdiffusion_i; - HeatDiffusion_j = val_heatdiffusion_j; - } + inline void SetHeatFluxDiffusion(su2double val_heatfluxdiffusion) { HeatFluxDiffusion = val_heatfluxdiffusion; } /*! - * \brief Set the heat diffusion - * \param[in] val_gradheatdiffusion_i - Value of the heat diffusion at i. - * \param[in] val_gradheatdiffusion_j - Value of the heat diffusion at j + * \brief Set Jacobian of the heat flux due to enthalpy diffusion + * \param[in] val_jacheatfluxdiffusion - Value of the heat flux jacobian due to enthalpy diffusion. */ - inline void SetGradHeatDiffusion(const su2double* val_gradheatdiffusion_i, - const su2double* val_gradheatdiffusion_j) { - GradHeatDiffusion_i = val_gradheatdiffusion_i; - GradHeatDiffusion_j = val_gradheatdiffusion_j; + inline void SetJacHeatFluxDiffusion(su2double val_jac_heatfluxdiffusion) { + Jac_HeatFluxDiffusion = val_jac_heatfluxdiffusion; } /*! diff --git a/SU2_CFD/include/numerics/flow/flow_diffusion.hpp b/SU2_CFD/include/numerics/flow/flow_diffusion.hpp index be24cddb6e11..f3b997a97016 100644 --- a/SU2_CFD/include/numerics/flow/flow_diffusion.hpp +++ b/SU2_CFD/include/numerics/flow/flow_diffusion.hpp @@ -51,8 +51,8 @@ class CAvgGrad_Base : public CNumerics { *heat_flux_jac_i = nullptr, /*!< \brief Jacobian of the molecular + turbulent heat flux vector, projected onto the normal vector. */ **tau_jacobian_i = nullptr; /*!< \brief Jacobian of the viscous + turbulent stress tensor, projected onto the normal vector. */ su2double *Mean_PrimVar = nullptr; /*!< \brief Mean primitive variables. */ - su2double *Mean_GradSecVar = nullptr; /*!< \brief Mean gradient secundary variable for multicomponent flows. */ - su2double *Mean_JacSecVar = nullptr; /*!< \brief Mean jacobian secundary variables for multicomponent flows. */ + su2double Mean_HeatFluxDiffusion; /*!< \brief Mean heat flux due to enthalpy diffusion for multicomponent flows. */ + su2double Mean_JacHeatFluxDiffusion; /*!< \brief Mean Jacobian heat flux due to enthalpy diffusion for multicomponent flows. */ const su2double *PrimVar_i = nullptr, *PrimVar_j = nullptr; /*!< \brief Primitives variables at point i and j. */ @@ -290,7 +290,6 @@ class CAvgGradInc_Flow final : public CAvgGrad_Base { private: su2double Mean_Thermal_Conductivity; /*!< \brief Mean value of the effective thermal conductivity. */ su2double Mean_Heat_Capacity; /*!< \brief Mean value of the heat capacity. */ - su2double Mean_Density; /*!< \brief Mean value of the density. */ bool energy; /*!< \brief computation with the energy equation. */ /*! @@ -305,7 +304,7 @@ class CAvgGradInc_Flow final : public CAvgGrad_Base { * \param[in] val_heatDiffusion - Heat diffusion */ void GetViscousIncProjFlux(const su2double* const* val_gradprimvar, const su2double* val_normal, - su2double val_thermal_conductivity, const su2double* val_heatDiffusion = nullptr); + su2double val_thermal_conductivity, su2double val_heatFluxDiffusion); /*! * \brief Compute the projection of the viscous Jacobian matrices. diff --git a/SU2_CFD/src/fluid/CFluidScalar.cpp b/SU2_CFD/src/fluid/CFluidScalar.cpp index 60b57df5ea43..b52c3b0b0b55 100644 --- a/SU2_CFD/src/fluid/CFluidScalar.cpp +++ b/SU2_CFD/src/fluid/CFluidScalar.cpp @@ -224,6 +224,23 @@ void CFluidScalar::ComputeTempFromEnthalpy(const su2double val_enthalpy, su2doub *val_temperature = val_enthalpy / val_cp + 298.15; } +void CFluidScalar::GetEnthalpyDiffusivity(su2double* enthalpy_diffusions) { + for (int iVar = 0; iVar < n_species_mixture - 1; iVar++) { + enthalpy_diffusions[iVar] = Density * + (specificHeat[iVar] * massDiffusivity[iVar] - + specificHeat[n_species_mixture - 1] * massDiffusivity[n_species_mixture - 1]) * + (Temperature - 298.15); + } +} + +void CFluidScalar::GetGradEnthalpyDiffusivity(su2double* grad_enthalpy_diffusions){ + for (int iVar = 0; iVar < n_species_mixture - 1; iVar++) { + grad_enthalpy_diffusions[iVar] = Density * + (specificHeat[iVar] * massDiffusivity[iVar] - + specificHeat[n_species_mixture - 1] * massDiffusivity[n_species_mixture - 1]); + } +} + void CFluidScalar::SetTDState_T(const su2double val_temperature, const su2double* val_scalars) { MassToMoleFractions(val_scalars); ComputeGasConstant(); diff --git a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp index 5661e75d7016..8e3804a598b9 100644 --- a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp +++ b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp @@ -50,9 +50,6 @@ CAvgGrad_Base::CAvgGrad_Base(unsigned short val_nDim, for (iVar = 0; iVar < nPrimVar; iVar++) Mean_GradPrimVar[iVar] = new su2double [nDim]; - Mean_GradSecVar = new su2double[nDim]; - Mean_JacSecVar = new su2double[nDim]; - Proj_Mean_GradPrimVar_Edge = new su2double[val_nPrimVar]; tau_jacobian_i = new su2double* [nDim]; @@ -74,8 +71,6 @@ CAvgGrad_Base::CAvgGrad_Base(unsigned short val_nDim, CAvgGrad_Base::~CAvgGrad_Base() { delete [] Mean_PrimVar; - delete [] Mean_GradSecVar; - delete [] Mean_JacSecVar; if (Mean_GradPrimVar != nullptr) { for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) @@ -591,8 +586,6 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi if (multicomponent_energy) { Cp_i = V_i[nDim + 7]; Cp_j = V_j[nDim + 7]; - Density_i = V_i[nDim + 2]; - Density_j = V_i[nDim + 2]; } /*--- Mean transport properties ---*/ @@ -603,7 +596,6 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi Mean_Thermal_Conductivity = 0.5*(Thermal_Conductivity_i + Thermal_Conductivity_j); if (multicomponent_energy) { Mean_Heat_Capacity = 0.5 * (Cp_i + Cp_j); - Mean_Density = 0.5 * (Density_i + Density_j); } /*--- Mean gradient approximation ---*/ @@ -639,13 +631,11 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi if (Mean_TauWall > 0) AddTauWall(UnitNormal, Mean_TauWall); if (multicomponent_energy) { - for (iDim = 0; iDim < nDim; iDim++) { - Mean_GradSecVar[iDim] = 0.5 * (HeatDiffusion_i[iDim] + HeatDiffusion_j[iDim]) * Mean_Density; - Mean_JacSecVar[iDim] = 0.5 * (GradHeatDiffusion_i[iDim] + GradHeatDiffusion_j[iDim]); - } + Mean_HeatFluxDiffusion = HeatFluxDiffusion; + Mean_JacHeatFluxDiffusion = Jac_HeatFluxDiffusion; } - GetViscousIncProjFlux(Mean_GradPrimVar, Normal, Mean_Thermal_Conductivity, Mean_GradSecVar); + GetViscousIncProjFlux(Mean_GradPrimVar, Normal, Mean_Thermal_Conductivity, Mean_HeatFluxDiffusion); /*--- Implicit part ---*/ @@ -672,14 +662,10 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi } proj_vector_ij = proj_vector_ij/dist_ij_2; if (multicomponent_energy){ - su2double projJacGradSecVar= 0.0; - for (iDim = 0; iDim < nDim; iDim++) { - projJacGradSecVar += Mean_JacSecVar[iDim] * Normal[iDim]; - } Jacobian_i[nDim + 1][nDim + 1] = - -(Mean_Thermal_Conductivity * proj_vector_ij + projJacGradSecVar) / Mean_Heat_Capacity; + -(Mean_Thermal_Conductivity * proj_vector_ij + Mean_JacHeatFluxDiffusion) / Mean_Heat_Capacity; Jacobian_j[nDim + 1][nDim + 1] = - (Mean_Thermal_Conductivity * proj_vector_ij + projJacGradSecVar) / Mean_Heat_Capacity; + (Mean_Thermal_Conductivity * proj_vector_ij + Mean_JacHeatFluxDiffusion) / Mean_Heat_Capacity; } else { Jacobian_i[nDim + 1][nDim + 1] = -Mean_Thermal_Conductivity * proj_vector_ij; Jacobian_j[nDim + 1][nDim + 1] = Mean_Thermal_Conductivity * proj_vector_ij; @@ -711,7 +697,7 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi void CAvgGradInc_Flow::GetViscousIncProjFlux(const su2double* const *val_gradprimvar, const su2double *val_normal, su2double val_thermal_conductivity, - const su2double *val_heatDiffusion) { + su2double val_heatDiffusion) { /*--- Gradient of primitive variables -> [Pressure vel_x vel_y vel_z Temperature] ---*/ @@ -727,10 +713,6 @@ void CAvgGradInc_Flow::GetViscousIncProjFlux(const su2double* const *val_gradpri Flux_Tensor[1][1] = tau[1][0]; Flux_Tensor[2][1] = tau[1][1]; Flux_Tensor[3][1] = val_thermal_conductivity*val_gradprimvar[nDim+1][1]; - if (multicomponent_energy) { - Flux_Tensor[3][0] += val_heatDiffusion[0]; - Flux_Tensor[3][1] += val_heatDiffusion[1]; - } } else { @@ -752,12 +734,6 @@ void CAvgGradInc_Flow::GetViscousIncProjFlux(const su2double* const *val_gradpri Flux_Tensor[3][2] = tau[2][2]; Flux_Tensor[4][2] = val_thermal_conductivity*val_gradprimvar[nDim+1][2]; - if (multicomponent_energy) { - Flux_Tensor[4][0] += val_heatDiffusion[0]; - Flux_Tensor[4][1] += val_heatDiffusion[1]; - Flux_Tensor[4][2] += val_heatDiffusion[2]; - } - } for (unsigned short iVar = 0; iVar < nVar; iVar++) { @@ -765,7 +741,9 @@ void CAvgGradInc_Flow::GetViscousIncProjFlux(const su2double* const *val_gradpri for (unsigned short iDim = 0; iDim < nDim; iDim++) Proj_Flux_Tensor[iVar] += Flux_Tensor[iVar][iDim] * val_normal[iDim]; } - + if (multicomponent_energy) { + Proj_Flux_Tensor[nVar - 1] += val_heatDiffusion; + } } void CAvgGradInc_Flow::GetViscousIncProjJacs(su2double val_dS, diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index 9971a2a2ddc9..01f7fce0ab0a 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -278,7 +278,7 @@ void CIncNSSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CS const bool speciesEnergy = (config->GetKind_Species_Model() == SPECIES_MODEL::SPECIES_TRANSPORT) && config->GetEnergy_Equation(); const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - + /*--- Contribution to heat flux due to enthalpy diffusion for multicomponent and reacting flows ---*/ if (speciesEnergy) { CVariable* speciesNodes = solver_container[SPECIES_SOL]->GetNodes(); @@ -286,38 +286,66 @@ void CIncNSSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CS auto iPoint = geometry->edges->GetNode(iEdge, 0); auto jPoint = geometry->edges->GetNode(iEdge, 1); + + /*--- Points coordinates, and normal vector ---*/ + + const su2double* Normal = geometry->edges->GetNormal(iEdge); + const su2double* Coord_i = geometry->nodes->GetCoord(iPoint); + const su2double* Coord_j = geometry->nodes->GetCoord(jPoint); + + /*--- Obtain fluid model for computing the enthalpy diffusion terms. ---*/ + CFluidModel* FluidModel = solver_container[FLOW_SOL]->GetFluidModel(); - FluidModel->SetTDState_T(nodes->GetPrimitive(iPoint)[prim_idx.Temperature()], speciesNodes->GetSolution(iPoint)); - const int n_species = config->GetnSpecies(); + + /*--- retrieve number of species that are solved and set maximum static array ---*/ + + int n_species = config->GetnSpecies(); static constexpr size_t MAXNVAR_SPECIES = 20UL; - su2double GradientScalar[MAXNVAR_SPECIES]; - su2double HeatDiffusion_i[MAXNDIM]; - su2double GradDiffusion_i[MAXNDIM]; - /*--- Loop over spatial dimensions to fill in the enthalpy diffusion with the gradient of scalar species. ---*/ - /*--- The gradients of species with respect to the i-spatial dimension are stored in GradientScalars. ---*/ - for (int i = 0; i < nDim; i++) { - for (int i_species = 0; i_species < n_species; i_species++) { - GradientScalar[i_species] = speciesNodes->GetGradient(iPoint)[i_species][i]; - } - /*--- The gradients due to enthalpy diffusion depend on the fluid model, in particular if we are solving for total - * enthalpy or sensible enthalpy. ---*/ - HeatDiffusion_i[i] = FluidModel->GetEnthalpyDiffusivity(GradientScalar); - if (implicit) GradDiffusion_i[i] = FluidModel->GetGradEnthalpyDiffusivity(GradientScalar); - } + + /*--- Species variables, and its gradients ---*/ + const su2double* Species_i = speciesNodes->GetSolution(iPoint); + const su2double* Species_j = speciesNodes->GetSolution(jPoint); + CMatrixView Species_Grad_i = speciesNodes->GetGradient(iPoint); + CMatrixView Species_Grad_j = speciesNodes->GetGradient(iPoint); + + /*--- Compute Projected gradient for species variables ---*/ + su2double ProjGradScalarVarNoCorr[MAXNVAR_SPECIES]{0.0}; + su2double Proj_Mean_GradScalarVar[MAXNVAR_SPECIES]{0.0}; + su2double proj_vector_ij = numerics->ComputeProjectedGradient( + nDim, n_species, Normal, Coord_i, Coord_j, Species_Grad_i, Species_Grad_j, true, Species_i, Species_j, + ProjGradScalarVarNoCorr, Proj_Mean_GradScalarVar); + + /*--- Get enthalpy diffusion terms and its gradient(for implicit) for each species at point i. ---*/ + + su2double EnthalpyDiffusion_i[MAXNVAR_SPECIES]{0.0}; + su2double GradEnthalpyDiffusion_i[MAXNVAR_SPECIES]{0.0}; + FluidModel->SetTDState_T(nodes->GetPrimitive(iPoint)[prim_idx.Temperature()], Species_i); + FluidModel->GetEnthalpyDiffusivity(EnthalpyDiffusion_i); + if (implicit) FluidModel->GetGradEnthalpyDiffusivity(GradEnthalpyDiffusion_i); + /*--- Repeat the above computations for jPoint. ---*/ + + su2double EnthalpyDiffusion_j[MAXNVAR_SPECIES]{0.0}; + su2double GradEnthalpyDiffusion_j[MAXNVAR_SPECIES]{0.0}; FluidModel->SetTDState_T(nodes->GetPrimitive(jPoint)[prim_idx.Temperature()], speciesNodes->GetSolution(jPoint)); - su2double HeatDiffusion_j[MAXNDIM]; - su2double GradDiffusion_j[MAXNDIM]; - for (int i = 0; i < nDim; i++) { - for (int i_species = 0; i_species < n_species; i_species++) { - GradientScalar[i_species] = speciesNodes->GetGradient(iPoint)[i_species][i]; - } - HeatDiffusion_j[i] = FluidModel->GetEnthalpyDiffusivity(GradientScalar); - if (implicit) GradDiffusion_j[i] = FluidModel->GetGradEnthalpyDiffusivity(GradientScalar); + FluidModel->GetEnthalpyDiffusivity(EnthalpyDiffusion_j); + if (implicit) FluidModel->GetGradEnthalpyDiffusivity(GradEnthalpyDiffusion_j); + + /*--- Compute Enthalpy diffusion flux and its jacobian (for implicit iterations) ---*/ + su2double flux_enthalpy_diffusion = 0.0; + su2double jac_flux_enthalpy_diffusion = 0.0; + for (int i_species = 0; i_species < n_species; i_species++) { + flux_enthalpy_diffusion += + 0.5 * (EnthalpyDiffusion_i[i_species] + EnthalpyDiffusion_j[i_species]) * Proj_Mean_GradScalarVar[i_species]; + if (implicit) + jac_flux_enthalpy_diffusion += 0.5 * (GradEnthalpyDiffusion_i[i_species] + GradEnthalpyDiffusion_j[i_species]) * + Proj_Mean_GradScalarVar[i_species]; } - /*--- Enthalpy diffusion and gradient (for implicit iterations) ---*/ - numerics->SetHeatDiffusion(HeatDiffusion_i, HeatDiffusion_j); - if (implicit) numerics->SetGradHeatDiffusion(GradDiffusion_i, GradDiffusion_j); + + /*--- Set heat flux and jacobian (for implicit) due to enthalpy diffusion ---*/ + + numerics->SetHeatFluxDiffusion(flux_enthalpy_diffusion); + if (implicit) numerics->SetJacHeatFluxDiffusion(jac_flux_enthalpy_diffusion); } Viscous_Residual_impl(iEdge, geometry, solver_container, numerics, config); } diff --git a/subprojects/MLPCpp b/subprojects/MLPCpp index 6865a58b22f2..c19c53ea2b85 160000 --- a/subprojects/MLPCpp +++ b/subprojects/MLPCpp @@ -1 +1 @@ -Subproject commit 6865a58b22f21a92977839d9c93eae9522402f55 +Subproject commit c19c53ea2b85ccfb185f1c6c87044dc0b5bc7ae0 From 7f9273009cc59b625d6bb580e62bc1d7f29f5015 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Fri, 22 Nov 2024 21:10:36 +0100 Subject: [PATCH 08/97] axisymetric source term and corrected flux jacobian at the wall --- .../include/numerics/flow/flow_sources.hpp | 3 +- SU2_CFD/src/numerics/flow/flow_sources.cpp | 21 +++++++++---- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 30 +++++++++++++++++++ SU2_CFD/src/solvers/CIncNSSolver.cpp | 15 ++++++---- 4 files changed, 58 insertions(+), 11 deletions(-) diff --git a/SU2_CFD/include/numerics/flow/flow_sources.hpp b/SU2_CFD/include/numerics/flow/flow_sources.hpp index e4cb64e4b54e..5fb9ef05be98 100644 --- a/SU2_CFD/include/numerics/flow/flow_sources.hpp +++ b/SU2_CFD/include/numerics/flow/flow_sources.hpp @@ -126,7 +126,8 @@ class CSourceGeneralAxisymmetric_Flow final : public CSourceAxisymmetric_Flow { class CSourceIncAxisymmetric_Flow final : public CSourceBase_Flow { bool implicit, /*!< \brief Implicit calculation. */ viscous, /*!< \brief Viscous incompressible flows. */ - energy; /*!< \brief computation with the energy equation. */ + energy, /*!< \brief computation with the energy equation. */ + multicomponent; /*!< \brief multicomponent incompressible flows. */ public: /*! diff --git a/SU2_CFD/src/numerics/flow/flow_sources.cpp b/SU2_CFD/src/numerics/flow/flow_sources.cpp index 6f8359a5f582..b07ad673be3e 100644 --- a/SU2_CFD/src/numerics/flow/flow_sources.cpp +++ b/SU2_CFD/src/numerics/flow/flow_sources.cpp @@ -245,7 +245,7 @@ CSourceIncAxisymmetric_Flow::CSourceIncAxisymmetric_Flow(unsigned short val_nDim implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); energy = config->GetEnergy_Equation(); viscous = config->GetViscous(); - + multicomponent = (config->GetKind_FluidModel() == FLUID_MIXTURE); } CNumerics::ResidualType<> CSourceIncAxisymmetric_Flow::ComputeResidual(const CConfig* config) { @@ -264,7 +264,11 @@ CNumerics::ResidualType<> CSourceIncAxisymmetric_Flow::ComputeResidual(const CCo DensityInc_i = V_i[nDim+2]; BetaInc2_i = V_i[nDim+3]; Cp_i = V_i[nDim+7]; - Enthalpy_i = Cp_i*Temp_i; + if (multicomponent && energy) { + Enthalpy_i = V_i[nDim + 9]; + } else { + Enthalpy_i = Cp_i * Temp_i; + } for (iDim = 0; iDim < nDim; iDim++) Velocity_i[iDim] = V_i[iDim+1]; @@ -296,7 +300,11 @@ CNumerics::ResidualType<> CSourceIncAxisymmetric_Flow::ComputeResidual(const CCo jacobian[3][0] = 0.0; jacobian[3][1] = 0.0; jacobian[3][2] = Enthalpy_i; - jacobian[3][3] = Cp_i*Velocity_i[1]; + if (multicomponent && energy) { + jacobian[3][3] = (1.0 - Enthalpy_i / (Cp_i * Temp_i)) * Velocity_i[1]; + } else { + jacobian[3][3] = Cp_i * Velocity_i[1]; + } for (iVar=0; iVar < nVar; iVar++) for (jVar=0; jVar < nVar; jVar++) @@ -326,8 +334,11 @@ CNumerics::ResidualType<> CSourceIncAxisymmetric_Flow::ComputeResidual(const CCo residual[2] -= Volume*(yinv*2.0*total_viscosity*PrimVar_Grad_i[2][1] - yinv* yinv*2.0*total_viscosity*Velocity_i[1] - TWO3*AuxVar_Grad_i[0][1]); - residual[3] -= Volume*yinv*Thermal_Conductivity_i*PrimVar_Grad_i[nDim+1][1]; - + residual[3] -= Volume * yinv * Thermal_Conductivity_i * PrimVar_Grad_i[nDim + 1][1]; + if (multicomponent && energy) { + residual[3] -= Volume * yinv * HeatFluxDiffusion; + if (implicit) jacobian[3][3] -= Volume * yinv * Jac_HeatFluxDiffusion; + } } } else { diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index f3de80979363..1e68499ddb2e 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -1407,6 +1407,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont const bool energy = config->GetEnergy_Equation(); const bool streamwise_periodic = (config->GetKind_Streamwise_Periodic() != ENUM_STREAMWISE_PERIODIC::NONE); const bool streamwise_periodic_temperature = config->GetStreamwise_Periodic_Temperature(); + const bool multicomponent = (config->GetKind_FluidModel()==FLUID_MIXTURE); AD::StartNoSharedReading(); @@ -1589,6 +1590,35 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont numerics->SetAuxVarGrad(nodes->GetAuxVarGradient(iPoint), nullptr); + if(multicomponent && energy){ + /*--- retrieve number of species that are solved and set maximum static array ---*/ + int n_species = config->GetnSpecies(); + static constexpr size_t MAXNVAR_SPECIES = 20UL; + /*--- Obtain fluid model for computing the enthalpy diffusion terms. ---*/ + CFluidModel* FluidModel = solver_container[FLOW_SOL]->GetFluidModel(); + /*--- retrieve species gradient needed for multicomponent. ---*/ + CMatrixView Species_Grad_i = solver_container[SPECIES_SOL]->GetNodes()->GetGradient(iPoint); + /*--- Set thermodynamic state. ---*/ + FluidModel->SetTDState_T(nodes->GetTemperature(iPoint),solver_container[SPECIES_SOL]->GetNodes()->GetSolution(iPoint)); + /*--- Get enthalpy diffusion terms and its gradients(for implicit). ---*/ + su2double EnthalpyDiffusion_i[MAXNVAR_SPECIES]{0.0}; + su2double GradEnthalpyDiffusion_i[MAXNVAR_SPECIES]{0.0}; + FluidModel->GetEnthalpyDiffusivity(EnthalpyDiffusion_i); + if (implicit) FluidModel->GetGradEnthalpyDiffusivity(GradEnthalpyDiffusion_i); + /*--- Compute Enthalpy diffusion flux and its jacobian (for implicit iterations) ---*/ + su2double flux_enthalpy_diffusion = 0.0; + su2double jac_flux_enthalpy_diffusion = 0.0; + for (int i_species = 0; i_species < n_species; i_species++) { + flux_enthalpy_diffusion += EnthalpyDiffusion_i[i_species]* Species_Grad_i[i_species][1]; + if (implicit) + jac_flux_enthalpy_diffusion += GradEnthalpyDiffusion_i[i_species] * Species_Grad_i[i_species][1]; + } + + /*--- Set heat flux and jacobian (for implicit) due to enthalpy diffusion ---*/ + + numerics->SetHeatFluxDiffusion(flux_enthalpy_diffusion); + if (implicit) numerics->SetJacHeatFluxDiffusion(jac_flux_enthalpy_diffusion); + } } /*--- Compute Source term Residual ---*/ diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index 01f7fce0ab0a..6b7ea0e56b94 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -306,7 +306,7 @@ void CIncNSSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CS const su2double* Species_i = speciesNodes->GetSolution(iPoint); const su2double* Species_j = speciesNodes->GetSolution(jPoint); CMatrixView Species_Grad_i = speciesNodes->GetGradient(iPoint); - CMatrixView Species_Grad_j = speciesNodes->GetGradient(iPoint); + CMatrixView Species_Grad_j = speciesNodes->GetGradient(jPoint); /*--- Compute Projected gradient for species variables ---*/ su2double ProjGradScalarVarNoCorr[MAXNVAR_SPECIES]{0.0}; @@ -327,7 +327,7 @@ void CIncNSSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CS su2double EnthalpyDiffusion_j[MAXNVAR_SPECIES]{0.0}; su2double GradEnthalpyDiffusion_j[MAXNVAR_SPECIES]{0.0}; - FluidModel->SetTDState_T(nodes->GetPrimitive(jPoint)[prim_idx.Temperature()], speciesNodes->GetSolution(jPoint)); + FluidModel->SetTDState_T(nodes->GetPrimitive(jPoint)[prim_idx.Temperature()], Species_j); FluidModel->GetEnthalpyDiffusivity(EnthalpyDiffusion_j); if (implicit) FluidModel->GetGradEnthalpyDiffusivity(GradEnthalpyDiffusion_j); @@ -408,6 +408,7 @@ void CIncNSSolver::BC_Wall_Generic(const CGeometry *geometry, const CConfig *con const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool energy = config->GetEnergy_Equation(); const bool py_custom = config->GetMarker_All_PyCustom(val_marker); + const bool multicomponent = (config->GetKind_FluidModel() == FLUID_MIXTURE); /*--- Variables for streamwise periodicity ---*/ const bool streamwise_periodic = (config->GetKind_Streamwise_Periodic() != ENUM_STREAMWISE_PERIODIC::NONE); @@ -565,9 +566,13 @@ void CIncNSSolver::BC_Wall_Generic(const CGeometry *geometry, const CConfig *con if (implicit) { su2double proj_vector_ij = 0.0; - if (dist_ij_2 > 0.0) - proj_vector_ij = GeometryToolbox::DotProduct(nDim, Edge_Vector, Normal) / dist_ij_2; - Jacobian.AddVal2Diag(iPoint, nDim+1, thermal_conductivity*proj_vector_ij); + if (dist_ij_2 > 0.0) proj_vector_ij = GeometryToolbox::DotProduct(nDim, Edge_Vector, Normal) / dist_ij_2; + if (multicomponent) { + Cp = nodes->GetSpecificHeatCp(iPoint); + Jacobian.AddVal2Diag(iPoint, nDim + 1, thermal_conductivity * proj_vector_ij / Cp); + } else { + Jacobian.AddVal2Diag(iPoint, nDim + 1, thermal_conductivity * proj_vector_ij); + } } break; } // switch From fdbb9b9fb0c96fff456a9ddef8749ad63afde489 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sat, 30 Nov 2024 16:23:40 +0100 Subject: [PATCH 09/97] updating BC_ConjugateHeat_Interface for fluid mixture --- SU2_CFD/src/solvers/CIncNSSolver.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index 6b7ea0e56b94..7af9d4bb8d4f 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -603,6 +603,7 @@ void CIncNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **sol const su2double Temperature_Ref = config->GetTemperature_Ref(); const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool energy = config->GetEnergy_Equation(); + const bool multicomponent = (config->GetKind_FluidModel() == FLUID_MIXTURE); /*--- Identify the boundary ---*/ @@ -688,7 +689,18 @@ void CIncNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **sol /*--- Strong imposition of the temperature on the fluid zone. ---*/ LinSysRes(iPoint, nDim+1) = 0.0; - nodes->SetSolution_Old(iPoint, nDim+1, Twall); + if (multicomponent) { + /*--- Retrieve scalars at wall node. ---*/ + su2double* scalars = solver_container[SPECIES_SOL]->GetNodes()->GetSolution(iPoint); + /*--- Retrieve fluid model. ---*/ + CFluidModel* fluid_model_local = solver_container[FLOW_SOL]->GetFluidModel(); + /*--- Set thermodynamic state given wall temperature and species composition. ---*/ + fluid_model_local->SetTDState_T(Twall, scalars); + /*--- Set enthalpy obtained from fluid model. ---*/ + nodes->SetSolution_Old(iPoint, nDim + 1, fluid_model_local->GetEnthalpy()); + } else { + nodes->SetSolution_Old(iPoint, nDim + 1, Twall); + } nodes->SetEnergy_ResTruncError_Zero(iPoint); } END_SU2_OMP_FOR From 2af10c3283b6ece0178b50c378dcbce3a3da0023 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Thu, 2 Jan 2025 15:43:31 +0100 Subject: [PATCH 10/97] activating muscl, consistent extrapolation for multicomponent --- SU2_CFD/include/solvers/CIncEulerSolver.hpp | 13 +++++++ SU2_CFD/src/solvers/CIncEulerSolver.cpp | 39 +++++++++++++++++++++ SU2_CFD/src/solvers/CIncNSSolver.cpp | 26 ++++++++++++++ SU2_CFD/src/variables/CIncNSVariable.cpp | 7 +++- 4 files changed, 84 insertions(+), 1 deletion(-) diff --git a/SU2_CFD/include/solvers/CIncEulerSolver.hpp b/SU2_CFD/include/solvers/CIncEulerSolver.hpp index 990c9b7095d5..50c52d4654a0 100644 --- a/SU2_CFD/include/solvers/CIncEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CIncEulerSolver.hpp @@ -191,6 +191,19 @@ class CIncEulerSolver : public CFVMFlowSolverBaseGetKind_SlopeLimit_Flow() != LIMITER::NONE); const bool van_albada = (config->GetKind_SlopeLimit_Flow() == LIMITER::VAN_ALBADA_EDGE); const bool bounded_scalar = config->GetBounded_Scalar(); + const bool energy_multicomponent = (config->GetEnergy_Equation()) && (config->GetKind_FluidModel() == FLUID_MIXTURE); /*--- For hybrid parallel AD, pause preaccumulation if there is shared reading of * variables, otherwise switch to the faster adjoint evaluation mode. ---*/ @@ -1315,6 +1316,31 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont Primitive_i[iVar] = V_i[iVar]; Primitive_j[iVar] = V_j[iVar]; } + if (energy_multicomponent) { + su2double Project_Grad_Enthalpy_i = 0.0; + su2double Project_Grad_Enthalpy_j = 0.0; + + for (iDim = 0; iDim < nDim; iDim++) { + Project_Grad_Enthalpy_i += Vector_ij[iDim] * nodes->GetAuxVarGradient(iPoint, 1, iDim); + Project_Grad_Enthalpy_j -= Vector_ij[iDim] * nodes->GetAuxVarGradient(jPoint, 1, iDim); + } + su2double lim_i = 1.0; + su2double lim_j = 1.0; + if (van_albada) { + su2double V_ij = V_j[nDim + 9] - V_i[nDim + 9]; + lim_i = LimiterHelpers<>::vanAlbadaFunction(Project_Grad_Enthalpy_i, V_ij, EPS); + lim_j = LimiterHelpers<>::vanAlbadaFunction(-Project_Grad_Enthalpy_j, V_ij, EPS); + } else if (limiter) { + lim_i = 1.0; // nodes->GetLimiter_Primitive(iPoint, iVar); + lim_j = 1.0; // nodes->GetLimiter_Primitive(jPoint, iVar); + } + Primitive_i[nDim + 9] = V_i[nDim + 9] + lim_i * Project_Grad_Enthalpy_i; + Primitive_j[nDim + 9] = V_j[nDim + 9] + lim_j * Project_Grad_Enthalpy_j; + const su2double* scalar_i = solver_container[SPECIES_SOL]->GetNodes()->GetSolution(iPoint); + const su2double* scalar_j = solver_container[SPECIES_SOL]->GetNodes()->GetSolution(jPoint); + ComputeConsistentExtrapolation(GetFluidModel(), nDim, Primitive_i, scalar_i); + ComputeConsistentExtrapolation(GetFluidModel(), nDim, Primitive_j, scalar_j); + } /*--- Check for non-physical solutions after reconstruction. If found, use the cell-average value of the solution. This results in a locally @@ -1386,6 +1412,19 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont FinalizeResidualComputation(geometry, pausePreacc, counter_local, config); } +void CIncEulerSolver::ComputeConsistentExtrapolation(CFluidModel* fluidModel, unsigned short nDim, su2double* primitive, + const su2double* scalar) { + const CIncEulerVariable::CIndices prim_idx(nDim, 0); + const su2double enthalpy = primitive[prim_idx.Enthalpy()]; + su2double temperature = primitive[prim_idx.Temperature()]; + fluidModel->ComputeTempFromEnthalpy(enthalpy, &temperature, scalar); + + fluidModel->SetTDState_T(temperature, scalar); + + primitive[prim_idx.Temperature()] = temperature; + primitive[prim_idx.Density()] = fluidModel->GetDensity(); +} + void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh) { diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index 8ce8cb88ee17..ad73c560b0ea 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -69,10 +69,21 @@ void CIncNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container const bool limiter = (config->GetKind_SlopeLimit_Flow() != LIMITER::NONE) && (InnerIter <= config->GetLimiterIter()); const bool van_albada = (config->GetKind_SlopeLimit_Flow() == LIMITER::VAN_ALBADA_EDGE); const bool wall_functions = config->GetWall_Functions(); + const bool energy_multicomponent = (config->GetEnergy_Equation()) && (config->GetKind_FluidModel() == FLUID_MIXTURE); + const bool test = config->GetReconstructionGradientRequired(); /*--- Common preprocessing steps (implemented by CEulerSolver) ---*/ CommonPreprocessing(geometry, solver_container, config, iMesh, iRKStep, RunTime_EqSystem, Output); + if (energy_multicomponent && muscl) { + SU2_OMP_SAFE_GLOBAL_ACCESS(config->SetGlobalParam(config->GetKind_Solver(), RunTime_EqSystem);) + SU2_OMP_FOR_STAT(omp_chunk_size) + for (auto i_point = 0u; i_point < nPoint; i_point++) { + solver_container[FLOW_SOL]->GetNodes()->SetAuxVar(i_point, 1, + solver_container[FLOW_SOL]->GetNodes()->GetEnthalpy(i_point)); + } + END_SU2_OMP_FOR + } /*--- Compute gradient for MUSCL reconstruction ---*/ @@ -86,6 +97,21 @@ void CIncNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container default: break; } } + if (muscl && !center && energy_multicomponent) { + /*--- Gradient computation for MUSCL reconstruction of Enthalpy for multicomponent flows. ---*/ + + switch (config->GetKind_Gradient_Method_Recon()) { + case GREEN_GAUSS: + SetAuxVar_Gradient_GG(geometry, config); + break; + case LEAST_SQUARES: + case WEIGHTED_LEAST_SQUARES: + SetAuxVar_Gradient_LS(geometry, config); + break; + default: + break; + } + } /*--- Compute gradient of the primitive variables ---*/ diff --git a/SU2_CFD/src/variables/CIncNSVariable.cpp b/SU2_CFD/src/variables/CIncNSVariable.cpp index c2aae3bc8c88..81f9ecc0d86a 100644 --- a/SU2_CFD/src/variables/CIncNSVariable.cpp +++ b/SU2_CFD/src/variables/CIncNSVariable.cpp @@ -46,8 +46,13 @@ CIncNSVariable::CIncNSVariable(su2double pressure, const su2double *velocity, su AuxVar.resize(nPoint,nAuxVar) = su2double(0.0); Grad_AuxVar.resize(nPoint,nAuxVar,nDim); } - if ((config->GetKind_Species_Model()==SPECIES_MODEL::SPECIES_TRANSPORT) && config->GetEnergy_Equation()){ + if ((config->GetKind_Species_Model() == SPECIES_MODEL::SPECIES_TRANSPORT) && config->GetEnergy_Equation()) { Energy_Multicomponent = true; + if (config->GetMUSCL_Flow()) { + nAuxVar = 2; + AuxVar.resize(nPoint, nAuxVar) = su2double(0.0); + Grad_AuxVar.resize(nPoint, nAuxVar, nDim); + } } } From a1f526c4abd80693fc4f54782349cfa795218fb1 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Fri, 10 Jan 2025 09:47:01 +0100 Subject: [PATCH 11/97] correct average enthalpy for multicomponent flows output --- SU2_CFD/src/output/CFlowOutput.cpp | 7 ++++++- SU2_CFD/src/solvers/CIncNSSolver.cpp | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 3c651269b02e..979d911f3b26 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -150,6 +150,7 @@ void CFlowOutput::SetAnalyzeSurface(const CSolver* const*solver, const CGeometry const bool compressible = config->GetKind_Regime() == ENUM_REGIME::COMPRESSIBLE; const bool incompressible = config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE; const bool energy = config->GetEnergy_Equation(); + const bool multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE; const bool streamwisePeriodic = (config->GetKind_Streamwise_Periodic() != ENUM_STREAMWISE_PERIODIC::NONE); const bool species = config->GetKind_Species_Model() == SPECIES_MODEL::SPECIES_TRANSPORT; const auto nSpecies = config->GetnSpecies(); @@ -241,7 +242,11 @@ void CFlowOutput::SetAnalyzeSurface(const CSolver* const*solver, const CGeometry sqrt(config->GetBulk_Modulus()/(flow_nodes->GetDensity(iPoint))); } Temperature = flow_nodes->GetTemperature(iPoint); - Enthalpy = flow_nodes->GetSpecificHeatCp(iPoint)*Temperature; + if (energy && multicomponent) { + Enthalpy = flow_nodes->GetEnthalpy(iPoint); + } else { + Enthalpy = flow_nodes->GetSpecificHeatCp(iPoint) * Temperature; + } TotalTemperature = Temperature + 0.5*Velocity2/flow_nodes->GetSpecificHeatCp(iPoint); TotalPressure = Pressure + 0.5*Density*Velocity2; } diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index ad73c560b0ea..bdeddb2447da 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -70,7 +70,6 @@ void CIncNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container const bool van_albada = (config->GetKind_SlopeLimit_Flow() == LIMITER::VAN_ALBADA_EDGE); const bool wall_functions = config->GetWall_Functions(); const bool energy_multicomponent = (config->GetEnergy_Equation()) && (config->GetKind_FluidModel() == FLUID_MIXTURE); - const bool test = config->GetReconstructionGradientRequired(); /*--- Common preprocessing steps (implemented by CEulerSolver) ---*/ From ef2dc5fcd90ec93a38a70253a90cf9634e962626 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sat, 11 Jan 2025 17:33:30 +0100 Subject: [PATCH 12/97] changing boolean names --- SU2_CFD/include/numerics/CNumerics.hpp | 2 +- SU2_CFD/src/numerics/CNumerics.cpp | 11 ++++----- SU2_CFD/src/numerics/flow/convection/fds.cpp | 12 +++++----- SU2_CFD/src/numerics/flow/flow_diffusion.cpp | 10 ++++---- SU2_CFD/src/numerics/flow/flow_sources.cpp | 2 +- SU2_CFD/src/output/CFlowIncOutput.cpp | 2 +- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 25 ++++++++++---------- SU2_CFD/src/solvers/CIncNSSolver.cpp | 5 ++-- SU2_CFD/src/variables/CIncNSVariable.cpp | 2 +- 9 files changed, 35 insertions(+), 36 deletions(-) diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 9942f79a4925..cec666bc72d5 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -192,7 +192,7 @@ class CNumerics { bool nemo; /*!< \brief Flag for NEMO problems */ - bool multicomponent_energy = false; /*!< \brief Flag for multicomponent and reacting flow */ + bool energy_multicomponent = false; /*!< \brief Flag for multicomponent and reacting flow */ bool bounded_scalar = false; /*!< \brief Flag for bounded scalar problem */ diff --git a/SU2_CFD/src/numerics/CNumerics.cpp b/SU2_CFD/src/numerics/CNumerics.cpp index 379276fa83a1..f78e4b602885 100644 --- a/SU2_CFD/src/numerics/CNumerics.cpp +++ b/SU2_CFD/src/numerics/CNumerics.cpp @@ -54,8 +54,7 @@ CNumerics::CNumerics(unsigned short val_nDim, unsigned short val_nVar, Prandtl_Lam = config->GetPrandtl_Lam(); Prandtl_Turb = config->GetPrandtl_Turb(); Gas_Constant = config->GetGas_ConstantND(); - multicomponent_energy = - (config->GetKind_Species_Model() == SPECIES_MODEL::SPECIES_TRANSPORT) && (config->GetEnergy_Equation()); + energy_multicomponent = ((config->GetKind_FluidModel() == FLUID_MIXTURE) && (config->GetEnergy_Equation())); tau = new su2double* [nDim]; for (iDim = 0; iDim < nDim; iDim++) @@ -280,7 +279,7 @@ void CNumerics::GetInviscidIncProjJac(const su2double *val_density, const su2dou val_Proj_Jac_Tensor[2][2] = val_scale*((*val_density)*(proj_vel + val_normal[1]*val_velocity[1])); val_Proj_Jac_Tensor[2][3] = val_scale*((*val_dRhodT)*val_velocity[1]*proj_vel); - if (multicomponent_energy) { + if (energy_multicomponent) { val_Proj_Jac_Tensor[3][0] = val_scale * ((*val_temperature) * proj_vel / (*val_betainc2)); val_Proj_Jac_Tensor[3][1] = val_scale * ((*val_temperature) * val_normal[0] * (*val_density)); val_Proj_Jac_Tensor[3][2] = val_scale * ((*val_temperature) * val_normal[1] * (*val_density)); @@ -321,7 +320,7 @@ void CNumerics::GetInviscidIncProjJac(const su2double *val_density, const su2dou val_Proj_Jac_Tensor[3][3] = val_scale*((*val_density)*(proj_vel + val_normal[2]*val_velocity[2])); val_Proj_Jac_Tensor[3][4] = val_scale*((*val_dRhodT)*val_velocity[2]*proj_vel); - if (multicomponent_energy) { + if (energy_multicomponent) { val_Proj_Jac_Tensor[4][0] = val_scale * ((*val_temperature) * proj_vel / (*val_betainc2)); val_Proj_Jac_Tensor[4][1] = val_scale * ((*val_temperature) * val_normal[0] * (*val_density)); val_Proj_Jac_Tensor[4][2] = val_scale * ((*val_temperature) * val_normal[1] * (*val_density)); @@ -349,7 +348,7 @@ void CNumerics::GetPreconditioner(const su2double *val_density, const su2double val_Precon[0][0] = 1.0/(*val_betainc2); for (iDim = 0; iDim < nDim; iDim++) val_Precon[iDim+1][0] = val_velocity[iDim]/(*val_betainc2); - if (multicomponent_energy){ + if (energy_multicomponent){ val_Precon[nDim+1][0] = (*val_temperature)/(*val_betainc2); }else{ val_Precon[nDim+1][0] = (*val_cp)*(*val_temperature)/(*val_betainc2); @@ -367,7 +366,7 @@ void CNumerics::GetPreconditioner(const su2double *val_density, const su2double val_Precon[0][nDim+1] = (*val_drhodt); for (iDim = 0; iDim < nDim; iDim++) val_Precon[iDim+1][nDim+1] = val_velocity[iDim]*(*val_drhodt); - if (multicomponent_energy){ + if (energy_multicomponent){ val_Precon[nDim+1][nDim+1] = (*val_drhodt)*(*val_temperature) + (*val_density); }else{ val_Precon[nDim+1][nDim+1] = (*val_cp)*((*val_drhodt)*(*val_temperature) + (*val_density)); diff --git a/SU2_CFD/src/numerics/flow/convection/fds.cpp b/SU2_CFD/src/numerics/flow/convection/fds.cpp index de1963e3fb30..115a966896bd 100644 --- a/SU2_CFD/src/numerics/flow/convection/fds.cpp +++ b/SU2_CFD/src/numerics/flow/convection/fds.cpp @@ -118,7 +118,7 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config DensityInc_i = V_i[nDim+2]; DensityInc_j = V_j[nDim+2]; BetaInc2_i = V_i[nDim+3]; BetaInc2_j = V_j[nDim+3]; Cp_i = V_i[nDim+7]; Cp_j = V_j[nDim+7]; - if (multicomponent_energy) { + if (energy_multicomponent) { Enthalpy_i = V_i[nDim + 9]; Enthalpy_j = V_j[nDim + 9]; } else { @@ -163,7 +163,7 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config MeandRhodT = 0.0; dRhodT_i = 0.0; dRhodT_j = 0.0; if (variable_density) { - if (multicomponent_energy) { + if (energy_multicomponent) { MeandRhodT = -MeanDensity / (MeanCp * MeanTemperature); dRhodT_i = -DensityInc_i / (Cp_i * Temperature_i); dRhodT_j = -DensityInc_j / (Cp_j * Temperature_j); @@ -204,7 +204,7 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config Lambda[iVar] = fabs(Lambda[iVar]); /*--- Build the preconditioning matrix using mean values ---*/ - if (multicomponent_energy) { + if (energy_multicomponent) { GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanEnthalpy, &MeandRhodT, Precon); } else { GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanTemperature, &MeandRhodT, Precon); @@ -221,7 +221,7 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config Diff_V[0] = Pressure_j - Pressure_i; for (iDim = 0; iDim < nDim; iDim++) Diff_V[iDim+1] = Velocity_j[iDim] - Velocity_i[iDim]; - if (multicomponent_energy){ + if (energy_multicomponent){ Diff_V[nDim+1] = Enthalpy_j - Enthalpy_i; }else{ Diff_V[nDim+1] = Temperature_j - Temperature_i; @@ -230,7 +230,7 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config /*--- Build the inviscid Jacobian w.r.t. the primitive variables ---*/ if (implicit) { - if (multicomponent_energy) { + if (energy_multicomponent) { GetInviscidIncProjJac(&DensityInc_i, Velocity_i, &BetaInc2_i, &Cp_i, &Enthalpy_i, &dRhodT_i, Normal, 0.5, Jacobian_i); GetInviscidIncProjJac(&DensityInc_j, Velocity_j, &BetaInc2_j, &Cp_j, &Enthalpy_j, &dRhodT_j, Normal, 0.5, @@ -286,7 +286,7 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config Jacobian_i[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_i; Jacobian_j[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_j; } - if (multicomponent_energy){ + if (energy_multicomponent){ Jacobian_i[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_i; Jacobian_j[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_j; } else { diff --git a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp index 8e3804a598b9..ddef652b8dbf 100644 --- a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp +++ b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp @@ -583,7 +583,7 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi Laminar_Viscosity_i = V_i[nDim+4]; Laminar_Viscosity_j = V_j[nDim+4]; Eddy_Viscosity_i = V_i[nDim+5]; Eddy_Viscosity_j = V_j[nDim+5]; Thermal_Conductivity_i = V_i[nDim+6]; Thermal_Conductivity_j = V_j[nDim+6]; - if (multicomponent_energy) { + if (energy_multicomponent) { Cp_i = V_i[nDim + 7]; Cp_j = V_j[nDim + 7]; } @@ -594,7 +594,7 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi Mean_Eddy_Viscosity = 0.5*(Eddy_Viscosity_i + Eddy_Viscosity_j); Mean_turb_ke = 0.5*(turb_ke_i + turb_ke_j); Mean_Thermal_Conductivity = 0.5*(Thermal_Conductivity_i + Thermal_Conductivity_j); - if (multicomponent_energy) { + if (energy_multicomponent) { Mean_Heat_Capacity = 0.5 * (Cp_i + Cp_j); } @@ -630,7 +630,7 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi if (config->GetSAParsedOptions().qcr2000) AddQCR(nDim, &Mean_GradPrimVar[1], tau); if (Mean_TauWall > 0) AddTauWall(UnitNormal, Mean_TauWall); - if (multicomponent_energy) { + if (energy_multicomponent) { Mean_HeatFluxDiffusion = HeatFluxDiffusion; Mean_JacHeatFluxDiffusion = Jac_HeatFluxDiffusion; } @@ -661,7 +661,7 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi proj_vector_ij += (Coord_j[iDim]-Coord_i[iDim])*Normal[iDim]; } proj_vector_ij = proj_vector_ij/dist_ij_2; - if (multicomponent_energy){ + if (energy_multicomponent){ Jacobian_i[nDim + 1][nDim + 1] = -(Mean_Thermal_Conductivity * proj_vector_ij + Mean_JacHeatFluxDiffusion) / Mean_Heat_Capacity; Jacobian_j[nDim + 1][nDim + 1] = @@ -741,7 +741,7 @@ void CAvgGradInc_Flow::GetViscousIncProjFlux(const su2double* const *val_gradpri for (unsigned short iDim = 0; iDim < nDim; iDim++) Proj_Flux_Tensor[iVar] += Flux_Tensor[iVar][iDim] * val_normal[iDim]; } - if (multicomponent_energy) { + if (energy_multicomponent) { Proj_Flux_Tensor[nVar - 1] += val_heatDiffusion; } } diff --git a/SU2_CFD/src/numerics/flow/flow_sources.cpp b/SU2_CFD/src/numerics/flow/flow_sources.cpp index b07ad673be3e..4aa072be466c 100644 --- a/SU2_CFD/src/numerics/flow/flow_sources.cpp +++ b/SU2_CFD/src/numerics/flow/flow_sources.cpp @@ -337,7 +337,7 @@ CNumerics::ResidualType<> CSourceIncAxisymmetric_Flow::ComputeResidual(const CCo residual[3] -= Volume * yinv * Thermal_Conductivity_i * PrimVar_Grad_i[nDim + 1][1]; if (multicomponent && energy) { residual[3] -= Volume * yinv * HeatFluxDiffusion; - if (implicit) jacobian[3][3] -= Volume * yinv * Jac_HeatFluxDiffusion; + if (implicit) jacobian[3][3] -= Volume * yinv * Jac_HeatFluxDiffusion / Cp_i; } } diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index 60f7e6775c22..e616a9b63abc 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -37,7 +37,7 @@ CFlowIncOutput::CFlowIncOutput(CConfig *config, unsigned short nDim) : CFlowOutp heat = config->GetEnergy_Equation(); - multicomponent = config->GetKind_Species_Model()==SPECIES_MODEL::SPECIES_TRANSPORT; + multicomponent = (config->GetKind_FluidModel() == FLUID_MIXTURE); weakly_coupled_heat = config->GetWeakly_Coupled_Heat(); flamelet = (config->GetKind_Species_Model() == SPECIES_MODEL::FLAMELET); diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index 9be9d63729cd..aa6bea96a0d1 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -57,7 +57,7 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned bool time_stepping = config->GetTime_Marching() == TIME_MARCHING::TIME_STEPPING; bool adjoint = (config->GetContinuous_Adjoint()) || (config->GetDiscrete_Adjoint()); const bool centered = config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED; - bool Energy_Multicomponent = (config->GetKind_Species_Model()==SPECIES_MODEL::SPECIES_TRANSPORT) && config->GetEnergy_Equation(); + const bool energy_multicomponent = ((config->GetKind_FluidModel() == FLUID_MIXTURE) && config->GetEnergy_Equation()); /* A grid is defined as dynamic if there's rigid grid movement or grid deformation AND the problem is time domain */ dynamic_grid = config->GetDynamic_Grid(); @@ -179,7 +179,7 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned Pressure_Inf = config->GetPressure_FreeStreamND(); Velocity_Inf = config->GetVelocity_FreeStreamND(); Temperature_Inf = config->GetTemperature_FreeStreamND(); - if (Energy_Multicomponent){ + if (energy_multicomponent){ CFluidModel *auxFluidModel = new CFluidScalar(config->GetPressure_Thermodynamic(), config); const su2double *scalar_init = config->GetSpecies_Init(); auxFluidModel->SetTDState_T(Temperature_Inf,scalar_init); // compute total enthalpy from temperature @@ -215,7 +215,7 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned /*--- Initialize the solution to the far-field state everywhere. ---*/ if (navier_stokes) { - if (Energy_Multicomponent){ + if (energy_multicomponent){ nodes = new CIncNSVariable(Pressure_Inf, Velocity_Inf, Enthalpy_Inf, nPoint, nDim, nVar, config); }else{ nodes = new CIncNSVariable(Pressure_Inf, Velocity_Inf, Temperature_Inf, nPoint, nDim, nVar, config); @@ -1238,7 +1238,8 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont const bool limiter = (config->GetKind_SlopeLimit_Flow() != LIMITER::NONE); const bool van_albada = (config->GetKind_SlopeLimit_Flow() == LIMITER::VAN_ALBADA_EDGE); const bool bounded_scalar = config->GetBounded_Scalar(); - const bool energy_multicomponent = (config->GetEnergy_Equation()) && (config->GetKind_FluidModel() == FLUID_MIXTURE); + const bool energy_multicomponent = + ((config->GetEnergy_Equation()) && (config->GetKind_FluidModel() == FLUID_MIXTURE)); /*--- For hybrid parallel AD, pause preaccumulation if there is shared reading of * variables, otherwise switch to the faster adjoint evaluation mode. ---*/ @@ -1446,7 +1447,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont const bool energy = config->GetEnergy_Equation(); const bool streamwise_periodic = (config->GetKind_Streamwise_Periodic() != ENUM_STREAMWISE_PERIODIC::NONE); const bool streamwise_periodic_temperature = config->GetStreamwise_Periodic_Temperature(); - const bool multicomponent = (config->GetKind_FluidModel()==FLUID_MIXTURE); + const bool multicomponent = (config->GetKind_FluidModel() == FLUID_MIXTURE); AD::StartNoSharedReading(); @@ -2063,7 +2064,7 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo bool variable_density = (config->GetVariable_Density_Model()); bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); bool energy = config->GetEnergy_Equation(); - bool multicomponent = config->GetKind_Species_Model()==SPECIES_MODEL::SPECIES_TRANSPORT; + bool multicomponent = (config->GetKind_FluidModel() == FLUID_MIXTURE); /*--- Access the primitive variables at this node. ---*/ @@ -2336,7 +2337,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool viscous = config->GetViscous(); - bool Energy_Multicomponent = (config->GetKind_Species_Model()==SPECIES_MODEL::SPECIES_TRANSPORT) && config->GetEnergy_Equation(); + const bool energy_multicomponent = ((config->GetKind_FluidModel() == FLUID_MIXTURE) && (config->GetEnergy_Equation())); string Marker_Tag = config->GetMarker_All_TagBound(val_marker); @@ -2501,7 +2502,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, } /*-- Enthalpy is needed for energy equation in multicomponent and reacting flows. ---*/ - if (Energy_Multicomponent) { + if (energy_multicomponent) { CFluidModel* auxFluidModel = solver_container[FLOW_SOL]->GetFluidModel(); const su2double* scalar_inlet = config->GetInlet_SpeciesVal(config->GetMarker_All_TagBound(val_marker)); auxFluidModel->SetTDState_T(V_inlet[prim_idx.Temperature()], @@ -2546,7 +2547,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Viscous contribution, commented out because serious convergence problems ---*/ - if (!viscous || Energy_Multicomponent) continue; + if (!viscous || energy_multicomponent) continue; /*--- Set transport properties at the inlet ---*/ @@ -2598,7 +2599,7 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool viscous = config->GetViscous(); - bool Energy_Multicomponent = (config->GetKind_Species_Model()==SPECIES_MODEL::SPECIES_TRANSPORT) && config->GetEnergy_Equation(); + const bool energy_multicomponent = ((config->GetKind_FluidModel() == FLUID_MIXTURE) && (config->GetEnergy_Equation())); string Marker_Tag = config->GetMarker_All_TagBound(val_marker); su2double Normal[MAXNDIM] = {0.0}; @@ -2722,7 +2723,7 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, V_outlet[prim_idx.CpTotal()] = nodes->GetSpecificHeatCp(iPoint); /*-- Enthalpy is needed for energy equation in multicomponent and reacting flows. ---*/ - if (Energy_Multicomponent) { + if (energy_multicomponent) { CFluidModel* auxFluidModel = solver_container[FLOW_SOL]->GetFluidModel();; const su2double* scalar_outlet = solver_container[SPECIES_SOL]->GetNodes()->GetSolution(iPoint); auxFluidModel->SetTDState_T(nodes->GetTemperature(iPoint), @@ -2754,7 +2755,7 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, /*--- Viscous contribution, commented out because serious convergence problems ---*/ - if (!viscous || Energy_Multicomponent) continue; + if (!viscous || energy_multicomponent) continue; /*--- Set transport properties at the outlet. ---*/ diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index bdeddb2447da..08a8d7a1f1d4 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -300,12 +300,11 @@ void CIncNSSolver::Compute_Streamwise_Periodic_Recovered_Values(CConfig *config, void CIncNSSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config) { - const bool speciesEnergy = - (config->GetKind_Species_Model() == SPECIES_MODEL::SPECIES_TRANSPORT) && config->GetEnergy_Equation(); + const bool energy_multicomponent = ((config->GetKind_FluidModel() == FLUID_MIXTURE) && config->GetEnergy_Equation()); const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); /*--- Contribution to heat flux due to enthalpy diffusion for multicomponent and reacting flows ---*/ - if (speciesEnergy) { + if (energy_multicomponent) { CVariable* speciesNodes = solver_container[SPECIES_SOL]->GetNodes(); /*--- Points in edge ---*/ diff --git a/SU2_CFD/src/variables/CIncNSVariable.cpp b/SU2_CFD/src/variables/CIncNSVariable.cpp index 81f9ecc0d86a..b8b7f7deb814 100644 --- a/SU2_CFD/src/variables/CIncNSVariable.cpp +++ b/SU2_CFD/src/variables/CIncNSVariable.cpp @@ -46,7 +46,7 @@ CIncNSVariable::CIncNSVariable(su2double pressure, const su2double *velocity, su AuxVar.resize(nPoint,nAuxVar) = su2double(0.0); Grad_AuxVar.resize(nPoint,nAuxVar,nDim); } - if ((config->GetKind_Species_Model() == SPECIES_MODEL::SPECIES_TRANSPORT) && config->GetEnergy_Equation()) { + if ((config->GetKind_FluidModel() == FLUID_MIXTURE) && config->GetEnergy_Equation()) { Energy_Multicomponent = true; if (config->GetMUSCL_Flow()) { nAuxVar = 2; From 94bd0b0856e2d4548fd3d059434b8afeb1a4d4a7 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sat, 11 Jan 2025 17:51:25 +0100 Subject: [PATCH 13/97] up to date to develop --- subprojects/MLPCpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/MLPCpp b/subprojects/MLPCpp index c19c53ea2b85..6865a58b22f2 160000 --- a/subprojects/MLPCpp +++ b/subprojects/MLPCpp @@ -1 +1 @@ -Subproject commit c19c53ea2b85ccfb185f1c6c87044dc0b5bc7ae0 +Subproject commit 6865a58b22f21a92977839d9c93eae9522402f55 From 912642b1ca6483752ab7979f96e53c423345bed4 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sat, 18 Jan 2025 14:12:23 +0100 Subject: [PATCH 14/97] adding brackets --- SU2_CFD/src/output/CFlowIncOutput.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index e616a9b63abc..b7e05371bd07 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -135,12 +135,13 @@ void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ if (nDim == 3) AddHistoryOutput("MAX_VELOCITY-Z", "max[W]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the velocity z-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the temperature. - if (heat || weakly_coupled_heat) + if (heat || weakly_coupled_heat) { if (multicomponent){ AddHistoryOutput("MAX_ENTHALPY", "max[h]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the enthalpy.", HistoryFieldType::RESIDUAL); } else { AddHistoryOutput("MAX_TEMPERATURE", "max[T]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the temperature.", HistoryFieldType::RESIDUAL); } + } AddHistoryOutputFields_ScalarMAX_RES(config); /// END_GROUP @@ -156,12 +157,13 @@ void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ if (nDim == 3) AddHistoryOutput("BGS_VELOCITY-Z", "bgs[W]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the velocity z-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the temperature. - if (heat || weakly_coupled_heat) + if (heat || weakly_coupled_heat) { if (multicomponent){ AddHistoryOutput("BGS_ENTHALPY", "bgs[h]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the enthalpy.", HistoryFieldType::RESIDUAL); } else { AddHistoryOutput("BGS_TEMPERATURE", "bgs[T]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the temperature.", HistoryFieldType::RESIDUAL); } + } AddHistoryOutputFields_ScalarBGS_RES(config); @@ -462,9 +464,10 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve SetVolumeOutputValue("RES_VELOCITY-Y", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 2)); if (nDim == 3) SetVolumeOutputValue("RES_VELOCITY-Z", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 3)); - if (config->GetEnergy_Equation()) + if (config->GetEnergy_Equation()) { if (multicomponent) SetVolumeOutputValue("RES_ENTHALPY", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, nDim+1)); else SetVolumeOutputValue("RES_TEMPERATURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, nDim+1)); + } if (config->GetKind_SlopeLimit_Flow() != LIMITER::NONE && config->GetKind_SlopeLimit_Flow() != LIMITER::VAN_ALBADA_EDGE) { SetVolumeOutputValue("LIMITER_PRESSURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 0)); From a6ce2d42c427e480e9f844066caad9f5db7d7ea1 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sat, 18 Jan 2025 14:32:55 +0100 Subject: [PATCH 15/97] fixing warning --- SU2_CFD/src/solvers/CIncNSSolver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index 08a8d7a1f1d4..2128f85a4505 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -338,6 +338,7 @@ void CIncNSSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CS su2double proj_vector_ij = numerics->ComputeProjectedGradient( nDim, n_species, Normal, Coord_i, Coord_j, Species_Grad_i, Species_Grad_j, true, Species_i, Species_j, ProjGradScalarVarNoCorr, Proj_Mean_GradScalarVar); + (void)proj_vector_ij; /*--- Get enthalpy diffusion terms and its gradient(for implicit) for each species at point i. ---*/ From 0655c994dbc3a131cb3ef9d9e60c747c196acb52 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Thu, 30 Jan 2025 17:37:56 +0100 Subject: [PATCH 16/97] adding standard reference temperature T0=298.15K as default value --- Common/include/CConfig.hpp | 7 +++++++ Common/src/CConfig.cpp | 3 +++ SU2_CFD/include/fluid/CFluidScalar.hpp | 1 + SU2_CFD/src/fluid/CFluidScalar.cpp | 13 +++++++------ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index 58918bfdc2c4..361e4ded7eec 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -893,6 +893,7 @@ 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 */ @@ -1924,6 +1925,12 @@ 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. + */ + su2double GetStandard_RefTemperature(void) const { return Standard_Ref_Temperature; } + /*! * \brief Get the value of the non-dimensionalized thermodynamic pressure. * \return Non-dimensionalized thermodynamic pressure. diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index cc5bd3faca69..ccc4f4fdc314 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -1211,6 +1211,9 @@ 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*/ diff --git a/SU2_CFD/include/fluid/CFluidScalar.hpp b/SU2_CFD/include/fluid/CFluidScalar.hpp index 1db6307cd46e..5c0618de43cc 100644 --- a/SU2_CFD/include/fluid/CFluidScalar.hpp +++ b/SU2_CFD/include/fluid/CFluidScalar.hpp @@ -42,6 +42,7 @@ 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 Reference temperature. */ const su2double GasConstant_Ref; /*!< \brief Gas constant reference needed for Nondimensional problems. */ const su2double Prandtl_Number; /*!< \brief Prandlt number.*/ diff --git a/SU2_CFD/src/fluid/CFluidScalar.cpp b/SU2_CFD/src/fluid/CFluidScalar.cpp index b52c3b0b0b55..c305a74c7077 100644 --- a/SU2_CFD/src/fluid/CFluidScalar.cpp +++ b/SU2_CFD/src/fluid/CFluidScalar.cpp @@ -45,6 +45,7 @@ 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_RefTemperature()), GasConstant_Ref(config->GetGas_Constant_Ref()), Prandtl_Number(config->GetPrandtl_Turb()), wilke(config->GetKind_MixingViscosityModel() == MIXINGVISCOSITYMODEL::WILKE), @@ -213,7 +214,7 @@ su2double CFluidScalar::ComputeMeanSpecificHeatCp(const su2double* val_scalars) } su2double CFluidScalar::ComputeEnthalpyFromT(const su2double val_temperature, const su2double* val_scalars){ - su2double val_Enthalpy = Cp * (val_temperature - 298.15); + su2double val_Enthalpy = Cp * (val_temperature - Ref_Temperature); return val_Enthalpy; } @@ -221,15 +222,15 @@ void CFluidScalar::ComputeTempFromEnthalpy(const su2double val_enthalpy, su2doub const su2double* val_scalars) { MassToMoleFractions(val_scalars); su2double val_cp = ComputeMeanSpecificHeatCp(val_scalars); - *val_temperature = val_enthalpy / val_cp + 298.15; + *val_temperature = val_enthalpy / val_cp + Ref_Temperature; } void CFluidScalar::GetEnthalpyDiffusivity(su2double* enthalpy_diffusions) { + const su2double enthalpy_species_N = specificHeat[n_species_mixture - 1] * (Temperature - Ref_Temperature); for (int iVar = 0; iVar < n_species_mixture - 1; iVar++) { - enthalpy_diffusions[iVar] = Density * - (specificHeat[iVar] * massDiffusivity[iVar] - - specificHeat[n_species_mixture - 1] * massDiffusivity[n_species_mixture - 1]) * - (Temperature - 298.15); + const su2double enthalpy_species_i = specificHeat[iVar] * (Temperature - Ref_Temperature); + enthalpy_diffusions[iVar] = Density * (enthalpy_species_i * massDiffusivity[iVar] - + enthalpy_species_N * massDiffusivity[n_species_mixture - 1]); } } From 3f45e1c969f031c19f3558b005c85eb8125b3b7d Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Tue, 18 Feb 2025 12:30:20 +0100 Subject: [PATCH 17/97] reformulating and cleaning --- SU2_CFD/include/numerics/CNumerics.hpp | 3 + .../include/numerics/flow/convection/fds.hpp | 2 +- SU2_CFD/src/numerics/CNumerics.cpp | 53 ++++------------ SU2_CFD/src/numerics/flow/convection/fds.cpp | 62 +++++++------------ SU2_CFD/src/solvers/CIncEulerSolver.cpp | 62 +++++++------------ 5 files changed, 63 insertions(+), 119 deletions(-) diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index cec666bc72d5..37ed3a036fce 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -103,6 +103,9 @@ class CNumerics { su2double Enthalpy_i, /*!< \brief Enthalpy at point i. */ Enthalpy_j; /*!< \brief Enthalpy at point j. */ + su2double + WorkingVariable_i, /*!< \brief Enthalpy at point i. */ + WorkingVariable_j; /*!< \brief Enthalpy at point j. */ su2double dist_i, /*!< \brief Distance of point i to the nearest wall. */ dist_j; /*!< \brief Distance of point j to the nearest wall. */ diff --git a/SU2_CFD/include/numerics/flow/convection/fds.hpp b/SU2_CFD/include/numerics/flow/convection/fds.hpp index e72db06db6a3..2e39d8fc10bd 100644 --- a/SU2_CFD/include/numerics/flow/convection/fds.hpp +++ b/SU2_CFD/include/numerics/flow/convection/fds.hpp @@ -51,7 +51,7 @@ class CUpwFDSInc_Flow final : public CNumerics { Pressure_j, ProjVelocity, MeandRhodT, dRhodT_i, dRhodT_j, /*!< \brief Derivative of density w.r.t. temperature (variable density flows). */ Temperature_i, Temperature_j, /*!< \brief Temperature at node 0 and 1. */ - MeanDensity, MeanPressure, MeanSoundSpeed, MeanBetaInc2, MeanEnthalpy, MeanCp, MeanTemperature; /*!< \brief Mean values of primitive variables. */ + MeanDensity, MeanPressure, MeanSoundSpeed, MeanBetaInc2, MeanWorkingVar, MeanCp, MeanTemperature; /*!< \brief Mean values of primitive variables. */ unsigned short iDim, iVar, jVar, kVar; su2double* Flux = nullptr; /*!< \brief The flux / residual across the edge. */ diff --git a/SU2_CFD/src/numerics/CNumerics.cpp b/SU2_CFD/src/numerics/CNumerics.cpp index f78e4b602885..116ce359ee5d 100644 --- a/SU2_CFD/src/numerics/CNumerics.cpp +++ b/SU2_CFD/src/numerics/CNumerics.cpp @@ -279,20 +279,10 @@ void CNumerics::GetInviscidIncProjJac(const su2double *val_density, const su2dou val_Proj_Jac_Tensor[2][2] = val_scale*((*val_density)*(proj_vel + val_normal[1]*val_velocity[1])); val_Proj_Jac_Tensor[2][3] = val_scale*((*val_dRhodT)*val_velocity[1]*proj_vel); - if (energy_multicomponent) { - val_Proj_Jac_Tensor[3][0] = val_scale * ((*val_temperature) * proj_vel / (*val_betainc2)); - val_Proj_Jac_Tensor[3][1] = val_scale * ((*val_temperature) * val_normal[0] * (*val_density)); - val_Proj_Jac_Tensor[3][2] = val_scale * ((*val_temperature) * val_normal[1] * (*val_density)); - val_Proj_Jac_Tensor[3][3] = - val_scale * ((*val_temperature) * (*val_dRhodT) + (*val_density)) * proj_vel; - - } else { - val_Proj_Jac_Tensor[3][0] = val_scale * ((*val_cp) * (*val_temperature) * proj_vel / (*val_betainc2)); - val_Proj_Jac_Tensor[3][1] = val_scale * ((*val_cp) * (*val_temperature) * val_normal[0] * (*val_density)); - val_Proj_Jac_Tensor[3][2] = val_scale * ((*val_cp) * (*val_temperature) * val_normal[1] * (*val_density)); - val_Proj_Jac_Tensor[3][3] = - val_scale * ((*val_cp) * ((*val_temperature) * (*val_dRhodT) + (*val_density)) * proj_vel); - } + val_Proj_Jac_Tensor[3][0] = val_scale*((*val_cp)*(*val_temperature)*proj_vel/(*val_betainc2)); + val_Proj_Jac_Tensor[3][1] = val_scale*((*val_cp)*(*val_temperature)*val_normal[0]*(*val_density)); + val_Proj_Jac_Tensor[3][2] = val_scale*((*val_cp)*(*val_temperature)*val_normal[1]*(*val_density)); + val_Proj_Jac_Tensor[3][3] = val_scale*((*val_cp)*((*val_temperature)*(*val_dRhodT) + (*val_density))*proj_vel); } else { @@ -319,22 +309,13 @@ void CNumerics::GetInviscidIncProjJac(const su2double *val_density, const su2dou val_Proj_Jac_Tensor[3][2] = val_scale*(val_normal[1]*(*val_density)*val_velocity[2]); val_Proj_Jac_Tensor[3][3] = val_scale*((*val_density)*(proj_vel + val_normal[2]*val_velocity[2])); val_Proj_Jac_Tensor[3][4] = val_scale*((*val_dRhodT)*val_velocity[2]*proj_vel); - - if (energy_multicomponent) { - val_Proj_Jac_Tensor[4][0] = val_scale * ((*val_temperature) * proj_vel / (*val_betainc2)); - val_Proj_Jac_Tensor[4][1] = val_scale * ((*val_temperature) * val_normal[0] * (*val_density)); - val_Proj_Jac_Tensor[4][2] = val_scale * ((*val_temperature) * val_normal[1] * (*val_density)); - val_Proj_Jac_Tensor[4][3] = val_scale * ((*val_temperature) * val_normal[2] * (*val_density)); - val_Proj_Jac_Tensor[4][4] = - val_scale * ((*val_temperature) * (*val_dRhodT) + (*val_density)) * proj_vel; - } else { - val_Proj_Jac_Tensor[4][0] = val_scale * ((*val_cp) * (*val_temperature) * proj_vel / (*val_betainc2)); - val_Proj_Jac_Tensor[4][1] = val_scale * ((*val_cp) * (*val_temperature) * val_normal[0] * (*val_density)); - val_Proj_Jac_Tensor[4][2] = val_scale * ((*val_cp) * (*val_temperature) * val_normal[1] * (*val_density)); - val_Proj_Jac_Tensor[4][3] = val_scale * ((*val_cp) * (*val_temperature) * val_normal[2] * (*val_density)); - val_Proj_Jac_Tensor[4][4] = - val_scale * ((*val_cp) * ((*val_temperature) * (*val_dRhodT) + (*val_density)) * proj_vel); - } + + val_Proj_Jac_Tensor[4][0] = val_scale*((*val_cp)*(*val_temperature)*proj_vel/(*val_betainc2)); + val_Proj_Jac_Tensor[4][1] = val_scale*((*val_cp)*(*val_temperature)*val_normal[0]*(*val_density)); + val_Proj_Jac_Tensor[4][2] = val_scale*((*val_cp)*(*val_temperature)*val_normal[1]*(*val_density)); + val_Proj_Jac_Tensor[4][3] = val_scale*((*val_cp)*(*val_temperature)*val_normal[2]*(*val_density)); + val_Proj_Jac_Tensor[4][4] = val_scale*((*val_cp)*((*val_temperature)*(*val_dRhodT) + (*val_density))*proj_vel); + } AD::EndPassive(wasActive); } @@ -348,11 +329,7 @@ void CNumerics::GetPreconditioner(const su2double *val_density, const su2double val_Precon[0][0] = 1.0/(*val_betainc2); for (iDim = 0; iDim < nDim; iDim++) val_Precon[iDim+1][0] = val_velocity[iDim]/(*val_betainc2); - if (energy_multicomponent){ - val_Precon[nDim+1][0] = (*val_temperature)/(*val_betainc2); - }else{ - val_Precon[nDim+1][0] = (*val_cp)*(*val_temperature)/(*val_betainc2); - } + val_Precon[nDim+1][0] = (*val_cp)*(*val_temperature)/(*val_betainc2); for (jDim = 0; jDim < nDim; jDim++) { val_Precon[0][jDim+1] = 0.0; @@ -366,11 +343,7 @@ void CNumerics::GetPreconditioner(const su2double *val_density, const su2double val_Precon[0][nDim+1] = (*val_drhodt); for (iDim = 0; iDim < nDim; iDim++) val_Precon[iDim+1][nDim+1] = val_velocity[iDim]*(*val_drhodt); - if (energy_multicomponent){ - val_Precon[nDim+1][nDim+1] = (*val_drhodt)*(*val_temperature) + (*val_density); - }else{ - val_Precon[nDim+1][nDim+1] = (*val_cp)*((*val_drhodt)*(*val_temperature) + (*val_density)); - } + val_Precon[nDim+1][nDim+1] = (*val_cp)*((*val_drhodt)*(*val_temperature) + (*val_density)); } diff --git a/SU2_CFD/src/numerics/flow/convection/fds.cpp b/SU2_CFD/src/numerics/flow/convection/fds.cpp index 115a966896bd..a941a8008e63 100644 --- a/SU2_CFD/src/numerics/flow/convection/fds.cpp +++ b/SU2_CFD/src/numerics/flow/convection/fds.cpp @@ -121,9 +121,13 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config if (energy_multicomponent) { Enthalpy_i = V_i[nDim + 9]; Enthalpy_j = V_j[nDim + 9]; + WorkingVariable_i = Enthalpy_i; + WorkingVariable_j = Enthalpy_j; } else { Enthalpy_i = Cp_i * Temperature_i; Enthalpy_j = Cp_j * Temperature_j; + WorkingVariable_i = Temperature_i; + WorkingVariable_j = Temperature_j; } ProjVelocity = 0.0; @@ -149,7 +153,7 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config MeanDensity = 0.5*(DensityInc_i + DensityInc_j); MeanPressure = 0.5*(Pressure_i + Pressure_j); MeanBetaInc2 = 0.5*(BetaInc2_i + BetaInc2_j); - MeanEnthalpy = 0.5*(Enthalpy_i + Enthalpy_j); + MeanWorkingVar = 0.5*(WorkingVariable_i + WorkingVariable_j); MeanCp = 0.5*(Cp_i + Cp_j); MeanTemperature = 0.5*(Temperature_i + Temperature_j); @@ -163,15 +167,17 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config MeandRhodT = 0.0; dRhodT_i = 0.0; dRhodT_j = 0.0; if (variable_density) { - if (energy_multicomponent) { - MeandRhodT = -MeanDensity / (MeanCp * MeanTemperature); - dRhodT_i = -DensityInc_i / (Cp_i * Temperature_i); - dRhodT_j = -DensityInc_j / (Cp_j * Temperature_j); - } else { - MeandRhodT = -MeanDensity / MeanTemperature; - dRhodT_i = -DensityInc_i / Temperature_i; - dRhodT_j = -DensityInc_j / Temperature_j; - } + MeandRhodT = -MeanDensity / MeanTemperature; + dRhodT_i = -DensityInc_i / Temperature_i; + dRhodT_j = -DensityInc_j / Temperature_j; + } + if (energy_multicomponent) { + MeandRhodT /= MeanCp ; + dRhodT_i /= Cp_i; + dRhodT_j /= Cp_j; + MeanCp = 1.0; + Cp_i = 1.0; + Cp_j = 1.0; } /*--- Compute ProjFlux_i ---*/ @@ -204,11 +210,7 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config Lambda[iVar] = fabs(Lambda[iVar]); /*--- Build the preconditioning matrix using mean values ---*/ - if (energy_multicomponent) { - GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanEnthalpy, &MeandRhodT, Precon); - } else { - GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanTemperature, &MeandRhodT, Precon); - } + GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanWorkingVar, &MeandRhodT, Precon); /*--- Build the absolute value of the preconditioned Jacobian, i.e., |A_precon| = P x |Lambda| x inv(P), where P diagonalizes the matrix @@ -221,26 +223,15 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config Diff_V[0] = Pressure_j - Pressure_i; for (iDim = 0; iDim < nDim; iDim++) Diff_V[iDim+1] = Velocity_j[iDim] - Velocity_i[iDim]; - if (energy_multicomponent){ - Diff_V[nDim+1] = Enthalpy_j - Enthalpy_i; - }else{ - Diff_V[nDim+1] = Temperature_j - Temperature_i; - } + Diff_V[nDim + 1] = WorkingVariable_j - WorkingVariable_i; /*--- Build the inviscid Jacobian w.r.t. the primitive variables ---*/ if (implicit) { - if (energy_multicomponent) { - GetInviscidIncProjJac(&DensityInc_i, Velocity_i, &BetaInc2_i, &Cp_i, &Enthalpy_i, &dRhodT_i, Normal, 0.5, - Jacobian_i); - GetInviscidIncProjJac(&DensityInc_j, Velocity_j, &BetaInc2_j, &Cp_j, &Enthalpy_j, &dRhodT_j, Normal, 0.5, - Jacobian_j); - } else { - GetInviscidIncProjJac(&DensityInc_i, Velocity_i, &BetaInc2_i, &Cp_i, &Temperature_i, &dRhodT_i, Normal, 0.5, - Jacobian_i); - GetInviscidIncProjJac(&DensityInc_j, Velocity_j, &BetaInc2_j, &Cp_j, &Temperature_j, &dRhodT_j, Normal, 0.5, - Jacobian_j); - } + GetInviscidIncProjJac(&DensityInc_i, Velocity_i, &BetaInc2_i, &Cp_i, &WorkingVariable_i, &dRhodT_i, Normal, 0.5, + Jacobian_i); + GetInviscidIncProjJac(&DensityInc_j, Velocity_j, &BetaInc2_j, &Cp_j, &WorkingVariable_j, &dRhodT_j, Normal, 0.5, + Jacobian_j); } /*--- Compute dissipation as Precon x |A_precon| x dV. If implicit, @@ -286,13 +277,8 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config Jacobian_i[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_i; Jacobian_j[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_j; } - if (energy_multicomponent){ - Jacobian_i[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_i; - Jacobian_j[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_j; - } else { - Jacobian_i[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_i*Cp_i; - Jacobian_j[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_j*Cp_j; - } + Jacobian_i[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_i*Cp_i; + Jacobian_j[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_j*Cp_j; } } } diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index aa6bea96a0d1..a939af159e12 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -2073,7 +2073,10 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo Cp = nodes->GetSpecificHeatCp(iPoint); oneOverCp = 1.0/Cp; Temperature = nodes->GetTemperature(iPoint); - if (energy && multicomponent) Enthalpy = nodes->GetEnthalpy(iPoint); + Enthalpy = Cp * Temperature; + if (energy && multicomponent) { + Enthalpy = nodes->GetEnthalpy(iPoint); + } for (iDim = 0; iDim < nDim; iDim++) Velocity[iDim] = nodes->GetVelocity(iPoint,iDim); @@ -2085,6 +2088,7 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo if (variable_density) { if (multicomponent && energy){ dRhodT = -Density / (Cp * Temperature); + Cp = oneOverCp = 1.0; } else { dRhodT = -Density/Temperature; } @@ -2105,13 +2109,9 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo Preconditioner[iDim+1][0] = Velocity[iDim]/BetaInc2; if (energy) { - if (multicomponent) { - Preconditioner[nDim + 1][0] = Enthalpy / BetaInc2; - } else { - Preconditioner[nDim + 1][0] = Cp * Temperature / BetaInc2; - } + Preconditioner[nDim+1][0] = Enthalpy / BetaInc2; } else { - Preconditioner[nDim + 1][0] = 0.0; + Preconditioner[nDim+1][0] = 0.0; } for (jDim = 0; jDim < nDim; jDim++) { @@ -2128,13 +2128,9 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo Preconditioner[iDim+1][nDim+1] = Velocity[iDim]*dRhodT; if (energy) { - if (multicomponent) { - Preconditioner[nDim + 1][nDim + 1] = dRhodT * Enthalpy + Density; - } else { - Preconditioner[nDim + 1][nDim + 1] = Cp * (dRhodT * Temperature + Density); - } + Preconditioner[nDim+1][nDim+1] = dRhodT * Enthalpy + Cp * Density; } else { - Preconditioner[nDim + 1][nDim + 1] = 1.0; + Preconditioner[nDim+1][nDim+1] = 1.0; } for (iVar = 0; iVar < nVar; iVar ++ ) @@ -2147,50 +2143,36 @@ 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. ---*/ - if (multicomponent && energy) { - Preconditioner[0][0] = Enthalpy * BetaInc2 * dRhodT / Density + BetaInc2; - } else { - Preconditioner[0][0] = Temperature * BetaInc2 * dRhodT / Density + BetaInc2; - } + + Preconditioner[0][0] = Enthalpy * BetaInc2 * dRhodT * oneOverCp / Density + BetaInc2; + for (iDim = 0; iDim < nDim; iDim++) Preconditioner[iDim + 1][0] = -1.0 * Velocity[iDim] / Density; if (energy) { - if (multicomponent) { - Preconditioner[nDim + 1][0] = -1.0 * Enthalpy / Density; - } else { - Preconditioner[nDim + 1][0] = -1.0 * Temperature / Density; - } + Preconditioner[nDim+1][0] = -1.0 * Enthalpy * oneOverCp / Density; } else { - Preconditioner[nDim + 1][0] = 0.0; + Preconditioner[nDim+1][0] = 0.0; } for (jDim = 0; jDim < nDim; jDim++) { - Preconditioner[0][jDim + 1] = 0.0; + Preconditioner[0][jDim+1] = 0.0; for (iDim = 0; iDim < nDim; iDim++) { if (iDim == jDim) - Preconditioner[iDim + 1][jDim + 1] = 1.0 / Density; + Preconditioner[iDim+1][jDim+1] = 1.0 / Density; else - Preconditioner[iDim + 1][jDim + 1] = 0.0; + Preconditioner[iDim+1][jDim+1] = 0.0; } - Preconditioner[nDim + 1][jDim + 1] = 0.0; + Preconditioner[nDim+1][jDim+1] = 0.0; } - if (multicomponent && energy) { - Preconditioner[0][nDim + 1] = -1.0 * BetaInc2 * dRhodT / Density; - } else { - Preconditioner[0][nDim + 1] = -1.0 * BetaInc2 * dRhodT * oneOverCp / Density; - } - for (iDim = 0; iDim < nDim; iDim++) Preconditioner[iDim + 1][nDim + 1] = 0.0; + Preconditioner[0][nDim+1] = -1.0 * BetaInc2 * dRhodT * oneOverCp / Density; + for (iDim = 0; iDim < nDim; iDim++) Preconditioner[iDim+1][nDim+1] = 0.0; if (energy) { - if (multicomponent) { - Preconditioner[nDim + 1][nDim + 1] = 1.0 / Density; - } else { - Preconditioner[nDim + 1][nDim + 1] = oneOverCp / Density; - } + Preconditioner[nDim+1][nDim+1] = oneOverCp / Density; } else { - Preconditioner[nDim + 1][nDim + 1] = 0.0; + Preconditioner[nDim+1][nDim+1] = 0.0; } } } From b1fc9d43ed71fd704de3c0515bfed064acc46a5b Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Wed, 19 Feb 2025 14:01:52 +0100 Subject: [PATCH 18/97] cleaning flow_diffusion.hpp and .cpp --- .../include/numerics/flow/flow_diffusion.hpp | 8 +++--- SU2_CFD/src/numerics/flow/flow_diffusion.cpp | 26 ++++++------------- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/SU2_CFD/include/numerics/flow/flow_diffusion.hpp b/SU2_CFD/include/numerics/flow/flow_diffusion.hpp index f3b997a97016..558d035eb1b1 100644 --- a/SU2_CFD/include/numerics/flow/flow_diffusion.hpp +++ b/SU2_CFD/include/numerics/flow/flow_diffusion.hpp @@ -51,8 +51,6 @@ class CAvgGrad_Base : public CNumerics { *heat_flux_jac_i = nullptr, /*!< \brief Jacobian of the molecular + turbulent heat flux vector, projected onto the normal vector. */ **tau_jacobian_i = nullptr; /*!< \brief Jacobian of the viscous + turbulent stress tensor, projected onto the normal vector. */ su2double *Mean_PrimVar = nullptr; /*!< \brief Mean primitive variables. */ - su2double Mean_HeatFluxDiffusion; /*!< \brief Mean heat flux due to enthalpy diffusion for multicomponent flows. */ - su2double Mean_JacHeatFluxDiffusion; /*!< \brief Mean Jacobian heat flux due to enthalpy diffusion for multicomponent flows. */ const su2double *PrimVar_i = nullptr, *PrimVar_j = nullptr; /*!< \brief Primitives variables at point i and j. */ @@ -301,10 +299,10 @@ class CAvgGradInc_Flow final : public CAvgGrad_Base { * \param[in] val_gradprimvar - Gradient of the primitive variables. * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face. * \param[in] val_thermal_conductivity - Thermal conductivity. - * \param[in] val_heatDiffusion - Heat diffusion */ - void GetViscousIncProjFlux(const su2double* const* val_gradprimvar, const su2double* val_normal, - su2double val_thermal_conductivity, su2double val_heatFluxDiffusion); + void GetViscousIncProjFlux(const su2double* const *val_gradprimvar, + const su2double *val_normal, + su2double val_thermal_conductivity); /*! * \brief Compute the projection of the viscous Jacobian matrices. diff --git a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp index ddef652b8dbf..0bfce624285c 100644 --- a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp +++ b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp @@ -583,10 +583,6 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi Laminar_Viscosity_i = V_i[nDim+4]; Laminar_Viscosity_j = V_j[nDim+4]; Eddy_Viscosity_i = V_i[nDim+5]; Eddy_Viscosity_j = V_j[nDim+5]; Thermal_Conductivity_i = V_i[nDim+6]; Thermal_Conductivity_j = V_j[nDim+6]; - if (energy_multicomponent) { - Cp_i = V_i[nDim + 7]; - Cp_j = V_j[nDim + 7]; - } /*--- Mean transport properties ---*/ @@ -594,9 +590,6 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi Mean_Eddy_Viscosity = 0.5*(Eddy_Viscosity_i + Eddy_Viscosity_j); Mean_turb_ke = 0.5*(turb_ke_i + turb_ke_j); Mean_Thermal_Conductivity = 0.5*(Thermal_Conductivity_i + Thermal_Conductivity_j); - if (energy_multicomponent) { - Mean_Heat_Capacity = 0.5 * (Cp_i + Cp_j); - } /*--- Mean gradient approximation ---*/ @@ -630,13 +623,12 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi if (config->GetSAParsedOptions().qcr2000) AddQCR(nDim, &Mean_GradPrimVar[1], tau); if (Mean_TauWall > 0) AddTauWall(UnitNormal, Mean_TauWall); + GetViscousIncProjFlux(Mean_GradPrimVar, Normal, Mean_Thermal_Conductivity); + if (energy_multicomponent) { - Mean_HeatFluxDiffusion = HeatFluxDiffusion; - Mean_JacHeatFluxDiffusion = Jac_HeatFluxDiffusion; + Proj_Flux_Tensor[nVar - 1] += HeatFluxDiffusion; } - GetViscousIncProjFlux(Mean_GradPrimVar, Normal, Mean_Thermal_Conductivity, Mean_HeatFluxDiffusion); - /*--- Implicit part ---*/ if (implicit) { @@ -662,10 +654,11 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi } proj_vector_ij = proj_vector_ij/dist_ij_2; if (energy_multicomponent){ + Mean_Heat_Capacity = 0.5 * (V_i[nDim + 7] + V_j[nDim + 7]); Jacobian_i[nDim + 1][nDim + 1] = - -(Mean_Thermal_Conductivity * proj_vector_ij + Mean_JacHeatFluxDiffusion) / Mean_Heat_Capacity; + -(Mean_Thermal_Conductivity * proj_vector_ij + Jac_HeatFluxDiffusion) / Mean_Heat_Capacity; Jacobian_j[nDim + 1][nDim + 1] = - (Mean_Thermal_Conductivity * proj_vector_ij + Mean_JacHeatFluxDiffusion) / Mean_Heat_Capacity; + (Mean_Thermal_Conductivity * proj_vector_ij + Jac_HeatFluxDiffusion) / Mean_Heat_Capacity; } else { Jacobian_i[nDim + 1][nDim + 1] = -Mean_Thermal_Conductivity * proj_vector_ij; Jacobian_j[nDim + 1][nDim + 1] = Mean_Thermal_Conductivity * proj_vector_ij; @@ -696,8 +689,7 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi void CAvgGradInc_Flow::GetViscousIncProjFlux(const su2double* const *val_gradprimvar, const su2double *val_normal, - su2double val_thermal_conductivity, - su2double val_heatDiffusion) { + su2double val_thermal_conductivity) { /*--- Gradient of primitive variables -> [Pressure vel_x vel_y vel_z Temperature] ---*/ @@ -741,9 +733,7 @@ void CAvgGradInc_Flow::GetViscousIncProjFlux(const su2double* const *val_gradpri for (unsigned short iDim = 0; iDim < nDim; iDim++) Proj_Flux_Tensor[iVar] += Flux_Tensor[iVar][iDim] * val_normal[iDim]; } - if (energy_multicomponent) { - Proj_Flux_Tensor[nVar - 1] += val_heatDiffusion; - } + } void CAvgGradInc_Flow::GetViscousIncProjJacs(su2double val_dS, From b23913a797e1b504b4f9a1676cbce367b7fbb09c Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Fri, 21 Feb 2025 11:52:04 +0100 Subject: [PATCH 19/97] removing spaces --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 2 +- SU2_CFD/src/numerics/CNumerics.cpp | 4 ++-- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index a4e2f8849317..d7a634e82271 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -434,7 +434,7 @@ void CFVMFlowSolverBase::Viscous_Residual_impl(unsigned long iEdge, CGeome const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST); - CVariable* turbNodes = nullptr; + CVariable* turbNodes = nullptr; if (tkeNeeded) turbNodes = solver_container[TURB_SOL]->GetNodes(); /*--- Points, coordinates and normal vector in edge ---*/ diff --git a/SU2_CFD/src/numerics/CNumerics.cpp b/SU2_CFD/src/numerics/CNumerics.cpp index 116ce359ee5d..5dcf37df568c 100644 --- a/SU2_CFD/src/numerics/CNumerics.cpp +++ b/SU2_CFD/src/numerics/CNumerics.cpp @@ -309,13 +309,13 @@ void CNumerics::GetInviscidIncProjJac(const su2double *val_density, const su2dou val_Proj_Jac_Tensor[3][2] = val_scale*(val_normal[1]*(*val_density)*val_velocity[2]); val_Proj_Jac_Tensor[3][3] = val_scale*((*val_density)*(proj_vel + val_normal[2]*val_velocity[2])); val_Proj_Jac_Tensor[3][4] = val_scale*((*val_dRhodT)*val_velocity[2]*proj_vel); - + val_Proj_Jac_Tensor[4][0] = val_scale*((*val_cp)*(*val_temperature)*proj_vel/(*val_betainc2)); val_Proj_Jac_Tensor[4][1] = val_scale*((*val_cp)*(*val_temperature)*val_normal[0]*(*val_density)); val_Proj_Jac_Tensor[4][2] = val_scale*((*val_cp)*(*val_temperature)*val_normal[1]*(*val_density)); val_Proj_Jac_Tensor[4][3] = val_scale*((*val_cp)*(*val_temperature)*val_normal[2]*(*val_density)); val_Proj_Jac_Tensor[4][4] = val_scale*((*val_cp)*((*val_temperature)*(*val_dRhodT) + (*val_density))*proj_vel); - + } AD::EndPassive(wasActive); } diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index a939af159e12..84773f2a75ac 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -2170,7 +2170,6 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo if (energy) { Preconditioner[nDim+1][nDim+1] = oneOverCp / Density; - } else { Preconditioner[nDim+1][nDim+1] = 0.0; } From 1961b08292d5ba64b29630749f6af1ffbecc94f4 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Fri, 21 Feb 2025 15:05:49 +0100 Subject: [PATCH 20/97] fix description working variable --- SU2_CFD/include/numerics/CNumerics.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 37ed3a036fce..afe18ee87a1b 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -104,8 +104,8 @@ class CNumerics { Enthalpy_i, /*!< \brief Enthalpy at point i. */ Enthalpy_j; /*!< \brief Enthalpy at point j. */ su2double - WorkingVariable_i, /*!< \brief Enthalpy at point i. */ - WorkingVariable_j; /*!< \brief Enthalpy at point j. */ + WorkingVariable_i, /*!< \brief Working Variable at point i for incompressible solver. */ + WorkingVariable_j; /*!< \brief Working Variable at point j for incompressible solver. */ su2double dist_i, /*!< \brief Distance of point i to the nearest wall. */ dist_j; /*!< \brief Distance of point j to the nearest wall. */ From 02e5eac957b037dcba30c5dd1b229a552cbedf83 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sat, 22 Feb 2025 10:43:08 +0100 Subject: [PATCH 21/97] update parallel regresion test --- TestCases/parallel_regression.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 530328b52a64..5e8555798170 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1525,7 +1525,7 @@ def main(): species2_primitiveVenturi_mixingmodel.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel.cfg_file = "species2_primitiveVenturi_mixingmodel.cfg" species2_primitiveVenturi_mixingmodel.test_iter = 50 - species2_primitiveVenturi_mixingmodel.test_vals = [ -5.407755, -4.557255, -4.635502, -5.642910, -0.059627, -5.546376, 5.000000, -1.879995, 5.000000, -4.898985, 5.000000, -1.169389, 0.000551, 0.000483, 0.000068, 0.000000] + species2_primitiveVenturi_mixingmodel.test_vals = [ -5.406062, -4.556225, -4.633753, -5.644242, -0.058437, -5.545635, 5.000000, -1.881888, 5.000000, -4.900700, 5.000000, -1.169412, 0.000559, 0.000492, 0.000067, 0.000000] test_list.append(species2_primitiveVenturi_mixingmodel) # 2 species (1 eq) primitive venturi mixing using mixing model and bounded scalar transport @@ -1533,7 +1533,7 @@ def main(): species2_primitiveVenturi_mixingmodel_boundedscalar.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_boundedscalar.cfg_file = "species2_primitiveVenturi_mixingmodel_boundedscalar.cfg" species2_primitiveVenturi_mixingmodel_boundedscalar.test_iter = 50 - species2_primitiveVenturi_mixingmodel_boundedscalar.test_vals = [-5.392378, -4.492373, -4.576491, -5.759780, -0.137797, -5.677531, 5.000000, -1.895013, 5.000000, -4.806816, 5.000000, -1.697769, 0.000275, 0.000275, 0.000000, 0.000000] + species2_primitiveVenturi_mixingmodel_boundedscalar.test_vals = [-5.390872, -4.491249, -4.575176, -5.760619, -0.137842, -5.677153, 5.000000, -1.896522, 5.000000, -4.806007, 5.000000, -1.697287, 0.000275, 0.000275, 0.000000, 0.000000] test_list.append(species2_primitiveVenturi_mixingmodel_boundedscalar) # 2 species (1 eq) primitive venturi mixing using mixing model including viscosity, thermal conductivity and inlet markers for SA turbulence model @@ -1549,7 +1549,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_iter = 50 - species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-5.688779, -4.556193, -4.513326, -6.563666, 2.298459, -5.423525, 30.000000, -6.903871, 13.000000, -8.224587, 8.000000, -9.119625, 2.078869, 1.000000, 0.600000, 0.478869] + species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-5.705589, -4.493347, -4.464137, -6.399752, 2.021703, -5.466399, 30.000000, -7.430567, 13.000000, -8.018769, 8.000000, -8.506180, 2.092565, 1.000000, 0.600000, 0.492565] test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2) # 2 species (1 eq) primitive venturi mixing using mixing model including heat capacity and mass diffusivity NonDimensional case From 810d2df97d1f5da9b43c2f64868706767d18709a Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sat, 22 Feb 2025 11:32:09 +0100 Subject: [PATCH 22/97] fix non-dimensionalization issue --- Common/include/CConfig.hpp | 4 ++-- SU2_CFD/src/fluid/CFluidScalar.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index a53eaef1218b..de1eafb8eac2 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -1928,9 +1928,9 @@ class CConfig { /*! * \brief Get the value of the standard reference temperature for multicomponent flows. - * \return Standard reference temperature. + * \return Standard reference temperature, Non-dimensionalized if it is needed for Non-Dimensional problems. */ - su2double GetStandard_RefTemperature(void) const { return Standard_Ref_Temperature; } + su2double GetStandard_RefTemperatureND(void) const { return Standard_Ref_Temperature / Temperature_Ref; } /*! * \brief Get the value of the non-dimensionalized thermodynamic pressure. diff --git a/SU2_CFD/src/fluid/CFluidScalar.cpp b/SU2_CFD/src/fluid/CFluidScalar.cpp index c305a74c7077..ac22fb7d5f3d 100644 --- a/SU2_CFD/src/fluid/CFluidScalar.cpp +++ b/SU2_CFD/src/fluid/CFluidScalar.cpp @@ -45,7 +45,7 @@ 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_RefTemperature()), + Ref_Temperature(config->GetStandard_RefTemperatureND()), GasConstant_Ref(config->GetGas_Constant_Ref()), Prandtl_Number(config->GetPrandtl_Turb()), wilke(config->GetKind_MixingViscosityModel() == MIXINGVISCOSITYMODEL::WILKE), From 70ae6eebe293c1aad167d858d10a5a8b5b981afb Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sat, 22 Feb 2025 14:03:32 +0100 Subject: [PATCH 23/97] updating species Non-Dimensional test case --- TestCases/parallel_regression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 5e8555798170..183341de5163 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1557,7 +1557,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_iter = 50 - species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.287504, -4.852957, -4.798004, -7.501815, 1.991002, -5.023713, 10.000000, -2.696121, 3.000000, -5.182457, 5.000000, -5.561055, 2.078843, 1.000000, 0.600000, 0.478843] + species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.291034, -4.770419, -4.743257, -7.365441, 1.709269, -5.067282, 10.000000, -2.860653, 4.000000, -5.134413, 5.000000, -5.474359, 2.093031, 1.000000, 0.600000, 0.493031] test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND) # 2 species (1 eq) primitive venturi mixing From 165a9ad43f0bda44d0ee725b8b7429bb9275e6d9 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Tue, 4 Mar 2025 13:31:26 +0100 Subject: [PATCH 24/97] fix parallel_regression.py --- TestCases/parallel_regression.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 45c6752016a0..353eeef35fe7 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1525,11 +1525,7 @@ def main(): species2_primitiveVenturi_mixingmodel.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel.cfg_file = "species2_primitiveVenturi_mixingmodel.cfg" species2_primitiveVenturi_mixingmodel.test_iter = 50 -<<<<<<< HEAD species2_primitiveVenturi_mixingmodel.test_vals = [ -5.406062, -4.556225, -4.633753, -5.644242, -0.058437, -5.545635, 5.000000, -1.881888, 5.000000, -4.900700, 5.000000, -1.169412, 0.000559, 0.000492, 0.000067, 0.000000] -======= - species2_primitiveVenturi_mixingmodel.test_vals = [-5.433571, -4.507202, -4.599966, -5.856697, -0.076061, -5.608935, 5.000000, -1.897907, 5.000000, -4.894972, 5.000000, -1.202673, 0.000538, 0.000476, 0.000062, 0.000000] ->>>>>>> develop test_list.append(species2_primitiveVenturi_mixingmodel) # 2 species (1 eq) primitive venturi mixing using mixing model and bounded scalar transport @@ -1537,11 +1533,7 @@ def main(): species2_primitiveVenturi_mixingmodel_boundedscalar.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_boundedscalar.cfg_file = "species2_primitiveVenturi_mixingmodel_boundedscalar.cfg" species2_primitiveVenturi_mixingmodel_boundedscalar.test_iter = 50 -<<<<<<< HEAD species2_primitiveVenturi_mixingmodel_boundedscalar.test_vals = [-5.390872, -4.491249, -4.575176, -5.760619, -0.137842, -5.677153, 5.000000, -1.896522, 5.000000, -4.806007, 5.000000, -1.697287, 0.000275, 0.000275, 0.000000, 0.000000] -======= - species2_primitiveVenturi_mixingmodel_boundedscalar.test_vals = [-5.397959, -4.441556, -4.532005, -6.118886, -0.129272, -5.681345, 5.000000, -1.986039, 5.000000, -4.961054, 5.000000, -1.880403, 0.000297, 0.000297, 0.000000, 0.000000] ->>>>>>> develop test_list.append(species2_primitiveVenturi_mixingmodel_boundedscalar) # 2 species (1 eq) primitive venturi mixing using mixing model including viscosity, thermal conductivity and inlet markers for SA turbulence model @@ -1557,11 +1549,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_iter = 50 -<<<<<<< HEAD species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-5.705589, -4.493347, -4.464137, -6.399752, 2.021703, -5.466399, 30.000000, -7.430567, 13.000000, -8.018769, 8.000000, -8.506180, 2.092565, 1.000000, 0.600000, 0.492565] -======= - species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-5.704159, -4.581981, -4.519914, -6.960130, 2.304741, -5.429054, 30.000000, -6.864204, 12.000000, -8.228958, 8.000000, -9.215808, 2.079379, 1.000000, 0.600000, 0.479379] ->>>>>>> develop test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2) # 2 species (1 eq) primitive venturi mixing using mixing model including heat capacity and mass diffusivity NonDimensional case @@ -1569,11 +1557,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_iter = 50 -<<<<<<< HEAD species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.291034, -4.770419, -4.743257, -7.365441, 1.709269, -5.067282, 10.000000, -2.860653, 4.000000, -5.134413, 5.000000, -5.474359, 2.093031, 1.000000, 0.600000, 0.493031] -======= - species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.304586, -4.884409, -4.811332, -7.928962, 1.999898, -5.034484, 10.000000, -2.603534, 3.000000, -5.374631, 5.000000, -5.612314, 2.079522, 1.000000, 0.600000, 0.479522] ->>>>>>> develop test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND) # 2 species (1 eq) primitive venturi mixing From eabaabf6d29abed5bed156ad464436ab9d7fbf0f Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Tue, 4 Mar 2025 15:25:00 +0100 Subject: [PATCH 25/97] updating regression test cases --- TestCases/parallel_regression.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 353eeef35fe7..f94a64d9f8cb 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1525,7 +1525,7 @@ def main(): species2_primitiveVenturi_mixingmodel.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel.cfg_file = "species2_primitiveVenturi_mixingmodel.cfg" species2_primitiveVenturi_mixingmodel.test_iter = 50 - species2_primitiveVenturi_mixingmodel.test_vals = [ -5.406062, -4.556225, -4.633753, -5.644242, -0.058437, -5.545635, 5.000000, -1.881888, 5.000000, -4.900700, 5.000000, -1.169412, 0.000559, 0.000492, 0.000067, 0.000000] + species2_primitiveVenturi_mixingmodel.test_vals = [ -5.432322, -4.506693, -4.598961, -5.858079, -0.074848, -5.608093, 5.000000, -1.900665, 5.000000, -4.895929, 5.000000, -1.202887, 0.000544, 0.000484, 0.000060, 0.000000] test_list.append(species2_primitiveVenturi_mixingmodel) # 2 species (1 eq) primitive venturi mixing using mixing model and bounded scalar transport @@ -1533,7 +1533,7 @@ def main(): species2_primitiveVenturi_mixingmodel_boundedscalar.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_boundedscalar.cfg_file = "species2_primitiveVenturi_mixingmodel_boundedscalar.cfg" species2_primitiveVenturi_mixingmodel_boundedscalar.test_iter = 50 - species2_primitiveVenturi_mixingmodel_boundedscalar.test_vals = [-5.390872, -4.491249, -4.575176, -5.760619, -0.137842, -5.677153, 5.000000, -1.896522, 5.000000, -4.806007, 5.000000, -1.697287, 0.000275, 0.000275, 0.000000, 0.000000] + species2_primitiveVenturi_mixingmodel_boundedscalar.test_vals = [-5.396930, -4.441229, -4.531561, -6.119468, -0.129257, -5.681246, 5.000000, -1.986168, 5.000000, -4.959587, 5.000000, -1.880063, 0.000297, 0.000297, 0.000000, 0.000000] test_list.append(species2_primitiveVenturi_mixingmodel_boundedscalar) # 2 species (1 eq) primitive venturi mixing using mixing model including viscosity, thermal conductivity and inlet markers for SA turbulence model @@ -1549,7 +1549,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_iter = 50 - species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-5.705589, -4.493347, -4.464137, -6.399752, 2.021703, -5.466399, 30.000000, -7.430567, 13.000000, -8.018769, 8.000000, -8.506180, 2.092565, 1.000000, 0.600000, 0.492565] + species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-5.683102, -4.564193, -4.448313, -6.737904, 2.044729, -5.467878, 30.000000, -7.621295, 12.000000, -8.052264, 8.000000, -8.963883, 2.092215, 1.000000, 0.600000, 0.492215] test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2) # 2 species (1 eq) primitive venturi mixing using mixing model including heat capacity and mass diffusivity NonDimensional case @@ -1557,7 +1557,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_iter = 50 - species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.291034, -4.770419, -4.743257, -7.365441, 1.709269, -5.067282, 10.000000, -2.860653, 4.000000, -5.134413, 5.000000, -5.474359, 2.093031, 1.000000, 0.600000, 0.493031] + species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.273052, -4.863236, -4.734578, -7.722857, 1.740741, -5.073467, 10.000000, -2.926106, 3.000000, -5.186545, 5.000000, -5.929953, 2.092322, 1.000000, 0.600000, 0.492322] test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND) # 2 species (1 eq) primitive venturi mixing From 4428a03fc1e81fdb5dcf7d074d908595c22d19bd Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Tue, 3 Jun 2025 08:34:12 +0200 Subject: [PATCH 26/97] update parallel regression test --- TestCases/parallel_regression.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 0b5d8d80f233..24b4cfc6fd13 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1542,7 +1542,7 @@ def main(): species2_primitiveVenturi_mixingmodel.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel.cfg_file = "species2_primitiveVenturi_mixingmodel.cfg" species2_primitiveVenturi_mixingmodel.test_iter = 50 - species2_primitiveVenturi_mixingmodel.test_vals = [ -5.432322, -4.506693, -4.598961, -5.858079, -0.074848, -5.608093, 5.000000, -1.900665, 5.000000, -4.895929, 5.000000, -1.202887, 0.000544, 0.000484, 0.000060, 0.000000] + species2_primitiveVenturi_mixingmodel.test_vals = [ -5.732153, -4.561603, -4.665933, -5.864167, -0.069493, -5.583639, 5.000000, -1.381549, 5.000000, -4.869625, 5.000000, -1.453019, 0.000378, 0.000362, 0.000016, 0.000000] test_list.append(species2_primitiveVenturi_mixingmodel) # 2 species (1 eq) primitive venturi mixing using mixing model and bounded scalar transport @@ -1550,7 +1550,7 @@ def main(): species2_primitiveVenturi_mixingmodel_boundedscalar.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_boundedscalar.cfg_file = "species2_primitiveVenturi_mixingmodel_boundedscalar.cfg" species2_primitiveVenturi_mixingmodel_boundedscalar.test_iter = 50 - species2_primitiveVenturi_mixingmodel_boundedscalar.test_vals = [-5.396930, -4.441229, -4.531561, -6.119468, -0.129257, -5.681246, 5.000000, -1.986168, 5.000000, -4.959587, 5.000000, -1.880063, 0.000297, 0.000297, 0.000000, 0.000000] + species2_primitiveVenturi_mixingmodel_boundedscalar.test_vals = [-5.688210, -4.507478, -4.611654, -6.120321, -0.118407, -5.705981, 5.000000, -1.439850, 5.000000, -4.922431, 5.000000, -1.768043, 0.000313, 0.000313, 0.000000, 0.000000] test_list.append(species2_primitiveVenturi_mixingmodel_boundedscalar) # 2 species (1 eq) primitive venturi mixing using mixing model including viscosity, thermal conductivity and inlet markers for SA turbulence model @@ -1566,7 +1566,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_iter = 50 - species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-5.683102, -4.564193, -4.448313, -6.737904, 2.044729, -5.467878, 30.000000, -7.621295, 12.000000, -8.052264, 8.000000, -8.963883, 2.092215, 1.000000, 0.600000, 0.492215] + species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-5.820188, -4.627870, -4.556574, -6.834134, 2.077283, -5.481298, 30.000000, -7.317611, 12.000000, -8.064489, 8.000000, -8.902923, 2.092310, 1.000000, 0.600000, 0.492310] test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2) # 2 species (1 eq) primitive venturi mixing using mixing model including heat capacity and mass diffusivity NonDimensional case @@ -1574,7 +1574,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_iter = 50 - species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.273052, -4.863236, -4.734578, -7.722857, 1.740741, -5.073467, 10.000000, -2.926106, 3.000000, -5.186545, 5.000000, -5.929953, 2.092322, 1.000000, 0.600000, 0.492322] + species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.407825, -4.920839, -4.842095, -7.820571, 1.773871, -5.086936, 10.000000, -2.736335, 3.000000, -5.216316, 5.000000, -5.855262, 2.092350, 1.000000, 0.600000, 0.492350] test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND) # 2 species (1 eq) primitive venturi mixing From 395430d04d33df6c489e597ac7064fc65f115a96 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Wed, 4 Jun 2025 15:52:09 +0200 Subject: [PATCH 27/97] adding adj enthalpy fields for incompressible solver --- SU2_CFD/include/output/CAdjFlowIncOutput.hpp | 1 + SU2_CFD/src/output/CAdjFlowIncOutput.cpp | 90 +++++++++++++++++--- SU2_PY/SU2/io/historyMap.py | 12 +++ 3 files changed, 89 insertions(+), 14 deletions(-) diff --git a/SU2_CFD/include/output/CAdjFlowIncOutput.hpp b/SU2_CFD/include/output/CAdjFlowIncOutput.hpp index 2aee3d236ee9..725aefba332d 100644 --- a/SU2_CFD/include/output/CAdjFlowIncOutput.hpp +++ b/SU2_CFD/include/output/CAdjFlowIncOutput.hpp @@ -40,6 +40,7 @@ class CAdjFlowIncOutput final: public CAdjFlowOutput { RADIATION_MODEL rad_model; /*!< \brief The kind of radiation model */ bool heat; /*!< \brief Boolean indicating whether have a heat problem*/ bool weakly_coupled_heat; /*!< \brief Boolean indicating whether have a weakly coupled heat equation*/ + bool multicomponent; /*!< \brief Boolean indicating whether have a multicomponent problem*/ public: diff --git a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp index 140ab6d7bdd7..257ff3fea312 100644 --- a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp @@ -37,6 +37,8 @@ CAdjFlowIncOutput::CAdjFlowIncOutput(CConfig *config, unsigned short nDim) : CAd weakly_coupled_heat = config->GetWeakly_Coupled_Heat(); + multicomponent = (config->GetKind_FluidModel() == FLUID_MIXTURE); + rad_model = config->GetKind_RadiationModel(); /*--- Set the default history fields if nothing is set in the config file ---*/ @@ -113,7 +115,11 @@ void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config) { } /// DESCRIPTION: Maximum residual of the temperature. if (heat || weakly_coupled_heat) { - AddHistoryOutput("RMS_ADJ_TEMPERATURE", "rms[A_T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint temperature.", HistoryFieldType::RESIDUAL); + if (multicomponent){ + AddHistoryOutput("RMS_ADJ_ENTHALPY", "rms[A_h]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the enthalpy.", HistoryFieldType::RESIDUAL); + } else { + AddHistoryOutput("RMS_ADJ_TEMPERATURE", "rms[A_T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint temperature.", HistoryFieldType::RESIDUAL); + } } if (config->GetKind_Streamwise_Periodic() == ENUM_STREAMWISE_PERIODIC::MASSFLOW) { @@ -141,7 +147,11 @@ void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config) { } /// DESCRIPTION: Maximum residual of the temperature. if (heat || weakly_coupled_heat) { - AddHistoryOutput("MAX_ADJ_TEMPERATURE", "max[A_T]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the temperature.", HistoryFieldType::RESIDUAL); + if (multicomponent) { + AddHistoryOutput("MAX_ADJ_ENTHALPY", "max[A_h]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the enthalpy.", HistoryFieldType::RESIDUAL); + } else { + AddHistoryOutput("MAX_ADJ_TEMPERATURE", "max[A_T]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the temperature.", HistoryFieldType::RESIDUAL); + } } AddHistoryOutputFields_AdjScalarMAX_RES(config); @@ -213,8 +223,17 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS SetHistoryOutputValue("RMS_ADJ_TEMPERATURE", log10(adjheat_solver->GetRes_RMS(0))); } if (heat) { - if (nDim == 3) SetHistoryOutputValue("RMS_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_RMS(4))); - else SetHistoryOutputValue("RMS_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_RMS(3))); + if (multicomponent) { + if (nDim == 3) + SetHistoryOutputValue("RMS_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_RMS(4))); + else + SetHistoryOutputValue("RMS_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_RMS(3))); + } else { + if (nDim == 3) + SetHistoryOutputValue("RMS_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_RMS(4))); + else + SetHistoryOutputValue("RMS_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_RMS(3))); + } } if (config->AddRadiation()) { @@ -235,8 +254,17 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS SetHistoryOutputValue("MAX_ADJ_TEMPERATURE", log10(adjheat_solver->GetRes_Max(0))); } if (heat) { - if (nDim == 3) SetHistoryOutputValue("MAX_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_Max(4))); - else SetHistoryOutputValue("MAX_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_Max(3))); + if (multicomponent) { + if (nDim == 3) + SetHistoryOutputValue("MAX_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_Max(4))); + else + SetHistoryOutputValue("MAX_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_Max(3))); + } else { + if (nDim == 3) + SetHistoryOutputValue("MAX_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_Max(4))); + else + SetHistoryOutputValue("MAX_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_Max(3))); + } } if (multiZone) { @@ -250,8 +278,17 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS SetHistoryOutputValue("BGS_ADJ_TEMPERATURE", log10(adjheat_solver->GetRes_BGS(0))); } if (heat) { - if (nDim == 3) SetHistoryOutputValue("BGS_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_BGS(4))); - else SetHistoryOutputValue("BGS_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_BGS(3))); + if (multicomponent) { + if (nDim == 3) + SetHistoryOutputValue("BGS_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_BGS(4))); + else + SetHistoryOutputValue("BGS_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_BGS(3))); + } else { + if (nDim == 3) + SetHistoryOutputValue("BGS_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_BGS(4))); + else + SetHistoryOutputValue("BGS_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_BGS(3))); + } } if (config->AddRadiation()) { @@ -298,7 +335,11 @@ void CAdjFlowIncOutput::SetVolumeOutputFields(CConfig *config) { /// DESCRIPTION: Adjoint Velocity z-component. AddVolumeOutput("ADJ_VELOCITY-Z", "Adjoint_Velocity_z", "SOLUTION", "z-component of the adjoint velocity vector"); } - AddVolumeOutput("ADJ_TEMPERATURE", "Adjoint_Temperature", "SOLUTION", "Adjoint temperature"); + if (multicomponent && heat) { + AddVolumeOutput("ADJ_ENTHALPY", "Adjoint_Enthalpy", "SOLUTION", "Adjoint_Enthalpy"); + } else { + AddVolumeOutput("ADJ_TEMPERATURE", "Adjoint_Temperature", "SOLUTION", "Adjoint temperature"); + } SetVolumeOutputFieldsAdjScalarSolution(config); @@ -328,7 +369,11 @@ void CAdjFlowIncOutput::SetVolumeOutputFields(CConfig *config) { AddVolumeOutput("RES_ADJ_VELOCITY-Z", "Residual_Adjoint_Velocity_z", "RESIDUAL", "Residual of the adjoint z-velocity"); } /// DESCRIPTION: Residual of the adjoint energy. - AddVolumeOutput("RES_ADJ_TEMPERATURE", "Residual_Adjoint_Heat", "RESIDUAL", "Residual of the adjoint temperature"); + if (multicomponent && heat) { + AddVolumeOutput("RES_ADJ_ENTHALPY", "Residual_Adjoint_Heat", "RESIDUAL", "Residual of the adjoint enthalpy"); + } else { + AddVolumeOutput("RES_ADJ_TEMPERATURE", "Residual_Adjoint_Heat", "RESIDUAL", "Residual of the adjoint temperature"); + } SetVolumeOutputFieldsAdjScalarResidual(config); @@ -383,8 +428,17 @@ void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjHeat->GetSolution(iPoint, 0)); } else { - if (nDim == 3) SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 4)); - else SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 3)); + if (multicomponent) { + if (nDim == 3) + SetVolumeOutputValue("ADJ_ENTHALPY", iPoint, Node_AdjFlow->GetSolution(iPoint, 4)); + else + SetVolumeOutputValue("ADJ_ENTHALPY", iPoint, Node_AdjFlow->GetSolution(iPoint, 3)); + } else { + if (nDim == 3) + SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 4)); + else + SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 3)); + } } // Radiation @@ -398,9 +452,17 @@ void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo SetVolumeOutputValue("RES_ADJ_VELOCITY-Y", iPoint, Node_AdjFlow->GetSolution(iPoint, 2) - Node_AdjFlow->GetSolution_Old(iPoint, 2)); if (nDim == 3) { SetVolumeOutputValue("RES_ADJ_VELOCITY-Z", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); - SetVolumeOutputValue("RES_ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 4) - Node_AdjFlow->GetSolution_Old(iPoint, 4)); + if (multicomponent) { + SetVolumeOutputValue("RES_ADJ_ENTHALPY", iPoint, Node_AdjFlow->GetSolution(iPoint, 4) - Node_AdjFlow->GetSolution_Old(iPoint, 4)); + } else { + SetVolumeOutputValue("RES_ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 4) - Node_AdjFlow->GetSolution_Old(iPoint, 4)); + } } else { - SetVolumeOutputValue("RES_ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); + if (multicomponent) { + SetVolumeOutputValue("RES_ADJ_ENTHALPY", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); + } else { + SetVolumeOutputValue("RES_ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); + } } if (config->AddRadiation()) { diff --git a/SU2_PY/SU2/io/historyMap.py b/SU2_PY/SU2/io/historyMap.py index be17da146431..e98684e50655 100644 --- a/SU2_PY/SU2/io/historyMap.py +++ b/SU2_PY/SU2/io/historyMap.py @@ -810,6 +810,12 @@ "HEADER": "max[A_T]", "TYPE": "RESIDUAL", }, + "MAX_ADJ_ENTHALPY": { + "DESCRIPTION": "Maximum residual of the enthalpy.", + "GROUP": "MAX_RES", + "HEADER": "max[A_h]", + "TYPE": "RESIDUAL", + }, "MAX_ADJ_TKE": { "DESCRIPTION": "Maximum residual of the adjoint kinetic " "energy.", "GROUP": "MAX_RES", @@ -1055,6 +1061,12 @@ "HEADER": "rms[A_T]", "TYPE": "RESIDUAL", }, + "RMS_ADJ_ENTHALPY": { + "DESCRIPTION": "Root mean square residual of the " "adjoint enthalpy.", + "GROUP": "RMS_RES", + "HEADER": "rms[A_h]", + "TYPE": "RESIDUAL", + }, "RMS_ADJ_TKE": { "DESCRIPTION": "Root-mean square residual of the adjoint " "kinetic energy.", "GROUP": "RMS_RES", From 247e64be29a1b9f58a96cc317211724ebae641d2 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Wed, 4 Jun 2025 16:38:13 +0200 Subject: [PATCH 28/97] adding HeatFluxDiffusion in Preaccumulation --- SU2_CFD/src/numerics/flow/flow_diffusion.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp index 53af20096d63..882191d0224d 100644 --- a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp +++ b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp @@ -553,6 +553,9 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi AD::SetPreaccIn(turb_ke_i); AD::SetPreaccIn(turb_ke_j); AD::SetPreaccIn(TauWall_i); AD::SetPreaccIn(TauWall_j); AD::SetPreaccIn(Normal, nDim); + if (energy_multicomponent) { + AD::SetPreaccIn(HeatFluxDiffusion); + } unsigned short iVar, jVar, iDim; From fcacd1815c977a215c031f255508571765f1929b Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Fri, 6 Jun 2025 11:46:43 +0200 Subject: [PATCH 29/97] updating JST and Lax-Friedrich --- .../numerics/flow/convection/centered.hpp | 6 +- .../src/numerics/flow/convection/centered.cpp | 56 ++++++++++++++++--- 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/SU2_CFD/include/numerics/flow/convection/centered.hpp b/SU2_CFD/include/numerics/flow/convection/centered.hpp index 6e7d3190733a..c66359557334 100644 --- a/SU2_CFD/include/numerics/flow/convection/centered.hpp +++ b/SU2_CFD/include/numerics/flow/convection/centered.hpp @@ -48,7 +48,8 @@ class CCentLaxInc_Flow final : public CNumerics { Temperature_i, Temperature_j, /*!< \brief Temperature at node 0 and 1. */ MeanDensity, MeanPressure, MeanBetaInc2, MeanEnthalpy, - MeanCp, MeanTemperature, /*!< \brief Mean values of primitive variables. */ + MeanCp, MeanTemperature, + MeanWorkingVar, /*!< \brief Mean values of primitive variables. */ MeandRhodT, /*!< \brief Derivative of density w.r.t. temperature (variable density flows). */ Param_p, Param_Kappa_0, /*!< \brief Artificial dissipation parameters. */ Local_Lambda_i, Local_Lambda_j, @@ -108,7 +109,8 @@ class CCentJSTInc_Flow final : public CNumerics { Temperature_i, Temperature_j, /*!< \brief Temperature at node 0 and 1. */ MeanDensity, MeanPressure, MeanBetaInc2, MeanEnthalpy, - MeanCp, MeanTemperature, /*!< \brief Mean values of primitive variables. */ + MeanCp, MeanTemperature, + MeanWorkingVar, /*!< \brief Mean values of primitive variables. */ MeandRhodT, /*!< \brief Derivative of density w.r.t. temperature (variable density flows). */ Param_p, Param_Kappa_2, Param_Kappa_4, /*!< \brief Artificial dissipation parameters. */ diff --git a/SU2_CFD/src/numerics/flow/convection/centered.cpp b/SU2_CFD/src/numerics/flow/convection/centered.cpp index 5e15f35983fb..f80f1769ef88 100644 --- a/SU2_CFD/src/numerics/flow/convection/centered.cpp +++ b/SU2_CFD/src/numerics/flow/convection/centered.cpp @@ -97,7 +97,17 @@ CNumerics::ResidualType<> CCentLaxInc_Flow::ComputeResidual(const CConfig* confi DensityInc_i = V_i[nDim+2]; DensityInc_j = V_j[nDim+2]; BetaInc2_i = V_i[nDim+3]; BetaInc2_j = V_j[nDim+3]; Cp_i = V_i[nDim+7]; Cp_j = V_j[nDim+7]; - Enthalpy_i = Cp_i*Temperature_i; Enthalpy_j = Cp_j*Temperature_j; + if (energy_multicomponent) { + Enthalpy_i = V_i[nDim + 9]; + Enthalpy_j = V_j[nDim + 9]; + WorkingVariable_i = Enthalpy_i; + WorkingVariable_j = Enthalpy_j; + } else { + Enthalpy_i = Cp_i * Temperature_i; + Enthalpy_j = Cp_j * Temperature_j; + WorkingVariable_i = Temperature_i; + WorkingVariable_j = Temperature_j; + } Area = 0.0; sq_vel_i = 0.0; sq_vel_j = 0.0; ProjVelocity_i = 0.0; ProjVelocity_j = 0.0; @@ -121,6 +131,7 @@ CNumerics::ResidualType<> CCentLaxInc_Flow::ComputeResidual(const CConfig* confi MeanEnthalpy = 0.5*(Enthalpy_i + Enthalpy_j); MeanCp = 0.5*(Cp_i + Cp_j); MeanTemperature = 0.5*(Temperature_i + Temperature_j); + MeanWorkingVar = 0.5*(WorkingVariable_i + WorkingVariable_j); /*--- We need the derivative of the equation of state to build the preconditioning matrix. For now, the only option is the ideal gas @@ -130,6 +141,12 @@ CNumerics::ResidualType<> CCentLaxInc_Flow::ComputeResidual(const CConfig* confi if (variable_density) { MeandRhodT = -MeanDensity/MeanTemperature; } + if (energy_multicomponent) { + MeandRhodT /= MeanCp ; + MeanCp = 1.0; + Cp_i = 1.0; + Cp_j = 1.0; + } /*--- Get projected flux tensor ---*/ @@ -138,7 +155,7 @@ CNumerics::ResidualType<> CCentLaxInc_Flow::ComputeResidual(const CConfig* confi /*--- Jacobians of the inviscid flux ---*/ if (implicit) { - GetInviscidIncProjJac(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanTemperature, &MeandRhodT, Normal, 0.5, Jacobian_i); + GetInviscidIncProjJac(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanWorkingVar, &MeandRhodT, Normal, 0.5, Jacobian_i); for (iVar = 0; iVar < nVar; iVar++) { for (jVar = 0; jVar < nVar; jVar++) { Jacobian_j[iVar][jVar] = Jacobian_i[iVar][jVar]; @@ -179,12 +196,13 @@ CNumerics::ResidualType<> CCentLaxInc_Flow::ComputeResidual(const CConfig* confi /*--- Computes differences btw. conservative variables ---*/ - for (iVar = 0; iVar < nVar; iVar++) + for (iVar = 0; iVar < nVar - 1; iVar++) Diff_V[iVar] = V_i[iVar]-V_j[iVar]; + Diff_V[nVar - 1] = WorkingVariable_i - WorkingVariable_j; /*--- Build the preconditioning matrix using mean values ---*/ - GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanTemperature, &MeandRhodT, Precon); + GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanWorkingVar, &MeandRhodT, Precon); /*--- Compute the local espectral radius of the preconditioned system and the stretching factor. ---*/ @@ -320,7 +338,17 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi DensityInc_i = V_i[nDim+2]; DensityInc_j = V_j[nDim+2]; BetaInc2_i = V_i[nDim+3]; BetaInc2_j = V_j[nDim+3]; Cp_i = V_i[nDim+7]; Cp_j = V_j[nDim+7]; - Enthalpy_i = Cp_i*Temperature_i; Enthalpy_j = Cp_j*Temperature_j; + if (energy_multicomponent) { + Enthalpy_i = V_i[nDim + 9]; + Enthalpy_j = V_j[nDim + 9]; + WorkingVariable_i = Enthalpy_i; + WorkingVariable_j = Enthalpy_j; + } else { + Enthalpy_i = Cp_i * Temperature_i; + Enthalpy_j = Cp_j * Temperature_j; + WorkingVariable_i = Temperature_i; + WorkingVariable_j = Temperature_j; + } Area = 0.0; sq_vel_i = 0.0; sq_vel_j = 0.0; ProjVelocity_i = 0.0; ProjVelocity_j = 0.0; @@ -342,6 +370,7 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi MeanPressure = 0.5*(Pressure_i + Pressure_j); MeanBetaInc2 = 0.5*(BetaInc2_i + BetaInc2_j); MeanEnthalpy = 0.5*(Enthalpy_i + Enthalpy_j); + MeanWorkingVar = 0.5*(WorkingVariable_i + WorkingVariable_j); MeanCp = 0.5*(Cp_i + Cp_j); MeanTemperature = 0.5*(Temperature_i + Temperature_j); @@ -353,6 +382,12 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi if (variable_density) { MeandRhodT = -MeanDensity/MeanTemperature; } + if (energy_multicomponent) { + MeandRhodT /= MeanCp ; + MeanCp = 1.0; + Cp_i = 1.0; + Cp_j = 1.0; + } /*--- Get projected flux tensor ---*/ @@ -361,7 +396,7 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi /*--- Jacobians of the inviscid flux ---*/ if (implicit) { - GetInviscidIncProjJac(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanTemperature, &MeandRhodT, Normal, 0.5, Jacobian_i); + GetInviscidIncProjJac(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanWorkingVar, &MeandRhodT, Normal, 0.5, Jacobian_i); for (iVar = 0; iVar < nVar; iVar++) { for (jVar = 0; jVar < nVar; jVar++) { Jacobian_j[iVar][jVar] = Jacobian_i[iVar][jVar]; @@ -405,12 +440,17 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi for (iVar = 0; iVar < nVar; iVar++) { Diff_Lapl[iVar] = Und_Lapl_i[iVar]-Und_Lapl_j[iVar]; - Diff_V[iVar] = V_i[iVar]-V_j[iVar]; + if (iVar == nVar - 1) { + Diff_V[iVar] = WorkingVariable_i - WorkingVariable_j; + } else { + Diff_V[iVar] = V_i[iVar] - V_j[iVar]; + } } + /*--- Build the preconditioning matrix using mean values ---*/ - GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanTemperature, &MeandRhodT, Precon); + GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanWorkingVar, &MeandRhodT, Precon); /*--- Compute the local spectral radius of the preconditioned system and the stretching factor. ---*/ From 5e1dacf33b1609f27963e9c91062037aa0aee461 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Wed, 18 Jun 2025 12:15:01 +0200 Subject: [PATCH 30/97] updating BC far-field for multicomponent flows --- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index 51c0321039e6..6157511d50b5 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -2184,6 +2184,7 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain const bool implicit = config->GetKind_TimeIntScheme() == EULER_IMPLICIT; const bool viscous = config->GetViscous(); + const bool energy_multicomponent = ((config->GetKind_FluidModel() == FLUID_MIXTURE) && (config->GetEnergy_Equation())); su2double Normal[MAXNDIM] = {0.0}; @@ -2228,6 +2229,15 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain V_infty[prim_idx.Temperature()] = GetTemperature_Inf(); + /*-- Enthalpy at far-field is needed for energy equation in multicomponent and reacting flows. ---*/ + if (energy_multicomponent) { + CFluidModel* auxFluidModel = solver_container[FLOW_SOL]->GetFluidModel(); + const su2double* scalar_infty = config->GetSpecies_Init(); + auxFluidModel->SetTDState_T(V_infty[prim_idx.Temperature()], + scalar_infty); // obtain enthalpy from temperature and species mass fractions + V_infty[prim_idx.Enthalpy()] = auxFluidModel->GetEnthalpy(); + } + /*--- Store the density. ---*/ V_infty[prim_idx.Density()] = GetDensity_Inf(); @@ -2263,7 +2273,7 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain /*--- Viscous residual contribution ---*/ - if (!viscous) continue; + if (!viscous || energy_multicomponent) continue; /*--- Set transport properties at infinity. ---*/ From 93f70ab661b1c74be2c8e9d7114e58e5a40532a6 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Fri, 20 Jun 2025 10:32:38 +0200 Subject: [PATCH 31/97] fix small bug conductivity prandtl --- SU2_CFD/src/fluid/CFluidScalar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/fluid/CFluidScalar.cpp b/SU2_CFD/src/fluid/CFluidScalar.cpp index a8775ea90df3..ef28a2c81983 100644 --- a/SU2_CFD/src/fluid/CFluidScalar.cpp +++ b/SU2_CFD/src/fluid/CFluidScalar.cpp @@ -169,7 +169,7 @@ su2double CFluidScalar::DavidsonViscosity(const su2double* val_scalars) { su2double CFluidScalar::WilkeConductivity(const su2double* val_scalars) { for (int iVar = 0; iVar < n_species_mixture; iVar++) { - ThermalConductivityPointers[iVar]->SetConductivity(Temperature, Density, Mu, 0.0, 0.0, 0.0, 0.0); + ThermalConductivityPointers[iVar]->SetConductivity(Temperature, Density, Mu, 0.0, Cp, 0.0, 0.0); laminarThermalConductivity[iVar] = ThermalConductivityPointers[iVar]->GetConductivity(); } From 8640efd366841f8642677b71b57b905a02f71974 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Fri, 27 Jun 2025 15:17:45 +0200 Subject: [PATCH 32/97] adding regression cases --- TestCases/parallel_regression.py | 16 ++ .../species2_primitiveVenturi_JST.cfg | 153 +++++++++++++++++ ...pecies2_primitiveVenturi_Lax_Friedrich.cfg | 155 ++++++++++++++++++ 3 files changed, 324 insertions(+) create mode 100644 TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_JST.cfg create mode 100644 TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_Lax_Friedrich.cfg diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 490112e0c601..bd9a21923026 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1586,6 +1586,22 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.407825, -4.920839, -4.842095, -7.820571, 1.773871, -5.086936, 10.000000, -2.736335, 3.000000, -5.216316, 5.000000, -5.855262, 2.092350, 1.000000, 0.600000, 0.492350] test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND) + # 2 species (1 eq) primitive venturi mixing using mixing model solving enthalpy equation using preconditioning + JST convective scheme + species2_primitiveVenturi_JST = TestCase('species2_primitiveVenturi_JST.cfg') + species2_primitiveVenturi_JST.cfg_dir = "species_transport/venturi_primitive_3species" + species2_primitiveVenturi_JST.cfg_file = "species2_primitiveVenturi_JST.cfg" + species2_primitiveVenturi_JST.test_iter = 50 + species2_primitiveVenturi_JST.test_vals = [-4.667804, -6.715941, -6.135929, 0.122592, -7.541682, 10.00000, -3.607574, 5.000000, -6.111865, 0.046831, 0.014468, 0.017896, 0.014468, 50.000000] + test_list.append(species2_primitiveVenturi_JST) + + # 2 species (1 eq) primitive venturi mixing using mixing model solving enthalpy equation using preconditioning + Lax-Friedrich convective scheme + species2_primitiveVenturi_Lax_Friedrich = TestCase('species2_primitiveVenturi_Lax_Friedrich.cfg') + species2_primitiveVenturi_Lax_Friedrich.cfg_dir = "species_transport/venturi_primitive_3species" + species2_primitiveVenturi_Lax_Friedrich.cfg_file = "species2_primitiveVenturi_Lax_Friedrich.cfg" + species2_primitiveVenturi_Lax_Friedrich.test_iter = 50 + species2_primitiveVenturi_Lax_Friedrich.test_vals = [-4.667804, -6.715941, -6.135929, 0.122592, -7.541682, 10.00000, -3.607574, 5.000000, -6.111865, 0.046831, 0.014468, 0.017896, 0.014468, 50.000000] + test_list.append(species2_primitiveVenturi_Lax_Friedrich) + # 2 species (1 eq) primitive venturi mixing species2_primitiveVenturi = TestCase('species2_primitiveVenturi') species2_primitiveVenturi.cfg_dir = "species_transport/venturi_primitive_3species" diff --git a/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_JST.cfg b/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_JST.cfg new file mode 100644 index 000000000000..2bd04a386be3 --- /dev/null +++ b/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_JST.cfg @@ -0,0 +1,153 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Species mixing with 2 species: Hydrogen and air. % +% 1 transport equation is being solved(For H2 in this case). % +% Including JST scheme with preconditioning for enthalpy. % +% Author: Cristopher Morales Ubal % +% Institution: Eindhoven University of Technology % +% Date: 2025/06/27 % +% File Version 8.0.1 "Harrier" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +SOLVER= INC_NAVIER_STOKES +KIND_TURB_MODEL= NONE +% +% ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% +% +INC_DENSITY_MODEL= VARIABLE +INC_DENSITY_INIT= 0.0807 +% +INC_VELOCITY_INIT= ( 0.1, 0.0, 0.0 ) +% +INC_ENERGY_EQUATION= YES +INC_TEMPERATURE_INIT= 350.0 +% +INC_NONDIM= DIMENSIONAL +% +% -------------------- FLUID PROPERTIES ------------------------------------- % +% +FLUID_MODEL= FLUID_MIXTURE +% +THERMODYNAMIC_PRESSURE= 101325.0 +% +MOLECULAR_WEIGHT= 2.01588, 28.960 +% +SPECIFIC_HEAT_CP = 14310, 1009.39 +% +CONDUCTIVITY_MODEL= CONSTANT_CONDUCTIVITY +THERMAL_CONDUCTIVITY_CONSTANT= 0.187, 0.0258 +% +PRANDTL_LAM= 0.72, 0.72 +TURBULENT_CONDUCTIVITY_MODEL= NONE +PRANDTL_TURB= 0.90, 0.90 +% +% --------------------------- VISCOSITY MODEL ---------------------------------% +% +VISCOSITY_MODEL= CONSTANT_VISCOSITY +% +MU_CONSTANT= 8.9E-06, 1.8551E-05 +% +MU_REF= 8.411E-05, 1.716E-05 +% +MU_T_REF= 273, 273 +% +SUTHERLAND_CONSTANT= 97, 111 +% +MIXING_VISCOSITY_MODEL = WILKE +% +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +MARKER_HEATFLUX= ( wall, 0.0) +MARKER_SYM= ( axis ) +% +SPECIFIED_INLET_PROFILE= NO +INLET_FILENAME= inlet_venturi.dat +INC_INLET_TYPE= VELOCITY_INLET VELOCITY_INLET +MARKER_INLET= ( gas_inlet, 350, 0.1, 1.0, 0.0, 0.0,\ + air_axial_inlet, 300, 0.1, 0.0, -1.0, 0.0 ) +MARKER_INLET_SPECIES= (gas_inlet, 0.014467517838966, \ + air_axial_inlet, 0.020137986304114414) +% +INC_OUTLET_TYPE= PRESSURE_OUTLET +MARKER_OUTLET= ( outlet, 0.0 ) +% +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +% +CFL_NUMBER= 100 +CFL_REDUCTION_SPECIES= 1.0 +CFL_REDUCTION_TURB= 1.0 +CFL_ADAPT= YES +CFL_ADAPT_PARAM= ( 0.5, 2.0, 10, 1000, 1E-4) +% +% Run commented Iter for good results +ITER= 2000 +% +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ERROR= 1E-5 +LINEAR_SOLVER_ITER= 10 +% +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +CONV_NUM_METHOD_FLOW= JST +MUSCL_FLOW= NO +SLOPE_LIMITER_FLOW = NONE +TIME_DISCRE_FLOW= EULER_IMPLICIT +% +% -------------------- SCALAR TRANSPORT ---------------------------------------% +% +KIND_SCALAR_MODEL= SPECIES_TRANSPORT +% +DIFFUSIVITY_MODEL = UNITY_LEWIS +% +CONV_NUM_METHOD_SPECIES= BOUNDED_SCALAR +MUSCL_SPECIES= NO +SLOPE_LIMITER_SPECIES = NONE +% +TIME_DISCRE_SPECIES= EULER_IMPLICIT +% +SPECIES_INIT= 0.014467517838966 +SPECIES_CLIPPING= NO +SPECIES_CLIPPING_MIN= 0.0 +SPECIES_CLIPPING_MAX= 1.0 +% +% -------------------- TURBULENT TRANSPORT ---------------------------------------% +% +CONV_NUM_METHOD_TURB= BOUNDED_SCALAR +MUSCL_TURB= NO +% +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +CONV_FIELD= RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_SPECIES +CONV_RESIDUAL_MINVAL= -18 +CONV_STARTITER= 10 +% +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +MESH_FILENAME= primitiveVenturi.su2 +SCREEN_OUTPUT= INNER_ITER WALL_TIME \ + RMS_PRESSURE RMS_VELOCITY-X RMS_VELOCITY-Y RMS_ENTHALPY RMS_SPECIES_0 \ + LINSOL_ITER LINSOL_RESIDUAL \ + LINSOL_ITER_SPECIES LINSOL_RESIDUAL_SPECIES \ + SURFACE_SPECIES_0 AVG_CFL +SCREEN_WRT_FREQ_INNER= 10 +% +HISTORY_OUTPUT= ITER RMS_RES LINSOL SPECIES_COEFF SPECIES_COEFF_SURF +CONV_FILENAME= history +MARKER_ANALYZE= gas_inlet, air_axial_inlet, outlet +MARKER_ANALYZE_AVERAGE= AREA +% +OUTPUT_FILES= RESTART_ASCII, PARAVIEW_MULTIBLOCK +VOLUME_OUTPUT= RESIDUAL, PRIMITIVE, TIMESTEP +OUTPUT_WRT_FREQ= 1000 +% +RESTART_SOL= NO +READ_BINARY_RESTART= NO diff --git a/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_Lax_Friedrich.cfg b/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_Lax_Friedrich.cfg new file mode 100644 index 000000000000..dbe7fde8ebfc --- /dev/null +++ b/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_Lax_Friedrich.cfg @@ -0,0 +1,155 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Species mixing with 2 species: Hydrogen and air. % +% 1 transport equation is being solved(For H2 in this case). % +% Including Lax-Friedrich scheme with preconditioning % +% solving for enthalpy. % +% Author: Cristopher Morales Ubal % +% Institution: Eindhoven University of Technology % +% Date: 2022/06/27 % +% File Version 8.0.1 "Harrier" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +SOLVER= INC_NAVIER_STOKES +KIND_TURB_MODEL= NONE +% +% ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% +% +INC_DENSITY_MODEL= VARIABLE +INC_DENSITY_INIT= 0.0807 +% +INC_VELOCITY_INIT= ( 0.1, 0.0, 0.0 ) +% +INC_ENERGY_EQUATION= YES +INC_TEMPERATURE_INIT= 350.0 +% +INC_NONDIM= DIMENSIONAL +% +% -------------------- FLUID PROPERTIES ------------------------------------- % +% +FLUID_MODEL= FLUID_MIXTURE +% +THERMODYNAMIC_PRESSURE= 101325.0 +% +MOLECULAR_WEIGHT= 2.01588, 28.960 +% +SPECIFIC_HEAT_CP = 14310, 1009.39 +% +CONDUCTIVITY_MODEL= CONSTANT_CONDUCTIVITY +THERMAL_CONDUCTIVITY_CONSTANT= 0.187, 0.0258 +% +PRANDTL_LAM= 0.72, 0.72 +TURBULENT_CONDUCTIVITY_MODEL= NONE +PRANDTL_TURB= 0.90, 0.90 +% +% --------------------------- VISCOSITY MODEL ---------------------------------% +% +VISCOSITY_MODEL= CONSTANT_VISCOSITY +% +MU_CONSTANT= 8.9E-06, 1.8551E-05 +% +MU_REF= 8.411E-05, 1.716E-05 +% +MU_T_REF= 273, 273 +% +SUTHERLAND_CONSTANT= 97, 111 +% +MIXING_VISCOSITY_MODEL = WILKE +% +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +MARKER_HEATFLUX= ( wall, 0.0) +MARKER_SYM= ( axis ) +% +SPECIFIED_INLET_PROFILE= NO +INLET_FILENAME= inlet_venturi.dat +INC_INLET_TYPE= VELOCITY_INLET VELOCITY_INLET +MARKER_INLET= ( gas_inlet, 350, 0.1, 1.0, 0.0, 0.0,\ + air_axial_inlet, 300, 0.1, 0.0, -1.0, 0.0 ) +MARKER_INLET_SPECIES= (gas_inlet, 0.014467517838966, \ + air_axial_inlet, 0.020137986304114414) +% +INC_OUTLET_TYPE= PRESSURE_OUTLET +MARKER_OUTLET= ( outlet, 0.0 ) +% +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +% +CFL_NUMBER= 100 +CFL_REDUCTION_SPECIES= 1.0 +CFL_REDUCTION_TURB= 1.0 +CFL_ADAPT= YES +CFL_ADAPT_PARAM= ( 0.5, 2.0, 10, 1000, 1E-4) +% +% Run commented Iter for good results +ITER= 2000 +% +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ERROR= 1E-5 +LINEAR_SOLVER_ITER= 10 +% +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +CONV_NUM_METHOD_FLOW= LAX-FRIEDRICH +LAX_SENSOR_COEFF = 0.01 +MUSCL_FLOW= NO +SLOPE_LIMITER_FLOW = NONE +TIME_DISCRE_FLOW= EULER_IMPLICIT +% +% -------------------- SCALAR TRANSPORT ---------------------------------------% +% +KIND_SCALAR_MODEL= SPECIES_TRANSPORT +% +DIFFUSIVITY_MODEL = UNITY_LEWIS +% +CONV_NUM_METHOD_SPECIES= BOUNDED_SCALAR +MUSCL_SPECIES= NO +SLOPE_LIMITER_SPECIES = NONE +% +TIME_DISCRE_SPECIES= EULER_IMPLICIT +% +SPECIES_INIT= 0.014467517838966 +SPECIES_CLIPPING= NO +SPECIES_CLIPPING_MIN= 0.0 +SPECIES_CLIPPING_MAX= 1.0 +% +% -------------------- TURBULENT TRANSPORT ---------------------------------------% +% +CONV_NUM_METHOD_TURB= BOUNDED_SCALAR +MUSCL_TURB= NO +% +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +CONV_FIELD= RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_SPECIES +CONV_RESIDUAL_MINVAL= -18 +CONV_STARTITER= 10 +% +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +MESH_FILENAME= primitiveVenturi.su2 +SCREEN_OUTPUT= INNER_ITER WALL_TIME \ + RMS_PRESSURE RMS_VELOCITY-X RMS_VELOCITY-Y RMS_ENTHALPY RMS_SPECIES_0 \ + LINSOL_ITER LINSOL_RESIDUAL \ + LINSOL_ITER_SPECIES LINSOL_RESIDUAL_SPECIES \ + SURFACE_SPECIES_0 AVG_CFL +SCREEN_WRT_FREQ_INNER= 10 +% +HISTORY_OUTPUT= ITER RMS_RES LINSOL SPECIES_COEFF SPECIES_COEFF_SURF +CONV_FILENAME= history +MARKER_ANALYZE= gas_inlet, air_axial_inlet, outlet +MARKER_ANALYZE_AVERAGE= AREA +% +OUTPUT_FILES= RESTART_ASCII, PARAVIEW_MULTIBLOCK +VOLUME_OUTPUT= RESIDUAL, PRIMITIVE, TIMESTEP +OUTPUT_WRT_FREQ= 1000 +% +RESTART_SOL= NO +READ_BINARY_RESTART= NO From c0b0bed96779a3383f7e554fab0b51497e9fc5b7 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Mon, 30 Jun 2025 16:40:17 +0200 Subject: [PATCH 33/97] update residual JST-Lax_Friedrich --- TestCases/parallel_regression.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index bd9a21923026..1d1cc8c04f34 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1591,7 +1591,7 @@ def main(): species2_primitiveVenturi_JST.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_JST.cfg_file = "species2_primitiveVenturi_JST.cfg" species2_primitiveVenturi_JST.test_iter = 50 - species2_primitiveVenturi_JST.test_vals = [-4.667804, -6.715941, -6.135929, 0.122592, -7.541682, 10.00000, -3.607574, 5.000000, -6.111865, 0.046831, 0.014468, 0.017896, 0.014468, 50.000000] + species2_primitiveVenturi_JST.test_vals = [-6.035464, -7.071918, -7.201080, -1.142940, -8.348316, 10.000000, -3.223791, 10.000000, -4.435519, 0.049048, 0.014468, 0.020068, 0.014512, 25.000000] test_list.append(species2_primitiveVenturi_JST) # 2 species (1 eq) primitive venturi mixing using mixing model solving enthalpy equation using preconditioning + Lax-Friedrich convective scheme @@ -1599,7 +1599,7 @@ def main(): species2_primitiveVenturi_Lax_Friedrich.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_Lax_Friedrich.cfg_file = "species2_primitiveVenturi_Lax_Friedrich.cfg" species2_primitiveVenturi_Lax_Friedrich.test_iter = 50 - species2_primitiveVenturi_Lax_Friedrich.test_vals = [-4.667804, -6.715941, -6.135929, 0.122592, -7.541682, 10.00000, -3.607574, 5.000000, -6.111865, 0.046831, 0.014468, 0.017896, 0.014468, 50.000000] + species2_primitiveVenturi_Lax_Friedrich.test_vals = [-6.092441, -6.981653, -6.982959, -1.195023, -8.245626, 10.000000, -3.472515, 8.000000, -5.356121, 0.048943, 0.014468, 0.020007, 0.014468, 12.500000] test_list.append(species2_primitiveVenturi_Lax_Friedrich) # 2 species (1 eq) primitive venturi mixing From 3148c3a0f90237cf1a56ea479fea2f4c17517a2f Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sat, 12 Jul 2025 13:43:51 +0200 Subject: [PATCH 34/97] adding function for computing enthalpy due to species diffusion --- SU2_CFD/include/solvers/CIncNSSolver.hpp | 13 ++- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 6 +- SU2_CFD/src/solvers/CIncNSSolver.cpp | 139 ++++++++++++----------- 3 files changed, 89 insertions(+), 69 deletions(-) diff --git a/SU2_CFD/include/solvers/CIncNSSolver.hpp b/SU2_CFD/include/solvers/CIncNSSolver.hpp index 684ea4625466..6d0f25a9d102 100644 --- a/SU2_CFD/include/solvers/CIncNSSolver.hpp +++ b/SU2_CFD/include/solvers/CIncNSSolver.hpp @@ -94,8 +94,19 @@ class CIncNSSolver final : public CIncEulerSolver { */ void Compute_Streamwise_Periodic_Recovered_Values(CConfig *config, const CGeometry *geometry, const unsigned short iMesh); + /*! + * \brief Compute the enthalpy due to species diffusion contribution for multicomponent and reacting flows. + * \param[in] iEdge - Edge for which the flux and Jacobians are to be computed. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method. + * \param[in] n_species - Number of species in the mixture that a transport equation is solved. + * \param[in] implicit - Boolean for implicit iterations. + */ + void ComputeEnthalpyDiffusion(unsigned long iEdge, CGeometry* geometry, CSolver** solver_container, CNumerics* numerics, + const int n_species, const bool implicit) ; -public: + public: /*! * \brief Constructor of the class. * \param[in] geometry - Geometrical definition of the problem. diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index 6157511d50b5..e7f7a4ea0233 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -1332,8 +1332,10 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont lim_i = LimiterHelpers<>::vanAlbadaFunction(Project_Grad_Enthalpy_i, V_ij, EPS); lim_j = LimiterHelpers<>::vanAlbadaFunction(-Project_Grad_Enthalpy_j, V_ij, EPS); } else if (limiter) { - lim_i = 1.0; // nodes->GetLimiter_Primitive(iPoint, iVar); - lim_j = 1.0; // nodes->GetLimiter_Primitive(jPoint, iVar); + /*--- For solving enthalpy instead of temperature, computation of limiters must be added + in future implementation, for now it is limited to van Albada limiter or default value 1.0. ---*/ + lim_i = 1.0; + lim_j = 1.0; } Primitive_i[nDim + 9] = V_i[nDim + 9] + lim_i * Project_Grad_Enthalpy_i; Primitive_j[nDim + 9] = V_j[nDim + 9] + lim_j * Project_Grad_Enthalpy_j; diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index 1ca5080ee588..be55f202d69b 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -301,78 +301,85 @@ void CIncNSSolver::Compute_Streamwise_Periodic_Recovered_Values(CConfig *config, void CIncNSSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config) { const bool energy_multicomponent = ((config->GetKind_FluidModel() == FLUID_MIXTURE) && config->GetEnergy_Equation()); - const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); /*--- Contribution to heat flux due to enthalpy diffusion for multicomponent and reacting flows ---*/ if (energy_multicomponent) { - CVariable* speciesNodes = solver_container[SPECIES_SOL]->GetNodes(); - /*--- Points in edge ---*/ - - auto iPoint = geometry->edges->GetNode(iEdge, 0); - auto jPoint = geometry->edges->GetNode(iEdge, 1); - - /*--- Points coordinates, and normal vector ---*/ - - const su2double* Normal = geometry->edges->GetNormal(iEdge); - const su2double* Coord_i = geometry->nodes->GetCoord(iPoint); - const su2double* Coord_j = geometry->nodes->GetCoord(jPoint); - - /*--- Obtain fluid model for computing the enthalpy diffusion terms. ---*/ - - CFluidModel* FluidModel = solver_container[FLOW_SOL]->GetFluidModel(); - - /*--- retrieve number of species that are solved and set maximum static array ---*/ - - int n_species = config->GetnSpecies(); - static constexpr size_t MAXNVAR_SPECIES = 20UL; - - /*--- Species variables, and its gradients ---*/ - const su2double* Species_i = speciesNodes->GetSolution(iPoint); - const su2double* Species_j = speciesNodes->GetSolution(jPoint); - CMatrixView Species_Grad_i = speciesNodes->GetGradient(iPoint); - CMatrixView Species_Grad_j = speciesNodes->GetGradient(jPoint); - - /*--- Compute Projected gradient for species variables ---*/ - su2double ProjGradScalarVarNoCorr[MAXNVAR_SPECIES]{0.0}; - su2double Proj_Mean_GradScalarVar[MAXNVAR_SPECIES]{0.0}; - su2double proj_vector_ij = numerics->ComputeProjectedGradient( - nDim, n_species, Normal, Coord_i, Coord_j, Species_Grad_i, Species_Grad_j, true, Species_i, Species_j, - ProjGradScalarVarNoCorr, Proj_Mean_GradScalarVar); - (void)proj_vector_ij; - - /*--- Get enthalpy diffusion terms and its gradient(for implicit) for each species at point i. ---*/ - - su2double EnthalpyDiffusion_i[MAXNVAR_SPECIES]{0.0}; - su2double GradEnthalpyDiffusion_i[MAXNVAR_SPECIES]{0.0}; - FluidModel->SetTDState_T(nodes->GetPrimitive(iPoint)[prim_idx.Temperature()], Species_i); - FluidModel->GetEnthalpyDiffusivity(EnthalpyDiffusion_i); - if (implicit) FluidModel->GetGradEnthalpyDiffusivity(GradEnthalpyDiffusion_i); - - /*--- Repeat the above computations for jPoint. ---*/ - - su2double EnthalpyDiffusion_j[MAXNVAR_SPECIES]{0.0}; - su2double GradEnthalpyDiffusion_j[MAXNVAR_SPECIES]{0.0}; - FluidModel->SetTDState_T(nodes->GetPrimitive(jPoint)[prim_idx.Temperature()], Species_j); - FluidModel->GetEnthalpyDiffusivity(EnthalpyDiffusion_j); - if (implicit) FluidModel->GetGradEnthalpyDiffusivity(GradEnthalpyDiffusion_j); - - /*--- Compute Enthalpy diffusion flux and its jacobian (for implicit iterations) ---*/ - su2double flux_enthalpy_diffusion = 0.0; - su2double jac_flux_enthalpy_diffusion = 0.0; - for (int i_species = 0; i_species < n_species; i_species++) { - flux_enthalpy_diffusion += - 0.5 * (EnthalpyDiffusion_i[i_species] + EnthalpyDiffusion_j[i_species]) * Proj_Mean_GradScalarVar[i_species]; - if (implicit) - jac_flux_enthalpy_diffusion += 0.5 * (GradEnthalpyDiffusion_i[i_species] + GradEnthalpyDiffusion_j[i_species]) * - Proj_Mean_GradScalarVar[i_species]; - } + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + const int n_species = config->GetnSpecies(); + ComputeEnthalpyDiffusion(iEdge, geometry, solver_container, numerics, n_species, implicit); + } + + Viscous_Residual_impl(iEdge, geometry, solver_container, numerics, config); +} + +void CIncNSSolver::ComputeEnthalpyDiffusion(unsigned long iEdge, CGeometry* geometry, CSolver** solver_container, + CNumerics* numerics, const int n_species, const bool implicit) { + + CVariable* speciesNodes = solver_container[SPECIES_SOL]->GetNodes(); + /*--- Points in edge ---*/ + + auto iPoint = geometry->edges->GetNode(iEdge, 0); + auto jPoint = geometry->edges->GetNode(iEdge, 1); + + /*--- Points coordinates, and normal vector ---*/ + + const su2double* Normal = geometry->edges->GetNormal(iEdge); + const su2double* Coord_i = geometry->nodes->GetCoord(iPoint); + const su2double* Coord_j = geometry->nodes->GetCoord(jPoint); + + /*--- Obtain fluid model for computing the enthalpy diffusion terms. ---*/ - /*--- Set heat flux and jacobian (for implicit) due to enthalpy diffusion ---*/ + CFluidModel* FluidModel = solver_container[FLOW_SOL]->GetFluidModel(); - numerics->SetHeatFluxDiffusion(flux_enthalpy_diffusion); - if (implicit) numerics->SetJacHeatFluxDiffusion(jac_flux_enthalpy_diffusion); + /*--- set maximum static array ---*/ + + static constexpr size_t MAXNVAR_SPECIES = 20UL; + + /*--- Species variables, and its gradients ---*/ + const su2double* Species_i = speciesNodes->GetSolution(iPoint); + const su2double* Species_j = speciesNodes->GetSolution(jPoint); + CMatrixView Species_Grad_i = speciesNodes->GetGradient(iPoint); + CMatrixView Species_Grad_j = speciesNodes->GetGradient(jPoint); + + /*--- Compute Projected gradient for species variables ---*/ + su2double ProjGradScalarVarNoCorr[MAXNVAR_SPECIES]{0.0}; + su2double Proj_Mean_GradScalarVar[MAXNVAR_SPECIES]{0.0}; + su2double proj_vector_ij = + numerics->ComputeProjectedGradient(nDim, n_species, Normal, Coord_i, Coord_j, Species_Grad_i, Species_Grad_j, + true, Species_i, Species_j, ProjGradScalarVarNoCorr, Proj_Mean_GradScalarVar); + (void)proj_vector_ij; + + /*--- Get enthalpy diffusion terms and its gradient(for implicit) for each species at point i. ---*/ + + su2double EnthalpyDiffusion_i[MAXNVAR_SPECIES]{0.0}; + su2double GradEnthalpyDiffusion_i[MAXNVAR_SPECIES]{0.0}; + FluidModel->SetTDState_T(nodes->GetPrimitive(iPoint)[prim_idx.Temperature()], Species_i); + FluidModel->GetEnthalpyDiffusivity(EnthalpyDiffusion_i); + if (implicit) FluidModel->GetGradEnthalpyDiffusivity(GradEnthalpyDiffusion_i); + + /*--- Repeat the above computations for jPoint. ---*/ + + su2double EnthalpyDiffusion_j[MAXNVAR_SPECIES]{0.0}; + su2double GradEnthalpyDiffusion_j[MAXNVAR_SPECIES]{0.0}; + FluidModel->SetTDState_T(nodes->GetPrimitive(jPoint)[prim_idx.Temperature()], Species_j); + FluidModel->GetEnthalpyDiffusivity(EnthalpyDiffusion_j); + if (implicit) FluidModel->GetGradEnthalpyDiffusivity(GradEnthalpyDiffusion_j); + + /*--- Compute Enthalpy diffusion flux and its jacobian (for implicit iterations) ---*/ + su2double flux_enthalpy_diffusion = 0.0; + su2double jac_flux_enthalpy_diffusion = 0.0; + for (int i_species = 0; i_species < n_species; i_species++) { + flux_enthalpy_diffusion += + 0.5 * (EnthalpyDiffusion_i[i_species] + EnthalpyDiffusion_j[i_species]) * Proj_Mean_GradScalarVar[i_species]; + if (implicit) + jac_flux_enthalpy_diffusion += 0.5 * (GradEnthalpyDiffusion_i[i_species] + GradEnthalpyDiffusion_j[i_species]) * + Proj_Mean_GradScalarVar[i_species]; } - Viscous_Residual_impl(iEdge, geometry, solver_container, numerics, config); + + /*--- Set heat flux and jacobian (for implicit) due to enthalpy diffusion ---*/ + + numerics->SetHeatFluxDiffusion(flux_enthalpy_diffusion); + if (implicit) numerics->SetJacHeatFluxDiffusion(jac_flux_enthalpy_diffusion); } unsigned long CIncNSSolver::SetPrimitive_Variables(CSolver **solver_container, const CConfig *config) { From 69d4efaf3644db0448c7cb8bb6e64701b158db0e Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sun, 13 Jul 2025 14:10:37 +0200 Subject: [PATCH 35/97] adding setTDState_h for multicomponent --- SU2_CFD/include/fluid/CFluidModel.hpp | 4 +-- SU2_CFD/include/fluid/CFluidScalar.hpp | 13 +++++----- SU2_CFD/src/fluid/CFluidScalar.cpp | 33 +++++++++++++++++++----- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 10 +++---- SU2_CFD/src/variables/CIncNSVariable.cpp | 24 ++++++++++------- 5 files changed, 52 insertions(+), 32 deletions(-) diff --git a/SU2_CFD/include/fluid/CFluidModel.hpp b/SU2_CFD/include/fluid/CFluidModel.hpp index 183f011974cb..c8e6cc08b39d 100644 --- a/SU2_CFD/include/fluid/CFluidModel.hpp +++ b/SU2_CFD/include/fluid/CFluidModel.hpp @@ -358,9 +358,9 @@ class CFluidModel { /*! * \brief Virtual member. * \param[in] val_enthalpy - Enthalpy value at the point. + * \param[in] val_scalars - Scalar mass fractions. */ - virtual void ComputeTempFromEnthalpy(su2double val_enthalpy, su2double* val_temperature, - const su2double* val_scalars = nullptr) {} + virtual void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) {} /*! * \brief Set fluid eddy viscosity provided by a turbulence model needed for computing effective thermal conductivity. diff --git a/SU2_CFD/include/fluid/CFluidScalar.hpp b/SU2_CFD/include/fluid/CFluidScalar.hpp index d7a5c9289bf9..576c0cd54b78 100644 --- a/SU2_CFD/include/fluid/CFluidScalar.hpp +++ b/SU2_CFD/include/fluid/CFluidScalar.hpp @@ -153,15 +153,16 @@ class CFluidScalar final : public CFluidModel { */ void GetGradEnthalpyDiffusivity(su2double* grad_enthalpy_diffusions) override; - /*! - * \brief Compute Temperature from Enthalpy and scalars. - */ - void ComputeTempFromEnthalpy(const su2double val_enthalpy, su2double* val_temperature, - const su2double* val_scalars) override; - /*! * \brief Set the Dimensionless State using Temperature. * \param[in] t - Temperature value at the point. */ void SetTDState_T(su2double val_temperature, const su2double* val_scalars) override; + + /*! + * \brief Virtual member. + * \param[in] val_enthalpy - Enthalpy value at the point. + * \param[in] val_scalars - Scalar mass fractions. + */ + void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) override; }; diff --git a/SU2_CFD/src/fluid/CFluidScalar.cpp b/SU2_CFD/src/fluid/CFluidScalar.cpp index ef28a2c81983..6bea14c4cb94 100644 --- a/SU2_CFD/src/fluid/CFluidScalar.cpp +++ b/SU2_CFD/src/fluid/CFluidScalar.cpp @@ -214,17 +214,14 @@ su2double CFluidScalar::ComputeMeanSpecificHeatCp(const su2double* val_scalars) } su2double CFluidScalar::ComputeEnthalpyFromT(const su2double val_temperature, const su2double* val_scalars){ + /* In future implementations, enthalpy should be computed using numerical integration. For now, as Cp does not + * depend on temperature, but it does depend on mixture composition, ehtalpy is directly computed from + * the expression h_s = Cp(T - T_ref). + */ su2double val_Enthalpy = Cp * (val_temperature - Ref_Temperature); return val_Enthalpy; } -void CFluidScalar::ComputeTempFromEnthalpy(const su2double val_enthalpy, su2double* val_temperature, - const su2double* val_scalars) { - MassToMoleFractions(val_scalars); - su2double val_cp = ComputeMeanSpecificHeatCp(val_scalars); - *val_temperature = val_enthalpy / val_cp + Ref_Temperature; -} - void CFluidScalar::GetEnthalpyDiffusivity(su2double* enthalpy_diffusions) { const su2double enthalpy_species_N = specificHeat[n_species_mixture - 1] * (Temperature - Ref_Temperature); for (int iVar = 0; iVar < n_species_mixture - 1; iVar++) { @@ -260,3 +257,25 @@ void CFluidScalar::SetTDState_T(const su2double val_temperature, const su2double Kt = WilkeConductivity(val_scalars); ComputeMassDiffusivity(); } + +void CFluidScalar::SetTDState_h(const su2double val_enthalpy, const su2double* val_scalars) { + MassToMoleFractions(val_scalars); + ComputeGasConstant(); + Enthalpy = val_enthalpy; + Cp = ComputeMeanSpecificHeatCp(val_scalars); + /* In future implementations, temperature should be computed using Newton-Raphson. For now, as Cp does not + * 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; + Density = Pressure_Thermodynamic / (Temperature * Gas_Constant); + Cv = Cp - Gas_Constant; + + if (wilke) { + Mu = WilkeViscosity(val_scalars); + } else if (davidson) { + Mu = DavidsonViscosity(val_scalars); + } + + Kt = WilkeConductivity(val_scalars); +} diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index e7f7a4ea0233..bc9dde16f821 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -1419,12 +1419,9 @@ void CIncEulerSolver::ComputeConsistentExtrapolation(CFluidModel* fluidModel, un const su2double* scalar) { const CIncEulerVariable::CIndices prim_idx(nDim, 0); const su2double enthalpy = primitive[prim_idx.Enthalpy()]; - su2double temperature = primitive[prim_idx.Temperature()]; - fluidModel->ComputeTempFromEnthalpy(enthalpy, &temperature, scalar); + fluidModel->SetTDState_h(enthalpy, scalar); - fluidModel->SetTDState_T(temperature, scalar); - - primitive[prim_idx.Temperature()] = temperature; + primitive[prim_idx.Temperature()] = fluidModel->GetTemperature(); primitive[prim_idx.Density()] = fluidModel->GetDensity(); } @@ -2498,8 +2495,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, if (energy_multicomponent) { CFluidModel* auxFluidModel = solver_container[FLOW_SOL]->GetFluidModel(); const su2double* scalar_inlet = config->GetInlet_SpeciesVal(config->GetMarker_All_TagBound(val_marker)); - auxFluidModel->SetTDState_T(V_inlet[prim_idx.Temperature()], - scalar_inlet); // compute total enthalpy from temperature + auxFluidModel->SetTDState_T(V_inlet[prim_idx.Temperature()], scalar_inlet); V_inlet[prim_idx.Enthalpy()] = auxFluidModel->GetEnthalpy(); } diff --git a/SU2_CFD/src/variables/CIncNSVariable.cpp b/SU2_CFD/src/variables/CIncNSVariable.cpp index bc909abdb1b6..55524bfef7bb 100644 --- a/SU2_CFD/src/variables/CIncNSVariable.cpp +++ b/SU2_CFD/src/variables/CIncNSVariable.cpp @@ -67,22 +67,24 @@ bool CIncNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2do if(Energy_Multicomponent){ su2double Enthalpy = Solution(iPoint, nDim +1); - FluidModel->ComputeTempFromEnthalpy(Enthalpy, &Temperature, scalar); + FluidModel->SetTDState_h(Enthalpy, scalar); + Temperature = FluidModel->GetTemperature(); } else { /*--- Set the value of the temperature directly ---*/ Temperature = Solution(iPoint, indices.Temperature()); } auto check_temp = SetTemperature(iPoint, Temperature); - /*--- Use the fluid model to compute the new value of density. - Note that the thermodynamic pressure is constant and decoupled - from the dynamic pressure being iterated. ---*/ + + if (!Energy_Multicomponent) { + /*--- Use the fluid model to compute the new value of density. + Note that the thermodynamic pressure is constant and decoupled + from the dynamic pressure being iterated. ---*/ - /*--- Use the fluid model to compute the new value of density. ---*/ + /*--- Use the fluid model to compute the new value of density. ---*/ - FluidModel->SetTDState_T(Temperature, scalar); + FluidModel->SetTDState_T(Temperature, scalar); - if (!Energy_Multicomponent) { /*--- for FLAMELET: copy the LUT temperature into the solution ---*/ Solution(iPoint, nDim + 1) = FluidModel->GetTemperature(); /*--- for FLAMELET: update the local temperature using LUT variables ---*/ @@ -107,12 +109,14 @@ bool CIncNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2do if (Energy_Multicomponent) { su2double Enthalpy = Solution(iPoint, nDim + 1); - FluidModel->ComputeTempFromEnthalpy(Enthalpy, &Temperature, scalar); + FluidModel->SetTDState_h(Enthalpy, scalar); + SetTemperature(iPoint, FluidModel->GetTemperature()); } else { Temperature = Solution(iPoint, indices.Temperature()); + SetTemperature(iPoint, Temperature); + FluidModel->SetTDState_T(Temperature, scalar); } - SetTemperature(iPoint, Temperature); - FluidModel->SetTDState_T(Temperature, scalar); + SetDensity(iPoint, FluidModel->GetDensity()); /*--- Flag this point as non-physical. ---*/ From 982fb56c2556217c19088616bc0209c7c741db19 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Thu, 31 Jul 2025 13:52:39 +0200 Subject: [PATCH 36/97] updating parallel_regresion residuals --- TestCases/parallel_regression.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index c1b42fd916c8..c2f8c949e813 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1569,7 +1569,7 @@ def main(): species2_primitiveVenturi_mixingmodel.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel.cfg_file = "species2_primitiveVenturi_mixingmodel.cfg" species2_primitiveVenturi_mixingmodel.test_iter = 50 - species2_primitiveVenturi_mixingmodel.test_vals = [ -5.732153, -4.561603, -4.665933, -5.864167, -0.069493, -5.583639, 5.000000, -1.381549, 5.000000, -4.869625, 5.000000, -1.453019, 0.000378, 0.000362, 0.000016, 0.000000] + species2_primitiveVenturi_mixingmodel.test_vals = [ -5.737415, -4.566668, -4.671780, -5.777603, -0.066800, -5.583554, 5.000000, -1.373807, 5.000000, -4.869219, 5.000000, -1.453021, 0.000381, 0.000365, 0.000016, 0.000000] test_list.append(species2_primitiveVenturi_mixingmodel) # 2 species (1 eq) primitive venturi mixing using mixing model and bounded scalar transport @@ -1577,7 +1577,7 @@ def main(): species2_primitiveVenturi_mixingmodel_boundedscalar.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_boundedscalar.cfg_file = "species2_primitiveVenturi_mixingmodel_boundedscalar.cfg" species2_primitiveVenturi_mixingmodel_boundedscalar.test_iter = 50 - species2_primitiveVenturi_mixingmodel_boundedscalar.test_vals = [-5.688210, -4.507478, -4.611654, -6.120321, -0.118407, -5.705981, 5.000000, -1.439850, 5.000000, -4.922431, 5.000000, -1.768043, 0.000313, 0.000313, 0.000000, 0.000000] + species2_primitiveVenturi_mixingmodel_boundedscalar.test_vals = [-5.690396, -4.512158, -4.616488, -5.776093, -0.113176, -5.705291, 5.000000, -1.433234, 5.000000, -4.921121, 5.000000, -1.770744, 0.000318, 0.000318, 0.000000, 0.000000] test_list.append(species2_primitiveVenturi_mixingmodel_boundedscalar) # 2 species (1 eq) primitive venturi mixing using mixing model including viscosity, thermal conductivity and inlet markers for SA turbulence model @@ -1593,7 +1593,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_iter = 50 - species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-5.820188, -4.627870, -4.556574, -6.834134, 2.077283, -5.481298, 30.000000, -7.317611, 12.000000, -8.064489, 8.000000, -8.902923, 2.092310, 1.000000, 0.600000, 0.492310] + species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-5.824280, -4.632628, -4.560106, -6.764902, 2.076781, -5.480635, 30.000000, -7.313820, 12.000000, -8.059765, 8.000000, -8.904808, 2.092258, 1.000000, 0.600000, 0.492258] test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2) # 2 species (1 eq) primitive venturi mixing using mixing model including heat capacity and mass diffusivity NonDimensional case @@ -1601,7 +1601,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_iter = 50 - species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.407825, -4.920839, -4.842095, -7.820571, 1.773871, -5.086936, 10.000000, -2.736335, 3.000000, -5.216316, 5.000000, -5.855262, 2.092350, 1.000000, 0.600000, 0.492350] + species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.400552, -4.915641, -4.836920, -7.711367, 1.771551, -5.086850, 10.000000, -2.741766, 3.000000, -5.104310, 5.000000, -5.859810, 2.092354, 1.000000, 0.600000, 0.492354] test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND) # 2 species (1 eq) primitive venturi mixing using mixing model solving enthalpy equation using preconditioning + JST convective scheme From 18792df7c582dfdf2f76ea5a5565320be2fc1449 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Thu, 21 Aug 2025 11:09:10 +0200 Subject: [PATCH 37/97] update multizone restart for species transport --- .github/workflows/regression.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 3c14057f42e2..142f9d3a3855 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -211,7 +211,7 @@ jobs: uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402 with: # -t -c - args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} + args: -b ${{github.ref}} -t develop -c feature_restart_preconditioning -s ${{matrix.testscript}} - name: Cleanup uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402 with: From 5fa9236e5ff235291e0b8218420d7f53432670e1 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Thu, 21 Aug 2025 12:02:07 +0200 Subject: [PATCH 38/97] updating residual multizone species transport --- TestCases/parallel_regression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index cf145c331c6d..a2c0d4ead205 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1667,7 +1667,7 @@ def main(): species3_multizone_restart.cfg_dir = "species_transport/multizone" species3_multizone_restart.cfg_file = "configMaster.cfg" species3_multizone_restart.test_iter = 5 - species3_multizone_restart.test_vals = [-3.723247, -3.108855] + species3_multizone_restart.test_vals = [-4.717939, -4.785805] species3_multizone_restart.multizone = True test_list.append(species3_multizone_restart) From 1b52536b9e65ebfde9776cc02e9901984889772d Mon Sep 17 00:00:00 2001 From: Cristopher Morales <98025159+Cristopher-Morales@users.noreply.github.com> Date: Mon, 25 Aug 2025 10:37:50 +0200 Subject: [PATCH 39/97] Update SU2_CFD/include/numerics/CNumerics.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/include/numerics/CNumerics.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 84a2126507ca..4e26ae757d44 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -136,7 +136,7 @@ class CNumerics { su2double HeatFluxDiffusion; /*!< \brief Heat flux due to enthalpy diffusion for multicomponent. */ su2double - Jac_HeatFluxDiffusion; /*!< \brief Heat flux jacobian due to enthalpy diffusion for multicomponent. */ + JacHeatFluxDiffusion; /*!< \brief Heat flux jacobian due to enthalpy diffusion for multicomponent. */ const su2double *TransVar_i, /*!< \brief Vector of turbulent variables at point i. */ *TransVar_j; /*!< \brief Vector of turbulent variables at point j. */ From 47e77c77cbd2fac2063f7970cc37f931d3a2eb1f Mon Sep 17 00:00:00 2001 From: Cristopher Morales <98025159+Cristopher-Morales@users.noreply.github.com> Date: Mon, 25 Aug 2025 10:38:00 +0200 Subject: [PATCH 40/97] Update SU2_CFD/include/numerics/CNumerics.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/include/numerics/CNumerics.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 4e26ae757d44..7852bac8eb4e 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -770,7 +770,7 @@ class CNumerics { * \brief Set Jacobian of the heat flux due to enthalpy diffusion * \param[in] val_jacheatfluxdiffusion - Value of the heat flux jacobian due to enthalpy diffusion. */ - inline void SetJacHeatFluxDiffusion(su2double val_jac_heatfluxdiffusion) { + inline void SetJacHeatFluxDiffusion(su2double val_jacheatfluxdiffusion) { Jac_HeatFluxDiffusion = val_jac_heatfluxdiffusion; } From f99a541cac58d7acc811c9a11dce7a3a85a3bd69 Mon Sep 17 00:00:00 2001 From: Cristopher Morales <98025159+Cristopher-Morales@users.noreply.github.com> Date: Mon, 25 Aug 2025 10:38:32 +0200 Subject: [PATCH 41/97] Update SU2_CFD/src/fluid/CFluidScalar.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/src/fluid/CFluidScalar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/fluid/CFluidScalar.cpp b/SU2_CFD/src/fluid/CFluidScalar.cpp index 6bea14c4cb94..fddd6608f8a5 100644 --- a/SU2_CFD/src/fluid/CFluidScalar.cpp +++ b/SU2_CFD/src/fluid/CFluidScalar.cpp @@ -215,7 +215,7 @@ su2double CFluidScalar::ComputeMeanSpecificHeatCp(const su2double* val_scalars) su2double CFluidScalar::ComputeEnthalpyFromT(const su2double val_temperature, const su2double* val_scalars){ /* In future implementations, enthalpy should be computed using numerical integration. For now, as Cp does not - * depend on temperature, but it does depend on mixture composition, ehtalpy is directly computed from + * 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); From d3496d66cce8173c9df570130e6105b099be9ad5 Mon Sep 17 00:00:00 2001 From: Cristopher Morales <98025159+Cristopher-Morales@users.noreply.github.com> Date: Mon, 25 Aug 2025 10:38:50 +0200 Subject: [PATCH 42/97] Update SU2_CFD/src/numerics/CNumerics.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/src/numerics/CNumerics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/numerics/CNumerics.cpp b/SU2_CFD/src/numerics/CNumerics.cpp index 07c29c029af6..f89179041633 100644 --- a/SU2_CFD/src/numerics/CNumerics.cpp +++ b/SU2_CFD/src/numerics/CNumerics.cpp @@ -54,7 +54,7 @@ CNumerics::CNumerics(unsigned short val_nDim, unsigned short val_nVar, Prandtl_Lam = config->GetPrandtl_Lam(); Prandtl_Turb = config->GetPrandtl_Turb(); Gas_Constant = config->GetGas_ConstantND(); - energy_multicomponent = ((config->GetKind_FluidModel() == FLUID_MIXTURE) && (config->GetEnergy_Equation())); + energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); tau = new su2double* [nDim]; for (iDim = 0; iDim < nDim; iDim++) From d45faef5687c309314d6ef339fc7c9bac672cceb Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Mon, 25 Aug 2025 11:47:38 +0200 Subject: [PATCH 43/97] fixing names according to review comment --- SU2_CFD/include/numerics/CNumerics.hpp | 2 +- SU2_CFD/src/numerics/flow/flow_diffusion.cpp | 4 ++-- SU2_CFD/src/numerics/flow/flow_sources.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 7852bac8eb4e..654e6dea7436 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -771,7 +771,7 @@ class CNumerics { * \param[in] val_jacheatfluxdiffusion - Value of the heat flux jacobian due to enthalpy diffusion. */ inline void SetJacHeatFluxDiffusion(su2double val_jacheatfluxdiffusion) { - Jac_HeatFluxDiffusion = val_jac_heatfluxdiffusion; + JacHeatFluxDiffusion = val_jacheatfluxdiffusion; } /*! diff --git a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp index 882191d0224d..75fdfd295938 100644 --- a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp +++ b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp @@ -659,9 +659,9 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi if (energy_multicomponent){ Mean_Heat_Capacity = 0.5 * (V_i[nDim + 7] + V_j[nDim + 7]); Jacobian_i[nDim + 1][nDim + 1] = - -(Mean_Thermal_Conductivity * proj_vector_ij + Jac_HeatFluxDiffusion) / Mean_Heat_Capacity; + -(Mean_Thermal_Conductivity * proj_vector_ij + JacHeatFluxDiffusion) / Mean_Heat_Capacity; Jacobian_j[nDim + 1][nDim + 1] = - (Mean_Thermal_Conductivity * proj_vector_ij + Jac_HeatFluxDiffusion) / Mean_Heat_Capacity; + (Mean_Thermal_Conductivity * proj_vector_ij + JacHeatFluxDiffusion) / Mean_Heat_Capacity; } else { Jacobian_i[nDim + 1][nDim + 1] = -Mean_Thermal_Conductivity * proj_vector_ij; Jacobian_j[nDim + 1][nDim + 1] = Mean_Thermal_Conductivity * proj_vector_ij; diff --git a/SU2_CFD/src/numerics/flow/flow_sources.cpp b/SU2_CFD/src/numerics/flow/flow_sources.cpp index b35d151faefc..3d9cbb4c3535 100644 --- a/SU2_CFD/src/numerics/flow/flow_sources.cpp +++ b/SU2_CFD/src/numerics/flow/flow_sources.cpp @@ -337,7 +337,7 @@ CNumerics::ResidualType<> CSourceIncAxisymmetric_Flow::ComputeResidual(const CCo residual[3] -= Volume * yinv * Thermal_Conductivity_i * PrimVar_Grad_i[nDim + 1][1]; if (multicomponent && energy) { residual[3] -= Volume * yinv * HeatFluxDiffusion; - if (implicit) jacobian[3][3] -= Volume * yinv * Jac_HeatFluxDiffusion / Cp_i; + if (implicit) jacobian[3][3] -= Volume * yinv * JacHeatFluxDiffusion / Cp_i; } } From bbb0882582700c2d9f7c5514d521c58422437d28 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Tue, 26 Aug 2025 08:56:43 +0200 Subject: [PATCH 44/97] fixing ComputeConsistentExtrapolation according to review comment --- SU2_CFD/include/solvers/CIncEulerSolver.hpp | 4 ++-- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/SU2_CFD/include/solvers/CIncEulerSolver.hpp b/SU2_CFD/include/solvers/CIncEulerSolver.hpp index 02bdb12a3775..527fc4f11e31 100644 --- a/SU2_CFD/include/solvers/CIncEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CIncEulerSolver.hpp @@ -213,8 +213,8 @@ class CIncEulerSolver : public CFVMFlowSolverBaseGetNodes()->GetSolution(iPoint); const su2double* scalar_j = solver_container[SPECIES_SOL]->GetNodes()->GetSolution(jPoint); - ComputeConsistentExtrapolation(GetFluidModel(), nDim, Primitive_i, scalar_i); - ComputeConsistentExtrapolation(GetFluidModel(), nDim, Primitive_j, scalar_j); + ComputeConsistentExtrapolation(GetFluidModel(), nDim, scalar_i, Primitive_i); + ComputeConsistentExtrapolation(GetFluidModel(), nDim, scalar_j, Primitive_j); } /*--- Check for non-physical solutions after reconstruction. If found, @@ -1419,8 +1419,8 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont FinalizeResidualComputation(geometry, pausePreacc, counter_local, config); } -void CIncEulerSolver::ComputeConsistentExtrapolation(CFluidModel* fluidModel, unsigned short nDim, su2double* primitive, - const su2double* scalar) { +void CIncEulerSolver::ComputeConsistentExtrapolation(CFluidModel* fluidModel, unsigned short nDim, + const su2double* scalar, su2double* primitive) { const CIncEulerVariable::CIndices prim_idx(nDim, 0); const su2double enthalpy = primitive[prim_idx.Enthalpy()]; fluidModel->SetTDState_h(enthalpy, scalar); From d66fcebc1233c3f9e11b9bb1b2f48cc69bb1c619 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Wed, 3 Sep 2025 21:47:03 +0200 Subject: [PATCH 45/97] removing WorkingVar from numerics and small cleaning --- SU2_CFD/include/numerics/CNumerics.hpp | 3 --- SU2_CFD/src/numerics/flow/convection/centered.cpp | 2 ++ SU2_CFD/src/numerics/flow/convection/fds.cpp | 1 + SU2_CFD/src/solvers/CIncEulerSolver.cpp | 8 ++++---- SU2_CFD/src/solvers/CIncNSSolver.cpp | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 19b67beb8419..cf1cc8afda5c 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -103,9 +103,6 @@ class CNumerics { su2double Enthalpy_i, /*!< \brief Enthalpy at point i. */ Enthalpy_j; /*!< \brief Enthalpy at point j. */ - su2double - WorkingVariable_i, /*!< \brief Working Variable at point i for incompressible solver. */ - WorkingVariable_j; /*!< \brief Working Variable at point j for incompressible solver. */ su2double dist_i, /*!< \brief Distance of point i to the nearest wall. */ dist_j; /*!< \brief Distance of point j to the nearest wall. */ diff --git a/SU2_CFD/src/numerics/flow/convection/centered.cpp b/SU2_CFD/src/numerics/flow/convection/centered.cpp index fca062df2907..e04724408cca 100644 --- a/SU2_CFD/src/numerics/flow/convection/centered.cpp +++ b/SU2_CFD/src/numerics/flow/convection/centered.cpp @@ -89,6 +89,7 @@ CNumerics::ResidualType<> CCentLaxInc_Flow::ComputeResidual(const CConfig* confi su2double U_i[5] = {0.0}, U_j[5] = {0.0}; su2double ProjGridVel = 0.0, ProjVelocity = 0.0; + su2double WorkingVariable_i, WorkingVariable_j; /*--- Primitive variables at point i and j ---*/ @@ -330,6 +331,7 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi su2double U_i[5] = {0.0}, U_j[5] = {0.0}; su2double ProjGridVel = 0.0; + su2double WorkingVariable_i, WorkingVariable_j; /*--- Primitive variables at point i and j ---*/ diff --git a/SU2_CFD/src/numerics/flow/convection/fds.cpp b/SU2_CFD/src/numerics/flow/convection/fds.cpp index 965d52f9e2d0..a77b82f8977f 100644 --- a/SU2_CFD/src/numerics/flow/convection/fds.cpp +++ b/SU2_CFD/src/numerics/flow/convection/fds.cpp @@ -92,6 +92,7 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config su2double U_i[5] = {0.0,0.0,0.0,0.0,0.0}, U_j[5] = {0.0,0.0,0.0,0.0,0.0}; su2double ProjGridVel = 0.0; + su2double WorkingVariable_i, WorkingVariable_j; AD::StartPreacc(); AD::SetPreaccIn(V_i, nDim+10); AD::SetPreaccIn(V_j, nDim+10); AD::SetPreaccIn(Normal, nDim); diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index 43d390f6bdf3..5ee15ef5f44f 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -55,7 +55,7 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned bool time_stepping = config->GetTime_Marching() == TIME_MARCHING::TIME_STEPPING; bool adjoint = (config->GetContinuous_Adjoint()) || (config->GetDiscrete_Adjoint()); const bool centered = config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED; - const bool energy_multicomponent = ((config->GetKind_FluidModel() == FLUID_MIXTURE) && config->GetEnergy_Equation()); + const bool energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); /* A grid is defined as dynamic if there's rigid grid movement or grid deformation AND the problem is time domain */ dynamic_grid = config->GetDynamic_Grid(); @@ -2218,7 +2218,7 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain const bool implicit = config->GetKind_TimeIntScheme() == EULER_IMPLICIT; const bool viscous = config->GetViscous(); - const bool energy_multicomponent = ((config->GetKind_FluidModel() == FLUID_MIXTURE) && (config->GetEnergy_Equation())); + const bool energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); su2double Normal[MAXNDIM] = {0.0}; @@ -2362,7 +2362,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool viscous = config->GetViscous(); - const bool energy_multicomponent = ((config->GetKind_FluidModel() == FLUID_MIXTURE) && (config->GetEnergy_Equation())); + const bool energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); string Marker_Tag = config->GetMarker_All_TagBound(val_marker); @@ -2623,7 +2623,7 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool viscous = config->GetViscous(); - const bool energy_multicomponent = ((config->GetKind_FluidModel() == FLUID_MIXTURE) && (config->GetEnergy_Equation())); + const bool energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); string Marker_Tag = config->GetMarker_All_TagBound(val_marker); su2double Normal[MAXNDIM] = {0.0}; diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index a422a5d67d18..c66697eba0f7 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -69,7 +69,7 @@ void CIncNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container const bool limiter = (config->GetKind_SlopeLimit_Flow() != LIMITER::NONE) && (InnerIter <= config->GetLimiterIter()); const bool van_albada = (config->GetKind_SlopeLimit_Flow() == LIMITER::VAN_ALBADA_EDGE); const bool wall_functions = config->GetWall_Functions(); - const bool energy_multicomponent = (config->GetEnergy_Equation()) && (config->GetKind_FluidModel() == FLUID_MIXTURE); + const bool energy_multicomponent = config->GetEnergy_Equation() && config->GetKind_FluidModel() == FLUID_MIXTURE; /*--- Common preprocessing steps (implemented by CEulerSolver) ---*/ @@ -300,7 +300,7 @@ void CIncNSSolver::Compute_Streamwise_Periodic_Recovered_Values(CConfig *config, void CIncNSSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config) { - const bool energy_multicomponent = ((config->GetKind_FluidModel() == FLUID_MIXTURE) && config->GetEnergy_Equation()); + const bool energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); /*--- Contribution to heat flux due to enthalpy diffusion for multicomponent and reacting flows ---*/ if (energy_multicomponent) { From 8ba4b783204e110453c7e13923a9a1be50002234 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Wed, 10 Sep 2025 11:48:12 +0200 Subject: [PATCH 46/97] formatting --- SU2_CFD/include/solvers/CIncNSSolver.hpp | 4 ++-- SU2_CFD/src/solvers/CIncNSSolver.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/include/solvers/CIncNSSolver.hpp b/SU2_CFD/include/solvers/CIncNSSolver.hpp index 21fbc65ddeb5..7cc443e6dfee 100644 --- a/SU2_CFD/include/solvers/CIncNSSolver.hpp +++ b/SU2_CFD/include/solvers/CIncNSSolver.hpp @@ -103,8 +103,8 @@ class CIncNSSolver final : public CIncEulerSolver { * \param[in] n_species - Number of species in the mixture that a transport equation is solved. * \param[in] implicit - Boolean for implicit iterations. */ - void ComputeEnthalpyDiffusion(unsigned long iEdge, CGeometry* geometry, CSolver** solver_container, CNumerics* numerics, - const int n_species, const bool implicit) ; + void Compute_Enthalpy_Diffusion(unsigned long iEdge, CGeometry* geometry, CSolver** solver_container, + CNumerics* numerics, const int n_species, const bool implicit); public: /*! diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index c66697eba0f7..7f02687aa3f2 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -306,13 +306,13 @@ void CIncNSSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CS if (energy_multicomponent) { const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const int n_species = config->GetnSpecies(); - ComputeEnthalpyDiffusion(iEdge, geometry, solver_container, numerics, n_species, implicit); + Compute_Enthalpy_Diffusion(iEdge, geometry, solver_container, numerics, n_species, implicit); } Viscous_Residual_impl(iEdge, geometry, solver_container, numerics, config); } -void CIncNSSolver::ComputeEnthalpyDiffusion(unsigned long iEdge, CGeometry* geometry, CSolver** solver_container, +void CIncNSSolver::Compute_Enthalpy_Diffusion(unsigned long iEdge, CGeometry* geometry, CSolver** solver_container, CNumerics* numerics, const int n_species, const bool implicit) { CVariable* speciesNodes = solver_container[SPECIES_SOL]->GetNodes(); From da4ab089d688c6edbd8f9fba2569a49fe0c4bc91 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Wed, 24 Sep 2025 11:32:51 +0200 Subject: [PATCH 47/97] updating residuals --- TestCases/parallel_regression.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 3489f7a908f4..4f7e929f0051 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1667,8 +1667,8 @@ def main(): species_active_transport_temp_limits.cfg_dir = "species_transport/passive_transport_validation" species_active_transport_temp_limits.cfg_file = "active_species_transport_temp_limits.cfg" species_active_transport_temp_limits.test_iter = 50 - species_active_transport_temp_limits.test_vals = [-2.340885, -2.257725, -1.926927, -3.236329, 9.000000, -5.006265, 4.000000, -5.931361, 1.646370, 0.993308, 0.000445, 0.652617] - species_active_transport_temp_limits.test_vals_aarch64 = [-2.340885, -2.257725, -1.926927, -3.236329, 9.000000, -5.006265, 4.000000, -5.931361, 1.646370, 0.993308, 0.000445, 0.652617] + species_active_transport_temp_limits.test_vals = [-1.785041, -2.565628, 2.460433, -3.188111, 9.000000, -5.551493, 3.000000, -5.826106, 1.456438, 0.998134, 0.001475, 0.456829] + species_active_transport_temp_limits.test_vals_aarch64 = [-1.785041, -2.565628, 2.460433, -3.188111, 9.000000, -5.551493, 3.000000, -5.826106, 1.456438, 0.998134, 0.001475, 0.456829] test_list.append(species_active_transport_temp_limits) # species transport, 3 species with multizone (2 fluid regions) From 61ba0f2aa38db14cc6a5c55a9e5df612e39e5344 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Fri, 3 Oct 2025 15:42:27 +0200 Subject: [PATCH 48/97] defining enthalpy in each model and reformulating inlet BC --- SU2_CFD/include/fluid/CConstantDensity.hpp | 1 + SU2_CFD/include/fluid/CIncIdealGas.hpp | 1 + .../include/fluid/CIncIdealGasPolynomial.hpp | 1 + SU2_CFD/src/fluid/CFluidFlamelet.cpp | 1 + .../src/numerics/flow/convection/centered.cpp | 13 +--- SU2_CFD/src/numerics/flow/convection/fds.cpp | 5 +- SU2_CFD/src/numerics/flow/flow_sources.cpp | 6 +- SU2_CFD/src/output/CFlowOutput.cpp | 7 +-- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 60 ++++++++----------- SU2_CFD/src/variables/CIncNSVariable.cpp | 2 +- 10 files changed, 37 insertions(+), 60 deletions(-) diff --git a/SU2_CFD/include/fluid/CConstantDensity.hpp b/SU2_CFD/include/fluid/CConstantDensity.hpp index a452661be5cc..0a3371f87ebf 100644 --- a/SU2_CFD/include/fluid/CConstantDensity.hpp +++ b/SU2_CFD/include/fluid/CConstantDensity.hpp @@ -56,5 +56,6 @@ class CConstantDensity final : public CFluidModel { decoupled equation. Hence, we update the value. Note Cp = Cv, (gamma = 1).*/ Temperature = t; + Enthalpy = Cp * Temperature; } }; diff --git a/SU2_CFD/include/fluid/CIncIdealGas.hpp b/SU2_CFD/include/fluid/CIncIdealGas.hpp index d8bb21af5941..cabc30f47ca2 100644 --- a/SU2_CFD/include/fluid/CIncIdealGas.hpp +++ b/SU2_CFD/include/fluid/CIncIdealGas.hpp @@ -58,6 +58,7 @@ class CIncIdealGas final : public CFluidModel { /*--- The EoS only depends upon temperature. ---*/ Temperature = t; Density = Pressure / (Temperature * Gas_Constant); + Enthalpy = Cp * Temperature; } private: diff --git a/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp b/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp index 06cfa616adb5..a64f308df848 100644 --- a/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp +++ b/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp @@ -80,6 +80,7 @@ class CIncIdealGasPolynomial final : public CFluidModel { Cp += coeffs_[i] * t_i; } Cv = Cp / Gamma; + Enthalpy = Cp * Temperature; } private: diff --git a/SU2_CFD/src/fluid/CFluidFlamelet.cpp b/SU2_CFD/src/fluid/CFluidFlamelet.cpp index fd1417b3f56d..7cc1692fd5a4 100644 --- a/SU2_CFD/src/fluid/CFluidFlamelet.cpp +++ b/SU2_CFD/src/fluid/CFluidFlamelet.cpp @@ -123,6 +123,7 @@ void CFluidFlamelet::SetTDState_T(su2double val_temperature, const su2double* va /*--- Add all quantities and their names to the look up vectors. ---*/ EvaluateDataSet(scalars_vector, FLAMELET_LOOKUP_OPS::THERMO, val_vars_TD); + Enthalpy = scalars_vector[1]; Temperature = val_vars_TD[LOOKUP_TD::TEMPERATURE]; Cp = val_vars_TD[LOOKUP_TD::HEATCAPACITY]; Mu = val_vars_TD[LOOKUP_TD::VISCOSITY]; diff --git a/SU2_CFD/src/numerics/flow/convection/centered.cpp b/SU2_CFD/src/numerics/flow/convection/centered.cpp index e04724408cca..4d03c474b56e 100644 --- a/SU2_CFD/src/numerics/flow/convection/centered.cpp +++ b/SU2_CFD/src/numerics/flow/convection/centered.cpp @@ -98,14 +98,11 @@ CNumerics::ResidualType<> CCentLaxInc_Flow::ComputeResidual(const CConfig* confi DensityInc_i = V_i[nDim+2]; DensityInc_j = V_j[nDim+2]; BetaInc2_i = V_i[nDim+3]; BetaInc2_j = V_j[nDim+3]; Cp_i = V_i[nDim+7]; Cp_j = V_j[nDim+7]; - if (energy_multicomponent) { - Enthalpy_i = V_i[nDim + 9]; - Enthalpy_j = V_j[nDim + 9]; + Enthalpy_i = V_i[nDim + 9]; Enthalpy_j = V_j[nDim + 9]; + if (energy_multicomponent) { WorkingVariable_i = Enthalpy_i; WorkingVariable_j = Enthalpy_j; } else { - Enthalpy_i = Cp_i * Temperature_i; - Enthalpy_j = Cp_j * Temperature_j; WorkingVariable_i = Temperature_i; WorkingVariable_j = Temperature_j; } @@ -339,15 +336,11 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi Temperature_i = V_i[nDim+1]; Temperature_j = V_j[nDim+1]; DensityInc_i = V_i[nDim+2]; DensityInc_j = V_j[nDim+2]; BetaInc2_i = V_i[nDim+3]; BetaInc2_j = V_j[nDim+3]; - Cp_i = V_i[nDim+7]; Cp_j = V_j[nDim+7]; + Enthalpy_i = V_i[nDim+9]; Enthalpy_j = V_j[nDim+9]; if (energy_multicomponent) { - Enthalpy_i = V_i[nDim + 9]; - Enthalpy_j = V_j[nDim + 9]; WorkingVariable_i = Enthalpy_i; WorkingVariable_j = Enthalpy_j; } else { - Enthalpy_i = Cp_i * Temperature_i; - Enthalpy_j = Cp_j * Temperature_j; WorkingVariable_i = Temperature_i; WorkingVariable_j = Temperature_j; } diff --git a/SU2_CFD/src/numerics/flow/convection/fds.cpp b/SU2_CFD/src/numerics/flow/convection/fds.cpp index a77b82f8977f..3ed67448e082 100644 --- a/SU2_CFD/src/numerics/flow/convection/fds.cpp +++ b/SU2_CFD/src/numerics/flow/convection/fds.cpp @@ -119,14 +119,11 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config DensityInc_i = V_i[nDim+2]; DensityInc_j = V_j[nDim+2]; BetaInc2_i = V_i[nDim+3]; BetaInc2_j = V_j[nDim+3]; Cp_i = V_i[nDim+7]; Cp_j = V_j[nDim+7]; + Enthalpy_i = V_i[nDim+9]; Enthalpy_j = V_j[nDim+9]; if (energy_multicomponent) { - Enthalpy_i = V_i[nDim + 9]; - Enthalpy_j = V_j[nDim + 9]; WorkingVariable_i = Enthalpy_i; WorkingVariable_j = Enthalpy_j; } else { - Enthalpy_i = Cp_i * Temperature_i; - Enthalpy_j = Cp_j * Temperature_j; WorkingVariable_i = Temperature_i; WorkingVariable_j = Temperature_j; } diff --git a/SU2_CFD/src/numerics/flow/flow_sources.cpp b/SU2_CFD/src/numerics/flow/flow_sources.cpp index f9cb377c90c9..4004060861d0 100644 --- a/SU2_CFD/src/numerics/flow/flow_sources.cpp +++ b/SU2_CFD/src/numerics/flow/flow_sources.cpp @@ -264,11 +264,7 @@ CNumerics::ResidualType<> CSourceIncAxisymmetric_Flow::ComputeResidual(const CCo DensityInc_i = V_i[nDim+2]; BetaInc2_i = V_i[nDim+3]; Cp_i = V_i[nDim+7]; - if (multicomponent && energy) { - Enthalpy_i = V_i[nDim + 9]; - } else { - Enthalpy_i = Cp_i * Temp_i; - } + Enthalpy_i = V_i[nDim + 9]; for (iDim = 0; iDim < nDim; iDim++) Velocity_i[iDim] = V_i[iDim+1]; diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 0efd009b1bde..0fa0dcda3df7 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -150,7 +150,6 @@ void CFlowOutput::SetAnalyzeSurface(const CSolver* const*solver, const CGeometry const bool compressible = config->GetKind_Regime() == ENUM_REGIME::COMPRESSIBLE; const bool incompressible = config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE; const bool energy = config->GetEnergy_Equation(); - const bool multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE; const bool streamwisePeriodic = (config->GetKind_Streamwise_Periodic() != ENUM_STREAMWISE_PERIODIC::NONE); const bool species = config->GetKind_Species_Model() == SPECIES_MODEL::SPECIES_TRANSPORT; const auto nSpecies = config->GetnSpecies(); @@ -242,11 +241,7 @@ void CFlowOutput::SetAnalyzeSurface(const CSolver* const*solver, const CGeometry sqrt(config->GetBulk_Modulus()/(flow_nodes->GetDensity(iPoint))); } Temperature = flow_nodes->GetTemperature(iPoint); - if (energy && multicomponent) { - Enthalpy = flow_nodes->GetEnthalpy(iPoint); - } else { - Enthalpy = flow_nodes->GetSpecificHeatCp(iPoint) * Temperature; - } + Enthalpy = flow_nodes->GetEnthalpy(iPoint); TotalTemperature = Temperature + 0.5*Velocity2/flow_nodes->GetSpecificHeatCp(iPoint); TotalPressure = Pressure + 0.5*Density*Velocity2; } diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index aac3121e3c13..ab25638ed874 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -2118,10 +2118,7 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo Cp = nodes->GetSpecificHeatCp(iPoint); oneOverCp = 1.0/Cp; Temperature = nodes->GetTemperature(iPoint); - Enthalpy = Cp * Temperature; - if (energy && multicomponent) { - Enthalpy = nodes->GetEnthalpy(iPoint); - } + Enthalpy = nodes->GetEnthalpy(iPoint); for (iDim = 0; iDim < nDim; iDim++) Velocity[iDim] = nodes->GetVelocity(iPoint,iDim); @@ -2131,7 +2128,7 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo law, but in the future, dRhodT should be in the fluid model. ---*/ if (variable_density) { - if (multicomponent && energy){ + if (multicomponent){ dRhodT = -Density / (Cp * Temperature); Cp = oneOverCp = 1.0; } else { @@ -2229,7 +2226,7 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain const bool implicit = config->GetKind_TimeIntScheme() == EULER_IMPLICIT; const bool viscous = config->GetViscous(); - const bool energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); + const bool species_model = config->GetKind_Species_Model() != SPECIES_MODEL::NONE; su2double Normal[MAXNDIM] = {0.0}; @@ -2274,14 +2271,12 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain V_infty[prim_idx.Temperature()] = GetTemperature_Inf(); - /*-- Enthalpy at far-field is needed for energy equation in multicomponent and reacting flows. ---*/ - if (energy_multicomponent) { - CFluidModel* auxFluidModel = solver_container[FLOW_SOL]->GetFluidModel(); - const su2double* scalar_infty = config->GetSpecies_Init(); - auxFluidModel->SetTDState_T(V_infty[prim_idx.Temperature()], - scalar_infty); // obtain enthalpy from temperature and species mass fractions - V_infty[prim_idx.Enthalpy()] = auxFluidModel->GetEnthalpy(); - } + /*-- Enthalpy at far-field. ---*/ + const su2double* scalar_infty = nullptr; + if (species_model) scalar_infty = config->GetSpecies_Init(); + CFluidModel* auxFluidModel = solver_container[FLOW_SOL]->GetFluidModel(); + auxFluidModel->SetTDState_T(V_infty[prim_idx.Temperature()], scalar_infty); + V_infty[prim_idx.Enthalpy()] = auxFluidModel->GetEnthalpy(); /*--- Store the density. ---*/ @@ -2318,7 +2313,7 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain /*--- Viscous residual contribution ---*/ - if (!viscous || energy_multicomponent) continue; + if (!viscous || species_model) continue; /*--- Set transport properties at infinity. ---*/ @@ -2373,7 +2368,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool viscous = config->GetViscous(); - const bool energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); + const bool species_model = config->GetKind_Species_Model() != SPECIES_MODEL::NONE; string Marker_Tag = config->GetMarker_All_TagBound(val_marker); @@ -2537,13 +2532,12 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, V_inlet[prim_idx.Pressure()] = nodes->GetPressure(iPoint); } - /*-- Enthalpy is needed for energy equation in multicomponent and reacting flows. ---*/ - if (energy_multicomponent) { - CFluidModel* auxFluidModel = solver_container[FLOW_SOL]->GetFluidModel(); - const su2double* scalar_inlet = config->GetInlet_SpeciesVal(config->GetMarker_All_TagBound(val_marker)); - auxFluidModel->SetTDState_T(V_inlet[prim_idx.Temperature()], scalar_inlet); - V_inlet[prim_idx.Enthalpy()] = auxFluidModel->GetEnthalpy(); - } + /*-- Enthalpy is needed for energy equation. ---*/ + const su2double* scalar_inlet = nullptr; + if (species_model) scalar_inlet = config->GetInlet_SpeciesVal(config->GetMarker_All_TagBound(val_marker)); + CFluidModel* auxFluidModel = solver_container[FLOW_SOL]->GetFluidModel(); + auxFluidModel->SetTDState_T(V_inlet[prim_idx.Temperature()], scalar_inlet); + V_inlet[prim_idx.Enthalpy()] = auxFluidModel->GetEnthalpy(); /*--- Access density at the node. This is either constant by construction, or will be set fixed implicitly by the temperature @@ -2582,7 +2576,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Viscous contribution, commented out because serious convergence problems ---*/ - if (!viscous || energy_multicomponent) continue; + if (!viscous || species_model) continue; /*--- Set transport properties at the inlet ---*/ @@ -2634,7 +2628,7 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool viscous = config->GetViscous(); - const bool energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); + const bool species_model = config->GetKind_Species_Model() != SPECIES_MODEL::NONE; string Marker_Tag = config->GetMarker_All_TagBound(val_marker); su2double Normal[MAXNDIM] = {0.0}; @@ -2761,14 +2755,12 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, V_outlet[prim_idx.CpTotal()] = nodes->GetSpecificHeatCp(iPoint); - /*-- Enthalpy is needed for energy equation in multicomponent and reacting flows. ---*/ - if (energy_multicomponent) { - CFluidModel* auxFluidModel = solver_container[FLOW_SOL]->GetFluidModel();; - const su2double* scalar_outlet = solver_container[SPECIES_SOL]->GetNodes()->GetSolution(iPoint); - auxFluidModel->SetTDState_T(nodes->GetTemperature(iPoint), - scalar_outlet); // compute total enthalpy from temperature - V_outlet[prim_idx.Enthalpy()] = auxFluidModel->GetEnthalpy(); - } + /*-- Enthalpy is needed for energy equation. ---*/ + const su2double* scalar_outlet = nullptr; + if (species_model) scalar_outlet = solver_container[SPECIES_SOL]->GetNodes()->GetSolution(iPoint); + CFluidModel* auxFluidModel = solver_container[FLOW_SOL]->GetFluidModel(); + auxFluidModel->SetTDState_T(nodes->GetTemperature(iPoint), scalar_outlet); + V_outlet[prim_idx.Enthalpy()] = auxFluidModel->GetEnthalpy(); /*--- Set various quantities in the solver class ---*/ @@ -2794,7 +2786,7 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, /*--- Viscous contribution, commented out because serious convergence problems ---*/ - if (!viscous || energy_multicomponent) continue; + if (!viscous || species_model) continue; /*--- Set transport properties at the outlet. ---*/ diff --git a/SU2_CFD/src/variables/CIncNSVariable.cpp b/SU2_CFD/src/variables/CIncNSVariable.cpp index d2e490c83acb..efe0bdc6dfc9 100644 --- a/SU2_CFD/src/variables/CIncNSVariable.cpp +++ b/SU2_CFD/src/variables/CIncNSVariable.cpp @@ -146,7 +146,7 @@ bool CIncNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2do SetSpecificHeatCp(iPoint, FluidModel->GetCp()); SetSpecificHeatCv(iPoint, FluidModel->GetCv()); - if (Energy_Multicomponent) SetEnthalpy(iPoint, FluidModel->GetEnthalpy()); + SetEnthalpy(iPoint, FluidModel->GetEnthalpy()); return physical; From a0884d70cbf77789415aa24d65020d3436a6b9ce Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sat, 4 Oct 2025 13:21:51 +0200 Subject: [PATCH 49/97] fix error JST and BC IncEulerSolver --- SU2_CFD/src/numerics/flow/convection/centered.cpp | 1 + SU2_CFD/src/solvers/CIncEulerSolver.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/src/numerics/flow/convection/centered.cpp b/SU2_CFD/src/numerics/flow/convection/centered.cpp index 4d03c474b56e..881e18456559 100644 --- a/SU2_CFD/src/numerics/flow/convection/centered.cpp +++ b/SU2_CFD/src/numerics/flow/convection/centered.cpp @@ -336,6 +336,7 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi Temperature_i = V_i[nDim+1]; Temperature_j = V_j[nDim+1]; DensityInc_i = V_i[nDim+2]; DensityInc_j = V_j[nDim+2]; BetaInc2_i = V_i[nDim+3]; BetaInc2_j = V_j[nDim+3]; + Cp_i = V_i[nDim+7]; Cp_j = V_j[nDim+7]; Enthalpy_i = V_i[nDim+9]; Enthalpy_j = V_j[nDim+9]; if (energy_multicomponent) { WorkingVariable_i = Enthalpy_i; diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index ab25638ed874..810fe463a918 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -2128,7 +2128,7 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo law, but in the future, dRhodT should be in the fluid model. ---*/ if (variable_density) { - if (multicomponent){ + if (multicomponent && energy){ dRhodT = -Density / (Cp * Temperature); Cp = oneOverCp = 1.0; } else { @@ -2226,6 +2226,7 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain const bool implicit = config->GetKind_TimeIntScheme() == EULER_IMPLICIT; const bool viscous = config->GetViscous(); + const bool energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); const bool species_model = config->GetKind_Species_Model() != SPECIES_MODEL::NONE; su2double Normal[MAXNDIM] = {0.0}; @@ -2313,7 +2314,7 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain /*--- Viscous residual contribution ---*/ - if (!viscous || species_model) continue; + if (!viscous || energy_multicomponent) continue; /*--- Set transport properties at infinity. ---*/ @@ -2368,6 +2369,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool viscous = config->GetViscous(); + const bool energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); const bool species_model = config->GetKind_Species_Model() != SPECIES_MODEL::NONE; string Marker_Tag = config->GetMarker_All_TagBound(val_marker); @@ -2576,7 +2578,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Viscous contribution, commented out because serious convergence problems ---*/ - if (!viscous || species_model) continue; + if (!viscous || energy_multicomponent) continue; /*--- Set transport properties at the inlet ---*/ @@ -2628,6 +2630,7 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool viscous = config->GetViscous(); + const bool energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); const bool species_model = config->GetKind_Species_Model() != SPECIES_MODEL::NONE; string Marker_Tag = config->GetMarker_All_TagBound(val_marker); @@ -2786,7 +2789,7 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, /*--- Viscous contribution, commented out because serious convergence problems ---*/ - if (!viscous || species_model) continue; + if (!viscous || energy_multicomponent) continue; /*--- Set transport properties at the outlet. ---*/ From 807667f661a279ad4d45b2a7c1c238818885a8bc Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Mon, 6 Oct 2025 11:00:11 +0200 Subject: [PATCH 50/97] using GetFluidModel in CIncEulerSolver --- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index 810fe463a918..730d565ee616 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -168,11 +168,10 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned Pressure_Inf = config->GetPressure_FreeStreamND(); Velocity_Inf = config->GetVelocity_FreeStreamND(); Temperature_Inf = config->GetTemperature_FreeStreamND(); - if (energy_multicomponent){ - CFluidModel *auxFluidModel = new CFluidScalar(config->GetPressure_Thermodynamic(), config); - const su2double *scalar_init = config->GetSpecies_Init(); - auxFluidModel->SetTDState_T(Temperature_Inf,scalar_init); // compute total enthalpy from temperature - Enthalpy_Inf = auxFluidModel->GetEnthalpy(); + if (energy_multicomponent) { + const su2double* scalar_init = config->GetSpecies_Init(); + GetFluidModel()->SetTDState_T(Temperature_Inf, scalar_init); + Enthalpy_Inf = GetFluidModel()->GetEnthalpy(); } /*--- Initialize the secondary values for direct derivative approxiations ---*/ From 5477a0551134e573ca00a2301a863ff0f323d9ac Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Tue, 7 Oct 2025 16:16:50 +0200 Subject: [PATCH 51/97] making enthalpy the working variable --- SU2_CFD/include/fluid/CConstantDensity.hpp | 5 + SU2_CFD/include/fluid/CFluidFlamelet.hpp | 7 ++ SU2_CFD/include/fluid/CIncIdealGas.hpp | 6 ++ .../include/fluid/CIncIdealGasPolynomial.hpp | 14 +++ SU2_CFD/include/numerics/CNumerics.hpp | 18 ++-- .../numerics/flow/convection/centered.hpp | 10 +- .../include/numerics/flow/convection/fds.hpp | 4 +- SU2_CFD/include/output/CAdjFlowIncOutput.hpp | 1 - .../include/variables/CIncEulerVariable.hpp | 18 ++-- SU2_CFD/include/variables/CIncNSVariable.hpp | 1 - SU2_CFD/src/fluid/CFluidFlamelet.cpp | 4 + SU2_CFD/src/numerics/CNumerics.cpp | 40 ++++--- .../src/numerics/flow/convection/centered.cpp | 62 +++-------- SU2_CFD/src/numerics/flow/convection/fds.cpp | 37 +++---- SU2_CFD/src/numerics/flow/flow_diffusion.cpp | 25 ++--- SU2_CFD/src/numerics/flow/flow_sources.cpp | 21 ++-- SU2_CFD/src/output/CAdjFlowIncOutput.cpp | 102 +++++------------- SU2_CFD/src/output/CFlowIncOutput.cpp | 52 +++------ SU2_CFD/src/solvers/CIncEulerSolver.cpp | 75 ++++--------- SU2_CFD/src/solvers/CIncNSSolver.cpp | 64 +++-------- SU2_CFD/src/variables/CIncEulerVariable.cpp | 22 ++-- SU2_CFD/src/variables/CIncNSVariable.cpp | 53 ++------- 22 files changed, 218 insertions(+), 423 deletions(-) diff --git a/SU2_CFD/include/fluid/CConstantDensity.hpp b/SU2_CFD/include/fluid/CConstantDensity.hpp index 0a3371f87ebf..68163521465c 100644 --- a/SU2_CFD/include/fluid/CConstantDensity.hpp +++ b/SU2_CFD/include/fluid/CConstantDensity.hpp @@ -58,4 +58,9 @@ class CConstantDensity final : public CFluidModel { Temperature = t; Enthalpy = Cp * Temperature; } + + void SetTDState_h(const su2double val_enthalpy, const su2double* val_scalars) { + Enthalpy = val_enthalpy; + Temperature = Enthalpy / Cp; + } }; diff --git a/SU2_CFD/include/fluid/CFluidFlamelet.hpp b/SU2_CFD/include/fluid/CFluidFlamelet.hpp index 3c72eee242d9..0b94512d10d1 100644 --- a/SU2_CFD/include/fluid/CFluidFlamelet.hpp +++ b/SU2_CFD/include/fluid/CFluidFlamelet.hpp @@ -118,6 +118,13 @@ class CFluidFlamelet final : public CFluidModel { */ void SetTDState_T(su2double val_temperature, const su2double* val_scalars = nullptr) override; + /*! + * \brief Set the thermodynamic state. + * \param[in] val_enthalpy - enthalpy + * \param[in] val_scalars - pointer to species mass fractions + */ + void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) override; + /*! * \brief Evaluate data-set for flamelet simulations. * \param[in] input_scalar - controlling variables used to interpolate manifold. diff --git a/SU2_CFD/include/fluid/CIncIdealGas.hpp b/SU2_CFD/include/fluid/CIncIdealGas.hpp index cabc30f47ca2..9b976b09842f 100644 --- a/SU2_CFD/include/fluid/CIncIdealGas.hpp +++ b/SU2_CFD/include/fluid/CIncIdealGas.hpp @@ -61,6 +61,12 @@ class CIncIdealGas final : public CFluidModel { Enthalpy = Cp * Temperature; } + void SetTDState_h(const su2double val_enthalpy, const su2double* val_scalars) { + Enthalpy = val_enthalpy; + Temperature = Enthalpy / Cp; + Density = Pressure / (Temperature * Gas_Constant); + } + private: su2double Gas_Constant{0.0}; /*!< \brief Gas Constant. */ su2double Gamma{0.0}; /*!< \brief Heat Capacity Ratio. */ diff --git a/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp b/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp index a64f308df848..b4a034e98155 100644 --- a/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp +++ b/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp @@ -83,6 +83,20 @@ class CIncIdealGasPolynomial final : public CFluidModel { Enthalpy = Cp * Temperature; } + void SetTDState_h(const su2double val_enthalpy, const su2double* val_scalars) { + Enthalpy = val_enthalpy; + Temperature = Enthalpy / Cp; + Density = Pressure / (Temperature * Gas_Constant); + /* Evaluate the new Cp from the coefficients and temperature. */ + Cp = coeffs_[0]; + su2double t_i = 1.0; + for (int i = 1; i < N; ++i) { + t_i *= Temperature; + Cp += coeffs_[i] * t_i; + } + Cv = Cp / Gamma; + } + private: su2double Gas_Constant{0.0}; /*!< \brief Specific Gas Constant. */ su2double Gamma{0.0}; /*!< \brief Ratio of specific heats. */ diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 08d03ad33db5..3f0cdb0a7d84 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -191,7 +191,7 @@ class CNumerics { bool nemo; /*!< \brief Flag for NEMO problems */ - bool energy_multicomponent = false; /*!< \brief Flag for multicomponent and reacting flow */ + bool multicomponent = false; /*!< \brief Flag for multicomponent and reacting flow */ bool bounded_scalar = false; /*!< \brief Flag for bounded scalar problem */ @@ -1058,8 +1058,7 @@ class CNumerics { * \param[in] val_density - Value of the density. * \param[in] val_velocity - Pointer to the velocity. * \param[in] val_betainc2 - Value of the artificial compresibility factor. - * \param[in] val_cp - Value of the specific heat at constant pressure. - * \param[in] val_temperature - Value of the temperature. + * \param[in] val_enthalpy - Value of the enthalpy. * \param[in] val_dRhodT - Value of the derivative of density w.r.t. temperature. * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face. * \param[in] val_scale - Scale of the projection. @@ -1068,8 +1067,7 @@ class CNumerics { void GetInviscidIncProjJac(const su2double *val_density, const su2double *val_velocity, const su2double *val_betainc2, - const su2double *val_cp, - const su2double *val_temperature, + const su2double *val_enthalpy, const su2double *val_dRhodT, const su2double *val_normal, su2double val_scale, @@ -1080,17 +1078,15 @@ class CNumerics { * \param[in] val_density - Value of the density. * \param[in] val_velocity - Pointer to the velocity. * \param[in] val_betainc2 - Value of the artificial compresibility factor. - * \param[in] val_cp - Value of the specific heat at constant pressure. - * \param[in] val_temperature - Value of the temperature. - * \param[in] val_dRhodT - Value of the derivative of density w.r.t. temperature. + * \param[in] val_enthalpy - Value of the enthalpy. + * \param[in] val_dRhodh - Value of the derivative of density w.r.t. enthalpy. * \param[out] val_Precon - Pointer to the preconditioning matrix. */ void GetPreconditioner(const su2double *val_density, const su2double *val_velocity, const su2double *val_betainc2, - const su2double *val_cp, - const su2double *val_temperature, - const su2double *val_drhodt, + const su2double *val_enthalpy, + const su2double *val_drhodh, su2double **val_Precon) const; /*! diff --git a/SU2_CFD/include/numerics/flow/convection/centered.hpp b/SU2_CFD/include/numerics/flow/convection/centered.hpp index 8c2333edadf8..2573827e4278 100644 --- a/SU2_CFD/include/numerics/flow/convection/centered.hpp +++ b/SU2_CFD/include/numerics/flow/convection/centered.hpp @@ -48,9 +48,8 @@ class CCentLaxInc_Flow final : public CNumerics { Temperature_i, Temperature_j, /*!< \brief Temperature at node 0 and 1. */ MeanDensity, MeanPressure, MeanBetaInc2, MeanEnthalpy, - MeanCp, MeanTemperature, - MeanWorkingVar, /*!< \brief Mean values of primitive variables. */ - MeandRhodT, /*!< \brief Derivative of density w.r.t. temperature (variable density flows). */ + MeanCp, MeanTemperature, /*!< \brief Mean values of primitive variables. */ + MeandRhodh, /*!< \brief Derivative of density w.r.t. temperature (variable density flows). */ Param_p, Param_Kappa_0, /*!< \brief Artificial dissipation parameters. */ Local_Lambda_i, Local_Lambda_j, MeanLambda, /*!< \brief Local eingenvalues. */ @@ -109,9 +108,8 @@ class CCentJSTInc_Flow final : public CNumerics { Temperature_i, Temperature_j, /*!< \brief Temperature at node 0 and 1. */ MeanDensity, MeanPressure, MeanBetaInc2, MeanEnthalpy, - MeanCp, MeanTemperature, - MeanWorkingVar, /*!< \brief Mean values of primitive variables. */ - MeandRhodT, /*!< \brief Derivative of density w.r.t. temperature (variable density flows). */ + MeanCp, MeanTemperature, /*!< \brief Mean values of primitive variables. */ + MeandRhodh, /*!< \brief Derivative of density w.r.t. temperature (variable density flows). */ Param_p, Param_Kappa_2, Param_Kappa_4, /*!< \brief Artificial dissipation parameters. */ Local_Lambda_i, Local_Lambda_j, diff --git a/SU2_CFD/include/numerics/flow/convection/fds.hpp b/SU2_CFD/include/numerics/flow/convection/fds.hpp index 9b4e36b1a636..a1f3a0d970d2 100644 --- a/SU2_CFD/include/numerics/flow/convection/fds.hpp +++ b/SU2_CFD/include/numerics/flow/convection/fds.hpp @@ -49,9 +49,9 @@ class CUpwFDSInc_Flow final : public CNumerics { su2double **Precon, **invPrecon_A; su2double Proj_ModJac_Tensor_ij, Pressure_i, Pressure_j, ProjVelocity, - MeandRhodT, dRhodT_i, dRhodT_j, /*!< \brief Derivative of density w.r.t. temperature (variable density flows). */ + MeandRhodh, dRhodh_i, dRhodh_j, /*!< \brief Derivative of density w.r.t. enthalpy (variable density flows). */ Temperature_i, Temperature_j, /*!< \brief Temperature at node 0 and 1. */ - MeanDensity, MeanPressure, MeanSoundSpeed, MeanBetaInc2, MeanWorkingVar, MeanCp, MeanTemperature; /*!< \brief Mean values of primitive variables. */ + MeanDensity, MeanPressure, MeanSoundSpeed, MeanBetaInc2, MeanEnthalpy, MeanCp, MeanTemperature; /*!< \brief Mean values of primitive variables. */ unsigned short iDim, iVar, jVar, kVar; su2double* Flux = nullptr; /*!< \brief The flux / residual across the edge. */ diff --git a/SU2_CFD/include/output/CAdjFlowIncOutput.hpp b/SU2_CFD/include/output/CAdjFlowIncOutput.hpp index dec6a2b8961c..e1f8b2ec15fe 100644 --- a/SU2_CFD/include/output/CAdjFlowIncOutput.hpp +++ b/SU2_CFD/include/output/CAdjFlowIncOutput.hpp @@ -40,7 +40,6 @@ class CAdjFlowIncOutput final: public CAdjFlowOutput { RADIATION_MODEL rad_model; /*!< \brief The kind of radiation model */ bool heat; /*!< \brief Boolean indicating whether have a heat problem*/ bool weakly_coupled_heat; /*!< \brief Boolean indicating whether have a weakly coupled heat equation*/ - bool multicomponent; /*!< \brief Boolean indicating whether have a multicomponent problem*/ public: diff --git a/SU2_CFD/include/variables/CIncEulerVariable.hpp b/SU2_CFD/include/variables/CIncEulerVariable.hpp index 3d9136d1e64e..c257a8b2a94a 100644 --- a/SU2_CFD/include/variables/CIncEulerVariable.hpp +++ b/SU2_CFD/include/variables/CIncEulerVariable.hpp @@ -33,8 +33,8 @@ /*! * \class CIncEulerVariable * \brief Class for defining the variables of the incompressible Euler solver. - * \note Primitive variables (P, vx, vy, vz, T, rho, beta, lamMu, EddyMu, Kt_eff, Cp, Cv) - * \note Gradients of primitives (P, vx, vy, vz, T, rho, beta) + * \note Primitive variables (P, vx, vy, vz, T, rho,h, beta, lamMu, EddyMu, Kt_eff, Cp, Cv) + * \note Gradients of primitives (P, vx, vy, vz, T, rho, h) * \ingroup Euler_Equations * \author F. Palacios, T. Economon, T. Albring */ @@ -52,14 +52,14 @@ class CIncEulerVariable : public CFlowVariable { inline IndexType Velocity() const { return 1; } inline IndexType Temperature() const { return nDim+1; } inline IndexType Density() const { return nDim+2; } - inline IndexType Beta() const { return nDim+3; } + inline IndexType Enthalpy() const { return nDim+3; } + inline IndexType Beta() const { return nDim+4; } inline IndexType SoundSpeed() const { return Beta(); } - inline IndexType LaminarViscosity() const { return nDim+4; } - inline IndexType EddyViscosity() const { return nDim+5; } - inline IndexType ThermalConductivity() const { return nDim+6; } - inline IndexType CpTotal() const { return nDim+7; } - inline IndexType CvTotal() const { return nDim+8; } - inline IndexType Enthalpy() const { return nDim + 9; } + inline IndexType LaminarViscosity() const { return nDim+5; } + inline IndexType EddyViscosity() const { return nDim+6; } + inline IndexType ThermalConductivity() const { return nDim+7; } + inline IndexType CpTotal() const { return nDim+8; } + inline IndexType CvTotal() const { return nDim+9; } /*--- For compatible interface with NEMO. ---*/ inline IndexType SpeciesDensities() const { return std::numeric_limits::max(); } diff --git a/SU2_CFD/include/variables/CIncNSVariable.hpp b/SU2_CFD/include/variables/CIncNSVariable.hpp index 44eee3c6c3b1..5e254506b84f 100644 --- a/SU2_CFD/include/variables/CIncNSVariable.hpp +++ b/SU2_CFD/include/variables/CIncNSVariable.hpp @@ -40,7 +40,6 @@ class CIncNSVariable final : public CIncEulerVariable { private: VectorType Tau_Wall; /*!< \brief Magnitude of the wall shear stress from a wall function. */ VectorType DES_LengthScale; - bool Energy_Multicomponent = false; public: /*! diff --git a/SU2_CFD/src/fluid/CFluidFlamelet.cpp b/SU2_CFD/src/fluid/CFluidFlamelet.cpp index 7cc1692fd5a4..91c6fd985776 100644 --- a/SU2_CFD/src/fluid/CFluidFlamelet.cpp +++ b/SU2_CFD/src/fluid/CFluidFlamelet.cpp @@ -117,6 +117,10 @@ CFluidFlamelet::~CFluidFlamelet() { #endif } +void CFluidFlamelet::SetTDState_h(su2double val_enthalpy, const su2double* val_scalars) { + SetTDState_T(val_enthalpy, val_scalars); +} + void CFluidFlamelet::SetTDState_T(su2double val_temperature, const su2double* val_scalars) { for (auto iVar = 0u; iVar < n_scalars; iVar++) scalars_vector[iVar] = val_scalars[iVar]; diff --git a/SU2_CFD/src/numerics/CNumerics.cpp b/SU2_CFD/src/numerics/CNumerics.cpp index f45a4a290522..3c9edd25b856 100644 --- a/SU2_CFD/src/numerics/CNumerics.cpp +++ b/SU2_CFD/src/numerics/CNumerics.cpp @@ -53,7 +53,7 @@ CNumerics::CNumerics(unsigned short val_nDim, unsigned short val_nVar, Gamma_Minus_One = Gamma - 1.0; Prandtl_Turb = config->GetPrandtl_Turb(); Gas_Constant = config->GetGas_ConstantND(); - energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); + multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE; tau = new su2double* [nDim]; for (iDim = 0; iDim < nDim; iDim++) @@ -249,10 +249,9 @@ void CNumerics::GetInviscidProjJac(const su2double *val_velocity, const su2doubl } void CNumerics::GetInviscidIncProjJac(const su2double *val_density, const su2double *val_velocity, - const su2double *val_betainc2, const su2double *val_cp, - const su2double *val_temperature, const su2double *val_dRhodT, - const su2double *val_normal, su2double val_scale, - su2double **val_Proj_Jac_Tensor) const { + const su2double *val_betainc2, const su2double *val_enthalpy, + const su2double *val_dRhodT, const su2double *val_normal, + su2double val_scale, su2double **val_Proj_Jac_Tensor) const { const bool wasActive = AD::BeginPassive(); unsigned short iDim; su2double proj_vel; @@ -278,10 +277,10 @@ void CNumerics::GetInviscidIncProjJac(const su2double *val_density, const su2dou val_Proj_Jac_Tensor[2][2] = val_scale*((*val_density)*(proj_vel + val_normal[1]*val_velocity[1])); val_Proj_Jac_Tensor[2][3] = val_scale*((*val_dRhodT)*val_velocity[1]*proj_vel); - val_Proj_Jac_Tensor[3][0] = val_scale*((*val_cp)*(*val_temperature)*proj_vel/(*val_betainc2)); - val_Proj_Jac_Tensor[3][1] = val_scale*((*val_cp)*(*val_temperature)*val_normal[0]*(*val_density)); - val_Proj_Jac_Tensor[3][2] = val_scale*((*val_cp)*(*val_temperature)*val_normal[1]*(*val_density)); - val_Proj_Jac_Tensor[3][3] = val_scale*((*val_cp)*((*val_temperature)*(*val_dRhodT) + (*val_density))*proj_vel); + val_Proj_Jac_Tensor[3][0] = val_scale*((*val_enthalpy)*proj_vel/(*val_betainc2)); + val_Proj_Jac_Tensor[3][1] = val_scale*((*val_enthalpy)*val_normal[0]*(*val_density)); + val_Proj_Jac_Tensor[3][2] = val_scale*((*val_enthalpy)*val_normal[1]*(*val_density)); + val_Proj_Jac_Tensor[3][3] = val_scale*(((*val_enthalpy)*(*val_dRhodT) + (*val_density))*proj_vel); } else { @@ -309,26 +308,25 @@ void CNumerics::GetInviscidIncProjJac(const su2double *val_density, const su2dou val_Proj_Jac_Tensor[3][3] = val_scale*((*val_density)*(proj_vel + val_normal[2]*val_velocity[2])); val_Proj_Jac_Tensor[3][4] = val_scale*((*val_dRhodT)*val_velocity[2]*proj_vel); - val_Proj_Jac_Tensor[4][0] = val_scale*((*val_cp)*(*val_temperature)*proj_vel/(*val_betainc2)); - val_Proj_Jac_Tensor[4][1] = val_scale*((*val_cp)*(*val_temperature)*val_normal[0]*(*val_density)); - val_Proj_Jac_Tensor[4][2] = val_scale*((*val_cp)*(*val_temperature)*val_normal[1]*(*val_density)); - val_Proj_Jac_Tensor[4][3] = val_scale*((*val_cp)*(*val_temperature)*val_normal[2]*(*val_density)); - val_Proj_Jac_Tensor[4][4] = val_scale*((*val_cp)*((*val_temperature)*(*val_dRhodT) + (*val_density))*proj_vel); + val_Proj_Jac_Tensor[4][0] = val_scale*((*val_enthalpy)*proj_vel/(*val_betainc2)); + val_Proj_Jac_Tensor[4][1] = val_scale*((*val_enthalpy)*val_normal[0]*(*val_density)); + val_Proj_Jac_Tensor[4][2] = val_scale*((*val_enthalpy)*val_normal[1]*(*val_density)); + val_Proj_Jac_Tensor[4][3] = val_scale*((*val_enthalpy)*val_normal[2]*(*val_density)); + val_Proj_Jac_Tensor[4][4] = val_scale*(((*val_enthalpy)*(*val_dRhodT) + (*val_density))*proj_vel); } AD::EndPassive(wasActive); } void CNumerics::GetPreconditioner(const su2double *val_density, const su2double *val_velocity, - const su2double *val_betainc2, const su2double *val_cp, - const su2double *val_temperature, const su2double *val_drhodt, - su2double **val_Precon) const { + const su2double *val_betainc2, const su2double *val_enthalpy, + const su2double *val_drhodh, su2double **val_Precon) const { unsigned short iDim, jDim; val_Precon[0][0] = 1.0/(*val_betainc2); for (iDim = 0; iDim < nDim; iDim++) val_Precon[iDim+1][0] = val_velocity[iDim]/(*val_betainc2); - val_Precon[nDim+1][0] = (*val_cp)*(*val_temperature)/(*val_betainc2); + val_Precon[nDim+1][0] = *val_enthalpy /(*val_betainc2); for (jDim = 0; jDim < nDim; jDim++) { val_Precon[0][jDim+1] = 0.0; @@ -339,10 +337,10 @@ void CNumerics::GetPreconditioner(const su2double *val_density, const su2double val_Precon[nDim+1][jDim+1] = 0.0; } - val_Precon[0][nDim+1] = (*val_drhodt); + val_Precon[0][nDim+1] = (*val_drhodh); for (iDim = 0; iDim < nDim; iDim++) - val_Precon[iDim+1][nDim+1] = val_velocity[iDim]*(*val_drhodt); - val_Precon[nDim+1][nDim+1] = (*val_cp)*((*val_drhodt)*(*val_temperature) + (*val_density)); + val_Precon[iDim+1][nDim+1] = val_velocity[iDim]*(*val_drhodh); + val_Precon[nDim+1][nDim+1] = (*val_drhodh)*(*val_enthalpy) + (*val_density); } diff --git a/SU2_CFD/src/numerics/flow/convection/centered.cpp b/SU2_CFD/src/numerics/flow/convection/centered.cpp index 881e18456559..f8c1ddc602ad 100644 --- a/SU2_CFD/src/numerics/flow/convection/centered.cpp +++ b/SU2_CFD/src/numerics/flow/convection/centered.cpp @@ -89,23 +89,15 @@ CNumerics::ResidualType<> CCentLaxInc_Flow::ComputeResidual(const CConfig* confi su2double U_i[5] = {0.0}, U_j[5] = {0.0}; su2double ProjGridVel = 0.0, ProjVelocity = 0.0; - su2double WorkingVariable_i, WorkingVariable_j; /*--- Primitive variables at point i and j ---*/ Pressure_i = V_i[0]; Pressure_j = V_j[0]; Temperature_i = V_i[nDim+1]; Temperature_j = V_j[nDim+1]; DensityInc_i = V_i[nDim+2]; DensityInc_j = V_j[nDim+2]; - BetaInc2_i = V_i[nDim+3]; BetaInc2_j = V_j[nDim+3]; - Cp_i = V_i[nDim+7]; Cp_j = V_j[nDim+7]; - Enthalpy_i = V_i[nDim + 9]; Enthalpy_j = V_j[nDim + 9]; - if (energy_multicomponent) { - WorkingVariable_i = Enthalpy_i; - WorkingVariable_j = Enthalpy_j; - } else { - WorkingVariable_i = Temperature_i; - WorkingVariable_j = Temperature_j; - } + BetaInc2_i = V_i[nDim+4]; BetaInc2_j = V_j[nDim+4]; + Cp_i = V_i[nDim+8]; Cp_j = V_j[nDim+8]; + Enthalpy_i = V_i[nDim+3]; Enthalpy_j = V_j[nDim+3]; Area = 0.0; sq_vel_i = 0.0; sq_vel_j = 0.0; ProjVelocity_i = 0.0; ProjVelocity_j = 0.0; @@ -129,18 +121,14 @@ CNumerics::ResidualType<> CCentLaxInc_Flow::ComputeResidual(const CConfig* confi MeanEnthalpy = 0.5*(Enthalpy_i + Enthalpy_j); MeanCp = 0.5*(Cp_i + Cp_j); MeanTemperature = 0.5*(Temperature_i + Temperature_j); - MeanWorkingVar = 0.5*(WorkingVariable_i + WorkingVariable_j); /*--- We need the derivative of the equation of state to build the preconditioning matrix. For now, the only option is the ideal gas law, but in the future, dRhodT should be in the fluid model. ---*/ - MeandRhodT = 0.0; + MeandRhodh = 0.0; if (variable_density) { - MeandRhodT = -MeanDensity/MeanTemperature; - } - if (energy_multicomponent) { - MeandRhodT /= MeanCp ; + MeandRhodh = -MeanDensity/(MeanTemperature * MeanCp); MeanCp = 1.0; Cp_i = 1.0; Cp_j = 1.0; @@ -153,7 +141,7 @@ CNumerics::ResidualType<> CCentLaxInc_Flow::ComputeResidual(const CConfig* confi /*--- Jacobians of the inviscid flux ---*/ if (implicit) { - GetInviscidIncProjJac(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanWorkingVar, &MeandRhodT, Normal, 0.5, Jacobian_i); + GetInviscidIncProjJac(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanEnthalpy, &MeandRhodh, Normal, 0.5, Jacobian_i); for (iVar = 0; iVar < nVar; iVar++) { for (jVar = 0; jVar < nVar; jVar++) { Jacobian_j[iVar][jVar] = Jacobian_i[iVar][jVar]; @@ -196,11 +184,11 @@ CNumerics::ResidualType<> CCentLaxInc_Flow::ComputeResidual(const CConfig* confi for (iVar = 0; iVar < nVar - 1; iVar++) Diff_V[iVar] = V_i[iVar]-V_j[iVar]; - Diff_V[nVar - 1] = WorkingVariable_i - WorkingVariable_j; + Diff_V[nVar - 1] = Enthalpy_i - Enthalpy_j; /*--- Build the preconditioning matrix using mean values ---*/ - GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanWorkingVar, &MeandRhodT, Precon); + GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanEnthalpy, &MeandRhodh, Precon); /*--- Compute the local espectral radius of the preconditioned system and the stretching factor. ---*/ @@ -328,23 +316,15 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi su2double U_i[5] = {0.0}, U_j[5] = {0.0}; su2double ProjGridVel = 0.0; - su2double WorkingVariable_i, WorkingVariable_j; /*--- Primitive variables at point i and j ---*/ Pressure_i = V_i[0]; Pressure_j = V_j[0]; Temperature_i = V_i[nDim+1]; Temperature_j = V_j[nDim+1]; DensityInc_i = V_i[nDim+2]; DensityInc_j = V_j[nDim+2]; - BetaInc2_i = V_i[nDim+3]; BetaInc2_j = V_j[nDim+3]; - Cp_i = V_i[nDim+7]; Cp_j = V_j[nDim+7]; - Enthalpy_i = V_i[nDim+9]; Enthalpy_j = V_j[nDim+9]; - if (energy_multicomponent) { - WorkingVariable_i = Enthalpy_i; - WorkingVariable_j = Enthalpy_j; - } else { - WorkingVariable_i = Temperature_i; - WorkingVariable_j = Temperature_j; - } + BetaInc2_i = V_i[nDim+4]; BetaInc2_j = V_j[nDim+4]; + Cp_i = V_i[nDim+8]; Cp_j = V_j[nDim+8]; + Enthalpy_i = V_i[nDim+3]; Enthalpy_j = V_j[nDim+3]; Area = 0.0; sq_vel_i = 0.0; sq_vel_j = 0.0; ProjVelocity_i = 0.0; ProjVelocity_j = 0.0; @@ -366,7 +346,6 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi MeanPressure = 0.5*(Pressure_i + Pressure_j); MeanBetaInc2 = 0.5*(BetaInc2_i + BetaInc2_j); MeanEnthalpy = 0.5*(Enthalpy_i + Enthalpy_j); - MeanWorkingVar = 0.5*(WorkingVariable_i + WorkingVariable_j); MeanCp = 0.5*(Cp_i + Cp_j); MeanTemperature = 0.5*(Temperature_i + Temperature_j); @@ -374,12 +353,9 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi preconditioning matrix. For now, the only option is the ideal gas law, but in the future, dRhodT should be in the fluid model. ---*/ - MeandRhodT = 0.0; + MeandRhodh = 0.0; if (variable_density) { - MeandRhodT = -MeanDensity/MeanTemperature; - } - if (energy_multicomponent) { - MeandRhodT /= MeanCp ; + MeandRhodh = -MeanDensity/(MeanTemperature*MeanCp); MeanCp = 1.0; Cp_i = 1.0; Cp_j = 1.0; @@ -392,7 +368,7 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi /*--- Jacobians of the inviscid flux ---*/ if (implicit) { - GetInviscidIncProjJac(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanWorkingVar, &MeandRhodT, Normal, 0.5, Jacobian_i); + GetInviscidIncProjJac(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanEnthalpy, &MeandRhodh, Normal, 0.5, Jacobian_i); for (iVar = 0; iVar < nVar; iVar++) { for (jVar = 0; jVar < nVar; jVar++) { Jacobian_j[iVar][jVar] = Jacobian_i[iVar][jVar]; @@ -434,19 +410,15 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi /*--- Computes differences between Laplacians and conservative variables ---*/ - for (iVar = 0; iVar < nVar; iVar++) { + for (iVar = 0; iVar < nVar - 1; iVar++) { Diff_Lapl[iVar] = Und_Lapl_i[iVar]-Und_Lapl_j[iVar]; - if (iVar == nVar - 1) { - Diff_V[iVar] = WorkingVariable_i - WorkingVariable_j; - } else { - Diff_V[iVar] = V_i[iVar] - V_j[iVar]; - } } + Diff_V[nVar - 1] = Enthalpy_i - Enthalpy_j; /*--- Build the preconditioning matrix using mean values ---*/ - GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanWorkingVar, &MeandRhodT, Precon); + GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanEnthalpy, &MeandRhodh, Precon); /*--- Compute the local spectral radius of the preconditioned system and the stretching factor. ---*/ diff --git a/SU2_CFD/src/numerics/flow/convection/fds.cpp b/SU2_CFD/src/numerics/flow/convection/fds.cpp index 3ed67448e082..fb95ee48b1fb 100644 --- a/SU2_CFD/src/numerics/flow/convection/fds.cpp +++ b/SU2_CFD/src/numerics/flow/convection/fds.cpp @@ -92,7 +92,6 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config su2double U_i[5] = {0.0,0.0,0.0,0.0,0.0}, U_j[5] = {0.0,0.0,0.0,0.0,0.0}; su2double ProjGridVel = 0.0; - su2double WorkingVariable_i, WorkingVariable_j; AD::StartPreacc(); AD::SetPreaccIn(V_i, nDim+10); AD::SetPreaccIn(V_j, nDim+10); AD::SetPreaccIn(Normal, nDim); @@ -117,16 +116,9 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config Pressure_i = V_i[0]; Pressure_j = V_j[0]; Temperature_i = V_i[nDim+1]; Temperature_j = V_j[nDim+1]; DensityInc_i = V_i[nDim+2]; DensityInc_j = V_j[nDim+2]; - BetaInc2_i = V_i[nDim+3]; BetaInc2_j = V_j[nDim+3]; - Cp_i = V_i[nDim+7]; Cp_j = V_j[nDim+7]; - Enthalpy_i = V_i[nDim+9]; Enthalpy_j = V_j[nDim+9]; - if (energy_multicomponent) { - WorkingVariable_i = Enthalpy_i; - WorkingVariable_j = Enthalpy_j; - } else { - WorkingVariable_i = Temperature_i; - WorkingVariable_j = Temperature_j; - } + BetaInc2_i = V_i[nDim+4]; BetaInc2_j = V_j[nDim+4]; + Cp_i = V_i[nDim+8]; Cp_j = V_j[nDim+8]; + Enthalpy_i = V_i[nDim+3]; Enthalpy_j = V_j[nDim+3]; ProjVelocity = 0.0; for (iDim = 0; iDim < nDim; iDim++) { @@ -151,7 +143,7 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config MeanDensity = 0.5*(DensityInc_i + DensityInc_j); MeanPressure = 0.5*(Pressure_i + Pressure_j); MeanBetaInc2 = 0.5*(BetaInc2_i + BetaInc2_j); - MeanWorkingVar = 0.5*(WorkingVariable_i + WorkingVariable_j); + MeanEnthalpy = 0.5*(Enthalpy_i + Enthalpy_j); MeanCp = 0.5*(Cp_i + Cp_j); MeanTemperature = 0.5*(Temperature_i + Temperature_j); @@ -163,16 +155,11 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config preconditioning matrix. For now, the only option is the ideal gas law, but in the future, dRhodT should be in the fluid model. ---*/ - MeandRhodT = 0.0; dRhodT_i = 0.0; dRhodT_j = 0.0; + MeandRhodh = 0.0; dRhodh_i = 0.0; dRhodh_j = 0.0; if (variable_density) { - MeandRhodT = -MeanDensity / MeanTemperature; - dRhodT_i = -DensityInc_i / Temperature_i; - dRhodT_j = -DensityInc_j / Temperature_j; - } - if (energy_multicomponent) { - MeandRhodT /= MeanCp ; - dRhodT_i /= Cp_i; - dRhodT_j /= Cp_j; + MeandRhodh = -MeanDensity / (MeanTemperature * MeanCp); + dRhodh_i = -DensityInc_i / (Temperature_i * Cp_i); + dRhodh_j = -DensityInc_j / (Temperature_j * Cp_j); MeanCp = 1.0; Cp_i = 1.0; Cp_j = 1.0; @@ -208,7 +195,7 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config Lambda[iVar] = fabs(Lambda[iVar]); /*--- Build the preconditioning matrix using mean values ---*/ - GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanCp, &MeanWorkingVar, &MeandRhodT, Precon); + GetPreconditioner(&MeanDensity, MeanVelocity, &MeanBetaInc2, &MeanEnthalpy, &MeandRhodh, Precon); /*--- Build the absolute value of the preconditioned Jacobian, i.e., |A_precon| = P x |Lambda| x inv(P), where P diagonalizes the matrix @@ -221,14 +208,14 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config Diff_V[0] = Pressure_j - Pressure_i; for (iDim = 0; iDim < nDim; iDim++) Diff_V[iDim+1] = Velocity_j[iDim] - Velocity_i[iDim]; - Diff_V[nDim + 1] = WorkingVariable_j - WorkingVariable_i; + Diff_V[nDim + 1] = Enthalpy_j - Enthalpy_i; /*--- Build the inviscid Jacobian w.r.t. the primitive variables ---*/ if (implicit) { - GetInviscidIncProjJac(&DensityInc_i, Velocity_i, &BetaInc2_i, &Cp_i, &WorkingVariable_i, &dRhodT_i, Normal, 0.5, + GetInviscidIncProjJac(&DensityInc_i, Velocity_i, &BetaInc2_i, &Enthalpy_i, &dRhodh_i, Normal, 0.5, Jacobian_i); - GetInviscidIncProjJac(&DensityInc_j, Velocity_j, &BetaInc2_j, &Cp_j, &WorkingVariable_j, &dRhodT_j, Normal, 0.5, + GetInviscidIncProjJac(&DensityInc_j, Velocity_j, &BetaInc2_j, &Enthalpy_j, &dRhodh_j, Normal, 0.5, Jacobian_j); } diff --git a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp index 5b3468e995a0..7fc226dca5d9 100644 --- a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp +++ b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp @@ -554,7 +554,7 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi AD::SetPreaccIn(turb_ke_i); AD::SetPreaccIn(turb_ke_j); AD::SetPreaccIn(TauWall_i); AD::SetPreaccIn(TauWall_j); AD::SetPreaccIn(Normal, nDim); - if (energy_multicomponent) { + if (multicomponent) { AD::SetPreaccIn(HeatFluxDiffusion); } @@ -584,9 +584,9 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi /*--- Density and transport properties ---*/ - Laminar_Viscosity_i = V_i[nDim+4]; Laminar_Viscosity_j = V_j[nDim+4]; - Eddy_Viscosity_i = V_i[nDim+5]; Eddy_Viscosity_j = V_j[nDim+5]; - Thermal_Conductivity_i = V_i[nDim+6]; Thermal_Conductivity_j = V_j[nDim+6]; + Laminar_Viscosity_i = V_i[nDim+5]; Laminar_Viscosity_j = V_j[nDim+5]; + Eddy_Viscosity_i = V_i[nDim+6]; Eddy_Viscosity_j = V_j[nDim+6]; + Thermal_Conductivity_i = V_i[nDim+7]; Thermal_Conductivity_j = V_j[nDim+7]; /*--- Mean transport properties ---*/ @@ -629,7 +629,7 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi GetViscousIncProjFlux(Mean_GradPrimVar, Normal, Mean_Thermal_Conductivity); - if (energy_multicomponent) { + if (multicomponent) { Proj_Flux_Tensor[nVar - 1] += HeatFluxDiffusion; } @@ -657,15 +657,12 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi proj_vector_ij += (Coord_j[iDim]-Coord_i[iDim])*Normal[iDim]; } proj_vector_ij = proj_vector_ij/dist_ij_2; - if (energy_multicomponent){ - Mean_Heat_Capacity = 0.5 * (V_i[nDim + 7] + V_j[nDim + 7]); - Jacobian_i[nDim + 1][nDim + 1] = - -(Mean_Thermal_Conductivity * proj_vector_ij + JacHeatFluxDiffusion) / Mean_Heat_Capacity; - Jacobian_j[nDim + 1][nDim + 1] = - (Mean_Thermal_Conductivity * proj_vector_ij + JacHeatFluxDiffusion) / Mean_Heat_Capacity; - } else { - Jacobian_i[nDim + 1][nDim + 1] = -Mean_Thermal_Conductivity * proj_vector_ij; - Jacobian_j[nDim + 1][nDim + 1] = Mean_Thermal_Conductivity * proj_vector_ij; + Mean_Heat_Capacity = 0.5 * (V_i[nDim + 8] + V_j[nDim + 8]); + Jacobian_i[nDim + 1][nDim + 1] = -Mean_Thermal_Conductivity * proj_vector_ij / Mean_Heat_Capacity; + Jacobian_j[nDim + 1][nDim + 1] = Mean_Thermal_Conductivity * proj_vector_ij / Mean_Heat_Capacity; + if (multicomponent){ + Jacobian_i[nDim + 1][nDim + 1] -= JacHeatFluxDiffusion / Mean_Heat_Capacity; + Jacobian_j[nDim + 1][nDim + 1] += JacHeatFluxDiffusion / Mean_Heat_Capacity; } } diff --git a/SU2_CFD/src/numerics/flow/flow_sources.cpp b/SU2_CFD/src/numerics/flow/flow_sources.cpp index 4004060861d0..06712e0a6953 100644 --- a/SU2_CFD/src/numerics/flow/flow_sources.cpp +++ b/SU2_CFD/src/numerics/flow/flow_sources.cpp @@ -259,12 +259,11 @@ CNumerics::ResidualType<> CSourceIncAxisymmetric_Flow::ComputeResidual(const CCo /*--- Set primitive variables at points iPoint. ---*/ - const su2double Temp_i = V_i[nDim+1]; Pressure_i = V_i[0]; DensityInc_i = V_i[nDim+2]; - BetaInc2_i = V_i[nDim+3]; - Cp_i = V_i[nDim+7]; - Enthalpy_i = V_i[nDim + 9]; + BetaInc2_i = V_i[nDim+4]; + Cp_i = V_i[nDim+8]; + Enthalpy_i = V_i[nDim+3]; for (iDim = 0; iDim < nDim; iDim++) Velocity_i[iDim] = V_i[iDim+1]; @@ -296,11 +295,7 @@ CNumerics::ResidualType<> CSourceIncAxisymmetric_Flow::ComputeResidual(const CCo jacobian[3][0] = 0.0; jacobian[3][1] = 0.0; jacobian[3][2] = Enthalpy_i; - if (multicomponent && energy) { - jacobian[3][3] = (1.0 - Enthalpy_i / (Cp_i * Temp_i)) * Velocity_i[1]; - } else { - jacobian[3][3] = Cp_i * Velocity_i[1]; - } + jacobian[3][3] = Velocity_i[1]; for (iVar=0; iVar < nVar; iVar++) for (jVar=0; jVar < nVar; jVar++) @@ -312,9 +307,9 @@ CNumerics::ResidualType<> CSourceIncAxisymmetric_Flow::ComputeResidual(const CCo if (viscous) { - Laminar_Viscosity_i = V_i[nDim+4]; - Eddy_Viscosity_i = V_i[nDim+5]; - Thermal_Conductivity_i = V_i[nDim+6]; + Laminar_Viscosity_i = V_i[nDim+5]; + Eddy_Viscosity_i = V_i[nDim+6]; + Thermal_Conductivity_i = V_i[nDim+7]; su2double total_viscosity; @@ -331,7 +326,7 @@ CNumerics::ResidualType<> CSourceIncAxisymmetric_Flow::ComputeResidual(const CCo yinv* yinv*2.0*total_viscosity*Velocity_i[1] - TWO3*AuxVar_Grad_i[0][1]); residual[3] -= Volume * yinv * Thermal_Conductivity_i * PrimVar_Grad_i[nDim + 1][1]; - if (multicomponent && energy) { + if (multicomponent) { residual[3] -= Volume * yinv * HeatFluxDiffusion; if (implicit) jacobian[3][3] -= Volume * yinv * JacHeatFluxDiffusion / Cp_i; } diff --git a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp index 3c87b3422dbe..41ef8a7319c5 100644 --- a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp @@ -37,8 +37,6 @@ CAdjFlowIncOutput::CAdjFlowIncOutput(CConfig *config, unsigned short nDim) : CAd weakly_coupled_heat = config->GetWeakly_Coupled_Heat(); - multicomponent = (config->GetKind_FluidModel() == FLUID_MIXTURE); - rad_model = config->GetKind_RadiationModel(); /*--- Set the default history fields if nothing is set in the config file ---*/ @@ -115,11 +113,7 @@ void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config) { } /// DESCRIPTION: Maximum residual of the temperature. if (heat || weakly_coupled_heat) { - if (multicomponent){ - AddHistoryOutput("RMS_ADJ_ENTHALPY", "rms[A_h]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the enthalpy.", HistoryFieldType::RESIDUAL); - } else { - AddHistoryOutput("RMS_ADJ_TEMPERATURE", "rms[A_T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint temperature.", HistoryFieldType::RESIDUAL); - } + AddHistoryOutput("RMS_ADJ_ENTHALPY", "rms[A_h]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the enthalpy.", HistoryFieldType::RESIDUAL); } if (config->GetKind_Streamwise_Periodic() == ENUM_STREAMWISE_PERIODIC::MASSFLOW) { @@ -147,11 +141,7 @@ void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config) { } /// DESCRIPTION: Maximum residual of the temperature. if (heat || weakly_coupled_heat) { - if (multicomponent) { - AddHistoryOutput("MAX_ADJ_ENTHALPY", "max[A_h]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the enthalpy.", HistoryFieldType::RESIDUAL); - } else { - AddHistoryOutput("MAX_ADJ_TEMPERATURE", "max[A_T]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the temperature.", HistoryFieldType::RESIDUAL); - } + AddHistoryOutput("MAX_ADJ_ENTHALPY", "max[A_h]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the enthalpy.", HistoryFieldType::RESIDUAL); } AddHistoryOutputFields_AdjScalarMAX_RES(config); @@ -223,17 +213,10 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS SetHistoryOutputValue("RMS_ADJ_TEMPERATURE", log10(adjheat_solver->GetRes_RMS(0))); } if (heat) { - if (multicomponent) { - if (nDim == 3) - SetHistoryOutputValue("RMS_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_RMS(4))); - else - SetHistoryOutputValue("RMS_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_RMS(3))); - } else { - if (nDim == 3) - SetHistoryOutputValue("RMS_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_RMS(4))); - else - SetHistoryOutputValue("RMS_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_RMS(3))); - } + if (nDim == 3) + SetHistoryOutputValue("RMS_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_RMS(4))); + else + SetHistoryOutputValue("RMS_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_RMS(3))); } if (config->AddRadiation()) { @@ -254,17 +237,10 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS SetHistoryOutputValue("MAX_ADJ_TEMPERATURE", log10(adjheat_solver->GetRes_Max(0))); } if (heat) { - if (multicomponent) { - if (nDim == 3) - SetHistoryOutputValue("MAX_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_Max(4))); - else - SetHistoryOutputValue("MAX_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_Max(3))); - } else { - if (nDim == 3) - SetHistoryOutputValue("MAX_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_Max(4))); - else - SetHistoryOutputValue("MAX_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_Max(3))); - } + if (nDim == 3) + SetHistoryOutputValue("MAX_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_Max(4))); + else + SetHistoryOutputValue("MAX_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_Max(3))); } if (multiZone) { @@ -278,17 +254,10 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS SetHistoryOutputValue("BGS_ADJ_TEMPERATURE", log10(adjheat_solver->GetRes_BGS(0))); } if (heat) { - if (multicomponent) { - if (nDim == 3) - SetHistoryOutputValue("BGS_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_BGS(4))); - else - SetHistoryOutputValue("BGS_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_BGS(3))); - } else { - if (nDim == 3) - SetHistoryOutputValue("BGS_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_BGS(4))); - else - SetHistoryOutputValue("BGS_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_BGS(3))); - } + if (nDim == 3) + SetHistoryOutputValue("BGS_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_BGS(4))); + else + SetHistoryOutputValue("BGS_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_BGS(3))); } if (config->AddRadiation()) { @@ -335,11 +304,7 @@ void CAdjFlowIncOutput::SetVolumeOutputFields(CConfig *config) { /// DESCRIPTION: Adjoint Velocity z-component. AddVolumeOutput("ADJ_VELOCITY-Z", "Adjoint_Velocity_z", "SOLUTION", "z-component of the adjoint velocity vector"); } - if (multicomponent && heat) { - AddVolumeOutput("ADJ_ENTHALPY", "Adjoint_Enthalpy", "SOLUTION", "Adjoint_Enthalpy"); - } else { - AddVolumeOutput("ADJ_TEMPERATURE", "Adjoint_Temperature", "SOLUTION", "Adjoint temperature"); - } + AddVolumeOutput("ADJ_ENTHALPY", "Adjoint_Enthalpy", "SOLUTION", "Adjoint_Enthalpy"); SetVolumeOutputFieldsAdjScalarSolution(config); @@ -369,11 +334,8 @@ void CAdjFlowIncOutput::SetVolumeOutputFields(CConfig *config) { AddVolumeOutput("RES_ADJ_VELOCITY-Z", "Residual_Adjoint_Velocity_z", "RESIDUAL", "Residual of the adjoint z-velocity"); } /// DESCRIPTION: Residual of the adjoint energy. - if (multicomponent && heat) { - AddVolumeOutput("RES_ADJ_ENTHALPY", "Residual_Adjoint_Heat", "RESIDUAL", "Residual of the adjoint enthalpy"); - } else { - AddVolumeOutput("RES_ADJ_TEMPERATURE", "Residual_Adjoint_Heat", "RESIDUAL", "Residual of the adjoint temperature"); - } + + AddVolumeOutput("RES_ADJ_ENTHALPY", "Residual_Adjoint_Heat", "RESIDUAL", "Residual of the adjoint enthalpy"); SetVolumeOutputFieldsAdjScalarResidual(config); @@ -426,19 +388,11 @@ void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo if (weakly_coupled_heat) { SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjHeat->GetSolution(iPoint, 0)); - } - else { - if (multicomponent) { - if (nDim == 3) - SetVolumeOutputValue("ADJ_ENTHALPY", iPoint, Node_AdjFlow->GetSolution(iPoint, 4)); - else - SetVolumeOutputValue("ADJ_ENTHALPY", iPoint, Node_AdjFlow->GetSolution(iPoint, 3)); - } else { - if (nDim == 3) - SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 4)); - else - SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 3)); - } + } else { + if (nDim == 3) + SetVolumeOutputValue("ADJ_ENTHALPY", iPoint, Node_AdjFlow->GetSolution(iPoint, 4)); + else + SetVolumeOutputValue("ADJ_ENTHALPY", iPoint, Node_AdjFlow->GetSolution(iPoint, 3)); } // Radiation @@ -452,17 +406,9 @@ void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo SetVolumeOutputValue("RES_ADJ_VELOCITY-Y", iPoint, Node_AdjFlow->GetSolution(iPoint, 2) - Node_AdjFlow->GetSolution_Old(iPoint, 2)); if (nDim == 3) { SetVolumeOutputValue("RES_ADJ_VELOCITY-Z", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); - if (multicomponent) { - SetVolumeOutputValue("RES_ADJ_ENTHALPY", iPoint, Node_AdjFlow->GetSolution(iPoint, 4) - Node_AdjFlow->GetSolution_Old(iPoint, 4)); - } else { - SetVolumeOutputValue("RES_ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 4) - Node_AdjFlow->GetSolution_Old(iPoint, 4)); - } + SetVolumeOutputValue("RES_ADJ_ENTHALPY", iPoint, Node_AdjFlow->GetSolution(iPoint, 4) - Node_AdjFlow->GetSolution_Old(iPoint, 4)); } else { - if (multicomponent) { - SetVolumeOutputValue("RES_ADJ_ENTHALPY", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); - } else { - SetVolumeOutputValue("RES_ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); - } + SetVolumeOutputValue("RES_ADJ_ENTHALPY", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); } if (config->AddRadiation()) { diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index 1d1a49dbb727..9ce01f37cd14 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -37,8 +37,6 @@ CFlowIncOutput::CFlowIncOutput(CConfig *config, unsigned short nDim) : CFlowOutp heat = config->GetEnergy_Equation(); - multicomponent = (config->GetKind_FluidModel() == FLUID_MIXTURE); - weakly_coupled_heat = config->GetWeakly_Coupled_Heat(); flamelet = (config->GetKind_Species_Model() == SPECIES_MODEL::FLAMELET); @@ -111,11 +109,7 @@ void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ if (nDim == 3) AddHistoryOutput("RMS_VELOCITY-Z", "rms[W]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the velocity z-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the temperature. if (heat || weakly_coupled_heat){ - if (multicomponent){ - AddHistoryOutput("RMS_ENTHALPY", "rms[h]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the enthalpy.", HistoryFieldType::RESIDUAL); - } else { - AddHistoryOutput("RMS_TEMPERATURE", "rms[T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the temperature.", HistoryFieldType::RESIDUAL); - } + AddHistoryOutput("RMS_ENTHALPY", "rms[h]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the enthalpy.", HistoryFieldType::RESIDUAL); } AddHistoryOutputFields_ScalarRMS_RES(config); @@ -136,11 +130,7 @@ void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ AddHistoryOutput("MAX_VELOCITY-Z", "max[W]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the velocity z-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the temperature. if (heat || weakly_coupled_heat) { - if (multicomponent){ - AddHistoryOutput("MAX_ENTHALPY", "max[h]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the enthalpy.", HistoryFieldType::RESIDUAL); - } else { - AddHistoryOutput("MAX_TEMPERATURE", "max[T]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the temperature.", HistoryFieldType::RESIDUAL); - } + AddHistoryOutput("MAX_ENTHALPY", "max[h]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the enthalpy.", HistoryFieldType::RESIDUAL); } AddHistoryOutputFields_ScalarMAX_RES(config); @@ -158,11 +148,7 @@ void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ AddHistoryOutput("BGS_VELOCITY-Z", "bgs[W]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the velocity z-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the temperature. if (heat || weakly_coupled_heat) { - if (multicomponent){ - AddHistoryOutput("BGS_ENTHALPY", "bgs[h]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the enthalpy.", HistoryFieldType::RESIDUAL); - } else { - AddHistoryOutput("BGS_TEMPERATURE", "bgs[T]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the temperature.", HistoryFieldType::RESIDUAL); - } + AddHistoryOutput("BGS_ENTHALPY", "bgs[h]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the enthalpy.", HistoryFieldType::RESIDUAL); } AddHistoryOutputFields_ScalarBGS_RES(config); @@ -250,18 +236,10 @@ void CFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolv if (heat) { SetHeatCoefficients(config, flow_solver); SetHistoryOutputValue("AVG_TEMPERATURE", flow_solver->GetTotal_AvgTemperature()); - if (multicomponent){ - SetHistoryOutputValue("RMS_ENTHALPY", log10(flow_solver->GetRes_RMS(nDim + 1))); - SetHistoryOutputValue("MAX_ENTHALPY", log10(flow_solver->GetRes_Max(nDim + 1))); - if (multiZone) { - SetHistoryOutputValue("BGS_ENTHALPY", log10(flow_solver->GetRes_BGS(nDim + 1))); - } - } else { - SetHistoryOutputValue("RMS_TEMPERATURE", log10(flow_solver->GetRes_RMS(nDim + 1))); - SetHistoryOutputValue("MAX_TEMPERATURE", log10(flow_solver->GetRes_Max(nDim + 1))); - if (multiZone) { - SetHistoryOutputValue("BGS_TEMPERATURE", log10(flow_solver->GetRes_BGS(nDim + 1))); - } + SetHistoryOutputValue("RMS_ENTHALPY", log10(flow_solver->GetRes_RMS(nDim + 1))); + SetHistoryOutputValue("MAX_ENTHALPY", log10(flow_solver->GetRes_Max(nDim + 1))); + if (multiZone) { + SetHistoryOutputValue("BGS_ENTHALPY", log10(flow_solver->GetRes_BGS(nDim + 1))); } } @@ -322,8 +300,7 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ if (nDim == 3) AddVolumeOutput("VELOCITY-Z", "Velocity_z", "SOLUTION", "z-component of the velocity vector"); if (heat || weakly_coupled_heat || flamelet){ - if (multicomponent) AddVolumeOutput("ENTHALPY", "Enthalpy", "SOLUTION", "Enthalpy"); - else AddVolumeOutput("TEMPERATURE", "Temperature","SOLUTION", "Temperature"); + AddVolumeOutput("ENTHALPY", "Enthalpy", "SOLUTION", "Enthalpy"); } SetVolumeOutputFieldsScalarSolution(config); @@ -348,7 +325,7 @@ 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 && multicomponent) AddVolumeOutput("TEMPERATURE", "Temperature", "PRIMITIVE", "Temperature"); + 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"); @@ -373,8 +350,7 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ if (nDim == 3) AddVolumeOutput("RES_VELOCITY-Z", "Residual_Velocity_z", "RESIDUAL", "Residual of the z-velocity component"); if (config->GetEnergy_Equation()){ - if (multicomponent) AddVolumeOutput("RES_ENTHALPY", "Residual_Enthalpy", "RESIDUAL", "Residual of the enthalpy"); - else AddVolumeOutput("RES_TEMPERATURE", "Residual_Temperature", "RESIDUAL", "Residual of the temperature"); + AddVolumeOutput("RES_ENTHALPY", "Residual_Enthalpy", "RESIDUAL", "Residual of the enthalpy"); } SetVolumeOutputFieldsScalarResidual(config); @@ -430,8 +406,7 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve SetVolumeOutputValue("VELOCITY-Z", iPoint, Node_Flow->GetSolution(iPoint, 3)); if (heat || flamelet) { - if (multicomponent) SetVolumeOutputValue("ENTHALPY", iPoint, Node_Flow->GetSolution(iPoint, nDim+1)); - else SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetSolution(iPoint, nDim+1)); + SetVolumeOutputValue("ENTHALPY", iPoint, Node_Flow->GetSolution(iPoint, nDim+1)); } if (weakly_coupled_heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Heat->GetSolution(iPoint, 0)); @@ -456,7 +431,7 @@ 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 (multicomponent && heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetTemperature(iPoint)); + SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetTemperature(iPoint)); } SetVolumeOutputValue("RES_PRESSURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 0)); @@ -465,8 +440,7 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve if (nDim == 3) SetVolumeOutputValue("RES_VELOCITY-Z", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 3)); if (config->GetEnergy_Equation()) { - if (multicomponent) SetVolumeOutputValue("RES_ENTHALPY", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, nDim+1)); - else SetVolumeOutputValue("RES_TEMPERATURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, nDim+1)); + SetVolumeOutputValue("RES_ENTHALPY", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, nDim+1)); } if (config->GetKind_SlopeLimit_Flow() != LIMITER::NONE && config->GetKind_SlopeLimit_Flow() != LIMITER::VAN_ALBADA_EDGE) { diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index 730d565ee616..a5c566d4cf31 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -55,7 +55,7 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned bool time_stepping = config->GetTime_Marching() == TIME_MARCHING::TIME_STEPPING; bool adjoint = (config->GetContinuous_Adjoint()) || (config->GetDiscrete_Adjoint()); const bool centered = config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED; - const bool energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); + const su2double* scalar_init = nullptr; /* A grid is defined as dynamic if there's rigid grid movement or grid deformation AND the problem is time domain */ dynamic_grid = config->GetDynamic_Grid(); @@ -168,11 +168,9 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned Pressure_Inf = config->GetPressure_FreeStreamND(); Velocity_Inf = config->GetVelocity_FreeStreamND(); Temperature_Inf = config->GetTemperature_FreeStreamND(); - if (energy_multicomponent) { - const su2double* scalar_init = config->GetSpecies_Init(); - GetFluidModel()->SetTDState_T(Temperature_Inf, scalar_init); - Enthalpy_Inf = GetFluidModel()->GetEnthalpy(); - } + if (config->GetKind_Species_Model() != SPECIES_MODEL::NONE) scalar_init = config->GetSpecies_Init(); + GetFluidModel()->SetTDState_T(Temperature_Inf, scalar_init); + Enthalpy_Inf = GetFluidModel()->GetEnthalpy(); /*--- Initialize the secondary values for direct derivative approxiations ---*/ @@ -203,13 +201,9 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned /*--- Initialize the solution to the far-field state everywhere. ---*/ if (navier_stokes) { - if (energy_multicomponent){ - nodes = new CIncNSVariable(Pressure_Inf, Velocity_Inf, Enthalpy_Inf, nPoint, nDim, nVar, config); - }else{ - nodes = new CIncNSVariable(Pressure_Inf, Velocity_Inf, Temperature_Inf, nPoint, nDim, nVar, config); - } + nodes = new CIncNSVariable(Pressure_Inf, Velocity_Inf, Enthalpy_Inf, nPoint, nDim, nVar, config); } else { - nodes = new CIncEulerVariable(Pressure_Inf, Velocity_Inf, Temperature_Inf, nPoint, nDim, nVar, config); + nodes = new CIncEulerVariable(Pressure_Inf, Velocity_Inf, Enthalpy_Inf, nPoint, nDim, nVar, config); } SetBaseClassPointerToNodes(); @@ -1241,8 +1235,7 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont const bool limiter = (config->GetKind_SlopeLimit_Flow() != LIMITER::NONE); const bool van_albada = (config->GetKind_SlopeLimit_Flow() == LIMITER::VAN_ALBADA_EDGE); const bool bounded_scalar = config->GetBounded_Scalar(); - const bool energy_multicomponent = - ((config->GetEnergy_Equation()) && (config->GetKind_FluidModel() == FLUID_MIXTURE)); + const bool multicomponent = (config->GetKind_FluidModel() == FLUID_MIXTURE); /*--- For hybrid parallel AD, pause preaccumulation if there is shared reading of * variables, otherwise switch to the faster adjoint evaluation mode. ---*/ @@ -1320,28 +1313,7 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont Primitive_i[iVar] = V_i[iVar]; Primitive_j[iVar] = V_j[iVar]; } - if (energy_multicomponent) { - su2double Project_Grad_Enthalpy_i = 0.0; - su2double Project_Grad_Enthalpy_j = 0.0; - - for (iDim = 0; iDim < nDim; iDim++) { - Project_Grad_Enthalpy_i += Vector_ij[iDim] * nodes->GetAuxVarGradient(iPoint, 1, iDim); - Project_Grad_Enthalpy_j -= Vector_ij[iDim] * nodes->GetAuxVarGradient(jPoint, 1, iDim); - } - su2double lim_i = 1.0; - su2double lim_j = 1.0; - if (van_albada) { - su2double V_ij = V_j[nDim + 9] - V_i[nDim + 9]; - lim_i = LimiterHelpers<>::vanAlbadaFunction(Project_Grad_Enthalpy_i, V_ij, EPS); - lim_j = LimiterHelpers<>::vanAlbadaFunction(-Project_Grad_Enthalpy_j, V_ij, EPS); - } else if (limiter) { - /*--- For solving enthalpy instead of temperature, computation of limiters must be added - in future implementation, for now it is limited to van Albada limiter or default value 1.0. ---*/ - lim_i = 1.0; - lim_j = 1.0; - } - Primitive_i[nDim + 9] = V_i[nDim + 9] + lim_i * Project_Grad_Enthalpy_i; - Primitive_j[nDim + 9] = V_j[nDim + 9] + lim_j * Project_Grad_Enthalpy_j; + if(multicomponent){ const su2double* scalar_i = solver_container[SPECIES_SOL]->GetNodes()->GetSolution(iPoint); const su2double* scalar_j = solver_container[SPECIES_SOL]->GetNodes()->GetSolution(jPoint); ComputeConsistentExtrapolation(GetFluidModel(), nDim, scalar_i, Primitive_i); @@ -1629,7 +1601,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont numerics->SetAuxVarGrad(nodes->GetAuxVarGradient(iPoint), nullptr); - if(multicomponent && energy){ + if(multicomponent){ /*--- retrieve number of species that are solved and set maximum static array ---*/ int n_species = config->GetnSpecies(); static constexpr size_t MAXNVAR_SPECIES = 20UL; @@ -2102,20 +2074,18 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo unsigned short iDim, jDim, iVar, jVar; - su2double BetaInc2, Density, dRhodT, Temperature, oneOverCp, Cp, Enthalpy; + su2double BetaInc2, Density, dRhodh, Temperature, Cp, Enthalpy; su2double Velocity[MAXNDIM] = {0.0}; bool variable_density = (config->GetVariable_Density_Model()); bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); bool energy = config->GetEnergy_Equation(); - bool multicomponent = (config->GetKind_FluidModel() == FLUID_MIXTURE); /*--- Access the primitive variables at this node. ---*/ Density = nodes->GetDensity(iPoint); BetaInc2 = nodes->GetBetaInc2(iPoint); Cp = nodes->GetSpecificHeatCp(iPoint); - oneOverCp = 1.0/Cp; Temperature = nodes->GetTemperature(iPoint); Enthalpy = nodes->GetEnthalpy(iPoint); @@ -2124,17 +2094,10 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo /*--- We need the derivative of the equation of state to build the preconditioning matrix. For now, the only option is the ideal gas - law, but in the future, dRhodT should be in the fluid model. ---*/ + law, but in the future, dRhodh should be in the fluid model. ---*/ if (variable_density) { - if (multicomponent && energy){ - dRhodT = -Density / (Cp * Temperature); - Cp = oneOverCp = 1.0; - } else { - dRhodT = -Density/Temperature; - } - } else { - dRhodT = 0.0; + dRhodh = -Density / (Cp * Temperature); } /*--- Calculating the inverse of the preconditioning matrix @@ -2164,12 +2127,12 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo Preconditioner[nDim+1][jDim+1] = 0.0; } - Preconditioner[0][nDim+1] = dRhodT; + Preconditioner[0][nDim+1] = dRhodh; for (iDim = 0; iDim < nDim; iDim++) - Preconditioner[iDim+1][nDim+1] = Velocity[iDim]*dRhodT; + Preconditioner[iDim+1][nDim+1] = Velocity[iDim]*dRhodh; if (energy) { - Preconditioner[nDim+1][nDim+1] = dRhodT * Enthalpy + Cp * Density; + Preconditioner[nDim+1][nDim+1] = dRhodh * Enthalpy + Density; } else { Preconditioner[nDim+1][nDim+1] = 1.0; } @@ -2185,12 +2148,12 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo later in the R-K and Euler Explicit time integration schemes. ---*/ - Preconditioner[0][0] = Enthalpy * BetaInc2 * dRhodT * oneOverCp / Density + BetaInc2; + 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) { - Preconditioner[nDim+1][0] = -1.0 * Enthalpy * oneOverCp / Density; + Preconditioner[nDim+1][0] = -1.0 * Enthalpy / Density; } else { Preconditioner[nDim+1][0] = 0.0; } @@ -2206,11 +2169,11 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo Preconditioner[nDim+1][jDim+1] = 0.0; } - Preconditioner[0][nDim+1] = -1.0 * BetaInc2 * dRhodT * oneOverCp / Density; + Preconditioner[0][nDim+1] = -1.0 * BetaInc2 * dRhodh / Density; for (iDim = 0; iDim < nDim; iDim++) Preconditioner[iDim+1][nDim+1] = 0.0; if (energy) { - Preconditioner[nDim+1][nDim+1] = oneOverCp / Density; + Preconditioner[nDim+1][nDim+1] = 1 / Density; } else { Preconditioner[nDim+1][nDim+1] = 0.0; } diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index 7f02687aa3f2..d85a57669750 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -69,20 +69,10 @@ void CIncNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container const bool limiter = (config->GetKind_SlopeLimit_Flow() != LIMITER::NONE) && (InnerIter <= config->GetLimiterIter()); const bool van_albada = (config->GetKind_SlopeLimit_Flow() == LIMITER::VAN_ALBADA_EDGE); const bool wall_functions = config->GetWall_Functions(); - const bool energy_multicomponent = config->GetEnergy_Equation() && config->GetKind_FluidModel() == FLUID_MIXTURE; /*--- Common preprocessing steps (implemented by CEulerSolver) ---*/ CommonPreprocessing(geometry, solver_container, config, iMesh, iRKStep, RunTime_EqSystem, Output); - if (energy_multicomponent && muscl) { - SU2_OMP_SAFE_GLOBAL_ACCESS(config->SetGlobalParam(config->GetKind_Solver(), RunTime_EqSystem);) - SU2_OMP_FOR_STAT(omp_chunk_size) - for (auto i_point = 0u; i_point < nPoint; i_point++) { - solver_container[FLOW_SOL]->GetNodes()->SetAuxVar(i_point, 1, - solver_container[FLOW_SOL]->GetNodes()->GetEnthalpy(i_point)); - } - END_SU2_OMP_FOR - } /*--- Compute gradient for MUSCL reconstruction ---*/ @@ -96,21 +86,6 @@ void CIncNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container default: break; } } - if (muscl && !center && energy_multicomponent) { - /*--- Gradient computation for MUSCL reconstruction of Enthalpy for multicomponent flows. ---*/ - - switch (config->GetKind_Gradient_Method_Recon()) { - case GREEN_GAUSS: - SetAuxVar_Gradient_GG(geometry, config); - break; - case LEAST_SQUARES: - case WEIGHTED_LEAST_SQUARES: - SetAuxVar_Gradient_LS(geometry, config); - break; - default: - break; - } - } /*--- Compute gradient of the primitive variables ---*/ @@ -300,10 +275,10 @@ void CIncNSSolver::Compute_Streamwise_Periodic_Recovered_Values(CConfig *config, void CIncNSSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config) { - const bool energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); + const bool multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE; /*--- Contribution to heat flux due to enthalpy diffusion for multicomponent and reacting flows ---*/ - if (energy_multicomponent) { + if (multicomponent) { const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const int n_species = config->GetnSpecies(); Compute_Enthalpy_Diffusion(iEdge, geometry, solver_container, numerics, n_species, implicit); @@ -440,7 +415,6 @@ void CIncNSSolver::BC_Wall_Generic(const CGeometry *geometry, const CConfig *con const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool energy = config->GetEnergy_Equation(); const bool py_custom = config->GetMarker_All_PyCustom(val_marker); - const bool multicomponent = (config->GetKind_FluidModel() == FLUID_MIXTURE); /*--- Variables for streamwise periodicity ---*/ const bool streamwise_periodic = (config->GetKind_Streamwise_Periodic() != ENUM_STREAMWISE_PERIODIC::NONE); @@ -563,7 +537,8 @@ void CIncNSSolver::BC_Wall_Generic(const CGeometry *geometry, const CConfig *con LinSysRes(iPoint, nDim+1) -= Wall_HeatFlux*Area; if (implicit) { - Jacobian.AddVal2Diag(iPoint, nDim+1, Transfer_Coefficient*Area); + const su2double Cp = nodes->GetSpecificHeatCp(iPoint); + Jacobian.AddVal2Diag(iPoint, nDim+1, Transfer_Coefficient*Area/Cp); } break; @@ -596,12 +571,8 @@ void CIncNSSolver::BC_Wall_Generic(const CGeometry *geometry, const CConfig *con /*--- Jacobian contribution for temperature equation. ---*/ if (implicit) { - if (multicomponent) { - const su2double Cp = nodes->GetSpecificHeatCp(iPoint); - Jacobian.AddVal2Diag(iPoint, nDim + 1, thermal_conductivity * Area / (dist_ij * Cp)); - } else { - Jacobian.AddVal2Diag(iPoint, nDim + 1, thermal_conductivity * Area / dist_ij); - } + const su2double Cp = nodes->GetSpecificHeatCp(iPoint); + Jacobian.AddVal2Diag(iPoint, nDim + 1, thermal_conductivity * Area / (dist_ij * Cp)); } break; } // switch @@ -632,7 +603,7 @@ void CIncNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **sol const su2double Temperature_Ref = config->GetTemperature_Ref(); const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool energy = config->GetEnergy_Equation(); - const bool multicomponent = (config->GetKind_FluidModel() == FLUID_MIXTURE); + const su2double* scalars = nullptr; /*--- Identify the boundary ---*/ @@ -718,18 +689,17 @@ void CIncNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **sol /*--- Strong imposition of the temperature on the fluid zone. ---*/ LinSysRes(iPoint, nDim+1) = 0.0; - if (multicomponent) { - /*--- Retrieve scalars at wall node. ---*/ - su2double* scalars = solver_container[SPECIES_SOL]->GetNodes()->GetSolution(iPoint); - /*--- Retrieve fluid model. ---*/ - CFluidModel* fluid_model_local = solver_container[FLOW_SOL]->GetFluidModel(); - /*--- Set thermodynamic state given wall temperature and species composition. ---*/ - fluid_model_local->SetTDState_T(Twall, scalars); - /*--- Set enthalpy obtained from fluid model. ---*/ - nodes->SetSolution_Old(iPoint, nDim + 1, fluid_model_local->GetEnthalpy()); - } else { - nodes->SetSolution_Old(iPoint, nDim + 1, Twall); + + /*--- Retrieve scalars at wall node. ---*/ + if (config->GetKind_Species_Model() != SPECIES_MODEL::NONE && solver_container[SPECIES_SOL] != nullptr) { + scalars = solver_container[SPECIES_SOL]->GetNodes()->GetSolution(iPoint); } + /*--- Retrieve fluid model. ---*/ + CFluidModel* fluid_model_local = solver_container[FLOW_SOL]->GetFluidModel(); + /*--- Set thermodynamic state given wall temperature and species composition. ---*/ + fluid_model_local->SetTDState_T(Twall, scalars); + /*--- Set enthalpy obtained from fluid model. ---*/ + nodes->SetSolution_Old(iPoint, nDim + 1, fluid_model_local->GetEnthalpy()); nodes->SetEnergy_ResTruncError_Zero(iPoint); } END_SU2_OMP_FOR diff --git a/SU2_CFD/src/variables/CIncEulerVariable.cpp b/SU2_CFD/src/variables/CIncEulerVariable.cpp index 085ecc8596b9..881de86562e4 100644 --- a/SU2_CFD/src/variables/CIncEulerVariable.cpp +++ b/SU2_CFD/src/variables/CIncEulerVariable.cpp @@ -28,7 +28,7 @@ #include "../../include/variables/CIncEulerVariable.hpp" #include "../../include/fluid/CFluidModel.hpp" -CIncEulerVariable::CIncEulerVariable(su2double pressure, const su2double *velocity, su2double temperature, +CIncEulerVariable::CIncEulerVariable(su2double pressure, const su2double *velocity, su2double enthalpy, unsigned long npoint, unsigned long ndim, unsigned long nvar, const CConfig *config) : CFlowVariable(npoint, ndim, nvar, ndim + 10, ndim + (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED ? 2 : 4), config), @@ -42,7 +42,7 @@ CIncEulerVariable::CIncEulerVariable(su2double pressure, const su2double *veloci /*--- Solution initialization ---*/ - su2double val_solution[5] = {pressure, velocity[0], velocity[1], temperature, temperature}; + su2double val_solution[5] = {pressure, velocity[0], velocity[1], enthalpy, enthalpy}; if(nDim==3) val_solution[3] = velocity[2]; for(unsigned long iPoint=0; iPointSetTDState_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. Note that the thermodynamic pressure is constant and decoupled from the dynamic pressure being iterated. ---*/ - /*--- Use the fluid model to compute the new value of density. ---*/ - - FluidModel->SetTDState_T(Temperature); - /*--- Set the value of the density ---*/ const auto check_dens = SetDensity(iPoint, FluidModel->GetDensity()); @@ -103,9 +101,10 @@ bool CIncEulerVariable::SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel /*--- Recompute the primitive variables ---*/ - Temperature = Solution(iPoint, nDim+1); + Enthalpy = Solution(iPoint, nDim+1); + FluidModel->SetTDState_h(Enthalpy); + Temperature = FluidModel->GetTemperature(); SetTemperature(iPoint, Temperature, TemperatureLimits); - FluidModel->SetTDState_T(Temperature); SetDensity(iPoint, FluidModel->GetDensity()); /*--- Flag this point as non-physical. ---*/ @@ -118,10 +117,11 @@ bool CIncEulerVariable::SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel SetVelocity(iPoint); - /*--- Set specific heats (only necessary for consistency with preconditioning). ---*/ + /*--- Set enthalpy and specific heats (only necessary for consistency with preconditioning). ---*/ SetSpecificHeatCp(iPoint, FluidModel->GetCp()); SetSpecificHeatCv(iPoint, FluidModel->GetCv()); + SetEnthalpy(iPoint, FluidModel->GetEnthalpy()); return physical; diff --git a/SU2_CFD/src/variables/CIncNSVariable.cpp b/SU2_CFD/src/variables/CIncNSVariable.cpp index efe0bdc6dfc9..382446ca09aa 100644 --- a/SU2_CFD/src/variables/CIncNSVariable.cpp +++ b/SU2_CFD/src/variables/CIncNSVariable.cpp @@ -28,9 +28,9 @@ #include "../../include/variables/CIncNSVariable.hpp" #include "../../include/fluid/CFluidModel.hpp" -CIncNSVariable::CIncNSVariable(su2double pressure, const su2double *velocity, su2double temperature, +CIncNSVariable::CIncNSVariable(su2double pressure, const su2double *velocity, su2double enthalpy, unsigned long npoint, unsigned long ndim, unsigned long nvar, const CConfig *config) : - CIncEulerVariable(pressure, velocity, temperature, npoint, ndim, nvar, config) { + CIncEulerVariable(pressure, velocity, enthalpy, npoint, ndim, nvar, config) { Vorticity.resize(nPoint,3); StrainMag.resize(nPoint); @@ -46,52 +46,23 @@ CIncNSVariable::CIncNSVariable(su2double pressure, const su2double *velocity, su AuxVar.resize(nPoint,nAuxVar) = su2double(0.0); Grad_AuxVar.resize(nPoint,nAuxVar,nDim); } - if ((config->GetKind_FluidModel() == FLUID_MIXTURE) && config->GetEnergy_Equation()) { - Energy_Multicomponent = true; - if (config->GetMUSCL_Flow()) { - nAuxVar = 2; - AuxVar.resize(nPoint, nAuxVar) = su2double(0.0); - Grad_AuxVar.resize(nPoint, nAuxVar, nDim); - } - } } bool CIncNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel, const su2double *scalar) { bool physical = true; su2double Temperature; + su2double Enthalpy; /*--- Set the value of the pressure ---*/ SetPressure(iPoint); - if(Energy_Multicomponent){ - su2double Enthalpy = Solution(iPoint, nDim +1); - FluidModel->SetTDState_h(Enthalpy, scalar); - Temperature = FluidModel->GetTemperature(); - } else { - /*--- Set the value of the temperature directly ---*/ - Temperature = Solution(iPoint, indices.Temperature()); - } + Enthalpy = Solution(iPoint, nDim + 1); + FluidModel->SetTDState_h(Enthalpy, scalar); + Temperature = FluidModel->GetTemperature(); auto check_temp = SetTemperature(iPoint, Temperature, TemperatureLimits); - - if (!Energy_Multicomponent) { - /*--- Use the fluid model to compute the new value of density. - Note that the thermodynamic pressure is constant and decoupled - from the dynamic pressure being iterated. ---*/ - - /*--- Use the fluid model to compute the new value of density. ---*/ - - FluidModel->SetTDState_T(Temperature, scalar); - - /*--- for FLAMELET: copy the LUT temperature into the solution ---*/ - Solution(iPoint, nDim + 1) = FluidModel->GetTemperature(); - /*--- for FLAMELET: update the local temperature using LUT variables ---*/ - Temperature = Solution(iPoint, indices.Temperature()); - check_temp = SetTemperature(iPoint, Temperature, TemperatureLimits); - } - /*--- Set the value of the density ---*/ const auto check_dens = SetDensity(iPoint, FluidModel->GetDensity()); @@ -107,15 +78,9 @@ bool CIncNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2do /*--- Recompute the primitive variables ---*/ - if (Energy_Multicomponent) { - su2double Enthalpy = Solution(iPoint, nDim + 1); - FluidModel->SetTDState_h(Enthalpy, scalar); - SetTemperature(iPoint, FluidModel->GetTemperature(), TemperatureLimits); - } else { - Temperature = Solution(iPoint, indices.Temperature()); - SetTemperature(iPoint, Temperature, TemperatureLimits); - FluidModel->SetTDState_T(Temperature, scalar); - } + Enthalpy = Solution(iPoint, nDim + 1); + FluidModel->SetTDState_h(Enthalpy, scalar); + SetTemperature(iPoint, FluidModel->GetTemperature(), TemperatureLimits); SetDensity(iPoint, FluidModel->GetDensity()); From 58e66ea565541a06a00d15c6b3ab1681d506cbb8 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Tue, 7 Oct 2025 16:31:24 +0200 Subject: [PATCH 52/97] fix warning --- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index a5c566d4cf31..cb64035f7cd0 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -2098,6 +2098,8 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo if (variable_density) { dRhodh = -Density / (Cp * Temperature); + } else { + dRhodh = 0.0; } /*--- Calculating the inverse of the preconditioning matrix @@ -2128,8 +2130,7 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo } Preconditioner[0][nDim+1] = dRhodh; - for (iDim = 0; iDim < nDim; iDim++) - Preconditioner[iDim+1][nDim+1] = Velocity[iDim]*dRhodh; + for (iDim = 0; iDim < nDim; iDim++) Preconditioner[iDim+1][nDim+1] = Velocity[iDim] * dRhodh; if (energy) { Preconditioner[nDim+1][nDim+1] = dRhodh * Enthalpy + Density; From 09323dd9bde357257c622f9675f01ddb9f2b4b5f Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Tue, 7 Oct 2025 20:43:49 +0200 Subject: [PATCH 53/97] fixing outputs --- SU2_CFD/include/output/CFlowIncOutput.hpp | 1 - SU2_CFD/src/numerics/flow/convection/fds.cpp | 7 ++--- SU2_CFD/src/output/CAdjFlowIncOutput.cpp | 24 ++++++++++++----- SU2_CFD/src/output/CFlowIncOutput.cpp | 27 ++++++++++++-------- SU2_PY/SU2/io/historyMap.py | 6 +++++ 5 files changed, 42 insertions(+), 23 deletions(-) diff --git a/SU2_CFD/include/output/CFlowIncOutput.hpp b/SU2_CFD/include/output/CFlowIncOutput.hpp index 4ac5d25925f5..241c7d56e9c6 100644 --- a/SU2_CFD/include/output/CFlowIncOutput.hpp +++ b/SU2_CFD/include/output/CFlowIncOutput.hpp @@ -40,7 +40,6 @@ class CFlowIncOutput final: public CFlowOutput { private: TURB_MODEL turb_model; /*!< \brief The kind of turbulence model*/ bool heat; /*!< \brief Boolean indicating whether have a heat problem*/ - bool multicomponent; /*!< \brief Boolean indicating whether have a multicomponent problem*/ bool weakly_coupled_heat; /*!< \brief Boolean indicating whether have a weakly coupled heat equation*/ bool flamelet; /*!< \brief Boolean indicating whether we solve the flamelet equations */ unsigned short streamwisePeriodic; /*!< \brief Boolean indicating whether it is a streamwise periodic simulation. */ diff --git a/SU2_CFD/src/numerics/flow/convection/fds.cpp b/SU2_CFD/src/numerics/flow/convection/fds.cpp index fb95ee48b1fb..8b7e0338b3cf 100644 --- a/SU2_CFD/src/numerics/flow/convection/fds.cpp +++ b/SU2_CFD/src/numerics/flow/convection/fds.cpp @@ -160,9 +160,6 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config MeandRhodh = -MeanDensity / (MeanTemperature * MeanCp); dRhodh_i = -DensityInc_i / (Temperature_i * Cp_i); dRhodh_j = -DensityInc_j / (Temperature_j * Cp_j); - MeanCp = 1.0; - Cp_i = 1.0; - Cp_j = 1.0; } /*--- Compute ProjFlux_i ---*/ @@ -262,8 +259,8 @@ CNumerics::ResidualType<> CUpwFDSInc_Flow::ComputeResidual(const CConfig *config Jacobian_i[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_i; Jacobian_j[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_j; } - Jacobian_i[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_i*Cp_i; - Jacobian_j[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_j*Cp_j; + Jacobian_i[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_i; + Jacobian_j[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_j; } } } diff --git a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp index 41ef8a7319c5..ee5b9b8463b6 100644 --- a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp @@ -111,8 +111,12 @@ void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config) { if (nDim == 3) { AddHistoryOutput("RMS_ADJ_VELOCITY-Z", "rms[A_W]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint Velocity z-component.", HistoryFieldType::RESIDUAL); } - /// DESCRIPTION: Maximum residual of the temperature. - if (heat || weakly_coupled_heat) { + /// DESCRIPTION: Root-mean square residual of the adjoint temperature. + if (weakly_coupled_heat) { + AddHistoryOutput("RMS_ADJ_TEMPERATURE", "rms[A_T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint temperature.", HistoryFieldType::RESIDUAL); + } + /// DESCRIPTION: Root-mean square residual of the adjoint enthalpy. + if (heat) { AddHistoryOutput("RMS_ADJ_ENTHALPY", "rms[A_h]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the enthalpy.", HistoryFieldType::RESIDUAL); } @@ -139,8 +143,12 @@ void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config) { if (nDim == 3) { AddHistoryOutput("MAX_ADJ_VELOCITY-Z", "max[A_RhoW]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint Velocity z-component", HistoryFieldType::RESIDUAL); } - /// DESCRIPTION: Maximum residual of the temperature. - if (heat || weakly_coupled_heat) { + /// DESCRIPTION: Maximum residual of the adjoint temperature. + if (weakly_coupled_heat) { + AddHistoryOutput("MAX_ADJ_TEMPERATURE", "max[A_T]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the temperature.", HistoryFieldType::RESIDUAL); + } + /// DESCRIPTION: Maximum residual of the adjoint enthalpy. + if (heat) { AddHistoryOutput("MAX_ADJ_ENTHALPY", "max[A_h]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the enthalpy.", HistoryFieldType::RESIDUAL); } @@ -158,10 +166,14 @@ void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config) { if (nDim == 3) { AddHistoryOutput("BGS_ADJ_VELOCITY-Z", "bgs[A_RhoW]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint Velocity z-component", HistoryFieldType::RESIDUAL); } - /// DESCRIPTION: BGS residual of the temperature. - if (heat || weakly_coupled_heat) { + /// DESCRIPTION: BGS residual of the adjoint temperature. + if (weakly_coupled_heat) { AddHistoryOutput("BGS_ADJ_TEMPERATURE", "bgs[A_T]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint temperature.", HistoryFieldType::RESIDUAL); } + /// DESCRIPTION: BGS residual of the adjoint enthalpy. + if (heat) { + AddHistoryOutput("BGS_ADJ_ENTHALPY", "bgs[A_h]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint enthalpy.", HistoryFieldType::RESIDUAL); + } AddHistoryOutputFields_AdjScalarBGS_RES(config); diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index 9ce01f37cd14..9671ab08ab65 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -107,10 +107,10 @@ void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ AddHistoryOutput("RMS_VELOCITY-Y", "rms[V]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the velocity y-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Root-mean square residual of the velocity z-component. if (nDim == 3) AddHistoryOutput("RMS_VELOCITY-Z", "rms[W]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the velocity z-component.", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Maximum residual of the temperature. - if (heat || weakly_coupled_heat){ - AddHistoryOutput("RMS_ENTHALPY", "rms[h]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the enthalpy.", HistoryFieldType::RESIDUAL); - } + /// DESCRIPTION: Root-mean square residual of the temperature. + if (weakly_coupled_heat) AddHistoryOutput("RMS_TEMPERATURE", "rms[T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the temperature.", HistoryFieldType::RESIDUAL); + /// DESCRIPTION: Root-mean square residual of the enthalpy. + if (heat) AddHistoryOutput("RMS_ENTHALPY", "rms[h]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the enthalpy.", HistoryFieldType::RESIDUAL); AddHistoryOutputFields_ScalarRMS_RES(config); @@ -129,7 +129,10 @@ void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ if (nDim == 3) AddHistoryOutput("MAX_VELOCITY-Z", "max[W]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the velocity z-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the temperature. - if (heat || weakly_coupled_heat) { + if (weakly_coupled_heat) + AddHistoryOutput("MAX_TEMPERATURE", "max[T]", ScreenOutputFormat::FIXED, "MAX_RES", "Root-mean square residual of the temperature.", HistoryFieldType::RESIDUAL); + /// DESCRIPTION: Maximum residual of the enthalpy. + if (heat) { AddHistoryOutput("MAX_ENTHALPY", "max[h]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the enthalpy.", HistoryFieldType::RESIDUAL); } @@ -147,9 +150,12 @@ void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ if (nDim == 3) AddHistoryOutput("BGS_VELOCITY-Z", "bgs[W]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the velocity z-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the temperature. - if (heat || weakly_coupled_heat) { - AddHistoryOutput("BGS_ENTHALPY", "bgs[h]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the enthalpy.", HistoryFieldType::RESIDUAL); - } + if (weakly_coupled_heat) + AddHistoryOutput("BGS_TEMPERATURE", "bgs[T]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the temperature.", HistoryFieldType::RESIDUAL); + /// DESCRIPTION: Maximum residual of the Enthalpy. + if (heat) + AddHistoryOutput("BGS_ENTHALPY", "bgs[h]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the enthalpy.", + HistoryFieldType::RESIDUAL); AddHistoryOutputFields_ScalarBGS_RES(config); @@ -299,9 +305,8 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("VELOCITY-Y", "Velocity_y", "SOLUTION", "y-component of the velocity vector"); if (nDim == 3) AddVolumeOutput("VELOCITY-Z", "Velocity_z", "SOLUTION", "z-component of the velocity vector"); - if (heat || weakly_coupled_heat || flamelet){ - AddVolumeOutput("ENTHALPY", "Enthalpy", "SOLUTION", "Enthalpy"); - } + if (weakly_coupled_heat) AddVolumeOutput("TEMPERATURE", "Temperature", "SOLUTION", "Temperature"); + if (heat || flamelet) AddVolumeOutput("ENTHALPY", "Enthalpy", "SOLUTION", "Enthalpy"); SetVolumeOutputFieldsScalarSolution(config); diff --git a/SU2_PY/SU2/io/historyMap.py b/SU2_PY/SU2/io/historyMap.py index e98684e50655..93a49a2ce0f5 100644 --- a/SU2_PY/SU2/io/historyMap.py +++ b/SU2_PY/SU2/io/historyMap.py @@ -148,6 +148,12 @@ "HEADER": "bgs[A_T]", "TYPE": "RESIDUAL", }, + "BGS_ADJ_ENTHALPY": { + "DESCRIPTION": "BGS residual of the adjoint " "enthalpy.", + "GROUP": "BGS_RES", + "HEADER": "bgs[A_h]", + "TYPE": "RESIDUAL", + }, "BGS_ADJ_TKE": { "DESCRIPTION": "BGS residual of the adjoint kinetic energy.", "GROUP": "BGS_RES", From 798d7c4720e6e49d55338023abc6d18b0923c4c2 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Tue, 7 Oct 2025 21:02:08 +0200 Subject: [PATCH 54/97] fix centered scheme --- SU2_CFD/src/numerics/flow/convection/centered.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/SU2_CFD/src/numerics/flow/convection/centered.cpp b/SU2_CFD/src/numerics/flow/convection/centered.cpp index f8c1ddc602ad..9d480daaa569 100644 --- a/SU2_CFD/src/numerics/flow/convection/centered.cpp +++ b/SU2_CFD/src/numerics/flow/convection/centered.cpp @@ -356,9 +356,6 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi MeandRhodh = 0.0; if (variable_density) { MeandRhodh = -MeanDensity/(MeanTemperature*MeanCp); - MeanCp = 1.0; - Cp_i = 1.0; - Cp_j = 1.0; } /*--- Get projected flux tensor ---*/ @@ -410,10 +407,14 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi /*--- Computes differences between Laplacians and conservative variables ---*/ - for (iVar = 0; iVar < nVar - 1; iVar++) { + for (iVar = 0; iVar < nVar; iVar++) { Diff_Lapl[iVar] = Und_Lapl_i[iVar]-Und_Lapl_j[iVar]; + if (iVar == nVar - 1) { + Diff_V[iVar] = Enthalpy_i - Enthalpy_j; + } else { + Diff_V[iVar] = V_i[iVar] - V_j[iVar]; + } } - Diff_V[nVar - 1] = Enthalpy_i - Enthalpy_j; /*--- Build the preconditioning matrix using mean values ---*/ From ac24ff530f58a6a38bd2d208d77393e848b2c677 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Tue, 7 Oct 2025 22:42:19 +0200 Subject: [PATCH 55/97] fix ADJ_TEMPERATURE --- SU2_CFD/src/output/CAdjFlowIncOutput.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp index ee5b9b8463b6..9844df0e8bb7 100644 --- a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp @@ -316,6 +316,9 @@ void CAdjFlowIncOutput::SetVolumeOutputFields(CConfig *config) { /// DESCRIPTION: Adjoint Velocity z-component. AddVolumeOutput("ADJ_VELOCITY-Z", "Adjoint_Velocity_z", "SOLUTION", "z-component of the adjoint velocity vector"); } + /// DESCRIPTION: Adjoint Temperature. + AddVolumeOutput("ADJ_TEMPERATURE", "Adjoint_Temperature", "SOLUTION", "Adjoint temperature"); + /// DESCRIPTION: Adjoint Enthalpy. AddVolumeOutput("ADJ_ENTHALPY", "Adjoint_Enthalpy", "SOLUTION", "Adjoint_Enthalpy"); SetVolumeOutputFieldsAdjScalarSolution(config); From c874b029a9721713383d0c604325d688ff79af2d Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Wed, 8 Oct 2025 13:13:40 +0200 Subject: [PATCH 56/97] changes energy_multicomponent, enthalpy and RMS_ENTHALPY in test cases --- SU2_CFD/include/fluid/CConstantDensity.hpp | 6 +++++- SU2_CFD/include/fluid/CIncIdealGas.hpp | 6 +++++- SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp | 6 +++++- SU2_CFD/include/numerics/CNumerics.hpp | 2 +- SU2_CFD/src/numerics/CNumerics.cpp | 2 +- SU2_CFD/src/numerics/flow/flow_diffusion.cpp | 6 +++--- SU2_CFD/src/numerics/flow/flow_sources.cpp | 2 +- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 2 +- SU2_CFD/src/solvers/CIncNSSolver.cpp | 4 ++-- .../cylinder/heated_cylinder.cfg | 2 +- .../buoyancy_cavity/lam_buoyancy_cavity.cfg | 2 +- TestCases/incomp_navierstokes/cylinder/poly_cylinder.cfg | 2 +- .../streamwise_periodic/chtPinArray_2d/BC_HeatTransfer.cfg | 2 +- .../streamwise_periodic/chtPinArray_3d/configFluid.cfg | 2 +- .../custom_source_buoyancy/lam_buoyancy_cavity.cfg | 2 +- TestCases/radiation/p1model/configp1.cfg | 2 +- .../flatplate/incompressible_SA/turb_SA_flatplate.cfg | 2 +- .../flatplate/incompressible_SST/turb_SST_flatplate.cfg | 2 +- 18 files changed, 33 insertions(+), 21 deletions(-) diff --git a/SU2_CFD/include/fluid/CConstantDensity.hpp b/SU2_CFD/include/fluid/CConstantDensity.hpp index 68163521465c..903ebd4906f7 100644 --- a/SU2_CFD/include/fluid/CConstantDensity.hpp +++ b/SU2_CFD/include/fluid/CConstantDensity.hpp @@ -59,7 +59,11 @@ class CConstantDensity final : public CFluidModel { Enthalpy = Cp * Temperature; } - void SetTDState_h(const su2double val_enthalpy, const su2double* val_scalars) { + /*! + * \brief Set the Dimensionless State using Enthalpy. + * \param[in] val_enthalpy - Enthalpy value at the point. + */ + void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) override { Enthalpy = val_enthalpy; Temperature = Enthalpy / Cp; } diff --git a/SU2_CFD/include/fluid/CIncIdealGas.hpp b/SU2_CFD/include/fluid/CIncIdealGas.hpp index 9b976b09842f..16266e569568 100644 --- a/SU2_CFD/include/fluid/CIncIdealGas.hpp +++ b/SU2_CFD/include/fluid/CIncIdealGas.hpp @@ -61,7 +61,11 @@ class CIncIdealGas final : public CFluidModel { Enthalpy = Cp * Temperature; } - void SetTDState_h(const su2double val_enthalpy, const su2double* val_scalars) { + /*! + * \brief Set the Dimensionless State using Enthalpy. + * \param[in] val_enthalpy - Enthalpy value at the point. + */ + void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) override { Enthalpy = val_enthalpy; Temperature = Enthalpy / Cp; Density = Pressure / (Temperature * Gas_Constant); diff --git a/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp b/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp index b4a034e98155..067e40c74e8e 100644 --- a/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp +++ b/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp @@ -83,7 +83,11 @@ class CIncIdealGasPolynomial final : public CFluidModel { Enthalpy = Cp * Temperature; } - void SetTDState_h(const su2double val_enthalpy, const su2double* val_scalars) { + /*! + * \brief Set the Dimensionless State using enthalpy. + * \param[in] val_enthalpy - Enthalpy value at the point. + */ + void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) override { Enthalpy = val_enthalpy; Temperature = Enthalpy / Cp; Density = Pressure / (Temperature * Gas_Constant); diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 3f0cdb0a7d84..90c3a2e4cc4f 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -191,7 +191,7 @@ class CNumerics { bool nemo; /*!< \brief Flag for NEMO problems */ - bool multicomponent = false; /*!< \brief Flag for multicomponent and reacting flow */ + bool energy_multicomponent = false; /*!< \brief Flag for multicomponent and reacting flow */ bool bounded_scalar = false; /*!< \brief Flag for bounded scalar problem */ diff --git a/SU2_CFD/src/numerics/CNumerics.cpp b/SU2_CFD/src/numerics/CNumerics.cpp index 3c9edd25b856..5944c333c131 100644 --- a/SU2_CFD/src/numerics/CNumerics.cpp +++ b/SU2_CFD/src/numerics/CNumerics.cpp @@ -53,7 +53,7 @@ CNumerics::CNumerics(unsigned short val_nDim, unsigned short val_nVar, Gamma_Minus_One = Gamma - 1.0; Prandtl_Turb = config->GetPrandtl_Turb(); Gas_Constant = config->GetGas_ConstantND(); - multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE; + energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); tau = new su2double* [nDim]; for (iDim = 0; iDim < nDim; iDim++) diff --git a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp index 7fc226dca5d9..c008557035ce 100644 --- a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp +++ b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp @@ -554,7 +554,7 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi AD::SetPreaccIn(turb_ke_i); AD::SetPreaccIn(turb_ke_j); AD::SetPreaccIn(TauWall_i); AD::SetPreaccIn(TauWall_j); AD::SetPreaccIn(Normal, nDim); - if (multicomponent) { + if (energy_multicomponent) { AD::SetPreaccIn(HeatFluxDiffusion); } @@ -629,7 +629,7 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi GetViscousIncProjFlux(Mean_GradPrimVar, Normal, Mean_Thermal_Conductivity); - if (multicomponent) { + if (energy_multicomponent) { Proj_Flux_Tensor[nVar - 1] += HeatFluxDiffusion; } @@ -660,7 +660,7 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi Mean_Heat_Capacity = 0.5 * (V_i[nDim + 8] + V_j[nDim + 8]); Jacobian_i[nDim + 1][nDim + 1] = -Mean_Thermal_Conductivity * proj_vector_ij / Mean_Heat_Capacity; Jacobian_j[nDim + 1][nDim + 1] = Mean_Thermal_Conductivity * proj_vector_ij / Mean_Heat_Capacity; - if (multicomponent){ + if (energy_multicomponent){ Jacobian_i[nDim + 1][nDim + 1] -= JacHeatFluxDiffusion / Mean_Heat_Capacity; Jacobian_j[nDim + 1][nDim + 1] += JacHeatFluxDiffusion / Mean_Heat_Capacity; } diff --git a/SU2_CFD/src/numerics/flow/flow_sources.cpp b/SU2_CFD/src/numerics/flow/flow_sources.cpp index 06712e0a6953..13946cdeb30b 100644 --- a/SU2_CFD/src/numerics/flow/flow_sources.cpp +++ b/SU2_CFD/src/numerics/flow/flow_sources.cpp @@ -326,7 +326,7 @@ CNumerics::ResidualType<> CSourceIncAxisymmetric_Flow::ComputeResidual(const CCo yinv* yinv*2.0*total_viscosity*Velocity_i[1] - TWO3*AuxVar_Grad_i[0][1]); residual[3] -= Volume * yinv * Thermal_Conductivity_i * PrimVar_Grad_i[nDim + 1][1]; - if (multicomponent) { + if (multicomponent && energy) { residual[3] -= Volume * yinv * HeatFluxDiffusion; if (implicit) jacobian[3][3] -= Volume * yinv * JacHeatFluxDiffusion / Cp_i; } diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index cb64035f7cd0..2afaead67e30 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -1601,7 +1601,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont numerics->SetAuxVarGrad(nodes->GetAuxVarGradient(iPoint), nullptr); - if(multicomponent){ + if(multicomponent && energy){ /*--- retrieve number of species that are solved and set maximum static array ---*/ int n_species = config->GetnSpecies(); static constexpr size_t MAXNVAR_SPECIES = 20UL; diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index d85a57669750..7b6969478777 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -275,10 +275,10 @@ void CIncNSSolver::Compute_Streamwise_Periodic_Recovered_Values(CConfig *config, void CIncNSSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config) { - const bool multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE; + const bool energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); /*--- Contribution to heat flux due to enthalpy diffusion for multicomponent and reacting flows ---*/ - if (multicomponent) { + if (energy_multicomponent) { const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const int n_species = config->GetnSpecies(); Compute_Enthalpy_Diffusion(iEdge, geometry, solver_container, numerics, n_species, implicit); diff --git a/TestCases/disc_adj_incomp_navierstokes/cylinder/heated_cylinder.cfg b/TestCases/disc_adj_incomp_navierstokes/cylinder/heated_cylinder.cfg index 8c441c6b40c0..039b53f63659 100644 --- a/TestCases/disc_adj_incomp_navierstokes/cylinder/heated_cylinder.cfg +++ b/TestCases/disc_adj_incomp_navierstokes/cylinder/heated_cylinder.cfg @@ -120,7 +120,7 @@ GRAD_OBJFUNC_FILENAME= of_grad SURFACE_FILENAME= surface_flow SURFACE_ADJ_FILENAME= surface_adjoint OUTPUT_WRT_FREQ= 250 -SCREEN_OUTPUT= (INNER_ITER, RMS_ADJ_PRESSURE, RMS_ADJ_TEMPERATURE, SENS_PRESS, SENS_AOA) +SCREEN_OUTPUT= (INNER_ITER, RMS_ADJ_PRESSURE, RMS_ADJ_ENTHALPY, SENS_PRESS, SENS_AOA) % ----------------------- DESIGN VARIABLE PARAMETERS --------------------------% % diff --git a/TestCases/incomp_navierstokes/buoyancy_cavity/lam_buoyancy_cavity.cfg b/TestCases/incomp_navierstokes/buoyancy_cavity/lam_buoyancy_cavity.cfg index 912fcb82ebe3..47474c4a0a74 100644 --- a/TestCases/incomp_navierstokes/buoyancy_cavity/lam_buoyancy_cavity.cfg +++ b/TestCases/incomp_navierstokes/buoyancy_cavity/lam_buoyancy_cavity.cfg @@ -114,7 +114,7 @@ GRAD_OBJFUNC_FILENAME= of_grad SURFACE_FILENAME= surface_flow SURFACE_ADJ_FILENAME= surface_adjoint OUTPUT_WRT_FREQ= 100 -SCREEN_OUTPUT= (INNER_ITER, RMS_PRESSURE, RMS_TEMPERATURE, LIFT, DRAG) +SCREEN_OUTPUT= (INNER_ITER, RMS_PRESSURE, RMS_ENTHALPY, LIFT, DRAG) % ----------------------- GEOMETRY EVALUATION PARAMETERS ----------------------% GEO_BOUNDS= ( 0.499, 0.501) diff --git a/TestCases/incomp_navierstokes/cylinder/poly_cylinder.cfg b/TestCases/incomp_navierstokes/cylinder/poly_cylinder.cfg index a9454983bce0..e5dbb6b33d82 100644 --- a/TestCases/incomp_navierstokes/cylinder/poly_cylinder.cfg +++ b/TestCases/incomp_navierstokes/cylinder/poly_cylinder.cfg @@ -118,4 +118,4 @@ GRAD_OBJFUNC_FILENAME= of_grad SURFACE_FILENAME= surface_flow SURFACE_ADJ_FILENAME= surface_adjoint OUTPUT_WRT_FREQ= 250 -SCREEN_OUTPUT= (INNER_ITER, RMS_PRESSURE, RMS_TEMPERATURE, LIFT, DRAG, TOTAL_HEATFLUX) +SCREEN_OUTPUT= (INNER_ITER, RMS_PRESSURE, RMS_ENTHALPY, LIFT, DRAG, TOTAL_HEATFLUX) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/BC_HeatTransfer.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/BC_HeatTransfer.cfg index 7d40427e2382..456da5af5886 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/BC_HeatTransfer.cfg +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/BC_HeatTransfer.cfg @@ -113,7 +113,7 @@ CONV_STARTITER= 100000000 MESH_FILENAME= fluid.su2 % % SURFACE_STATIC_TEMPERATURE had to be removed from SCREEN_OUTPUT for the regression tests -SCREEN_OUTPUT= ( INNER_ITER, RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_TEMPERATURE, TOTAL_HEATFLUX) +SCREEN_OUTPUT= ( INNER_ITER, RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_ENTHALPY, TOTAL_HEATFLUX) SCREEN_WRT_FREQ_INNER= 1 % HISTORY_OUTPUT= ( ITER, RMS_RES, STREAMWISE_PERIODIC, FLOW_COEFF, LINSOL, HEAT ) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configFluid.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configFluid.cfg index 86c596886b26..8083f0574dfd 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configFluid.cfg +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configFluid.cfg @@ -105,7 +105,7 @@ TIME_DISCRE_TURB= EULER_IMPLICIT % % --------------------------- CONVERGENCE PARAMETERS --------------------------% % -CONV_FIELD= RMS_TEMPERATURE +CONV_FIELD= RMS_ENTHALPY CONV_RESIDUAL_MINVAL= -18 CONV_STARTITER= 100 % diff --git a/TestCases/py_wrapper/custom_source_buoyancy/lam_buoyancy_cavity.cfg b/TestCases/py_wrapper/custom_source_buoyancy/lam_buoyancy_cavity.cfg index 718f9207332d..6329eaf739c5 100644 --- a/TestCases/py_wrapper/custom_source_buoyancy/lam_buoyancy_cavity.cfg +++ b/TestCases/py_wrapper/custom_source_buoyancy/lam_buoyancy_cavity.cfg @@ -114,7 +114,7 @@ GRAD_OBJFUNC_FILENAME= of_grad.dat SURFACE_FILENAME= surface_flow SURFACE_ADJ_FILENAME= surface_adjoint OUTPUT_WRT_FREQ= 10 -SCREEN_OUTPUT= (INNER_ITER, RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_TEMPERATURE) +SCREEN_OUTPUT= (INNER_ITER, RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_ENTHALPY) WRT_PERFORMANCE= YES PYTHON_CUSTOM_SOURCE= YES diff --git a/TestCases/radiation/p1model/configp1.cfg b/TestCases/radiation/p1model/configp1.cfg index 1a3a9692ebec..6c779b16d0fb 100644 --- a/TestCases/radiation/p1model/configp1.cfg +++ b/TestCases/radiation/p1model/configp1.cfg @@ -96,7 +96,7 @@ CONV_CAUCHY_EPS= 1E-6 % OUTPUT %%%%%%%%%%%%%%%%%%%%%%% -SCREEN_OUTPUT = (INNER_ITER, RMS_PRESSURE, RMS_VELOCITY-X, RMS_TEMPERATURE, RMS_RAD_ENERGY, TOTAL_HEATFLUX) +SCREEN_OUTPUT = (INNER_ITER, RMS_PRESSURE, RMS_VELOCITY-X, RMS_ENTHALPY, RMS_RAD_ENERGY, TOTAL_HEATFLUX) MESH_FORMAT= SU2 MESH_FILENAME= meshp1.su2 diff --git a/TestCases/wallfunctions/flatplate/incompressible_SA/turb_SA_flatplate.cfg b/TestCases/wallfunctions/flatplate/incompressible_SA/turb_SA_flatplate.cfg index 1e87b7d96418..37c298a40b05 100644 --- a/TestCases/wallfunctions/flatplate/incompressible_SA/turb_SA_flatplate.cfg +++ b/TestCases/wallfunctions/flatplate/incompressible_SA/turb_SA_flatplate.cfg @@ -93,7 +93,7 @@ CONV_CAUCHY_EPS= 1E-6 % MESH_FILENAME= ../mesh_flatplate_140x100.su2 MESH_FORMAT= SU2 -SCREEN_OUTPUT= (INNER_ITER, WALL_TIME, RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_TEMPERATURE, RMS_NU_TILDE, \ +SCREEN_OUTPUT= (INNER_ITER, WALL_TIME, RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_ENTHALPY, RMS_NU_TILDE, \ LINSOL_ITER, LINSOL_RESIDUAL, LIFT, DRAG) SCREEN_WRT_FREQ_INNER= 10 % diff --git a/TestCases/wallfunctions/flatplate/incompressible_SST/turb_SST_flatplate.cfg b/TestCases/wallfunctions/flatplate/incompressible_SST/turb_SST_flatplate.cfg index d93972b22d37..9080c3903c5c 100644 --- a/TestCases/wallfunctions/flatplate/incompressible_SST/turb_SST_flatplate.cfg +++ b/TestCases/wallfunctions/flatplate/incompressible_SST/turb_SST_flatplate.cfg @@ -91,7 +91,7 @@ CONV_CAUCHY_EPS= 1E-6 % MESH_FILENAME= ../mesh_flatplate_140x100.su2 MESH_FORMAT= SU2 -SCREEN_OUTPUT= (INNER_ITER, WALL_TIME, RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_TEMPERATURE, RMS_TKE, RMS_DISSIPATION, \ +SCREEN_OUTPUT= (INNER_ITER, WALL_TIME, RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_ENTHALPY, RMS_TKE, RMS_DISSIPATION, \ LINSOL_ITER, LINSOL_RESIDUAL, LIFT, DRAG, TOTAL_HEATFLUX) SCREEN_WRT_FREQ_INNER= 10 HISTORY_OUTPUT= (ITER, RMS_RES, AERO_COEFF, FLOW_COEFF) From b0e3769cc67eccc16506d6381f7ca83b6859b743 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Wed, 8 Oct 2025 15:38:09 +0200 Subject: [PATCH 57/97] imposing temperature when energy equation is switched off --- .../include/variables/CIncEulerVariable.hpp | 2 ++ SU2_CFD/src/variables/CIncNSVariable.cpp | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/SU2_CFD/include/variables/CIncEulerVariable.hpp b/SU2_CFD/include/variables/CIncEulerVariable.hpp index c257a8b2a94a..2a034e88ebf2 100644 --- a/SU2_CFD/include/variables/CIncEulerVariable.hpp +++ b/SU2_CFD/include/variables/CIncEulerVariable.hpp @@ -72,6 +72,8 @@ 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. */ + bool Energy; /*!< \brief Flag for Energy equation in incompressible flows. */ public: /*! * \brief Constructor of the class. diff --git a/SU2_CFD/src/variables/CIncNSVariable.cpp b/SU2_CFD/src/variables/CIncNSVariable.cpp index 382446ca09aa..d42a06ed6163 100644 --- a/SU2_CFD/src/variables/CIncNSVariable.cpp +++ b/SU2_CFD/src/variables/CIncNSVariable.cpp @@ -46,6 +46,8 @@ CIncNSVariable::CIncNSVariable(su2double pressure, const su2double *velocity, su AuxVar.resize(nPoint,nAuxVar) = su2double(0.0); Grad_AuxVar.resize(nPoint,nAuxVar,nDim); } + Energy = config->GetEnergy_Equation(); + if(!Energy) TemperatureInc = config->GetInc_Temperature_Init(); } bool CIncNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel, const su2double *scalar) { @@ -58,9 +60,19 @@ bool CIncNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2do SetPressure(iPoint); - Enthalpy = Solution(iPoint, nDim + 1); - FluidModel->SetTDState_h(Enthalpy, scalar); - Temperature = FluidModel->GetTemperature(); + if (Energy) { + Enthalpy = Solution(iPoint, nDim + 1); + FluidModel->SetTDState_h(Enthalpy, scalar); + Temperature = FluidModel->GetTemperature(); + } else { + /*--- When energy equation is switch off, a constant temperature is imposed, and enthalpy is recomputed based on + * this temperature. As in the fluid flamelet model, the temperature is retrieved from a look-up table, then the + * temperature is obtained directly from the fluidmodel. For the other fluid models, GetTemperature provides the + * same value as TemperatureInc ---*/ + FluidModel->SetTDState_T(TemperatureInc, scalar); + Enthalpy = Solution(iPoint, nDim + 1) = FluidModel->GetEnthalpy(); + Temperature = FluidModel->GetTemperature(); + } auto check_temp = SetTemperature(iPoint, Temperature, TemperatureLimits); /*--- Set the value of the density ---*/ From d316de641abe77515f0aacaa607a4569d46b1096 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Wed, 8 Oct 2025 21:32:34 +0200 Subject: [PATCH 58/97] changing screenoutput BGS_ENTHALPY[0] in cht files --- .github/workflows/regression.yml | 2 +- .../coupled_cht/disc_adj_unsteadyCHT_cylinder/chtMaster.cfg | 4 ++-- .../streamwise_periodic/chtPinArray_2d/DA_configMaster.cfg | 2 +- .../streamwise_periodic/chtPinArray_2d/FD_configMaster.cfg | 2 +- .../streamwise_periodic/chtPinArray_2d/configMaster.cfg | 2 +- .../streamwise_periodic/chtPinArray_3d/configMaster.cfg | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 69257b1b72a0..e124f1a371b9 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -211,7 +211,7 @@ jobs: uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402 with: # -t -c - args: -b ${{github.ref}} -t develop -c feature_restart_preconditioning -s ${{matrix.testscript}} + args: -b ${{github.ref}} -t feature_preconditioning -c feature_restart_preconditioning -s ${{matrix.testscript}} - name: Cleanup uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402 with: diff --git a/TestCases/coupled_cht/disc_adj_unsteadyCHT_cylinder/chtMaster.cfg b/TestCases/coupled_cht/disc_adj_unsteadyCHT_cylinder/chtMaster.cfg index 6f3f5c486da0..b41f4517df01 100644 --- a/TestCases/coupled_cht/disc_adj_unsteadyCHT_cylinder/chtMaster.cfg +++ b/TestCases/coupled_cht/disc_adj_unsteadyCHT_cylinder/chtMaster.cfg @@ -30,9 +30,9 @@ ITER_AVERAGE_OBJ= 54 % ------------------------- INPUT/OUTPUT FILE INFORMATION --------------------------% % MESH_FILENAME= MeshCHT.su2 -SCREEN_OUTPUT= (TIME_ITER, OUTER_ITER, BGS_ADJ_PRESSURE[0], BGS_ADJ_VELOCITY-X[0], BGS_ADJ_VELOCITY-Y[0], BGS_ADJ_TEMPERATURE[0], BGS_ADJ_TEMPERATURE[1], SENS_TEMP[0], SENS_GEO[0], SENS_GEO[1] ) +SCREEN_OUTPUT= (TIME_ITER, OUTER_ITER, BGS_ADJ_PRESSURE[0], BGS_ADJ_VELOCITY-X[0], BGS_ADJ_VELOCITY-Y[0], BGS_ADJ_ENTHALPY[0], BGS_ADJ_TEMPERATURE[1], SENS_TEMP[0], SENS_GEO[0], SENS_GEO[1] ) % Suitable output for primal simulations -%SCREEN_OUTPUT= (TIME_ITER, OUTER_ITER, WALL_TIME, BGS_PRESSURE[0], BGS_TEMPERATURE[0], BGS_TEMPERATURE[1], DRAG[0], AVG_TEMPERATURE[1] ) +%SCREEN_OUTPUT= (TIME_ITER, OUTER_ITER, WALL_TIME, BGS_PRESSURE[0], BGS_ENTHALPY[0], BGS_TEMPERATURE[1], DRAG[0], AVG_TEMPERATURE[1] ) SCREEN_WRT_FREQ_OUTER= 50 HISTORY_OUTPUT= ( ITER, BGS_RES[0], RMS_RES[0], BGS_RES[1], RMS_RES[1],\ FLOW_COEFF[0], HEAT[0], AERO_COEFF[0], HEAT[1],\ diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/DA_configMaster.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/DA_configMaster.cfg index 44c88e2dc6bb..1da45e0d05c8 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/DA_configMaster.cfg +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/DA_configMaster.cfg @@ -20,7 +20,7 @@ MARKER_CHT_INTERFACE= ( fluid_pin1_interface, solid_pin1_interface, fluid_pin2_i CONV_RESIDUAL_MINVAL= -26 % OUTER_ITER= 3000 -SCREEN_OUTPUT= (OUTER_ITER, BGS_ADJ_PRESSURE[0], BGS_ADJ_TEMPERATURE[0], BGS_ADJ_TEMPERATURE[1]) +SCREEN_OUTPUT= (OUTER_ITER, BGS_ADJ_PRESSURE[0], BGS_ADJ_ENTHALPY[0], BGS_ADJ_TEMPERATURE[1]) SCREEN_WRT_FREQ_OUTER= 100 % HISTORY_OUTPUT= ( ITER, BGS_RES[0], BGS_RES[1], RMS_RES[0], RMS_RES[1] ) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/FD_configMaster.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/FD_configMaster.cfg index 66dff17144aa..f00e49f8eb5d 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/FD_configMaster.cfg +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/FD_configMaster.cfg @@ -23,7 +23,7 @@ CONV_RESIDUAL_MINVAL= -26 % FOR GADIENT VALIDATION USE OUTER_ITER= 3000! OUTER_ITER= 101 % -SCREEN_OUTPUT= ( WALL_TIME, OUTER_ITER, BGS_PRESSURE[0], BGS_TEMPERATURE[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1] ) +SCREEN_OUTPUT= ( WALL_TIME, OUTER_ITER, BGS_PRESSURE[0], BGS_ENTHALPY[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1] ) SCREEN_WRT_FREQ_OUTER= 100 % HISTORY_OUTPUT= ( ITER, BGS_RES[0], BGS_RES[1], RMS_RES[0], RMS_RES[1], STREAMWISE_PERIODIC[0], FLOW_COEFF[0], AERO_COEFF[0], HEAT[1] ) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configMaster.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configMaster.cfg index 0ec6bbadb332..229ca813cb04 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configMaster.cfg +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configMaster.cfg @@ -21,7 +21,7 @@ CONV_RESIDUAL_MINVAL= -26 % OUTER_ITER= 4000 % -SCREEN_OUTPUT= ( OUTER_ITER, BGS_PRESSURE[0], BGS_TEMPERATURE[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1], SURFACE_MASSFLOW[0] ) +SCREEN_OUTPUT= ( OUTER_ITER, BGS_PRESSURE[0], BGS_ENTHALPY[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1], SURFACE_MASSFLOW[0] ) SCREEN_WRT_FREQ_OUTER= 100 % HISTORY_OUTPUT= ( ITER, BGS_RES[0], BGS_RES[1], RMS_RES[0], RMS_RES[1], STREAMWISE_PERIODIC[0], FLOW_COEFF[0], FLOW_COEFF_SURF[0], HEAT[1], LINSOL[0], LINSOL[1], HEAT[0] ) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg index f9626ad040e6..b8b591c13dc0 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg @@ -21,7 +21,7 @@ MARKER_CHT_INTERFACE= (fluid_bottom_interface, solid_bottom_interface, fluid_pin OUTER_ITER = 31 % CONV_RESIDUAL_MINVAL= -26 -SCREEN_OUTPUT= (OUTER_ITER, BGS_PRESSURE[0], BGS_TEMPERATURE[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1], TOTAL_HEATFLUX[0] ) +SCREEN_OUTPUT= (OUTER_ITER, BGS_PRESSURE[0], BGS_ENTHALPY[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1], TOTAL_HEATFLUX[0] ) SCREEN_WRT_FREQ_OUTER= 10 % HISTORY_OUTPUT= ( ITER, RMS_RES[0], RMS_RES[1], STREAMWISE_PERIODIC[0], FLOW_COEFF[0], HEAT[1] ) From e2a80e69fb5aea3f54e51e478b1ccb0454d34a62 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Thu, 9 Oct 2025 10:07:03 +0200 Subject: [PATCH 59/97] avoid duplicating enthalpy output for flamelet solver --- SU2_CFD/src/output/CFlowIncOutput.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index 9671ab08ab65..fb872e6879a1 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -306,7 +306,7 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ if (nDim == 3) AddVolumeOutput("VELOCITY-Z", "Velocity_z", "SOLUTION", "z-component of the velocity vector"); if (weakly_coupled_heat) AddVolumeOutput("TEMPERATURE", "Temperature", "SOLUTION", "Temperature"); - if (heat || flamelet) AddVolumeOutput("ENTHALPY", "Enthalpy", "SOLUTION", "Enthalpy"); + if (heat) AddVolumeOutput("ENTHALPY", "Enthalpy", "SOLUTION", "Enthalpy"); SetVolumeOutputFieldsScalarSolution(config); @@ -410,7 +410,7 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve if (nDim == 3) SetVolumeOutputValue("VELOCITY-Z", iPoint, Node_Flow->GetSolution(iPoint, 3)); - if (heat || flamelet) { + if (heat) { SetVolumeOutputValue("ENTHALPY", iPoint, Node_Flow->GetSolution(iPoint, nDim+1)); } if (weakly_coupled_heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Heat->GetSolution(iPoint, 0)); From 23fe4257be00936448c591de168205efaaa043ed Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Thu, 9 Oct 2025 10:24:39 +0200 Subject: [PATCH 60/97] renaming LIMITER_TEMPERATURE to LIMITER_ENTHALPY --- SU2_CFD/src/output/CFlowIncOutput.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index fb872e6879a1..518f3b430909 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -365,8 +365,9 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("LIMITER_VELOCITY-Y", "Limiter_Velocity_y", "LIMITER", "Limiter value of the y-velocity"); if (nDim == 3) AddVolumeOutput("LIMITER_VELOCITY-Z", "Limiter_Velocity_z", "LIMITER", "Limiter value of the z-velocity"); - if (heat || weakly_coupled_heat || flamelet) + if (weakly_coupled_heat) AddVolumeOutput("LIMITER_TEMPERATURE", "Limiter_Temperature", "LIMITER", "Limiter value of the temperature"); + if (heat) AddVolumeOutput("LIMITER_ENTHALPY", "Limiter_Enthalpy", "LIMITER", "Limiter value of the enthalpy"); } SetVolumeOutputFieldsScalarLimiter(config); @@ -454,8 +455,10 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve SetVolumeOutputValue("LIMITER_VELOCITY-Y", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 2)); if (nDim == 3) SetVolumeOutputValue("LIMITER_VELOCITY-Z", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 3)); - if (heat || weakly_coupled_heat) + if (weakly_coupled_heat) SetVolumeOutputValue("LIMITER_TEMPERATURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, nDim+1)); + if (heat) + SetVolumeOutputValue("LIMITER_ENTHALPY", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, nDim+1)); } // All turbulence and species outputs. From e8f9571c09a5fe7ccaa01bdd7caebced17faf8d9 Mon Sep 17 00:00:00 2001 From: Cristopher Morales <98025159+Cristopher-Morales@users.noreply.github.com> Date: Thu, 9 Oct 2025 16:29:28 +0200 Subject: [PATCH 61/97] Update SU2_CFD/include/numerics/flow/convection/centered.hpp Co-authored-by: Nijso --- SU2_CFD/include/numerics/flow/convection/centered.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/numerics/flow/convection/centered.hpp b/SU2_CFD/include/numerics/flow/convection/centered.hpp index 2573827e4278..4e18c9f08fa4 100644 --- a/SU2_CFD/include/numerics/flow/convection/centered.hpp +++ b/SU2_CFD/include/numerics/flow/convection/centered.hpp @@ -49,7 +49,7 @@ class CCentLaxInc_Flow final : public CNumerics { MeanDensity, MeanPressure, MeanBetaInc2, MeanEnthalpy, MeanCp, MeanTemperature, /*!< \brief Mean values of primitive variables. */ - MeandRhodh, /*!< \brief Derivative of density w.r.t. temperature (variable density flows). */ + MeandRhodh, /*!< \brief Derivative of density w.r.t. enthalpy (variable density flows). */ Param_p, Param_Kappa_0, /*!< \brief Artificial dissipation parameters. */ Local_Lambda_i, Local_Lambda_j, MeanLambda, /*!< \brief Local eingenvalues. */ From 66de4bce4fd51874a3ef04760fb8393cb0c4b7db Mon Sep 17 00:00:00 2001 From: Cristopher Morales <98025159+Cristopher-Morales@users.noreply.github.com> Date: Thu, 9 Oct 2025 16:29:37 +0200 Subject: [PATCH 62/97] Update SU2_CFD/include/numerics/flow/convection/centered.hpp Co-authored-by: Nijso --- SU2_CFD/include/numerics/flow/convection/centered.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/numerics/flow/convection/centered.hpp b/SU2_CFD/include/numerics/flow/convection/centered.hpp index 4e18c9f08fa4..e8c1c3813b10 100644 --- a/SU2_CFD/include/numerics/flow/convection/centered.hpp +++ b/SU2_CFD/include/numerics/flow/convection/centered.hpp @@ -109,7 +109,7 @@ class CCentJSTInc_Flow final : public CNumerics { MeanDensity, MeanPressure, MeanBetaInc2, MeanEnthalpy, MeanCp, MeanTemperature, /*!< \brief Mean values of primitive variables. */ - MeandRhodh, /*!< \brief Derivative of density w.r.t. temperature (variable density flows). */ + MeandRhodh, /*!< \brief Derivative of density w.r.t. enthalpy (variable density flows). */ Param_p, Param_Kappa_2, Param_Kappa_4, /*!< \brief Artificial dissipation parameters. */ Local_Lambda_i, Local_Lambda_j, From b051888000694296d0439b812b2f568f11159b87 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Mon, 13 Oct 2025 20:51:54 +0200 Subject: [PATCH 63/97] adding eddy diffusivity in enthalpy diffusion --- SU2_CFD/include/fluid/CFluidScalar.hpp | 1 + SU2_CFD/src/fluid/CFluidScalar.cpp | 4 ++++ SU2_CFD/src/solvers/CIncNSSolver.cpp | 2 ++ 3 files changed, 7 insertions(+) diff --git a/SU2_CFD/include/fluid/CFluidScalar.hpp b/SU2_CFD/include/fluid/CFluidScalar.hpp index 33da061bac1e..9614402c0c0f 100644 --- a/SU2_CFD/include/fluid/CFluidScalar.hpp +++ b/SU2_CFD/include/fluid/CFluidScalar.hpp @@ -45,6 +45,7 @@ class CFluidScalar final : public CFluidModel { const su2double Ref_Temperature; /*!< \brief Reference temperature. */ const su2double GasConstant_Ref; /*!< \brief Gas constant reference needed for Nondimensional problems. */ const su2double Prandtl_Number; /*!< \brief Prandlt number.*/ + const su2double Schmidt_Turb_Number; /*!< \brief Prandlt number.*/ const bool wilke; const bool davidson; diff --git a/SU2_CFD/src/fluid/CFluidScalar.cpp b/SU2_CFD/src/fluid/CFluidScalar.cpp index c0cf3e1cc8cf..56f11aab78ce 100644 --- a/SU2_CFD/src/fluid/CFluidScalar.cpp +++ b/SU2_CFD/src/fluid/CFluidScalar.cpp @@ -48,6 +48,7 @@ CFluidScalar::CFluidScalar(su2double value_pressure_operating, const CConfig* co Ref_Temperature(config->GetStandard_RefTemperatureND()), GasConstant_Ref(config->GetGas_Constant_Ref()), Prandtl_Number(config->GetPrandtl_Turb()), + Schmidt_Turb_Number(config->GetSchmidt_Number_Turbulent()), wilke(config->GetKind_MixingViscosityModel() == MIXINGVISCOSITYMODEL::WILKE), davidson(config->GetKind_MixingViscosityModel() == MIXINGVISCOSITYMODEL::DAVIDSON) { if (n_species_mixture > ARRAYSIZE) { @@ -228,6 +229,7 @@ void CFluidScalar::GetEnthalpyDiffusivity(su2double* enthalpy_diffusions) { const su2double enthalpy_species_i = specificHeat[iVar] * (Temperature - Ref_Temperature); 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; } } @@ -236,6 +238,8 @@ void CFluidScalar::GetGradEnthalpyDiffusivity(su2double* grad_enthalpy_diffusion grad_enthalpy_diffusions[iVar] = Density * (specificHeat[iVar] * massDiffusivity[iVar] - specificHeat[n_species_mixture - 1] * massDiffusivity[n_species_mixture - 1]); + grad_enthalpy_diffusions[iVar] += + Mu_Turb * (specificHeat[iVar] - specificHeat[n_species_mixture - 1]) / Schmidt_Turb_Number; } } diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index 7b6969478777..cae0bbe03d4a 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -329,6 +329,7 @@ void CIncNSSolver::Compute_Enthalpy_Diffusion(unsigned long iEdge, CGeometry* ge su2double EnthalpyDiffusion_i[MAXNVAR_SPECIES]{0.0}; su2double GradEnthalpyDiffusion_i[MAXNVAR_SPECIES]{0.0}; FluidModel->SetTDState_T(nodes->GetPrimitive(iPoint)[prim_idx.Temperature()], Species_i); + FluidModel->SetEddyViscosity(nodes->GetPrimitive(iPoint)[prim_idx.EddyViscosity()]); FluidModel->GetEnthalpyDiffusivity(EnthalpyDiffusion_i); if (implicit) FluidModel->GetGradEnthalpyDiffusivity(GradEnthalpyDiffusion_i); @@ -337,6 +338,7 @@ void CIncNSSolver::Compute_Enthalpy_Diffusion(unsigned long iEdge, CGeometry* ge su2double EnthalpyDiffusion_j[MAXNVAR_SPECIES]{0.0}; su2double GradEnthalpyDiffusion_j[MAXNVAR_SPECIES]{0.0}; FluidModel->SetTDState_T(nodes->GetPrimitive(jPoint)[prim_idx.Temperature()], Species_j); + FluidModel->SetEddyViscosity(nodes->GetPrimitive(jPoint)[prim_idx.EddyViscosity()]); FluidModel->GetEnthalpyDiffusivity(EnthalpyDiffusion_j); if (implicit) FluidModel->GetGradEnthalpyDiffusivity(GradEnthalpyDiffusion_j); From f990a5569c498fc672f1f23af99ff0f617a1bb88 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Wed, 22 Oct 2025 17:13:10 +0200 Subject: [PATCH 64/97] updating residuals species transport --- TestCases/parallel_regression.py | 14 +++++++------- TestCases/tutorials.py | 2 +- TestCases/vandv.py | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index c5f601cefcfe..e28b1676a2b9 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1585,7 +1585,7 @@ def main(): species2_primitiveVenturi_mixingmodel_viscosity.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_viscosity.cfg_file = "species2_primitiveVenturi_mixingmodel_viscosity.cfg" species2_primitiveVenturi_mixingmodel_viscosity.test_iter = 50 - species2_primitiveVenturi_mixingmodel_viscosity.test_vals = [-5.236181, -3.624224, -3.871405, -7.533947, -5.128207, 5.000000, -1.678081, 5.000000, -3.489246, 5.000000, -2.086184, 2.495408, 0.985469, 0.600247, 0.909691] + species2_primitiveVenturi_mixingmodel_viscosity.test_vals = [-5.239118, -3.624947, -3.874462, -7.535191, -5.130418, 5.000000, -1.677376, 5.000000, -3.493540, 5.000000, -2.085009, 2.495398, 0.985401, 0.600225, 0.909772] test_list.append(species2_primitiveVenturi_mixingmodel_viscosity) # 2 species (1 eq) primitive venturi mixing using mixing model including heat capacity and mass diffusivity @@ -1593,7 +1593,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_iter = 50 - species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-5.824280, -4.632628, -4.560106, -6.764902, 2.076781, -5.480635, 30.000000, -7.313820, 12.000000, -8.059765, 8.000000, -8.904808, 2.092258, 1.000000, 0.600000, 0.492258] + species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [5.824346, -4.632948, -4.560590, -6.765715, 2.076808, -5.480881, 30.000000, -7.315121, 12.000000, -8.059064, 8.000000, -8.896288, 2.092262, 1.000000, 0.600000, 0.492262] test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2) # 2 species (1 eq) primitive venturi mixing using mixing model including heat capacity and mass diffusivity NonDimensional case @@ -1601,7 +1601,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_iter = 50 - species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.400552, -4.915641, -4.836920, -7.711367, 1.771551, -5.086850, 10.000000, -2.741766, 3.000000, -5.104310, 5.000000, -5.859810, 2.092354, 1.000000, 0.600000, 0.492354] + species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.400769, -4.916015, -4.837449, -7.711760, 1.771402, -5.087077, 10.000000, -2.744436, 3.000000, -5.095706, 5.000000, -5.856784, 2.092358, 1.000000, 0.600000, 0.492358] test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND) # 2 species (1 eq) primitive venturi mixing using mixing model solving enthalpy equation using preconditioning + JST convective scheme @@ -1641,7 +1641,7 @@ def main(): species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.cfg_file = "species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.cfg" species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.test_iter = 50 - species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.test_vals = [-4.552043, -1.787188, -1.552953, -0.964948, 1.707903, -3.855700, 24.000000, -5.203239, 10.000000, -5.176998, 3.000000, -5.329906, 2.000000, 1.000000, 0.000000, 1.000000] + species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.test_vals = [-4.767010, -1.818299, -1.842427, -0.615338, 1.366173, -3.921308, 21.000000, -5.213096, 9.000000, -5.422897, 4.000000, -5.919063, 2.000000, 1.000000, 0.000000, 1.000000] test_list.append(species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS) # 3 species (2 eq) primitive venturi mixing with inlet files. @@ -1658,8 +1658,8 @@ def main(): species_passive_val.cfg_dir = "species_transport/passive_transport_validation" species_passive_val.cfg_file = "passive_transport.cfg" species_passive_val.test_iter = 50 - species_passive_val.test_vals = [-16.561013, -16.280437, -16.910003, -4.257599, 10.000000, -4.457215, 8.000000, -5.193350, 0.186610, 0.000000] - species_passive_val.test_vals_aarch64 = [-16.538551, -16.312552, -16.882823, -4.257599, 10, -4.585464, 8, -5.19335, 0.18661, 0] + species_passive_val.test_vals = [-16.499938, -16.287111, -16.904700, -4.257599, 10.000000, -4.504235, 8.000000, -5.193350, 0.186610, 0.000000] + species_passive_val.test_vals_aarch64 = [-16.499938, -16.287111, -16.904700, -4.257599, 10.000000, -4.504235, 8.000000, -5.193350, 0.186610, 0.000000] test_list.append(species_passive_val) # rectangle active 2-species transport @@ -1676,7 +1676,7 @@ def main(): species3_multizone_restart.cfg_dir = "species_transport/multizone" species3_multizone_restart.cfg_file = "configMaster.cfg" species3_multizone_restart.test_iter = 5 - species3_multizone_restart.test_vals = [-4.717939, -4.785805] + species3_multizone_restart.test_vals = [-4.634484, -4.515504] species3_multizone_restart.multizone = True test_list.append(species3_multizone_restart) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index 0d9dc7e4cbf0..d1e3f6924f08 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -152,7 +152,7 @@ def main(): kenics_mixer_tutorial.cfg_dir = "../Tutorials/incompressible_flow/Inc_Species_Transport_Composition_Dependent_Model" kenics_mixer_tutorial.cfg_file = "kenics_mixer_tutorial.cfg" kenics_mixer_tutorial.test_iter = 10 - kenics_mixer_tutorial.test_vals = [-7.489818, -6.823672, -6.838301, -6.378918, -7.906045, -3.060796, -7.447919, 5.000000, -1.861690, 4.000000, -5.319671, 3.000000, -6.376137, 0.025476, 0.000000, 0.025476, 0.000000, 64.093000, 8.470600, 48.094000, 7.527900] + kenics_mixer_tutorial.test_vals = [-7.490303, -6.823796, -6.838369, -6.383332, -7.907780, -3.062276, -7.451176, 5.000000, -1.858354, 4.000000, -5.318193, 3.000000, -6.371744, 0.025671, 0.000000, 0.025671, 0.000000, 62.846000, 8.470600, 46.847000, 7.527900] kenics_mixer_tutorial.command = TestCase.Command("mpirun -n 2", "SU2_CFD") test_list.append(kenics_mixer_tutorial) diff --git a/TestCases/vandv.py b/TestCases/vandv.py index 3aedecc2b3c9..975e058dd025 100644 --- a/TestCases/vandv.py +++ b/TestCases/vandv.py @@ -109,8 +109,8 @@ def main(): sandiajet_sst.cfg_dir = "vandv/species_transport/sandia_jet" sandiajet_sst.cfg_file = "validation.cfg" sandiajet_sst.test_iter = 5 - sandiajet_sst.test_vals = [-17.176580, -13.874388, -15.527373, -12.642932, -10.076847, -15.743858, 5.000000, -2.659012, 5.000000, -5.009351, 5.000000, -3.986162, 0.000257, 0.000000, 0.000000, 0.000257, 4020.500000, 3919.900000, 49.151000, 51.435000] - sandiajet_sst.test_vals_aarch64 = [-17.069026, -13.156800, -15.290567, -11.689831, -9.349978, -14.907311, 5.000000, -2.738947, 5.000000, -4.813747, 5.000000, -3.981740, 0.000259, 0.000000, 0.000000, 0.000259, 4047.400000, 3946.800000, 49.161000, 51.433000] + sandiajet_sst.test_vals = [-8.271400, -6.305945, -6.123143, -5.634565, -1.687556, -7.869775, 5.000000, -1.527449, 5.000000, -4.053788, 5.000000, -2.303502, 0.000257, 0.000000, 0.000000, 0.000257, 4020.500000, 3919.900000, 49.151000, 51.436000] + sandiajet_sst.test_vals_aarch64 = [-8.271400, -6.305945, -6.123143, -5.634565, -1.687556, -7.869775, 5.000000, -1.527449, 5.000000, -4.053788, 5.000000, -2.303502, 0.000257, 0.000000, 0.000000, 0.000257, 4020.500000, 3919.900000, 49.151000, 51.436000] test_list.append(sandiajet_sst) ################# From 9224935bee90291369c78016b818899c43e94899 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Wed, 22 Oct 2025 20:44:05 +0200 Subject: [PATCH 65/97] updating residuals --- SU2_CFD/src/output/CAdjFlowIncOutput.cpp | 18 ++++++++++++------ SU2_CFD/src/output/CFlowIncOutput.cpp | 13 +++++++++---- TestCases/hybrid_regression.py | 8 ++++---- TestCases/parallel_regression.py | 20 ++++++++++---------- TestCases/serial_regression.py | 8 ++++---- 5 files changed, 39 insertions(+), 28 deletions(-) diff --git a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp index 9844df0e8bb7..60dd0f9318d0 100644 --- a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp @@ -316,10 +316,13 @@ void CAdjFlowIncOutput::SetVolumeOutputFields(CConfig *config) { /// DESCRIPTION: Adjoint Velocity z-component. AddVolumeOutput("ADJ_VELOCITY-Z", "Adjoint_Velocity_z", "SOLUTION", "z-component of the adjoint velocity vector"); } - /// DESCRIPTION: Adjoint Temperature. - AddVolumeOutput("ADJ_TEMPERATURE", "Adjoint_Temperature", "SOLUTION", "Adjoint temperature"); - /// DESCRIPTION: Adjoint Enthalpy. - AddVolumeOutput("ADJ_ENTHALPY", "Adjoint_Enthalpy", "SOLUTION", "Adjoint_Enthalpy"); + if (weakly_coupled_heat) { + /// DESCRIPTION: Adjoint Temperature. + AddVolumeOutput("ADJ_TEMPERATURE", "Adjoint_Temperature", "SOLUTION", "Adjoint temperature"); + } else { + /// DESCRIPTION: Adjoint Enthalpy. + AddVolumeOutput("ADJ_ENTHALPY", "Adjoint_Enthalpy", "SOLUTION", "Adjoint_Enthalpy"); + } SetVolumeOutputFieldsAdjScalarSolution(config); @@ -349,8 +352,11 @@ void CAdjFlowIncOutput::SetVolumeOutputFields(CConfig *config) { AddVolumeOutput("RES_ADJ_VELOCITY-Z", "Residual_Adjoint_Velocity_z", "RESIDUAL", "Residual of the adjoint z-velocity"); } /// DESCRIPTION: Residual of the adjoint energy. - - AddVolumeOutput("RES_ADJ_ENTHALPY", "Residual_Adjoint_Heat", "RESIDUAL", "Residual of the adjoint enthalpy"); + if (weakly_coupled_heat) { + AddVolumeOutput("RES_ADJ_TEMPERATURE", "Residual_Adjoint_Heat", "RESIDUAL", "Residual of the adjoint temperature"); + } else { + AddVolumeOutput("RES_ADJ_ENTHALPY", "Residual_Adjoint_Heat", "RESIDUAL", "Residual of the adjoint enthalpy"); + } SetVolumeOutputFieldsAdjScalarResidual(config); diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index 518f3b430909..a399c5c02dae 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -367,7 +367,10 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("LIMITER_VELOCITY-Z", "Limiter_Velocity_z", "LIMITER", "Limiter value of the z-velocity"); if (weakly_coupled_heat) AddVolumeOutput("LIMITER_TEMPERATURE", "Limiter_Temperature", "LIMITER", "Limiter value of the temperature"); - if (heat) AddVolumeOutput("LIMITER_ENTHALPY", "Limiter_Enthalpy", "LIMITER", "Limiter value of the enthalpy"); + if (heat) { + AddVolumeOutput("LIMITER_TEMPERATURE", "Limiter_Temperature", "LIMITER", "Limiter value of the temperature"); + AddVolumeOutput("LIMITER_ENTHALPY", "Limiter_Enthalpy", "LIMITER", "Limiter value of the enthalpy"); + } } SetVolumeOutputFieldsScalarLimiter(config); @@ -437,7 +440,7 @@ 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)); - 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)); @@ -457,8 +460,10 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve SetVolumeOutputValue("LIMITER_VELOCITY-Z", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 3)); if (weakly_coupled_heat) SetVolumeOutputValue("LIMITER_TEMPERATURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, nDim+1)); - if (heat) - SetVolumeOutputValue("LIMITER_ENTHALPY", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, nDim+1)); + if (heat){ + SetVolumeOutputValue("LIMITER_TEMPERATURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, nDim+1)); + SetVolumeOutputValue("LIMITER_ENTHALPY", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, nDim+3)); + } } // All turbulence and species outputs. diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index 66cc54ecbd45..3167df46f91f 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -381,8 +381,8 @@ def main(): inc_poly_cylinder.cfg_dir = "incomp_navierstokes/cylinder" inc_poly_cylinder.cfg_file = "poly_cylinder.cfg" inc_poly_cylinder.test_iter = 20 - inc_poly_cylinder.test_vals = [-7.827942, -2.061513, 0.029525, 1.953498, -174.780000] - inc_poly_cylinder.test_vals_aarch64 = [-7.827942, -2.061513, 0.029525, 1.953498, -174.780000] + inc_poly_cylinder.test_vals = [-7.815180, -2.022515, 0.029270, 1.948239, -175.610000] + inc_poly_cylinder.test_vals_aarch64 = [-7.815180, -2.022515, 0.029270, 1.948239, -175.610000] test_list.append(inc_poly_cylinder) # X-coarse laminar bend as a mixed element CGNS test @@ -666,8 +666,8 @@ def main(): slinc_steady.cfg_dir = "sliding_interface/incompressible_steady" slinc_steady.cfg_file = "config.cfg" slinc_steady.test_iter = 19 - slinc_steady.test_vals = [19.000000, -1.799803, -2.128200] - slinc_steady.test_vals_aarch64 = [19.000000, -1.799803, -2.128199] + slinc_steady.test_vals = [19.000000, -1.048446, -1.324274] + slinc_steady.test_vals_aarch64 = [19.000000, -1.048446, -1.324274] slinc_steady.multizone = True test_list.append(slinc_steady) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index e28b1676a2b9..22be1264022e 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -47,7 +47,7 @@ def main(): cfd_flamelet_ch4.cfg_dir = "flamelet/01_laminar_premixed_ch4_flame_cfd" cfd_flamelet_ch4.cfg_file = "lam_prem_ch4_cfd.cfg" cfd_flamelet_ch4.test_iter = 10 - cfd_flamelet_ch4.test_vals = [-14.297190, -12.593356, -14.249342, -6.069757, -14.816955, -17.057821] + cfd_flamelet_ch4.test_vals = [-11.167959, -10.484323, -12.764338, -5.876637, -13.407242, -17.032153] cfd_flamelet_ch4.new_output = True test_list.append(cfd_flamelet_ch4) @@ -56,7 +56,7 @@ def main(): cfd_flamelet_ch4_axi.cfg_dir = "flamelet/05_laminar_premixed_ch4_flame_cfd_axi" cfd_flamelet_ch4_axi.cfg_file = "lam_prem_ch4_cfd_axi.cfg" cfd_flamelet_ch4_axi.test_iter = 10 - cfd_flamelet_ch4_axi.test_vals = [-10.935482, -11.477701, -11.302709, -12.734435, -6.110542] + cfd_flamelet_ch4_axi.test_vals = [-10.083640, -11.327840, -10.714798, -12.750041, -6.112100] cfd_flamelet_ch4_axi.new_output = True test_list.append(cfd_flamelet_ch4_axi) @@ -65,7 +65,7 @@ def main(): cfd_flamelet_ch4_partial_premix.cfg_dir = "flamelet/06_laminar_partial_premixed_ch4_flame_cfd" cfd_flamelet_ch4_partial_premix.cfg_file = "lam_partial_prem_ch4_cfd.cfg" cfd_flamelet_ch4_partial_premix.test_iter = 10 - cfd_flamelet_ch4_partial_premix.test_vals = [-9.645814, -11.304194, -3.675580, -13.158500, -11.087904] + cfd_flamelet_ch4_partial_premix.test_vals = [-8.734770, -11.306471, -3.675618, -12.808760, -11.088026] cfd_flamelet_ch4_partial_premix.new_output = True test_list.append(cfd_flamelet_ch4_partial_premix) @@ -74,7 +74,7 @@ def main(): cfd_flamelet_h2.cfg_dir = "flamelet/07_laminar_premixed_h2_flame_cfd" cfd_flamelet_h2.cfg_file = "laminar_premixed_h2_flame_cfd.cfg" cfd_flamelet_h2.test_iter = 5 - cfd_flamelet_h2.test_vals = [-10.006096, -9.844001, -3.290043, -11.338465] + cfd_flamelet_h2.test_vals = [-9.984960, -9.843830, -3.289852, -11.338450] cfd_flamelet_h2.new_output = True test_list.append(cfd_flamelet_h2) @@ -610,7 +610,7 @@ def main(): inc_poly_cylinder.cfg_dir = "incomp_navierstokes/cylinder" inc_poly_cylinder.cfg_file = "poly_cylinder.cfg" inc_poly_cylinder.test_iter = 20 - inc_poly_cylinder.test_vals = [-7.786564, -2.036735, 0.012980, 1.944887, -170.930000] + inc_poly_cylinder.test_vals = [-7.866943, -1.883455, 0.043885, 1.935798, -148.430000] test_list.append(inc_poly_cylinder) # X-coarse laminar bend as a mixed element CGNS test @@ -1202,7 +1202,7 @@ def main(): slinc_steady.cfg_dir = "sliding_interface/incompressible_steady" slinc_steady.cfg_file = "config.cfg" slinc_steady.test_iter = 19 - slinc_steady.test_vals = [19.000000, -1.778863, -2.040209] + slinc_steady.test_vals = [19.000000, -1.012869, -1.222087] slinc_steady.timeout = 100 slinc_steady.tol = 0.00002 slinc_steady.multizone = True @@ -1310,7 +1310,7 @@ def main(): p1rad.cfg_dir = "radiation/p1model" p1rad.cfg_file = "configp1.cfg" p1rad.test_iter = 100 - p1rad.test_vals = [-7.743666, -7.921411, -2.111848, 0.098302, -47.897000] + p1rad.test_vals = [-7.639646, -7.433603, -0.546639, 0.013226, -133.880000] test_list.append(p1rad) @@ -1336,7 +1336,7 @@ def main(): cht_incompressible.cfg_dir = "coupled_cht/incomp_2d" cht_incompressible.cfg_file = "cht_2d_3cylinders.cfg" cht_incompressible.test_iter = 10 - cht_incompressible.test_vals = [-2.128827, -0.588812, -0.588812, -0.588812] + cht_incompressible.test_vals = [-1.376348, -0.591208, -0.591208, -0.591208] cht_incompressible.multizone = True test_list.append(cht_incompressible) @@ -1593,7 +1593,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_iter = 50 - species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [5.824346, -4.632948, -4.560590, -6.765715, 2.076808, -5.480881, 30.000000, -7.315121, 12.000000, -8.059064, 8.000000, -8.896288, 2.092262, 1.000000, 0.600000, 0.492262] + species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-5.824346, -4.632948, -4.560590, -6.765715, 2.076808, -5.480881, 30.000000, -7.315121, 12.000000, -8.059064, 8.000000, -8.896288, 2.092262, 1.000000, 0.600000, 0.492262] test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2) # 2 species (1 eq) primitive venturi mixing using mixing model including heat capacity and mass diffusivity NonDimensional case @@ -1702,7 +1702,7 @@ def main(): cfd_flamelet_ch4_cht.cfg_dir = "flamelet/03_laminar_premixed_ch4_flame_cht_cfd" cfd_flamelet_ch4_cht.cfg_file = "lam_prem_ch4_cht_cfd_master.cfg" cfd_flamelet_ch4_cht.test_iter = 5 - cfd_flamelet_ch4_cht.test_vals = [-10.166224, -9.299576, -10.022482, -11.907558, -3.447626, -12.290421, -13.719415, -6.864920] + cfd_flamelet_ch4_cht.test_vals = [-7.209184, -6.102044, -7.491447, -9.317122, -3.204897, -9.811662, -13.554684, -6.864880] cfd_flamelet_ch4_cht.timeout = 1600 cfd_flamelet_ch4_cht.multizone = True test_list.append(cfd_flamelet_ch4_cht) diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 38398445c53b..a69c6f1abe74 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -414,7 +414,7 @@ def main(): inc_poly_cylinder.cfg_dir = "incomp_navierstokes/cylinder" inc_poly_cylinder.cfg_file = "poly_cylinder.cfg" inc_poly_cylinder.test_iter = 20 - inc_poly_cylinder.test_vals = [-8.083556, -2.134369, 0.018999, 1.932938, -173.730000] + inc_poly_cylinder.test_vals = [-8.081693, -2.114336, 0.018545, 1.927744, -173.800000] test_list.append(inc_poly_cylinder) # X-coarse laminar bend as a mixed element CGNS test @@ -981,7 +981,7 @@ def main(): slinc_steady.cfg_dir = "sliding_interface/incompressible_steady" slinc_steady.cfg_file = "config.cfg" slinc_steady.test_iter = 19 - slinc_steady.test_vals = [19.000000, -1.803732, -2.108492] + slinc_steady.test_vals = [19.000000, -1.049468, -1.303013] slinc_steady.timeout = 100 slinc_steady.multizone = True test_list.append(slinc_steady) @@ -1093,7 +1093,7 @@ def main(): p1rad.cfg_dir = "radiation/p1model" p1rad.cfg_file = "configp1.cfg" p1rad.test_iter = 100 - p1rad.test_vals = [-7.751309, -7.923059, -2.119084, 0.091733, -47.387000] + p1rad.test_vals = [-7.641761, -7.438020, -0.541910, 0.003913, -133.770000] test_list.append(p1rad) # ############################### @@ -1112,7 +1112,7 @@ def main(): cht_incompressible.cfg_dir = "coupled_cht/incomp_2d" cht_incompressible.cfg_file = "cht_2d_3cylinders.cfg" cht_incompressible.test_iter = 10 - cht_incompressible.test_vals = [-2.128826, -0.588813, -0.588813, -0.588813] + cht_incompressible.test_vals = [-1.376347, -0.591210, -0.591210, -0.591210] cht_incompressible.multizone = True test_list.append(cht_incompressible) From 051c2016fcbf2cca9fef235490524837d5fea329 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Wed, 22 Oct 2025 22:29:26 +0200 Subject: [PATCH 66/97] update residual and fixing output temperature --- SU2_CFD/src/output/CFlowIncOutput.cpp | 4 ++-- TestCases/hybrid_regression_AD.py | 4 ++-- TestCases/parallel_regression_AD.py | 2 +- TestCases/serial_regression_AD.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index a399c5c02dae..bdb55e597849 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -330,7 +330,7 @@ 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"); - AddVolumeOutput("TEMPERATURE", "Temperature", "PRIMITIVE", "Temperature"); + if ((!weakly_coupled_heat && heat) || flamelet) 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"); @@ -440,7 +440,7 @@ 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 (!weakly_coupled_heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetTemperature(iPoint)); + if ((!weakly_coupled_heat && heat) || flamelet) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetTemperature(iPoint)); } SetVolumeOutputValue("RES_PRESSURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 0)); diff --git a/TestCases/hybrid_regression_AD.py b/TestCases/hybrid_regression_AD.py index 1107f9814eb3..560bb6c91dd4 100644 --- a/TestCases/hybrid_regression_AD.py +++ b/TestCases/hybrid_regression_AD.py @@ -110,8 +110,8 @@ def main(): discadj_incomp_cylinder.cfg_dir = "disc_adj_incomp_navierstokes/cylinder" discadj_incomp_cylinder.cfg_file = "heated_cylinder.cfg" discadj_incomp_cylinder.test_iter = 20 - discadj_incomp_cylinder.test_vals = [20.000000, -2.746353, -2.934792, 0.000000] - discadj_incomp_cylinder.test_vals_aarch64 = [20.000000, -2.746353, -2.934792, 0.000000] + discadj_incomp_cylinder.test_vals = [20.000000, -5.098033, -3.842740, 0.000000] + discadj_incomp_cylinder.test_vals_aarch64 = [20.000000, -5.098033, -3.842740, 0.000000] test_list.append(discadj_incomp_cylinder) ###################################### diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index b3cfea640a1c..5efdbab8b04a 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -116,7 +116,7 @@ def main(): discadj_incomp_cylinder.cfg_dir = "disc_adj_incomp_navierstokes/cylinder" discadj_incomp_cylinder.cfg_file = "heated_cylinder.cfg" discadj_incomp_cylinder.test_iter = 20 - discadj_incomp_cylinder.test_vals = [20.000000, -2.082673, -2.013587, 0.000000] + discadj_incomp_cylinder.test_vals = [20.000000, -5.098033, -3.842740, 0.000000] test_list.append(discadj_incomp_cylinder) ###################################### diff --git a/TestCases/serial_regression_AD.py b/TestCases/serial_regression_AD.py index 7fc8224b2fca..72d2683a5902 100644 --- a/TestCases/serial_regression_AD.py +++ b/TestCases/serial_regression_AD.py @@ -120,7 +120,7 @@ def main(): discadj_incomp_cylinder.cfg_dir = "disc_adj_incomp_navierstokes/cylinder" discadj_incomp_cylinder.cfg_file = "heated_cylinder.cfg" discadj_incomp_cylinder.test_iter = 20 - discadj_incomp_cylinder.test_vals = [20.000000, -2.386480, -2.408986, 0.000000] + discadj_incomp_cylinder.test_vals = [20.000000, -5.098033, -3.842740, 0.000000] test_list.append(discadj_incomp_cylinder) ####################################################### From 07b3f6126836e722654d9e2e0de2c04d9be74614 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Wed, 22 Oct 2025 22:37:36 +0200 Subject: [PATCH 67/97] small cleaning --- SU2_CFD/src/output/CFlowIncOutput.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index bdb55e597849..9d408892cf6e 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -330,7 +330,7 @@ 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 ((!weakly_coupled_heat && heat) || flamelet) AddVolumeOutput("TEMPERATURE", "Temperature", "PRIMITIVE", "Temperature"); + if (heat || flamelet) 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"); @@ -440,7 +440,7 @@ 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 ((!weakly_coupled_heat && heat) || flamelet) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetTemperature(iPoint)); + if (heat || flamelet) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetTemperature(iPoint)); } SetVolumeOutputValue("RES_PRESSURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 0)); From 63a8761e0a10997c45cf55bb2fa19449f9483727 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Thu, 23 Oct 2025 09:09:48 +0200 Subject: [PATCH 68/97] updating residuals --- SU2_CFD/src/output/CAdjFlowIncOutput.cpp | 11 ++++++++--- TestCases/hybrid_regression.py | 2 +- TestCases/serial_regression_AD.py | 6 +++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp index 60dd0f9318d0..1e6c91a4a46b 100644 --- a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp @@ -426,10 +426,15 @@ void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo SetVolumeOutputValue("RES_ADJ_VELOCITY-X", iPoint, Node_AdjFlow->GetSolution(iPoint, 1) - Node_AdjFlow->GetSolution_Old(iPoint, 1)); SetVolumeOutputValue("RES_ADJ_VELOCITY-Y", iPoint, Node_AdjFlow->GetSolution(iPoint, 2) - Node_AdjFlow->GetSolution_Old(iPoint, 2)); if (nDim == 3) { - SetVolumeOutputValue("RES_ADJ_VELOCITY-Z", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); - SetVolumeOutputValue("RES_ADJ_ENTHALPY", iPoint, Node_AdjFlow->GetSolution(iPoint, 4) - Node_AdjFlow->GetSolution_Old(iPoint, 4)); + SetVolumeOutputValue("RES_ADJ_VELOCITY-Z", iPoint, + Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); + if (heat) + SetVolumeOutputValue("RES_ADJ_ENTHALPY", iPoint, + Node_AdjFlow->GetSolution(iPoint, 4) - Node_AdjFlow->GetSolution_Old(iPoint, 4)); } else { - SetVolumeOutputValue("RES_ADJ_ENTHALPY", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); + if (heat) + SetVolumeOutputValue("RES_ADJ_ENTHALPY", iPoint, + Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); } if (config->AddRadiation()) { diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index 3167df46f91f..dd2102f2e2c0 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -419,7 +419,7 @@ def main(): inc_weakly_coupled.cfg_dir = "disc_adj_heat" inc_weakly_coupled.cfg_file = "primal.cfg" inc_weakly_coupled.test_iter = 10 - inc_weakly_coupled.test_vals = [-18.095922, -16.331787, -16.514014, -9.756795, -18.203865, -14.053738, 5.550800] + inc_weakly_coupled.test_vals = [-18.203897, -16.304273, -16.482683, -15.007166, -17.858118, -14.025087, 5.609100] test_list.append(inc_weakly_coupled) ###################################### diff --git a/TestCases/serial_regression_AD.py b/TestCases/serial_regression_AD.py index 72d2683a5902..4eb7a9735732 100644 --- a/TestCases/serial_regression_AD.py +++ b/TestCases/serial_regression_AD.py @@ -120,7 +120,7 @@ def main(): discadj_incomp_cylinder.cfg_dir = "disc_adj_incomp_navierstokes/cylinder" discadj_incomp_cylinder.cfg_file = "heated_cylinder.cfg" discadj_incomp_cylinder.test_iter = 20 - discadj_incomp_cylinder.test_vals = [20.000000, -5.098033, -3.842740, 0.000000] + discadj_incomp_cylinder.test_vals = [20.000000, -5.097821, -3.842739, 0.000000] test_list.append(discadj_incomp_cylinder) ####################################################### @@ -193,7 +193,7 @@ def main(): discadj_heat.cfg_dir = "disc_adj_heat" discadj_heat.cfg_file = "disc_adj_heat.cfg" discadj_heat.test_iter = 10 - discadj_heat.test_vals = [-2.178141, 0.578576, 0.000000, 0.008712] + discadj_heat.test_vals = [-2.685957, 0.665986, 0.000000, -9.155800] test_list.append(discadj_heat) ################################### @@ -217,7 +217,7 @@ def main(): discadj_cht.cfg_dir = "coupled_cht/disc_adj_incomp_2d" discadj_cht.cfg_file = "cht_2d_3cylinders.cfg" discadj_cht.test_iter = 10 - discadj_cht.test_vals = [-2.955506, -3.085551, -3.085518, -3.085513] + discadj_cht.test_vals = [-6.131112, -2.564634, -2.565220, -2.565304] test_list.append(discadj_cht) ###################################### From 42d3e9b70bd17e5ee487618d3e356fcde18259d2 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Thu, 23 Oct 2025 10:13:52 +0200 Subject: [PATCH 69/97] updating residuals --- TestCases/parallel_regression_AD.py | 16 ++++++++-------- TestCases/tutorials.py | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index 5efdbab8b04a..629f42dce486 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -116,7 +116,7 @@ def main(): discadj_incomp_cylinder.cfg_dir = "disc_adj_incomp_navierstokes/cylinder" discadj_incomp_cylinder.cfg_file = "heated_cylinder.cfg" discadj_incomp_cylinder.test_iter = 20 - discadj_incomp_cylinder.test_vals = [20.000000, -5.098033, -3.842740, 0.000000] + discadj_incomp_cylinder.test_vals = [20.000000, -5.181765, -3.840710, 0.000000] test_list.append(discadj_incomp_cylinder) ###################################### @@ -256,8 +256,8 @@ def main(): discadj_heat.cfg_dir = "disc_adj_heat" discadj_heat.cfg_file = "disc_adj_heat.cfg" discadj_heat.test_iter = 10 - discadj_heat.test_vals = [-2.001337, 0.655543, 0.000000, 0.006170] - discadj_heat.test_vals_aarch64 = [-2.226539, 0.605868, 0.000000, -6.256400] + discadj_heat.test_vals = [-1.928244, 0.730865, 0.000000, -3.993500] + discadj_heat.test_vals_aarch64 = [-1.928244, 0.730865, 0.000000, -3.993500] test_list.append(discadj_heat) ################################### @@ -291,7 +291,7 @@ def main(): discadj_cht.cfg_dir = "coupled_cht/disc_adj_incomp_2d" discadj_cht.cfg_file = "cht_2d_3cylinders.cfg" discadj_cht.test_iter = 10 - discadj_cht.test_vals = [-2.955510, -3.085549, -3.085516, -3.085511] + discadj_cht.test_vals = [-6.131109, -2.564634, -2.565220, -2.565303] test_list.append(discadj_cht) # 2D DA cht streamwise periodic case, 2 zones, avg temp objective @@ -317,8 +317,8 @@ def main(): da_unsteadyCHT_cylinder.cfg_dir = "coupled_cht/disc_adj_unsteadyCHT_cylinder" da_unsteadyCHT_cylinder.cfg_file = "chtMaster.cfg" da_unsteadyCHT_cylinder.test_iter = 2 - da_unsteadyCHT_cylinder.test_vals = [-3.508906, -4.317739, -4.241558, -11.836892, -12.862640, 0.000000, 3.688000, 0.295190] - da_unsteadyCHT_cylinder.test_vals_aarch64 = [-3.508906, -4.317739, -4.241558, -11.836892, -12.862650, 0.000000, 3.688000, 0.295190] + da_unsteadyCHT_cylinder.test_vals = [-12.131633, -12.617906, -12.688933, -16.179747, -6.432277, 0.000000, 75.761000, 0.247780] + da_unsteadyCHT_cylinder.test_vals_aarch64 = [-12.131633, -12.617906, -12.688933, -16.179747, -6.432277, 0.000000, 75.761000, 0.247780] da_unsteadyCHT_cylinder.unsteady = True da_unsteadyCHT_cylinder.multizone = True test_list.append(da_unsteadyCHT_cylinder) @@ -333,7 +333,7 @@ def main(): discadj_flamelet_ch4_hx.cfg_file = "lam_prem_ch4_hx_ad.cfg" discadj_flamelet_ch4_hx.multizone = False discadj_flamelet_ch4_hx.test_iter = 10 - discadj_flamelet_ch4_hx.test_vals = [-8.699008, -8.604699, -8.816298, -6.626855, -14.620943, -3.249062, -18.930953] + discadj_flamelet_ch4_hx.test_vals = [-8.717448, -8.450564, -8.766800, -6.626764, -14.602479, -3.248656, -18.930954] test_list.append(discadj_flamelet_ch4_hx) # 2D planar laminar premixed flame on isothermal burner with conjugate heat transfer (restart) @@ -342,7 +342,7 @@ def main(): discadj_flamelet_ch4_cht.cfg_file = "lam_prem_ch4_cht_ad_master.cfg" discadj_flamelet_ch4_cht.multizone = True discadj_flamelet_ch4_cht.test_iter = 10 - discadj_flamelet_ch4_cht.test_vals = [-2.760027, -1.999839, -2.096537, -0.153424, -7.289370, -18.655063, -18.622003, -4.847179] + discadj_flamelet_ch4_cht.test_vals = [-2.764345, -1.998773, -2.082310, -0.140923, -7.287831, -18.655078, -18.622026, -4.847187] test_list.append(discadj_flamelet_ch4_cht) ###################################### diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index d1e3f6924f08..0a0284cd9f03 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -49,7 +49,7 @@ def main(): cht_incompressible_unsteady.cfg_dir = "../Tutorials/multiphysics/unsteady_cht/" cht_incompressible_unsteady.cfg_file = "cht_2d_3cylinders.cfg" cht_incompressible_unsteady.test_iter = 2 - cht_incompressible_unsteady.test_vals = [-2.659390, -2.533160, -0.080399, -0.080399, -0.080399, -12.421450, 0.000000, 0, 0, 0, 0, 2.3824e+02] #last columns + cht_incompressible_unsteady.test_vals = [-2.661443, -2.546289, -0.080399, -0.080399, -0.080399, -12.421980, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 238.240000] #last columns cht_incompressible_unsteady.multizone = True cht_incompressible_unsteady.unsteady = True test_list.append(cht_incompressible_unsteady) @@ -59,7 +59,7 @@ def main(): cht_incompressible.cfg_dir = "../Tutorials/multiphysics/steady_cht" cht_incompressible.cfg_file = "cht_2d_3cylinders.cfg" cht_incompressible.test_iter = 10 - cht_incompressible.test_vals = [-2.128826, -0.588813, -0.588813, -0.588813] #last 4 columns + cht_incompressible.test_vals = [-1.376347, -0.591210, -0.591210, -0.591210] #last 4 columns cht_incompressible.command = TestCase.Command(exec = "SU2_CFD") cht_incompressible.multizone = True test_list.append(cht_incompressible) @@ -69,7 +69,7 @@ def main(): cht_CR.cfg_dir = "../Tutorials/multiphysics/contact_resistance_cht" cht_CR.cfg_file = "master.cfg" cht_CR.test_iter = 80 - cht_CR.test_vals = [-8.606916, -9.227614, -10.411673, -2.114949] + cht_CR.test_vals = [-8.606916, -9.227614, -10.411674, -2.116659] cht_CR.multizone = True test_list.append(cht_CR) @@ -164,7 +164,7 @@ def main(): premixed_hydrogen.cfg_dir = "../Tutorials/incompressible_flow/Inc_Combustion/1__premixed_hydrogen" premixed_hydrogen.cfg_file = "H2_burner.cfg" premixed_hydrogen.test_iter = 10 - premixed_hydrogen.test_vals = [-9.880667, -10.491791, -11.028989, -4.325192, -11.885386] + premixed_hydrogen.test_vals = [-8.851285, -9.756885, -11.037752, -4.321598, -11.891933] test_list.append(premixed_hydrogen) ### Compressible Flow From 3491b37a797fa3019c3cbc9e6ac6c29a48c78c37 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Thu, 23 Oct 2025 11:22:19 +0200 Subject: [PATCH 70/97] updating residuals DAspecies tutorial case --- TestCases/tutorials.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index 0a0284cd9f03..e09a7abc5942 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -142,7 +142,7 @@ def main(): DAspecies3_primitiveVenturi.cfg_dir = "../Tutorials/incompressible_flow/Inc_Species_Transport" DAspecies3_primitiveVenturi.cfg_file = "DAspecies3_primitiveVenturi.cfg" DAspecies3_primitiveVenturi.test_iter = 50 - DAspecies3_primitiveVenturi.test_vals = [-9.806113, -8.630821, -8.666250, -8.333798, -12.914857, -11.017067, -10.232083] + DAspecies3_primitiveVenturi.test_vals = [-9.819097, -8.643457, -8.676919, -8.347340, -12.926241, -9.739487, -8.947991] DAspecies3_primitiveVenturi.test_vals_aarch64 = [-7.865411, -7.548131, -7.347978, -7.217536, -11.822422, -10.968444, -10.193225] DAspecies3_primitiveVenturi.command = TestCase.Command("mpirun -n 2", "SU2_CFD_AD") test_list.append(DAspecies3_primitiveVenturi) From 13985c57924296916ebbc59aba3732b375443849 Mon Sep 17 00:00:00 2001 From: Cristopher Morales <98025159+Cristopher-Morales@users.noreply.github.com> Date: Sun, 26 Oct 2025 20:51:03 +0100 Subject: [PATCH 71/97] Update SU2_CFD/include/variables/CIncEulerVariable.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/include/variables/CIncEulerVariable.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/variables/CIncEulerVariable.hpp b/SU2_CFD/include/variables/CIncEulerVariable.hpp index 2a034e88ebf2..4a57834c2bf1 100644 --- a/SU2_CFD/include/variables/CIncEulerVariable.hpp +++ b/SU2_CFD/include/variables/CIncEulerVariable.hpp @@ -33,7 +33,7 @@ /*! * \class CIncEulerVariable * \brief Class for defining the variables of the incompressible Euler solver. - * \note Primitive variables (P, vx, vy, vz, T, rho,h, beta, lamMu, EddyMu, Kt_eff, Cp, Cv) + * \note Primitive variables (P, vx, vy, vz, T, rho, h, beta, lamMu, EddyMu, Kt_eff, Cp, Cv) * \note Gradients of primitives (P, vx, vy, vz, T, rho, h) * \ingroup Euler_Equations * \author F. Palacios, T. Economon, T. Albring From 8cffbd2fc52b2924dd98fcb976f4247b363f308f Mon Sep 17 00:00:00 2001 From: Cristopher Morales <98025159+Cristopher-Morales@users.noreply.github.com> Date: Sun, 26 Oct 2025 21:31:26 +0100 Subject: [PATCH 72/97] Update SU2_CFD/src/fluid/CFluidScalar.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/src/fluid/CFluidScalar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/fluid/CFluidScalar.cpp b/SU2_CFD/src/fluid/CFluidScalar.cpp index 56f11aab78ce..e7ee98f9e49b 100644 --- a/SU2_CFD/src/fluid/CFluidScalar.cpp +++ b/SU2_CFD/src/fluid/CFluidScalar.cpp @@ -223,7 +223,7 @@ su2double CFluidScalar::ComputeEnthalpyFromT(const su2double val_temperature, co return val_Enthalpy; } -void CFluidScalar::GetEnthalpyDiffusivity(su2double* enthalpy_diffusions) { +void CFluidScalar::GetEnthalpyDiffusivity(su2double* enthalpy_diffusions) const { const su2double enthalpy_species_N = specificHeat[n_species_mixture - 1] * (Temperature - Ref_Temperature); for (int iVar = 0; iVar < n_species_mixture - 1; iVar++) { const su2double enthalpy_species_i = specificHeat[iVar] * (Temperature - Ref_Temperature); From e5c3992d818eb71325d4a10909e33b2900e0964c Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sun, 26 Oct 2025 22:11:12 +0100 Subject: [PATCH 73/97] addressing comments part 1 --- SU2_CFD/include/fluid/CFluidModel.hpp | 4 ++-- SU2_CFD/include/fluid/CFluidScalar.hpp | 4 ++-- SU2_CFD/include/solvers/CIncEulerSolver.hpp | 2 +- SU2_CFD/src/fluid/CFluidScalar.cpp | 2 +- SU2_CFD/src/numerics/flow/convection/centered.cpp | 11 ++--------- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/SU2_CFD/include/fluid/CFluidModel.hpp b/SU2_CFD/include/fluid/CFluidModel.hpp index fe0c112badda..7c9e7391945f 100644 --- a/SU2_CFD/include/fluid/CFluidModel.hpp +++ b/SU2_CFD/include/fluid/CFluidModel.hpp @@ -195,12 +195,12 @@ class CFluidModel { /*! * \brief Get heat diffusivity terms. */ - virtual void GetEnthalpyDiffusivity(su2double* enthalpy_diffusions = nullptr) {} + virtual void GetEnthalpyDiffusivity(su2double* enthalpy_diffusions = nullptr) const {} /*! * \brief Get gradient heat diffusivity terms. */ - virtual void GetGradEnthalpyDiffusivity(su2double* grad_enthalpy_diffusions = nullptr) {} + virtual void GetGradEnthalpyDiffusivity(su2double* grad_enthalpy_diffusions = nullptr) const {} /*! * \brief Get fluid pressure partial derivative. diff --git a/SU2_CFD/include/fluid/CFluidScalar.hpp b/SU2_CFD/include/fluid/CFluidScalar.hpp index 9614402c0c0f..3927116898c3 100644 --- a/SU2_CFD/include/fluid/CFluidScalar.hpp +++ b/SU2_CFD/include/fluid/CFluidScalar.hpp @@ -147,12 +147,12 @@ class CFluidScalar final : public CFluidModel { /*! * \brief Get enthalpy diffusivity terms. */ - void GetEnthalpyDiffusivity(su2double* enthalpy_diffusions) override; + void GetEnthalpyDiffusivity(su2double* enthalpy_diffusions) const override; /*! * \brief Get gradient enthalpy diffusivity terms. */ - void GetGradEnthalpyDiffusivity(su2double* grad_enthalpy_diffusions) override; + void GetGradEnthalpyDiffusivity(su2double* grad_enthalpy_diffusions) const override; /*! * \brief Set the Dimensionless State using Temperature. diff --git a/SU2_CFD/include/solvers/CIncEulerSolver.hpp b/SU2_CFD/include/solvers/CIncEulerSolver.hpp index 4262b64fdce8..8e6803d69465 100644 --- a/SU2_CFD/include/solvers/CIncEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CIncEulerSolver.hpp @@ -210,8 +210,8 @@ class CIncEulerSolver : public CFVMFlowSolverBase CCentLaxInc_Flow::ComputeResidual(const CConfig* confi MeandRhodh = 0.0; if (variable_density) { MeandRhodh = -MeanDensity/(MeanTemperature * MeanCp); - MeanCp = 1.0; - Cp_i = 1.0; - Cp_j = 1.0; } /*--- Get projected flux tensor ---*/ @@ -170,12 +167,10 @@ CNumerics::ResidualType<> CCentLaxInc_Flow::ComputeResidual(const CConfig* confi /*--- Jacobian contributions ---*/ /*--- Implicit terms ---*/ if (implicit) { - for (iDim = 0; iDim < nDim; iDim++){ + for (iDim = 0; iDim < nDim+1; iDim++){ Jacobian_i[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_i; Jacobian_j[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_j; } - Jacobian_i[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_i*Cp_i; - Jacobian_j[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_j*Cp_j; } } } @@ -395,12 +390,10 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi /*--- Jacobian contributions ---*/ /*--- Implicit terms ---*/ if (implicit) { - for (iDim = 0; iDim < nDim; iDim++){ + for (iDim = 0; iDim < nDim+1; iDim++){ Jacobian_i[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_i; Jacobian_j[iDim+1][iDim+1] -= 0.5*ProjVelocity*DensityInc_j; } - Jacobian_i[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_i*Cp_i; - Jacobian_j[nDim+1][nDim+1] -= 0.5*ProjVelocity*DensityInc_j*Cp_j; } } } From a2ae0b1bb46bd7f2788bdb6bacf540abdfcee490 Mon Sep 17 00:00:00 2001 From: Cristopher Morales <98025159+Cristopher-Morales@users.noreply.github.com> Date: Sun, 26 Oct 2025 22:28:32 +0100 Subject: [PATCH 74/97] Update SU2_CFD/src/solvers/CIncNSSolver.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/src/solvers/CIncNSSolver.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index cae0bbe03d4a..5798336cc6ca 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -319,10 +319,9 @@ void CIncNSSolver::Compute_Enthalpy_Diffusion(unsigned long iEdge, CGeometry* ge /*--- Compute Projected gradient for species variables ---*/ su2double ProjGradScalarVarNoCorr[MAXNVAR_SPECIES]{0.0}; su2double Proj_Mean_GradScalarVar[MAXNVAR_SPECIES]{0.0}; - su2double proj_vector_ij = numerics->ComputeProjectedGradient(nDim, n_species, Normal, Coord_i, Coord_j, Species_Grad_i, Species_Grad_j, true, Species_i, Species_j, ProjGradScalarVarNoCorr, Proj_Mean_GradScalarVar); - (void)proj_vector_ij; + /*--- Get enthalpy diffusion terms and its gradient(for implicit) for each species at point i. ---*/ From 21fab1a4cc1cb58de999dc485304bd1bd8b5d00c Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Mon, 27 Oct 2025 08:49:20 +0100 Subject: [PATCH 75/97] addressing comments part 2 --- SU2_CFD/include/fluid/CFluidScalar.hpp | 10 +++---- .../include/numerics/flow/flow_diffusion.hpp | 1 - SU2_CFD/src/fluid/CFluidScalar.cpp | 2 +- SU2_CFD/src/numerics/flow/flow_diffusion.cpp | 10 +++---- SU2_CFD/src/solvers/CIncNSSolver.cpp | 29 +++++++++---------- TestCases/parallel_regression.py | 4 +-- 6 files changed, 27 insertions(+), 29 deletions(-) diff --git a/SU2_CFD/include/fluid/CFluidScalar.hpp b/SU2_CFD/include/fluid/CFluidScalar.hpp index 3927116898c3..46e0713db2ab 100644 --- a/SU2_CFD/include/fluid/CFluidScalar.hpp +++ b/SU2_CFD/include/fluid/CFluidScalar.hpp @@ -40,12 +40,12 @@ class CFluidScalar final : public CFluidModel { private: const int n_species_mixture; /*!< \brief Number of species in mixture. */ - su2double Gas_Constant; /*!< \brief Specific gas constant. */ + su2double Gas_Constant; /*!< \brief Specific gas constant. */ const su2double Pressure_Thermodynamic; /*!< \brief Constant pressure thermodynamic. */ - const su2double Ref_Temperature; /*!< \brief Reference temperature. */ + 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_Number; /*!< \brief Prandlt number.*/ - const su2double Schmidt_Turb_Number; /*!< \brief Prandlt number.*/ + const su2double Prandtl_Turb_Number; /*!< \brief Prandlt turbulent number.*/ + const su2double Schmidt_Turb_Number; /*!< \brief Schmidt turbulent number.*/ const bool wilke; const bool davidson; @@ -137,7 +137,7 @@ class CFluidScalar final : public CFluidModel { /*! * \brief Get fluid thermal conductivity. */ - inline su2double GetThermalConductivity() override { return Kt + Mu_Turb * Cp / Prandtl_Number; } + inline su2double GetThermalConductivity() override { return Kt + Mu_Turb * Cp / Prandtl_Turb_Number; } /*! * \brief Get fluid mass diffusivity. diff --git a/SU2_CFD/include/numerics/flow/flow_diffusion.hpp b/SU2_CFD/include/numerics/flow/flow_diffusion.hpp index eb29ba9dca7c..911a1256fec2 100644 --- a/SU2_CFD/include/numerics/flow/flow_diffusion.hpp +++ b/SU2_CFD/include/numerics/flow/flow_diffusion.hpp @@ -289,7 +289,6 @@ class CAvgGrad_Flow final : public CAvgGrad_Base { class CAvgGradInc_Flow final : public CAvgGrad_Base { private: su2double Mean_Thermal_Conductivity; /*!< \brief Mean value of the effective thermal conductivity. */ - su2double Mean_Heat_Capacity; /*!< \brief Mean value of the heat capacity. */ bool energy; /*!< \brief computation with the energy equation. */ /*! diff --git a/SU2_CFD/src/fluid/CFluidScalar.cpp b/SU2_CFD/src/fluid/CFluidScalar.cpp index bef1a82390fd..b42cf7b70433 100644 --- a/SU2_CFD/src/fluid/CFluidScalar.cpp +++ b/SU2_CFD/src/fluid/CFluidScalar.cpp @@ -47,7 +47,7 @@ CFluidScalar::CFluidScalar(su2double value_pressure_operating, const CConfig* co Pressure_Thermodynamic(value_pressure_operating), Ref_Temperature(config->GetStandard_RefTemperatureND()), GasConstant_Ref(config->GetGas_Constant_Ref()), - Prandtl_Number(config->GetPrandtl_Turb()), + Prandtl_Turb_Number(config->GetPrandtl_Turb()), Schmidt_Turb_Number(config->GetSchmidt_Number_Turbulent()), wilke(config->GetKind_MixingViscosityModel() == MIXINGVISCOSITYMODEL::WILKE), davidson(config->GetKind_MixingViscosityModel() == MIXINGVISCOSITYMODEL::DAVIDSON) { diff --git a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp index f21ce5f792ad..824562ac30ee 100644 --- a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp +++ b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp @@ -655,12 +655,12 @@ CNumerics::ResidualType<> CAvgGradInc_Flow::ComputeResidual(const CConfig* confi proj_vector_ij += (Coord_j[iDim]-Coord_i[iDim])*Normal[iDim]; } proj_vector_ij = proj_vector_ij/dist_ij_2; - Mean_Heat_Capacity = 0.5 * (V_i[nDim + 8] + V_j[nDim + 8]); - Jacobian_i[nDim + 1][nDim + 1] = -Mean_Thermal_Conductivity * proj_vector_ij / Mean_Heat_Capacity; - Jacobian_j[nDim + 1][nDim + 1] = Mean_Thermal_Conductivity * proj_vector_ij / Mean_Heat_Capacity; + Mean_Cp = 0.5 * (V_i[nDim + 8] + V_j[nDim + 8]); + Jacobian_i[nDim + 1][nDim + 1] = -Mean_Thermal_Conductivity * proj_vector_ij / Mean_Cp; + Jacobian_j[nDim + 1][nDim + 1] = Mean_Thermal_Conductivity * proj_vector_ij / Mean_Cp; if (energy_multicomponent){ - Jacobian_i[nDim + 1][nDim + 1] -= JacHeatFluxDiffusion / Mean_Heat_Capacity; - Jacobian_j[nDim + 1][nDim + 1] += JacHeatFluxDiffusion / Mean_Heat_Capacity; + Jacobian_i[nDim + 1][nDim + 1] -= JacHeatFluxDiffusion / Mean_Cp; + Jacobian_j[nDim + 1][nDim + 1] += JacHeatFluxDiffusion / Mean_Cp; } } diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index 5798336cc6ca..28747c7e1d71 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -306,6 +306,15 @@ void CIncNSSolver::Compute_Enthalpy_Diffusion(unsigned long iEdge, CGeometry* ge CFluidModel* FluidModel = solver_container[FLOW_SOL]->GetFluidModel(); + /*--- Helper function that retrieves enthalpy diffusion terms. ---*/ + auto GetEnthalpyDiffusionTerms = [&](unsigned long Point, const su2double* Species, su2double* EnthalpyDiffusion, + su2double* GradEnthalpyDiffusion) { + FluidModel->SetTDState_T(nodes->GetPrimitive(Point)[prim_idx.Temperature()], Species); + FluidModel->SetEddyViscosity(nodes->GetPrimitive(Point)[prim_idx.EddyViscosity()]); + FluidModel->GetEnthalpyDiffusivity(EnthalpyDiffusion); + if (implicit) FluidModel->GetGradEnthalpyDiffusivity(GradEnthalpyDiffusion); + }; + /*--- set maximum static array ---*/ static constexpr size_t MAXNVAR_SPECIES = 20UL; @@ -319,27 +328,17 @@ void CIncNSSolver::Compute_Enthalpy_Diffusion(unsigned long iEdge, CGeometry* ge /*--- Compute Projected gradient for species variables ---*/ su2double ProjGradScalarVarNoCorr[MAXNVAR_SPECIES]{0.0}; su2double Proj_Mean_GradScalarVar[MAXNVAR_SPECIES]{0.0}; - numerics->ComputeProjectedGradient(nDim, n_species, Normal, Coord_i, Coord_j, Species_Grad_i, Species_Grad_j, - true, Species_i, Species_j, ProjGradScalarVarNoCorr, Proj_Mean_GradScalarVar); - + numerics->ComputeProjectedGradient(nDim, n_species, Normal, Coord_i, Coord_j, Species_Grad_i, Species_Grad_j, true, + Species_i, Species_j, ProjGradScalarVarNoCorr, Proj_Mean_GradScalarVar); - /*--- Get enthalpy diffusion terms and its gradient(for implicit) for each species at point i. ---*/ + /*--- Get enthalpy diffusion terms and its gradient(for implicit) for each species at iPoint and jPoint. ---*/ su2double EnthalpyDiffusion_i[MAXNVAR_SPECIES]{0.0}; su2double GradEnthalpyDiffusion_i[MAXNVAR_SPECIES]{0.0}; - FluidModel->SetTDState_T(nodes->GetPrimitive(iPoint)[prim_idx.Temperature()], Species_i); - FluidModel->SetEddyViscosity(nodes->GetPrimitive(iPoint)[prim_idx.EddyViscosity()]); - FluidModel->GetEnthalpyDiffusivity(EnthalpyDiffusion_i); - if (implicit) FluidModel->GetGradEnthalpyDiffusivity(GradEnthalpyDiffusion_i); - - /*--- Repeat the above computations for jPoint. ---*/ - su2double EnthalpyDiffusion_j[MAXNVAR_SPECIES]{0.0}; su2double GradEnthalpyDiffusion_j[MAXNVAR_SPECIES]{0.0}; - FluidModel->SetTDState_T(nodes->GetPrimitive(jPoint)[prim_idx.Temperature()], Species_j); - FluidModel->SetEddyViscosity(nodes->GetPrimitive(jPoint)[prim_idx.EddyViscosity()]); - FluidModel->GetEnthalpyDiffusivity(EnthalpyDiffusion_j); - if (implicit) FluidModel->GetGradEnthalpyDiffusivity(GradEnthalpyDiffusion_j); + GetEnthalpyDiffusionTerms(iPoint, Species_i, EnthalpyDiffusion_i, GradEnthalpyDiffusion_i); + GetEnthalpyDiffusionTerms(jPoint, Species_j, EnthalpyDiffusion_j, GradEnthalpyDiffusion_j); /*--- Compute Enthalpy diffusion flux and its jacobian (for implicit iterations) ---*/ su2double flux_enthalpy_diffusion = 0.0; diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 78658d1e2f4f..f8851b6d8271 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1658,8 +1658,8 @@ def main(): species_passive_val.cfg_dir = "species_transport/passive_transport_validation" species_passive_val.cfg_file = "passive_transport.cfg" species_passive_val.test_iter = 50 - species_passive_val.test_vals = [-16.499938, -16.287111, -16.904700, -4.257599, 10.000000, -4.504235, 8.000000, -5.193350, 0.186610, 0.000000] - species_passive_val.test_vals_aarch64 = [-16.499938, -16.287111, -16.904700, -4.257599, 10.000000, -4.504235, 8.000000, -5.193350, 0.186610, 0.000000] + species_passive_val.test_vals = [-16.517744, -16.282420, -16.871663, -4.257599, 10.000000, -4.278151, 8.000000, -5.193350, 0.186610, 0.000000] + species_passive_val.test_vals_aarch64 = [-16.517744, -16.282420, -16.871663, -4.257599, 10.000000, -4.278151, 8.000000, -5.193350, 0.186610, 0.000000] test_list.append(species_passive_val) # rectangle active 2-species transport From 61be943e49a290ff009f3de54f3c11b7c8378540 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Mon, 27 Oct 2025 15:48:58 +0100 Subject: [PATCH 76/97] addressing comments part 3 --- SU2_CFD/include/fluid/CFluidModel.hpp | 18 ++++++++++++++++-- SU2_CFD/include/fluid/CFluidScalar.hpp | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/include/fluid/CFluidModel.hpp b/SU2_CFD/include/fluid/CFluidModel.hpp index 7c9e7391945f..03f1e7d66052 100644 --- a/SU2_CFD/include/fluid/CFluidModel.hpp +++ b/SU2_CFD/include/fluid/CFluidModel.hpp @@ -193,12 +193,26 @@ class CFluidModel { } /*! - * \brief Get heat diffusivity terms. + * \brief Get the enthalpy diffusivity terms for all species being solved. + * + * This function computes and retrieves the enthalpy diffusion terms required in the energy equation + * for multicomponent flows. + * + * \param[in,out] enthalpy_diffusions - Array containing the enthalpy diffusion terms for all + * species to be solved. The size of \p enthalpy_diffusions must be at least (n_species_mixture - 1), + * corresponding to the number of species transport equations in the system. */ virtual void GetEnthalpyDiffusivity(su2double* enthalpy_diffusions = nullptr) const {} /*! - * \brief Get gradient heat diffusivity terms. + * \brief Get the gradient of enthalpy diffusivity terms for all species being solved. + * + * This function computes and retrieves the gradient of the enthalpy diffusion terms with respect to temperature. + * These terms are required for implicit computations when solving the energy equation for multicomponent flows. + * + * \param[in,out] grad_enthalpy_diffusions - Array containing the gradient of enthalpy diffusion terms for all + * species to be solved. The size of \p grad_enthalpy_diffusions must be at least (n_species_mixture - 1), + * corresponding to the number of species transport equations in the system. */ virtual void GetGradEnthalpyDiffusivity(su2double* grad_enthalpy_diffusions = nullptr) const {} diff --git a/SU2_CFD/include/fluid/CFluidScalar.hpp b/SU2_CFD/include/fluid/CFluidScalar.hpp index 46e0713db2ab..164043872d6a 100644 --- a/SU2_CFD/include/fluid/CFluidScalar.hpp +++ b/SU2_CFD/include/fluid/CFluidScalar.hpp @@ -145,12 +145,26 @@ class CFluidScalar final : public CFluidModel { inline su2double GetMassDiffusivity(int ivar) override { return massDiffusivity[ivar]; } /*! - * \brief Get enthalpy diffusivity terms. + * \brief Get the enthalpy diffusivity terms for all species being solved. + * + * This function computes and retrieves the enthalpy diffusion terms required in the energy equation + * for multicomponent flows. + * + * \param[in,out] enthalpy_diffusions - Array containing the enthalpy diffusion terms for all + * species to be solved. The size of \p enthalpy_diffusions must be at least (n_species_mixture - 1), + * corresponding to the number of species transport equations in the system. */ void GetEnthalpyDiffusivity(su2double* enthalpy_diffusions) const override; /*! - * \brief Get gradient enthalpy diffusivity terms. + * \brief Get the gradient of enthalpy diffusivity terms for all species being solved. + * + * This function computes and retrieves the gradient of the enthalpy diffusion terms with respect to temperature. + * These terms are required for implicit computations when solving the energy equation for multicomponent flows. + * + * \param[in,out] grad_enthalpy_diffusions - Array containing the gradient of enthalpy diffusion terms for all + * species to be solved. The size of \p grad_enthalpy_diffusions must be at least (n_species_mixture - 1), + * corresponding to the number of species transport equations in the system. */ void GetGradEnthalpyDiffusivity(su2double* grad_enthalpy_diffusions) const override; From 8644084ff30a57481c4a9ece23b58d7767f7a837 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sun, 2 Nov 2025 12:25:21 +0100 Subject: [PATCH 77/97] updating residuals --- TestCases/parallel_regression.py | 4 ++-- TestCases/tutorials.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 95381488dd5a..eda53ff8b2a7 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1363,7 +1363,7 @@ def main(): sp_pinArray_cht_2d_dp_hf.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" sp_pinArray_cht_2d_dp_hf.cfg_file = "configMaster.cfg" sp_pinArray_cht_2d_dp_hf.test_iter = 100 - sp_pinArray_cht_2d_dp_hf.test_vals = [0.374853, -0.882716, -0.970590, -0.613374, 208.023676, 350.230000, -0.000000, -0.613370, 0.613370] + sp_pinArray_cht_2d_dp_hf.test_vals = [0.379544, 2.491817, -1.255558, -0.613405, 208.023676, 349.870000, -0.000000, -0.613410, 0.613410] sp_pinArray_cht_2d_dp_hf.multizone = True test_list.append(sp_pinArray_cht_2d_dp_hf) @@ -1372,7 +1372,7 @@ def main(): sp_pinArray_3d_cht_mf_hf_tp.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_3d" sp_pinArray_3d_cht_mf_hf_tp.cfg_file = "configMaster.cfg" sp_pinArray_3d_cht_mf_hf_tp.test_iter = 30 - sp_pinArray_3d_cht_mf_hf_tp.test_vals = [-1.279608, -2.263747, -3.397255, -0.009777, 104.609505, 418.370000, 0.000000] + sp_pinArray_3d_cht_mf_hf_tp.test_vals = [0.261726, 3.878700, 0.298987, -0.009537, 104.749181, 354.800000, 0.000000] sp_pinArray_3d_cht_mf_hf_tp.multizone = True test_list.append(sp_pinArray_3d_cht_mf_hf_tp) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index 7865285eb778..ae8df575b97e 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -80,7 +80,7 @@ def main(): sp_pinArray_2d_mf_hf.cfg_dir = "../Tutorials/incompressible_flow/Inc_Streamwise_Periodic" sp_pinArray_2d_mf_hf.cfg_file = "sp_pinArray_2d_mf_hf.cfg" sp_pinArray_2d_mf_hf.test_iter = 25 - sp_pinArray_2d_mf_hf.test_vals = [-4.685950, 1.388066, -0.755449, 241.878890] + sp_pinArray_2d_mf_hf.test_vals = [-4.685131, 1.388616, -0.755475, 241.878084] sp_pinArray_2d_mf_hf.test_vals_aarch64 = [-4.686092, 1.387918, -0.755447, 241.878841] test_list.append(sp_pinArray_2d_mf_hf) @@ -89,7 +89,7 @@ def main(): sp_pinArray_2d_dp_hf_tp.cfg_dir = "../Tutorials/incompressible_flow/Inc_Streamwise_Periodic" sp_pinArray_2d_dp_hf_tp.cfg_file = "sp_pinArray_2d_dp_hf_tp.cfg" sp_pinArray_2d_dp_hf_tp.test_iter = 25 - sp_pinArray_2d_dp_hf_tp.test_vals = [-4.732729, 1.326135, -0.713419, 208.023676] + sp_pinArray_2d_dp_hf_tp.test_vals = [-4.737196, 1.322378, -0.713373, 208.023676] sp_pinArray_2d_dp_hf_tp.test_vals_aarch64 = [-4.733643, 1.325195, -0.713411, 208.023676] test_list.append(sp_pinArray_2d_dp_hf_tp) From 2e0dcfee84343df1f9585139b471966b2b813ffd Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sun, 2 Nov 2025 20:56:00 +0100 Subject: [PATCH 78/97] updating residuals and .ref files --- .../chtPinArray_2d/of_grad_findiff.csv.ref | 2 +- TestCases/parallel_regression_AD.py | 4 +- .../radiation/p1adjoint/of_grad_cd.csv.ref | 100 +++++++++--------- 3 files changed, 53 insertions(+), 53 deletions(-) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref index d6673941ba48..2d925e77a8cd 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref @@ -1,2 +1,2 @@ "VARIABLE" , "AVG_DENSITY[0]", "AVG_ENTHALPY[0]", "AVG_NORMALVEL[0]", "DRAG[0]" , "EFFICIENCY[0]" , "FORCE_X[0]" , "FORCE_Y[0]" , "FORCE_Z[0]" , "LIFT[0]" , "MOMENT_X[0]" , "MOMENT_Y[0]" , "MOMENT_Z[0]" , "SIDEFORCE[0]" , "SURFACE_MACH[0]", "SURFACE_MASSFLOW[0]", "SURFACE_MOM_DISTORTION[0]", "SURFACE_PRESSURE_DROP[0]", "SURFACE_SECONDARY[0]", "SURFACE_SECOND_OVER_UNIFORM[0]", "SURFACE_STATIC_PRESSURE[0]", "SURFACE_STATIC_TEMPERATURE[0]", "SURFACE_TOTAL_PRESSURE[0]", "SURFACE_TOTAL_TEMPERATURE[0]", "SURFACE_UNIFORMITY[0]", "AVG_TEMPERATURE[1]", "TOTAL_HEATFLUX[1]", "FINDIFF_STEP" -0 , 0.0 , 0.0 , -3.330699999961374e-08, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 2.2200000003768e-08, 0.0 , 0.0 , 0.009999995276288587, 0.04000000330961484 , -9.999999406318238 , -20.000004496978363 , -49.999999873762135 , -19.99999312829459 , -0.09999998606957661 , -199.99999949504854, -369.9999979289714, 1e-08 +0 , 0.0 , 0.0 , 3.3307000000906214e-08, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , -9.999996564147295 , -10.000007932831068 , 0.0 , -80.0000009348878 , -360.00000136482413, 1e-08 diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index 80e9e47198a9..b320ccad7629 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -298,7 +298,7 @@ def main(): da_sp_pinArray_cht_2d_dp_hf.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" da_sp_pinArray_cht_2d_dp_hf.cfg_file = "DA_configMaster.cfg" da_sp_pinArray_cht_2d_dp_hf.test_iter = 100 - da_sp_pinArray_cht_2d_dp_hf.test_vals = [-5.081814, -3.881868, -4.127717] + da_sp_pinArray_cht_2d_dp_hf.test_vals = [-3.907317, -5.155811, -3.183956] da_sp_pinArray_cht_2d_dp_hf.multizone = True test_list.append(da_sp_pinArray_cht_2d_dp_hf) @@ -307,7 +307,7 @@ def main(): da_sp_pinArray_cht_2d_mf.cfg_dir = "incomp_navierstokes/streamwise_periodic/dp-adjoint_chtPinArray_2d" da_sp_pinArray_cht_2d_mf.cfg_file = "configMaster.cfg" da_sp_pinArray_cht_2d_mf.test_iter = 100 - da_sp_pinArray_cht_2d_mf.test_vals = [-4.512241, -1.154741, -1.436747, -18.499579, 0.148431, -5.675770, -19.074432, -50.463572] + da_sp_pinArray_cht_2d_mf.test_vals = [-4.512241, -1.154741, -1.436747, 0.148439, -5.675767, -15.727696, -50.4635702] da_sp_pinArray_cht_2d_mf.multizone = True test_list.append(da_sp_pinArray_cht_2d_mf) diff --git a/TestCases/radiation/p1adjoint/of_grad_cd.csv.ref b/TestCases/radiation/p1adjoint/of_grad_cd.csv.ref index 0f9cfc435c93..3261f4b5a175 100644 --- a/TestCases/radiation/p1adjoint/of_grad_cd.csv.ref +++ b/TestCases/radiation/p1adjoint/of_grad_cd.csv.ref @@ -1,51 +1,51 @@ "VARIABLE" , "GRADIENT" , "FINDIFF_STEP" -0 , -0.000958205 , 0.001 -1 , -0.00432733 , 0.001 -2 , -0.0111443 , 0.001 -3 , -0.0214515 , 0.001 -4 , -0.0343997 , 0.001 -5 , -0.0489968 , 0.001 -6 , -0.0643023 , 0.001 -7 , -0.0791818 , 0.001 -8 , -0.092416 , 0.001 -9 , -0.103017 , 0.001 -10 , -0.11024 , 0.001 -11 , -0.113392 , 0.001 -12 , -0.111913 , 0.001 -13 , -0.105766 , 0.001 -14 , -0.0957015 , 0.001 -15 , -0.0830517 , 0.001 -16 , -0.0692182 , 0.001 -17 , -0.0553101 , 0.001 -18 , -0.042129 , 0.001 -19 , -0.0303137 , 0.001 -20 , -0.0203813 , 0.001 -21 , -0.0126226 , 0.001 -22 , -0.00700441 , 0.001 -23 , -0.00322726 , 0.001 -24 , -0.000951904 , 0.001 -25 , 0.00128803 , 0.001 -26 , 0.0051774 , 0.001 -27 , 0.0125547 , 0.001 -28 , 0.0234674 , 0.001 -29 , 0.0370465 , 0.001 -30 , 0.0521956 , 0.001 -31 , 0.0678379 , 0.001 -32 , 0.0827257 , 0.001 -33 , 0.0955787 , 0.001 -34 , 0.105412 , 0.001 -35 , 0.111548 , 0.001 -36 , 0.113415 , 0.001 -37 , 0.110605 , 0.001 -38 , 0.103242 , 0.001 -39 , 0.0922244 , 0.001 -40 , 0.0789963 , 0.001 -41 , 0.0650234 , 0.001 -42 , 0.0514199 , 0.001 -43 , 0.0389312 , 0.001 -44 , 0.0280831 , 0.001 -45 , 0.0192316 , 0.001 -46 , 0.0124655 , 0.001 -47 , 0.00752232 , 0.001 -48 , 0.0039072 , 0.001 -49 , 0.00131195 , 0.001 +0 , -0.000805612 , 0.001 +1 , -0.00295734 , 0.001 +2 , -0.00745938 , 0.001 +3 , -0.0149199 , 0.001 +4 , -0.0249982 , 0.001 +5 , -0.0369863 , 0.001 +6 , -0.050081 , 0.001 +7 , -0.0632298 , 0.001 +8 , -0.0752505 , 0.001 +9 , -0.0851395 , 0.001 +10 , -0.0921234 , 0.001 +11 , -0.0955264 , 0.001 +12 , -0.0948301 , 0.001 +13 , -0.0899838 , 0.001 +14 , -0.0816164 , 0.001 +15 , -0.0708659 , 0.001 +16 , -0.0589605 , 0.001 +17 , -0.0469057 , 0.001 +18 , -0.0354473 , 0.001 +19 , -0.0251745 , 0.001 +20 , -0.0165555 , 0.001 +21 , -0.00985599 , 0.001 +22 , -0.00507083 , 0.001 +23 , -0.00200693 , 0.001 +24 , -0.00043705 , 0.001 +25 , 0.000131687 , 0.001 +26 , 0.0020078 , 0.001 +27 , 0.00694766 , 0.001 +28 , 0.0151982 , 0.001 +29 , 0.0261365 , 0.001 +30 , 0.0389073 , 0.001 +31 , 0.0525923 , 0.001 +32 , 0.0660375 , 0.001 +33 , 0.0779943 , 0.001 +34 , 0.0874455 , 0.001 +35 , 0.0936644 , 0.001 +36 , 0.0960748 , 0.001 +37 , 0.094294 , 0.001 +38 , 0.0884212 , 0.001 +39 , 0.0792256 , 0.001 +40 , 0.0679564 , 0.001 +41 , 0.0559069 , 0.001 +42 , 0.0440918 , 0.001 +43 , 0.0332097 , 0.001 +44 , 0.0237553 , 0.001 +45 , 0.0160694 , 0.001 +46 , 0.0102681 , 0.001 +47 , 0.00615345 , 0.001 +48 , 0.00325583 , 0.001 +49 , 0.00115708 , 0.001 From fa3bad1f4e3825c035fe36ea2746ba670294f209 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Tue, 4 Nov 2025 10:56:32 +0100 Subject: [PATCH 79/97] updating residual custom_source_buoyancy --- TestCases/parallel_regression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index eda53ff8b2a7..e5f4155154c0 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1488,7 +1488,7 @@ def main(): pywrapper_buoyancy.cfg_dir = "py_wrapper/custom_source_buoyancy" pywrapper_buoyancy.cfg_file = "lam_buoyancy_cavity.cfg" pywrapper_buoyancy.test_iter = 0 - pywrapper_buoyancy.test_vals = [-17.746018, -17.462127, -17.428851, -12.260605] + pywrapper_buoyancy.test_vals = [-11.864224, -12.149668, -3.539309, -6.119375] pywrapper_buoyancy.test_vals_aarch64 = [-17.746018, -17.460693, -17.430708, -12.260624] pywrapper_buoyancy.command = TestCase.Command("mpirun -np 2", "python", "run.py") test_list.append(pywrapper_buoyancy) From 694d9e5e28a15c723d5eb61f64185e52c7fa89d3 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Mon, 17 Nov 2025 23:06:58 +0100 Subject: [PATCH 80/97] computing enthalpy based on NASA polynomials for CIncIdealGasPolynomial --- .../include/fluid/CIncIdealGasPolynomial.hpp | 58 +++++++++++++++---- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 9 +-- 2 files changed, 49 insertions(+), 18 deletions(-) diff --git a/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp b/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp index 067e40c74e8e..5e26414d1d4e 100644 --- a/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp +++ b/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp @@ -58,8 +58,13 @@ 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; coeffs_[i] = config->GetCp_PolyCoeffND(i); + Enthalpy_Ref += coeffs_[i] * t_i / (i + 1); } } @@ -72,15 +77,16 @@ class CIncIdealGasPolynomial final : public CFluidModel { Temperature = t; Density = Pressure / (Temperature * Gas_Constant); - /* Evaluate the new Cp from the coefficients and temperature. */ + /* Evaluate the new Cp and enthalpy from the coefficients and temperature. */ Cp = coeffs_[0]; + Enthalpy = coeffs_[0] * t - Enthalpy_Ref; su2double t_i = 1.0; for (int i = 1; i < N; ++i) { t_i *= t; Cp += coeffs_[i] * t_i; + Enthalpy += coeffs_[i] * t_i * t / (i + 1); } Cv = Cp / Gamma; - Enthalpy = Cp * Temperature; } /*! @@ -89,20 +95,50 @@ class CIncIdealGasPolynomial final : public CFluidModel { */ void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) override { Enthalpy = val_enthalpy; - Temperature = Enthalpy / Cp; - Density = Pressure / (Temperature * Gas_Constant); - /* Evaluate the new Cp from the coefficients and temperature. */ - Cp = coeffs_[0]; - su2double t_i = 1.0; - for (int i = 1; i < N; ++i) { - t_i *= Temperature; - Cp += coeffs_[i] * t_i; + /*--- convergence criterion for temperature in [K], high accuracy needed for restarts. ---*/ + const su2double toll = 1e-5; + su2double temp_iter = 300.0; + su2double Cp_iter = 0.0; + su2double delta_temp_iter = 1e10; + su2double delta_enthalpy_iter; + const int counter_limit = 20; + + int counter = 0; + + /*--- Computing temperature given enthalpy using Newton-Raphson. ---*/ + while ((abs(delta_temp_iter) > toll) && (counter++ < counter_limit)) { + /* Evaluate the new Cp and enthalpy from the coefficients and temperature. */ + Cp_iter = coeffs_[0]; + su2double Enthalpy_iter = coeffs_[0] * temp_iter - Enthalpy_Ref; + su2double t_i = 1.0; + for (int i = 1; i < N; ++i) { + t_i *= temp_iter; + Cp_iter += coeffs_[i] * t_i; + Enthalpy_iter += coeffs_[i] * t_i * temp_iter / (i + 1); + } + + delta_enthalpy_iter = Enthalpy - Enthalpy_iter; + + delta_temp_iter = delta_enthalpy_iter / Cp_iter; + + temp_iter += delta_temp_iter; + if (temp_iter < 0.0) { + cout << "Warning: Negative temperature has been found during Newton-Raphson" << endl; + break; + } + } + Temperature = temp_iter; + Cp = Cp_iter; + if (counter == counter_limit) { + cout << "Warning Newton-Raphson exceed number of max iteration in temperature computation" << endl; } + Density = Pressure / (Temperature * Gas_Constant); Cv = Cp / Gamma; } private: su2double Gas_Constant{0.0}; /*!< \brief Specific Gas Constant. */ su2double Gamma{0.0}; /*!< \brief Ratio of specific heats. */ - array coeffs_; /*!< \brief Polynomial coefficients for conductivity as a function of temperature. */ + array coeffs_; /*!< \brief Polynomial coefficients for heat capacity as a function of temperature. */ + su2double Enthalpy_Ref; /*!< \brief Enthalpy computed at the reference temperature. */ }; diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index 276f29c36535..dd3b4511c082 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -2587,7 +2587,6 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool viscous = config->GetViscous(); const bool energy_multicomponent = config->GetKind_FluidModel() == FLUID_MIXTURE && config->GetEnergy_Equation(); - const bool species_model = config->GetKind_Species_Model() != SPECIES_MODEL::NONE; string Marker_Tag = config->GetMarker_All_TagBound(val_marker); su2double Normal[MAXNDIM] = {0.0}; @@ -2714,12 +2713,8 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, V_outlet[prim_idx.CpTotal()] = nodes->GetSpecificHeatCp(iPoint); - /*-- Enthalpy is needed for energy equation. ---*/ - const su2double* scalar_outlet = nullptr; - if (species_model) scalar_outlet = solver_container[SPECIES_SOL]->GetNodes()->GetSolution(iPoint); - CFluidModel* auxFluidModel = solver_container[FLOW_SOL]->GetFluidModel(); - auxFluidModel->SetTDState_T(nodes->GetTemperature(iPoint), scalar_outlet); - V_outlet[prim_idx.Enthalpy()] = auxFluidModel->GetEnthalpy(); + /*-- Neumann condition for Enthalpy in energy equation. ---*/ + V_outlet[prim_idx.Enthalpy()] = nodes->GetEnthalpy(iPoint); /*--- Set various quantities in the solver class ---*/ From 5896008668f831c6ba189e8fda3889d68188bfe3 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Mon, 17 Nov 2025 23:42:33 +0100 Subject: [PATCH 81/97] updating residuals inc_poly_cylinder --- TestCases/hybrid_regression.py | 4 ++-- TestCases/parallel_regression.py | 2 +- TestCases/serial_regression.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index 2c223c6c5e4e..c9b423f617c2 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -383,8 +383,8 @@ def main(): inc_poly_cylinder.cfg_dir = "incomp_navierstokes/cylinder" inc_poly_cylinder.cfg_file = "poly_cylinder.cfg" inc_poly_cylinder.test_iter = 20 - inc_poly_cylinder.test_vals = [-7.815180, -2.022515, 0.029270, 1.948239, -175.610000] - inc_poly_cylinder.test_vals_aarch64 = [-7.815180, -2.022515, 0.029270, 1.948239, -175.610000] + inc_poly_cylinder.test_vals = [-8.241953, -2.424330, 0.027284, 1.909617, -173.010000] + inc_poly_cylinder.test_vals_aarch64 = [-8.241953, -2.424330, 0.027284, 1.909617, -173.010000] test_list.append(inc_poly_cylinder) # X-coarse laminar bend as a mixed element CGNS test diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index e5f4155154c0..a6a25da13e44 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -611,7 +611,7 @@ def main(): inc_poly_cylinder.cfg_dir = "incomp_navierstokes/cylinder" inc_poly_cylinder.cfg_file = "poly_cylinder.cfg" inc_poly_cylinder.test_iter = 20 - inc_poly_cylinder.test_vals = [-7.866943, -1.883455, 0.043885, 1.935798, -148.430000] + inc_poly_cylinder.test_vals = [-8.030976, -2.362995, 0.006829, 1.923532, -172.590000] test_list.append(inc_poly_cylinder) # X-coarse laminar bend as a mixed element CGNS test diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index f2acad0447c1..865a0671b833 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -415,7 +415,7 @@ def main(): inc_poly_cylinder.cfg_dir = "incomp_navierstokes/cylinder" inc_poly_cylinder.cfg_file = "poly_cylinder.cfg" inc_poly_cylinder.test_iter = 20 - inc_poly_cylinder.test_vals = [-8.081693, -2.114336, 0.018545, 1.927744, -173.800000] + inc_poly_cylinder.test_vals = [-8.232551, -2.412865, 0.010163, 1.895333, -172.760000] test_list.append(inc_poly_cylinder) # X-coarse laminar bend as a mixed element CGNS test From d840e3f1f734c93c6865592880b7544b28ad0e28 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Thu, 27 Nov 2025 14:03:36 +0100 Subject: [PATCH 82/97] adding explanation enthalpy as passive scalar and updating zimont pywrapper --- SU2_CFD/src/fluid/CFluidFlamelet.cpp | 7 +++++++ TestCases/py_wrapper/turbulent_premixed_psi/run.py | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/SU2_CFD/src/fluid/CFluidFlamelet.cpp b/SU2_CFD/src/fluid/CFluidFlamelet.cpp index 91c6fd985776..9089e15c8e50 100644 --- a/SU2_CFD/src/fluid/CFluidFlamelet.cpp +++ b/SU2_CFD/src/fluid/CFluidFlamelet.cpp @@ -118,6 +118,13 @@ CFluidFlamelet::~CFluidFlamelet() { } void CFluidFlamelet::SetTDState_h(su2double val_enthalpy, const su2double* val_scalars) { + /*--- For the fluid flamelet model, the enthalpy (and the temperature) are passive scalars. + val_scalars contains the enthalpy as the second variable: val_scalars= (Progress_variable, enthalpy,..). + Consequently, the energy equation is not solved when the fluid flamelet model is used, instead the energy equation for + enthalpy is solved in the species flamelet solver, and the enthalpy solution is overwritten in the CIncEulerSolver. + Likewise, The temperature is retrieved from the look up table. Then, the thermodynamics state is fully determined with + the val_scalars. This is the reason why enthalpy (or temperature) can be passed in either SetTDSTtate_T or + SetTDState_h without affecting the solution.---*/ SetTDState_T(val_enthalpy, val_scalars); } diff --git a/TestCases/py_wrapper/turbulent_premixed_psi/run.py b/TestCases/py_wrapper/turbulent_premixed_psi/run.py index 8b418785bbc3..dc1133169a24 100644 --- a/TestCases/py_wrapper/turbulent_premixed_psi/run.py +++ b/TestCases/py_wrapper/turbulent_premixed_psi/run.py @@ -95,8 +95,14 @@ def update_temperature(SU2Driver, iPoint): iFLOWSOLVER = SU2Driver.GetSolverIndices()['INC.FLOW'] # the list with names solindex = getsolvar(SU2Driver) + primindex = SU2Driver.GetPrimitiveIndices() + # get Cp + iCp = primindex.get("CP_TOTAL") + Cp = SU2Driver.Primitives()(iPoint,iCp) + # get solution index for energy equation iTEMP = solindex.get("TEMPERATURE") - SU2Driver.Solution(iFLOWSOLVER).Set(iPoint,iTEMP,T) + # set enthalpy, for Ideal Gas model, enthalpy is Cp*T + SU2Driver.Solution(iFLOWSOLVER).Set(iPoint,iTEMP,Cp*T) # ################################################################## # From 7c94309d734d4650360b8b4dacc75c9cd382057f Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Thu, 27 Nov 2025 14:11:49 +0100 Subject: [PATCH 83/97] small addition to the explanation --- SU2_CFD/src/fluid/CFluidFlamelet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/src/fluid/CFluidFlamelet.cpp b/SU2_CFD/src/fluid/CFluidFlamelet.cpp index 9089e15c8e50..f6fd529df832 100644 --- a/SU2_CFD/src/fluid/CFluidFlamelet.cpp +++ b/SU2_CFD/src/fluid/CFluidFlamelet.cpp @@ -119,8 +119,8 @@ CFluidFlamelet::~CFluidFlamelet() { void CFluidFlamelet::SetTDState_h(su2double val_enthalpy, const su2double* val_scalars) { /*--- For the fluid flamelet model, the enthalpy (and the temperature) are passive scalars. - val_scalars contains the enthalpy as the second variable: val_scalars= (Progress_variable, enthalpy,..). - Consequently, the energy equation is not solved when the fluid flamelet model is used, instead the energy equation for + val_scalars contains the enthalpy as the second variable: val_scalars= (Progress_variable, enthalpy,...). + Consequently, the energy equation is not solved when the fluid flamelet model is used; instead the energy equation for enthalpy is solved in the species flamelet solver, and the enthalpy solution is overwritten in the CIncEulerSolver. Likewise, The temperature is retrieved from the look up table. Then, the thermodynamics state is fully determined with the val_scalars. This is the reason why enthalpy (or temperature) can be passed in either SetTDSTtate_T or From ecffbaf7582e8d9e6d1fbd54c1fbfd416b647296 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Thu, 27 Nov 2025 19:25:50 +0100 Subject: [PATCH 84/97] updating residual python wrapper test case zimont --- TestCases/parallel_regression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index a6a25da13e44..b45ea2be4730 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1498,7 +1498,7 @@ def main(): pywrapper_zimont.cfg_dir = "py_wrapper/turbulent_premixed_psi" pywrapper_zimont.cfg_file = "psi.cfg" pywrapper_zimont.test_iter = 0 - pywrapper_zimont.test_vals = [-3.229704, -1.602176, -3.904854, -2.631849, 0.752828, -3.498356] + pywrapper_zimont.test_vals = [-5.532006, -4.663972, -5.838306, -4.316956, -2.073665, -4.453762] pywrapper_zimont.command = TestCase.Command("mpirun -np 2", "python", "run.py") test_list.append(pywrapper_zimont) From 317cb7d910eb8d7acde6e890fbc2e2312d6d00b8 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Sun, 30 Nov 2025 20:50:26 +0100 Subject: [PATCH 85/97] update residuals --- TestCases/hybrid_regression_AD.py | 5 ----- TestCases/parallel_regression.py | 4 ---- TestCases/parallel_regression_AD.py | 5 ----- 3 files changed, 14 deletions(-) diff --git a/TestCases/hybrid_regression_AD.py b/TestCases/hybrid_regression_AD.py index 9dd93f25dd52..e1ba90d6a1d0 100644 --- a/TestCases/hybrid_regression_AD.py +++ b/TestCases/hybrid_regression_AD.py @@ -111,13 +111,8 @@ def main(): discadj_incomp_cylinder.cfg_dir = "disc_adj_incomp_navierstokes/cylinder" discadj_incomp_cylinder.cfg_file = "heated_cylinder.cfg" discadj_incomp_cylinder.test_iter = 20 -<<<<<<< HEAD discadj_incomp_cylinder.test_vals = [20.000000, -5.098033, -3.842740, 0.000000] discadj_incomp_cylinder.test_vals_aarch64 = [20.000000, -5.098033, -3.842740, 0.000000] -======= - discadj_incomp_cylinder.test_vals = [20.000000, -2.746353, -2.934777, 0.000000] - discadj_incomp_cylinder.test_vals_aarch64 = [20.000000, -2.731541, -2.890897, 0.000000] ->>>>>>> develop discadj_incomp_cylinder.tol_aarch64 = 2e-1 test_list.append(discadj_incomp_cylinder) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index cfcb33b50734..5a4f16a8fa16 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1488,11 +1488,7 @@ def main(): pywrapper_buoyancy.cfg_dir = "py_wrapper/custom_source_buoyancy" pywrapper_buoyancy.cfg_file = "lam_buoyancy_cavity.cfg" pywrapper_buoyancy.test_iter = 0 -<<<<<<< HEAD pywrapper_buoyancy.test_vals = [-11.864224, -12.149668, -3.539309, -6.119375] -======= - pywrapper_buoyancy.test_vals = [-17.746020, -17.462127, -17.428851, -12.260605] ->>>>>>> develop pywrapper_buoyancy.test_vals_aarch64 = [-17.746018, -17.460693, -17.430708, -12.260624] pywrapper_buoyancy.command = TestCase.Command("mpirun -np 2", "python", "run.py") test_list.append(pywrapper_buoyancy) diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index 25d5645c167e..b5cbd2eee1d4 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -316,13 +316,8 @@ def main(): da_unsteadyCHT_cylinder.cfg_dir = "coupled_cht/disc_adj_unsteadyCHT_cylinder" da_unsteadyCHT_cylinder.cfg_file = "chtMaster.cfg" da_unsteadyCHT_cylinder.test_iter = 2 -<<<<<<< HEAD da_unsteadyCHT_cylinder.test_vals = [-12.131633, -12.617906, -12.688933, -16.179747, -6.432277, 0.000000, 75.761000, 0.247780] da_unsteadyCHT_cylinder.test_vals_aarch64 = [-12.131633, -12.617906, -12.688933, -16.179747, -6.432277, 0.000000, 75.761000, 0.247780] -======= - da_unsteadyCHT_cylinder.test_vals = [-3.508906, -4.317739, -4.241558, -11.836892, -12.862648, 0.000000, 3.688000, 0.295190] - da_unsteadyCHT_cylinder.test_vals_aarch64 = [-3.508906, -4.317739, -4.241558, -11.836892, -12.862650, 0.000000, 3.688000, 0.295190] ->>>>>>> develop da_unsteadyCHT_cylinder.unsteady = True da_unsteadyCHT_cylinder.multizone = True test_list.append(da_unsteadyCHT_cylinder) From 684a5a08b56150b62989b8b52466799da4849fbc Mon Sep 17 00:00:00 2001 From: Cristopher Morales <98025159+Cristopher-Morales@users.noreply.github.com> Date: Thu, 4 Dec 2025 13:26:30 +0100 Subject: [PATCH 86/97] Update SU2_CFD/include/fluid/CConstantDensity.hpp Co-authored-by: Nijso --- SU2_CFD/include/fluid/CConstantDensity.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SU2_CFD/include/fluid/CConstantDensity.hpp b/SU2_CFD/include/fluid/CConstantDensity.hpp index 903ebd4906f7..c5f65c50cc24 100644 --- a/SU2_CFD/include/fluid/CConstantDensity.hpp +++ b/SU2_CFD/include/fluid/CConstantDensity.hpp @@ -62,6 +62,8 @@ class CConstantDensity final : public CFluidModel { /*! * \brief Set the Dimensionless State using Enthalpy. * \param[in] val_enthalpy - Enthalpy value at the point. + * \param[in] val_scalars - not used here. + */ void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) override { Enthalpy = val_enthalpy; From 3d6af7b48ed43f031fb33f4103fb70761e00e30a Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Thu, 4 Dec 2025 14:23:56 +0100 Subject: [PATCH 87/97] returning minimum temperature limits for Newton_Raphson when Cp is a polynomial --- SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp b/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp index 5e26414d1d4e..e1f5f1d9105c 100644 --- a/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp +++ b/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp @@ -66,6 +66,7 @@ class CIncIdealGasPolynomial final : public CFluidModel { coeffs_[i] = config->GetCp_PolyCoeffND(i); Enthalpy_Ref += coeffs_[i] * t_i / (i + 1); } + Temperature_Min = config->GetTemperatureLimits(0); } /*! @@ -122,8 +123,9 @@ class CIncIdealGasPolynomial final : public CFluidModel { delta_temp_iter = delta_enthalpy_iter / Cp_iter; temp_iter += delta_temp_iter; - if (temp_iter < 0.0) { + if (temp_iter < Temperature_Min) { cout << "Warning: Negative temperature has been found during Newton-Raphson" << endl; + temp_iter = Temperature_Min; break; } } @@ -141,4 +143,5 @@ class CIncIdealGasPolynomial final : public CFluidModel { su2double Gamma{0.0}; /*!< \brief Ratio of specific heats. */ array coeffs_; /*!< \brief Polynomial coefficients for heat capacity as a function of temperature. */ su2double Enthalpy_Ref; /*!< \brief Enthalpy computed at the reference temperature. */ + su2double Temperature_Min; /*!< \brief Minimum temperature value allowed in Newton-Raphson iterations. */ }; From cb90aec45c9c65de836426da32e83665c1775c49 Mon Sep 17 00:00:00 2001 From: Nijso Date: Tue, 9 Dec 2025 08:06:53 +0100 Subject: [PATCH 88/97] Update SU2_CFD/include/variables/CIncEulerVariable.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/include/variables/CIncEulerVariable.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/SU2_CFD/include/variables/CIncEulerVariable.hpp b/SU2_CFD/include/variables/CIncEulerVariable.hpp index 4a57834c2bf1..d53dc75386b2 100644 --- a/SU2_CFD/include/variables/CIncEulerVariable.hpp +++ b/SU2_CFD/include/variables/CIncEulerVariable.hpp @@ -73,7 +73,6 @@ class CIncEulerVariable : public CFlowVariable { 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. */ - bool Energy; /*!< \brief Flag for Energy equation in incompressible flows. */ public: /*! * \brief Constructor of the class. From 62a277cad81acd79ee06ea66a1cbe14381ecf269 Mon Sep 17 00:00:00 2001 From: Nijso Date: Tue, 9 Dec 2025 08:07:22 +0100 Subject: [PATCH 89/97] Update SU2_CFD/src/output/CFlowOutput.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/src/output/CFlowOutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 0fa0dcda3df7..696a4c595475 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -241,7 +241,7 @@ void CFlowOutput::SetAnalyzeSurface(const CSolver* const*solver, const CGeometry sqrt(config->GetBulk_Modulus()/(flow_nodes->GetDensity(iPoint))); } Temperature = flow_nodes->GetTemperature(iPoint); - Enthalpy = flow_nodes->GetEnthalpy(iPoint); + Enthalpy = flow_nodes->GetEnthalpy(iPoint); TotalTemperature = Temperature + 0.5*Velocity2/flow_nodes->GetSpecificHeatCp(iPoint); TotalPressure = Pressure + 0.5*Density*Velocity2; } From 64d77c0efdc9be6e369e7d57c0b9da6bc3230333 Mon Sep 17 00:00:00 2001 From: Nijso Date: Tue, 9 Dec 2025 08:07:35 +0100 Subject: [PATCH 90/97] Update SU2_CFD/include/fluid/CConstantDensity.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/include/fluid/CConstantDensity.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/SU2_CFD/include/fluid/CConstantDensity.hpp b/SU2_CFD/include/fluid/CConstantDensity.hpp index c5f65c50cc24..acfeed2e0cf0 100644 --- a/SU2_CFD/include/fluid/CConstantDensity.hpp +++ b/SU2_CFD/include/fluid/CConstantDensity.hpp @@ -63,7 +63,6 @@ class CConstantDensity final : public CFluidModel { * \brief Set the Dimensionless State using Enthalpy. * \param[in] val_enthalpy - Enthalpy value at the point. * \param[in] val_scalars - not used here. - */ void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) override { Enthalpy = val_enthalpy; From 38ce984964f8115cd9927458686e7051b3ed0f37 Mon Sep 17 00:00:00 2001 From: Nijso Date: Tue, 9 Dec 2025 08:08:01 +0100 Subject: [PATCH 91/97] Update SU2_CFD/src/output/CAdjFlowIncOutput.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/src/output/CAdjFlowIncOutput.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp index 1e6c91a4a46b..2c46229940da 100644 --- a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp @@ -225,10 +225,7 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS SetHistoryOutputValue("RMS_ADJ_TEMPERATURE", log10(adjheat_solver->GetRes_RMS(0))); } if (heat) { - if (nDim == 3) - SetHistoryOutputValue("RMS_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_RMS(4))); - else - SetHistoryOutputValue("RMS_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_RMS(3))); + SetHistoryOutputValue("RMS_ADJ_ENTHALPY", log10(adjflow_solver->GetRes_RMS(nDim + 1))); } if (config->AddRadiation()) { From d6606df9185994dc945926e999d7cacd1bc5d24f Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Tue, 9 Dec 2025 10:16:43 +0100 Subject: [PATCH 92/97] fix compile issue --- SU2_CFD/include/variables/CIncEulerVariable.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/SU2_CFD/include/variables/CIncEulerVariable.hpp b/SU2_CFD/include/variables/CIncEulerVariable.hpp index d53dc75386b2..4a57834c2bf1 100644 --- a/SU2_CFD/include/variables/CIncEulerVariable.hpp +++ b/SU2_CFD/include/variables/CIncEulerVariable.hpp @@ -73,6 +73,7 @@ class CIncEulerVariable : public CFlowVariable { 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. */ + bool Energy; /*!< \brief Flag for Energy equation in incompressible flows. */ public: /*! * \brief Constructor of the class. From 985bd3c34fb0b8fba29a4226ed4cfcbcaf917d46 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Wed, 10 Dec 2025 20:54:10 +0100 Subject: [PATCH 93/97] moving Energy flag to CIncNSVariable and making it constant --- SU2_CFD/include/variables/CIncEulerVariable.hpp | 1 - SU2_CFD/include/variables/CIncNSVariable.hpp | 1 + SU2_CFD/src/variables/CIncNSVariable.cpp | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SU2_CFD/include/variables/CIncEulerVariable.hpp b/SU2_CFD/include/variables/CIncEulerVariable.hpp index 4a57834c2bf1..d53dc75386b2 100644 --- a/SU2_CFD/include/variables/CIncEulerVariable.hpp +++ b/SU2_CFD/include/variables/CIncEulerVariable.hpp @@ -73,7 +73,6 @@ class CIncEulerVariable : public CFlowVariable { 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. */ - bool Energy; /*!< \brief Flag for Energy equation in incompressible flows. */ public: /*! * \brief Constructor of the class. diff --git a/SU2_CFD/include/variables/CIncNSVariable.hpp b/SU2_CFD/include/variables/CIncNSVariable.hpp index 5e254506b84f..f9bf112f9819 100644 --- a/SU2_CFD/include/variables/CIncNSVariable.hpp +++ b/SU2_CFD/include/variables/CIncNSVariable.hpp @@ -40,6 +40,7 @@ class CIncNSVariable final : public CIncEulerVariable { private: VectorType Tau_Wall; /*!< \brief Magnitude of the wall shear stress from a wall function. */ VectorType DES_LengthScale; + const bool Energy; /*!< \brief Flag for Energy equation in incompressible flows. */ public: /*! diff --git a/SU2_CFD/src/variables/CIncNSVariable.cpp b/SU2_CFD/src/variables/CIncNSVariable.cpp index d42a06ed6163..9f13d3a1212d 100644 --- a/SU2_CFD/src/variables/CIncNSVariable.cpp +++ b/SU2_CFD/src/variables/CIncNSVariable.cpp @@ -30,7 +30,8 @@ CIncNSVariable::CIncNSVariable(su2double pressure, const su2double *velocity, su2double enthalpy, unsigned long npoint, unsigned long ndim, unsigned long nvar, const CConfig *config) : - CIncEulerVariable(pressure, velocity, enthalpy, npoint, ndim, nvar, config) { + CIncEulerVariable(pressure, velocity, enthalpy, npoint, ndim, nvar, config), + Energy(config->GetEnergy_Equation()) { Vorticity.resize(nPoint,3); StrainMag.resize(nPoint); @@ -46,7 +47,6 @@ CIncNSVariable::CIncNSVariable(su2double pressure, const su2double *velocity, su AuxVar.resize(nPoint,nAuxVar) = su2double(0.0); Grad_AuxVar.resize(nPoint,nAuxVar,nDim); } - Energy = config->GetEnergy_Equation(); if(!Energy) TemperatureInc = config->GetInc_Temperature_Init(); } From 7606f59a814d1e0e81a4622bd5b9e6be79f28956 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Thu, 11 Dec 2025 23:17:40 +0100 Subject: [PATCH 94/97] fixing jacobian contribution energy equation for radiation model --- SU2_CFD/src/numerics/flow/flow_sources.cpp | 3 +-- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/src/numerics/flow/flow_sources.cpp b/SU2_CFD/src/numerics/flow/flow_sources.cpp index 6089a78f2d22..c4b0a962f6e5 100644 --- a/SU2_CFD/src/numerics/flow/flow_sources.cpp +++ b/SU2_CFD/src/numerics/flow/flow_sources.cpp @@ -823,8 +823,7 @@ CNumerics::ResidualType<> CSourceRadiation::ComputeResidual(const CConfig *confi /*--- Jacobian is set to zero on initialization. ---*/ - jacobian[nDim+1][nDim+1] = -RadVar_Source[1]*Volume; - + jacobian[nDim + 1][nDim + 1] = -RadVar_Source[1] * Volume / Cp_i; } return ResidualType<>(residual, jacobian, nullptr); diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index dd3b4511c082..246da78c22b5 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -1661,6 +1661,10 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont second_numerics->SetVolume(geometry->nodes->GetVolume(iPoint)); + /*--- Set Cp (for implicit) ---*/ + + if (implicit) second_numerics->SetSpecificHeat(nodes->GetSpecificHeatCp(iPoint), 0.0); + /*--- Compute the residual ---*/ auto residual = second_numerics->ComputeResidual(config); From 75a729d6c786a367e98e1c1bf57c011c60acdde8 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Fri, 12 Dec 2025 00:15:20 +0100 Subject: [PATCH 95/97] updating residuals p1model parallel regression --- TestCases/parallel_regression.py | 2 +- TestCases/serial_regression.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 5a4f16a8fa16..c5a3a055ad5a 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1319,7 +1319,7 @@ def main(): p1rad.cfg_dir = "radiation/p1model" p1rad.cfg_file = "configp1.cfg" p1rad.test_iter = 100 - p1rad.test_vals = [-7.639646, -7.433603, -0.546639, 0.013226, -133.880000] + p1rad.test_vals = [-7.743666, -7.921411, -2.111848, 0.098302, -47.897000] test_list.append(p1rad) diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 6be3eb35440c..1d06f1aa8d5d 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -1098,7 +1098,7 @@ def main(): p1rad.cfg_dir = "radiation/p1model" p1rad.cfg_file = "configp1.cfg" p1rad.test_iter = 100 - p1rad.test_vals = [-7.641761, -7.438020, -0.541910, 0.003913, -133.770000] + p1rad.test_vals = [-7.751309, -7.923059, -2.119084, 0.091733, -47.387000] test_list.append(p1rad) # ############################### From 7c32a6d057189f0412e75da86832b6e7ef3285ed Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Fri, 12 Dec 2025 08:55:39 +0100 Subject: [PATCH 96/97] undo changes of_grad_cd.csv.ref p1adjoint test case --- .../radiation/p1adjoint/of_grad_cd.csv.ref | 100 +++++++++--------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/TestCases/radiation/p1adjoint/of_grad_cd.csv.ref b/TestCases/radiation/p1adjoint/of_grad_cd.csv.ref index 3261f4b5a175..0f9cfc435c93 100644 --- a/TestCases/radiation/p1adjoint/of_grad_cd.csv.ref +++ b/TestCases/radiation/p1adjoint/of_grad_cd.csv.ref @@ -1,51 +1,51 @@ "VARIABLE" , "GRADIENT" , "FINDIFF_STEP" -0 , -0.000805612 , 0.001 -1 , -0.00295734 , 0.001 -2 , -0.00745938 , 0.001 -3 , -0.0149199 , 0.001 -4 , -0.0249982 , 0.001 -5 , -0.0369863 , 0.001 -6 , -0.050081 , 0.001 -7 , -0.0632298 , 0.001 -8 , -0.0752505 , 0.001 -9 , -0.0851395 , 0.001 -10 , -0.0921234 , 0.001 -11 , -0.0955264 , 0.001 -12 , -0.0948301 , 0.001 -13 , -0.0899838 , 0.001 -14 , -0.0816164 , 0.001 -15 , -0.0708659 , 0.001 -16 , -0.0589605 , 0.001 -17 , -0.0469057 , 0.001 -18 , -0.0354473 , 0.001 -19 , -0.0251745 , 0.001 -20 , -0.0165555 , 0.001 -21 , -0.00985599 , 0.001 -22 , -0.00507083 , 0.001 -23 , -0.00200693 , 0.001 -24 , -0.00043705 , 0.001 -25 , 0.000131687 , 0.001 -26 , 0.0020078 , 0.001 -27 , 0.00694766 , 0.001 -28 , 0.0151982 , 0.001 -29 , 0.0261365 , 0.001 -30 , 0.0389073 , 0.001 -31 , 0.0525923 , 0.001 -32 , 0.0660375 , 0.001 -33 , 0.0779943 , 0.001 -34 , 0.0874455 , 0.001 -35 , 0.0936644 , 0.001 -36 , 0.0960748 , 0.001 -37 , 0.094294 , 0.001 -38 , 0.0884212 , 0.001 -39 , 0.0792256 , 0.001 -40 , 0.0679564 , 0.001 -41 , 0.0559069 , 0.001 -42 , 0.0440918 , 0.001 -43 , 0.0332097 , 0.001 -44 , 0.0237553 , 0.001 -45 , 0.0160694 , 0.001 -46 , 0.0102681 , 0.001 -47 , 0.00615345 , 0.001 -48 , 0.00325583 , 0.001 -49 , 0.00115708 , 0.001 +0 , -0.000958205 , 0.001 +1 , -0.00432733 , 0.001 +2 , -0.0111443 , 0.001 +3 , -0.0214515 , 0.001 +4 , -0.0343997 , 0.001 +5 , -0.0489968 , 0.001 +6 , -0.0643023 , 0.001 +7 , -0.0791818 , 0.001 +8 , -0.092416 , 0.001 +9 , -0.103017 , 0.001 +10 , -0.11024 , 0.001 +11 , -0.113392 , 0.001 +12 , -0.111913 , 0.001 +13 , -0.105766 , 0.001 +14 , -0.0957015 , 0.001 +15 , -0.0830517 , 0.001 +16 , -0.0692182 , 0.001 +17 , -0.0553101 , 0.001 +18 , -0.042129 , 0.001 +19 , -0.0303137 , 0.001 +20 , -0.0203813 , 0.001 +21 , -0.0126226 , 0.001 +22 , -0.00700441 , 0.001 +23 , -0.00322726 , 0.001 +24 , -0.000951904 , 0.001 +25 , 0.00128803 , 0.001 +26 , 0.0051774 , 0.001 +27 , 0.0125547 , 0.001 +28 , 0.0234674 , 0.001 +29 , 0.0370465 , 0.001 +30 , 0.0521956 , 0.001 +31 , 0.0678379 , 0.001 +32 , 0.0827257 , 0.001 +33 , 0.0955787 , 0.001 +34 , 0.105412 , 0.001 +35 , 0.111548 , 0.001 +36 , 0.113415 , 0.001 +37 , 0.110605 , 0.001 +38 , 0.103242 , 0.001 +39 , 0.0922244 , 0.001 +40 , 0.0789963 , 0.001 +41 , 0.0650234 , 0.001 +42 , 0.0514199 , 0.001 +43 , 0.0389312 , 0.001 +44 , 0.0280831 , 0.001 +45 , 0.0192316 , 0.001 +46 , 0.0124655 , 0.001 +47 , 0.00752232 , 0.001 +48 , 0.0039072 , 0.001 +49 , 0.00131195 , 0.001 From fc4f12b17437eca7fe6cd779ea4d8b6517d1bfd8 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Fri, 12 Dec 2025 19:31:16 +0100 Subject: [PATCH 97/97] returning to develop branch in regression.yml --- .github/workflows/regression.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index e3bba90af69c..c89673588bbc 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -211,7 +211,7 @@ jobs: uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402 with: # -t -c - args: -b ${{github.ref}} -t feature_preconditioning -c feature_restart_preconditioning -s ${{matrix.testscript}} + args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} - name: Cleanup uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402 with: