Skip to content

Commit

Permalink
Integrating Keras capabilities to OPM
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalmanifold committed Nov 5, 2024
1 parent eb6e6ca commit 9dabbe9
Show file tree
Hide file tree
Showing 30 changed files with 2,281 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ list (APPEND MAIN_SOURCE_FILES
opm/material/fluidsystems/blackoilpvt/WaterPvtThermal.cpp
opm/material/fluidsystems/blackoilpvt/WetGasPvt.cpp
opm/material/fluidsystems/blackoilpvt/WetHumidGasPvt.cpp
opm/ml/ml_model.cpp
)
if(ENABLE_ECL_INPUT)
list(APPEND MAIN_SOURCE_FILES
Expand Down Expand Up @@ -474,6 +475,7 @@ list (APPEND TEST_SOURCE_FILES
tests/material/test_spline.cpp
tests/material/test_tabulation.cpp
tests/test_Visitor.cpp
tests/ml/ml_model_test.cpp
)

# tests that need to be linked to dune-common
Expand Down Expand Up @@ -646,6 +648,15 @@ list (APPEND TEST_DATA_FILES
tests/material/co2_unittest_below_sat.json
tests/material/h2o_unittest.json
tests/material/h2_unittest.json
tests/ml/ml_tools/models/test_dense_1x1.model
tests/ml/ml_tools/models/test_dense_2x2.model
tests/ml/ml_tools/models/test_dense_10x1.model
tests/ml/ml_tools/models/test_dense_10x10.model
tests/ml/ml_tools/models/test_dense_10x10x10.model
tests/ml/ml_tools/models/test_dense_relu_10.model
tests/ml/ml_tools/models/test_dense_tanh_10.model
tests/ml/ml_tools/models/test_relu_10.model
tests/ml/ml_tools/models/test_scalingdense_10x1.model
)
if(ENABLE_ECL_OUTPUT)
list (APPEND TEST_DATA_FILES
Expand Down Expand Up @@ -1054,6 +1065,7 @@ list( APPEND PUBLIC_HEADER_FILES
opm/material/thermal/SomertonThermalConductionLaw.hpp
opm/material/thermal/EclSpecrockLaw.hpp
opm/material/thermal/NullSolidEnergyLaw.hpp
opm/ml/ml_model.hpp
)

if(ENABLE_ECL_INPUT)
Expand Down
22 changes: 22 additions & 0 deletions opm/ml/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
These ML modules are heavily modifiying and extending the previous work done in Kerasify by Maevskikh and Rose. Kerasify is a library for running trained Keras models from a C++ platform. Our implementation is also compliant with the automatic differentiation approach used in OPM. The implementation works with Python v.3.9.0 and above (up to <=3.12.0).


-Unit tests are generated by:

$ python3 generateunittests.py


-To compile run the unit tests:

$ make ml_model_test
$ ./bin/ml_model_test
TEST tensor_test
TEST dense_1x1
TEST dense_10x1
TEST dense_2x2
TEST dense_10x10
TEST dense_10x10x10
TEST relu_10
TEST dense_relu_10
TEST dense_tanh_10
TEST scalingdense_10x1
Loading

0 comments on commit 9dabbe9

Please sign in to comment.