diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 2502204b64c..91fe553df80 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -209,7 +209,7 @@ jobs: uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536 with: # -t -c - args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} + args: -b ${{github.ref}} -t develop -c feature_PINN -s ${{matrix.testscript}} - name: Cleanup uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536 with: diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index d55416ed681..1bdee5d9ef9 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -535,9 +535,15 @@ class CConfig { Kind_TimeIntScheme_Heat, /*!< \brief Time integration for the wave equations. */ Kind_TimeStep_Heat, /*!< \brief Time stepping method for the (fvm) heat equation. */ n_Datadriven_files; - ENUM_DATADRIVEN_METHOD Kind_DataDriven_Method; /*!< \brief Method used for datset regression in data-driven fluid models. */ - su2double DataDriven_Relaxation_Factor; /*!< \brief Relaxation factor for Newton solvers in data-driven fluid models. */ + DataDrivenFluid_ParsedOptions datadriven_ParsedOptions; + //ENUM_DATADRIVEN_METHOD Kind_DataDriven_Method; /*!< \brief Method used for datset regression in data-driven fluid models. */ + + //su2double DataDriven_Relaxation_Factor; /*!< \brief Relaxation factor for Newton solvers in data-driven fluid models. */ + // su2double DataDriven_rho_init{-1.0}, /*!< \brief Optional initial density value for Newton solver in data-driven fluid model.*/ + // DataDriven_e_init{-1.0}; /*!< \brief Optional initial static energy value for Newton solver in data-driven fluid model.*/ + + //bool UsePINN = false; /*!< \brief Use physics-informed method for data-driven fluid modeling. */ STRUCT_TIME_INT Kind_TimeIntScheme_FEA; /*!< \brief Time integration for the FEA equations. */ STRUCT_SPACE_ITE Kind_SpaceIteScheme_FEA; /*!< \brief Iterative scheme for nonlinear structural analysis. */ @@ -821,8 +827,7 @@ class CConfig { SurfAdjCoeff_FileName, /*!< \brief Output file with the adjoint variables on the surface. */ SurfSens_FileName, /*!< \brief Output file for the sensitivity on the surface (discrete adjoint). */ VolSens_FileName, /*!< \brief Output file for the sensitivity in the volume (discrete adjoint). */ - ObjFunc_Hess_FileName, /*!< \brief Hessian approximation obtained by the Sobolev smoothing solver. */ - *DataDriven_Method_FileNames; /*!< \brief Dataset information for data-driven fluid models. */ + ObjFunc_Hess_FileName; /*!< \brief Hessian approximation obtained by the Sobolev smoothing solver. */ bool Wrt_Performance, /*!< \brief Write the performance summary at the end of a calculation. */ @@ -1239,28 +1244,7 @@ class CConfig { unsigned short nSpecies_Init; /*!< \brief Number of entries of SPECIES_INIT */ /*--- Additional flamelet solver options ---*/ - ///TODO: Add python wrapper initialization option - FLAMELET_INIT_TYPE flame_init_type = FLAMELET_INIT_TYPE::NONE; /*!< \brief Method for solution ignition for flamelet problems. */ - std::array flame_init; /*!< \brief Flame front initialization parameters. */ - std::array spark_init; /*!< \brief Spark ignition initialization parameters. */ - su2double* spark_reaction_rates; /*!< \brief Source terms for flamelet spark ignition option. */ - unsigned short nspark; /*!< \brief Number of source terms for spark initialization. */ - bool preferential_diffusion = false; /*!< \brief Preferential diffusion physics for flamelet solver.*/ - - /*--- lookup table ---*/ - unsigned short n_scalars = 0; /*!< \brief Number of transported scalars for flamelet LUT approach. */ - unsigned short n_lookups = 0; /*!< \brief Number of lookup variables, for visualization only. */ - unsigned short n_table_sources = 0; /*!< \brief Number of transported scalar source terms for LUT. */ - unsigned short n_user_scalars = 0; /*!< \brief Number of user defined (auxiliary) scalar transport equations. */ - unsigned short n_user_sources = 0; /*!< \brief Number of source terms for user defined (auxiliary) scalar transport equations. */ - unsigned short n_control_vars = 0; /*!< \brief Number of controlling variables (independent variables) for the LUT. */ - - string* controlling_variable_names; - string* cv_source_names; - vector table_scalar_names; /*!< \brief Names of transported scalar variables. */ - string* lookup_names; /*!< \brief Names of passive look-up variables. */ - string* user_scalar_names; /*!< \brief Names of the user defined (auxiliary) transported scalars .*/ - string* user_source_names; /*!< \brief Names of the source terms for the user defined transported scalars. */ + FluidFlamelet_ParsedOptions flamelet_ParsedOptions; /*!< \brief Additional flamelet solver options */ /*! * \brief Set the default values of config options not set in the config file using another config object. @@ -2169,106 +2153,6 @@ class CConfig { */ bool GetSpecies_StrongBC() const { return Species_StrongBC; } - /*! - * \brief Get the flame initialization. - * (x1,x2,x3) = flame offset/spark center location. - * (x4,x5,x6) = flame normal, separating unburnt from burnt or - * spark radius, spark start iteration, spark duration. - * (x7) = flame thickness, the length from unburnt to burnt conditions. - * (x8) = flame burnt thickness, the length to stay at burnt conditions. - * \return Ignition initialization parameters for the flamelet model. - */ - const su2double* GetFlameInit() const { - switch (flame_init_type) - { - case FLAMELET_INIT_TYPE::FLAME_FRONT: - return flame_init.data(); - break; - case FLAMELET_INIT_TYPE::SPARK: - return spark_init.data(); - break; - default: - return nullptr; - break; - } - } - - /*! - * \brief Get species net reaction rates applied during spark ignition. - */ - const su2double* GetSpark() const { - return spark_reaction_rates; - } - - /*! - * \brief Preferential diffusion combustion problem. - */ - bool GetPreferentialDiffusion() const { return preferential_diffusion; } - - /*! - * \brief Define preferential diffusion combustion problem. - */ - inline void SetPreferentialDiffusion(bool input) { preferential_diffusion = input; } - - /*! - * \brief Get the number of control variables for flamelet model. - */ - unsigned short GetNControlVars() const { return n_control_vars; } - - /*! - * \brief Get the number of total transported scalars for flamelet model. - */ - unsigned short GetNScalars() const { return n_scalars; } - - /*! - * \brief Get the number of user scalars for flamelet model. - */ - unsigned short GetNUserScalars() const { return n_user_scalars; } - - /*! - * \brief Get the name of a specific controlling variable. - */ - const string& GetControllingVariableName(unsigned short i_cv) const { - return controlling_variable_names[i_cv]; - } - - /*! - * \brief Get the name of the source term variable for a specific controlling variable. - */ - const string& GetControllingVariableSourceName(unsigned short i_cv) const { - return cv_source_names[i_cv]; - } - /*! - * \brief Get the name of the user scalar. - */ - const string& GetUserScalarName(unsigned short i_user_scalar) const { - static const std::string none = "NONE"; - if (n_user_scalars > 0) return user_scalar_names[i_user_scalar]; else return none; - } - - /*! - * \brief Get the name of the user scalar source term. - */ - const string& GetUserSourceName(unsigned short i_user_source) const { - static const std::string none = "NONE"; - if (n_user_sources > 0) return user_source_names[i_user_source]; else return none; - } - - /*! - * \brief Get the ignition method used for combustion problems. - */ - FLAMELET_INIT_TYPE GetFlameletInitType() const { return flame_init_type; } - - /*! - * \brief Get the number of transported scalars for combustion. - */ - unsigned short GetNLookups() const { return n_lookups; } - - /*! - * \brief Get the name of the variable that we want to retrieve from the lookup table. - */ - const string& GetLookupName(unsigned short i_lookup) const { return lookup_names[i_lookup]; } - /*! * \brief Get the Young's modulus of elasticity. * \return Value of the Young's modulus of elasticity. @@ -3970,29 +3854,6 @@ class CConfig { */ unsigned short GetKind_FluidModel(void) const { return Kind_FluidModel; } - /*! - * \brief Datadriven method for EoS evaluation. - */ - ENUM_DATADRIVEN_METHOD GetKind_DataDriven_Method(void) const { return Kind_DataDriven_Method; } - - /*! - * \brief Get name of the input file for the data-driven fluid model interpolation method. - * \return Name of the input file for the interpolation method. - */ - const string* GetDataDriven_FileNames(void) const { return DataDriven_Method_FileNames; } - - /*! - * \brief Get number of listed look-up table or multi-layer perceptron input files. - * \return Number of listed data-driven method input files. - */ - unsigned short GetNDataDriven_Files(void) const { return n_Datadriven_files; } - - /*! - * \brief Get Newton solver relaxation factor for data-driven fluid models. - * \return Newton solver relaxation factor. - */ - su2double GetRelaxation_DataDriven(void) const { return DataDriven_Relaxation_Factor; } - /*! * \brief Returns the name of the fluid we are using in CoolProp. */ @@ -7083,6 +6944,12 @@ class CConfig { */ void SetGiles_Var1(su2double newVar1, const string& val_marker); + /*! + * \brief Set the var 1 for Riemann BC. + * \param[in] val_marker - Index corresponding to the Riemann BC. + */ + void SetRiemann_Var1(su2double newVar1, const string& val_marker); + /*! * \brief Get the relax factor for the average component for the Giles BC. * \param[in] val_marker - Index corresponding to the Giles BC. @@ -9939,4 +9806,17 @@ class CConfig { */ LM_ParsedOptions GetLMParsedOptions() const { return lmParsedOptions; } + + /*! + * \brief Get parsed option data structure for data-driven fluid model. + * \return option data structure for data-driven fluid model. + */ + DataDrivenFluid_ParsedOptions GetDataDrivenParsedOptions() const { return datadriven_ParsedOptions; } + + /*! + * \brief Get parsed option data structure for the flamelet fluid model. + * \return option data structure for the flamelet fluid model. + */ + FluidFlamelet_ParsedOptions GetFlameletParsedOptions() const { return flamelet_ParsedOptions; } + }; diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index ddf570ab697..f116547aadf 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -1324,6 +1324,20 @@ inline LM_ParsedOptions ParseLMOptions(const LM_OPTIONS *LM_Options, unsigned sh return LMParsedOptions; } +/*! + * \brief Structure containing parsed options for data-driven fluid model. + */ +struct DataDrivenFluid_ParsedOptions { + su2double rho_init_custom = -1; /*!< \brief Optional initial guess for density in inverse look-up operations. */ + su2double e_init_custom = -1; /*!< \brief Optional initial guess for static energy in inverse look-up operations.*/ + su2double Newton_relaxation = 1.0; /*!< \brief Relaxation factor for Newton solvers in data-driven fluid models. */ + bool use_PINN = false; /*!< \brief Use physics-informed method for data-driven fluid modeling. */ + ENUM_DATADRIVEN_METHOD interp_algorithm_type = ENUM_DATADRIVEN_METHOD::MLP; /*!< \brief Interpolation algorithm used for data-driven fluid model. */ + unsigned short n_filenames = 1; /*!< \brief Number of datasets. */ + std::string *datadriven_filenames; /*!< \brief Dataset information for data-driven fluid models. */ +}; + + /*! * \brief types of species transport models */ @@ -1391,6 +1405,32 @@ static const MapType Flamelet_Init_Map = { MakePair("SPARK", FLAMELET_INIT_TYPE::SPARK) }; +/*! + * \brief Structure containing parsed options for flamelet fluid model. + */ +struct FluidFlamelet_ParsedOptions { + ///TODO: Add python wrapper initialization option + FLAMELET_INIT_TYPE ignition_method = FLAMELET_INIT_TYPE::NONE; /*!< \brief Method for solution ignition for flamelet problems. */ + unsigned short n_scalars = 0; /*!< \brief Number of transported scalars for flamelet LUT approach. */ + unsigned short n_lookups = 0; /*!< \brief Number of lookup variables, for visualization only. */ + unsigned short n_table_sources = 0; /*!< \brief Number of transported scalar source terms for LUT. */ + unsigned short n_user_scalars = 0; /*!< \brief Number of user defined (auxiliary) scalar transport equations. */ + unsigned short n_user_sources = 0; /*!< \brief Number of source terms for user defined (auxiliary) scalar transport equations. */ + unsigned short n_control_vars = 0; /*!< \brief Number of controlling variables (independent variables) for the LUT. */ + + std::string *controlling_variable_names; /*!< \brief Names of the independent, transported scalars. */ + std::string* cv_source_names; /*!< \brief Names of the source terms of the independent, transported scalars. */ + std::string* lookup_names; /*!< \brief Names of the passive look-up terms. */ + std::string* user_scalar_names; /*!< \brief Names of the passive transported scalars. */ + std::string* user_source_names; /*!< \brief Names of the source terms of the passive transported scalars. */ + + std::array flame_init; /*!< \brief Flame front initialization parameters. */ + std::array spark_init; /*!< \brief Spark ignition initialization parameters. */ + su2double* spark_reaction_rates; /*!< \brief Source terms for flamelet spark ignition option. */ + unsigned short nspark; /*!< \brief Number of source terms for spark initialization. */ + bool preferential_diffusion = false; /*!< \brief Preferential diffusion physics for flamelet solver.*/ +}; + /*! * \brief Types of subgrid scale models */ diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index c61fc1acb2a..2ac04c96391 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -991,7 +991,6 @@ void CConfig::SetPointersNull() { Species_Init = nullptr; Species_Clipping_Min = nullptr; Species_Clipping_Max = nullptr; - spark_reaction_rates = nullptr; /*--- Moving mesh pointers ---*/ @@ -1194,11 +1193,17 @@ void CConfig::SetConfig_Options() { /*!\par CONFIG_CATEGORY: Data-driven fluid model parameters \ingroup Config*/ /*!\brief INTERPOLATION_METHOD \n DESCRIPTION: Interpolation method used to determine the thermodynamic state of the fluid. \n OPTIONS: See \link DataDrivenMethod_Map \endlink DEFAULT: MLP \ingroup Config*/ - addEnumOption("INTERPOLATION_METHOD",Kind_DataDriven_Method, DataDrivenMethod_Map, ENUM_DATADRIVEN_METHOD::LUT); + addEnumOption("INTERPOLATION_METHOD",datadriven_ParsedOptions.interp_algorithm_type, DataDrivenMethod_Map, ENUM_DATADRIVEN_METHOD::LUT); /*!\brief FILENAME_INTERPOLATOR \n DESCRIPTION: Input file for the interpolation method. \n \ingroup Config*/ - addStringListOption("FILENAMES_INTERPOLATOR", n_Datadriven_files, DataDriven_Method_FileNames); + addStringListOption("FILENAMES_INTERPOLATOR", datadriven_ParsedOptions.n_filenames, datadriven_ParsedOptions.datadriven_filenames); /*!\brief DATADRIVEN_NEWTON_RELAXATION \n DESCRIPTION: Relaxation factor for Newton solvers in data-driven fluid model. \n \ingroup Config*/ - addDoubleOption("DATADRIVEN_NEWTON_RELAXATION", DataDriven_Relaxation_Factor, 0.05); + addDoubleOption("DATADRIVEN_NEWTON_RELAXATION", datadriven_ParsedOptions.Newton_relaxation, 1.0); + /*!\brief DATADRIVEN_INITIAL_DENSITY \n DESCRIPTION: Optional initial value for fluid density used for the Newton solver processes in the data-driven fluid model. */ + addDoubleOption("DATADRIVEN_INITIAL_DENSITY", datadriven_ParsedOptions.rho_init_custom, -1.0); + /*!\brief DATADRIVEN_INITIAL_ENERGY \n DESCRIPTION: Optional initial value for fluid static energy used for the Newton solver processes in the data-driven fluid model. */ + addDoubleOption("DATADRIVEN_INITIAL_ENERGY", datadriven_ParsedOptions.e_init_custom, -1.0); + /*!\biref USE_PINN \n DESCRIPTION: Use physics-informed approach for the entropy-based fluid model. \n \ingroup Config*/ + addBoolOption("USE_PINN",datadriven_ParsedOptions.use_PINN, false); /*!\brief CONFINEMENT_PARAM \n DESCRIPTION: Input Confinement Parameter for Vorticity Confinement*/ addDoubleOption("CONFINEMENT_PARAM", Confinement_Param, 0.0); @@ -1385,22 +1390,22 @@ void CConfig::SetConfig_Options() { addDoubleListOption("SPECIES_CLIPPING_MIN", nSpecies_Clipping_Min, Species_Clipping_Min); /*!\brief FLAME_INIT_METHOD \n DESCRIPTION: Ignition method for flamelet solver \n DEFAULT: no ignition; cold flow only. */ - addEnumOption("FLAME_INIT_METHOD", flame_init_type, Flamelet_Init_Map, FLAMELET_INIT_TYPE::NONE); + addEnumOption("FLAME_INIT_METHOD", flamelet_ParsedOptions.ignition_method, Flamelet_Init_Map, FLAMELET_INIT_TYPE::NONE); /*!\brief FLAME_INIT \n DESCRIPTION: flame front initialization using the flamelet model \ingroup Config*/ /*--- flame offset (x,y,z) ---*/ - flame_init[0] = 0.0; flame_init[1] = 0.0; flame_init[2] = 0.0; + flamelet_ParsedOptions.flame_init[0] = 0.0; flamelet_ParsedOptions.flame_init[1] = 0.0; flamelet_ParsedOptions.flame_init[2] = 0.0; /*--- flame normal (nx, ny, nz) ---*/ - flame_init[3] = 1.0; flame_init[4] = 0.0; flame_init[5] = 0.0; + flamelet_ParsedOptions.flame_init[3] = 1.0; flamelet_ParsedOptions.flame_init[4] = 0.0; flamelet_ParsedOptions.flame_init[5] = 0.0; /*--- flame thickness (x) and flame burnt thickness (after this thickness, we have unburnt conditions again) ---*/ - flame_init[6] = 0.5e-3; flame_init[7] = 1.0; - addDoubleArrayOption("FLAME_INIT", 8,flame_init.begin()); + flamelet_ParsedOptions.flame_init[6] = 0.5e-3; flamelet_ParsedOptions.flame_init[7] = 1.0; + addDoubleArrayOption("FLAME_INIT", 8,flamelet_ParsedOptions.flame_init.begin()); /*!\brief SPARK_INIT \n DESCRIPTION: spark initialization using the flamelet model \ingroup Config*/ - for (auto iSpark=0u; iSpark<6; ++iSpark) spark_init[iSpark]=0; - addDoubleArrayOption("SPARK_INIT", 6, spark_init.begin()); + for (auto iSpark=0u; iSpark<6; ++iSpark) flamelet_ParsedOptions.spark_init[iSpark]=0; + addDoubleArrayOption("SPARK_INIT", 6, flamelet_ParsedOptions.spark_init.begin()); /*!\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", nspark, spark_reaction_rates); + addDoubleListOption("SPARK_REACTION_RATES", flamelet_ParsedOptions.nspark, flamelet_ParsedOptions.spark_reaction_rates); /*--- Options related to mass diffusivity and thereby the species solver. ---*/ @@ -2155,22 +2160,22 @@ void CConfig::SetConfig_Options() { addBoolOption("MULTIZONE_RESIDUAL", Multizone_Residual, false); /* !\brief CONTROLLING_VARIABLE_NAMES \n DESCRIPTION: Names of the variables used as inputs for the data regression method in flamelet or data-driven fluid models. */ - addStringListOption("CONTROLLING_VARIABLE_NAMES", n_control_vars, controlling_variable_names); + addStringListOption("CONTROLLING_VARIABLE_NAMES", flamelet_ParsedOptions.n_control_vars, flamelet_ParsedOptions.controlling_variable_names); /* !\brief CONTROLLING_VARIABLE_SOURCE_NAMES \n DESCRIPTION: Names of the variables in the flamelet manifold corresponding to the source terms of the controlling variables. */ - addStringListOption("CONTROLLING_VARIABLE_SOURCE_NAMES", n_control_vars, cv_source_names); + addStringListOption("CONTROLLING_VARIABLE_SOURCE_NAMES", flamelet_ParsedOptions.n_control_vars, flamelet_ParsedOptions.cv_source_names); /* DESCRIPTION: Names of the passive lookup variables for flamelet LUT */ - addStringListOption("LOOKUP_NAMES", n_lookups, lookup_names); + addStringListOption("LOOKUP_NAMES", flamelet_ParsedOptions.n_lookups, flamelet_ParsedOptions.lookup_names); /* DESCRIPTION: Names of the user transport equations solved in the flamelet problem. */ - addStringListOption("USER_SCALAR_NAMES", n_user_scalars, user_scalar_names); + addStringListOption("USER_SCALAR_NAMES", flamelet_ParsedOptions.n_user_scalars, flamelet_ParsedOptions.user_scalar_names); /* DESCRIPTION: Names of the user scalar source terms. */ - addStringListOption("USER_SOURCE_NAMES", n_user_sources, user_source_names); + addStringListOption("USER_SOURCE_NAMES", flamelet_ParsedOptions.n_user_sources, flamelet_ParsedOptions.user_source_names); /* DESCRIPTION: Enable preferential diffusion for FGM simulations. \n DEFAULT: false */ - addBoolOption("PREFERENTIAL_DIFFUSION", preferential_diffusion, false); + addBoolOption("PREFERENTIAL_DIFFUSION", flamelet_ParsedOptions.preferential_diffusion, false); /*!\brief CONV_FILENAME \n DESCRIPTION: Output file convergence history (w/o extension) \n DEFAULT: history \ingroup Config*/ addStringOption("CONV_FILENAME", Conv_FileName, string("history")); @@ -5628,10 +5633,10 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i /*--- Define some variables for flamelet model. ---*/ if (Kind_Species_Model == SPECIES_MODEL::FLAMELET) { /*--- The controlling variables are progress variable, total enthalpy, and optionally mixture fraction ---*/ - if (n_control_vars != (nSpecies - n_user_scalars)) + if (flamelet_ParsedOptions.n_control_vars != (nSpecies - flamelet_ParsedOptions.n_user_scalars)) 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 ---*/ - n_scalars = n_control_vars + n_user_scalars; + flamelet_ParsedOptions.n_scalars = flamelet_ParsedOptions.n_control_vars + flamelet_ParsedOptions.n_user_scalars; } if (Kind_Regime == ENUM_REGIME::COMPRESSIBLE && GetBounded_Scalar()) { @@ -9125,6 +9130,13 @@ void CConfig::SetOutlet_Pressure(su2double val_pressure, const string& val_marke Outlet_Pressure[iMarker_Outlet] = val_pressure; } +void CConfig::SetRiemann_Var1(su2double newVar1, const string& val_marker) { + unsigned short iMarker_Riemann; + for (iMarker_Riemann = 0; iMarker_Riemann < nMarker_Riemann; iMarker_Riemann++) + if (Marker_Riemann[iMarker_Riemann] == val_marker) break; + Riemann_Var1[iMarker_Riemann] = newVar1; +} + su2double CConfig::GetRiemann_Var1(const string& val_marker) const { unsigned short iMarker_Riemann; for (iMarker_Riemann = 0; iMarker_Riemann < nMarker_Riemann; iMarker_Riemann++) diff --git a/SU2_CFD/include/fluid/CDataDrivenFluid.hpp b/SU2_CFD/include/fluid/CDataDrivenFluid.hpp index 57a68ea8d71..aba771f4932 100644 --- a/SU2_CFD/include/fluid/CDataDrivenFluid.hpp +++ b/SU2_CFD/include/fluid/CDataDrivenFluid.hpp @@ -62,6 +62,12 @@ class CDataDrivenFluid final : public CFluidModel { rho_min, rho_max, /*!< \brief Minimum and maximum density values in data set. */ e_min, e_max; /*!< \brief Minimum and maximum energy values in data set. */ + bool custom_init_rho{false}, + custom_init_e{false}; + su2double val_custom_init_rho, + val_custom_init_e, + rho_median, + e_median; unsigned long MaxIter_Newton; /*!< \brief Maximum number of iterations for Newton solvers. */ su2double dsde_rho, /*!< \brief Entropy derivative w.r.t. density. */ @@ -77,6 +83,8 @@ class CDataDrivenFluid final : public CFluidModel { P_middle, /*!< \brief Pressure computed from the centre of the data set. */ T_middle; /*!< \brief Temperature computed from the centre of the data set. */ + su2double gas_constant_config, + gamma_config; su2double Enthalpy, /*!< \brief Fluid enthalpy value [J kg^-1] */ dhdrho_e, /*!< \brief Enthalpy derivative w.r.t. density. */ dhde_rho; /*!< \brief Enthalpy derivative w.r.t. static energy. */ @@ -87,6 +95,10 @@ class CDataDrivenFluid final : public CFluidModel { vector outputs_rhoe; /*!< \brief Pointers to output variables. */ + vector> dsdrhoe; + vector>> d2sdrhoe2; + + bool use_MLP_derivatives; /*--- Class variables for the multi-layer perceptron method ---*/ #ifdef USE_MLPCPP MLPToolbox::CLookUp_ANN* lookup_mlp; /*!< \brief Multi-layer perceptron collection. */ @@ -145,8 +157,8 @@ class CDataDrivenFluid final : public CFluidModel { * \param[in] dY2drho - Pointer to the partial derivative of quantity 2 w.r.t. density at constant energy. * \param[in] dY2de - Pointer to the partial derivative of quantity 2 w.r.t. energy at constant density. */ - void Run_Newton_Solver(su2double Y1_target, su2double Y2_target, su2double* Y1, su2double* Y2, su2double* dY1drho, - su2double* dY1de, su2double* dY2drho, su2double* dY2de); + void Run_Newton_Solver(const su2double Y1_target, const su2double Y2_target, su2double const & Y1, su2double const & Y2, su2double const & dY1drho, + su2double const & dY1de, su2double const & dY2drho, su2double const & dY2de); /*! * \brief 1D Newton solver for computing the density or energy corresponding to Y_target. @@ -155,9 +167,10 @@ class CDataDrivenFluid final : public CFluidModel { * \param[in] X - Pointer to controlling variable (density or energy). * \param[in] dYdX - Pointer to the partial derivative of target quantity w.r.t. controlling variable. */ - void Run_Newton_Solver(su2double Y_target, su2double* Y, su2double* X, su2double* dYdX); + void Run_Newton_Solver(const su2double Y_target, su2double const & Y, su2double & X, su2double const & dYdX); void ComputeIdealGasQuantities(); + public: /*! * \brief Constructor of the class. @@ -213,6 +226,15 @@ class CDataDrivenFluid final : public CFluidModel { */ void SetTDState_Ps(su2double P, su2double s) override; + /*! + * \brief compute some derivatives of enthalpy and entropy needed for subsonic inflow BC + * \param[in] InputSpec - Input pair for FLP calls ("Pv"). + * \param[in] th1 - first thermodynamic variable (P). + * \param[in] th2 - second thermodynamic variable (v). + * + */ + void ComputeDerivativeNRBC_Prho(su2double P, su2double rho) override; + /*! * \brief Get fluid model extrapolation instance. * \return Query point lies outside fluid model data range. diff --git a/SU2_CFD/include/fluid/CFluidFlamelet.hpp b/SU2_CFD/include/fluid/CFluidFlamelet.hpp index f95072f30ce..c933c8650cb 100644 --- a/SU2_CFD/include/fluid/CFluidFlamelet.hpp +++ b/SU2_CFD/include/fluid/CFluidFlamelet.hpp @@ -37,6 +37,9 @@ class CFluidFlamelet final : public CFluidModel { private: + DataDrivenFluid_ParsedOptions datadriven_fluid_options; + FluidFlamelet_ParsedOptions flamelet_options; + ENUM_DATADRIVEN_METHOD Kind_DataDriven_Method = ENUM_DATADRIVEN_METHOD::LUT; /*!< \brief Interpolation method for data set evaluation. */ diff --git a/SU2_CFD/include/iteration/CFluidIteration.hpp b/SU2_CFD/include/iteration/CFluidIteration.hpp index 346f763581c..61cbc66a986 100644 --- a/SU2_CFD/include/iteration/CFluidIteration.hpp +++ b/SU2_CFD/include/iteration/CFluidIteration.hpp @@ -108,7 +108,7 @@ class CFluidIteration : public CIteration { unsigned short val_iInst) override; /*! - * \brief Monitors turbo computation (pressure and turbo ramps). + * \brief Monitors turbo computation (turbo ramp). * \param[in] geometry_container - Geometrical definition of the problem * \param[in] config_container - Defintion of the particular problem * \param[in] ExtIter - The current iteration of the problem @@ -116,6 +116,15 @@ class CFluidIteration : public CIteration { */ void TurboMonitor(CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter, unsigned short iZone); + /*! + * \brief Update adaptive boundary condition values. + * \param[in] geometry_container - Geometrical definition of the problem + * \param[in] config_container - Defintion of the particular problem + * \param[in] ExtIter - The current iteration of the problem + * \param[in] iZone - The current zone + */ + void UpdateBoundaryConditions(CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter, unsigned short iZone); + /*! * \brief Computes turboperformance. */ diff --git a/SU2_CFD/include/solvers/CSpeciesFlameletSolver.hpp b/SU2_CFD/include/solvers/CSpeciesFlameletSolver.hpp index cf336b7f458..1d3b137e59c 100644 --- a/SU2_CFD/include/solvers/CSpeciesFlameletSolver.hpp +++ b/SU2_CFD/include/solvers/CSpeciesFlameletSolver.hpp @@ -37,6 +37,7 @@ */ class CSpeciesFlameletSolver final : public CSpeciesSolver { private: + FluidFlamelet_ParsedOptions flamelet_config_options; bool include_mixture_fraction = false; /*!< \brief include mixture fraction as a controlling variable. */ /*! * \brief Compute the preconditioner for low-Mach flows. @@ -87,24 +88,22 @@ class CSpeciesFlameletSolver final : public CSpeciesSolver { /*! * \brief Retrieve passive look-up data from manifold. - * \param[in] config - definition of particular problem. * \param[in] fluid_model_local - pointer to flamelet fluid model. * \param[in] iPoint - node ID. * \param[in] scalars - local scalar solution. * \return - within manifold bounds (0) or outside manifold bounds (1). */ - unsigned long SetScalarLookUps(const CConfig* config, CFluidModel* fluid_model_local, unsigned long iPoint, + unsigned long SetScalarLookUps(CFluidModel* fluid_model_local, unsigned long iPoint, const vector& scalars); /*! * \brief Retrieve the preferential diffusion scalar values from manifold. - * \param[in] config - definition of particular problem. * \param[in] fluid_model_local - pointer to flamelet fluid model. * \param[in] iPoint - node ID. * \param[in] scalars - local scalar solution. * \return - within manifold bounds (0) or outside manifold bounds (1). */ - unsigned long SetPreferentialDiffusionScalars(const CConfig* config, CFluidModel* fluid_model_local, + unsigned long SetPreferentialDiffusionScalars(CFluidModel* fluid_model_local, unsigned long iPoint, const vector& scalars); public: diff --git a/SU2_CFD/src/fluid/CDataDrivenFluid.cpp b/SU2_CFD/src/fluid/CDataDrivenFluid.cpp index f4c81091df0..d25b5c2135c 100644 --- a/SU2_CFD/src/fluid/CDataDrivenFluid.cpp +++ b/SU2_CFD/src/fluid/CDataDrivenFluid.cpp @@ -33,30 +33,45 @@ CDataDrivenFluid::CDataDrivenFluid(const CConfig* config, bool display) : CFluidModel() { rank = SU2_MPI::GetRank(); - Kind_DataDriven_Method = config->GetKind_DataDriven_Method(); + DataDrivenFluid_ParsedOptions datadriven_fluid_options = config->GetDataDrivenParsedOptions(); + + Kind_DataDriven_Method = datadriven_fluid_options.interp_algorithm_type; varname_rho = "Density"; varname_e = "Energy"; + /*--- Use physics-informed approach ---*/ + use_MLP_derivatives = datadriven_fluid_options.use_PINN; + + /*--- Retrieve initial density and static energy values from config ---*/ + val_custom_init_e = datadriven_fluid_options.rho_init_custom; + val_custom_init_rho = datadriven_fluid_options.e_init_custom; + custom_init_e = (val_custom_init_e != -1.0); + custom_init_rho = (val_custom_init_rho != -1.0); + + /*--- Set up interpolation algorithm according to data-driven method. Currently only MLP's are supported. ---*/ switch (Kind_DataDriven_Method) { case ENUM_DATADRIVEN_METHOD::MLP: #ifdef USE_MLPCPP - lookup_mlp = new MLPToolbox::CLookUp_ANN(config->GetNDataDriven_Files(), config->GetDataDriven_FileNames()); + lookup_mlp = new MLPToolbox::CLookUp_ANN(datadriven_fluid_options.n_filenames, datadriven_fluid_options.datadriven_filenames); if ((rank == MASTER_NODE) && display) lookup_mlp->DisplayNetworkInfo(); #else SU2_MPI::Error("SU2 was not compiled with MLPCpp enabled (-Denable-mlpcpp=true).", CURRENT_FUNCTION); #endif break; case ENUM_DATADRIVEN_METHOD::LUT: - lookup_table = new CLookUpTable(config->GetDataDriven_FileNames()[0], varname_rho, varname_e); + if (use_MLP_derivatives && (rank == MASTER_NODE) && display) + cout << "Physics-informed approach currently only works with MLP-based tabulation." << endl; + + lookup_table = new CLookUpTable(datadriven_fluid_options.datadriven_filenames[0], varname_rho, varname_e); break; default: break; } /*--- Relaxation factor and tolerance for Newton solvers. ---*/ - Newton_Relaxation = config->GetRelaxation_DataDriven(); + Newton_Relaxation = datadriven_fluid_options.Newton_relaxation; Newton_Tolerance = 1e-10; MaxIter_Newton = 50; @@ -92,23 +107,50 @@ void CDataDrivenFluid::MapInputs_to_Outputs() { /*--- Required outputs for the interpolation method are entropy and its partial derivatives with respect to energy and * density. ---*/ - size_t n_outputs = 6; - size_t idx_s = 0, idx_dsde_rho = 1, idx_dsdrho_e = 2, idx_d2sde2 = 3, idx_d2sdedrho = 4, idx_d2sdrho2 = 5; - - outputs_rhoe.resize(n_outputs); - output_names_rhoe.resize(n_outputs); - output_names_rhoe[idx_s] = "s"; - outputs_rhoe[idx_s] = &Entropy; - output_names_rhoe[idx_dsde_rho] = "dsde_rho"; - outputs_rhoe[idx_dsde_rho] = &dsde_rho; - output_names_rhoe[idx_dsdrho_e] = "dsdrho_e"; - outputs_rhoe[idx_dsdrho_e] = &dsdrho_e; - output_names_rhoe[idx_d2sde2] = "d2sde2"; - outputs_rhoe[idx_d2sde2] = &d2sde2; - output_names_rhoe[idx_d2sdedrho] = "d2sdedrho"; - outputs_rhoe[idx_d2sdedrho] = &d2sdedrho; - output_names_rhoe[idx_d2sdrho2] = "d2sdrho2"; - outputs_rhoe[idx_d2sdrho2] = &d2sdrho2; + size_t n_outputs, idx_s,idx_dsde_rho = 1, idx_dsdrho_e = 2, idx_d2sde2 = 3, idx_d2sdedrho = 4, idx_d2sdrho2 = 5; + if (use_MLP_derivatives) { + n_outputs = 1; + idx_s = 0; + + outputs_rhoe.resize(n_outputs); + output_names_rhoe.resize(n_outputs); + output_names_rhoe[idx_s] = "s"; + outputs_rhoe[idx_s] = &Entropy; + + dsdrhoe.resize(n_outputs); + d2sdrhoe2.resize(n_outputs); + dsdrhoe[0].resize(2); + dsdrhoe[0][idx_rho] = &dsdrho_e; + dsdrhoe[0][idx_e] = &dsde_rho; + + d2sdrhoe2[0].resize(2); + d2sdrhoe2[0][idx_rho].resize(2); + d2sdrhoe2[0][idx_e].resize(2); + d2sdrhoe2[0][idx_rho][idx_rho] = &d2sdrho2; + d2sdrhoe2[0][idx_rho][idx_e] = &d2sdedrho; + d2sdrhoe2[0][idx_e][idx_rho] = &d2sdedrho; + d2sdrhoe2[0][idx_e][idx_e] = &d2sde2; + } else { + n_outputs = 6; + idx_s = 0; + idx_dsde_rho = 1, idx_dsdrho_e = 2, idx_d2sde2 = 3, idx_d2sdedrho = 4, idx_d2sdrho2 = 5; + + outputs_rhoe.resize(n_outputs); + output_names_rhoe.resize(n_outputs); + output_names_rhoe[idx_s] = "s"; + outputs_rhoe[idx_s] = &Entropy; + output_names_rhoe[idx_dsde_rho] = "dsde_rho"; + outputs_rhoe[idx_dsde_rho] = &dsde_rho; + output_names_rhoe[idx_dsdrho_e] = "dsdrho_e"; + outputs_rhoe[idx_dsdrho_e] = &dsdrho_e; + output_names_rhoe[idx_d2sde2] = "d2sde2"; + outputs_rhoe[idx_d2sde2] = &d2sde2; + output_names_rhoe[idx_d2sdedrho] = "d2sdedrho"; + outputs_rhoe[idx_d2sdedrho] = &d2sdedrho; + output_names_rhoe[idx_d2sdrho2] = "d2sdrho2"; + outputs_rhoe[idx_d2sdrho2] = &d2sdrho2; + } + /*--- Further preprocessing of input and output variables. ---*/ if (Kind_DataDriven_Method == ENUM_DATADRIVEN_METHOD::MLP) { @@ -137,44 +179,64 @@ void CDataDrivenFluid::MapInputs_to_Outputs() { } void CDataDrivenFluid::SetTDState_rhoe(su2double rho, su2double e) { - /*--- Compute thermodynamic state based on density and energy. ---*/ - Density = rho; - StaticEnergy = e; - /*--- Clip density and energy values to prevent extrapolation. ---*/ - Density = min(rho_max, max(rho_min, Density)); - StaticEnergy = min(e_max, max(e_min, StaticEnergy)); + AD::StartPreacc(); + AD::SetPreaccIn(rho); + AD::SetPreaccIn(e); - Evaluate_Dataset(Density, StaticEnergy); - - /*--- Compute speed of sound. ---*/ - auto blue_term = (dsdrho_e * (2 - rho * pow(dsde_rho, -1) * d2sdedrho) + rho * d2sdrho2); - auto green_term = (-pow(dsde_rho, -1) * d2sde2 * dsdrho_e + d2sdedrho); + /*--- Compute thermodynamic state based on density and energy. ---*/ + + Density = max(min(rho, rho_max), rho_min); + StaticEnergy = max(min(e, e_max), e_min); - SoundSpeed2 = -rho * pow(dsde_rho, -1) * (blue_term - rho * green_term * (dsdrho_e / dsde_rho)); + Evaluate_Dataset(Density, StaticEnergy); + const su2double rho_2 = Density * Density; /*--- Compute primary flow variables. ---*/ - Temperature = 1.0 / dsde_rho; - Pressure = -pow(rho, 2) * Temperature * dsdrho_e; - Density = rho; - StaticEnergy = e; - Enthalpy = e + Pressure / rho; + Temperature = pow(dsde_rho, -1); + Pressure = -rho_2 * Temperature * dsdrho_e; + Enthalpy = StaticEnergy + Pressure / Density; /*--- Compute secondary flow variables ---*/ - dTde_rho = -pow(dsde_rho, -2) * d2sde2; - dTdrho_e = -pow(dsde_rho, -2) * d2sdedrho; + dTde_rho = -Temperature * Temperature * d2sde2; + dTdrho_e = -Temperature * Temperature * d2sdedrho; + + /*--- Compute speed of sound. ---*/ + const su2double blue_term = (dsdrho_e * (2 - Density * Temperature * d2sdedrho) + Density * d2sdrho2); + const su2double green_term = (-Temperature * d2sde2 * dsdrho_e + d2sdedrho); - dPde_rho = -pow(rho, 2) * (dTde_rho * dsdrho_e + Temperature * d2sdedrho); - dPdrho_e = -2 * rho * Temperature * dsdrho_e - pow(rho, 2) * (dTdrho_e * dsdrho_e + Temperature * d2sdrho2); + SoundSpeed2 = -Density * Temperature * (blue_term - Density * green_term * (dsdrho_e / dsde_rho)); + + dPde_rho = -rho_2 * Temperature * (-Temperature * (d2sde2 * dsdrho_e) + d2sdedrho); + dPdrho_e = - Density * Temperature * (dsdrho_e * (2 - Density * Temperature * d2sdedrho) + Density * d2sdrho2); /*--- Compute enthalpy and entropy derivatives required for Giles boundary conditions. ---*/ - dhdrho_e = -Pressure * pow(rho, -2) + dPdrho_e / rho; - dhde_rho = 1 + dPde_rho / rho; + dhdrho_e = -Pressure * (1 / rho_2) + dPdrho_e / Density; + dhde_rho = 1 + dPde_rho / Density; + /*--- Compute specific heat at constant volume and specific heat at constant pressure. ---*/ + Cv = 1 / dTde_rho; dhdrho_P = dhdrho_e - dhde_rho * (1 / dPde_rho) * dPdrho_e; dhdP_rho = dhde_rho * (1 / dPde_rho); dsdrho_P = dsdrho_e - dPdrho_e * (1 / dPde_rho) * dsde_rho; dsdP_rho = dsde_rho / dPde_rho; + + const su2double drhode_p = -dPde_rho/dPdrho_e; + const su2double dTde_p = dTde_rho + dTdrho_e*drhode_p; + const su2double dhde_p = dhde_rho + drhode_p*dhdrho_e; + Cp = dhde_p / dTde_p; + + AD::SetPreaccOut(Temperature); + AD::SetPreaccOut(SoundSpeed2); + AD::SetPreaccOut(dPde_rho); + AD::SetPreaccOut(dPdrho_e); + AD::SetPreaccOut(dTde_rho); + AD::SetPreaccOut(dTdrho_e); + AD::SetPreaccOut(Pressure); + AD::SetPreaccOut(Entropy); + AD::SetPreaccOut(Cp); + AD::SetPreaccOut(Cv); + AD::EndPreacc(); } void CDataDrivenFluid::SetTDState_PT(su2double P, su2double T) { @@ -184,7 +246,7 @@ void CDataDrivenFluid::SetTDState_PT(su2double P, su2double T) { e_start = Cv_idealgas * T; /*--- Run 2D Newton solver for pressure and temperature ---*/ - Run_Newton_Solver(P, T, &Pressure, &Temperature, &dPdrho_e, &dPde_rho, &dTdrho_e, &dTde_rho); + Run_Newton_Solver(P, T, Pressure, Temperature, dPdrho_e, dPde_rho, dTdrho_e, dTde_rho); } void CDataDrivenFluid::SetTDState_Prho(su2double P, su2double rho) { @@ -197,10 +259,9 @@ void CDataDrivenFluid::SetEnergy_Prho(su2double P, su2double rho) { Density = rho; /*--- Approximate static energy through ideal gas law. ---*/ - su2double e_idealgas = Cv_idealgas * (P / (R_idealgas * rho)); - StaticEnergy = min(e_max, max(e_idealgas, e_min)); + StaticEnergy = Cv_idealgas * (P / (R_idealgas * rho)); - Run_Newton_Solver(P, &Pressure, &StaticEnergy, &dPde_rho); + Run_Newton_Solver(P, Pressure, StaticEnergy, dPde_rho); } void CDataDrivenFluid::SetTDState_rhoT(su2double rho, su2double T) { @@ -210,40 +271,49 @@ void CDataDrivenFluid::SetTDState_rhoT(su2double rho, su2double T) { /*--- Approximate static energy through ideal gas law. ---*/ StaticEnergy = Cv_idealgas * T; - Run_Newton_Solver(T, &Temperature, &StaticEnergy, &dTde_rho); + Run_Newton_Solver(T, Temperature, StaticEnergy, dTde_rho); } void CDataDrivenFluid::SetTDState_hs(su2double h, su2double s) { /*--- Run 2D Newton solver for enthalpy and entropy. ---*/ - /*--- Approximate density and static energy through ideal gas law under isentropic assumption. ---*/ - su2double T_init = h / Cp_idealgas; - su2double P_init = P_middle * pow(T_init / T_middle, gamma_idealgas/(gamma_idealgas - 1)); - - e_start = h * Cv_idealgas / Cp_idealgas; - rho_start = P_init / (R_idealgas * T_init); - Run_Newton_Solver(h, s, &Enthalpy, &Entropy, &dhdrho_e, &dhde_rho, &dsdrho_e, &dsde_rho); + e_start = StaticEnergy; + rho_start = Density; + Run_Newton_Solver(h, s, Enthalpy, Entropy, dhdrho_e, dhde_rho, dsdrho_e, dsde_rho); } void CDataDrivenFluid::SetTDState_Ps(su2double P, su2double s) { /*--- Run 2D Newton solver for pressure and entropy ---*/ - /*--- Approximate initial state through isentropic assumption and ideal gas law. ---*/ - su2double T_init = T_middle * pow(P / P_middle, (gamma_idealgas - 1)/gamma_idealgas); - e_start = Cv_idealgas * T_init; - rho_start = P / (R_idealgas * T_init); + e_start = StaticEnergy; + rho_start = Density; + Run_Newton_Solver(P, s, Pressure, Entropy, dPdrho_e, dPde_rho, dsdrho_e, dsde_rho); +} + - Run_Newton_Solver(P, s, &Pressure, &Entropy, &dPdrho_e, &dPde_rho, &dsdrho_e, &dsde_rho); +void CDataDrivenFluid::ComputeDerivativeNRBC_Prho(su2double P, su2double rho) { + SetTDState_Prho(P, rho); + + dhdrho_P = dhdrho_e - dhde_rho * (1 / dPde_rho) * dPdrho_e; + dhdP_rho = dhde_rho * (1 / dPde_rho); + dsdrho_P = dsdrho_e - dPdrho_e * (1 / dPde_rho) * dsde_rho; + dsdP_rho = dsde_rho / dPde_rho; } + unsigned long CDataDrivenFluid::Predict_MLP(su2double rho, su2double e) { unsigned long exit_code = 0; /*--- Evaluate MLP collection for the given values for density and energy. ---*/ #ifdef USE_MLPCPP MLP_inputs[idx_rho] = rho; MLP_inputs[idx_e] = e; - exit_code = lookup_mlp->PredictANN(iomap_rhoe, MLP_inputs, outputs_rhoe); + if (use_MLP_derivatives){ + exit_code = lookup_mlp->PredictANN(iomap_rhoe, MLP_inputs, outputs_rhoe, &dsdrhoe, &d2sdrhoe2); + } else { + exit_code = lookup_mlp->PredictANN(iomap_rhoe, MLP_inputs, outputs_rhoe); + } #endif + return exit_code; } @@ -268,37 +338,37 @@ void CDataDrivenFluid::Evaluate_Dataset(su2double rho, su2double e) { } } -void CDataDrivenFluid::Run_Newton_Solver(su2double Y1_target, su2double Y2_target, su2double* Y1, su2double* Y2, - su2double* dY1drho, su2double* dY1de, su2double* dY2drho, su2double* dY2de) { +void CDataDrivenFluid::Run_Newton_Solver(const su2double Y1_target, const su2double Y2_target, su2double const & Y1, su2double const & Y2, + su2double const & dY1drho, su2double const & dY1de, su2double const & dY2drho, su2double const & dY2de) { /*--- 2D Newton solver, computing the density and internal energy values corresponding to Y1_target and Y2_target. * ---*/ + AD::StartPreacc(); + AD::SetPreaccIn(Y1_target); + AD::SetPreaccIn(Y2_target); /*--- Setting initial values for density and energy. ---*/ su2double rho = rho_start, e = e_start; bool converged = false; unsigned long Iter = 0; - su2double delta_Y1, delta_Y2, delta_rho, delta_e, determinant; - /*--- Initiating Newton solver ---*/ while (!converged && (Iter < MaxIter_Newton)) { /*--- Determine thermodynamic state based on current density and energy. ---*/ SetTDState_rhoe(rho, e); /*--- Determine residuals. ---*/ - delta_Y1 = *Y1 - Y1_target; - delta_Y2 = *Y2 - Y2_target; + const su2double delta_Y1 = Y1 - Y1_target; + const su2double delta_Y2 = Y2 - Y2_target; /*--- Continue iterative process if residuals are outside tolerances. ---*/ - if ((abs(delta_Y1 / *Y1) < Newton_Tolerance) && (abs(delta_Y2 / *Y2) < Newton_Tolerance)) { + if ((abs(delta_Y1 / Y1) < Newton_Tolerance) && (abs(delta_Y2 / Y2) < Newton_Tolerance)) { converged = true; } else { /*--- Compute step size for density and energy. ---*/ - determinant = (*dY1drho) * (*dY2de) - (*dY1de) * (*dY2drho); - - delta_rho = (*dY2de * delta_Y1 - *dY1de * delta_Y2) / determinant; - delta_e = (-*dY2drho * delta_Y1 + *dY1drho * delta_Y2) / determinant; + const su2double determinant = (dY1drho) * (dY2de) - (dY1de) * (dY2drho); + const su2double delta_rho = (dY2de * delta_Y1 - dY1de * delta_Y2) / determinant; + const su2double delta_e = (-dY2drho * delta_Y1 + dY1drho * delta_Y2) / determinant; /*--- Update density and energy values. ---*/ rho -= Newton_Relaxation * delta_rho; @@ -307,38 +377,42 @@ void CDataDrivenFluid::Run_Newton_Solver(su2double Y1_target, su2double Y2_targe Iter++; } nIter_Newton = Iter; - + AD::SetPreaccOut(Density); + AD::SetPreaccOut(StaticEnergy); + AD::EndPreacc(); /*--- Evaluation of final state. ---*/ - SetTDState_rhoe(rho, e); + SetTDState_rhoe(Density, StaticEnergy); } -void CDataDrivenFluid::Run_Newton_Solver(su2double Y_target, su2double* Y, su2double* X, su2double* dYdX) { +void CDataDrivenFluid::Run_Newton_Solver(const su2double Y_target, su2double const & Y, su2double &X, su2double const & dYdX) { /*--- 1D Newton solver, computing the density or internal energy value corresponding to Y_target. ---*/ bool converged = false; unsigned long Iter = 0; - su2double delta_Y, delta_X; - + AD::StartPreacc(); + AD::SetPreaccIn(Y_target); /*--- Initiating Newton solver. ---*/ while (!converged && (Iter < MaxIter_Newton)) { /*--- Determine thermodynamic state based on current density and energy. ---*/ SetTDState_rhoe(Density, StaticEnergy); /*--- Determine residual ---*/ - delta_Y = Y_target - *Y; + const su2double delta_Y = Y_target - Y; /*--- Continue iterative process if residuals are outside tolerances. ---*/ - if (abs(delta_Y / *Y) < Newton_Tolerance) { + if (abs(delta_Y / Y) < Newton_Tolerance) { converged = true; } else { - delta_X = delta_Y / *dYdX; + const su2double delta_X = delta_Y / dYdX; /*--- Update energy value ---*/ - *X += Newton_Relaxation * delta_X; + X += Newton_Relaxation * delta_X; } Iter++; } + AD::SetPreaccOut(X); + AD::EndPreacc(); /*--- Calculate thermodynamic state based on converged values for density and energy. ---*/ SetTDState_rhoe(Density, StaticEnergy); @@ -367,21 +441,27 @@ void CDataDrivenFluid::ComputeIdealGasQuantities() { e_min = lookup_mlp->GetInputNorm(iomap_rhoe, idx_e).first; rho_max = lookup_mlp->GetInputNorm(iomap_rhoe, idx_rho).second; e_max = lookup_mlp->GetInputNorm(iomap_rhoe, idx_e).second; - rho_average = 0.5*(lookup_mlp->GetInputNorm(iomap_rhoe, idx_rho).first + lookup_mlp->GetInputNorm(iomap_rhoe, idx_rho).second); - e_average = 0.5*(lookup_mlp->GetInputNorm(iomap_rhoe, idx_e).first + lookup_mlp->GetInputNorm(iomap_rhoe, idx_e).second); + rho_average = lookup_mlp->GetInputOffset(iomap_rhoe, idx_rho); + e_average = lookup_mlp->GetInputOffset(iomap_rhoe, idx_e); #endif break; default: break; } - /*--- Compute thermodynamic state from middle of data set. ---*/ - SetTDState_rhoe(rho_average, e_average); + + su2double rho_init = custom_init_rho ? val_custom_init_rho : rho_average; + su2double e_init = custom_init_e ? val_custom_init_e : e_average; + + SetTDState_rhoe(rho_init, e_init); + rho_median = rho_init; + e_median = e_init; P_middle = Pressure; T_middle = Temperature; - R_idealgas = P_middle / (rho_average * T_middle); - Cv_idealgas = e_average / T_middle; - Cp_idealgas = Enthalpy / T_middle; + R_idealgas = P_middle / (rho_init * T_middle); + Cv_idealgas = Cv; + Cp_idealgas = Cp; + gamma_idealgas = (R_idealgas / Cv_idealgas) + 1; } \ No newline at end of file diff --git a/SU2_CFD/src/fluid/CFluidFlamelet.cpp b/SU2_CFD/src/fluid/CFluidFlamelet.cpp index a458a3fd97c..d9920d3fa47 100644 --- a/SU2_CFD/src/fluid/CFluidFlamelet.cpp +++ b/SU2_CFD/src/fluid/CFluidFlamelet.cpp @@ -36,13 +36,16 @@ CFluidFlamelet::CFluidFlamelet(CConfig* config, su2double value_pressure_operating) : CFluidModel() { rank = SU2_MPI::GetRank(); - Kind_DataDriven_Method = config->GetKind_DataDriven_Method(); + datadriven_fluid_options = config->GetDataDrivenParsedOptions(); + flamelet_options = config->GetFlameletParsedOptions(); + + Kind_DataDriven_Method = datadriven_fluid_options.interp_algorithm_type; /* -- number of auxiliary species transport equations, e.g. 1=CO, 2=NOx --- */ - n_user_scalars = config->GetNUserScalars(); - n_control_vars = config->GetNControlVars(); + n_user_scalars = flamelet_options.n_user_scalars; + n_control_vars = flamelet_options.n_control_vars; include_mixture_fraction = (n_control_vars == 3); - n_scalars = config->GetNScalars(); + n_scalars = flamelet_options.n_scalars; if (rank == MASTER_NODE) { cout << "Number of scalars: " << n_scalars << endl; @@ -52,19 +55,19 @@ CFluidFlamelet::CFluidFlamelet(CConfig* config, su2double value_pressure_operati scalars_vector.resize(n_scalars); table_scalar_names.resize(n_scalars); - for (auto iCV = 0u; iCV < n_control_vars; iCV++) table_scalar_names[iCV] = config->GetControllingVariableName(iCV); + for (auto iCV = 0u; iCV < n_control_vars; iCV++) table_scalar_names[iCV] = flamelet_options.controlling_variable_names[iCV];//->GetControllingVariableName(iCV); /*--- auxiliary species transport equations---*/ for (auto i_aux = 0u; i_aux < n_user_scalars; i_aux++) { - table_scalar_names[n_control_vars + i_aux] = config->GetUserScalarName(i_aux); + table_scalar_names[n_control_vars + i_aux] = flamelet_options.user_scalar_names[i_aux]; } controlling_variable_names.resize(n_control_vars); for (auto iCV = 0u; iCV < n_control_vars; iCV++) - controlling_variable_names[iCV] = config->GetControllingVariableName(iCV); + controlling_variable_names[iCV] =flamelet_options.controlling_variable_names[iCV]; passive_specie_names.resize(n_user_scalars); - for (auto i_aux = 0u; i_aux < n_user_scalars; i_aux++) passive_specie_names[i_aux] = config->GetUserScalarName(i_aux); + for (auto i_aux = 0u; i_aux < n_user_scalars; i_aux++) passive_specie_names[i_aux] = flamelet_options.user_scalar_names[i_aux];//config->GetUserScalarName(i_aux); switch (Kind_DataDriven_Method) { case ENUM_DATADRIVEN_METHOD::LUT: @@ -73,7 +76,7 @@ CFluidFlamelet::CFluidFlamelet(CConfig* config, su2double value_pressure_operati cout << "*** initializing the lookup table ***" << endl; cout << "*****************************************" << endl; } - look_up_table = new CLookUpTable(config->GetDataDriven_FileNames()[0], table_scalar_names[I_PROGVAR], + look_up_table = new CLookUpTable(datadriven_fluid_options.datadriven_filenames[0], table_scalar_names[I_PROGVAR], table_scalar_names[I_ENTH]); break; default: @@ -83,7 +86,7 @@ CFluidFlamelet::CFluidFlamelet(CConfig* config, su2double value_pressure_operati cout << "***********************************************" << endl; } #ifdef USE_MLPCPP - lookup_mlp = new MLPToolbox::CLookUp_ANN(config->GetNDataDriven_Files(), config->GetDataDriven_FileNames()); + lookup_mlp = new MLPToolbox::CLookUp_ANN(datadriven_fluid_options.n_filenames, datadriven_fluid_options.datadriven_filenames); if ((rank == MASTER_NODE)) lookup_mlp->DisplayNetworkInfo(); #else SU2_MPI::Error("SU2 was not compiled with MLPCpp enabled (-Denable-mlpcpp=true).", CURRENT_FUNCTION); @@ -170,7 +173,7 @@ void CFluidFlamelet::PreprocessLookUp(CConfig* config) { varnames_Sources.resize(n_sources); val_vars_Sources.resize(n_sources); for (auto iCV = 0u; iCV < n_control_vars; iCV++) - varnames_Sources[iCV] = config->GetControllingVariableSourceName(iCV); + varnames_Sources[iCV] = flamelet_options.cv_source_names[iCV];//->GetControllingVariableSourceName(iCV); /*--- No source term for enthalpy ---*/ /*--- For the auxiliary equations, we use a positive (production) and a negative (consumption) term: @@ -178,12 +181,12 @@ void CFluidFlamelet::PreprocessLookUp(CConfig* config) { for (size_t i_aux = 0; i_aux < n_user_scalars; i_aux++) { /*--- Order of the source terms: S_prod_1, S_cons_1, S_prod_2, S_cons_2, ...---*/ - varnames_Sources[n_control_vars + 2 * i_aux] = config->GetUserSourceName(2 * i_aux); - varnames_Sources[n_control_vars + 2 * i_aux + 1] = config->GetUserSourceName(2 * i_aux + 1); + varnames_Sources[n_control_vars + 2 * i_aux] = flamelet_options.user_source_names[2 * i_aux];//>GetUserSourceName(2 * i_aux); + varnames_Sources[n_control_vars + 2 * i_aux + 1] = flamelet_options.user_source_names[2 * i_aux + 1];//config->GetUserSourceName(2 * i_aux + 1); } /*--- Passive look-up terms ---*/ - size_t n_lookups = config->GetNLookups(); + size_t n_lookups = flamelet_options.n_lookups;//>GetNLookups(); if (n_lookups == 0) { varnames_LookUp.resize(1); val_vars_LookUp.resize(1); @@ -191,7 +194,7 @@ void CFluidFlamelet::PreprocessLookUp(CConfig* config) { } else { varnames_LookUp.resize(n_lookups); val_vars_LookUp.resize(n_lookups); - for (auto iLookup = 0u; iLookup < n_lookups; iLookup++) varnames_LookUp[iLookup] = config->GetLookupName(iLookup); + for (auto iLookup = 0u; iLookup < n_lookups; iLookup++) varnames_LookUp[iLookup] = flamelet_options.lookup_names[iLookup];//>GetLookupName(iLookup); } /*--- Preferential diffusion scalars ---*/ @@ -208,7 +211,7 @@ void CFluidFlamelet::PreprocessLookUp(CConfig* config) { val_vars_PD[FLAMELET_PREF_DIFF_SCALARS::I_BETA_ENTH] = beta_enth; val_vars_PD[FLAMELET_PREF_DIFF_SCALARS::I_BETA_MIXFRAC] = beta_mixfrac; - preferential_diffusion = config->GetPreferentialDiffusion(); + preferential_diffusion = flamelet_options.preferential_diffusion;//>GetPreferentialDiffusion(); switch (Kind_DataDriven_Method) { case ENUM_DATADRIVEN_METHOD::LUT: preferential_diffusion = look_up_table->CheckForVariables(varnames_PD); @@ -216,7 +219,7 @@ void CFluidFlamelet::PreprocessLookUp(CConfig* config) { case ENUM_DATADRIVEN_METHOD::MLP: #ifdef USE_MLPCPP n_betas = 0; - for (auto iMLP = 0u; iMLP < config->GetNDataDriven_Files(); iMLP++) { + for (auto iMLP = 0u; iMLP < datadriven_fluid_options.n_filenames; iMLP++) { auto outputMap = lookup_mlp->FindVariableIndices(iMLP, varnames_PD, false); n_betas += outputMap.size(); } @@ -227,7 +230,7 @@ void CFluidFlamelet::PreprocessLookUp(CConfig* config) { break; } - if (!preferential_diffusion && config->GetPreferentialDiffusion()) + if (!preferential_diffusion && flamelet_options.preferential_diffusion) SU2_MPI::Error("Preferential diffusion scalars not included in flamelet manifold.", CURRENT_FUNCTION); if (Kind_DataDriven_Method == ENUM_DATADRIVEN_METHOD::MLP) { diff --git a/SU2_CFD/src/iteration/CFluidIteration.cpp b/SU2_CFD/src/iteration/CFluidIteration.cpp index 4ca6c45a172..e77b0d7c2ca 100644 --- a/SU2_CFD/src/iteration/CFluidIteration.cpp +++ b/SU2_CFD/src/iteration/CFluidIteration.cpp @@ -235,6 +235,10 @@ bool CFluidIteration::Monitor(COutput* output, CIntegration**** integration, CGe TurboMonitor(geometry, config, config[val_iZone]->GetInnerIter(), val_iZone); } + + /*--- Update the values of any adaptive boundary conditions ---*/ + UpdateBoundaryConditions(geometry, config, config[val_iZone]->GetInnerIter(), val_iZone); + output->SetHistoryOutput(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone], config[val_iZone]->GetTimeIter(), config[val_iZone]->GetOuterIter(), config[val_iZone]->GetInnerIter()); @@ -286,7 +290,9 @@ void CFluidIteration::TurboMonitor(CGeometry**** geometry_container, CConfig** c } } } - +} +void CFluidIteration::UpdateBoundaryConditions(CGeometry**** geometry_container, CConfig** config_container, unsigned long iter, unsigned short iZone) { + auto* config = config_container[iZone]; /*--- Outlet Pressure Ramp: Compute the updated pressure. ---*/ if (config->GetRampOutletPressure()) { const unsigned long rampFreq = SU2_TYPE::Int(config->GetRampOutletPressure_Coeff(1)); @@ -306,7 +312,7 @@ void CFluidIteration::TurboMonitor(CGeometry**** geometry_container, CConfig** c case RIEMANN_BOUNDARY: KindBCOption = config->GetKind_Data_Riemann(Marker_Tag); if (KindBCOption == STATIC_PRESSURE || KindBCOption == RADIAL_EQUILIBRIUM) { - SU2_MPI::Error("Outlet pressure ramp only implemented for NRBC", CURRENT_FUNCTION); + config->SetRiemann_Var1(outPres, Marker_Tag); } break; case GILES_BOUNDARY: diff --git a/SU2_CFD/src/output/CAdjFlowOutput.cpp b/SU2_CFD/src/output/CAdjFlowOutput.cpp index 481b63f6fb4..c50c08b10a6 100644 --- a/SU2_CFD/src/output/CAdjFlowOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowOutput.cpp @@ -62,12 +62,13 @@ void CAdjFlowOutput::AddHistoryOutputFields_AdjScalarRMS_RES(const CConfig* conf } if (config->GetKind_Species_Model() == SPECIES_MODEL::FLAMELET) { - for (auto iCV=0u; iCV < config->GetNControlVars(); iCV++) { - const auto& cv_name = config->GetControllingVariableName(iCV); + const auto flamelet_config_options = config->GetFlameletParsedOptions(); + for (auto iCV=0u; iCV < flamelet_config_options.n_control_vars; iCV++) { + const auto& cv_name = config->GetFlameletParsedOptions().controlling_variable_names[iCV]; AddHistoryOutput("RMS_ADJ_"+cv_name, "rms[" + cv_name + "]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint " + cv_name, HistoryFieldType::RESIDUAL); } - for (unsigned short i_scalar = 0; i_scalar < config->GetNUserScalars(); i_scalar++) { - const auto& scalar_name = config->GetUserScalarName(i_scalar); + for (unsigned short i_scalar = 0; i_scalar < flamelet_config_options.n_user_scalars; i_scalar++) { + const auto& scalar_name = config->GetFlameletParsedOptions().user_scalar_names[i_scalar];//config->GetUserScalarName(i_scalar); AddHistoryOutput("RMS_ADJ_" + scalar_name, "rms[" + scalar_name + "]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint of " + scalar_name + " .", HistoryFieldType::RESIDUAL); } } @@ -98,12 +99,13 @@ void CAdjFlowOutput::AddHistoryOutputFields_AdjScalarMAX_RES(const CConfig* conf } if (config->GetKind_Species_Model() == SPECIES_MODEL::FLAMELET) { - for (auto iCV=0u; iCV < config->GetNControlVars(); iCV++) { - const auto& cv_name = config->GetControllingVariableName(iCV); + const auto flamelet_config_options = config->GetFlameletParsedOptions(); + for (auto iCV=0u; iCV < flamelet_config_options.n_control_vars; iCV++) { + const auto& cv_name = flamelet_config_options.controlling_variable_names[iCV]; AddHistoryOutput("MAX_ADJ_" + cv_name, "max["+cv_name +"]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint " + cv_name, HistoryFieldType::RESIDUAL); } - for (unsigned short i_scalar = 0; i_scalar < config->GetNUserScalars(); i_scalar++) { - const auto& scalar_name = config->GetUserScalarName(i_scalar); + for (unsigned short i_scalar = 0; i_scalar < flamelet_config_options.n_user_scalars; i_scalar++) { + const auto& scalar_name = flamelet_config_options.user_scalar_names[i_scalar]; AddHistoryOutput("MAX_ADJ_" + scalar_name, "max[scalar_" + scalar_name + "]",ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint of " + scalar_name + " .", HistoryFieldType::RESIDUAL); } } @@ -136,13 +138,14 @@ void CAdjFlowOutput::AddHistoryOutputFields_AdjScalarBGS_RES(const CConfig* conf } if (config->GetKind_Species_Model() == SPECIES_MODEL::FLAMELET) { - for (auto iCV=0u; iCV < config->GetNControlVars(); iCV++) { - const auto& cv_name = config->GetControllingVariableName(iCV); + const auto flamelet_config_options = config->GetFlameletParsedOptions(); + for (auto iCV=0u; iCV < flamelet_config_options.n_control_vars; iCV++) { + const auto& cv_name = flamelet_config_options.controlling_variable_names[iCV]; AddHistoryOutput("BGS_ADJ_" + cv_name, "bgs[" + cv_name + "]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint " + cv_name, HistoryFieldType::RESIDUAL); } - for (unsigned short i_scalar = 0; i_scalar < config->GetNUserScalars(); i_scalar++) { - const auto& scalar_name = config->GetUserScalarName(i_scalar); + for (unsigned short i_scalar = 0; i_scalar < flamelet_config_options.n_user_scalars; i_scalar++) { + const auto& scalar_name = flamelet_config_options.user_scalar_names[i_scalar]; AddHistoryOutput("BGS_ADJ_" + scalar_name, "bgs[" + scalar_name + "]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint of " + scalar_name + " .", HistoryFieldType::RESIDUAL); } } @@ -213,16 +216,17 @@ void CAdjFlowOutput::LoadHistoryDataAdjScalar(const CConfig* config, const CSolv } if (config->GetKind_Species_Model() == SPECIES_MODEL::FLAMELET) { - for (auto iCV=0u; iCV < config->GetNControlVars(); iCV++) { - const auto& cv_name = config->GetControllingVariableName(iCV); - SetHistoryOutputValue("RMS_ADJ_"+cv_name, log10(adjspecies_solver->GetRes_RMS(iCV))); - SetHistoryOutputValue("MAX_ADJ_"+cv_name, log10(adjspecies_solver->GetRes_Max(iCV))); - if (multiZone) - SetHistoryOutputValue("BGS_ADJ_" + cv_name, log10(adjspecies_solver->GetRes_BGS(iCV))); - } + const auto flamelet_config_options = config->GetFlameletParsedOptions(); + for (auto iCV=0u; iCV < flamelet_config_options.n_control_vars; iCV++) { + const auto& cv_name = flamelet_config_options.controlling_variable_names[iCV]; + SetHistoryOutputValue("RMS_ADJ_"+cv_name, log10(adjspecies_solver->GetRes_RMS(iCV))); + SetHistoryOutputValue("MAX_ADJ_"+cv_name, log10(adjspecies_solver->GetRes_Max(iCV))); + if (multiZone) + SetHistoryOutputValue("BGS_ADJ_" + cv_name, log10(adjspecies_solver->GetRes_BGS(iCV))); + } - for (unsigned short i_scalar = 0; i_scalar < config->GetNUserScalars(); i_scalar++) { - const auto& scalar_name = config->GetUserScalarName(i_scalar); + for (unsigned short i_scalar = 0; i_scalar < flamelet_config_options.n_user_scalars; i_scalar++) { + const auto& scalar_name = flamelet_config_options.user_scalar_names[i_scalar]; SetHistoryOutputValue("RMS_ADJ_" + scalar_name, log10(adjspecies_solver->GetRes_RMS(2 + i_scalar))); SetHistoryOutputValue("MAX_ADJ_" + scalar_name, log10(adjspecies_solver->GetRes_Max(2 + i_scalar))); if (multiZone) { @@ -263,13 +267,14 @@ void CAdjFlowOutput::SetVolumeOutputFieldsAdjScalarSolution(const CConfig* confi } if (config->GetKind_Species_Model() == SPECIES_MODEL::FLAMELET) { - for (auto iCV=0u; iCV < config->GetNControlVars(); iCV++) { - const auto& cv_name = config->GetControllingVariableName(iCV); + const auto flamelet_config_options = config->GetFlameletParsedOptions(); + for (auto iCV=0u; iCV < flamelet_config_options.n_control_vars; iCV++) { + const auto& cv_name = flamelet_config_options.controlling_variable_names[iCV]; AddVolumeOutput("ADJ_" + cv_name, "Adjoint_" + cv_name, "SOLUTION", "Adjoint of the " + cv_name + " controlling variable."); } - for (unsigned short i_scalar = 0; i_scalar < config->GetNUserScalars(); i_scalar++) { - const auto& scalar_name = config->GetUserScalarName(i_scalar); + for (unsigned short i_scalar = 0; i_scalar < flamelet_config_options.n_user_scalars; i_scalar++) { + const auto& scalar_name = flamelet_config_options.user_scalar_names[i_scalar]; AddVolumeOutput("ADJ_" + scalar_name, "Adjoint_" + scalar_name, "SOLUTION", "Adjoint of " + scalar_name); } } @@ -304,12 +309,13 @@ void CAdjFlowOutput::SetVolumeOutputFieldsAdjScalarResidual(const CConfig* confi } if (config->GetKind_Species_Model() == SPECIES_MODEL::FLAMELET) { - for(auto iCV=0u; iCV < config->GetNControlVars(); iCV++) { - const auto& cv_name = config->GetControllingVariableName(iCV); + const auto flamelet_config_options = config->GetFlameletParsedOptions(); + for(auto iCV=0u; iCV < flamelet_config_options.n_control_vars; iCV++) { + const auto& cv_name = flamelet_config_options.controlling_variable_names[iCV]; AddVolumeOutput("RES_ADJ_" + cv_name, "Residual_Adjoint_" + cv_name, "RESIDUAL", "Residual of the adjoint of " + cv_name); } - for (unsigned short i_scalar = 0; i_scalar < config->GetNUserScalars(); i_scalar++) { - const auto& scalar_name = config->GetUserScalarName(i_scalar); + for (unsigned short i_scalar = 0; i_scalar < flamelet_config_options.n_user_scalars; i_scalar++) { + const auto& scalar_name = flamelet_config_options.user_scalar_names[i_scalar]; AddVolumeOutput("RES_ADJ_" + scalar_name, "Residual_Adjoint_" + scalar_name, "RESIDUAL", "Residual of the adjoint of " + scalar_name); } } @@ -351,16 +357,16 @@ void CAdjFlowOutput::LoadVolumeDataAdjScalar(const CConfig* config, const CSolve } if (config->GetKind_Species_Model() == SPECIES_MODEL::FLAMELET) { - - for (auto iCV=0u; iCV < config->GetNControlVars(); iCV++) { - const auto& cv_name = config->GetControllingVariableName(iCV); + const auto flamelet_config_options = config->GetFlameletParsedOptions(); + for (auto iCV=0u; iCV < flamelet_config_options.n_control_vars; iCV++) { + const auto& cv_name = flamelet_config_options.controlling_variable_names[iCV]; SetVolumeOutputValue("ADJ_" + cv_name, iPoint, Node_AdjSpecies->GetSolution(iPoint, iCV)); SetVolumeOutputValue("RES_ADJ_" + cv_name, iPoint, Node_AdjSpecies->GetSolution(iPoint, iCV) - Node_AdjSpecies->GetSolution_Old(iPoint, iCV)); } - for (unsigned short i_scalar = 0; i_scalar < config->GetNUserScalars(); i_scalar++) { - const auto& scalar_name = config->GetUserScalarName(i_scalar); - SetVolumeOutputValue("ADJ_" + scalar_name, iPoint, Node_AdjSpecies->GetSolution(iPoint, config->GetNControlVars() + i_scalar)); - SetVolumeOutputValue("RES_ADJ_" + scalar_name, iPoint, Node_AdjSpecies->GetSolution(iPoint, config->GetNControlVars() + i_scalar) - Node_AdjSpecies->GetSolution_Old(iPoint, config->GetNControlVars() + i_scalar)); + for (unsigned short i_scalar = 0; i_scalar < flamelet_config_options.n_user_scalars; i_scalar++) { + const auto& scalar_name = flamelet_config_options.user_scalar_names[i_scalar]; + SetVolumeOutputValue("ADJ_" + scalar_name, iPoint, Node_AdjSpecies->GetSolution(iPoint, flamelet_config_options.n_control_vars + i_scalar)); + SetVolumeOutputValue("RES_ADJ_" + scalar_name, iPoint, Node_AdjSpecies->GetSolution(iPoint, flamelet_config_options.n_control_vars + i_scalar) - Node_AdjSpecies->GetSolution_Old(iPoint, flamelet_config_options.n_control_vars + i_scalar)); } } diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 3c651269b02..ac1bd8f92d9 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -995,15 +995,16 @@ void CFlowOutput::AddHistoryOutputFields_ScalarRMS_RES(const CConfig* config) { break; } case SPECIES_MODEL::FLAMELET: { + const auto flamelet_config_options = config->GetFlameletParsedOptions(); /*--- Controlling variable transport. ---*/ - for (auto iCV = 0u; iCV < config->GetNControlVars(); iCV++){ - const auto& CV_name = config->GetControllingVariableName(iCV); + for (auto iCV = 0u; iCV < flamelet_config_options.n_control_vars; iCV++){ + const auto& CV_name = flamelet_config_options.controlling_variable_names[iCV]; AddHistoryOutput("RMS_"+CV_name, "rms["+CV_name+"]",ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean squared residual of " + CV_name + " controlling variable equation.", HistoryFieldType::RESIDUAL); } /*--- auxiliary species transport ---*/ - for (auto i_scalar = 0u; i_scalar < config->GetNUserScalars(); i_scalar++){ - const auto& scalar_name = config->GetUserScalarName(i_scalar); + for (auto i_scalar = 0u; i_scalar < flamelet_config_options.n_user_scalars; i_scalar++){ + const auto& scalar_name = flamelet_config_options.user_scalar_names[i_scalar]; AddHistoryOutput("RMS_"+scalar_name, "rms["+scalar_name+"]", ScreenOutputFormat::FIXED , "RMS_RES", "Root-mean squared residual of the "+scalar_name+" mass fraction equation." , HistoryFieldType::RESIDUAL); } break; @@ -1052,15 +1053,16 @@ void CFlowOutput::AddHistoryOutputFields_ScalarMAX_RES(const CConfig* config) { break; } case SPECIES_MODEL::FLAMELET: { + const auto flamelet_config_options = config->GetFlameletParsedOptions(); /*--- Controlling variable transport. ---*/ - for (auto iCV=0u; iCV < config->GetNControlVars(); iCV++){ - const auto& cv_name = config->GetControllingVariableName(iCV); + for (auto iCV=0u; iCV < flamelet_config_options.n_control_vars; iCV++){ + const auto& cv_name = flamelet_config_options.controlling_variable_names[iCV]; AddHistoryOutput("MAX_" + cv_name, "max[" + cv_name + "]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the " + cv_name + " equation.", HistoryFieldType::RESIDUAL); } /*--- auxiliary species transport ---*/ - for (auto i_scalar = 0u; i_scalar < config->GetNUserScalars(); i_scalar++){ - const auto& scalar_name = config->GetUserScalarName(i_scalar); + for (auto i_scalar = 0u; i_scalar < flamelet_config_options.n_user_scalars; i_scalar++){ + const auto& scalar_name = flamelet_config_options.user_scalar_names[i_scalar]; AddHistoryOutput("MAX_" + scalar_name, "max[" + scalar_name + "]", ScreenOutputFormat::FIXED , "MAX_RES", "Maximum residual of the " + scalar_name + " mass fraction equation." , HistoryFieldType::RESIDUAL); } break; @@ -1107,15 +1109,16 @@ void CFlowOutput::AddHistoryOutputFields_ScalarBGS_RES(const CConfig* config) { break; } case SPECIES_MODEL::FLAMELET: { + const auto flamelet_config_options = config->GetFlameletParsedOptions(); /*--- Controlling variable transport. ---*/ - for (auto iCV=0u; iCV < config->GetNControlVars(); iCV++){ - const auto& cv_name = config->GetControllingVariableName(iCV); + for (auto iCV=0u; iCV < flamelet_config_options.n_control_vars; iCV++){ + const auto& cv_name = flamelet_config_options.controlling_variable_names[iCV]; AddHistoryOutput("BGS_" + cv_name, "bgs[" + cv_name + "]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the " + cv_name + " controlling variable equation.", HistoryFieldType::RESIDUAL); } /*--- auxiliary species transport ---*/ - for (auto i_scalar = 0u; i_scalar < config->GetNUserScalars(); i_scalar++){ - const auto& scalar_name = config->GetUserScalarName(i_scalar); + for (auto i_scalar = 0u; i_scalar < flamelet_config_options.n_user_scalars; i_scalar++){ + const auto& scalar_name = flamelet_config_options.user_scalar_names[i_scalar]; AddHistoryOutput("BGS_"+scalar_name, "bgs["+scalar_name+"]", ScreenOutputFormat::FIXED , "BGS_RES", "BGS residual of the "+scalar_name+" mass fraction equation." , HistoryFieldType::RESIDUAL); } break; @@ -1213,9 +1216,10 @@ void CFlowOutput::LoadHistoryDataScalar(const CConfig* config, const CSolver* co } case SPECIES_MODEL::FLAMELET: { + const auto flamelet_config_options = config->GetFlameletParsedOptions(); /*--- Controlling variable transport. ---*/ - for (auto iCV=0u; iCV < config->GetNControlVars(); iCV++){ - const auto& cv_name = config->GetControllingVariableName(iCV); + for (auto iCV=0u; iCV < flamelet_config_options.n_control_vars; iCV++){ + const auto& cv_name = flamelet_config_options.controlling_variable_names[iCV]; SetHistoryOutputValue("RMS_" + cv_name, log10(solver[SPECIES_SOL]->GetRes_RMS(iCV))); SetHistoryOutputValue("MAX_" + cv_name, log10(solver[SPECIES_SOL]->GetRes_Max(iCV))); if (multiZone) { @@ -1223,19 +1227,19 @@ void CFlowOutput::LoadHistoryDataScalar(const CConfig* config, const CSolver* co } } /*--- auxiliary species transport ---*/ - for (unsigned short iReactant=0; iReactantGetNUserScalars(); iReactant++){ - const auto& species_name = config->GetUserScalarName(iReactant); - SetHistoryOutputValue("RMS_" + species_name, log10(solver[SPECIES_SOL]->GetRes_RMS(config->GetNControlVars() + iReactant))); - SetHistoryOutputValue("MAX_" + species_name, log10(solver[SPECIES_SOL]->GetRes_Max(config->GetNControlVars() + iReactant))); + for (unsigned short iReactant=0; iReactantGetRes_RMS(flamelet_config_options.n_control_vars + iReactant))); + SetHistoryOutputValue("MAX_" + species_name, log10(solver[SPECIES_SOL]->GetRes_Max(flamelet_config_options.n_control_vars + iReactant))); if (multiZone) { - SetHistoryOutputValue("BGS_" + species_name, log10(solver[SPECIES_SOL]->GetRes_BGS(config->GetNControlVars() + iReactant))); + SetHistoryOutputValue("BGS_" + species_name, log10(solver[SPECIES_SOL]->GetRes_BGS(flamelet_config_options.n_control_vars + iReactant))); } } SetHistoryOutputValue("LINSOL_ITER_FLAMELET", solver[SPECIES_SOL]->GetIterLinSolver()); SetHistoryOutputValue("LINSOL_RESIDUAL_FLAMELET", log10(solver[SPECIES_SOL]->GetResLinSolver())); - break; } + break; case SPECIES_MODEL::NONE: break; } @@ -1274,18 +1278,19 @@ void CFlowOutput::SetVolumeOutputFieldsScalarSolution(const CConfig* config){ AddVolumeOutput("SPECIES_" + std::to_string(iVar), "Species_" + std::to_string(iVar), "SOLUTION", "Species_" + std::to_string(iVar) + " mass fraction"); } break; - case SPECIES_MODEL::FLAMELET: - /*--- Controlling variables. ---*/ - for (auto iCV=0u; iCVGetNControlVars(); iCV++) { - const auto& cv_name = config->GetControllingVariableName(iCV); - AddVolumeOutput(cv_name, cv_name, "SOLUTION", cv_name + " solution."); - } - /*--- auxiliary species ---*/ - for (auto iReactant=0u; iReactantGetNUserScalars(); iReactant++) { - const auto& species_name = config->GetUserScalarName(iReactant); - AddVolumeOutput(species_name, species_name, "SOLUTION", species_name + "Mass fraction solution"); + case SPECIES_MODEL::FLAMELET: { + const auto flamelet_config_options = config->GetFlameletParsedOptions(); + /*--- Controlling variables. ---*/ + for (auto iCV=0u; iCVGetFlameletParsedOptions(); /*--- Residuals for controlling variable transport equations. ---*/ - for (auto iCV=0u; iCVGetNControlVars(); iCV++) { - const auto& cv_name = config->GetControllingVariableName(iCV); + for (auto iCV=0u; iCVGetNUserScalars(); iReactant++){ - const auto& species_name = config->GetUserScalarName(iReactant); + for (unsigned short iReactant=0; iReactantGetnSpecies(); iVar++) AddVolumeOutput("LIMITER_SPECIES_" + std::to_string(iVar), "Limiter_Species_" + std::to_string(iVar), "LIMITER", "Limiter value of the transported species " + std::to_string(iVar)); break; - case SPECIES_MODEL::FLAMELET: + case SPECIES_MODEL::FLAMELET: { + const auto flamelet_config_options = config->GetFlameletParsedOptions(); /*--- Limiter for controlling variables transport. ---*/ - for (auto iCV=0u; iCV < config->GetNControlVars(); iCV++) { - const auto& cv_name = config->GetControllingVariableName(iCV); + for (auto iCV=0u; iCV < flamelet_config_options.n_control_vars; iCV++) { + const auto& cv_name = flamelet_config_options.controlling_variable_names[iCV]; AddVolumeOutput("LIMITER_" + cv_name, "Limiter_" + cv_name, "LIMITER", "Limiter of " + cv_name + " controlling variable."); } /*--- limiter for auxiliary species transport ---*/ - for (unsigned short iReactant=0; iReactant < config->GetNUserScalars(); iReactant++) { - const auto& species_name = config->GetUserScalarName(iReactant); + for (unsigned short iReactant=0; iReactant < flamelet_config_options.n_user_scalars; iReactant++) { + const auto& species_name = flamelet_config_options.user_scalar_names[iReactant]; AddVolumeOutput("LIMITER_" + species_name, "LIMITER_" + species_name, "LIMITER", "Limiter value for the " + species_name + " equation"); } + } break; default: break; @@ -1421,19 +1430,21 @@ void CFlowOutput::SetVolumeOutputFieldsScalarSource(const CConfig* config) { /*--- Only place outputs of the "SOURCE" group for scalar transport here. ---*/ switch (config->GetKind_Species_Model()) { - case SPECIES_MODEL::FLAMELET: - for (auto iCV=0u; iCV < config->GetNControlVars(); iCV++) { - const auto& cv_source_name = config->GetControllingVariableSourceName(iCV); - const auto& cv_name = config->GetControllingVariableName(iCV); + case SPECIES_MODEL::FLAMELET: { + const auto flamelet_config_options = config->GetFlameletParsedOptions(); + for (auto iCV=0u; iCV < flamelet_config_options.n_control_vars; iCV++) { + const auto& cv_source_name = flamelet_config_options.cv_source_names[iCV]; + const auto& cv_name = flamelet_config_options.controlling_variable_names[iCV]; if (cv_source_name.compare("NULL") != 0) AddVolumeOutput("SOURCE_"+cv_name, "Source_" + cv_name, "SOURCE", "Source " + cv_name); } /*--- no source term for enthalpy ---*/ /*--- auxiliary species source terms ---*/ - for (auto iReactant=0u; iReactantGetNUserScalars(); iReactant++) { - const auto& species_name = config->GetUserScalarName(iReactant); + for (auto iReactant=0u; iReactantGetKind_Species_Model()) { - case SPECIES_MODEL::FLAMELET: - for (auto i_lookup = 0u; i_lookup < config->GetNLookups(); ++i_lookup) { - string strname1 = "lookup_" + config->GetLookupName(i_lookup); - AddVolumeOutput(config->GetLookupName(i_lookup), strname1,"LOOKUP", config->GetLookupName(i_lookup)); - } - AddVolumeOutput("TABLE_MISSES" , "Table_misses" , "LOOKUP", "Lookup table misses"); - break; - default: - break; + if (config->GetKind_Species_Model() == SPECIES_MODEL::FLAMELET) { + const auto flamelet_config_options = config->GetFlameletParsedOptions(); + for (auto i_lookup = 0u; i_lookup < flamelet_config_options.n_lookups; ++i_lookup) { + string strname1 = "lookup_" + flamelet_config_options.lookup_names[i_lookup]; + AddVolumeOutput(flamelet_config_options.lookup_names[i_lookup], strname1,"LOOKUP", flamelet_config_options.lookup_names[i_lookup]); + } + AddVolumeOutput("TABLE_MISSES" , "Table_misses" , "LOOKUP", "Lookup table misses"); } } @@ -1585,47 +1593,47 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con case SPECIES_MODEL::FLAMELET: { const auto Node_Species = solver[SPECIES_SOL]->GetNodes(); - + const auto flamelet_config_options = config->GetFlameletParsedOptions(); /*--- Controlling variables transport equations. ---*/ - for (auto iCV=0u; iCV < config->GetNControlVars(); iCV++) { - const auto& cv_name = config->GetControllingVariableName(iCV); + for (auto iCV=0u; iCV < flamelet_config_options.n_control_vars; iCV++) { + const auto& cv_name = flamelet_config_options.controlling_variable_names[iCV]; SetVolumeOutputValue(cv_name, iPoint, Node_Species->GetSolution(iPoint, iCV)); SetVolumeOutputValue("RES_" + cv_name, iPoint, solver[SPECIES_SOL]->LinSysRes(iPoint, iCV)); - const auto& source_name = config->GetControllingVariableSourceName(iCV); + const auto& source_name = flamelet_config_options.cv_source_names[iCV]; if (source_name.compare("NULL") != 0) SetVolumeOutputValue("SOURCE_" + cv_name, iPoint, Node_Species->GetScalarSources(iPoint)[iCV]); } /*--- auxiliary species transport equations ---*/ - for (unsigned short i_scalar=0; i_scalarGetNUserScalars(); i_scalar++) { - const auto& scalar_name = config->GetUserScalarName(i_scalar); - SetVolumeOutputValue(scalar_name, iPoint, Node_Species->GetSolution(iPoint, config->GetNControlVars() + i_scalar)); - SetVolumeOutputValue("SOURCE_" + scalar_name, iPoint, Node_Species->GetScalarSources(iPoint)[config->GetNControlVars() + i_scalar]); - SetVolumeOutputValue("RES_" + scalar_name, iPoint, solver[SPECIES_SOL]->LinSysRes(iPoint, config->GetNControlVars() + i_scalar)); + for (unsigned short i_scalar=0; i_scalarGetSolution(iPoint, flamelet_config_options.n_control_vars + i_scalar)); + SetVolumeOutputValue("SOURCE_" + scalar_name, iPoint, Node_Species->GetScalarSources(iPoint)[flamelet_config_options.n_control_vars + i_scalar]); + SetVolumeOutputValue("RES_" + scalar_name, iPoint, solver[SPECIES_SOL]->LinSysRes(iPoint, flamelet_config_options.n_control_vars + i_scalar)); } if (config->GetKind_SlopeLimit_Species() != LIMITER::NONE) { /*--- Limiter for controlling variable transport equations. ---*/ - for (auto iCV=0u; iCVGetNControlVars(); iCV++) { - const auto& cv_name = config->GetControllingVariableName(iCV); + for (auto iCV=0u; iCVGetLimiter(iPoint, iCV)); } /*--- limiter for auxiliary species transport equations ---*/ - for (unsigned short i_scalar=0; i_scalarGetNUserScalars(); i_scalar++) { - const auto& scalar_name = config->GetUserScalarName(i_scalar); - SetVolumeOutputValue("LIMITER_" + scalar_name, iPoint, Node_Species->GetLimiter(iPoint, config->GetNControlVars() + i_scalar)); + for (unsigned short i_scalar=0; i_scalarGetLimiter(iPoint, flamelet_config_options.n_control_vars + i_scalar)); } } /*--- variables that we look up from the LUT ---*/ - for (int i_lookup = 0; i_lookup < config->GetNLookups(); ++i_lookup) { - if (config->GetLookupName(i_lookup)!="NULL") - SetVolumeOutputValue(config->GetLookupName(i_lookup), iPoint, Node_Species->GetScalarLookups(iPoint)[i_lookup]); + for (int i_lookup = 0; i_lookup < flamelet_config_options.n_lookups; ++i_lookup) { + if (flamelet_config_options.lookup_names[i_lookup] !="NULL") + SetVolumeOutputValue(flamelet_config_options.lookup_names[i_lookup], iPoint, Node_Species->GetScalarLookups(iPoint)[i_lookup]); } SetVolumeOutputValue("TABLE_MISSES", iPoint, Node_Species->GetTableMisses(iPoint)); - break; } + break; case SPECIES_MODEL::NONE: break; } } diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index 2c6322392c7..2263b2c94f3 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -3697,13 +3697,14 @@ void CSolver::LoadInletProfile(CGeometry **geometry, } break; case SPECIES_MODEL::FLAMELET: + const auto flamelet_config_options = config->GetFlameletParsedOptions(); /*--- 2-equation flamelet model ---*/ columnName << "PROGRESSVAR" << setw(24) << "ENTHALPYTOT" << setw(24); columnValue << config->GetInlet_SpeciesVal(Marker_Tag)[0] << "\t" << config->GetInlet_SpeciesVal(Marker_Tag)[1]<<"\t"; /*--- auxiliary species transport equations ---*/ - for (unsigned short iReactant = 0; iReactant < config->GetNUserScalars(); iReactant++) { - columnName << config->GetUserScalarName(iReactant) << setw(24); - columnValue << config->GetInlet_SpeciesVal(Marker_Tag)[config->GetNControlVars() + iReactant] << "\t"; + for (unsigned short iReactant = 0; iReactant < flamelet_config_options.n_user_scalars; iReactant++) { + columnName << flamelet_config_options.user_scalar_names[iReactant] << setw(24); + columnValue << config->GetInlet_SpeciesVal(Marker_Tag)[flamelet_config_options.n_control_vars + iReactant] << "\t"; } break; } diff --git a/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp b/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp index 33ad74b3f38..e57fd11a5f8 100644 --- a/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp +++ b/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp @@ -36,9 +36,13 @@ CSpeciesFlameletSolver::CSpeciesFlameletSolver(CGeometry* geometry, CConfig* config, unsigned short iMesh) : CSpeciesSolver(geometry, config, true) { + + /*--- Retrieve options from config. ---*/ + flamelet_config_options = config->GetFlameletParsedOptions(); + /*--- Dimension of the problem. ---*/ - nVar = config->GetNScalars(); - include_mixture_fraction = (config->GetNControlVars() == 3); + nVar = flamelet_config_options.n_scalars; + include_mixture_fraction = (flamelet_config_options.n_control_vars == 3); Initialize(geometry, config, iMesh, nVar); @@ -73,8 +77,8 @@ void CSpeciesFlameletSolver::Preprocessing(CGeometry* geometry, CSolver** solver auto* flowNodes = su2staticcast_p(solver_container[FLOW_SOL]->GetNodes()); /*--- Retrieve spark ignition parameters for spark-type ignition. ---*/ - if ((config->GetFlameletInitType() == FLAMELET_INIT_TYPE::SPARK) && !config->GetRestart()) { - auto spark_init = config->GetFlameInit(); + if ((flamelet_config_options.ignition_method == FLAMELET_INIT_TYPE::SPARK) && !config->GetRestart()) { + auto spark_init = flamelet_config_options.spark_init; spark_iter_start = ceil(spark_init[4]); spark_duration = ceil(spark_init[5]); unsigned long iter = config->GetMultizone_Problem() ? config->GetOuterIter() : config->GetInnerIter(); @@ -95,18 +99,18 @@ void CSpeciesFlameletSolver::Preprocessing(CGeometry* geometry, CSolver** solver if (ignition) { /*--- Apply source terms within spark radius. ---*/ su2double dist_from_center = 0, - spark_radius = config->GetFlameInit()[3]; - dist_from_center = GeometryToolbox::SquaredDistance(nDim, geometry->nodes->GetCoord(i_point), config->GetFlameInit()); + spark_radius = flamelet_config_options.spark_init[3]; + dist_from_center = GeometryToolbox::SquaredDistance(nDim, geometry->nodes->GetCoord(i_point), flamelet_config_options.flame_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] + config->GetSpark()[iVar]); + nodes->SetScalarSource(i_point, iVar, nodes->GetScalarSources(i_point)[iVar] + flamelet_config_options.spark_reaction_rates[iVar]); } } nodes->SetTableMisses(i_point, misses); n_not_in_domain_local += misses; /*--- Obtain passive look-up scalars. ---*/ - SetScalarLookUps(config, fluid_model_local, i_point, scalars_vector); + SetScalarLookUps(fluid_model_local, i_point, scalars_vector); /*--- Set mass diffusivity based on thermodynamic state. ---*/ auto T = flowNodes->GetTemperature(i_point); @@ -117,8 +121,8 @@ void CSpeciesFlameletSolver::Preprocessing(CGeometry* geometry, CSolver** solver } /*--- Obtain preferential diffusion scalar values. ---*/ - if (config->GetPreferentialDiffusion()) - SetPreferentialDiffusionScalars(config, fluid_model_local, i_point, scalars_vector); + if (flamelet_config_options.preferential_diffusion) + SetPreferentialDiffusionScalars(fluid_model_local, i_point, scalars_vector); if (!Output) LinSysRes.SetBlock_Zero(i_point); } @@ -130,7 +134,7 @@ void CSpeciesFlameletSolver::Preprocessing(CGeometry* geometry, CSolver** solver cout << "Number of points outside manifold domain: " << n_not_in_domain_global << endl; /*--- Compute preferential diffusion scalar gradients. ---*/ - if (config->GetPreferentialDiffusion()) { + if (flamelet_config_options.preferential_diffusion) { switch (config->GetKind_Gradient_Method()) { case GREEN_GAUSS: SetAuxVar_Gradient_GG(geometry, config); @@ -157,11 +161,11 @@ void CSpeciesFlameletSolver::SetInitialCondition(CGeometry** geometry, CSolver** su2double flame_offset[3] = {0, 0, 0}, flame_normal[3] = {0, 0, 0}, flame_thickness = 0, flame_burnt_thickness = 0, flamenorm = 0; - bool flame_front_ignition = (config->GetFlameletInitType() == FLAMELET_INIT_TYPE::FLAME_FRONT); + bool flame_front_ignition = (flamelet_config_options.ignition_method == FLAMELET_INIT_TYPE::FLAME_FRONT); if (flame_front_ignition) { /*--- Collect flame front ignition parameters. ---*/ - auto flame_init = config->GetFlameInit(); + auto flame_init = flamelet_config_options.flame_init; for (auto iDim = 0u; iDim < 3; ++iDim) { flame_offset[iDim] = flame_init[iDim]; flame_normal[iDim] = flame_init[3 + iDim]; @@ -179,11 +183,11 @@ void CSpeciesFlameletSolver::SetInitialCondition(CGeometry** geometry, CSolver** if (rank == MASTER_NODE) { cout << "initial condition: T = " << temp_inlet << endl; - for (auto iCV = 0u; iCV < config->GetNControlVars(); iCV++) { - const auto& cv_name = config->GetControllingVariableName(iCV); + for (auto iCV = 0u; iCV < flamelet_config_options.n_control_vars; iCV++) { + const auto& cv_name = flamelet_config_options.controlling_variable_names[iCV]; cout << "initial condition: " << cv_name << " = " << config->GetSpecies_Init()[iCV] << endl; } - switch (config->GetFlameletInitType()) { + switch (flamelet_config_options.ignition_method) { case FLAMELET_INIT_TYPE::FLAME_FRONT: cout << "Ignition with a straight flame front" << endl; break; @@ -214,12 +218,14 @@ void CSpeciesFlameletSolver::SetInitialCondition(CGeometry** geometry, CSolver** scalar_init[I_ENTH] = enth_inlet; prog_unburnt = config->GetSpecies_Init()[I_PROGVAR]; - prog_burnt = GetBurntProgressVariable(fluid_model_local, scalar_init); SU2_OMP_FOR_STAT(omp_chunk_size) for (unsigned long i_point = 0; i_point < nPoint; i_point++) { auto coords = geometry[i_mesh]->nodes->GetCoord(i_point); if (flame_front_ignition) { + + prog_burnt = GetBurntProgressVariable(fluid_model_local, scalar_init); + /*--- Determine if point is above or below the plane, assuming the normal is pointing towards the burned region. ---*/ point_loc = 0.0; @@ -258,7 +264,7 @@ void CSpeciesFlameletSolver::SetInitialCondition(CGeometry** geometry, CSolver** n_not_in_domain_local += fluid_model_local->GetExtrapolation(); /* --- Initialize the auxiliary transported scalars (not controlling variables). --- */ - for (int i_scalar = config->GetNControlVars(); i_scalar < config->GetNScalars(); ++i_scalar) { + for (int i_scalar = flamelet_config_options.n_control_vars; i_scalar < flamelet_config_options.n_scalars; ++i_scalar) { scalar_init[i_scalar] = config->GetSpecies_Init()[i_scalar]; } @@ -506,40 +512,40 @@ unsigned long CSpeciesFlameletSolver::SetScalarSources(const CConfig* config, CF unsigned long iPoint, const vector& scalars) { /*--- Compute total source terms from the production and consumption. ---*/ - vector table_sources(config->GetNControlVars() + 2 * config->GetNUserScalars()); + vector table_sources(flamelet_config_options.n_control_vars + 2 * flamelet_config_options.n_user_scalars); unsigned long misses = fluid_model_local->EvaluateDataSet(scalars, FLAMELET_LOOKUP_OPS::SOURCES, table_sources); table_sources[I_PROGVAR] = fmax(0, table_sources[I_PROGVAR]); nodes->SetTableMisses(iPoint, misses); /*--- The source term for progress variable is always positive, we clip from below to makes sure. --- */ - vector source_scalar(config->GetNScalars()); - for (auto iCV = 0u; iCV < config->GetNControlVars(); iCV++) source_scalar[iCV] = table_sources[iCV]; + vector source_scalar(flamelet_config_options.n_control_vars); + for (auto iCV = 0u; iCV < flamelet_config_options.n_control_vars; iCV++) source_scalar[iCV] = table_sources[iCV]; /*--- Source term for the auxiliary species transport equations. ---*/ - for (size_t i_aux = 0; i_aux < config->GetNUserScalars(); i_aux++) { + for (size_t i_aux = 0; i_aux < flamelet_config_options.n_user_scalars; i_aux++) { /*--- The source term for the auxiliary equations consists of a production term and a consumption term: S_TOT = S_PROD + S_CONS * Y ---*/ - su2double y_aux = scalars[config->GetNControlVars() + i_aux]; - su2double source_prod = table_sources[config->GetNControlVars() + 2 * i_aux]; - su2double source_cons = table_sources[config->GetNControlVars() + 2 * i_aux + 1]; - source_scalar[config->GetNControlVars() + i_aux] = source_prod + source_cons * y_aux; + su2double y_aux = scalars[flamelet_config_options.n_control_vars + i_aux]; + su2double source_prod = table_sources[flamelet_config_options.n_control_vars + 2 * i_aux]; + su2double source_cons = table_sources[flamelet_config_options.n_control_vars + 2 * i_aux + 1]; + source_scalar[flamelet_config_options.n_control_vars + i_aux] = source_prod + source_cons * y_aux; } for (auto i_scalar = 0u; i_scalar < nVar; i_scalar++) nodes->SetScalarSource(iPoint, i_scalar, source_scalar[i_scalar]); return misses; } -unsigned long CSpeciesFlameletSolver::SetScalarLookUps(const CConfig* config, CFluidModel* fluid_model_local, +unsigned long CSpeciesFlameletSolver::SetScalarLookUps(CFluidModel* fluid_model_local, unsigned long iPoint, const vector& scalars) { /*--- Retrieve the passive look-up variables from the manifold. ---*/ unsigned long misses{0}; /*--- Skip if no passive look-ups are listed ---*/ - if (config->GetNLookups() > 0) { - vector lookup_scalar(config->GetNLookups()); + if (flamelet_config_options.n_lookups > 0) { + vector lookup_scalar(flamelet_config_options.n_lookups); misses = fluid_model_local->EvaluateDataSet(scalars, FLAMELET_LOOKUP_OPS::LOOKUP, lookup_scalar); - for (auto i_lookup = 0u; i_lookup < config->GetNLookups(); i_lookup++) { + for (auto i_lookup = 0u; i_lookup < flamelet_config_options.n_lookups; i_lookup++) { nodes->SetLookupScalar(iPoint, lookup_scalar[i_lookup], i_lookup); } } @@ -547,8 +553,7 @@ unsigned long CSpeciesFlameletSolver::SetScalarLookUps(const CConfig* config, CF return misses; } -unsigned long CSpeciesFlameletSolver::SetPreferentialDiffusionScalars(const CConfig* config, - CFluidModel* fluid_model_local, +unsigned long CSpeciesFlameletSolver::SetPreferentialDiffusionScalars(CFluidModel* fluid_model_local, unsigned long iPoint, const vector& scalars) { /*--- Retrieve the preferential diffusion scalar values from the manifold. ---*/ @@ -566,7 +571,7 @@ void CSpeciesFlameletSolver::Viscous_Residual(const unsigned long iEdge, const C CNumerics* numerics, const CConfig* config) { /*--- Overloaded viscous residual method which accounts for preferential diffusion. ---*/ const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT), - PreferentialDiffusion = config->GetPreferentialDiffusion(); + PreferentialDiffusion = flamelet_config_options.preferential_diffusion; /*--- Points in edge ---*/ auto iPoint = geometry->edges->GetNode(iEdge, 0); @@ -592,7 +597,7 @@ void CSpeciesFlameletSolver::Viscous_Residual(const unsigned long iEdge, const C diff_coeff_beta_j[MAXNVAR] = {0}; // Number of active transport scalars - const auto n_CV = config->GetNControlVars(); + const auto n_CV = flamelet_config_options.n_control_vars; su2activematrix scalar_grad_i(MAXNVAR, MAXNDIM), scalar_grad_j(MAXNVAR, MAXNDIM); /*--- Looping over spatial dimensions to fill in the diffusion scalar gradients. ---*/ diff --git a/SU2_CFD/src/variables/CSpeciesFlameletVariable.cpp b/SU2_CFD/src/variables/CSpeciesFlameletVariable.cpp index 9b8d9b56212..d6d444ec934 100644 --- a/SU2_CFD/src/variables/CSpeciesFlameletVariable.cpp +++ b/SU2_CFD/src/variables/CSpeciesFlameletVariable.cpp @@ -49,12 +49,12 @@ CSpeciesFlameletVariable::CSpeciesFlameletVariable(const su2double* species_inf, Res_TruncError.resize(nPoint, nVar) = su2double(0.0); /* Allocate space for the source and scalars for visualization */ - - source_scalar.resize(nPoint, config->GetNScalars()) = su2double(0.0); - lookup_scalar.resize(nPoint, config->GetNLookups()) = su2double(0.0); + const auto flamelet_config_options = config->GetFlameletParsedOptions(); + source_scalar.resize(nPoint, flamelet_config_options.n_scalars) = su2double(0.0); + lookup_scalar.resize(nPoint, flamelet_config_options.n_lookups) = su2double(0.0); table_misses.resize(nPoint) = 0; - if (config->GetPreferentialDiffusion()) { + if (flamelet_config_options.preferential_diffusion) { AuxVar.resize(nPoint, FLAMELET_PREF_DIFF_SCALARS::N_BETA_TERMS) = su2double(0.0); Grad_AuxVar.resize(nPoint, FLAMELET_PREF_DIFF_SCALARS::N_BETA_TERMS, nDim, 0.0); } diff --git a/TestCases/nicf/datadriven/datadriven_nozzle.cfg b/TestCases/nicf/datadriven/datadriven_nozzle.cfg index 0e5326609f4..fb7c93c7ace 100644 --- a/TestCases/nicf/datadriven/datadriven_nozzle.cfg +++ b/TestCases/nicf/datadriven/datadriven_nozzle.cfg @@ -15,7 +15,7 @@ SOLVER= RANS KIND_TURB_MODEL= SST MATH_PROBLEM= DIRECT -RESTART_SOL= NO +RESTART_SOL= YES SYSTEM_MEASUREMENTS= SI % % -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% @@ -26,31 +26,36 @@ AOA= 0.0 SIDESLIP_ANGLE= 0.0 INIT_OPTION= TD_CONDITIONS FREESTREAM_OPTION= TEMPERATURE_FS -FREESTREAM_PRESSURE= 250000.0 +FREESTREAM_PRESSURE= 3361842.0 % -% Free-stream temperature (288.15 K, 518.67 R by default) -FREESTREAM_TEMPERATURE= 400.0 +FREESTREAM_TEMPERATURE= 189.288 FREESTREAM_DENSITY= 2.0 REF_DIMENSIONALIZATION= DIMENSIONAL % ---- DATADRIVEN FLUID MODEL DEFINITION -------% -% +% Use physics-informed neural network method. FLUID_MODEL = DATADRIVEN_FLUID INTERPOLATION_METHOD = MLP -FILENAMES_INTERPOLATOR = (MLP_air.mlp) -DATADRIVEN_NEWTON_RELAXATION = 0.8 +FILENAMES_INTERPOLATOR = (MLP_nitrogen.mlp) +USE_PINN= YES + +CONDUCTIVITY_MODEL=CONSTANT_PRANDTL +PRANDTL_LAM=0.8426621478074403 +PRANDTL_TURB=0.8426621478074403 % --------------------------- VISCOSITY MODEL ---------------------------------% VISCOSITY_MODEL= CONSTANT_VISCOSITY -MU_CONSTANT= 1.21409E-05 +MU_CONSTANT= 1.0998841148727364e-05 -% --------------------------- THERMAL CONDUCTIVITY MODEL ----------------------% -CONDUCTIVITY_MODEL= CONSTANT_CONDUCTIVITY -THERMAL_CONDUCTIVITY_CONSTANT= 0.030542828 % -------------------- BOUNDARY CONDITION DEFINITION --------------------------% -MARKER_SYM= ( SYMMETRY, WALL ) -MARKER_RIEMANN= ( INFLOW, TOTAL_CONDITIONS_PT, 904388, 542.13, 1.0, 0.0, 0.0, OUTFLOW, STATIC_PRESSURE, 200000.0, 0.0, 0.0, 0.0, 0.0 ) +MARKER_SYM= ( SYMMETRY ) +MARKER_HEATFLUX= (WALL, 0.0) +MARKER_RIEMANN= ( INFLOW, TOTAL_CONDITIONS_PT, 3361842.0, 189.288, 1.0, 0.0, 0.0, \ + OUTFLOW, STATIC_PRESSURE, 747076.0, 0.0, 0.0, 0.0, 0.0 ) + +RAMP_OUTLET_PRESSURE= NO +RAMP_OUTLET_PRESSURE_COEFF= (3361842.0, 1, 20) % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% NUM_METHOD_GRAD= GREEN_GAUSS @@ -73,8 +78,6 @@ LINEAR_SOLVER_ITER= 10 % -------------------------- MULTIGRID PARAMETERS -----------------------------% % -% Multi-grid levels (0 = no multi-grid) -MGLEVEL= 0 % -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% CONV_NUM_METHOD_FLOW= ROE @@ -89,7 +92,7 @@ CFL_REDUCTION_TURB= 1.0 % --------------------------- CONVERGENCE PARAMETERS --------------------------% % % Number of total iterations -ITER= 10 +ITER= 500 CONV_RESIDUAL_MINVAL= -24 CONV_STARTITER= 10 @@ -109,19 +112,19 @@ SOLUTION_FILENAME= solution_flow.dat TABULAR_FORMAT= CSV % % Output file convergence history (w/o extension) -CONV_FILENAME= history % % Output file restart flow RESTART_FILENAME= restart_flow.dat % % Output file flow (w/o extension) variables -VOLUME_FILENAME= flow +VOLUME_OUTPUT=(SOLUTION) % % Output file surface flow coefficient (w/o extension) SURFACE_FILENAME= surface_flow % % Writing solution file frequency OUTPUT_WRT_FREQ= 500 +OUTPUT_FILES=RESTART % % Screen output -SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_TKE, RMS_DISSIPATION, LIFT, DRAG) +SCREEN_OUTPUT= (INNER_ITER, RMS_RES) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 530328b52a6..23260a04f8e 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1066,7 +1066,7 @@ def main(): datadriven_fluidModel.cfg_dir = "nicf/datadriven" datadriven_fluidModel.cfg_file = "datadriven_nozzle.cfg" datadriven_fluidModel.test_iter = 50 - datadriven_fluidModel.test_vals = [-2.632817, 0.155922, 4.690917, 0.000000, 0.000000] + datadriven_fluidModel.test_vals = [-5.506499, -3.447247, -3.859876, -1.251899, -2.140268, 1.267121] test_list.append(datadriven_fluidModel) ###################################### diff --git a/UnitTests/SU2_CFD/fluid/CFluidModel_tests.cpp b/UnitTests/SU2_CFD/fluid/CFluidModel_tests.cpp new file mode 100644 index 00000000000..c0d18f54a1c --- /dev/null +++ b/UnitTests/SU2_CFD/fluid/CFluidModel_tests.cpp @@ -0,0 +1,125 @@ +/*! + * \file CFluidModel_tests.cpp + * \brief Unit tests for the fluid model classes. + * \author E.Bunschoten + * \version 8.1.0 "Harrier" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2024, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "catch.hpp" +#include +#include "../../../SU2_CFD/include/fluid/CFluidModel.hpp" +#include "../../../SU2_CFD/include/fluid/CIdealGas.hpp" +#include "../../../SU2_CFD/include/fluid/CDataDrivenFluid.hpp" + +void FluidModelChecks(CFluidModel * fluid_model, const su2double val_p, const su2double val_T) { + + /*--- Check consistency of reverse look-up ---*/ + { + fluid_model->SetTDState_PT(val_p, val_T); + + const su2double val_rho_fluidmodel = fluid_model->GetDensity(); + const su2double val_e_fluidmodel = fluid_model->GetStaticEnergy(); + + fluid_model->SetTDState_rhoe(val_rho_fluidmodel, val_e_fluidmodel); + CHECK(Approx(fluid_model->GetPressure()) == val_p); + CHECK(Approx(fluid_model->GetTemperature()) == val_T); + } + /*--- Check internal consistency between primary and derived fluid properties ---*/ + fluid_model->SetTDState_PT(val_p, val_T); + const su2double val_rho = fluid_model->GetDensity(); + const su2double val_e = fluid_model->GetStaticEnergy(); + + const su2double dTdrho_e = fluid_model->GetdTdrho_e(); + const su2double dPdrho_e = fluid_model->GetdPdrho_e(); + const su2double dTde_rho = fluid_model->GetdTde_rho(); + const su2double dPde_rho= fluid_model->GetdPde_rho(); + + su2double delta_rho = 1e-2, delta_e = 100.0; + { + fluid_model->SetTDState_rhoe(val_rho+delta_rho, val_e); + const su2double T_plus = fluid_model->GetTemperature(); + const su2double p_plus = fluid_model->GetPressure(); + + fluid_model->SetTDState_rhoe(val_rho-delta_rho, val_e); + const su2double T_minus = fluid_model->GetTemperature(); + const su2double p_minus = fluid_model->GetPressure(); + const su2double dTdrho_e_FD = (T_plus - T_minus)/(2*delta_rho); + const su2double dPdrho_e_FD = (p_plus - p_minus)/(2*delta_rho); + + CHECK(dTdrho_e == Approx(dTdrho_e_FD)); + CHECK(dPdrho_e == Approx(dPdrho_e_FD)); + } + { + fluid_model->SetTDState_rhoe(val_rho, val_e + delta_e); + const su2double T_plus = fluid_model->GetTemperature(); + const su2double p_plus = fluid_model->GetPressure(); + + fluid_model->SetTDState_rhoe(val_rho, val_e - delta_e); + const su2double T_minus = fluid_model->GetTemperature(); + const su2double p_minus = fluid_model->GetPressure(); + const su2double dTde_rho_FD = (T_plus - T_minus)/(2*delta_e); + const su2double dPde_rho_FD = (p_plus - p_minus)/(2*delta_e); + + CHECK(dTde_rho == Approx(dTde_rho_FD)); + CHECK(dPde_rho == Approx(dPde_rho_FD)); + } +} + +TEST_CASE("Test case for ideal gas fluid model") { + + CIdealGas * fluid_model = new CIdealGas(1.4, 287.0); + + FluidModelChecks(fluid_model, 101325, 300.0); + FluidModelChecks(fluid_model, 1e6, 600.0); + + delete fluid_model; +} + +TEST_CASE("Test case for data-driven fluid model") { + std::stringstream config_options; + + config_options << "SOLVER=RANS" << std::endl; + config_options<<"KIND_TURB_MODEL=SA"< + +[number of layers] +4 + +[neurons per layer] +2 +12 +12 +1 + +[activation function] +linear +exponential +exponential +linear + +[input names] +Density +Energy + +[input regularization method] +minmax + +[input normalization] ++1.0000000000002272e-01 +3.6000000000001620e+02 ++2.4999999999999913e+05 +5.5000000000000407e+05 + +[output names] +s + +[output regularization method] +minmax + +[output normalization] ++6.5239076364026619e+02 +1.5203988895015702e+03 + + + +[weights per layer] + +-2.2636230520308294e+00 -1.4376163759051570e+02 -1.8210265085365642e+00 -1.9392431999968291e+01 +7.7998972848161929e-01 -4.4451402056377132e-01 +1.1480586943782076e+00 +7.3911541657373481e-01 +6.6848364842168884e-01 -1.8271554443848029e+01 +1.2261285194926941e+00 -1.4498105832610020e+00 +-3.5792276167311754e-01 -4.6660012868153460e-02 +8.6960980388545261e-01 -3.3067252427727123e-01 +7.2901181049513930e-01 -4.5132436983111057e-01 -1.6721101091715045e+00 +1.6381708561036443e-01 -9.9953810361650641e-01 -1.6660397867362475e+00 -3.6845287976534608e-01 +3.2679042214120246e-01 + + ++5.9993107069789275e-01 -3.7968611358916876e-01 -9.1784196873856094e-01 +3.7697075096981791e-01 -2.4514594732936050e+00 -2.9404244326707329e-01 -9.4877021231483852e-02 -3.3980372028224931e-02 +4.2421189400580528e-01 +7.7781137867976824e-01 +7.8391084779202980e-02 -1.8389416804610961e+00 +-2.5408281524798354e-01 +9.0756663051344069e-03 +1.1584753496996323e+00 +2.3534308868577432e-03 +2.4490086543179976e+00 +5.5043198360778117e-02 +7.1243387886788068e-01 -1.3472356985325758e-02 -1.6022336815491792e-01 +7.9384957177751261e-03 -8.3913484678289282e-02 -5.0208325332694126e-01 +-1.3231543644220687e+00 +2.3890465005266312e-01 -2.7829788154280122e+00 -4.1684736117099767e-02 -1.7289853140913009e-01 -2.7452124285237439e-01 +1.9057689172006617e-01 -4.8499148958861135e-02 -1.5998171284591250e-01 -3.8444057771255657e-01 -1.7591798029573689e+00 -3.1998700856829099e-01 +-3.4460543761346853e+00 +2.8269088892223054e-01 -1.8007009126606924e-01 -1.8194428084477665e-01 -9.8097976562849054e-01 +2.2343131530917884e+00 -9.3480765212571959e-01 -2.1820922470878051e-01 +2.4998489167470859e+00 -9.2764413588769656e-01 +4.2116280346986166e+00 +5.7430289000882420e+00 +-1.3779943339666223e-01 +5.1527341679864391e-01 -2.0684081713014844e+00 -4.6713867186704139e-01 -1.6656574393452730e+00 +8.2916484143979841e-02 -6.2985392912561127e-03 -8.0554067455084744e-01 +1.5050572815527488e-01 -3.0403633272013114e-01 +9.3661086475363739e-02 -1.7366620874413785e-01 ++1.2102271004943301e+00 -1.4795362440831727e-01 -7.7934495467562570e-01 -5.9581359297919689e-01 -2.5799123516309956e+00 -4.2086823260415152e-01 -6.1754592301131395e-01 +5.3496586769756471e-01 -1.1988742301845021e+00 -1.1825507727456516e-01 -1.2989806049860451e+00 -1.5082167140110778e+00 +-1.5832999264655581e+00 -5.0541334265413407e-01 -1.2224436375090135e+00 +9.4464382557138807e-02 -7.7094226591729909e-01 -1.3308898524504738e+00 -5.6071570095690060e-01 -1.1808627032633583e-01 -6.8406003004295413e-01 -1.0851498125792971e+00 -1.6619882623877327e+00 +3.3905033683843949e-01 +-1.6613583604241693e+00 -4.7389354240091253e-01 -1.6404302611149377e+00 +5.6328884449292083e-01 -2.3886973163682126e+00 +6.3182847097032660e-02 -1.1988633757241718e+00 -1.0449760622285645e-01 -5.0007576677205112e-01 -5.7953124309145942e-01 +1.3744226228525147e-01 -5.2406676771136440e-01 +-5.2321502793378249e-01 -5.3150359391312596e-01 -8.2608918128172837e-01 -1.5179873908573804e+00 -1.3741534704444816e+00 -1.1396125599060034e+00 -2.4669798409655488e-01 +3.5463486969786873e-01 -1.4557579529418466e-01 +3.9772638519145487e-01 -7.3761409583500159e-01 +4.3638838398439539e-01 ++1.1339107378860229e+00 +1.7594521224843396e-01 -2.3113519941138065e+00 -1.6298684024567350e-01 +2.1654392231781072e+00 +1.1946181086317720e+00 +6.1504990167411666e-01 +3.5812470374750952e-02 +4.7359603213749768e-01 -1.3926908147980210e-01 +1.5092490082960155e+00 +6.2527693075989743e-01 +-1.8730091080176507e+00 +6.0253144933079306e-01 -8.4799895628536026e-01 -4.9738323769072662e-01 -2.7954591059886620e+00 -6.0772894919752340e-01 -1.6669559186193763e+00 +3.2575755465661199e-01 -6.3810153137096781e-01 -1.5742470796026808e+00 +4.0723523279497037e-01 -2.6629855030791610e-01 ++9.5260226581936475e-02 +1.3178352071446142e-01 -8.2706051782881629e-01 +4.3476689449955158e-01 -1.9510329069314138e+00 -6.1816074212742961e-02 -8.8250388388085288e-01 -3.9491669828062620e-01 -1.5457029407527009e-01 -8.1118953547083511e-02 -9.3695252718016830e-01 -7.2928015955932368e-01 + + +-1.1729556416685407e+00 ++6.5203789113121413e-01 +-1.8734538612518090e-01 ++2.1621137726863668e-01 ++5.6641315509463920e-03 ++2.0302117964378608e-01 ++8.4775779057667755e-02 +-3.0580176253474467e-01 ++3.0269028189313296e-01 ++5.6045172511572938e-01 +-1.2871102614766081e-01 +-1.2950131608167472e+00 + + +[biases per layer] ++0.0000000000000000e+00 +0.0000000000000000e+00 ++1.1016481462000773e+00 +2.3664012769409184e+00 -9.4722828005676618e-01 +2.9514075029104910e-02 -7.7331761508748165e-01 +7.3249514271738470e-01 +2.5926140499409794e-01 +8.9008692454169913e-01 +5.0307216362067246e-02 +5.9255316881972364e-01 -2.0202744615666726e-01 -4.3866869529767016e-01 ++3.7843782710203738e-01 +1.6775822623352205e-01 -6.9759335447123827e-01 -4.0155126735738134e-01 -2.5582386039767488e+00 -4.7188519950683777e-01 -7.9682095244914830e-01 -7.9066710997409528e-02 -6.3882846975992846e-01 -4.3560525651855958e-01 -1.3131160733413525e+00 -8.0222167363936081e-01 ++3.4454053855686528e-01 diff --git a/meson_scripts/init.py b/meson_scripts/init.py index 67a2e41a2ec..f8f2cdecc9d 100755 --- a/meson_scripts/init.py +++ b/meson_scripts/init.py @@ -74,7 +74,7 @@ def init_submodules( github_repo_mel = "https://github.com/pcarruscag/MEL" sha_version_fado = "ce7ee018e4e699af5028d69baa1939fea290e18a" github_repo_fado = "https://github.com/pcarruscag/FADO" - sha_version_mlpcpp = "6865a58b22f21a92977839d9c93eae9522402f55" + sha_version_mlpcpp = "e19ca0cafb28c4b7ba5b8cffef42883259b00dc0" github_repo_mlpcpp = "https://github.com/EvertBunschoten/MLPCpp" medi_name = "MeDiPack" diff --git a/subprojects/MLPCpp b/subprojects/MLPCpp index 6865a58b22f..e19ca0cafb2 160000 --- a/subprojects/MLPCpp +++ b/subprojects/MLPCpp @@ -1 +1 @@ -Subproject commit 6865a58b22f21a92977839d9c93eae9522402f55 +Subproject commit e19ca0cafb28c4b7ba5b8cffef42883259b00dc0