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
7 changes: 7 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,7 @@ class CConfig {
bool Species_StrongBC; /*!< \brief Boolean whether strong BC's are used for in- outlet of the species solver. */
su2double* Species_Init; /*!< \brief Initial uniform value for scalar transport. */
unsigned short nSpecies_Init; /*!< \brief Number of entries of SPECIES_INIT */
su2double Species_T_ignition; /*!< \brief Ignition temperature for the species, used for initialization. */

/*--- Additional flamelet solver options ---*/
FluidFlamelet_ParsedOptions flamelet_ParsedOptions; /*!< \brief Additional flamelet solver options */
Expand Down Expand Up @@ -2251,6 +2252,12 @@ class CConfig {
*/
const su2double* GetSpecies_Init() const { return Species_Init; }

/*!
* \brief Get the ignition temperature for the species.
* \return Ignition temperature for the species.
*/
su2double GetSpecies_T_ignition() const { return Species_T_ignition; }

/*!
* \brief Get the flag for using strong BC's for in- and outlets in the species solver.
* \return Flag for strong BC's.
Expand Down
19 changes: 19 additions & 0 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,9 @@ void CConfig::SetConfig_Options() {
/*!\brief SPARK_REACTION_RATES \n DESCRIPTION: Net source term values applied to species within spark area during spark ignition. \ingroup Config*/
addDoubleListOption("SPARK_REACTION_RATES", flamelet_ParsedOptions.nspark, flamelet_ParsedOptions.spark_reaction_rates);

/*!\brief FLAME_INIT_IGNITION \n DESCRIPTION: Ignition temperature for the flame initialization \ingroup Config*/
addDoubleOption("FLAME_INIT_IGNITION", Species_T_ignition, 5000.0);

/*--- Options related to mass diffusivity and thereby the species solver. ---*/

/*!\brief DIFFUSIVITY_MODEL\n DESCRIPTION: mass diffusivity model \n DEFAULT constant disffusivity \ingroup Config*/
Expand Down Expand Up @@ -5707,6 +5710,22 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
SU2_MPI::Error("Number of initial species incompatible with number of controlling variables and user scalars.", CURRENT_FUNCTION);
/*--- We can have additional user defined transported scalars ---*/
flamelet_ParsedOptions.n_scalars = flamelet_ParsedOptions.n_control_vars + flamelet_ParsedOptions.n_user_scalars;

/*--- Check that spark ignition has required parameters defined ---*/
if (flamelet_ParsedOptions.ignition_method == FLAMELET_INIT_TYPE::SPARK) {
/*--- Check if SPARK_INIT was explicitly set in config file ---*/
if (all_options.find("SPARK_INIT") != all_options.end()) {
SU2_MPI::Error("FLAME_INIT_METHOD= SPARK requires SPARK_INIT to be defined in the config file.", CURRENT_FUNCTION);
}
/*--- Check if SPARK_REACTION_RATES was explicitly set in config file ---*/
if (all_options.find("SPARK_REACTION_RATES") != all_options.end()) {
SU2_MPI::Error("FLAME_INIT_METHOD= SPARK requires SPARK_REACTION_RATES to be defined in the config file.", CURRENT_FUNCTION);
}
if (flamelet_ParsedOptions.nspark < flamelet_ParsedOptions.n_scalars) {
SU2_MPI::Error("SPARK_REACTION_RATES must have at least " + to_string(flamelet_ParsedOptions.n_scalars) +
" values (one for each scalar variable), but only " + to_string(flamelet_ParsedOptions.nspark) + " were provided.", CURRENT_FUNCTION);
}
}
}

if (Kind_Regime == ENUM_REGIME::COMPRESSIBLE && GetBounded_Scalar()) {
Expand Down
3 changes: 2 additions & 1 deletion SU2_CFD/include/solvers/CSpeciesFlameletSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ class CSpeciesFlameletSolver final : public CSpeciesSolver {
* \brief Find maximum progress variable value within the manifold for the current solution.
* \param[in] fluid_model - pointer to flamelet fluid model.
* \param[in] scalars - local scalar solution.
* \param[in] T_ignition - ignition temperature - at this temperature, the progress variable is considered burnt.
* \return - maximum progress variable value within manifold bounds.
*/
su2double GetBurntProgressVariable(CFluidModel* fluid_model, const su2double* scalars);
su2double GetBurntProgressVariable(CFluidModel* fluid_model, const su2double* scalars, const su2double T_ignition);

/*!
* \brief Retrieve scalar source terms from manifold.
Expand Down
29 changes: 20 additions & 9 deletions SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,11 @@ void CSpeciesFlameletSolver::Preprocessing(CGeometry* geometry, CSolver** solver
spark_radius = flamelet_config_options.spark_init[3];
dist_from_center = GeometryToolbox::SquaredDistance(nDim, geometry->nodes->GetCoord(i_point), flamelet_config_options.spark_init.data());
if (dist_from_center < pow(spark_radius,2)) {
for (auto iVar = 0u; iVar < nVar; iVar++)
nodes->SetScalarSource(i_point, iVar, nodes->GetScalarSources(i_point)[iVar] + flamelet_config_options.spark_reaction_rates[iVar]);
/*--- Add spark reaction rates to the sources that were just set by SetScalarSources ---*/
const su2double* current_sources = nodes->GetScalarSources(i_point);
for (auto iVar = 0u; iVar < nVar; iVar++) {
nodes->SetScalarSource(i_point, iVar, current_sources[iVar] + flamelet_config_options.spark_reaction_rates[iVar]);
}
}
}

Expand Down Expand Up @@ -181,7 +184,7 @@ void CSpeciesFlameletSolver::SetInitialCondition(CGeometry** geometry, CSolver**
su2double enth_inlet = config->GetSpecies_Init()[I_ENTH];

su2double prog_burnt = 0, prog_unburnt, point_loc;
su2double scalar_init[MAXNVAR];
su2double scalar_init[MAXNVAR]= {0.0};

if (rank == MASTER_NODE) {
cout << "initial condition: T = " << temp_inlet << endl;
Expand All @@ -194,10 +197,11 @@ void CSpeciesFlameletSolver::SetInitialCondition(CGeometry** geometry, CSolver**
cout << "Ignition with a straight flame front" << endl;
break;
case FLAMELET_INIT_TYPE::SPARK:
cout << "Ignition with an artificial spark" << endl;
cout << "Ignition with an artificial spark at iteration "<< flamelet_config_options.spark_init[4]
<< " for a duration of " << flamelet_config_options.spark_init[5] << " iterations." << endl;
break;
case FLAMELET_INIT_TYPE::NONE:
cout << "No solution ignition (cold flow)" << endl;
cout << "No solution ignition (cold flow or restart)" << endl;
break;
default:
break;
Expand All @@ -213,14 +217,15 @@ void CSpeciesFlameletSolver::SetInitialCondition(CGeometry** geometry, CSolver**

for (unsigned long i_mesh = 0; i_mesh <= config->GetnMGLevels(); i_mesh++) {
fluid_model_local = solver_container[i_mesh][FLOW_SOL]->GetFluidModel();
if (flame_front_ignition) prog_burnt = GetBurntProgressVariable(fluid_model_local, scalar_init);

for (auto iVar = 0u; iVar < nVar; iVar++) scalar_init[iVar] = config->GetSpecies_Init()[iVar];

/*--- Set enthalpy based on initial temperature and scalars. ---*/
n_not_iterated_local += GetEnthFromTemp(fluid_model_local, temp_inlet, config->GetSpecies_Init(), &enth_inlet);
scalar_init[I_ENTH] = enth_inlet;

if (flame_front_ignition) prog_burnt = GetBurntProgressVariable(fluid_model_local, scalar_init, config->GetSpecies_T_ignition());

prog_unburnt = config->GetSpecies_Init()[I_PROGVAR];
SU2_OMP_FOR_STAT(omp_chunk_size)
for (unsigned long i_point = 0; i_point < nPoint; i_point++) {
Expand Down Expand Up @@ -791,15 +796,21 @@ unsigned long CSpeciesFlameletSolver::GetEnthFromTemp(CFluidModel* fluid_model,
return exit_code;
}

su2double CSpeciesFlameletSolver::GetBurntProgressVariable(CFluidModel* fluid_model, const su2double* scalar_solution) {
su2double CSpeciesFlameletSolver::GetBurntProgressVariable(CFluidModel* fluid_model, const su2double* scalar_solution, const su2double T_ignition) {
su2double scalars[MAXNVAR], delta = 1e-3;
for (auto iVar = 0u; iVar < nVar; iVar++) scalars[iVar] = scalar_solution[iVar];
bool outside = false;
scalars[I_PROGVAR] += delta;
while (!outside) {
fluid_model->SetTDState_T(300, scalars);
if (fluid_model->GetExtrapolation() == 1 || (fluid_model->GetTemperature()>1000.)) outside = true;
/*--- Note that 300.0 is a dummy temperature here and not used. ---*/
fluid_model->SetTDState_T(300.0, scalars);
if ((fluid_model->GetExtrapolation() == 1) || fluid_model->GetTemperature() > T_ignition) outside = true;
scalars[I_PROGVAR] += delta;
}
su2double pv_burnt = scalars[I_PROGVAR] - delta;
if (rank == MASTER_NODE) {
cout << "Burnt progress variable determined from flamelet table: " << pv_burnt << endl;
cout << "Burnt temperature from flamelet table: " << fluid_model->GetTemperature() << endl;
}
return pv_burnt;
}
Loading