-
Notifications
You must be signed in to change notification settings - Fork 917
[WIP] Add initialization option for incompressible solver #2709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
| /*! | ||
| * \brief Types of initialization option incompressible solver | ||
| */ | ||
| enum ENUM_INIT_OPTION_INC { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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!!!
There was a problem hiding this comment.
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
| if (density_init) { | ||
| Pressure_Thermodynamic = Density_FreeStream * Temperature_FreeStream * config->GetGas_Constant(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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!!
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!!!
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.
pre-commit run --allto format old commits.