diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 76545cdb2747..0bb7110fd971 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -26,13 +26,13 @@ jobs: config_set: [BaseMPI, ReverseMPI, ForwardMPI, BaseNoMPI, ReverseNoMPI, ForwardNoMPI, BaseOMP, ReverseOMP, ForwardOMP] include: - config_set: BaseMPI - flags: '-Denable-pywrapper=true -Denable-coolprop=true -Denable-tests=true --warnlevel=2 --werror' + flags: '-Denable-pywrapper=true -Denable-coolprop=true -Denable-mlpcpp=true -Denable-tests=true --warnlevel=2 --werror' - config_set: ReverseMPI flags: '-Denable-autodiff=true -Denable-normal=false -Denable-pywrapper=true -Denable-tests=true --warnlevel=3 --werror' - config_set: ForwardMPI flags: '-Denable-directdiff=true -Denable-normal=false -Denable-tests=true --warnlevel=3 --werror' - config_set: BaseNoMPI - flags: '-Denable-pywrapper=true -Denable-openblas=true -Dwith-mpi=disabled -Denable-tests=true --warnlevel=3 --werror' + flags: '-Denable-pywrapper=true -Denable-openblas=true -Dwith-mpi=disabled -Denable-mlpcpp=true -Denable-tests=true --warnlevel=3 --werror' - config_set: ReverseNoMPI flags: '-Denable-autodiff=true -Denable-normal=false -Dwith-mpi=disabled -Denable-pywrapper=true -Denable-tests=true --warnlevel=3 --werror' - config_set: ForwardNoMPI diff --git a/.gitmodules b/.gitmodules index c7e70424d907..2c655cb36da3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -24,3 +24,6 @@ [submodule "externals/mel"] path = externals/mel url = https://github.com/pcarruscag/MEL.git +[submodule "subprojects/MLPCpp"] + path = subprojects/MLPCpp + url = https://github.com/EvertBunschoten/MLPCpp.git diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index 54e00341482f..39ebcf28c011 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -519,7 +519,12 @@ class CConfig { Kind_TimeIntScheme_AdjTurb, /*!< \brief Time integration for the adjoint turbulence model. */ Kind_TimeIntScheme_Species, /*!< \brief Time integration for the species model. */ Kind_TimeIntScheme_Heat, /*!< \brief Time integration for the wave equations. */ - Kind_TimeStep_Heat; /*!< \brief Time stepping method for the (fvm) heat equation. */ + 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. */ + 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. */ unsigned short @@ -800,7 +805,8 @@ 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. */ + ObjFunc_Hess_FileName, /*!< \brief Hessian approximation obtained by the Sobolev smoothing solver. */ + *DataDriven_Method_FileNames; /*!< \brief Dataset information for data-driven fluid models. */ bool Wrt_Performance, /*!< \brief Write the performance summary at the end of a calculation. */ @@ -3844,6 +3850,29 @@ 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. */ diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 8baa2e319012..7e5aa1727def 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -548,6 +548,7 @@ enum ENUM_FLUIDMODEL { FLUID_MIXTURE = 9, /*!< \brief Species mixture model. */ COOLPROP = 10, /*!< \brief Thermodynamics library. */ FLUID_FLAMELET = 11, /*!< \brief lookup table (LUT) method for premixed flamelets. */ + DATADRIVEN_FLUID = 12, /*!< \brief multi-layer perceptron driven fluid model. */ }; static const MapType FluidModel_Map = { MakePair("STANDARD_AIR", STANDARD_AIR) @@ -561,6 +562,7 @@ static const MapType FluidModel_Map = { MakePair("SU2_NONEQ", SU2_NONEQ) MakePair("FLUID_MIXTURE", FLUID_MIXTURE) MakePair("COOLPROP", COOLPROP) + MakePair("DATADRIVEN_FLUID", DATADRIVEN_FLUID) MakePair("FLUID_FLAMELET", FLUID_FLAMELET) }; @@ -590,6 +592,19 @@ MakePair("ARGON-SID",ARGON_SID) MakePair("ONESPECIES", ONESPECIES) }; +/*! +* \brief Types of interpolation methods for data-driven fluid models. +*/ +enum class ENUM_DATADRIVEN_METHOD { + LUT = 0, + MLP = 1 +}; + +static const MapType DataDrivenMethod_Map = { + MakePair("LUT", ENUM_DATADRIVEN_METHOD::LUT) + MakePair("MLP", ENUM_DATADRIVEN_METHOD::MLP) +}; + /*! * \brief types of coefficient transport model */ diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index ace96e28cbb5..b5cd0ba2fa95 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -1169,6 +1169,14 @@ void CConfig::SetConfig_Options() { /*!\brief FLUID_NAME \n DESCRIPTION: Fluid name \n OPTIONS: see coolprop homepage \n DEFAULT: nitrogen \ingroup Config*/ addStringOption("FLUID_NAME", FluidName, string("nitrogen")); + /*!\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); + /*!\brief FILENAME_INTERPOLATOR \n DESCRIPTION: Input file for the interpolation method. \n \ingroup Config*/ + addStringListOption("FILENAMES_INTERPOLATOR", n_Datadriven_files, DataDriven_Method_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); + /*!\brief CONFINEMENT_PARAM \n DESCRIPTION: Input Confinement Parameter for Vorticity Confinement*/ addDoubleOption("CONFINEMENT_PARAM", Confinement_Param, 0.0); @@ -4967,6 +4975,11 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i } } + /*--- Data-driven fluid model is currently only supported for compressible flow problems. ---*/ + if ((Kind_Solver == MAIN_SOLVER::INC_EULER || Kind_Solver == MAIN_SOLVER::INC_NAVIER_STOKES || Kind_Solver == MAIN_SOLVER::INC_RANS) && (Kind_FluidModel == DATADRIVEN_FLUID)) { + SU2_MPI::Error("Data-driven fluid model can only be used for compressible flows.", CURRENT_FUNCTION); + } + if ((Kind_Solver == MAIN_SOLVER::INC_EULER || Kind_Solver == MAIN_SOLVER::INC_NAVIER_STOKES || Kind_Solver == MAIN_SOLVER::INC_RANS) && (Kind_FluidModel == INC_IDEAL_GAS_POLY)) { su2double sum = 0.0; for (unsigned short iVar = 0; iVar < N_POLY_COEFFS; iVar++) { diff --git a/Docs/docmain.hpp b/Docs/docmain.hpp index ab8b45fa8ec3..fcda1b961ece 100644 --- a/Docs/docmain.hpp +++ b/Docs/docmain.hpp @@ -225,3 +225,9 @@ * \brief Classes for explicit (done by the programmer) vectorization (SIMD) of computations. * \ingroup Toolboxes */ + +/*! + * \defgroup Multi-Layer Perceptrons (MLP) + * \brief Data look up and interpolation via dense, feed-forward multi-layer perceptrons. + * \ingroup Toolboxes + */ diff --git a/SU2_CFD/include/fluid/CDataDrivenFluid.hpp b/SU2_CFD/include/fluid/CDataDrivenFluid.hpp new file mode 100644 index 000000000000..ddf33ba96412 --- /dev/null +++ b/SU2_CFD/include/fluid/CDataDrivenFluid.hpp @@ -0,0 +1,220 @@ +/*! + * \file CDataDrivenFluid.hpp + * \brief Defines a template fluid model class using multilayer perceptrons + * for theromodynamic state definition + * \author E.C.Bunschoten + * \version 7.5.1 "Blackbird" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2023, 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 . + */ + +#pragma once + +#include +#include "../../../Common/include/containers/CLookUpTable.hpp" +#if defined(HAVE_MLPCPP) +#define MLP_CUSTOM_TYPE su2double +#include "../../../subprojects/MLPCpp/include/CLookUp_ANN.hpp" +#define USE_MLPCPP +#endif +#include "CFluidModel.hpp" + +/*! + * \class CDataDrivenFluid + * \brief Template class for fluid model definition using multi-layer perceptrons for + * fluid dynamic state definition. + * \author: E.C.Bunschoten. + */ +class CDataDrivenFluid final : public CFluidModel { + protected: + int rank{MASTER_NODE}; /*!< \brief MPI Rank. */ + ENUM_DATADRIVEN_METHOD Kind_DataDriven_Method = + ENUM_DATADRIVEN_METHOD::LUT; /*!< \brief Interpolation method for data set evaluation. */ + + string varname_rho, /*!< \brief Controlling variable name for density. */ + varname_e; /*!< \brief Controlling variable name for static energy. */ + + size_t idx_rho, /*!< \brief Interpolator index for density input. */ + idx_e; /*!< \brief Interpolator index for energy input. */ + + su2double Newton_Relaxation, /*!< \brief Relaxation factor for Newton solvers. */ + rho_start, /*!< \brief Starting value for the density in Newton solver processes. */ + e_start, /*!< \brief Starting value for the energy in Newton solver processes. */ + Newton_Tolerance, /*!< \brief Normalized tolerance for Newton solvers. */ + 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. */ + + unsigned long MaxIter_Newton; /*!< \brief Maximum number of iterations for Newton solvers. */ + + su2double dsde_rho, /*!< \brief Entropy derivative w.r.t. density. */ + dsdrho_e, /*!< \brief Entropy derivative w.r.t. static energy. */ + d2sde2, /*!< \brief Entropy second derivative w.r.t. static energy. */ + d2sdedrho, /*!< \brief Entropy second derivative w.r.t. density and static energy. */ + d2sdrho2; /*!< \brief Entropy second derivative w.r.t. static density. */ + + su2double R_idealgas, /*!< \brief Approximated ideal gas constant. */ + Cp_idealgas, /*!< \brief Approximated ideal gas specific heat at constant pressure. */ + gamma_idealgas, /*!< \brief Approximated ideal gas specific heat ratio. */ + Cv_idealgas, /*!< \brief Approximated ideal gas specific heat at constant volume. */ + 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 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. */ + + vector input_names_rhoe, /*!< \brief Data-driven method input variable names of the independent variables + (density, energy). */ + output_names_rhoe; /*!< \brief Output variable names listed in the data-driven method input file name. */ + + vector outputs_rhoe; /*!< \brief Pointers to output variables. */ + + /*--- Class variables for the multi-layer perceptron method ---*/ +#ifdef USE_MLPCPP + MLPToolbox::CLookUp_ANN* lookup_mlp; /*!< \brief Multi-layer perceptron collection. */ + MLPToolbox::CIOMap* iomap_rhoe; /*!< \brief Input-output map. */ +#endif + vector MLP_inputs; /*!< \brief Inputs for the multi-layer perceptron look-up operation. */ + + CLookUpTable* lookup_table; /*!< \brief Look-up table regression object. */ + + unsigned long outside_dataset, /*!< \brief Density-energy combination lies outside data set. */ + nIter_Newton; /*!< \brief Number of Newton solver iterations. */ + + /*! + * \brief Map dataset variables to specific look-up operations. + */ + void MapInputs_to_Outputs(); + + /*! + * \brief Evaluate dataset through multi-layer perceptron. + * \param[in] rho - Density value. + * \param[in] e - Static energy value. + * \return Query point lies outside MLP normalization range (0 is inside, 1 is outside). + */ + unsigned long Predict_MLP(su2double rho, su2double e); + + /*! + * \brief Evaluate dataset through look-up table. + * \param[in] rho - Density value. + * \param[in] e - Static energy value. + * \return Query point lies outside table data range (0 is inside, 1 is outside). + */ + unsigned long Predict_LUT(su2double rho, su2double e); + + /*! + * \brief Evaluate the data set. + * \param[in] rho - Density value. + * \param[in] e - Static energy value. + */ + void Evaluate_Dataset(su2double rho, su2double e); + + /*! + * \brief 2D Newton solver for computing the density and energy corresponding to Y1_target and Y2_target. + * \param[in] Y1_target - Target value for output quantity 1. + * \param[in] Y2_target - Target value for output quantity 2. + * \param[in] Y1 - Pointer to output quantity 1. + * \param[in] Y2 - Pointer to output quantity 2. + * \param[in] dY1drho - Pointer to the partial derivative of quantity 1 w.r.t. density at constant energy. + * \param[in] dY1de - Pointer to the partial derivative of quantity 1 w.r.t. energy at constant density. + * \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); + + /*! + * \brief 1D Newton solver for computing the density or energy corresponding to Y_target. + * \param[in] Y_target - Target quantity value. + * \param[in] Y - Pointer to output quantity. + * \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 ComputeIdealGasQuantities(); + public: + /*! + * \brief Constructor of the class. + */ + CDataDrivenFluid(const CConfig* config, bool display = true); + + ~CDataDrivenFluid(); + /*! + * \brief Set the Dimensionless State using Density and Internal Energy. + * \param[in] rho - first thermodynamic variable (density). + * \param[in] e - second thermodynamic variable (static energy). + */ + void SetTDState_rhoe(su2double rho, su2double e) override; + + /*! + * \brief Set the Dimensionless State using Pressure and Temperature. + * \param[in] P - first thermodynamic variable (pressure). + * \param[in] T - second thermodynamic variable (temperature). + */ + void SetTDState_PT(su2double P, su2double T) override; + + /*! + * \brief Set the Dimensionless State using Pressure and Density. + * \param[in] P - first thermodynamic variable (pressure). + * \param[in] rho - second thermodynamic variable (density). + */ + void SetTDState_Prho(su2double P, su2double rho) override; + + /*! + * \brief Set the Dimensionless Internal Energy using Pressure and Density. + * \param[in] P - first thermodynamic variable (pressure). + * \param[in] rho - second thermodynamic variable (density). + */ + void SetEnergy_Prho(su2double P, su2double rho) override; + + /*! + * \brief Set the Dimensionless Internal Energy using Pressure and Density. + * \param[in] rho - second thermodynamic variable (density). + */ + void SetTDState_rhoT(su2double rho, su2double T) override; + + /*! + * \brief Set the Dimensionless State using Enthalpy and Entropy. + * \param[in] h - first thermodynamic variable (h). + * \param[in] s - second thermodynamic variable (s). + */ + void SetTDState_hs(su2double h, su2double s) override; + + /*! + * \brief Set the Dimensionless State using Pressure and Entropy. + * \param[in] P - first thermodynamic variable (P). + * \param[in] s - second thermodynamic variable (s). + */ + void SetTDState_Ps(su2double P, su2double s) override; + + /*! + * \brief Get fluid model extrapolation instance. + * \return Query point lies outside fluid model data range. + */ + unsigned long GetExtrapolation() override { return outside_dataset; } + + /*! + * \brief Get number of Newton solver iterations. + * \return Newton solver iteration count at termination. + */ + unsigned long GetnIter_Newton() override { return nIter_Newton; } +}; diff --git a/SU2_CFD/include/fluid/CFluidModel.hpp b/SU2_CFD/include/fluid/CFluidModel.hpp index 5e3785bcda15..fae2d9003479 100644 --- a/SU2_CFD/include/fluid/CFluidModel.hpp +++ b/SU2_CFD/include/fluid/CFluidModel.hpp @@ -344,4 +344,16 @@ class CFluidModel { * \brief Set fluid eddy viscosity provided by a turbulence model needed for computing effective thermal conductivity. */ void SetEddyViscosity(su2double val_Mu_Turb) { Mu_Turb = val_Mu_Turb; } + + /*! + * \brief Get fluid model extrapolation instance + * \return Query point lies outside fluid model data range. + */ + virtual unsigned long GetExtrapolation() { return 0; } + + /*! + * \brief Get number of Newton solver iterations. + * \return Newton solver iteration count at termination. + */ + virtual unsigned long GetnIter_Newton() { return 0; } }; diff --git a/SU2_CFD/include/variables/CEulerVariable.hpp b/SU2_CFD/include/variables/CEulerVariable.hpp index 43641a27199f..9f4fef32a82c 100644 --- a/SU2_CFD/include/variables/CEulerVariable.hpp +++ b/SU2_CFD/include/variables/CEulerVariable.hpp @@ -73,6 +73,11 @@ class CEulerVariable : public CFlowVariable { MatrixType WindGust; /*! < \brief Wind gust value */ + bool DataDrivenFluid = false; /*!< \brief Usage of data-driven fluid model. DatasetExtrapolation and FluidEntropy will not be sized if disabled. */ + su2vector DatasetExtrapolation; /*!< \brief Stores instances of dataset bounds violation when using data-driven fluid models. */ + su2vector NIterNewtonsolver; /*!< \brief Stores number of Newton solver iterations when using data-driven fluid models. */ + VectorType FluidEntropy; /*!< \brief Stores the fluid entropy value as computed by the data-driven fluid model. */ + public: /*! * \brief Constructor of the class. @@ -293,4 +298,48 @@ class CEulerVariable : public CFlowVariable { for (unsigned long iDim = 0; iDim < nDim; iDim++) Solution(iPoint, iDim+1) = GetDensity(iPoint) * val_vector[iDim]; } + /*! + * \brief Set fluid entropy + * \param[in] iPoint - Node index + * \param[in] entropy - fluid entropy value. + */ + inline void SetEntropy(unsigned long iPoint, su2double entropy) final { FluidEntropy[iPoint] = entropy; }; + + /*! + * \brief Get fluid entropy + * \param[in] iPoint - Node index + * \return Entropy - Fluid entropy value + */ + inline su2double GetEntropy(unsigned long iPoint) const final { return FluidEntropy[iPoint]; } + + /*! + * \brief Set dataset extrapolation instance + * \param[in] iPoint - Node index + * \param[in] extrapolation - Extrapolation instance (0 = within dataset, 1 = outside dataset) + */ + inline void SetDataExtrapolation(unsigned long iPoint, unsigned short extrapolation) final { + DatasetExtrapolation[iPoint] = extrapolation; + }; + + /*! + * \brief Get dataset extrapolation instance + * \param[in] iPoint - Node index + * \return extrapolation - Extrapolation instance (0 = within dataset, 1 = outside dataset) + */ + inline unsigned short GetDataExtrapolation(unsigned long iPoint) const final { return DatasetExtrapolation[iPoint]; } + + /*! + * \brief Set the number of iterations required by a Newton solver used by the fluid model. + * \param[in] iPoint - Node index + * \param[in] nIter - Number of iterations evaluated by the Newton solver + */ + inline void SetNewtonSolverIterations(unsigned long iPoint, unsigned long nIter) final { NIterNewtonsolver[iPoint] = nIter; } + + /*! + * \brief Get the number of iterations required by a Newton solver used by the fluid model. + * \param[in] iPoint - Node index + * \return Number of iterations evaluated by the Newton solver + */ + inline unsigned long GetNewtonSolverIterations(unsigned long iPoint) const final { return NIterNewtonsolver[iPoint]; } + }; diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index a1c89d5a4145..ec2557c8088a 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -2284,6 +2284,48 @@ class CVariable { virtual su2double GetSourceTerm_DispAdjoint(unsigned long iPoint, unsigned long iDim) const { return 0.0; } virtual su2double GetSourceTerm_VelAdjoint(unsigned long iPoint, unsigned long iDim) const { return 0.0; } + /*! + * \brief Set fluid entropy + * \param[in] iPoint - Node index + * \param[in] entropy - fluid entropy value. + */ + inline virtual void SetEntropy(unsigned long iPoint, su2double entropy) { }; + + /*! + * \brief Get fluid entropy + * \param[in] iPoint - Node index + * \return Entropy - Fluid entropy value + */ + inline virtual su2double GetEntropy(unsigned long iPoint) const { return 0; } + + /*! + * \brief Set dataset extrapolation instance + * \param[in] iPoint - Node index + * \param[in] extrapolation - Extrapolation instance (0 = within dataset, 1 = outside dataset) + */ + inline virtual void SetDataExtrapolation(unsigned long iPoint, unsigned short extrapolation) { }; + + /*! + * \brief Get dataset extrapolation instance + * \param[in] iPoint - Node index + * \return extrapolation - Extrapolation instance (0 = within dataset, 1 = outside dataset) + */ + inline virtual unsigned short GetDataExtrapolation(unsigned long iPoint) const { return 0; } + + /*! + * \brief Set the number of iterations required by a Newton solver used by the fluid model. + * \param[in] iPoint - Node index + * \param[in] nIter - Number of iterations evaluated by the Newton solver + */ + inline virtual void SetNewtonSolverIterations(unsigned long iPoint, unsigned long nIter) { } + + /*! + * \brief Get the number of iterations required by a Newton solver used by the fluid model. + * \param[in] iPoint - Node index + * \return Number of iterations evaluated by the Newton solver + */ + inline virtual unsigned long GetNewtonSolverIterations(unsigned long iPoint) const { return 0; } + /*! * \brief LUT premixed flamelet: virtual functions for the speciesflameletvariable LUT */ diff --git a/SU2_CFD/src/fluid/CDataDrivenFluid.cpp b/SU2_CFD/src/fluid/CDataDrivenFluid.cpp new file mode 100644 index 000000000000..a53601b7f5c2 --- /dev/null +++ b/SU2_CFD/src/fluid/CDataDrivenFluid.cpp @@ -0,0 +1,383 @@ +/*! + * \file CDataDrivenFluid.cpp + * \brief Source of the data-driven fluid model class + * \author E.C.Bunschoten M.Mayer A.Capiello + * \version 7.5.1 "Blackbird" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2023, 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 "../../include/fluid/CDataDrivenFluid.hpp" +#if defined(HAVE_MLPCPP) +#include "../../../subprojects/MLPCpp/include/CLookUp_ANN.hpp" +#define USE_MLPCPP +#endif + +CDataDrivenFluid::CDataDrivenFluid(const CConfig* config, bool display) : CFluidModel() { + rank = SU2_MPI::GetRank(); + Kind_DataDriven_Method = config->GetKind_DataDriven_Method(); + + varname_rho = "Density"; + varname_e = "Energy"; + + /*--- 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()); + 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); + break; + default: + break; + } + + /*--- Relaxation factor and tolerance for Newton solvers. ---*/ + Newton_Relaxation = config->GetRelaxation_DataDriven(); + Newton_Tolerance = 1e-10; + MaxIter_Newton = 50; + + /*--- Preprocessing of inputs and outputs for the interpolation method. ---*/ + MapInputs_to_Outputs(); + + /*--- Compute approximate ideal gas properties ---*/ + ComputeIdealGasQuantities(); +} + +CDataDrivenFluid::~CDataDrivenFluid() { + switch (Kind_DataDriven_Method) { + case ENUM_DATADRIVEN_METHOD::MLP: +#ifdef USE_MLPCPP + delete iomap_rhoe; + delete lookup_mlp; +#endif + break; + case ENUM_DATADRIVEN_METHOD::LUT: + delete lookup_table; + break; + default: + break; + } +} +void CDataDrivenFluid::MapInputs_to_Outputs() { + /*--- Inputs of the data-driven method are density and internal energy. ---*/ + input_names_rhoe.resize(2); + idx_rho = 0; + idx_e = 1; + input_names_rhoe[idx_rho] = varname_rho; + input_names_rhoe[idx_e] = varname_e; + + /*--- 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; + + /*--- Further preprocessing of input and output variables. ---*/ + if (Kind_DataDriven_Method == ENUM_DATADRIVEN_METHOD::MLP) { +/*--- Map MLP inputs to outputs. ---*/ +#ifdef USE_MLPCPP + iomap_rhoe = new MLPToolbox::CIOMap(input_names_rhoe, output_names_rhoe); + lookup_mlp->PairVariableswithMLPs(*iomap_rhoe); + MLP_inputs.resize(2); +#endif + } +} + +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)); + + 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); + + SoundSpeed2 = -rho * pow(dsde_rho, -1) * (blue_term - rho * green_term * (dsdrho_e / dsde_rho)); + + /*--- Compute primary flow variables. ---*/ + Temperature = 1.0 / dsde_rho; + Pressure = -pow(rho, 2) * Temperature * dsdrho_e; + Density = rho; + StaticEnergy = e; + Enthalpy = e + Pressure / rho; + + /*--- Compute secondary flow variables ---*/ + dTde_rho = -pow(dsde_rho, -2) * d2sde2; + dTdrho_e = -pow(dsde_rho, -2) * 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); + + /*--- 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_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; +} + +void CDataDrivenFluid::SetTDState_PT(su2double P, su2double T) { + + /*--- Approximate density and static energy with ideal gas law. ---*/ + rho_start = P / (R_idealgas * 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); +} + +void CDataDrivenFluid::SetTDState_Prho(su2double P, su2double rho) { + /*--- Computing static energy according to pressure and density. ---*/ + SetEnergy_Prho(P, rho); +} + +void CDataDrivenFluid::SetEnergy_Prho(su2double P, su2double rho) { + /*--- Run 1D Newton solver for pressure at constant density. ---*/ + 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)); + + Run_Newton_Solver(P, &Pressure, &StaticEnergy, &dPde_rho); +} + +void CDataDrivenFluid::SetTDState_rhoT(su2double rho, su2double T) { + /*--- Run 1D Newton solver for temperature at constant density. ---*/ + Density = rho; + + /*--- Approximate static energy through ideal gas law. ---*/ + StaticEnergy = Cv_idealgas * T; + + 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); +} + +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); + + Run_Newton_Solver(P, s, &Pressure, &Entropy, &dPdrho_e, &dPde_rho, &dsdrho_e, &dsde_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); +#endif + return exit_code; +} + +unsigned long CDataDrivenFluid::Predict_LUT(su2double rho, su2double e) { + unsigned long exit_code; + std::vector output_names_rhoe_LUT; + std::vector outputs_LUT; + output_names_rhoe_LUT.resize(output_names_rhoe.size()); + for (auto iOutput = 0u; iOutput < output_names_rhoe.size(); iOutput++) { + output_names_rhoe_LUT[iOutput] = output_names_rhoe[iOutput]; + } + + outputs_LUT.resize(outputs_rhoe.size()); + for (auto iOutput = 0u; iOutput < outputs_rhoe.size(); iOutput++) { + outputs_LUT[iOutput] = outputs_rhoe[iOutput]; + } + + exit_code = lookup_table->LookUp_XY(output_names_rhoe_LUT, outputs_LUT, rho, e); + return exit_code; +} + +void CDataDrivenFluid::Evaluate_Dataset(su2double rho, su2double e) { + /*--- Evaluate dataset based on regression method. ---*/ + switch (Kind_DataDriven_Method) { + case ENUM_DATADRIVEN_METHOD::LUT: + outside_dataset = Predict_LUT(rho, e); + break; + case ENUM_DATADRIVEN_METHOD::MLP: + outside_dataset = Predict_MLP(rho, e); + break; + default: + break; + } +} + +void CDataDrivenFluid::Run_Newton_Solver(su2double Y1_target, su2double Y2_target, su2double* Y1, su2double* Y2, + su2double* dY1drho, su2double* dY1de, su2double* dY2drho, su2double* dY2de) { + /*--- 2D Newton solver, computing the density and internal energy values corresponding to Y1_target and 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; + + /*--- Continue iterative process if residuals are outside tolerances. ---*/ + 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; + + /*--- Update density and energy values. ---*/ + rho -= Newton_Relaxation * delta_rho; + e -= Newton_Relaxation * delta_e; + } + Iter++; + } + nIter_Newton = Iter; + + /*--- Evaluation of final state. ---*/ + SetTDState_rhoe(rho, e); +} + +void CDataDrivenFluid::Run_Newton_Solver(su2double Y_target, su2double* Y, su2double* X, su2double* 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; + + /*--- 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; + + /*--- Continue iterative process if residuals are outside tolerances. ---*/ + if (abs(delta_Y / *Y) < Newton_Tolerance) { + converged = true; + } else { + delta_X = delta_Y / *dYdX; + + /*--- Update energy value ---*/ + *X += Newton_Relaxation * delta_X; + } + Iter++; + } + + /*--- Calculate thermodynamic state based on converged values for density and energy. ---*/ + SetTDState_rhoe(Density, StaticEnergy); + + nIter_Newton = Iter; +} + +void CDataDrivenFluid::ComputeIdealGasQuantities() { + /*--- Compute approximate ideal gas properties from the middle of the reference data set. These properties are used to approximate the initial condition of the Newton solvers using the ideal gas law. ---*/ + su2double rho_average = 1.0, e_average = 1.0; + + /*--- Obtain minimum and maximum density and static energy from data set. ---*/ + switch (Kind_DataDriven_Method) + { + case ENUM_DATADRIVEN_METHOD::LUT: + rho_min = *lookup_table->GetTableLimitsX().first; + e_min = *lookup_table->GetTableLimitsY().first; + rho_max = *lookup_table->GetTableLimitsX().second; + e_max = *lookup_table->GetTableLimitsY().second; + rho_average = 0.5*(*lookup_table->GetTableLimitsX().first + *lookup_table->GetTableLimitsX().second); + e_average = 0.5*(*lookup_table->GetTableLimitsY().first + *lookup_table->GetTableLimitsY().second); + break; + case ENUM_DATADRIVEN_METHOD::MLP: +#ifdef USE_MLPCPP + rho_min = lookup_mlp->GetInputNorm(iomap_rhoe, idx_rho).first; + 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); +#endif + break; + default: + break; + } + + /*--- Compute thermodynamic state from middle of data set. ---*/ + SetTDState_rhoe(rho_average, e_average); + 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; + gamma_idealgas = (R_idealgas / Cv_idealgas) + 1; +} \ No newline at end of file diff --git a/SU2_CFD/src/meson.build b/SU2_CFD/src/meson.build index 98f71f9fd45e..946227cd3052 100644 --- a/SU2_CFD/src/meson.build +++ b/SU2_CFD/src/meson.build @@ -12,7 +12,8 @@ su2_cfd_src += files(['fluid/CFluidModel.cpp', 'fluid/CCoolProp.cpp', 'fluid/CNEMOGas.cpp', 'fluid/CMutationTCLib.cpp', - 'fluid/CSU2TCLib.cpp']) + 'fluid/CSU2TCLib.cpp', + 'fluid/CDataDrivenFluid.cpp']) su2_cfd_src += files(['output/COutputFactory.cpp', 'output/CAdjElasticityOutput.cpp', diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index 4cfe8b9f64cc..dbad2ffd8c83 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -238,6 +238,13 @@ void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("MACH", "Mach", "PRIMITIVE", "Mach number"); AddVolumeOutput("PRESSURE_COEFF", "Pressure_Coefficient", "PRIMITIVE", "Pressure coefficient"); + // Datadriven fluid model + if(config->GetKind_FluidModel() == DATADRIVEN_FLUID){ + AddVolumeOutput("EXTRAPOLATION", "Extrapolation", "PRIMITIVE", "Density, energy outside data range"); + AddVolumeOutput("FLUIDMODEL_NEWTONITER", "nIter_Newton", "PRIMITIVE", "Number of iterations evaluated by the Newton solver"); + AddVolumeOutput("ENTROPY", "Entropy", "PRIMITIVE", "Fluid entropy value"); + } + if (config->GetViscous()) { AddVolumeOutput("LAMINAR_VISCOSITY", "Laminar_Viscosity", "PRIMITIVE", "Laminar viscosity"); @@ -324,6 +331,12 @@ void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv const su2double factor = solver[FLOW_SOL]->GetReferenceDynamicPressure(); SetVolumeOutputValue("PRESSURE_COEFF", iPoint, (Node_Flow->GetPressure(iPoint) - solver[FLOW_SOL]->GetPressure_Inf())/factor); + if(config->GetKind_FluidModel() == DATADRIVEN_FLUID){ + SetVolumeOutputValue("EXTRAPOLATION", iPoint, Node_Flow->GetDataExtrapolation(iPoint)); + SetVolumeOutputValue("FLUIDMODEL_NEWTONITER", iPoint, Node_Flow->GetNewtonSolverIterations(iPoint)); + SetVolumeOutputValue("ENTROPY", iPoint, Node_Flow->GetEntropy(iPoint)); + } + if (config->GetKind_Solver() == MAIN_SOLVER::RANS || config->GetKind_Solver() == MAIN_SOLVER::NAVIER_STOKES){ SetVolumeOutputValue("LAMINAR_VISCOSITY", iPoint, Node_Flow->GetLaminarViscosity(iPoint)); } diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index a8dedcba6d7f..1ce06058b5ea 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -32,6 +32,7 @@ #include "../../include/fluid/CIdealGas.hpp" #include "../../include/fluid/CVanDerWaalsGas.hpp" #include "../../include/fluid/CPengRobinson.hpp" +#include "../../include/fluid/CDataDrivenFluid.hpp" #include "../../include/fluid/CCoolProp.hpp" #include "../../include/numerics_simd/CNumericsSIMD.hpp" #include "../../include/limiters/CLimiterDetails.hpp" @@ -852,6 +853,12 @@ void CEulerSolver::SetNondimensionalization(CConfig *config, unsigned short iMes auxFluidModel = new CPengRobinson(Gamma, config->GetGas_Constant(), config->GetPressure_Critical(), config->GetTemperature_Critical(), config->GetAcentric_Factor()); break; + + case DATADRIVEN_FLUID: + + auxFluidModel = new CDataDrivenFluid(config); + + break; case COOLPROP: auxFluidModel = new CCoolProp(config->GetFluid_Name()); @@ -1084,6 +1091,10 @@ void CEulerSolver::SetNondimensionalization(CConfig *config, unsigned short iMes config->GetAcentric_Factor()); break; + case DATADRIVEN_FLUID: + FluidModel[thread] = new CDataDrivenFluid(config, false); + break; + case COOLPROP: FluidModel[thread] = new CCoolProp(config->GetFluid_Name()); break; @@ -4832,6 +4843,11 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, Energy_b = u_b[nVar-1]/Density_b; StaticEnergy_b = Energy_b - 0.5*Velocity2_b; GetFluidModel()->SetTDState_rhoe(Density_b, StaticEnergy_b); + + /*--- Store number of Newton iterations at BC ---*/ + if(config->GetKind_FluidModel() == DATADRIVEN_FLUID) + nodes->SetNewtonSolverIterations(iPoint, GetFluidModel()->GetnIter_Newton()); + Pressure_b = GetFluidModel()->GetPressure(); Temperature_b = GetFluidModel()->GetTemperature(); Enthalpy_b = Energy_b + Pressure_b/Density_b; @@ -5002,6 +5018,9 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); } + /*--- Store number of Newton iterations at BC ---*/ + if(config->GetKind_FluidModel() == DATADRIVEN_FLUID) + nodes->SetNewtonSolverIterations(iPoint, GetFluidModel()->GetnIter_Newton()); } } @@ -5600,6 +5619,7 @@ void CEulerSolver::PreprocessBC_Giles(CGeometry *geometry, CConfig *config, CNum { Velocity_i[iDim] = nodes->GetVelocity(iPoint,iDim); } + ComputeTurboVelocity(Velocity_i, turboNormal, turboVelocity, marker_flag, config->GetKind_TurboMachinery(iZone)); if(nDim ==2){ @@ -6423,6 +6443,9 @@ void CEulerSolver::BC_Giles(CGeometry *geometry, CSolver **solver_container, CNu Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); } + /*--- Store number of Newton iterations at BC ---*/ + if(config->GetKind_FluidModel() == DATADRIVEN_FLUID) + nodes->SetNewtonSolverIterations(iPoint, GetFluidModel()->GetnIter_Newton()); } END_SU2_OMP_FOR diff --git a/SU2_CFD/src/solvers/CFEM_DG_EulerSolver.cpp b/SU2_CFD/src/solvers/CFEM_DG_EulerSolver.cpp index 7beeb095bbe1..ae9da1c7350a 100644 --- a/SU2_CFD/src/solvers/CFEM_DG_EulerSolver.cpp +++ b/SU2_CFD/src/solvers/CFEM_DG_EulerSolver.cpp @@ -32,6 +32,7 @@ #include "../../include/fluid/CVanDerWaalsGas.hpp" #include "../../include/fluid/CPengRobinson.hpp" #include "../../include/fluid/CCoolProp.hpp" +#include "../../include/fluid/CDataDrivenFluid.hpp" enum { SIZE_ARR_NORM = 8 @@ -897,6 +898,20 @@ void CFEM_DG_EulerSolver::SetNondimensionalization(CConfig *config, } break; + case DATADRIVEN_FLUID: + FluidModel = new CDataDrivenFluid(config, false); + if (free_stream_temp) { + FluidModel->SetTDState_PT(Pressure_FreeStream, Temperature_FreeStream); + Density_FreeStream = FluidModel->GetDensity(); + config->SetDensity_FreeStream(Density_FreeStream); + } + else { + FluidModel->SetTDState_Prho(Pressure_FreeStream, Density_FreeStream ); + Temperature_FreeStream = FluidModel->GetTemperature(); + config->SetTemperature_FreeStream(Temperature_FreeStream); + } + + break; } Mach2Vel_FreeStream = FluidModel->GetSoundSpeed(); @@ -1085,6 +1100,11 @@ void CFEM_DG_EulerSolver::SetNondimensionalization(CConfig *config, FluidModel = new CCoolProp(config->GetFluid_Name()); FluidModel->SetEnergy_Prho(Pressure_FreeStreamND, Density_FreeStreamND); break; + + case DATADRIVEN_FLUID: + FluidModel = new CDataDrivenFluid(config); + FluidModel->SetEnergy_Prho(Pressure_FreeStreamND, Density_FreeStreamND); + break; } Energy_FreeStreamND = FluidModel->GetStaticEnergy() + 0.5*ModVel_FreeStreamND*ModVel_FreeStreamND; @@ -7772,6 +7792,7 @@ void CFEM_DG_EulerSolver::BoundaryStates_Riemann(CConfig *confi /* Compute the total enthalpy and entropy from these values. */ FluidModel->SetTDState_PT(P_Total, T_Total); + const su2double Enthalpy_e = FluidModel->GetStaticEnergy() + FluidModel->GetPressure()/FluidModel->GetDensity(); const su2double Entropy_e = FluidModel->GetEntropy(); diff --git a/SU2_CFD/src/variables/CEulerVariable.cpp b/SU2_CFD/src/variables/CEulerVariable.cpp index cf3432ebd071..84a0fa106966 100644 --- a/SU2_CFD/src/variables/CEulerVariable.cpp +++ b/SU2_CFD/src/variables/CEulerVariable.cpp @@ -77,6 +77,13 @@ CEulerVariable::CEulerVariable(su2double density, const su2double *velocity, su2 Grad_AuxVar.resize(nPoint, nAuxVar, nDim, 0.0); AuxVar.resize(nPoint, nAuxVar) = su2double(0.0); } + + if (config->GetKind_FluidModel() == ENUM_FLUIDMODEL::DATADRIVEN_FLUID){ + DataDrivenFluid = true; + DatasetExtrapolation.resize(nPoint) = 0; + NIterNewtonsolver.resize(nPoint) = 0; + FluidEntropy.resize(nPoint) = su2double(0.0); + } } bool CEulerVariable::SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel) { @@ -124,6 +131,12 @@ bool CEulerVariable::SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel) { SetEnthalpy(iPoint); // Requires pressure computation. + /*--- Set look-up variables in case of data-driven fluid model ---*/ + if (DataDrivenFluid) { + SetDataExtrapolation(iPoint, FluidModel->GetExtrapolation()); + SetEntropy(iPoint, FluidModel->GetEntropy()); + } + return RightVol; } diff --git a/SU2_CFD/src/variables/CNSVariable.cpp b/SU2_CFD/src/variables/CNSVariable.cpp index ec278b27ae17..99b7de107410 100644 --- a/SU2_CFD/src/variables/CNSVariable.cpp +++ b/SU2_CFD/src/variables/CNSVariable.cpp @@ -198,6 +198,12 @@ bool CNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2doubl SetSpecificHeatCp(iPoint, FluidModel->GetCp()); + /*--- Set look-up variables in case of data-driven fluid model ---*/ + if (DataDrivenFluid) { + SetDataExtrapolation(iPoint, FluidModel->GetExtrapolation()); + SetEntropy(iPoint, FluidModel->GetEntropy()); + } + return RightVol; } diff --git a/TestCases/nicf/datadriven/MLP_air.mlp b/TestCases/nicf/datadriven/MLP_air.mlp new file mode 100644 index 000000000000..e28657819cfa --- /dev/null +++ b/TestCases/nicf/datadriven/MLP_air.mlp @@ -0,0 +1,138 @@ +
+ +[number of layers] +4 + +[neurons per layer] +2 +50 +30 +6 + +[activation function] +linear +swish +swish +linear + +[input names] +Density +Energy + +[input normalization] ++2.8103800000000001e-01 +2.7297899999999998e+01 ++1.7995600000000000e+05 +4.4831800000000000e+05 + +[output names] +s +dsde_rho +dsdrho_e +d2sde2 +d2sdedrho +d2sdrho2 + +[output normalization] ++5.7472900000000000e+03 +7.7785200000000004e+03 ++1.6686100000000001e-03 +4.0000000000000001e-03 +-1.0563199999999999e+03 -1.0714800000000000e+01 +-2.1545900000000001e-08 -3.5737000000000002e-09 +-4.2049399999999996e-06 -4.9376699999999998e-07 ++3.9691700000000002e-01 +3.7578600000000001e+03 + +
+ +[weights per layer] + +-8.7661929428577423e-03 -3.4266726970672607e+00 -1.1285322718322277e-02 -4.4609041213989258e+00 -6.2620453536510468e-03 -8.7659519910812378e-01 +8.1317527219653130e-03 +1.0037513971328735e+00 +5.1442968845367432e-01 -3.8515377044677734e+01 +3.0268053524196148e-03 -3.5439160466194153e-01 -5.6422060728073120e-01 -8.2498639822006226e-03 -1.1617618612945080e-02 +9.0869655832648277e-03 -9.9546900019049644e-03 +1.6827103495597839e-01 -2.7841054916381836e+01 -8.8479537516832352e-03 -3.9593321084976196e-01 +9.5181297510862350e-03 -2.3468191921710968e-01 -8.5755866020917892e-03 -9.0520847588777542e-03 +6.8784481287002563e-01 -3.5454284667968750e+01 -3.9844226837158203e+00 +4.1778454184532166e-01 -1.3072727015241981e-03 -1.0021785274147987e-02 -8.5394643247127533e-03 -2.2426181793212891e+01 -6.7269902229309082e+00 -2.2461936473846436e+00 +1.0424779728055000e-02 -2.1550936698913574e+00 +1.0762871503829956e+00 -5.4205872118473053e-02 +1.0137343406677246e+00 +1.0054445825517178e-02 +8.3967143297195435e-01 -3.2765858173370361e+00 -9.6592950820922852e-01 +7.5265145860612392e-03 +1.7908766865730286e-02 -1.0453859567642212e+00 +5.1517069339752197e-01 +1.0649362578988075e-02 -1.4490582466125488e+01 +-3.2857151236385107e-03 +5.9187543392181396e-01 -2.7645176742225885e-03 -5.6996935606002808e-01 +2.6538472156971693e-03 -2.7195680141448975e+00 +3.0651132110506296e-03 +8.6517339944839478e-01 +4.3157178163528442e-01 +1.4268080890178680e-01 +3.5014057066291571e-03 +5.3483609110116959e-02 -6.2381106615066528e-01 -2.6864213868975639e-03 -3.6386675201356411e-03 +3.2822357024997473e-03 -6.2203389825299382e-04 +5.6492674350738525e-01 -4.0196239948272705e-02 -3.2206296455115080e-03 -1.3066108226776123e+00 +3.2423695083707571e-03 -4.7114229202270508e-01 -3.1998909544199705e-03 -3.4287294838577509e-03 -7.1377158164978027e-01 -3.3232133835554123e-02 +4.1278833150863647e-01 -6.1671531200408936e-01 +8.1366943195462227e-03 -2.5733003858476877e-03 -4.1674333624541759e-03 +2.6167348027229309e-01 +2.3013504222035408e-02 -3.9804546833038330e+00 +3.2503411639481783e-03 -4.1613835096359253e-01 +8.3258646726608276e-01 -4.6460423469543457e+00 -6.7755001783370972e-01 +2.0869453437626362e-03 -1.2752885818481445e+00 +3.7751388549804688e-01 +7.4102884531021118e-01 +2.5022702757269144e-03 -3.5920643806457520e+00 +4.4666483998298645e-01 +6.7768990993499756e-01 +3.8648282643407583e-03 -6.6180028021335602e-02 + + ++2.2392576560378075e-02 +7.9600289463996887e-03 +3.5748567897826433e-03 -9.0584503486752510e-03 +1.2166848406195641e-02 -2.5937089230865240e-03 -3.1598001718521118e-02 -1.0288016637787223e-03 +5.8472803793847561e-03 +9.6058771014213562e-03 +1.1490470496937633e-03 +1.1987331090494990e-03 -1.4139647595584393e-02 +5.7148635387420654e-03 -1.3746656477451324e-02 -1.1688595404848456e-03 -6.0691782273352146e-03 +1.2217802926898003e-02 +4.9242796376347542e-04 -3.5094288177788258e-03 -1.1753068974940106e-04 +1.0253794491291046e-02 -4.4527775608003139e-03 -9.4327889382839203e-03 +5.4327612742781639e-03 +1.4921743422746658e-02 -4.8628062941133976e-03 +2.6123812422156334e-03 -2.4538778234273195e-03 +1.0964288376271725e-03 ++3.6110359430313110e-01 +9.8026596009731293e-02 +4.6404144167900085e-01 +6.0216322541236877e-02 -8.0096580088138580e-02 +1.2656687200069427e-01 +1.0300234556198120e+00 +2.5322940945625305e-01 -1.1969280242919922e-01 +7.5731530785560608e-02 +2.5466546416282654e-01 +4.0801015496253967e-01 +1.0507564246654510e-01 +1.8800427019596100e-01 -6.6708527505397797e-02 -2.8555359691381454e-02 +1.5476048924028873e-02 -2.9614616185426712e-02 +3.6750924587249756e-01 +2.5943362712860107e-01 -1.8100416660308838e-01 +8.2749044895172119e-01 -3.2592689990997314e-01 -1.8920606374740601e-01 +3.0292451381683350e-01 +1.6076701879501343e-01 +4.3490141630172729e-01 +1.1568275690078735e+00 +4.0298035740852356e-01 +4.5640733838081360e-01 ++2.8654664754867554e-02 -5.1102931611239910e-03 -5.0179590471088886e-03 +2.9692562296986580e-02 -2.5242846459150314e-02 -1.0584304109215736e-02 -8.6143769323825836e-02 -1.2718157377094030e-03 -1.6436820151284337e-03 -6.0880156233906746e-03 +6.4149782992899418e-03 +7.7689094468951225e-03 -8.7809944525361061e-03 +4.9446863122284412e-03 +1.4842073433101177e-02 -1.3596132630482316e-03 -4.6914261765778065e-03 -5.8191916905343533e-03 +5.3516036132350564e-05 -2.4235600139945745e-03 +1.3130043633282185e-02 +1.2955116108059883e-02 +7.5448508141562343e-05 -2.3631529882550240e-02 -7.2855874896049500e-03 -1.2934653786942363e-03 -3.2870728522539139e-02 -7.9475715756416321e-03 -1.0526617552386597e-04 +6.6794380545616150e-03 ++1.0183042287826538e+00 +9.4328612089157104e-02 +1.5826278924942017e-01 +1.0882979631423950e+00 +2.0344227552413940e-02 +1.0282444208860397e-01 +2.0774064064025879e+00 +2.3161085322499275e-02 -2.3039284348487854e-01 -1.1217297054827213e-02 +1.8896563351154327e-01 +5.7233422994613647e-01 +8.3293038606643677e-01 +1.4052432775497437e+00 +3.1595088541507721e-02 -4.9777433276176453e-02 +6.8844801187515259e-01 -5.7788652181625366e-01 +1.2352354079484940e-01 +6.8365705013275146e-01 +5.9540993534028530e-03 +1.2188625335693359e+00 +2.3281562328338623e-01 +1.4437642097473145e+00 +3.4375214576721191e-01 +2.4806845188140869e-01 +6.3897532224655151e-01 +1.4015979766845703e+00 +4.7642663121223450e-02 +8.3598303794860840e-01 +-7.1249902248382568e-02 +7.3736738413572311e-03 -6.5115123987197876e-02 +1.7532150447368622e-01 -1.6516063362360001e-02 -2.2883811965584755e-02 -2.8121235966682434e-01 +1.7733649583533406e-03 +1.3607916422188282e-02 +5.1674195565283298e-03 +2.4119220674037933e-02 +2.7576148509979248e-02 -1.2013184279203415e-01 +8.2866497337818146e-02 -4.9877990968525410e-03 -1.4383967965841293e-02 -1.5938781201839447e-02 -1.2918220460414886e-01 +3.9603719487786293e-03 +7.1034422144293785e-03 +2.2393852472305298e-02 +1.2858656700700521e-03 -1.4535012654960155e-02 -1.7607294023036957e-01 -3.1297340989112854e-02 +3.4883134067058563e-02 -2.8218910098075867e-01 -1.9953873753547668e-01 +1.9713912159204483e-02 +2.8901921585202217e-02 ++4.0369346737861633e-01 +2.9731053113937378e-01 +2.4753858149051666e-01 +8.8224422931671143e-01 -1.6348542273044586e-01 -9.0610712766647339e-02 +1.9077446460723877e+00 +4.6216920018196106e-01 +2.5316935498267412e-03 -9.5464952290058136e-02 +2.1605189889669418e-02 -3.3519038558006287e-01 +1.2772579193115234e+00 +1.1152528971433640e-01 -1.6712199151515961e-01 +5.5418047122657299e-04 +1.9669297337532043e-01 +9.5107990503311157e-01 -2.9479548335075378e-01 +1.0238968133926392e+00 +9.9080967903137207e-01 +1.0320177078247070e+00 +4.5898649096488953e-01 +2.5367140769958496e-01 +1.8751852512359619e+00 +9.4264733791351318e-01 +3.9391773939132690e-01 +1.5431394577026367e+00 +3.1736749410629272e-01 +6.5486781299114227e-02 +-1.8551195040345192e-02 -7.2722234763205051e-03 -1.1413882020860910e-03 +5.5114943534135818e-03 -1.3809083029627800e-02 +1.5010851202532649e-03 +2.1325828507542610e-02 +9.0782874030992389e-04 -3.4422297030687332e-03 -9.2107634991407394e-03 +2.1454272791743279e-03 -1.9363844767212868e-03 +1.5615450218319893e-02 -7.0545747876167297e-03 +1.5504360198974609e-02 +6.2023132340982556e-04 +9.1641666367650032e-03 -2.5680776685476303e-02 -3.0705684912391007e-04 +1.5729337465018034e-03 +4.7629857435822487e-03 -7.7615403570234776e-03 +3.7197743076831102e-03 +8.1001278012990952e-03 -5.9072612784802914e-03 -9.1548021882772446e-03 -8.5639227181673050e-03 -4.2250481783412397e-04 +2.3268302902579308e-03 -1.4017717912793159e-03 +-2.3385837674140930e-01 -2.0700454711914062e-01 +5.0028526782989502e-01 -8.4764569997787476e-02 +2.3447500169277191e-01 -2.8759571909904480e-01 -1.1670864820480347e+00 +2.5192543864250183e-01 -2.3637959361076355e-01 -1.8615426123142242e-01 -7.5147911906242371e-02 -4.2479848861694336e-01 +1.0016661137342453e-01 -1.5444077551364899e-01 +2.9203984141349792e-01 -1.6324970871210098e-02 +1.4786723256111145e-01 -2.1885683760046959e-02 -3.8148441910743713e-01 -5.9453976154327393e-01 -2.6424989104270935e-01 -8.0739200115203857e-01 -4.9984103441238403e-01 -1.9075922667980194e-01 +2.6735782623291016e-01 +2.4672958254814148e-01 -1.6150070726871490e-01 -1.3906221389770508e+00 +3.6920774728059769e-03 -3.1305900216102600e-01 ++5.3976573050022125e-02 +2.2428610920906067e-01 +7.5511598587036133e-01 +2.2359265387058258e-01 +1.4866603910923004e-01 -1.9589638710021973e-01 -9.5226556062698364e-01 +2.3839950561523438e-01 +3.1497514247894287e-01 +2.2922165691852570e-01 -1.8898980319499969e-01 +3.0267661809921265e-01 +2.0260135829448700e-01 -3.4200616180896759e-02 -2.2988453507423401e-01 +3.7760379910469055e-01 +2.7023553848266602e-01 +5.1056051254272461e-01 -2.6908892393112183e-01 -7.1504056453704834e-02 +3.2599738240242004e-01 -6.3871419429779053e-01 +1.2145425193011761e-02 +3.0939784646034241e-01 +5.7983940839767456e-01 +5.5183309316635132e-01 +8.7424121797084808e-02 -7.2706693410873413e-01 +1.6143250465393066e-01 -3.0804461240768433e-01 ++5.4388680458068848e+00 -4.8211678862571716e-02 +1.3934879302978516e+00 -3.8359767198562622e-01 -7.1386933326721191e-02 -9.7167646884918213e-01 +7.1207904815673828e+00 -1.8979947268962860e-01 +9.0723522007465363e-03 -3.0877865850925446e-02 -2.2286973893642426e-02 +1.9570294022560120e-01 -2.9662413522601128e-02 +3.3544573783874512e+00 +8.1466563045978546e-02 +1.7743223905563354e-01 +4.0210589766502380e-01 -1.2413966655731201e+00 -1.0203550010919571e-01 -2.0565536022186279e+00 +2.2479303181171417e-01 +2.5490016937255859e+00 +1.2534368038177490e-01 -1.4018478989601135e-01 +3.3276398181915283e+00 -1.6095693111419678e+00 +7.6436616480350494e-02 +2.7643635272979736e+00 +9.4836199283599854e-01 +6.8442809581756592e-01 +-8.9177824556827545e-02 +6.5167476423084736e-03 -2.8235929086804390e-02 +9.8510220646858215e-02 +5.0358367152512074e-03 +4.5349965803325176e-03 -4.3019449710845947e-01 +1.5286672860383987e-03 -1.6081217676401138e-02 +2.3365607485175133e-02 +4.6824812889099121e-02 +2.7973545715212822e-02 -8.8929399847984314e-02 +1.1491440981626511e-01 +3.1452793627977371e-02 -1.0596839711070061e-03 -2.1337373182177544e-02 -7.5179286301136017e-02 -1.6686336603015661e-03 -1.3744756579399109e-01 -1.4291884005069733e-01 +9.9394628778100014e-03 +9.0381503105163574e-04 -2.5926785543560982e-02 -3.5228424239903688e-03 +1.5739551186561584e-01 +2.9531730338931084e-02 -2.9179224371910095e-01 -2.9110519681125879e-03 +4.2410619556903839e-02 ++2.0986029505729675e-01 -3.2014039158821106e-01 +6.4531847834587097e-02 +3.5717433691024780e-01 -1.0694514960050583e-01 +1.5922227501869202e-01 +1.8404359817504883e+00 -7.0013843476772308e-02 +1.0977050662040710e-01 -1.9438337534666061e-02 +3.0386874079704285e-01 -2.5890406966209412e-01 +2.3401951789855957e-01 -1.9390870630741119e-01 +2.1952521800994873e-01 +3.0579257011413574e-01 -4.1737759113311768e-01 +1.3158984482288361e-01 -2.5674876570701599e-01 -2.0747114717960358e-01 -1.3071627356112003e-02 +8.8095277547836304e-01 +4.7186973690986633e-01 -4.3130216002464294e-01 +2.2180753946304321e-01 +2.1879050135612488e-01 +8.7652452290058136e-02 +1.4542431831359863e+00 -1.7569498717784882e-01 -4.2115136981010437e-02 ++3.1454294919967651e-02 -1.2935942411422729e-01 +5.0012981891632080e-01 -2.2237123921513557e-02 +3.2395929098129272e-02 -1.2856999039649963e-01 +1.0422532558441162e+00 +5.9094369411468506e-02 +1.6329297423362732e-01 -1.5968561172485352e-02 +3.5146292299032211e-02 +2.5358462333679199e-01 +6.9700509309768677e-01 +3.7190999835729599e-02 -3.1922256946563721e-01 +9.9820084869861603e-03 -2.1194377914071083e-02 +6.2019509077072144e-01 +4.1183158755302429e-01 +8.9281946420669556e-02 +4.3999701738357544e-01 +9.0066611766815186e-01 -3.1003439426422119e-01 -1.1288642138242722e-01 +4.2092651128768921e-01 +4.0025594830513000e-01 +7.1255147457122803e-01 +1.4434016942977905e+00 -5.5304080247879028e-01 -1.7932089045643806e-02 ++2.7572058141231537e-02 +8.2171997055411339e-03 +9.4498787075281143e-04 -2.0359544083476067e-02 +6.9288755767047405e-03 -2.4946043267846107e-03 -3.6368090659379959e-02 -1.2999128084629774e-03 +5.0133448094129562e-03 +1.2948354706168175e-02 -1.0674160439521074e-03 +8.6972565623000264e-04 +6.6573929507285357e-04 +2.8723340947180986e-03 -1.4617691747844219e-02 -1.5716382768005133e-03 -3.3463290892541409e-03 +3.7084981799125671e-02 +7.2192674269899726e-04 -1.9076513126492500e-03 +4.3147504329681396e-02 +7.8640561550855637e-03 -4.3465071357786655e-03 -1.2246314436197281e-02 +3.7610607687383890e-03 +1.2747735716402531e-02 +5.3343186154961586e-03 +2.3305744398385286e-03 -2.1638954058289528e-03 +1.8606630619615316e-03 ++1.1653236113488674e-02 +8.3067623199895024e-04 -2.0229928195476532e-02 +4.6623736619949341e-02 -2.3877365514636040e-02 -9.5734903588891029e-03 -7.6195552945137024e-02 -1.3526364928111434e-03 -4.4793300330638885e-03 -1.8764500273391604e-03 +1.9989397376775742e-02 +1.0507276281714439e-02 -2.7843827381730080e-02 +1.7238724976778030e-02 +3.0009781476110220e-03 -1.7600433202460408e-03 -9.1034341603517532e-03 -1.0331550613045692e-02 +2.0209257490932941e-04 +9.8309172317385674e-03 +1.8703460693359375e-02 +9.5323780551552773e-03 -1.1899343226104975e-03 -3.2162051647901535e-02 -4.5783161185681820e-03 +1.0196280200034380e-03 -4.6069648116827011e-02 -1.8225667998194695e-02 +3.3020708360709250e-04 +9.3011017888784409e-03 +-1.8872637301683426e-02 -6.0376455076038837e-03 -4.1067937854677439e-04 +1.3683103956282139e-02 -1.1682632379233837e-02 +1.4379398198798299e-03 +3.2982267439365387e-02 +1.0437252931296825e-03 -4.7897922922857106e-04 -9.3664173036813736e-03 -7.5457541970536113e-04 -1.7994442023336887e-03 +1.1769735254347324e-02 -7.3857572861015797e-03 +8.5298512130975723e-03 +8.7231909856200218e-04 +6.8040224723517895e-03 -1.7418755218386650e-02 -4.4098650687374175e-04 +3.2832606229931116e-03 -7.0642125792801380e-03 -5.5945846252143383e-03 +4.4170590117573738e-03 +9.8447855561971664e-03 -5.4901787079870701e-03 -1.9048498943448067e-02 -4.0401788428425789e-03 +1.0774898109957576e-03 +2.8382160235196352e-03 -2.2717663086950779e-03 +-3.0968807637691498e-02 +3.4293960779905319e-03 -4.5778378844261169e-02 +1.2099603563547134e-01 -2.1703146398067474e-02 -2.6458010077476501e-02 -1.4596630632877350e-01 +1.8748512957245111e-04 +4.1643748991191387e-03 +6.9636721163988113e-03 +2.0675826817750931e-02 +9.0420674532651901e-03 -9.0069174766540527e-02 +3.9218366146087646e-02 +1.8253201851621270e-03 -6.5851653926074505e-03 -3.5960872191935778e-03 -6.4441464841365814e-02 +1.1426685377955437e-03 -5.2756820805370808e-03 -1.7345602810382843e-01 +3.9035785943269730e-02 -3.0535785481333733e-03 -7.2163030505180359e-02 -1.5704572200775146e-02 -1.9623422995209694e-02 -1.1985094845294952e-01 -9.9167406558990479e-02 +4.9744793213903904e-03 +1.4784702099859715e-02 ++1.8654450774192810e-01 +1.4119601249694824e-01 -2.2252102196216583e-01 +9.6041089296340942e-01 -1.6173821687698364e-01 +5.8522284030914307e-02 +1.7320021390914917e+00 +4.7821000218391418e-02 +4.3808248639106750e-01 -1.2928076088428497e-01 -1.5165460109710693e-01 -2.3914944380521774e-02 +1.4819781780242920e+00 -1.5836881101131439e-01 +1.4562886953353882e-01 -2.1183432638645172e-01 +1.6852976754307747e-02 +4.6025195717811584e-01 -1.3624036312103271e-01 +8.7582886219024658e-01 +9.4384902715682983e-01 +8.5495972633361816e-01 +6.4013659954071045e-01 +1.7367276549339294e-01 +9.5168566703796387e-01 +4.0076676011085510e-01 +4.8677390813827515e-01 +1.7919195890426636e+00 -3.0221998691558838e-01 -3.9657318592071533e-01 ++4.8854022026062012e+00 -7.3605217039585114e-02 +4.5121341943740845e-02 +9.2635381221771240e-01 -6.6728584468364716e-02 +3.6604961752891541e-01 +1.1934051513671875e+01 +8.6639933288097382e-02 +6.0030452907085419e-02 -7.9747047275304794e-03 -1.4038564264774323e-01 +5.0605779886245728e-01 -1.8718546628952026e-01 +2.2427473068237305e+00 +9.9341079592704773e-02 -2.6597088575363159e-01 +3.6095491051673889e-01 +2.1646662056446075e-01 +5.4312353022396564e-03 +1.1021225452423096e+00 +1.6586470603942871e-01 +2.1038167476654053e+00 -2.7163031697273254e-01 +5.9570664167404175e-01 +2.1361887454986572e+00 +1.4068026542663574e+00 -4.3007794022560120e-01 +3.7596609592437744e+00 +6.4098358154296875e-01 +5.3141951560974121e-01 ++2.4275714531540871e-02 +8.0193914473056793e-03 +2.7947551570832729e-03 -1.0994555428624153e-02 +1.1617438867688179e-02 -2.9287489596754313e-03 -3.3954977989196777e-02 -1.1213655816391110e-03 +6.6085052676498890e-03 +1.0182109661400318e-02 +9.9353352561593056e-04 +9.4423000700771809e-04 -1.1731697246432304e-02 +4.6814437955617905e-03 -1.4674077741801739e-02 -1.2527407379820943e-03 -5.2128336392343044e-03 +2.1108357235789299e-02 +5.0052808364853263e-04 -2.9256476555019617e-03 +7.6805154094472528e-04 +1.1561916209757328e-02 -3.8946189451962709e-03 -9.9965883418917656e-03 +4.8208623193204403e-03 +1.0596007108688354e-02 +7.9873314825817943e-04 +3.5245600156486034e-03 -2.2933133877813816e-03 +1.2488393113017082e-03 ++1.6016787290573120e-01 +7.7209278941154480e-02 +1.7114375531673431e-01 +4.3050479143857956e-02 +5.7305462658405304e-02 +1.5422140061855316e-01 +6.1659538745880127e-01 +9.0307667851448059e-03 +3.5114419460296631e-01 +3.5721026360988617e-02 -2.3983967304229736e-01 +2.1818891167640686e-01 +1.8132917582988739e-01 -9.6874050796031952e-02 -4.7828834503889084e-02 +4.4671192765235901e-01 -2.1089844405651093e-01 -3.9429506659507751e-01 +1.2285838127136230e+00 +4.7332602739334106e-01 -3.4942340850830078e-01 +5.0397449731826782e-01 +5.4826319217681885e-01 -4.1917493939399719e-01 -5.1285572350025177e-02 -1.0766799002885818e-01 +2.0650914311408997e-01 +1.2224029302597046e+00 -5.6231819093227386e-02 +1.1693327128887177e-01 +-2.2527543827891350e-02 -1.0194590315222740e-02 -1.7490637255832553e-03 +1.1888316832482815e-02 -9.6026370301842690e-03 +2.3832642473280430e-03 +3.6170259118080139e-02 +1.0733433300629258e-03 -3.5343344788998365e-03 -9.4599602743983269e-03 +3.5193939693272114e-03 -1.1839274084195495e-03 +9.5982411876320839e-03 -5.3506642580032349e-03 +1.2060887180268764e-02 +8.7261211592704058e-04 +4.8638777807354927e-03 -2.6349717751145363e-02 -3.5703508183360100e-04 +3.2163087744265795e-03 +7.4916356243193150e-03 -6.1825853772461414e-03 +3.4973602741956711e-03 +1.0307240299880505e-02 -4.4109360314905643e-03 -1.2619192712008953e-03 +1.4225110644474626e-03 -2.7125081978738308e-03 +2.7898952830582857e-03 -1.7149281920865178e-03 ++2.2116163372993469e-01 +3.2759135961532593e-01 +8.7951850891113281e-01 +7.3240935802459717e-01 -9.7584985196590424e-02 +2.2130407392978668e-01 +1.3648532629013062e+00 -1.0221759974956512e-01 +1.7253969563171268e-03 -3.2343029975891113e-01 +3.4902298450469971e-01 -1.9911876006517559e-04 +8.9159053564071655e-01 -6.0936197638511658e-02 +2.5235185027122498e-01 +3.5128825902938843e-01 +1.9840463995933533e-01 +7.5175738334655762e-01 +2.7205696702003479e-01 +8.6356562376022339e-01 +4.3659573793411255e-01 +9.8762542009353638e-01 +5.3135689347982407e-02 +1.4561730623245239e-01 +1.1676498651504517e+00 +9.6018069982528687e-01 +3.7918668985366821e-01 +1.7153657674789429e+00 +7.4393503367900848e-02 -2.3986081779003143e-01 ++1.8529502674937248e-02 +1.2471674941480160e-02 -3.4637285862118006e-03 -1.5456212684512138e-02 +5.7575823739171028e-03 -6.6754622384905815e-03 -4.0383581072092056e-02 -1.2936701532453299e-03 +8.4897894412279129e-03 +8.8328812271356583e-03 +7.7898991294205189e-03 +4.1505205444991589e-03 -1.0132861323654652e-02 +7.9530533403158188e-03 -6.9545153528451920e-03 -2.2615678608417511e-03 -7.9146688804030418e-03 +5.0236810930073261e-03 +8.9906400535255671e-04 +1.6654084902256727e-03 +1.3985021039843559e-02 +1.5896828845143318e-02 -5.7941824197769165e-03 -2.2503504529595375e-02 +1.4351443387567997e-03 +1.0629719123244286e-02 -1.8404109403491020e-02 -9.9081424996256828e-03 +2.8386365738697350e-04 +4.6008829958736897e-03 ++2.2111453115940094e-02 +8.2840332761406898e-03 +5.1666749641299248e-03 -1.1102426797151566e-02 +1.2924573384225368e-02 -1.9009257666766644e-03 -3.2805427908897400e-02 -1.1316227028146386e-03 +5.4512554779648781e-03 +1.0801286436617374e-02 -1.1930909240618348e-03 +1.1684393975883722e-03 -1.5875825658440590e-02 +5.5907550267875195e-03 -1.3301973231136799e-02 -9.4381708186119795e-04 -5.1597617566585541e-03 +1.6487410292029381e-02 +3.9696216117590666e-04 -3.2301587052643299e-03 -9.8162807989865541e-04 +4.2292084544897079e-03 -4.3733813799917698e-03 -1.0548825375735760e-02 +5.0795632414519787e-03 +1.9577415660023689e-02 +1.5869616763666272e-03 +2.4348013103008270e-03 -3.0362205579876900e-03 +1.3995966874063015e-03 +-2.0789991319179535e-01 -3.1365436315536499e-01 -2.1224570274353027e-01 +2.7200996875762939e-01 -1.8354667723178864e-01 +1.7508347332477570e-01 -1.6252928972244263e-01 -5.5214416980743408e-01 +2.9524454474449158e-01 +4.8238866031169891e-02 -8.3344601094722748e-02 -2.6718851923942566e-01 +1.2276823818683624e-01 -4.1695365309715271e-01 +1.6769100725650787e-01 +4.9431991577148438e-01 +2.9209960252046585e-02 +2.5150081515312195e-01 +1.5908457338809967e-02 -1.4371997117996216e-01 +3.2890480756759644e-01 -2.6231148838996887e-01 -3.8024280220270157e-02 -6.4148157835006714e-02 +9.4589143991470337e-01 +2.1765588223934174e-01 -1.0722817853093147e-02 -6.3435238599777222e-01 +4.1574063897132874e-01 -4.2805054783821106e-01 ++7.2712225914001465e+00 +1.2700730562210083e-01 +5.3292846679687500e-01 +5.1340532302856445e-01 +6.9889031350612640e-02 -5.0969070196151733e-01 +1.3058687210083008e+01 +1.3733775913715363e-01 +2.7870317921042442e-02 +3.8505170494318008e-02 +1.0009362548589706e-01 -7.5890056788921356e-02 +3.3805650472640991e-01 +3.3654196262359619e+00 -1.4968556165695190e-01 -8.6031705141067505e-02 -3.7358690053224564e-02 +7.2901225090026855e-01 +8.7380141019821167e-02 -6.5669131278991699e-01 -3.9542964100837708e-01 +3.0369405746459961e+00 +1.0485937446355820e-01 +2.9783341288566589e-01 +3.0435004234313965e+00 -4.4410625100135803e-01 +1.7786826193332672e-01 +4.1729598045349121e+00 +1.1803784370422363e+00 +5.1697224378585815e-01 ++7.2361037135124207e-02 +1.0434747487306595e-01 +2.5478628277778625e-01 -3.1980383396148682e-01 +1.0744347237050533e-03 +1.5667042462155223e-03 +8.4402757883071899e-01 -1.6111811995506287e-01 -3.9067182689905167e-02 -1.2757842242717743e-01 +3.7187714129686356e-02 +5.8204048871994019e-01 +9.9003091454505920e-03 +4.8570826649665833e-01 -1.2334727682173252e-02 +1.4479886740446091e-02 +3.3324141055345535e-02 +1.0832691937685013e-01 -1.8778277933597565e-01 -6.4557157456874847e-02 -4.2752179503440857e-01 +7.4300664663314819e-01 -2.9012808203697205e-01 +1.8560871481895447e-01 -4.8793795704841614e-01 +5.2122825384140015e-01 +2.1336844563484192e-01 +6.3208365440368652e-01 +5.4360829293727875e-02 +4.0972760319709778e-01 ++3.5012421011924744e-01 +6.9923810660839081e-02 +4.0716433525085449e-01 +5.3995728492736816e-01 -2.3399001359939575e-01 -4.0856763720512390e-02 +2.8955936431884766e-01 -5.1727855205535889e-01 +2.3481069505214691e-01 -1.3956817984580994e-01 +1.4436457306146622e-02 -2.6022922992706299e-01 -6.6649812459945679e-01 +9.2143051326274872e-02 +2.6337483897805214e-02 +1.1338828504085541e-01 +1.5185187757015228e-01 +1.6408857703208923e-01 +1.0436477512121201e-01 +1.8627494573593140e-01 +3.0829069018363953e-01 +2.7388930320739746e-01 +6.8136763572692871e-01 -3.1408968567848206e-01 +8.7798923254013062e-01 +3.5235232114791870e-01 +1.5354498289525509e-02 +7.3805421590805054e-01 +1.2355228513479233e-01 -2.4989223480224609e-01 +-3.2276257872581482e-01 -1.0486289113759995e-01 +2.3173089325428009e-01 +2.1661554276943207e-01 +2.9786330461502075e-01 +6.6890522837638855e-02 -1.1054642200469971e+00 -1.1351974681019783e-02 -1.3273781538009644e-01 +2.4014513194561005e-01 +1.0007199645042419e-01 +4.7196555882692337e-02 -9.3297913670539856e-02 +2.9942387342453003e-01 -1.6772331297397614e-01 +1.9559809938073158e-02 -1.5826578019186854e-03 +3.4687739610671997e-01 -1.0238303802907467e-02 -2.1310466527938843e-01 -9.4791159033775330e-02 -7.1938371658325195e-01 -3.5081151872873306e-03 -6.3778846524655819e-03 -7.6994225382804871e-02 +6.0040992498397827e-01 +3.3398607373237610e-01 -7.7061820030212402e-01 -3.3901266753673553e-02 +1.0806512832641602e-01 ++8.2691572606563568e-03 +8.9024257613345981e-04 -2.1341597661375999e-02 +8.3748750388622284e-02 -2.5057313963770866e-02 -1.5810465440154076e-02 -1.3286414742469788e-01 -1.2695635668933392e-03 -2.1033026278018951e-03 +1.5939393779262900e-03 +1.9721014425158501e-02 +1.3928753323853016e-02 -5.3723499178886414e-02 +2.5143200531601906e-02 +1.7632738454267383e-03 -4.5787091366946697e-03 -6.5327701158821583e-03 -4.9782957881689072e-02 +1.1645258637145162e-03 +3.8044687244109809e-04 +5.3891308605670929e-02 +1.2177241034805775e-02 -6.7768176086246967e-03 -6.0138739645481110e-02 -1.2698988430202007e-02 +5.8310475200414658e-02 -1.2028193473815918e-01 -5.1947850733995438e-02 +2.7508037164807320e-03 +1.2942352332174778e-02 +-3.4236672945553437e-05 -2.8759775683283806e-02 -2.9006756842136383e-02 -1.3310307636857033e-02 -3.6137101706117392e-03 -9.4494642689824104e-03 -2.1286444738507271e-02 -1.3164381962269545e-03 -1.9364116713404655e-02 -1.3604124076664448e-02 +1.1144751682877541e-02 +3.2778438180685043e-03 -1.2264763936400414e-02 +1.7550691962242126e-02 +4.1497065685689449e-03 +9.7439253295306116e-05 -1.4168939553201199e-02 -6.9460864178836346e-03 -2.2605271078646183e-04 -2.3730602115392685e-03 -1.8942527822218835e-04 +1.2368117459118366e-02 -4.3640783987939358e-03 -6.2440014444291592e-03 +4.2781820520758629e-03 +2.2261872887611389e-02 +1.2400990817695856e-03 -1.3751769438385963e-02 -5.9892060235142708e-03 +2.1073534153401852e-03 ++8.5913372039794922e-01 +2.3073198273777962e-02 -2.1961748600006104e-01 -4.3026676774024963e-01 +3.0936915427446365e-02 +4.3308371305465698e-01 +4.0976762771606445e+00 +3.9217900484800339e-02 -2.6484379172325134e-01 +6.8370722234249115e-02 -3.0703976750373840e-02 +5.6450337171554565e-02 -9.6004538238048553e-02 -2.2072274982929230e-01 -4.1375476866960526e-03 +1.6725915670394897e-01 +2.3670588433742523e-01 -3.7519767880439758e-01 +5.9574068291112781e-04 +2.0866191387176514e+00 +1.7037096619606018e-01 +6.5619558095932007e-01 +2.0581054687500000e-01 -4.1148620843887329e-01 +1.2755781412124634e-01 +9.5241892337799072e-01 +1.2518359422683716e+00 +1.0952361822128296e+00 -8.9960135519504547e-02 -5.0880756229162216e-02 ++9.0228390693664551e-01 -1.0823003202676773e-01 +1.5816891193389893e-01 -6.4109116792678833e-01 +4.2200352996587753e-02 +1.3504280149936676e-01 +2.2318611145019531e+00 +1.4964121580123901e-01 +5.6394997984170914e-02 -2.2471547126770020e-03 -2.9191595315933228e-01 +5.1329350471496582e-01 -8.0748385190963745e-01 +2.5235477089881897e-01 +1.4373315870761871e-01 -1.6342315822839737e-02 +7.2524732351303101e-01 -7.5963836908340454e-01 -6.2272511422634125e-02 -1.7983757257461548e+00 +9.6288102865219116e-01 +7.4859458208084106e-01 +2.2991824150085449e-01 -1.7653387039899826e-03 +1.1102116107940674e+00 -9.5934426784515381e-01 +8.5379183292388916e-01 +1.7208693027496338e+00 +3.3490353822708130e-01 +3.5197514295578003e-01 ++5.6387966871261597e-01 +4.0609989315271378e-02 +5.8700656890869141e-01 +1.1989215612411499e+00 +2.0690809190273285e-01 +1.4520037174224854e-01 +1.7833678722381592e+00 +2.4562267586588860e-02 -1.5529439551755786e-03 +1.5156769752502441e-01 -2.2962193191051483e-01 -4.5012792944908142e-01 +9.7887712717056274e-01 +6.1935609579086304e-01 -5.1285469532012939e-01 -5.6241933256387711e-02 +4.2846706509590149e-01 +5.6083625555038452e-01 -1.8052670359611511e-01 +9.5499169826507568e-01 +1.0722625255584717e+00 +8.5608100891113281e-01 +4.9229997396469116e-01 +3.4569552540779114e-01 +1.6449652910232544e+00 +3.1636464595794678e-01 +1.5552981197834015e-01 +1.5618047714233398e+00 +2.4557434022426605e-01 -2.7909988164901733e-01 +-2.5227408856153488e-02 +6.7925280891358852e-03 -8.5221873596310616e-03 -4.6783997095189989e-04 +2.1475488319993019e-02 +2.8867835644632578e-03 +4.2210184037685394e-02 +6.4291694434359670e-04 +1.3722287490963936e-02 -4.5590819790959358e-03 -6.5302308648824692e-03 -2.2286348976194859e-03 -7.3106321506202221e-03 -5.5026537738740444e-03 -2.3869426921010017e-02 -1.5804014401510358e-03 +9.4235930591821671e-03 -5.0292089581489563e-03 +9.9515949841588736e-04 +6.5869204699993134e-03 +2.0632037892937660e-02 -9.1606361092999578e-04 -4.2537762783467770e-03 -8.0395229160785675e-03 -3.9589703083038330e-03 +2.2554711904376745e-04 -4.8205000348389149e-03 -9.0945875272154808e-03 +5.4113185033202171e-03 +1.1075953952968121e-03 ++1.7417770624160767e-01 -4.0229223668575287e-02 +4.6047145128250122e-01 -9.1004621982574463e-01 -7.4416518211364746e-02 +2.3426543176174164e-01 +1.5793747901916504e+00 -1.2237736582756042e-01 +1.4910872280597687e-01 +4.5358218252658844e-02 -2.5151076912879944e-01 +2.8184050321578979e-01 -5.1158499717712402e-01 +3.7776541709899902e-01 -3.1885482370853424e-02 -3.3769153058528900e-02 -7.2127304971218109e-02 +8.8425815105438232e-01 +2.0678674802184105e-02 -1.3104153871536255e+00 -2.1792354062199593e-02 +1.5569976568222046e+00 +4.3220180273056030e-01 -1.3016904592514038e+00 -3.0009365081787109e-01 +3.2529893517494202e-01 +3.1526025384664536e-02 +9.4456905126571655e-01 -1.4266319572925568e-01 +4.8495379090309143e-01 +-4.9574843049049377e-01 +2.6691950857639313e-02 -4.0789869427680969e-01 -4.5558023452758789e-01 -2.1639565005898476e-02 -4.0469595789909363e-01 -1.5745351314544678e+00 +8.0675952136516571e-02 +1.5461166203022003e-01 +6.0930907726287842e-02 +1.0698282718658447e-01 -5.2611881494522095e-01 -1.6550740599632263e-01 -5.6813292205333710e-02 -2.1225520968437195e-01 -4.4593742489814758e-01 -1.3828843832015991e-01 -1.1011983454227448e-01 -9.6598960459232330e-02 -6.5178626775741577e-01 -1.6192813217639923e-01 -9.2766767740249634e-01 -2.7915176749229431e-01 -3.2323712110519409e-01 -1.9982039928436279e-02 -3.3703488111495972e-01 -6.5649084746837616e-02 -2.0218217372894287e+00 -2.9219651222229004e-01 -1.3018406927585602e-01 ++4.9251103401184082e-01 -8.7121725082397461e-02 +8.5130169987678528e-02 +9.6962526440620422e-02 +7.9782120883464813e-02 -3.4045062959194183e-02 +1.6377160549163818e+00 +1.9997876882553101e-01 +2.2851370275020599e-01 -8.0786406993865967e-02 -1.0590063035488129e-01 +7.6197758316993713e-02 -8.7243348360061646e-02 -4.5814581215381622e-02 +1.4000245928764343e-01 -2.1818161010742188e-01 -8.0201119184494019e-02 +8.5532791912555695e-02 +1.2365285307168961e-01 -7.4288614094257355e-02 +2.4353055655956268e-01 +2.4158811569213867e-01 +1.2290992736816406e+00 +3.0012336373329163e-01 +9.2908658087253571e-02 +1.4172053337097168e-01 -3.7198325991630554e-01 +2.7218204736709595e-01 -7.7823422849178314e-02 -9.6637226641178131e-02 +-4.6841818094253540e-01 +1.7005908489227295e-01 -5.4296755790710449e-01 +2.2754096984863281e-01 -1.5194181352853775e-02 -4.9939686059951782e-01 -1.4728440046310425e+00 -9.5285558700561523e-01 -1.8690270371735096e-04 +1.3434211723506451e-02 +8.6971007287502289e-02 -3.0161961913108826e-01 +3.5969528555870056e-01 -4.8469176888465881e-01 -1.3120765984058380e-01 +2.3883371055126190e-01 -4.5547321438789368e-01 +2.6230758428573608e-01 +2.7766993641853333e-01 -3.4189659357070923e-01 -4.4736310839653015e-01 -1.3306137323379517e+00 -1.3333316147327423e-01 -2.4263903498649597e-01 -9.9412500858306885e-02 +4.4701001048088074e-01 -3.5031038522720337e-01 -2.7213785648345947e+00 -2.1192440390586853e-01 -8.4427821636199951e-01 +-3.3448636531829834e-02 +8.9835692197084427e-03 -6.5952339209616184e-03 -5.3455894812941551e-03 +1.6410067677497864e-02 +6.5088388510048389e-03 +6.6855318844318390e-02 +9.3841814668849111e-04 -9.7151109948754311e-03 +4.0276134386658669e-03 -9.5740901306271553e-03 -4.9032061360776424e-03 +7.4591850861907005e-03 -5.8736867504194379e-04 +3.2730080420151353e-04 +7.5981480767950416e-04 +6.9340672343969345e-03 -1.0156388161703944e-03 -5.9065539971925318e-05 +3.3496976830065250e-03 -5.7697235606610775e-03 -1.4045382849872112e-02 +2.2680233232676983e-03 +1.1603409424424171e-02 +3.8276310078799725e-03 -3.0227122828364372e-02 +9.1359596699476242e-03 -2.9817569884471595e-04 -1.2338858505245298e-04 -3.5347316879779100e-03 ++3.1464809179306030e-01 -4.8857383430004120e-02 -2.1987538039684296e-01 -2.6111778616905212e-01 +1.8091994524002075e-01 -1.8209226429462433e-01 +7.4240036308765411e-02 -2.7146503329277039e-01 -3.0029293149709702e-02 -1.1482884734869003e-01 -7.5120501220226288e-02 -1.1809055507183075e-01 +2.6831731200218201e-01 +5.8739922940731049e-02 +1.4310979843139648e-01 +5.0606024265289307e-01 -1.2150792032480240e-01 +2.1435607969760895e-01 +5.5021792650222778e-01 -6.3730580732226372e-03 +2.7586728334426880e-01 -4.5122686028480530e-01 +7.9343646764755249e-02 -2.3562739789485931e-01 -4.5495156198740005e-02 -3.2746738195419312e-01 +1.7539262771606445e-02 -4.2562082409858704e-01 +4.5706573128700256e-01 -1.4218541979789734e-01 ++3.6496931314468384e-01 -2.0537619292736053e-01 +2.5819087028503418e-01 +7.1379441022872925e-01 +6.7814722657203674e-02 +3.7629532814025879e-01 +8.0760020017623901e-01 +1.6809834539890289e-01 +1.7543268622830510e-03 +2.1190480887889862e-01 -1.1153786629438400e-01 +8.6404174566268921e-01 +9.1552518308162689e-02 +9.2499452829360962e-01 -1.4293928444385529e-01 -2.1640296280384064e-01 +3.5960590839385986e-01 -2.9521626234054565e-01 -2.4126714468002319e-01 +1.3970802724361420e-01 -1.4264649152755737e-01 +9.9740475416183472e-01 -5.0068593025207520e-01 +6.7435383796691895e-01 -7.3690897226333618e-01 -1.4745153486728668e-01 +1.5310531482100487e-02 +1.2325330972671509e+00 +4.5714557170867920e-02 +4.6030706167221069e-01 ++9.2886157333850861e-02 -1.1922582238912582e-01 -4.9895313382148743e-01 -1.9985504448413849e-01 -6.1947335489094257e-03 +5.7205015420913696e-01 +7.8876090049743652e-01 +2.5913164019584656e-01 +3.1355875730514526e-01 -3.6606261134147644e-01 +2.5535365939140320e-01 +1.5164694190025330e-01 -1.8307344615459442e-01 +2.6586732268333435e-01 +1.4935271441936493e-01 -3.5986623167991638e-01 +3.0458036065101624e-01 -1.0690507292747498e-01 -3.5260570049285889e-01 +3.0534574389457703e-01 -1.0010030865669250e-01 +8.1395524740219116e-01 -2.1038036048412323e-01 -5.3777214139699936e-02 -4.8050814867019653e-01 +9.1335386037826538e-02 +2.8668665885925293e-01 +1.5066503286361694e+00 -4.2691496014595032e-01 +5.3858321905136108e-01 +-1.4088123105466366e-02 -6.1492775566875935e-03 +2.2522946528624743e-04 +8.8410768657922745e-03 -1.2607325799763203e-02 +5.5126682855188847e-03 +1.9818911328911781e-02 +8.5534679237753153e-04 -4.3872273527085781e-03 -1.3753470964729786e-02 -2.8280979022383690e-03 -2.1627312526106834e-03 +1.1933071538805962e-02 -1.0548267513513565e-02 +9.0234223753213882e-03 +4.5409213635139167e-04 +1.1314689181745052e-02 -1.1020600795745850e-02 -1.0142030077986419e-04 +1.7749603139236569e-03 +2.2967137396335602e-02 -6.7487834021449089e-03 +3.0444024596363306e-03 +1.1188144795596600e-02 -4.2400173842906952e-03 -2.6354703586548567e-03 -2.3605523165315390e-03 +1.0621706023812294e-02 +2.6744541246443987e-03 -1.5434531960636377e-03 +-2.0672981441020966e-01 +8.2184910774230957e-02 +1.7402394115924835e-01 -3.4167635440826416e-01 -5.4828312247991562e-02 -3.7911307066679001e-02 +5.0929081439971924e-01 +3.1625594943761826e-02 -3.5400679707527161e-01 +1.3837477564811707e-01 +1.2615914642810822e-01 +1.0758785530924797e-02 -2.2367040812969208e-01 +4.0047321468591690e-02 -1.8446820974349976e-01 -1.9697667658329010e-01 -6.0867007821798325e-02 +4.4389382004737854e-02 +5.1984351873397827e-01 +7.6414972543716431e-02 +1.9797277636826038e-03 -7.1104906499385834e-02 +2.0175647735595703e+00 +6.9345474243164062e-01 +5.1039654761552811e-02 -3.1801525503396988e-02 -2.4907366931438446e-01 +1.2399928271770477e-01 +4.0570212877355516e-04 -3.4516483545303345e-02 ++1.2012437731027603e-01 +2.9090836644172668e-01 -4.8961594700813293e-01 +2.8930142521858215e-01 +1.5402483940124512e-01 +1.5638862550258636e-01 +1.3026195764541626e+00 +1.0790649056434631e-01 +9.6289940178394318e-02 +1.3474942743778229e-01 -3.8193273544311523e-01 +2.0716269314289093e-01 +1.8367521464824677e-01 -4.2812656611204147e-02 -4.8012584447860718e-03 +1.8278571963310242e-01 -1.8782964348793030e-01 +3.0191963911056519e-01 -3.6237433552742004e-01 -4.5970830321311951e-01 -1.9458299875259399e-01 +1.3021967411041260e+00 -1.8262360990047455e-01 -6.5785437822341919e-01 -2.7622979879379272e-01 -5.7803769595921040e-03 -2.9666721820831299e-01 +1.4283515214920044e+00 +9.6987641882151365e-05 +1.9939766824245453e-01 +-1.7304770648479462e-01 -2.0138850808143616e-01 +2.6076278090476990e-01 +4.4358954764902592e-03 -2.7871212363243103e-01 -1.9396860897541046e-01 -5.0468033552169800e-01 -3.2618436962366104e-02 +4.5539047569036484e-02 +3.5546250641345978e-02 -4.9949545413255692e-02 -8.9463062584400177e-02 -8.0656096339225769e-02 -2.6377370953559875e-01 +1.0322146117687225e-02 -2.1701647341251373e-01 -9.3095647171139717e-03 +1.1115838587284088e-01 -5.3583115339279175e-01 +1.4199742674827576e-01 -6.1459654569625854e-01 -2.5085407495498657e-01 +9.7282171249389648e-02 -2.7957832813262939e-01 +5.2655935287475586e-02 +1.7640849947929382e-01 +3.8416877388954163e-01 -7.9046171903610229e-01 +3.1108902767300606e-02 -1.1552833020687103e-01 +-7.5884438119828701e-03 -6.2733283266425133e-04 +1.2744986452162266e-02 -4.3244853615760803e-02 +1.1466627940535545e-02 +1.5220566652715206e-02 +6.8379670381546021e-02 +9.7049679607152939e-04 +8.3337293472141027e-04 -7.1498188190162182e-03 -1.3829435221850872e-02 -8.1339543685317039e-03 +1.9301829859614372e-02 -1.7021007835865021e-02 -7.5892051681876183e-03 +9.9351792596280575e-04 +1.1096559464931488e-02 -1.0808402672410011e-02 +2.6915257330983877e-04 -3.3895706292241812e-03 +3.9948940277099609e-02 -1.2528277002274990e-02 -1.9773361273109913e-03 +2.9426328837871552e-02 +5.4721562191843987e-03 +5.1665484905242920e-02 +4.6823285520076752e-02 +2.3768465965986252e-02 +1.6680307453498244e-04 -5.3364355117082596e-03 ++2.5939819812774658e+00 +7.1734778583049774e-02 +2.7827683091163635e-01 -2.9755944013595581e-01 -5.6231677532196045e-02 +6.6687077283859253e-01 +5.3504238128662109e+00 +3.4579738974571228e-02 +9.3228295445442200e-02 -2.3696100339293480e-02 +1.0725089162588120e-01 +1.5156050920486450e+00 +1.7533695697784424e-01 +1.4719903469085693e+00 -5.9924624860286713e-02 -2.6424646377563477e-02 +1.4910707473754883e+00 +5.3463923931121826e-01 -2.4285372346639633e-02 +3.6803019046783447e-01 -4.2189949750900269e-01 +1.9239125251770020e+00 +2.6969047263264656e-02 +2.4070377647876740e-01 +1.4325764179229736e+00 -4.3420797586441040e-01 -8.4287077188491821e-02 +1.4134492874145508e+00 +8.2153409719467163e-01 +1.4257271289825439e+00 + + ++4.8718269914388657e-02 +5.1280397921800613e-02 -1.0515274107456207e-01 -5.7251038961112499e-03 +2.5530014187097549e-02 +2.5280538201332092e-01 +-1.7855012789368629e-02 -2.7597448788583279e-03 +1.8528614193201065e-02 +8.4048081189393997e-03 +4.8878509551286697e-03 -1.1067137122154236e-02 +-2.5306174159049988e-01 -4.5542544126510620e-01 -3.0863013863563538e-01 +1.2230248749256134e-01 -8.1740982830524445e-02 -7.6324820518493652e-02 ++1.5791025757789612e-01 -8.2615852355957031e-02 -3.9199030399322510e-01 -1.9035328924655914e-01 -3.2966196537017822e-01 -4.5959230512380600e-02 ++1.6459969803690910e-02 +5.4764654487371445e-03 -1.3240806758403778e-02 +3.6613764241337776e-03 -4.5153261162340641e-03 +1.1981657706201077e-02 ++2.5032436847686768e-01 +5.1723390817642212e-02 -1.1523335427045822e-01 -3.0775105580687523e-02 -1.1508050374686718e-02 -3.3497687429189682e-02 ++1.4080987311899662e-02 +9.5595102757215500e-03 -4.3282680213451385e-02 +4.8981801228364930e-05 +3.4974352456629276e-03 +1.0934604704380035e-01 ++3.1958758831024170e-01 -4.1242790222167969e-01 +1.3835957506671548e-03 +1.9787399470806122e-01 +1.4436250925064087e-01 -4.1318999137729406e-05 +-7.8926365822553635e-03 -2.8869228437542915e-02 -2.7689326088875532e-04 -3.7490714341402054e-02 +2.5341248139739037e-02 +5.5105990031734109e-04 +-8.6267190054059029e-03 +7.9606911167502403e-03 +8.0507192760705948e-03 +2.3239757865667343e-02 -6.9461385719478130e-03 +8.9885730994865298e-04 +-1.4945676084607840e-03 -2.9469688888639212e-03 +7.0819971151649952e-03 +5.3441328927874565e-03 +2.1633794531226158e-02 +5.0463057123124599e-03 ++1.1373555660247803e-01 +1.5678133070468903e-01 -3.2501840591430664e-01 -4.5751754194498062e-02 -1.9446562975645065e-02 +1.3406214118003845e-01 +-4.5630955696105957e-01 +6.9369770586490631e-02 -5.3695875406265259e-01 -4.0482807159423828e-01 -1.6789759695529938e-01 +2.3414686322212219e-01 ++2.8184825554490089e-02 +6.4447857439517975e-02 -1.0469113290309906e-01 -1.0360312880948186e-03 +4.6972345560789108e-02 +2.5881844758987427e-01 ++8.7771462276577950e-03 -2.5288416072726250e-03 -1.0541239753365517e-02 -1.9384928047657013e-02 -9.8785466980189085e-04 -3.1314610969275236e-03 +-2.2836768627166748e-01 +6.8491512537002563e-01 -1.2317761778831482e-02 -3.4806674718856812e-01 -1.8174758553504944e-01 +5.6523042730987072e-03 +-1.0423558205366135e-01 +8.1715196371078491e-02 -1.7303641140460968e-01 +4.0340252220630646e-02 +1.1804384738206863e-01 -8.3986530080437660e-03 +-3.3341920375823975e-01 -1.5960222482681274e-01 +2.2913898527622223e-01 -2.2243657708168030e-01 -4.4431155920028687e-01 +2.0166225731372833e-01 +-1.2163001298904419e-01 +6.0135596990585327e-01 +4.5694648288190365e-03 -8.2382899522781372e-01 -9.0038329362869263e-01 -4.9839001148939133e-03 +-3.1503716111183167e-01 -1.2468872219324112e-01 +1.5327152609825134e-01 +8.3698056638240814e-02 +3.9292898029088974e-02 +3.4749239683151245e-02 +-3.2114735245704651e-01 +2.2985550761222839e-01 -3.4883531928062439e-01 -4.5440492033958435e-01 -3.7103876471519470e-01 -3.3910289406776428e-01 +-1.5751658380031586e-01 -3.1974539160728455e-01 +1.6715502366423607e-02 +3.3349316567182541e-02 -2.0118977129459381e-01 -2.7216572314500809e-02 ++1.1766321258619428e-03 +7.2402417659759521e-02 +9.2022772878408432e-03 -1.8883422017097473e-01 -2.7701869606971741e-01 -2.8931684792041779e-03 +-8.4980977699160576e-03 -1.5197299420833588e-01 -5.1791906356811523e-02 -5.4501686245203018e-02 -3.5542692989110947e-02 -3.5902922973036766e-03 ++6.3685655593872070e-01 +9.4508506357669830e-02 -2.7333220839500427e-01 -5.2644416689872742e-02 -5.5399943143129349e-02 -3.7951543927192688e-01 +-2.9785081744194031e-01 -2.1770578622817993e-01 -2.7142554521560669e-01 -3.5189813375473022e-01 -2.1658948063850403e-01 -9.4562992453575134e-02 +-3.8083154708147049e-02 -2.4195717647671700e-02 -2.1490247920155525e-02 -2.4765911698341370e-01 -6.1096609570086002e-03 +1.3527723029255867e-02 +-5.6719094514846802e-01 -1.8840165436267853e-01 +7.2667652368545532e-01 +3.5026542842388153e-02 +5.1972195506095886e-03 -9.4628494977951050e-01 +-2.2089238464832306e-01 -7.9360559582710266e-02 -4.5122358947992325e-02 -4.8103030771017075e-02 -1.0051660239696503e-01 +1.7232533544301987e-02 ++2.8489297628402710e-01 -2.5881674885749817e-01 -3.7712398171424866e-01 +3.2797567546367645e-02 -1.4035736024379730e-01 +3.1092634797096252e-01 + + +[biases per layer] ++0.0000000000000000e+00 +0.0000000000000000e+00 +0.0000000000000000e+00 ++5.7850396260619164e-03 -5.4800868034362793e-01 +7.0601208135485649e-03 +4.4343668222427368e-01 +9.5969978719949722e-03 -1.8918423652648926e+00 -5.9042316861450672e-03 -7.0072931051254272e-01 -3.7168869376182556e-01 +2.7316311374306679e-02 +9.8313717171549797e-03 -4.3344125151634216e-02 +3.4073707461357117e-01 +6.2903217040002346e-03 +6.4147775992751122e-03 -5.8323685079813004e-03 +6.0578244738280773e-03 -4.7514703869819641e-01 +1.3792721927165985e-01 +5.8732479810714722e-03 +4.2972606420516968e-01 -5.8087822981178761e-03 +6.9927662611007690e-02 +6.5745734609663486e-03 +5.7183597236871719e-03 -2.0756023004651070e-02 +8.2162462174892426e-02 -3.1270492076873779e-01 -4.9186524003744125e-02 +1.0777912102639675e-02 +7.7938484027981758e-03 +4.5307301916182041e-03 -2.4378831684589386e-01 -2.6500603184103966e-02 -3.5185754299163818e+00 -5.5729215964674950e-03 +2.8386363387107849e-01 -5.9977006912231445e-01 -3.2172240316867828e-02 +2.8363862633705139e-01 -7.1090161800384521e-03 +1.9982965663075447e-02 -2.2212673723697662e-01 -4.8118641972541809e-01 -6.8406895734369755e-03 +2.1139304339885712e-01 -3.5522702336311340e-01 -4.7585010528564453e-01 -6.0312664136290550e-03 +3.3170813322067261e-01 +-3.7559503316879272e-01 +5.0203863531351089e-02 -6.7103123664855957e-01 -9.5661211013793945e-01 -3.7905260920524597e-02 -8.4884636104106903e-02 -1.4869323968887329e+00 -1.1877594888210297e-01 +9.2768125236034393e-02 -4.6068467199802399e-02 -4.6287722885608673e-02 +2.1052359044551849e-01 -1.0061993598937988e+00 -2.6615330949425697e-02 +2.9844671487808228e-02 -1.6860149800777435e-01 +4.1984126437455416e-04 -1.1137908697128296e+00 -3.0047450214624405e-02 -1.0990808010101318e+00 -9.0412914752960205e-01 -1.0024057626724243e+00 -5.0296580791473389e-01 -3.8795295357704163e-01 -1.4703199863433838e+00 -1.0035289525985718e+00 -6.4480721950531006e-01 -1.5599024295806885e+00 -1.0307478904724121e-01 +1.0781782865524292e-01 ++1.0000430047512054e-01 +1.5528109669685364e-01 +1.9897127151489258e-01 +1.2465928494930267e-01 +1.2603196501731873e-01 +1.1598975211381912e-01 diff --git a/TestCases/nicf/datadriven/datadriven_nozzle.cfg b/TestCases/nicf/datadriven/datadriven_nozzle.cfg new file mode 100644 index 000000000000..700f1c38865b --- /dev/null +++ b/TestCases/nicf/datadriven/datadriven_nozzle.cfg @@ -0,0 +1,127 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Non-ideal compressible fluid flow in a converging- % +% diverging supersonic nozzle using a multi-layer perceptron % +% for thermodynamic state calculations. % +% Author: Evert Bunschoten % +% Institution: Delft University of Technology % +% Date: 2022.10.8 % +% File Version 7.4.0 Blackbird % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +SOLVER= RANS +KIND_TURB_MODEL= SST +MATH_PROBLEM= DIRECT +RESTART_SOL= NO +SYSTEM_MEASUREMENTS= SI +% +% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% +% +% Mach number (non-dimensional, based on the free-stream values) +MACH_NUMBER= 1E-9 +AOA= 0.0 +SIDESLIP_ANGLE= 0.0 +INIT_OPTION= TD_CONDITIONS +FREESTREAM_OPTION= TEMPERATURE_FS +FREESTREAM_PRESSURE= 250000.0 +% +% Free-stream temperature (288.15 K, 518.67 R by default) +FREESTREAM_TEMPERATURE= 400.0 +FREESTREAM_DENSITY= 2.0 +REF_DIMENSIONALIZATION= DIMENSIONAL + +% ---- DATADRIVEN FLUID MODEL DEFINITION -------% +% +FLUID_MODEL = DATADRIVEN_FLUID +INTERPOLATION_METHOD = MLP +FILENAMES_INTERPOLATOR = (MLP_air.mlp) +DATADRIVEN_NEWTON_RELAXATION = 0.8 + +% --------------------------- VISCOSITY MODEL ---------------------------------% +VISCOSITY_MODEL= CONSTANT_VISCOSITY +MU_CONSTANT= 1.21409E-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 ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 10.0 +CFL_ADAPT= YES +CFL_ADAPT_PARAM= ( 0.1, 2.0, 10.0, 1000.0 ) +MAX_DELTA_TIME= 1E6 + +% ----------- SLOPE LIMITER AND DISSIPATION SENSOR DEFINITION -----------------% +MUSCL_FLOW= NO +SLOPE_LIMITER_FLOW= NONE +MUSCL_TURB= NO + +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ILU_FILL_IN= 0 +LINEAR_SOLVER_ERROR= 1E-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 +ENTROPY_FIX_COEFF= 0.1 +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +TIME_DISCRE_TURB= EULER_IMPLICIT +CFL_REDUCTION_TURB= 1.0 + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +% Number of total iterations +ITER= 10 +CONV_RESIDUAL_MINVAL= -24 +CONV_STARTITER= 10 + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +MESH_FILENAME= ../coolprop/coolprop_nozzle.su2 +% +% Mesh input file format (SU2, CGNS) +MESH_FORMAT= SU2 +% +% Mesh output file +MESH_OUT_FILENAME= mesh_out.su2 +% +% Restart flow input file +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 +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow +% +% Writing solution file frequency +OUTPUT_WRT_FREQ= 500 +% +% Screen output +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_TKE, RMS_DISSIPATION, LIFT, DRAG) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 0a27b9fa7d26..94deb08de2fd 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -998,6 +998,14 @@ def main(): coolprop_fluidModel.test_vals = [-4.525459, -1.578697, 3.443116, 0.000000, 0.000000] test_list.append(coolprop_fluidModel) + # Rarefaction Q1D nozzle, include CoolProp fluid model + datadriven_fluidModel = TestCase('datadriven_fluidModel') + datadriven_fluidModel.cfg_dir = "nicf/datadriven" + datadriven_fluidModel.cfg_file = "datadriven_nozzle.cfg" + datadriven_fluidModel.test_iter = 50 + datadriven_fluidModel.test_vals = [-2.623890, 0.145236, 4.688439, 0.000000, 0.000000] + test_list.append(datadriven_fluidModel) + # Rarefaction Q1D nozzle, include CoolProp transport model coolprop_transportModel = TestCase('coolprop_transportModel') coolprop_transportModel.cfg_dir = "nicf/coolprop" diff --git a/UnitTests/Common/toolboxes/multilayer_perceptron/CLookUp_ANN_tests.cpp b/UnitTests/Common/toolboxes/multilayer_perceptron/CLookUp_ANN_tests.cpp new file mode 100644 index 000000000000..a495ea3358e0 --- /dev/null +++ b/UnitTests/Common/toolboxes/multilayer_perceptron/CLookUp_ANN_tests.cpp @@ -0,0 +1,77 @@ +/*! + * \file CLookUp_ANN_tests.cpp + * \brief Unit tests for CLookUp_ANN and CIOMap classes. + * \author E.C.Bunschoten + * \version 7.5.1 "Blackbird" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2023, 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 "../../../../Common/include/CConfig.hpp" +#if defined(HAVE_MLPCPP) +#include "../../../../subprojects/MLPCpp/include/CLookUp_ANN.hpp" +#define USE_MLPCPP +#endif +#include + +#ifdef USE_MLPCPP +TEST_CASE("LookUp ANN test", "[LookUpANN]") { + std::string MLP_input_files[] = {"src/SU2/UnitTests/Common/toolboxes/multilayer_perceptron/simple_mlp.mlp"}; + unsigned short n_MLPs = 1; + MLPToolbox::CLookUp_ANN ANN(n_MLPs, MLP_input_files); + std::vector MLP_input_names, MLP_output_names; + std::vector MLP_inputs; + std::vector MLP_outputs; + su2double x, y, z; + + /*--- Define MLP inputs and outputs ---*/ + MLP_input_names.resize(2); + MLP_input_names[0] = "x"; + MLP_input_names[1] = "y"; + MLP_inputs.resize(2); + + MLP_outputs.resize(1); + MLP_output_names.resize(1); + MLP_output_names[0] = "z"; + MLP_outputs[0] = &z; + + /*--- Generate input-output map ---*/ + MLPToolbox::CIOMap iomap(MLP_input_names, MLP_output_names); + ANN.PairVariableswithMLPs(iomap); + /*--- MLP evaluation on point in the middle of the training data range ---*/ + x = 1.0; + y = -0.5; + + MLP_inputs[0] = x; + MLP_inputs[1] = y; + ANN.PredictANN(&iomap, MLP_inputs, MLP_outputs); + CHECK(z == Approx(0.344829)); + + /*--- MLP evaluation on point outside the training data range ---*/ + x = 3.0; + y = -10; + MLP_inputs[0] = x; + MLP_inputs[1] = y; + ANN.PredictANN(&iomap, MLP_inputs, MLP_outputs); + CHECK(z == Approx(0.012737)); +} +#endif diff --git a/UnitTests/Common/toolboxes/multilayer_perceptron/simple_mlp.mlp b/UnitTests/Common/toolboxes/multilayer_perceptron/simple_mlp.mlp new file mode 100644 index 000000000000..5336c8d60471 --- /dev/null +++ b/UnitTests/Common/toolboxes/multilayer_perceptron/simple_mlp.mlp @@ -0,0 +1,47 @@ +
+ +[number of layers] +3 + +[neurons per layer] +2 +4 +1 + +[activation function] +linear +elu +linear + +[input names] +x +y + +[input normalization] ++0.0000000000000000e+00 +2.0000000000000000e+00 +-1.0000000000000000e+00 +0.0000000000000000e+00 + +[output names] +z + +[output normalization] +-1.0000000000000000e+00 +9.9998769302960888e-01 + +
+ +[weights per layer] + +-4.1729342937469482e-01 -2.2465672492980957e+00 +1.1258139610290527e+00 -7.0158332586288452e-01 ++1.1477893590927124e+00 +2.5089375674724579e-02 +2.6767715811729431e-01 +1.0031684637069702e+00 + + ++2.5062826275825500e-01 +-6.2471812963485718e-01 +-2.0578651130199432e-01 ++2.6085931062698364e-01 + + +[biases per layer] ++0.0000000000000000e+00 +0.0000000000000000e+00 +0.0000000000000000e+00 ++7.5714819133281708e-02 +7.7316933870315552e-01 -4.4279521703720093e-01 +4.1041103005409241e-01 ++2.8878501057624817e-01 diff --git a/UnitTests/meson.build b/UnitTests/meson.build index 3875cf1b5768..1c806b67ca43 100644 --- a/UnitTests/meson.build +++ b/UnitTests/meson.build @@ -12,6 +12,7 @@ su2_cfd_tests = files(['Common/geometry/primal_grid/CPrimalGrid_tests.cpp', 'Common/vectorization.cpp', 'Common/toolboxes/ndflattener_tests.cpp', 'Common/containers/CLookupTable_tests.cpp', + 'Common/toolboxes/multilayer_perceptron/CLookUp_ANN_tests.cpp', 'SU2_CFD/numerics/CNumerics_tests.cpp', 'SU2_CFD/gradients.cpp', 'SU2_CFD/windowing.cpp']) diff --git a/config_template.cfg b/config_template.cfg index e36c6d9cfc35..45f33fede272 100644 --- a/config_template.cfg +++ b/config_template.cfg @@ -317,7 +317,7 @@ SEMI_SPAN= 0.0 % ---- NONEQUILIBRIUM GAS, IDEAL GAS, POLYTROPIC, VAN DER WAALS AND PENG ROBINSON CONSTANTS, CoolProp library -------% % % Fluid model (STANDARD_AIR, IDEAL_GAS, VW_GAS, PR_GAS, -% CONSTANT_DENSITY, INC_IDEAL_GAS, INC_IDEAL_GAS_POLY, MUTATIONPP, SU2_NONEQ, FLUID_MIXTURE, COOLPROP, FLUID_FLAMELET) +% CONSTANT_DENSITY, INC_IDEAL_GAS, INC_IDEAL_GAS_POLY, MUTATIONPP, SU2_NONEQ, FLUID_MIXTURE, COOLPROP, FLUID_FLAMELET, DATADRIVEN_FLUID) FLUID_MODEL= STANDARD_AIR % To find all available fluid name for CoolProp library, clikc the following link: % http://www.coolprop.org/fluid_properties/PurePseudoPure.html#list-of-fluids @@ -368,6 +368,21 @@ GAS_COMPOSITION= (0.77, 0.23, 0.0, 0.0, 0.0) % % Freeze chemical reactions FROZEN_MIXTURE= NO + +% +% Datadriven fluid model +% For data-driven fluid models, an interpolation algorithm is used to retrieve the thermodynamic state for a given density and internal energy + +% Interpolation method for thermodynamic state calculation (MLP for multi-layer perceptron, LUT for 2D, unstructured look-up table) +INTERPOLATION_METHOD= MLP + +% Name of the input file containing the information required for the interpolator to function +% See https://github.com/EvertBunschoten/MLPCpp for more information. +FILENAME_INTERPOLATOR= MLP_collection.mlp + +% Relaxation factor for the Newton solvers in the data-driven fluid model +DATADRIVEN_NEWTON_RELAXATION= 0.8 + % % NEMO Inlet Options INLET_TEMPERATURE_VE = 288.15 diff --git a/meson.build b/meson.build index 2aa544f949c4..cbfdacc0e125 100644 --- a/meson.build +++ b/meson.build @@ -259,6 +259,9 @@ if get_option('enable-coolprop') endif endif +if get_option('enable-mlpcpp') + su2_cpp_args += '-DHAVE_MLPCPP' +endif if omp and get_option('enable-autodiff') py = find_program('python3','python') @@ -325,7 +328,7 @@ message('''--------------------------------------------------------------------- '''.format(get_option('prefix')+'/bin', meson.source_root(), get_option('enable-tecio'), get_option('enable-cgns'), get_option('enable-autodiff'), get_option('enable-directdiff'), get_option('enable-pywrapper'), get_option('enable-mkl'), get_option('enable-openblas'), get_option('enable-pastix'), get_option('enable-mixedprec'), get_option('enable-librom'), get_option('enable-coolprop'), - meson.build_root().startswith(meson.source_root()) ? meson.build_root().split('/')[-1] : meson.build_root())) + get_option('enable-mlpcpp'), meson.build_root().startswith(meson.source_root()) ? meson.build_root().split('/')[-1] : meson.build_root())) if get_option('enable-mpp') message(''' To run SU2 with Mutation++ library, add these lines to your .bashrc file: diff --git a/meson_options.txt b/meson_options.txt index acb2f627d268..f31f9a0fc572 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -19,6 +19,7 @@ option('enable-mixedprec', type : 'boolean', value : false, description: 'use si option('extra-deps', type : 'string', value : '', description: 'comma-separated list of extra (custom) dependencies to add for compilation') option('enable-mpp', type : 'boolean', value : false, description: 'enable Mutation++ support') option('enable-coolprop', type : 'boolean', value : false, description: 'enable CoolProp support') +option('enable-mlpcpp', type : 'boolean', value : false, description: 'enable MLPCpp support') option('opdi-backend', type : 'combo', choices : ['auto', 'macro', 'ompt'], value : 'auto', description: 'OpDiLib backend choice') option('codi-tape', type : 'combo', choices : ['JacobianLinear', 'JacobianIndex'], value : 'JacobianLinear', description: 'CoDiPack tape choice') option('opdi-shared-read-opt', type : 'boolean', value : true, description : 'OpDiLib shared reading optimization') diff --git a/meson_scripts/init.py b/meson_scripts/init.py index 231c091cbb69..372e77bc228a 100755 --- a/meson_scripts/init.py +++ b/meson_scripts/init.py @@ -48,6 +48,7 @@ def init_submodules( own_mpp=True, own_cool=True, own_mel=True, + own_mlpcpp=True, ): cur_dir = sys.path[0] @@ -70,6 +71,8 @@ def init_submodules( github_repo_coolprop = "https://github.com/CoolProp/CoolProp" sha_version_mel = "2484cd3258ef800a10e361016cb341834ee7930b" github_repo_mel = "https://github.com/pcarruscag/MEL" + sha_version_mlpcpp = "a80115c6f4779cc168d1464cf32aead61559c9ea" + github_repo_mlpcpp = "https://github.com/EvertBunschoten/MLPCpp" medi_name = "MeDiPack" codi_name = "CoDiPack" @@ -79,6 +82,8 @@ def init_submodules( mpp_name = "Mutationpp" coolprop_name = "CoolProp" mel_name = "MEL" + mlpcpp_name = "MLPCpp" + base_path = cur_dir + os.path.sep + "externals" + os.path.sep alt_name_medi = base_path + "medi" alt_name_codi = base_path + "codi" @@ -88,6 +93,7 @@ def init_submodules( alt_name_mel = base_path + "mel" alt_name_mpp = cur_dir + os.path.sep + "subprojects" + os.path.sep + "Mutationpp" alt_name_coolprop = cur_dir + os.path.sep + "subprojects" + os.path.sep + "CoolProp" + alt_name_mlpcpp = cur_dir + os.path.sep + "subprojects" + os.path.sep + "MLPCpp" if method == "auto": is_git = is_git_directory(cur_dir) @@ -117,6 +123,8 @@ def init_submodules( submodule_status(alt_name_coolprop, sha_version_coolprop) if own_mel: submodule_status(alt_name_mel, sha_version_mel) + if own_mlpcpp: + submodule_status(alt_name_mlpcpp, sha_version_mlpcpp) # Otherwise download the zip file from git else: if own_codi: @@ -149,6 +157,10 @@ def init_submodules( ) if own_mel: download_module(mel_name, alt_name_mel, github_repo_mel, sha_version_mel) + if own_mlpcpp: + download_module( + mlpcpp_name, alt_name_mlpcpp, github_repo_mlpcpp, sha_version_mlpcpp + ) def is_git_directory(path="."): diff --git a/preconfigure.py b/preconfigure.py index 9085809e1dfd..c6dc0220a5f7 100755 --- a/preconfigure.py +++ b/preconfigure.py @@ -81,6 +81,7 @@ def run( own_mpp=True, own_cool=True, own_mel=True, + own_mlpcpp=True, ): # Set up the build environment, i.e. clone or download submodules @@ -93,6 +94,7 @@ def run( own_mpp=own_mpp, own_cool=own_cool, own_mel=own_mel, + own_mlpcpp=own_mlpcpp, ) if own_meson: @@ -135,6 +137,11 @@ def run( parser.add_argument( "--no-mel", help="do not download own copy of MEL", action="store_false" ) + parser.add_argument( + "--no-mlpcpp", + help="do not download copy of MLpCpp", + action="store_false", + ) args = parser.parse_args() run( @@ -145,4 +152,5 @@ def run( own_mpp=args.no_mpp, own_cool=args.no_coolprop, own_mel=args.no_mel, + own_mlpcpp=args.no_mlpcpp, ) diff --git a/subprojects/MLPCpp b/subprojects/MLPCpp new file mode 160000 index 000000000000..a80115c6f477 --- /dev/null +++ b/subprojects/MLPCpp @@ -0,0 +1 @@ +Subproject commit a80115c6f4779cc168d1464cf32aead61559c9ea