Skip to content

Conversation

@Cristopher-Morales
Copy link
Contributor

@Cristopher-Morales Cristopher-Morales commented Jan 15, 2026

Proposed Changes

This pull request aims to implement initialization option for the incompressible solver similar to the one for the compressible solver.
For some applications using fluid mixture and fluid flamelet model, using operating pressure is preferred. Other applications, the operating pressure is computed using the INC_DENSITY_INIT and INC_TEMPERATURE_INIT options. So, this implementation aims to have a better distinction between both ways of initialization.

Related Work

This was an old pull request #2137

PR Checklist

Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
  • My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
  • I used the pre-commit hook to prevent dirty commits and used pre-commit run --all to format old commits.
  • I have added a test case that demonstrates my contribution, if necessary.
  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary.

@Cristopher-Morales Cristopher-Morales changed the title [WIP] Add initialization options for incompressible solver [WIP] Add initialization option for incompressible solver Jan 16, 2026
/*!
* \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 {

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

Comment on lines +288 to +289
if (density_init) {
Pressure_Thermodynamic = Density_FreeStream * Temperature_FreeStream * config->GetGas_Constant();
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!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants