From a2585f432151d846afb07f9581899cdb5055c7d6 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 12 Apr 2026 00:06:18 +0200 Subject: [PATCH] initialization --- Common/src/CConfig.cpp | 16 ++++++++++++++++ SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp | 12 ++++++++---- subprojects/CoolProp | 2 +- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 65a84ed437d..1a2a0dc0ed3 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -5707,6 +5707,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()) { diff --git a/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp b/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp index d2143ba8d1d..a2fcc48fbb3 100644 --- a/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp +++ b/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp @@ -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]); + } } } @@ -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; diff --git a/subprojects/CoolProp b/subprojects/CoolProp index 98b3523d5da..bafdea1f39e 160000 --- a/subprojects/CoolProp +++ b/subprojects/CoolProp @@ -1 +1 @@ -Subproject commit 98b3523d5daa98454618d381d2ae53f7471d216b +Subproject commit bafdea1f39ee873a6bb9833e3a21fe41f90b85e8