Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
01bb85b
Added MLP classes to numerics folder
EvertBunschoten Sep 12, 2022
f5d0267
Added error checking in MLP file reader and fixed bug with input-outp…
EvertBunschoten Sep 13, 2022
9370536
Merge branch 'develop' into feature_multilayer_perceptron
EvertBunschoten Sep 13, 2022
a8c1389
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Sep 13, 2022
438e8c6
Moved MLP classes to separate library in its own namespace. Added a t…
EvertBunschoten Sep 15, 2022
2016118
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Sep 15, 2022
cd64c3b
Merge branch 'feature_multilayer_perceptron' of https://github.com/su…
EvertBunschoten Sep 15, 2022
9e32ee0
fixed build bug
EvertBunschoten Sep 15, 2022
b233278
Fixed unused-variable error
EvertBunschoten Sep 15, 2022
47b456c
Fixed unused-variable error
EvertBunschoten Sep 15, 2022
88f0012
Added more comments to CIOMap and CLookUp_ANN classes
EvertBunschoten Sep 26, 2022
76b1411
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Oct 13, 2022
04813b1
Added a MLP fluid model template class
EvertBunschoten Oct 19, 2022
7e78918
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Oct 19, 2022
112876d
Merged with develop, migrated MLP fluid model to more general datadri…
EvertBunschoten Nov 18, 2022
e8a3a93
Bug fix
EvertBunschoten Nov 21, 2022
0a56534
Allowed for LUT alongside MLP evaluation in datadriven fluid model
EvertBunschoten Nov 21, 2022
76194ec
Improved Newton solver behavior in data driven fluid model
EvertBunschoten Nov 22, 2022
b81ddf7
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Nov 23, 2022
68d02ae
Added unit test for multi-layer perceptron
EvertBunschoten Nov 23, 2022
52ae8ee
Merge branch 'feature_multilayer_perceptron' of https://github.com/su…
EvertBunschoten Nov 23, 2022
1a40d51
Added MLP test case configuration file and unit test
EvertBunschoten Nov 23, 2022
054a8ff
Replaced std::vector by su2vector where possible
EvertBunschoten Nov 25, 2022
ee77088
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Dec 1, 2022
d0c7cab
Merge branch 'feature_multilayer_perceptron' of https://github.com/su…
EvertBunschoten Dec 1, 2022
b090223
Added MLP-driven fluid model test case and fixed build error
EvertBunschoten Dec 1, 2022
2f82b5d
Added MLP-driven fluid model test case
EvertBunschoten Dec 1, 2022
7eb2180
Changed test case branch in runTests.sh to allow access to MLP fluid …
EvertBunschoten Dec 1, 2022
f4323a3
Added range check to MLP evaluation
EvertBunschoten Dec 1, 2022
3a4938d
changed regression branch to feature_multilayer_perceptron
EvertBunschoten Dec 1, 2022
76d239c
MLP evaluation is based on query data inclusion, addition of Newton s…
EvertBunschoten Dec 2, 2022
592204c
Merge branch 'feature_multilayer_perceptron' of https://github.com/su…
EvertBunschoten Dec 2, 2022
55bab28
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Dec 5, 2022
687bb20
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Dec 8, 2022
ec8692d
Merged with develop and fixed build error
EvertBunschoten Dec 13, 2022
728e6f1
Added more comments, fixed some style inconsistencies, and set auto v…
EvertBunschoten Dec 13, 2022
07094df
Pulled develop
EvertBunschoten Dec 13, 2022
1f1b772
Merge branch 'feature_multilayer_perceptron' of https://github.com/su…
EvertBunschoten Dec 13, 2022
513ee66
Fixed bug in determining the nearest MLP to a query point outside the…
EvertBunschoten Dec 14, 2022
143c20d
Merge branch 'feature_multilayer_perceptron' of https://github.com/su…
EvertBunschoten Dec 14, 2022
d0cc4d3
Made commenting more consistent, changed datadriven input file option…
EvertBunschoten Dec 14, 2022
0e23ce6
Removed necessity to provide a separate MLP collection input file and…
EvertBunschoten Dec 19, 2022
bbb7d85
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Dec 22, 2022
62be048
Improved clang formatting
EvertBunschoten Dec 22, 2022
d909894
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Jan 3, 2023
cc29f49
added clang formatting to multilayer-perceptron files
EvertBunschoten Jan 3, 2023
ae130fa
added clang formatting to multilayer-perceptron files
EvertBunschoten Jan 3, 2023
027e23b
added clang formatting to multilayer-perceptron files
EvertBunschoten Jan 3, 2023
10280a8
Merged with develop
EvertBunschoten Jan 13, 2023
3d45fc5
Merge branch 'feature_multilayer_perceptron' of https://github.com/su…
EvertBunschoten Jan 13, 2023
720d4ed
changed testcases branch for regression tests
EvertBunschoten Jan 13, 2023
1e0a2ef
Added datadriven fluid test case to regression tests
EvertBunschoten Jan 13, 2023
2e0cb94
Changed MLP file name in datadriven config file to be compatible with…
EvertBunschoten Jan 13, 2023
882e4c3
Changed regression values
EvertBunschoten Jan 13, 2023
80815e2
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Jan 23, 2023
014e2d0
Updated tutorials branch for datadriven NICFD example
EvertBunschoten Jan 23, 2023
30831d6
Fixed bug in computation of secondary flow variables
EvertBunschoten Jan 25, 2023
2de9889
Reduced tolerances in Newton solvers to reduce solution variations at…
EvertBunschoten Jan 25, 2023
1eb3a6e
Reduced tolerances in datadriven fluid model for better convergence a…
EvertBunschoten Jan 27, 2023
5fac4f4
Fixed build errors
EvertBunschoten Jan 27, 2023
830ff14
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Jan 27, 2023
ad2f0d7
Updated regression test values
EvertBunschoten Jan 27, 2023
2423abb
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Jan 30, 2023
2a03b96
Merge branch 'feature_multilayer_perceptron' of https://github.com/su…
EvertBunschoten Jan 30, 2023
b8d83a0
Added function to neural network class displaying information on the …
EvertBunschoten Feb 1, 2023
f1140ba
Carried everything to do with the heat solver over from Develop as it…
EvertBunschoten Feb 3, 2023
27c62c5
Updated test case configuration files
EvertBunschoten Feb 3, 2023
ed2cd66
Pulled develop
EvertBunschoten Feb 7, 2023
b60d1fc
Pulled develop
EvertBunschoten Feb 8, 2023
c60442e
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Feb 8, 2023
44f3f45
Merge branch 'feature_multilayer_perceptron' of https://github.com/su…
EvertBunschoten Feb 8, 2023
4907fc5
pulled develop
EvertBunschoten Feb 8, 2023
c9816d5
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Feb 13, 2023
26dc856
pulled develop
EvertBunschoten Feb 13, 2023
3b44b82
Pulled changes from develop
EvertBunschoten Feb 14, 2023
d770955
Updated AD regression file
EvertBunschoten Feb 14, 2023
a857dbc
Added datadriven fluid model test case back
EvertBunschoten Feb 14, 2023
5fc6b34
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Feb 14, 2023
f14002d
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Feb 16, 2023
42f7690
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Feb 20, 2023
3742d96
Merge branch 'develop' into feature_multilayer_perceptron
bigfooted Feb 25, 2023
5962016
Improved MLP classes consistency and documentation
EvertBunschoten Feb 27, 2023
a615cae
Fixed bug in CLookUp_ANN_tests
EvertBunschoten Feb 27, 2023
10a09c2
Fixed Giles boundary condition when using data-driven fluid model
EvertBunschoten Feb 28, 2023
6bf394a
Fixed build error
EvertBunschoten Mar 1, 2023
78e8dc2
Merge branch 'feature_multilayer_perceptron' of https://github.com/su…
EvertBunschoten Mar 3, 2023
4a76a4c
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Mar 6, 2023
6e1f747
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Mar 7, 2023
5242067
Added elu activation function to CNeuralNetwork class as it was missing
EvertBunschoten Mar 7, 2023
f0b6155
Merge branch 'feature_multilayer_perceptron' of https://github.com/su…
EvertBunschoten Mar 7, 2023
18cd9e8
Implemented feedback from Pedro and code-scanner
EvertBunschoten Mar 7, 2023
8c35c83
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Mar 16, 2023
56d0f36
Pulled develop
EvertBunschoten Mar 16, 2023
b7f5b12
Updated submodules
EvertBunschoten Mar 16, 2023
6330b62
Further reduced MLP class dependence on SU2 code
EvertBunschoten Mar 19, 2023
df4f974
Pulled develop
EvertBunschoten Mar 20, 2023
d1992b2
Rebased with develop
EvertBunschoten Mar 20, 2023
87e5d66
Improved formatting of MLP classes
EvertBunschoten Mar 20, 2023
3535b0a
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Mar 21, 2023
b97e68c
pulled develop
EvertBunschoten Mar 21, 2023
4083d59
Pulled develop
EvertBunschoten Mar 21, 2023
2a93baa
Merge branch 'feature_multilayer_perceptron' of https://github.com/su…
EvertBunschoten Mar 21, 2023
c2f547d
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Mar 23, 2023
1c990e0
Replaced multi-layer perceptron classes with external submodule
EvertBunschoten Mar 28, 2023
bca3dd8
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Mar 28, 2023
c3d32a6
Updated submodules and fixed build error
EvertBunschoten Mar 28, 2023
f956a8f
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Mar 29, 2023
2496a35
Pulled develop
EvertBunschoten Mar 29, 2023
6a346ff
Changed sha code for MLPCpp to refer to main branch
EvertBunschoten Mar 29, 2023
ca70b57
Checkout right submodule SHA codes
EvertBunschoten Mar 29, 2023
4516eb4
Removed inclusion of CLookUp_ANN submodule in case mlpcpp is disabled
EvertBunschoten Mar 30, 2023
76b475b
Improved clang formatting and fixed build error
EvertBunschoten Mar 30, 2023
53cb6e5
Fixed clang-format using pre-commit
EvertBunschoten Mar 30, 2023
cbd296c
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Mar 30, 2023
55dc1b5
Pulled develop
EvertBunschoten Mar 30, 2023
5303d91
Made MLPCpp submodule compatible with adjoint
EvertBunschoten Apr 1, 2023
64c2029
Fixed CLookUp_ANN unit test with new MLP class format
EvertBunschoten Apr 1, 2023
1649fb5
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Apr 2, 2023
3bf5b04
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Apr 4, 2023
26c5bf2
Pulled develop, updated MLPCpp version
EvertBunschoten Apr 4, 2023
8292429
Updated submodules
EvertBunschoten Apr 6, 2023
9ae0748
Implemented some of Pedros comments
EvertBunschoten Apr 6, 2023
8131691
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Apr 11, 2023
96ca12f
Updated submodules, pulled develop, updated test case for datadriven …
EvertBunschoten Apr 11, 2023
bec052f
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Apr 17, 2023
8ecadfe
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Apr 28, 2023
967f2f6
Updated regression.yml
EvertBunschoten Apr 28, 2023
32d7bb3
Update Common/include/CConfig.hpp
pcarruscag Apr 29, 2023
04f5e1a
Simplified Newton solver process in data-driven fluid model
EvertBunschoten May 11, 2023
9a57431
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten May 11, 2023
e248138
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten May 23, 2023
be6e95f
Made sure initial density and energy are set for all relevant boundar…
EvertBunschoten May 23, 2023
cff61ce
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten May 23, 2023
e55c0fe
Merge branch 'develop' into feature_multilayer_perceptron
bigfooted May 31, 2023
ddd855b
Pulled develop and updated submodules
EvertBunschoten Jun 13, 2023
c2b7d29
Pulled develop and updated submodules
EvertBunschoten Jun 13, 2023
b4320bc
Fixed build error
EvertBunschoten Jun 13, 2023
c6f2c46
Implemented ideal gas approximation for data-driven fluid model, such…
EvertBunschoten Jun 27, 2023
2b709d9
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Jun 27, 2023
51143a6
Fixed build error and updated submodule
EvertBunschoten Jun 27, 2023
73ce89b
Updated data-driven fluid test case
EvertBunschoten Jul 3, 2023
b27849f
Updated data-driven fluid regression test
EvertBunschoten Jul 3, 2023
b504e20
Merge branch 'develop' of https://github.com/su2code/SU2 into feature…
EvertBunschoten Jul 3, 2023
5a9354d
Merge branch 'develop' into feature_multilayer_perceptron
EvertBunschoten Jul 3, 2023
4066516
Merge branch 'feature_multilayer_perceptron' of https://github.com/su…
EvertBunschoten Jul 3, 2023
2a0fd69
Updated regression values for data-driven fluid test case
EvertBunschoten Jul 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
33 changes: 31 additions & 2 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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.
*/
Expand Down
15 changes: 15 additions & 0 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string, ENUM_FLUIDMODEL> FluidModel_Map = {
MakePair("STANDARD_AIR", STANDARD_AIR)
Expand All @@ -561,6 +562,7 @@ static const MapType<std::string, ENUM_FLUIDMODEL> 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)
};

Expand Down Expand Up @@ -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<std::string, ENUM_DATADRIVEN_METHOD> DataDrivenMethod_Map = {
MakePair("LUT", ENUM_DATADRIVEN_METHOD::LUT)
MakePair("MLP", ENUM_DATADRIVEN_METHOD::MLP)
};

/*!
* \brief types of coefficient transport model
*/
Expand Down
13 changes: 13 additions & 0 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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++) {
Expand Down
6 changes: 6 additions & 0 deletions Docs/docmain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
220 changes: 220 additions & 0 deletions SU2_CFD/include/fluid/CDataDrivenFluid.hpp
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

#pragma once

#include <vector>
#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<string> 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<su2double*> 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<su2double> 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; }
};
12 changes: 12 additions & 0 deletions SU2_CFD/include/fluid/CFluidModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
};
Loading