Documentation 6b54b78464
Loading...
Searching...
No Matches
CFluidFlamelet.hpp
Go to the documentation of this file.
1/*!
2 * \file CFluidFlamelet.hpp
3 * \brief Defines the flamelet fluid model
4 * \author D. Mayer, T. Economon, N. Beishuizen, E. Bunschoten
5 * \version 8.5.0 "Harrier"
6 *
7 * SU2 Project Website: https://su2code.github.io
8 *
9 * The SU2 Project is maintained by the SU2 Foundation
10 * (http://su2foundation.org)
11 *
12 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
13 *
14 * SU2 is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * SU2 is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26 */
27
28#pragma once
29
30#include "../../Common/include/containers/CLookUpTable.hpp"
31#if defined(HAVE_MLPCPP)
32#define MLP_CUSTOM_TYPE su2double
33#include "../../../subprojects/MLPCpp/include/CLookUp_ANN.hpp"
34#define USE_MLPCPP
35#endif
36#include "CFluidModel.hpp"
37
38class CFluidFlamelet final : public CFluidModel {
39 private:
40 DataDrivenFluid_ParsedOptions datadriven_fluid_options;
41 FluidFlamelet_ParsedOptions flamelet_options;
42
43 ENUM_DATADRIVEN_METHOD Kind_DataDriven_Method =
44 ENUM_DATADRIVEN_METHOD::LUT; /*!< \brief Interpolation method for data set evaluation. */
45
46 enum LOOKUP_TD { TEMPERATURE, HEATCAPACITY, VISCOSITY, CONDUCTIVITY, DIFFUSIONCOEFFICIENT, MOLARWEIGHT, SIZE };
47
48 su2double beta_progvar, beta_enth_thermal, beta_enth, beta_mixfrac;
49 int rank;
50
51 bool include_mixture_fraction = false, /*!< \brief include mixture fraction in controlling variables. */
52 preferential_diffusion = false; /*!< \brief use preferential diffusion physics. */
53
54 unsigned short n_scalars, n_lookups, n_user_scalars, /*!< \brief number of passive reactant species. */
55 n_control_vars; /*!< \brief number of controlling variables. */
56
57 unsigned long extrapolation;
58
59 INC_DENSITYMODEL density_model;
60 vector<string> controlling_variable_names, passive_specie_names;
61 vector<string> table_scalar_names; /*!< \brief vector to store names of scalar variables. */
62
63 su2double mass_diffusivity, /*!< \brief local mass diffusivity of the mixture */
64 molar_weight; /*!< \brief local molar weight of the mixture */
65
66 CLookUpTable* look_up_table;
67
68 vector<unsigned long> LUT_idx_TD,
69 LUT_idx_Sources,
70 LUT_idx_LookUp,
71 LUT_idx_PD;
72
73 /*--- Class variables for the multi-layer perceptron method ---*/
74#ifdef USE_MLPCPP
75 size_t n_betas;
76 MLPToolbox::CLookUp_ANN* lookup_mlp; /*!< \brief Multi-layer perceptron collection. */
77 MLPToolbox::CIOMap* iomap_TD; /*!< \brief Input-output map for thermochemical properties. */
78 MLPToolbox::CIOMap* iomap_PD; /*!< \brief Input-output map for the preferential diffusion scalars. */
79 MLPToolbox::CIOMap* iomap_Sources; /*!< \brief Input-output map for species source terms. */
80 MLPToolbox::CIOMap* iomap_LookUp; /*!< \brief Input-output map for passive look-up terms. */
81 MLPToolbox::CIOMap* iomap_Current;
82#endif
83
84 vector<su2double> scalars_vector;
85
86 vector<string> varnames_TD, /*!< \brief Lookup names for thermodynamic state variables. */
87 varnames_Sources, /*!< \brief Lookup names for source terms. */
88 varnames_LookUp, /*!< \brief Lookup names for passive look-up terms. */
89 varnames_PD; /*!< \brief Lookup names for preferential diffusion scalars. */
90
91 vector<su2double> val_vars_TD, /*!< \brief References to thermodynamic state variables. */
92 val_vars_Sources, /*!< \brief References to source terms. */
93 val_vars_LookUp, /*!< \brief References passive look-up terms. */
94 val_vars_PD; /*!< \brief References to preferential diffusion scalars. */
95
96 void PreprocessLookUp(CConfig* config);
97
98 /*! \brief
99 * Returns true if the string is null or zero (ignores case).
100 */
101 inline bool noSource(const std::string& name_var) const {
102 if (name_var.compare("NULL") == 0 || name_var.compare("Null") == 0 || name_var.compare("null") == 0 ||
103 name_var.compare("ZERO") == 0 || name_var.compare("Zero") == 0 || name_var.compare("zero") == 0) {
104 return true;
105 } else {
106 return false;
107 }
108 }
109 public:
110 CFluidFlamelet(CConfig* config, su2double value_pressure_operating);
111
113
114 /*!
115 * \brief Set the thermodynamic state.
116 * \param[in] val_temperature - temperature
117 * \param[in] val_scalars - pointer to species mass fractions
118 */
119 void SetTDState_T(su2double val_temperature, const su2double* val_scalars = nullptr) override;
120
121 /*!
122 * \brief Set the thermodynamic state.
123 * \param[in] val_enthalpy - enthalpy
124 * \param[in] val_scalars - pointer to species mass fractions
125 */
126 void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) override;
127
128 /*!
129 * \brief Evaluate data-set for flamelet simulations.
130 * \param[in] input_scalar - controlling variables used to interpolate manifold.
131 * \param[in] lookup_type - look-up operation to be performed (FLAMELET_LOOKUP_OPS)
132 * \param[in] output_refs - output variables where interpolated results are stored.
133 * \param[out] Extrapolation - query data is within manifold bounds (0) or out of bounds (1).
134 */
135 unsigned long EvaluateDataSet(const vector<su2double>& input_scalar, unsigned short lookup_type,
136 vector<su2double>& output_refs);
137
138 /*!
139 * \brief Check for out-of-bounds condition for data set interpolation.
140 * \return - within bounds (0) or out of bounds (1).
141 */
142 unsigned long GetExtrapolation() const override { return extrapolation; }
143
144 /*!
145 * \brief Get the mass diffusivity of the species.
146 * \param[in] iVar - index to the species
147 * \param[out] mass_diffusivity - value of the mass diffusivity
148 */
149 inline su2double GetMassDiffusivity(int iVar) override { return mass_diffusivity; }
150
151 /*!
152 * \brief Get the thermal conductivity of the species.
153 * \param[in] iVar - index to the species
154 * \param[out] Kt - value of the thermal conductivity
155 */
156 inline su2double GetThermalConductivity() override { return Kt; }
157
158 /*!
159 * \brief Get the laminar viscosity of the species.
160 * \param[in] iVar - index to the species
161 * \param[out] Mu - value of the laminar viscosity
162 */
163 inline su2double GetLaminarViscosity() override { return Mu; }
164
165 /*!
166 * \brief Preferential diffusion as relevant phenomenon in flamelet simulations.
167 * \return Inclusion of preferential diffusion model.
168 */
169 inline bool GetPreferentialDiffusion() const override { return preferential_diffusion; }
170};
Defines the main fluid model class for thermophysical properties.
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Definition CFluidFlamelet.hpp:38
unsigned long GetExtrapolation() const override
Check for out-of-bounds condition for data set interpolation.
Definition CFluidFlamelet.hpp:142
~CFluidFlamelet()
Definition CFluidFlamelet.cpp:110
void SetTDState_T(su2double val_temperature, const su2double *val_scalars=nullptr) override
Set the thermodynamic state.
Definition CFluidFlamelet.cpp:134
su2double GetLaminarViscosity() override
Get the laminar viscosity of the species.
Definition CFluidFlamelet.hpp:163
bool GetPreferentialDiffusion() const override
Preferential diffusion as relevant phenomenon in flamelet simulations.
Definition CFluidFlamelet.hpp:169
void SetTDState_h(su2double val_enthalpy, const su2double *val_scalars=nullptr) override
Set the thermodynamic state.
Definition CFluidFlamelet.cpp:123
su2double GetThermalConductivity() override
Get the thermal conductivity of the species.
Definition CFluidFlamelet.hpp:156
su2double GetMassDiffusivity(int iVar) override
Get the mass diffusivity of the species.
Definition CFluidFlamelet.hpp:149
unsigned long EvaluateDataSet(const vector< su2double > &input_scalar, unsigned short lookup_type, vector< su2double > &output_refs)
Evaluate data-set for flamelet simulations.
Definition CFluidFlamelet.cpp:277
Main class for defining the Thermo-Physical Model.
Definition CFluidModel.hpp:47
su2double Mu
Laminar viscosity.
Definition CFluidModel.hpp:66
su2double Kt
Thermal conductivity.
Definition CFluidModel.hpp:70
Look up table.
Definition CLookUpTable.hpp:43
passivedouble su2double
Definition code_config.hpp:181
ENUM_DATADRIVEN_METHOD
Types of interpolation methods for data-driven fluid models.
Definition option_structure.hpp:700
INC_DENSITYMODEL
Types of density models.
Definition option_structure.hpp:729
Structure containing parsed options for data-driven fluid model.
Definition option_structure.hpp:1488
Structure containing parsed options for flamelet fluid model.
Definition option_structure.hpp:1584