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
8 changes: 8 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ class CConfig {
CONDUCTIVITYMODEL_TURB Kind_ConductivityModel_Turb; /*!< \brief Kind of the Turbulent Thermal Conductivity Model */
DIFFUSIVITYMODEL Kind_Diffusivity_Model; /*!< \brief Kind of the mass diffusivity Model */
FREESTREAM_OPTION Kind_FreeStreamOption; /*!< \brief Kind of free stream option to choose if initializing with density or temperature */
INIT_OPTION_INC Kind_InitOption_Inc; /*!< \brief Kind of initialization of the incompressible solver. */
MAIN_SOLVER Kind_Solver; /*!< \brief Kind of solver: Euler, NS, Continuous adjoint, etc. */
LIMITER Kind_SlopeLimit, /*!< \brief Slope limiter (for the runtime eq. system). */
Kind_SlopeLimit_Flow, /*!< \brief Slope limiter for flow equations.*/
Expand Down Expand Up @@ -4114,6 +4115,13 @@ class CConfig {
* \return free stream option
*/
unsigned short GetKind_InitOption(void) const { return Kind_InitOption; }

/*!
* \brief Get the initialization option of the incompressible solver.
* \return Initialization option of the incompressible solver.
*/
INIT_OPTION_INC GetKind_InitOption_Inc() 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 @@ -751,6 +751,18 @@ static const MapType<std::string, ENUM_INIT_OPTION> InitOption_Map = {
MakePair("TD_CONDITIONS", TD_CONDITIONS)
};

/*!
* \brief Types of initialization of the incompressible solver.
*/
enum class INIT_OPTION_INC {
DENSITY_INIT, /*!< \brief Initialization with the initial density. */
OPERATING_PRESSURE, /*!< \brief Initialization with the operating (thermodynamic) pressure. */
};
static const MapType<std::string, INIT_OPTION_INC> InitOptionInc_Map = {
MakePair("DENSITY_INIT", INIT_OPTION_INC::DENSITY_INIT)
MakePair("OPERATING_PRESSURE", INIT_OPTION_INC::OPERATING_PRESSURE)
};

/*!
* \brief Types of freestream specification
*/
Expand Down
16 changes: 16 additions & 0 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,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 the incompressible solver to choose between the initial
* density and the operating pressure for initializing the solution \n OPTIONS: see \link InitOptionInc_Map \endlink
* \n DEFAULT: fluid model dependent \ingroup Config*/
addEnumOption("INIT_OPTION_INC", Kind_InitOption_Inc, InitOptionInc_Map, INIT_OPTION_INC::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 @@ -5398,6 +5402,18 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
}
}

/*--- Without an explicit INIT_OPTION_INC each fluid model keeps the density it used before the option existed. ---*/

if (!OptionIsSet("INIT_OPTION_INC")) {
if (Kind_FluidModel == FLUID_MIXTURE || Kind_FluidModel == FLUID_FLAMELET) {
Kind_InitOption_Inc = INIT_OPTION_INC::OPERATING_PRESSURE;
} else {
Kind_InitOption_Inc = INIT_OPTION_INC::DENSITY_INIT;
}
} else if (Kind_FluidModel == CONSTANT_DENSITY && Kind_InitOption_Inc == INIT_OPTION_INC::OPERATING_PRESSURE) {
SU2_MPI::Error("CONSTANT_DENSITY fluid model can only be used with INIT_OPTION_INC= DENSITY_INIT.", CURRENT_FUNCTION);
}

if (Kind_Solver != MAIN_SOLVER::INC_EULER && Kind_Solver != MAIN_SOLVER::INC_NAVIER_STOKES && Kind_Solver != MAIN_SOLVER::INC_RANS) {
if ((Kind_FluidModel == CONSTANT_DENSITY) || (Kind_FluidModel == INC_IDEAL_GAS) || (Kind_FluidModel == INC_IDEAL_GAS_POLY)) {
SU2_MPI::Error("Fluid model not compatible with compressible flows.\n CONSTANT_DENSITY/INC_IDEAL_GAS/INC_IDEAL_GAS_POLY are for incompressible only.", CURRENT_FUNCTION);
Expand Down
5 changes: 5 additions & 0 deletions SU2_CFD/include/fluid/CFluidModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,11 @@ class CFluidModel {
*/
void SetEddyViscosity(su2double val_Mu_Turb) { Mu_Turb = val_Mu_Turb; }

/*!
* \brief Set the thermodynamic pressure of the incompressible fluid models.
*/
void SetPressure(su2double val_pressure) { Pressure = val_pressure; }

/*!
* \brief Get fluid model extrapolation instance
* \return Query point lies outside fluid model data range.
Expand Down
1 change: 0 additions & 1 deletion SU2_CFD/include/fluid/CFluidScalar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class CFluidScalar final : public CFluidModel {
private:
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 GasConstant_Ref; /*!< \brief Gas constant reference needed for Nondimensional problems. */
const su2double Std_Ref_Temp_ND; /*!< \brief Nondimensional standard reference temperature for enthalpy. */
const su2double Prandtl_Turb_Number; /*!< \brief Prandlt turbulent number.*/
Expand Down
7 changes: 4 additions & 3 deletions SU2_CFD/src/fluid/CFluidScalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@
CFluidScalar::CFluidScalar(su2double value_pressure_operating, const CConfig* config)
: CFluidModel(),
n_species_mixture(config->GetnSpecies() + 1),
Pressure_Thermodynamic(value_pressure_operating),
GasConstant_Ref(config->GetGas_Constant_Ref()),
Std_Ref_Temp_ND(STD_REF_TEMP / config->GetTemperature_Ref()),
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) {
Pressure = value_pressure_operating;

if (n_species_mixture > ARRAYSIZE) {
SU2_MPI::Error("Too many species, increase ARRAYSIZE", CURRENT_FUNCTION);
}
Expand Down Expand Up @@ -247,7 +248,7 @@ void CFluidScalar::SetTDState_T(const su2double val_temperature, const su2double
MassToMoleFractions(val_scalars);
ComputeGasConstant();
Temperature = val_temperature;
Density = Pressure_Thermodynamic / (Temperature * Gas_Constant);
Density = Pressure / (Temperature * Gas_Constant);
Cp = ComputeMeanSpecificHeatCp(val_scalars);
Cv = Cp - Gas_Constant;
Enthalpy = ComputeEnthalpyFromT(Temperature, val_scalars);
Expand All @@ -272,7 +273,7 @@ void CFluidScalar::SetTDState_h(const su2double val_enthalpy, const su2double* v
* expression h_s = Cp(T - T_ref).
*/
Temperature = val_enthalpy / Cp + Std_Ref_Temp_ND;
Density = Pressure_Thermodynamic / (Temperature * Gas_Constant);
Density = Pressure / (Temperature * Gas_Constant);
Cv = Cp - Gas_Constant;

if (wilke) {
Expand Down
51 changes: 33 additions & 18 deletions SU2_CFD/src/solvers/CIncEulerSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,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_InitOption_Inc() == INIT_OPTION_INC::DENSITY_INIT);

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

Expand All @@ -309,57 +310,50 @@ void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short i
}
ModVel_FreeStream = sqrt(ModVel_FreeStream); config->SetModVel_FreeStream(ModVel_FreeStream);

const su2double* scalar_init = nullptr;
if (config->GetKind_Species_Model() != SPECIES_MODEL::NONE) scalar_init = config->GetSpecies_Init();

/*--- Build the fluid model at the operating pressure, it is rescaled below for density initialization. ---*/

const bool constant_density = (config->GetKind_FluidModel() == CONSTANT_DENSITY);
if (!constant_density) {
config->SetGas_Constant(UNIVERSAL_GAS_CONSTANT/(config->GetMolecular_Weight()/1000.0));
Pressure_Thermodynamic = config->GetPressure_Thermodynamic();
}

CFluidModel* auxFluidModel = nullptr;

switch (config->GetKind_FluidModel()) {

case CONSTANT_DENSITY:

auxFluidModel = new CConstantDensity(Density_FreeStream, config->GetSpecific_Heat_Cp(), Temperature_FreeStream);
auxFluidModel->SetTDState_T(Temperature_FreeStream);
break;

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);
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. ---*/
for (iVar = 0; iVar < config->GetnPolyCoeffs(); iVar++)
config->SetCp_PolyCoeffND(config->GetCp_PolyCoeff(iVar), iVar);
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;

default:
Expand All @@ -368,6 +362,25 @@ void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short i
break;
}

auxFluidModel->SetTDState_T(Temperature_FreeStream, scalar_init);

/*--- Density is proportional to the thermodynamic pressure, match one of the two to the initial value.
The flamelet manifold tabulates the density, there the pressure cannot change it. ---*/

const bool tabulated_density = (config->GetKind_DensityModel() == INC_DENSITYMODEL::FLAMELET);

if (!constant_density) {
if (density_init && !tabulated_density) {
Pressure_Thermodynamic *= Density_FreeStream/auxFluidModel->GetDensity();
auxFluidModel->SetPressure(Pressure_Thermodynamic);
auxFluidModel->SetTDState_T(Temperature_FreeStream, scalar_init);
} else {
Density_FreeStream = auxFluidModel->GetDensity();
config->SetDensity_FreeStream(Density_FreeStream);
}
config->SetPressure_Thermodynamic(Pressure_Thermodynamic);
}

if (viscous) {

for (iVar = 0; iVar < config->GetnPolyCoeffs(); iVar++)
Expand Down Expand Up @@ -634,6 +647,8 @@ void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short i

case INC_DENSITYMODEL::FLAMELET:
cout << "Energy equation is disabled and density is obtained through flamelet manifold." << endl;
if (config->OptionIsSet("INIT_OPTION_INC"))
cout << "INIT_OPTION_INC is not used, the density is looked up in the flamelet manifold." << endl;
break;
}

Expand Down
12 changes: 6 additions & 6 deletions TestCases/parallel_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def main():
flame_init_methods.new_output = True
test_list.append(flame_init_methods)

# 2D laminar premixed ch4-air flame, transient flame propagation
# 2D laminar premixed ch4-air flame, transient flame propagation
cfd_flamelet_ch4_unsteady = TestCase('cfd_flamelet_ch4_unsteady')
cfd_flamelet_ch4_unsteady.cfg_dir = "flamelet/09_laminar_premixed_ch4_flame_unsteady"
cfd_flamelet_ch4_unsteady.cfg_file = "lam_prem_ch4_unsteady.cfg"
Expand Down Expand Up @@ -1769,23 +1769,23 @@ 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.239996, -3.625478, -3.874990, -7.535233, -5.130497, 5.000000, -1.677719, 5.000000, -3.494206, 5.000000, -2.085734, 2.494985, 0.985388, 0.599841, 0.909757]
species2_primitiveVenturi_mixingmodel_viscosity.test_vals = [-5.243310, -3.635941, -3.892111, -7.558656, -5.131491, 5.000000, -1.668102, 5.000000, -3.474705, 5.000000, -2.085931, 2.494619, 0.985334, 0.599879, 0.909406]
test_list.append(species2_primitiveVenturi_mixingmodel_viscosity)

# 2 species (1 eq) primitive venturi mixing using mixing model including heat capacity and mass diffusivity
species2_primitiveVenturi_mixingmodel_heatcapacity_H2 = TestCase('species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg')
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.815955, -4.624944, -4.555357, -6.656244, 2.075950, -5.479969, 30.000000, -7.342937, 12.000000, -8.030131, 8.000000, -8.931183, 2.092270, 1.000000, 0.600000, 0.492270]
species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-5.837690, -4.641815, -4.576060, -6.662811, 2.074231, -5.482861, 30.000000, -7.308120, 12.000000, -8.022273, 8.000000, -8.828506, 2.092336, 1.000000, 0.600000, 0.492336]
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
species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND = TestCase('species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg')
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.404273, -4.918833, -4.841423, -7.647725, 1.772604, -5.085765, 10.000000, -2.745490, 3.000000, -5.207707, 5.000000, -5.863162, 2.092298, 1.000000, 0.600000, 0.492298]
species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.706757, -5.216206, -5.142503, -7.926926, 1.492326, -5.366923, 10.000000, -2.738884, 3.000000, -5.208126, 5.000000, -5.742459, 2.092365, 1.000000, 0.600000, 0.492365]
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
Expand Down Expand Up @@ -1825,7 +1825,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.847447, -1.922191, -1.947568, -0.716575, 1.211626, -3.930420, 21.000000, -5.152536, 9.000000, -5.329555, 4.000000, -5.865224, 2.000000, 1.000000, 0.000000, 1.000000]
species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.test_vals = [-4.847325, -1.922154, -1.947527, -0.716546, 1.211740, -3.930346, 21.000000, -5.152522, 9.000000, -5.325373, 4.000000, -5.865914, 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.
Expand Down Expand Up @@ -1868,7 +1868,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.634924, -4.516692]
species3_multizone_restart.test_vals = [-4.621056, -4.492840]
species3_multizone_restart.multizone = True
test_list.append(species3_multizone_restart)

Expand Down
Loading
Loading