Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8bd6c74
Implicit progress variable source Jacobian for flamelet solver
bigfooted Nov 19, 2026
b1387fa
Update flamelet regression values for the implicit PV source Jacobian
bigfooted Nov 19, 2026
899ab14
update monitor for unsteady plotting
bigfooted Nov 21, 2026
5cbf7a2
Merge branch 'develop' into fix_unsteady_flamelet
EvertBunschoten Nov 26, 2026
b2cd7c9
Move the progress variable source Jacobian into CFluidFlamelet
bigfooted Nov 27, 2026
99fff93
Merge remote-tracking branch 'origin/fix_unsteady_flamelet' into fix_…
bigfooted Nov 28, 2026
6dabf0c
Merge branch 'develop' into fix_unsteady_flamelet
bigfooted Nov 29, 2026
0e34254
Apply black formatting to the monitor script and its tests
bigfooted Nov 29, 2026
2fdac90
Flamelet LUT: extrapolate linearly beyond the outer table levels
bigfooted Nov 26, 2026
9f36808
Flamelet: block Jacobian of the preferential diffusion terms
bigfooted Nov 26, 2026
c91ac9b
Flamelet: keep the burnt state of the flame front initialization insi…
bigfooted Nov 26, 2026
2215935
Update flamelet regression values for the preferential diffusion Jaco…
bigfooted Nov 29, 2026
971ee6f
Merge branch 'develop' into fix_unsteady_flamelet
bigfooted Nov 29, 2026
a34cb00
Merge branch 'fix_unsteady_flamelet' of https://github.com/su2code/su…
bigfooted Nov 29, 2026
1652a6d
Potential fix for pull request finding 'CodeQL / Multiplication resul…
bigfooted Nov 29, 2026
ceb8532
Move the SU2_MON changes to their own pull request
bigfooted Nov 29, 2026
c3bc995
Flamelet: clamp outside the mixture fraction range, robust PV source …
bigfooted Nov 29, 2026
4dd35f6
Update the flame initialization and premixed hydrogen regression values
bigfooted Nov 30, 2026
76d548e
Fix the preferential diffusion Jacobian step in AD builds
bigfooted Nov 30, 2026
2ee8857
Flamelet: thermal PD Jacobian with its own diffusivity, guard off-man…
bigfooted Nov 30, 2026
645ae90
Merge branch 'develop' into fix_unsteady_flamelet
bigfooted Dec 1, 2026
16203e5
Merge branch 'develop' into fix_unsteady_flamelet
bigfooted Dec 2, 2026
7fa2ba5
Flamelet: divide the auxiliary species source Jacobian by density
bigfooted Dec 2, 2026
0974dd4
Merge branch 'develop' into fix_unsteady_flamelet
bigfooted Dec 4, 2026
a60c647
Flamelet: evaluate the implicit Jacobian derivatives in the fluid model
bigfooted Dec 4, 2026
68764ca
Merge branch 'fix_unsteady_flamelet' of https://github.com/su2code/su…
bigfooted Dec 5, 2026
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/containers/CLookUpTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,14 @@ class CLookUpTable {
return limits_table_x[i_level];
}

/*!
* \brief Determine the minimum and maximum value of the third controlling variable.
* \returns Pair of the values of the first and last table level.
*/
inline std::pair<su2double, su2double> GetTableLimitsZ() const {
return std::make_pair(z_values_levels.front(), z_values_levels.back());
}

/*!
* \brief Check whether requested set of variables are included in the table.
*/
Expand Down
2 changes: 2 additions & 0 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,8 @@ enum FLAMELET_LOOKUP_OPS {
PREFDIF, /*!< \brief Preferential diffusion scalars. */
SOURCES, /*!< \brief Scalar source terms (controlling variables, passive species).*/
LOOKUP, /*!< \brief Passive look-up variables specified in config. */
SOURCES_JACOBIAN, /*!< \brief Scalar source terms and the derivative of the progress variable source. */
PREFDIF_JACOBIAN, /*!< \brief Preferential diffusion scalars and their derivatives to the controlling variables. */
};

/*!
Expand Down
30 changes: 30 additions & 0 deletions SU2_CFD/include/fluid/CFluidFlamelet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ class CFluidFlamelet final : public CFluidModel {
MLPToolbox::CIOMap* iomap_PD; /*!< \brief Input-output map for the preferential diffusion scalars. */
MLPToolbox::CIOMap* iomap_Sources; /*!< \brief Input-output map for species source terms. */
MLPToolbox::CIOMap* iomap_LookUp; /*!< \brief Input-output map for passive look-up terms. */
MLPToolbox::CIOMap* iomap_SourcesJacobian; /*!< \brief Map for source terms and the progress variable source Jacobian. */
MLPToolbox::CIOMap* iomap_PDJacobian; /*!< \brief Map for preferential diffusion scalars and their Jacobian. */
MLPToolbox::CIOMap* iomap_TempJacobian; /*!< \brief Map for the temperature and its Jacobian. */
MLPToolbox::CIOMap* iomap_Current;
#endif

Expand All @@ -93,6 +96,13 @@ class CFluidFlamelet final : public CFluidModel {
val_vars_LookUp, /*!< \brief References passive look-up terms. */
val_vars_PD; /*!< \brief References to preferential diffusion scalars. */

su2double source_pv_jac = 0.0; /*!< \brief Derivative of the progress variable source to the progress variable. */

vector<su2double> pd_jac_beta, /*!< \brief Row-major d(beta_i)/d(phi_j) of the MLP, zero where unsupported. */
pd_jac_temperature, /*!< \brief dT/d(phi_j) of the MLP, zero where unsupported. */
pd_values_temperature; /*!< \brief Temperature returned alongside the MLP Jacobian. */
vector<su2double*> pd_refs_temperature; /*!< \brief Reference to the temperature value above. */

void PreprocessLookUp(CConfig* config);

/*! \brief
Expand Down Expand Up @@ -135,6 +145,26 @@ class CFluidFlamelet final : public CFluidModel {
unsigned long EvaluateDataSet(const vector<su2double>& input_scalar, unsigned short lookup_type,
vector<su2double>& output_refs);

/*!
* \brief Derivatives of the preferential diffusion scalars and of the temperature to the controlling variables.
* \note The thermodynamic state must be set for input_scalar. For MLP, dbeta is taken from the preceding
* EvaluateDataSet with PREFDIF_JACOBIAN at input_scalar. Central differences for LUT.
* \param[in] input_scalar - controlling variables used to interpolate manifold.
* \param[in] beta - preferential diffusion scalars at input_scalar.
* \param[in] step - finite difference step per controlling variable.
* \param[out] dbeta - row-major d(beta_i)/d(phi_j), with beta_i the scalar of controlling variable i.
* \param[out] dtemperature - dT/d(phi_j).
* \param[out] usable - whether column j holds a derivative, false at the edge of the manifold.
*/
void EvaluatePrefDiffJacobian(const vector<su2double>& input_scalar, const vector<su2double>& beta,
const passivedouble* step, su2double* dbeta, su2double* dtemperature, bool* usable);

/*!
* \brief Derivative of the progress variable source with respect to the progress variable.
* \note Set by EvaluateDataSet with SOURCES_JACOBIAN, zero where the source is not positive.
*/
inline su2double GetChemicalSourceJacobian(int iVar) override { return (iVar == I_PROGVAR) ? source_pv_jac : 0.0; }

/*!
* \brief Check for out-of-bounds condition for data set interpolation.
* \return - within bounds (0) or out of bounds (1).
Expand Down
33 changes: 25 additions & 8 deletions SU2_CFD/include/numerics/species/flamelet_edge_flux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ class CScalarFlux_Flamelet final
* \brief Preferential diffusion, two terms with the shape of the ordinary diffusion but of
* states the model synthesises: div(D grad(beta - phi)) for each controlling variable,
* and a thermal term div(beta_T D grad(T)) on the enthalpy equation.
* \note The thermal term has no implicit part, matching the treatment of the heat flux it
* models; the first term has the same thin shear layer Jacobian as the ordinary diffusion,
* because it is the same operator applied to a shifted state.
* \note The Jacobian uses d(beta - phi)/dphi and dT/dphi from the solver, each with the diffusivity of its flux.
*/
template <class VariableType>
FORCEINLINE void extraDiffusionTerms(const FlowIndices& idx, const ScalarFluxOptions& opt, Int iPoint,
Expand Down Expand Up @@ -104,11 +102,16 @@ class CScalarFlux_Flamelet final
if (!opt.oneSided) res.flux_j(iScalar) += D * projGrad;

if (opt.implicit) {
res.jac_ii(iScalar, iScalar) += D * proj_on_rho_i;
if (!opt.oneSided) {
res.jac_ij(iScalar, iScalar) -= D * proj_on_rho_j;
res.jac_ji(iScalar, iScalar) -= D * proj_on_rho_i;
res.jac_jj(iScalar, iScalar) += D * proj_on_rho_j;
for (auto jScalar = 0u; jScalar < nControlVars; ++jScalar) {
const auto iEntry = iScalar * nControlVars + jScalar;
const Double dState_i = gatherVariables(iPoint, side_i.scalarNodes.GetPrefDiffJacobian(), iEntry);
const Double dState_j = gatherVariables(jPoint, side_j.scalarNodes.GetPrefDiffJacobian(), iEntry);
res.jac_ii(iScalar, jScalar) += D * proj_on_rho_i * dState_i;
if (!opt.oneSided) {
res.jac_ij(iScalar, jScalar) -= D * proj_on_rho_j * dState_j;
res.jac_ji(iScalar, jScalar) -= D * proj_on_rho_i * dState_i;
res.jac_jj(iScalar, jScalar) += D * proj_on_rho_j * dState_j;
}
}
}
}
Expand All @@ -132,6 +135,20 @@ class CScalarFlux_Flamelet final

res.flux_i(I_ENTH) -= Dth * projGradT;
if (!opt.oneSided) res.flux_j(I_ENTH) += Dth * projGradT;

if (opt.implicit) {
const auto iFirst = nControlVars * nControlVars;
for (auto jScalar = 0u; jScalar < nControlVars; ++jScalar) {
const Double dT_i = gatherVariables(iPoint, side_i.scalarNodes.GetPrefDiffJacobian(), iFirst + jScalar);
const Double dT_j = gatherVariables(jPoint, side_j.scalarNodes.GetPrefDiffJacobian(), iFirst + jScalar);
res.jac_ii(I_ENTH, jScalar) += Dth * proj_on_rho_i * dT_i;
if (!opt.oneSided) {
res.jac_ij(I_ENTH, jScalar) -= Dth * proj_on_rho_j * dT_j;
res.jac_ji(I_ENTH, jScalar) -= Dth * proj_on_rho_i * dT_i;
res.jac_jj(I_ENTH, jScalar) += Dth * proj_on_rho_j * dT_j;
}
}
}
}

private:
Expand Down
11 changes: 10 additions & 1 deletion SU2_CFD/include/solvers/CSpeciesFlameletSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ class CSpeciesFlameletSolver final : public CSpeciesSolver {
/*!< \brief Number of points outside the manifold domain, shared across OpenMP threads so it can be
* accumulated atomically and reduced by the master thread alone in Preprocessing. */
unsigned long n_not_in_domain_local = 0;
bool pd_jacobian = false; /*!< \brief Whether the preferential diffusion Jacobian is evaluated this iteration. */
passivedouble pd_jacobian_step[MAXNVAR] = {0}; /*!< \brief Finite difference step per controlling variable. */

/*!
* \brief Set the finite difference steps of the preferential diffusion Jacobian, a fraction of the global
* range of each controlling variable.
*/
void SetPrefDiffJacobianSteps();
/*!
* \brief Compute the preconditioner for low-Mach flows.
* \param[in] geometry - Geometrical definition of the problem.
Expand Down Expand Up @@ -105,7 +113,8 @@ class CSpeciesFlameletSolver final : public CSpeciesSolver {
const vector<su2double>& scalars);

/*!
* \brief Retrieve the preferential diffusion scalar values from manifold.
* \brief Retrieve the preferential diffusion scalar values from manifold, and their derivatives to the
* controlling variables when the scheme is implicit.
* \param[in] fluid_model_local - pointer to flamelet fluid model.
* \param[in] iPoint - node ID.
* \param[in] scalars - local scalar solution.
Expand Down
13 changes: 13 additions & 0 deletions SU2_CFD/include/variables/CSpeciesVariable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,23 @@ class CSpeciesVariable : public CScalarVariable {
MatrixType SpeciesSourceTerm; /*!< \brief Matrix (nPoint, nVar) of chemical source terms for species transport*/
MatrixType SpeciesSourceJacobian; /*!< \brief Matrix (nPoint, nVar) of the diagonal chemical source Jacobian. */
VectorType HeatRelease; /*!< \brief Vector of heat release due to combustion for species transport*/
MatrixType PrefDiffJacobian; /*!< \brief Matrix (nPoint, nCV*nCV + nCV): row-major d(beta_i - phi_i)/d(phi_j), then dT/d(phi_j). */

public:
static constexpr size_t MAXNVAR = MAX_TRANSPORTED_SPECIES; /*!< \brief Max number of variables for static arrays. */

/*!
* \brief Derivatives of the preferential diffusion states to the controlling variables, row-major per point.
*/
inline const MatrixType& GetPrefDiffJacobian() const { return PrefDiffJacobian; }

/*!
* \brief Set one derivative: entry iCV*nCV + jCV of the beta block, or nCV*nCV + jCV for temperature.
*/
inline void SetPrefDiffJacobian(unsigned long iPoint, unsigned long iEntry, su2double val) {
PrefDiffJacobian(iPoint, iEntry) = val;
}

/*!
* \brief Constructor of the class.
* \param[in] species_inf - species variable values (initialization value).
Expand Down
149 changes: 148 additions & 1 deletion SU2_CFD/src/fluid/CFluidFlamelet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,27 @@ CFluidFlamelet::CFluidFlamelet(CConfig* config, su2double value_pressure_operati
}
}

/*--- Index of the preferential diffusion scalar belonging to a controlling variable. ---*/
static unsigned short BetaIndex(unsigned short i_cv) {
if (i_cv == I_PROGVAR) return I_BETA_PROGVAR;
if (i_cv == I_ENTH) return I_BETA_ENTH;
return I_BETA_MIXFRAC;
}

CFluidFlamelet::~CFluidFlamelet() {
if (Kind_DataDriven_Method == ENUM_DATADRIVEN_METHOD::LUT) delete look_up_table;
#ifdef USE_MLPCPP
if (Kind_DataDriven_Method == ENUM_DATADRIVEN_METHOD::MLP) {
delete iomap_TD;
delete iomap_Sources;
delete iomap_LookUp;
delete iomap_SourcesJacobian;
delete lookup_mlp;
if (preferential_diffusion) delete iomap_PD;
if (preferential_diffusion) {
delete iomap_PD;
delete iomap_PDJacobian;
delete iomap_TempJacobian;
}
}
#endif
}
Expand Down Expand Up @@ -244,6 +256,47 @@ void CFluidFlamelet::PreprocessLookUp(CConfig* config) {
iomap_PD = new MLPToolbox::CIOMap(controlling_variable_names, varnames_PD);
lookup_mlp->PairVariableswithMLPs(*iomap_PD);
}
iomap_SourcesJacobian = new MLPToolbox::CIOMap(controlling_variable_names, varnames_Sources);
if (!noSource(varnames_Sources[I_PROGVAR]))
iomap_SourcesJacobian->AddQueryJacobian(varnames_Sources[I_PROGVAR], controlling_variable_names[I_PROGVAR],
&source_pv_jac);
lookup_mlp->PairVariableswithMLPs(*iomap_SourcesJacobian);

if (preferential_diffusion) {
/*--- A derivative is queried only where a network has the controlling variable as input, else it is zero. ---*/
auto has_derivative = [](const MLPToolbox::CIOMap& map, const string& output, const string& input) {
for (const auto& network : map.GetNetworksInQuery()) {
const auto network_inputs = network.MLP->GetInputVars();
const auto network_outputs = network.MLP->GetOutputVars();
if (find(network_outputs.begin(), network_outputs.end(), output) != network_outputs.end() &&
find(network_inputs.begin(), network_inputs.end(), input) != network_inputs.end())
return true;
}
return false;
};

pd_jac_beta.assign(n_control_vars * n_control_vars, 0.0);
pd_jac_temperature.assign(n_control_vars, 0.0);
pd_values_temperature.assign(1, 0.0);
pd_refs_temperature = {&pd_values_temperature[0]};

vector<string> beta_names;
for (auto i_cv = 0u; i_cv < n_control_vars; i_cv++) beta_names.push_back(varnames_PD[BetaIndex(i_cv)]);
iomap_PDJacobian = new MLPToolbox::CIOMap(controlling_variable_names, varnames_PD);
iomap_TempJacobian = new MLPToolbox::CIOMap(controlling_variable_names, {varnames_TD[LOOKUP_TD::TEMPERATURE]});
for (auto j_cv = 0u; j_cv < n_control_vars; j_cv++) {
for (auto i_cv = 0u; i_cv < n_control_vars; i_cv++) {
if (has_derivative(*iomap_PD, beta_names[i_cv], controlling_variable_names[j_cv]))
iomap_PDJacobian->AddQueryJacobian(beta_names[i_cv], controlling_variable_names[j_cv],
&pd_jac_beta[i_cv * n_control_vars + j_cv]);
}
if (has_derivative(*iomap_TD, varnames_TD[LOOKUP_TD::TEMPERATURE], controlling_variable_names[j_cv]))
iomap_TempJacobian->AddQueryJacobian(varnames_TD[LOOKUP_TD::TEMPERATURE], controlling_variable_names[j_cv],
&pd_jac_temperature[j_cv]);
}
lookup_mlp->PairVariableswithMLPs(*iomap_PDJacobian);
lookup_mlp->PairVariableswithMLPs(*iomap_TempJacobian);
}
#endif
} else {
for (auto iVar = 0u; iVar < varnames_TD.size(); iVar++) {
Expand Down Expand Up @@ -285,6 +338,10 @@ unsigned long CFluidFlamelet::EvaluateDataSet(const vector<su2double>& input_sca
vector<su2double> val_vars;
vector<su2double*> refs_vars;
vector<unsigned long> LUT_idx;
const bool with_source_jacobian = (lookup_type == FLAMELET_LOOKUP_OPS::SOURCES_JACOBIAN);
if (with_source_jacobian) source_pv_jac = 0.0;
if (lookup_type == FLAMELET_LOOKUP_OPS::PREFDIF_JACOBIAN)
fill(pd_jac_beta.begin(), pd_jac_beta.end(), su2double(0.0));
switch (lookup_type) {
case FLAMELET_LOOKUP_OPS::THERMO:
LUT_idx = LUT_idx_TD;
Expand All @@ -302,6 +359,18 @@ unsigned long CFluidFlamelet::EvaluateDataSet(const vector<su2double>& input_sca
LUT_idx = LUT_idx_Sources;
#ifdef USE_MLPCPP
iomap_Current = iomap_Sources;
#endif
break;
case FLAMELET_LOOKUP_OPS::PREFDIF_JACOBIAN:
LUT_idx = LUT_idx_PD;
#ifdef USE_MLPCPP
iomap_Current = iomap_PDJacobian;
#endif
break;
case FLAMELET_LOOKUP_OPS::SOURCES_JACOBIAN:
LUT_idx = LUT_idx_Sources;
#ifdef USE_MLPCPP
iomap_Current = iomap_SourcesJacobian;
#endif
break;
case FLAMELET_LOOKUP_OPS::LOOKUP:
Expand All @@ -322,9 +391,30 @@ unsigned long CFluidFlamelet::EvaluateDataSet(const vector<su2double>& input_sca
SU2_MPI::Error(string("Output vector size incompatible with manifold lookup operation."), CURRENT_FUNCTION);
if (include_mixture_fraction) {
inside = look_up_table->LookUp_XYZ(LUT_idx, output_refs, val_prog, val_enth, val_mixfrac);
/*--- Beyond the outer levels, beta_Z - Z keeps its boundary value. ---*/
if (lookup_type == FLAMELET_LOOKUP_OPS::PREFDIF) {
const auto limits_z = look_up_table->GetTableLimitsZ();
const su2double mixfrac_bound = min(max(val_mixfrac, limits_z.first), limits_z.second);
output_refs[FLAMELET_PREF_DIFF_SCALARS::I_BETA_MIXFRAC] += val_mixfrac - mixfrac_bound;
}
} else {
inside = look_up_table->LookUp_XY(LUT_idx, output_refs, val_prog, val_enth);
}
if (with_source_jacobian && inside) {
/*--- Forward difference, backward at the manifold edge. ---*/
const su2double delta = 1e-6;
const unsigned long idx = LUT_idx_Sources[I_PROGVAR];
auto lookup = [&](const su2double pv, su2double& source) {
if (include_mixture_fraction) return look_up_table->LookUp_XYZ(idx, &source, pv, val_enth, val_mixfrac);
return look_up_table->LookUp_XY(idx, &source, pv, val_enth);
};
su2double source_pert;
if (lookup(val_prog + delta, source_pert)) {
source_pv_jac = (source_pert - output_refs[I_PROGVAR]) / delta;
} else if (lookup(val_prog - delta, source_pert)) {
source_pv_jac = (output_refs[I_PROGVAR] - source_pert) / delta;
}
}
break;
case ENUM_DATADRIVEN_METHOD::MLP:
refs_vars.resize(output_refs.size());
Expand All @@ -336,9 +426,66 @@ unsigned long CFluidFlamelet::EvaluateDataSet(const vector<su2double>& input_sca
default:
break;
}
if (with_source_jacobian && (!inside || output_refs[I_PROGVAR] <= 0)) source_pv_jac = 0.0;
if (inside) extrapolation = 0;
else extrapolation = 1;
for (auto iVar = 0u; iVar < output_refs.size(); iVar++) AD::SetPreaccOut(output_refs[iVar]);
AD::EndPreacc();
return extrapolation;
}

void CFluidFlamelet::EvaluatePrefDiffJacobian(const vector<su2double>& input_scalar, const vector<su2double>& beta,
const passivedouble* step, su2double* dbeta, su2double* dtemperature,
bool* usable) {
const auto n_cv = n_control_vars;

if (Kind_DataDriven_Method == ENUM_DATADRIVEN_METHOD::MLP) {
#ifdef USE_MLPCPP
fill(pd_jac_temperature.begin(), pd_jac_temperature.end(), su2double(0.0));
const bool inside = lookup_mlp->Predict(*iomap_TempJacobian, input_scalar, pd_refs_temperature);
for (auto j_cv = 0u; j_cv < n_cv; j_cv++) {
usable[j_cv] = inside;
dtemperature[j_cv] = pd_jac_temperature[j_cv];
for (auto i_cv = 0u; i_cv < n_cv; i_cv++) dbeta[i_cv * n_cv + j_cv] = pd_jac_beta[i_cv * n_cv + j_cv];
}
#endif
return;
}

/*--- Central differences, one-sided where a perturbed state is outside the manifold. ---*/
const unsigned long extrapolation_state = extrapolation;
vector<su2double> state(input_scalar), beta_plus(beta.size()), beta_minus(beta.size()), thermo(LOOKUP_TD::SIZE);

auto evaluate = [&](vector<su2double>& beta_out, su2double& temperature_out) {
bool inside = EvaluateDataSet(state, FLAMELET_LOOKUP_OPS::PREFDIF, beta_out) == 0;
inside = (EvaluateDataSet(state, FLAMELET_LOOKUP_OPS::THERMO, thermo) == 0) && inside;
temperature_out = thermo[LOOKUP_TD::TEMPERATURE];
return inside;
};

for (auto j_cv = 0u; j_cv < n_cv; j_cv++) {
su2double temperature_plus, temperature_minus;
state[j_cv] = input_scalar[j_cv] + step[j_cv];
bool inside_plus = evaluate(beta_plus, temperature_plus);
state[j_cv] = input_scalar[j_cv] - step[j_cv];
bool inside_minus = evaluate(beta_minus, temperature_minus);
state[j_cv] = input_scalar[j_cv];

su2double span = 2 * step[j_cv];
if (!inside_plus) {
beta_plus = beta;
temperature_plus = Temperature;
span = step[j_cv];
}
if (!inside_minus) {
beta_minus = beta;
temperature_minus = Temperature;
span = step[j_cv];
}
usable[j_cv] = inside_plus || inside_minus;
for (auto i_cv = 0u; i_cv < n_cv; i_cv++)
dbeta[i_cv * n_cv + j_cv] = (beta_plus[BetaIndex(i_cv)] - beta_minus[BetaIndex(i_cv)]) / span;
dtemperature[j_cv] = (temperature_plus - temperature_minus) / span;
}
extrapolation = extrapolation_state;
}
Loading