Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ jobs:
uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402
with:
# -t <Tutorials-branch> -c <Testcases-branch>
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}}
args: -b ${{github.ref}} -t feature_initialization -c develop -s ${{matrix.testscript}}
- name: Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402
with:
Expand Down
8 changes: 8 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ class CConfig {
LINEAR_SOLVER_INNER Kind_Linear_Solver_Inner; /*!< \brief Inner solver used in nested Krylov schemes. */
unsigned short Kind_FluidModel, /*!< \brief Kind of the Fluid Model: Ideal, van der Waals, etc. */
Kind_InitOption, /*!< \brief Kind of Init option to choose if initializing with Reynolds number or with thermodynamic conditions */
Kind_InitOption_Inc, /*!< \brief Kind of Init option for incompressible solver, initializing with initial density or operating pressure */
Kind_GridMovement, /*!< \brief Kind of the static mesh movement. */
*Kind_SurfaceMovement, /*!< \brief Kind of the static mesh movement. */
nKind_SurfaceMovement, /*!< \brief Kind of the dynamic mesh movement. */
Expand Down Expand Up @@ -4045,6 +4046,13 @@ class CConfig {
* \return free stream option
*/
unsigned short GetKind_InitOption(void) const { return Kind_InitOption; }

/*!
* \brief Get kind of initialization option for incompressible flows.
* \return Kind initialization option for incompressible flows.
*/
unsigned short GetKind_InitOptionInc(void) const { return Kind_InitOption_Inc; }

/*!
* \brief Get the value of the critical pressure.
* \return Critical pressure.
Expand Down
12 changes: 12 additions & 0 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,18 @@ static const MapType<std::string, ENUM_INIT_OPTION> InitOption_Map = {
MakePair("TD_CONDITIONS", TD_CONDITIONS)
};

/*!
* \brief Types of initialization option incompressible solver
*/
enum ENUM_INIT_OPTION_INC {
Copy link
Contributor

@bigfooted bigfooted Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
enum ENUM_INIT_OPTION_INC {
enum class INIT_OPTION_INC {

DENSITY_INIT = 0, /*!< \brief Density initalization. */
OPERATING_PRESSURE = 1 /*!< \brief Operating pressure initalization. */
};
static const MapType<std::string, ENUM_INIT_OPTION_INC> InitOptionInc_Map = {
MakePair("DENSITY_INIT", DENSITY_INIT)
MakePair("OPERATING_PRESSURE", OPERATING_PRESSURE)
};

/*!
* \brief Types of freestream specification
*/
Expand Down
10 changes: 10 additions & 0 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,10 @@ void CConfig::SetConfig_Options() {
addDoubleOption("MACH_NUMBER", Mach, 0.0);
/*!\brief INIT_OPTION \n DESCRIPTION: Init option to choose between Reynolds or thermodynamics quantities for initializing the solution \n OPTIONS: see \link InitOption_Map \endlink \n DEFAULT REYNOLDS \ingroup Config*/
addEnumOption("INIT_OPTION", Kind_InitOption, InitOption_Map, REYNOLDS);
/*!\brief INIT_OPTION_INC \n DESCRIPTION: Init option for incompressible solver to choose between initial density or
* operating pressure initialization of the solution \n OPTIONS: see \link InitOption_Map \endlink \n DEFAULT REYNOLDS
* \ingroup Config*/
addEnumOption("INIT_OPTION_INC", Kind_InitOption_Inc, InitOptionInc_Map, DENSITY_INIT);
/* DESCRIPTION: Free-stream option to choose between density and temperature for initializing the solution */
addEnumOption("FREESTREAM_OPTION", Kind_FreeStreamOption, FreeStreamOption_Map, FREESTREAM_OPTION::TEMPERATURE_FS);
/*!\brief FREESTREAM_PRESSURE\n DESCRIPTION: Free-stream pressure (101325.0 N/m^2 by default) \ingroup Config*/
Expand Down Expand Up @@ -3558,6 +3562,12 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
SU2_MPI::Error("CoolProp can not be used with non-dimensionalization.", CURRENT_FUNCTION);
}

/*--- Check if CONSTANT_DENSITY model is used with INIT_OPTION_INC=OPERATING_PRESSURE. ---*/
if (Kind_FluidModel == CONSTANT_DENSITY && Kind_InitOption_Inc == OPERATING_PRESSURE) {
SU2_MPI::Error("CONSTANT_DENSITY fluid model can only be used with INIT_OPTION_INC=DENSITY_INIT.",
CURRENT_FUNCTION);
}

/*--- STL_BINARY output not implemented yet, but already a value in option_structure.hpp---*/
for (unsigned short iVolumeFile = 0; iVolumeFile < nVolumeOutputFiles; iVolumeFile++) {
if (VolumeOutputFiles[iVolumeFile] == OUTPUT_TYPE::STL_BINARY){
Expand Down
24 changes: 10 additions & 14 deletions SU2_CFD/src/solvers/CIncEulerSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short i
bool tkeNeeded = ((turbulent) && ((config->GetKind_Turb_Model() == TURB_MODEL::SST)));
bool energy = config->GetEnergy_Equation();
bool boussinesq = (config->GetKind_DensityModel() == INC_DENSITYMODEL::BOUSSINESQ);
bool density_init = (config->GetKind_InitOptionInc() == DENSITY_INIT);

/*--- Compute dimensional free-stream values. ---*/

Expand All @@ -283,6 +284,14 @@ void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short i
}
ModVel_FreeStream = sqrt(ModVel_FreeStream); config->SetModVel_FreeStream(ModVel_FreeStream);

config->SetGas_Constant(UNIVERSAL_GAS_CONSTANT / (config->GetMolecular_Weight() / 1000.0));
if (density_init) {
Pressure_Thermodynamic = Density_FreeStream * Temperature_FreeStream * config->GetGas_Constant();
Comment on lines +288 to +289
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it valid to use this for constant density fluids?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi!!

The constant density fluid does not define and use the thermodynamics pressure, that is why the test cases that use the constant density model do not fail.

/*!
 * \class CConstantDensity
 * \brief Child class for defining a constant density gas model (incompressible only).
 * \author: T. Economon
 */
class CConstantDensity final : public CFluidModel {
 public:
  /*!
   * \brief Constructor of the class.
   */
  CConstantDensity(su2double val_Density, su2double val_Cp, su2double val_Temperature_Ref) {
    Density = val_Density;
    Cp = val_Cp;
    Cv = val_Cp;
    Std_Ref_Temp_ND = val_Temperature_Ref;
  }

For the other fluid models, the ideal gas law is used

$\rho = \frac{p_{op}}{RT/W}$

so they require the thermodynamic pressure, but for constant density, it is not used.
Please let me know if I should add an if statement there or maybe a runtime error that DENSITY_INIT must be used
when the fluid model is CONSTANT_DENSITY.

Thank you so much in advance!!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what would be the initial pressure in that case?
If it doesn't make sense to use density init, throw an error.

Copy link
Contributor Author

@Cristopher-Morales Cristopher-Morales Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi!!

The initial pressure for incompressible solver is always initialized to zero. This thermodynamic pressure is mainly used for computing the density using the ideal gas law.

in the constructor of the CIncEulerSolver:

/*--- Read farfield conditions ---*/

 Density_Inf     = config->GetDensity_FreeStreamND();
 Pressure_Inf    = config->GetPressure_FreeStreamND();
 Velocity_Inf    = config->GetVelocity_FreeStreamND();
 Temperature_Inf = config->GetTemperature_FreeStreamND();
 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 solution to the far-field state everywhere. ---*/

 if (navier_stokes) {
   nodes = new CIncNSVariable(Pressure_Inf, Velocity_Inf, Enthalpy_Inf, nPoint, nDim, nVar, config);
 } else {
   nodes = new CIncEulerVariable(Pressure_Inf, Velocity_Inf, Enthalpy_Inf, nPoint, nDim, nVar, config);
 }

before the above code , there is a called to the SetNonDimensionalization. and in the SetNonDimensionalization, the FreeStream pressure is set as:

/*--- Compute dimensional free-stream values. ---*/

  Density_FreeStream     = config->GetInc_Density_Init();     config->SetDensity_FreeStream(Density_FreeStream);
  Temperature_FreeStream = config->GetInc_Temperature_Init(); config->SetTemperature_FreeStream(Temperature_FreeStream);
  Pressure_FreeStream    = 0.0; config->SetPressure_FreeStream(Pressure_FreeStream);

I will add throw error.

Thanks!!!

} else {
Pressure_Thermodynamic = config->GetPressure_Thermodynamic();
}
config->SetPressure_Thermodynamic(Pressure_Thermodynamic);

CFluidModel* auxFluidModel = nullptr;

switch (config->GetKind_FluidModel()) {
Expand All @@ -295,18 +304,12 @@ void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short i

case INC_IDEAL_GAS:

config->SetGas_Constant(UNIVERSAL_GAS_CONSTANT/(config->GetMolecular_Weight()/1000.0));
Pressure_Thermodynamic = Density_FreeStream*Temperature_FreeStream*config->GetGas_Constant();
auxFluidModel = new CIncIdealGas(config->GetSpecific_Heat_Cp(), config->GetGas_Constant(), Pressure_Thermodynamic, STD_REF_TEMP);
auxFluidModel->SetTDState_T(Temperature_FreeStream);
Pressure_Thermodynamic = auxFluidModel->GetPressure();
config->SetPressure_Thermodynamic(Pressure_Thermodynamic);
auxFluidModel->SetTDState_T(Temperature_FreeStream);
break;

case INC_IDEAL_GAS_POLY:

config->SetGas_Constant(UNIVERSAL_GAS_CONSTANT/(config->GetMolecular_Weight()/1000.0));
Pressure_Thermodynamic = Density_FreeStream*Temperature_FreeStream*config->GetGas_Constant();
auxFluidModel = new CIncIdealGasPolynomial<N_POLY_COEFFS>(config->GetGas_Constant(), Pressure_Thermodynamic, STD_REF_TEMP);
if (viscous) {
/*--- Variable Cp model via polynomial. ---*/
Expand All @@ -315,24 +318,17 @@ void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short i
auxFluidModel->SetCpModel(config, Temperature_FreeStream);
}
auxFluidModel->SetTDState_T(Temperature_FreeStream);
Pressure_Thermodynamic = auxFluidModel->GetPressure();
config->SetPressure_Thermodynamic(Pressure_Thermodynamic);
break;

case FLUID_MIXTURE:

config->SetGas_Constant(UNIVERSAL_GAS_CONSTANT / (config->GetMolecular_Weight() / 1000.0));
Pressure_Thermodynamic = config->GetPressure_Thermodynamic();
auxFluidModel = new CFluidScalar(Pressure_Thermodynamic, config);
auxFluidModel->SetTDState_T(Temperature_FreeStream, config->GetSpecies_Init());
break;

case FLUID_FLAMELET:

config->SetGas_Constant(UNIVERSAL_GAS_CONSTANT / (config->GetMolecular_Weight() / 1000.0));
Pressure_Thermodynamic = config->GetPressure_Thermodynamic();
auxFluidModel = new CFluidFlamelet(config, Pressure_Thermodynamic);
config->SetPressure_Thermodynamic(Pressure_Thermodynamic);
auxFluidModel->SetTDState_T(Temperature_FreeStream, config->GetSpecies_Init());
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ INC_DENSITY_INIT= 1.00
INC_VELOCITY_INIT= (0.5, 0.0, 0.0 )
INC_TEMPERATURE_INIT= 300.0
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE
%
% -------------------- FLUID MODEL --------------------------------------- %
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ INC_VELOCITY_INIT= ( 0.2, 0, 0 )
INC_ENERGY_EQUATION= YES
INC_TEMPERATURE_INIT= 300.0
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the default please so that users in the wild are not surprised

Copy link
Contributor Author

@Cristopher-Morales Cristopher-Morales Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi!

Thanks for your comment!!

If I understand correctly, should I change the default to OPERATING_PRESSURE? or you mean to add the default in the config_template?

I have already added this in the config_template:

% Init option incompressible solver to choose between initial density (default) or operating pressure
% for initializing the solution (DENSITY_INIT, OPERATING_PRESSURE)
INIT_OPTION_INC= DENSITY_INIT

Thank you so much in advance!!!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

operating pressure so that not having it in the config is backward compatible

%
% -------------------- FLUID PROPERTIES ------------------------------------- %
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ INC_VELOCITY_INIT= ( 0.2, 0, 0 )
INC_ENERGY_EQUATION= YES
INC_TEMPERATURE_INIT= 300.0
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE
%
% -------------------- FLUID PROPERTIES ------------------------------------- %
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ INC_VELOCITY_INIT= ( 0.2, 0, 0 )
INC_ENERGY_EQUATION= YES
INC_TEMPERATURE_INIT= 300.0
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE

% -------------------- FLUID MODEL --------------------------------------- %

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ INC_VELOCITY_INIT= ( 0.2, 0, 0 )
INC_ENERGY_EQUATION= YES
INC_TEMPERATURE_INIT= 300.0
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE

% -------------------- FLUID MODEL --------------------------------------- %

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ INC_DENSITY_INIT= 1.00
INC_VELOCITY_INIT= (0.5, 0.0, 0.0 )
INC_TEMPERATURE_INIT= 300.0
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE
%
%
AXISYMMETRIC= YES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ INC_DENSITY_INIT= 1.00
INC_VELOCITY_INIT= (0.7, 0.0, 0.0 )
INC_TEMPERATURE_INIT= 300.0
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE
%
% -------------------- FLUID MODEL --------------------------------------- %
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ INC_VELOCITY_INIT= (1.13, 0.0, 0.0 )
INC_TEMPERATURE_INIT= 300.0
THERMODYNAMIC_PRESSURE= 101325
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE

% -------------------- FLUID MODEL --------------------------------------- %
%
Expand Down
3 changes: 2 additions & 1 deletion TestCases/species_transport/multizone/zone1.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ INC_DENSITY_INIT= 1.2
INC_VELOCITY_INIT= ( 1.0, 0.0, 0.0 )
INC_ENERGY_EQUATION= YES
INC_TEMPERATURE_INIT= 300.0
INC_NONDIM= DIMENSIONAL
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE
%
% -------------------- FLUID PROPERTIES ------------------------------------- %
%
Expand Down
3 changes: 2 additions & 1 deletion TestCases/species_transport/multizone/zone2.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ INC_DENSITY_INIT= 1.2
INC_VELOCITY_INIT= ( 1.0, 0.0, 0.0 )
INC_ENERGY_EQUATION= YES
INC_TEMPERATURE_INIT= 300.0
INC_NONDIM= DIMENSIONAL
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE
%
% -------------------- FLUID PROPERTIES ------------------------------------- %
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ TEMPERATURE_LIMITS= 250, 400
INC_TEMPERATURE_INIT= 350.0
%
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE
%
% -------------------- FLUID PROPERTIES ------------------------------------- %
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ INC_ENERGY_EQUATION= YES
INC_TEMPERATURE_INIT= 350.0
%
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE
%
% -------------------- FLUID PROPERTIES ------------------------------------- %
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ INC_ENERGY_EQUATION= YES
INC_TEMPERATURE_INIT= 350.0
%
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE
%
% -------------------- FLUID PROPERTIES ------------------------------------- %
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ INC_ENERGY_EQUATION= YES
INC_TEMPERATURE_INIT= 300.0
%
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE
%
% -------------------- FLUID PROPERTIES ------------------------------------- %
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ INC_ENERGY_EQUATION= NO
INC_TEMPERATURE_INIT= 300.0
%
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE
%
% -------------------- FLUID PROPERTIES ------------------------------------- %
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ INC_ENERGY_EQUATION= YES
INC_TEMPERATURE_INIT= 300.0
%
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE
%
% -------------------- FLUID PROPERTIES ------------------------------------- %
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ INC_ENERGY_EQUATION= YES
INC_TEMPERATURE_INIT= 300.0
%
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE
%
% -------------------- FLUID PROPERTIES ------------------------------------- %
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ INC_ENERGY_EQUATION= YES
INC_TEMPERATURE_INIT= 300.0
%
INC_NONDIM= INITIAL_VALUES
INIT_OPTION_INC= OPERATING_PRESSURE
%
% -------------------- FLUID PROPERTIES ------------------------------------- %
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ INC_ENERGY_EQUATION= NO
INC_TEMPERATURE_INIT= 300.0
%
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE
%
% -------------------- FLUID PROPERTIES ------------------------------------- %
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ INC_ENERGY_EQUATION= NO
INC_TEMPERATURE_INIT= 294.0
%
INC_NONDIM= DIMENSIONAL
INIT_OPTION_INC= OPERATING_PRESSURE
%
% -------------------- FLUID PROPERTIES ------------------------------------- %
%
Expand Down
4 changes: 4 additions & 0 deletions config_template.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ INC_TEMPERATURE_INIT= 288.15
% INC_*_REF values are ignored unless REFERENCE_VALUES is chosen.
INC_NONDIM= INITIAL_VALUES
%
% Init option incompressible solver to choose between initial density (default) or operating pressure
% for initializing the solution (DENSITY_INIT, OPERATING_PRESSURE)
INIT_OPTION_INC= DENSITY_INIT
%
% Reference density for incompressible flows (1.0 kg/m^3 by default)
INC_DENSITY_REF= 1.0
%
Expand Down
Loading