Commit Graph
81 Commits
Author SHA1 Message Date
Tor Harald Sandve 26d5a3497f Speedup the temperature module
- Use its own fluidstate and Evaluation class to avoid having to add an extra derivative to the main equations
- Sotre the scaling factor to avoid calling the parameter all the time
2026-02-18 11:31:27 +01:00
Arne Morten Kvarving 6cbeb653da drop old cmake compatibility
we require >= 3.23 now. fix python code to use the target
for the interpreter and reflow code while at it
2026-02-06 12:43:25 +01:00
Arne Morten Kvarving 2c91ac05ad use opm_add_target_options 2026-01-30 14:44:45 +01:00
Arne Morten Kvarving 793937ef58 add use_runpath to targets 2026-01-30 12:12:28 +01:00
Arne Morten Kvarving dec1b90fe9 add use_threads to targets 2026-01-30 09:19:02 +01:00
Arne Morten Kvarving 42742fadc1 add use_only_needed to targets 2026-01-29 15:41:58 +01:00
Arne Morten Kvarving 14e5fb8c50 add additional optimization flags to targets 2026-01-29 13:01:44 +01:00
Arne Morten Kvarving de1729fd0a add fast build flags to targets 2026-01-29 10:42:05 +01:00
Arne Morten Kvarving 64b0590688 adapt to changed use_warnings function 2026-01-29 09:48:29 +01:00
Arne Morten Kvarving 2e9eb19baa add warnings to some targets 2026-01-28 15:41:11 +01:00
Håkon Hægland 044e6a700b Add python_tests target and test fixtures for Python tests
Add CMake infrastructure to simplify building and running Python tests:

- Add `python_tests` target: builds only Python modules and test files
  Usage: `ninja python_tests`

- Add test fixtures: running `ctest -R python_basic` now automatically
  builds the required Python modules first via FIXTURES_REQUIRED

This allows one to quickly iterate on Python tests without building
unrelated C++ test binaries.
2026-01-05 08:54:17 +01:00
Arne Morten Kvarving 0e911d734b fixed: do not run python mpi tests without mpi 2025-12-03 15:05:41 +01:00
Tor Harald Sandve 288e97dc39 Make a seqential solver for temperature
Use with TEMP
2025-11-21 12:55:26 +01:00
Tor Harald Sandve 8e63489f75 Add energy module type and use it.
This also add an no_temp implementation that can be used by the standard blackoil model
to avoid storing temperature in the fluid state.
2025-10-24 16:05:32 +02:00
David Landa Marban 1fd280c68d Removing trailing spaces and adding eol at eof 2025-10-02 10:22:55 +02:00
Svenn Tveit 8eaa56885d Use docstring template for OnePhaseSimulator documentation 2025-09-23 13:20:42 +02:00
Svenn Tveit 46559c532f Adressed review comments 2025-09-23 12:54:28 +02:00
Svenn Tveit 5153cd6fc0 Add OnePhaseSimulator to custom Python target 2025-09-23 12:52:46 +02:00
Svenn Tveit d0c08c4382 Python wrapper of single phase (water) simulator 2025-09-23 12:52:46 +02:00
Arne Morten Kvarving fafa4d8a19 Merge pull request #6418 from hakonhagland/docstring-template-refactor
Add support for Python docstring.json template format
2025-09-23 08:36:05 +02:00
David Landa Marban d3101a9c80 BIOFILM effects for gas-water systems 2025-09-18 11:15:48 +02:00
Håkon Hægland 2f6bf952e1 Use new docstring format for python modules 2025-09-17 15:35:17 +02:00
Håkon Hægland 7552aec2c0 Update CMakeLists.txt to pass simulator type to docstring generator
- Add 'BlackOil' as 5th parameter to generate_docstring_hpp.py
- Prepares for template-based docstring generation
- Will work with updated opm-common generate_docstring_hpp.py script
2025-09-17 14:47:04 +02:00
Håkon Hægland 3c6313b619 Custom target to build all simulator modules
Create a convenience target to build all Python simulator modules.
2025-09-17 10:06:50 +02:00
Svenn Tveit 753fcc2ec4 Cleaned up formatting 2025-09-17 10:06:50 +02:00
Svenn Tveit 32dd09c78f Add Python gas-water simulator and refactor to template base class
Extend the Python blackoil simulator to support two-phase gas-water
simulations by extracting common functionality into a template base
class and implementing proper module separation.

- Extract PyBaseSimulator<TypeTag> template base class containing all
  common simulator functionality (20+ methods including advance, run,
  step, property access, and MPI handling)
- Add PyGasWaterSimulator for two-phase gas-water simulations using
  FlowGasWaterProblem TypeTag with oil phase disabled
- Split Python modules to avoid ODR violations:
  - BlackOil.so for PyBlackOilSimulator (FlowProblemTPFA)
  - GasWater.so for PyGasWaterSimulator (FlowGasWaterProblem)
- Implement proper template instantiation control with explicit
  instantiations per module

- Eliminate ~400 lines of code duplication between simulators
- Clean inheritance hierarchy: derived classes contain only constructors
- Type-safe specialization through OPM's TypeTag property system
- Separate docstring generation for each simulator type
- Independent build targets with shared infrastructure

- Update CMakeLists.txt to support multiple pybind11 modules
- Add docstrings_gw_simulators.json for gas-water simulator documentation
- Remove centralized Pybind11Exporter.cpp in favor of distributed exports
- Implement proper build dependencies and custom targets

This establishes a scalable foundation for extending OPM's Python
bindings to support additional simulator types (thermal, polymer,
solvent) while maintaining type safety and avoiding symbol conflicts.

Files changed: 21 files, 915 insertions, 428 deletions
2025-09-17 10:06:44 +02:00
Bård Skaflestad 54663f96a4 Add Missing Headers to Python Simulator
These were originally obtained through transitive includes,
especially from Main.hpp, but that's not a stable condition if the
set of transitive includes changes.
2025-01-30 12:17:39 +01:00
Arne Morten Kvarving 4d5a67fa82 added: ability to pass command line parameters from python 2024-11-28 09:14:53 +01:00
Arne Morten Kvarving 2353ba56a6 changed: don't store schedule keywords unless required in simulators
in the python simulator we cannot make this decision up front
since the schedule can be modified from python code so we have
to do the safe thing
2024-09-27 11:24:20 +02:00
Bård Skaflestad 03795d5b23 Merge pull request #5588 from akva2/move_python_initialization_function
Move python initialization function
2024-09-09 14:54:14 +02:00
Arne Morten Kvarving 2a9d81227b changed: subclass Main for python
move the initFlowBlackoil method into it

in particular we then avoid the FlowMainType type alias
in Main.hpp
2024-09-09 14:28:20 +02:00
Arne Morten Kvarving 8ed1149252 fix python package versioning
remove opm-models cloning
build both bindings in one build directory
2024-09-09 12:45:00 +02:00
Arne Morten Kvarving a78337fc33 fixed: make python simulator object depend on copy_python
if not building just the python binding won't end up in
a complete build
2024-09-02 08:21:36 +02:00
Arne Morten Kvarving 0203f74b3f add python packaging fluff 2024-08-30 14:28:25 +02:00
Lisa Julia Nebel 42d79ebb97 Delete almost everything of the documentation here, this will be done in a separate repository opm-python-documentation
Keep only the file docstrings.json (renamed to docstrings_simulators.json)
2024-07-10 18:02:41 +02:00
Lisa Julia Nebel fa3392fb7d Use generate_docstring_hpp.py of opm-common and delete the one here 2024-07-09 13:52:01 +02:00
Håkon Hægland 6c3f3af4b4 Docstring fixes 2024-05-02 11:24:58 +02:00
Håkon Hægland a1b7d4b5dd Allow Python bindings to setup MPI
Allows the Python bindings to control whether MPI_Init() and
MPI_Finalize() will be called when creating an OPM::Main object.
2024-05-02 11:14:07 +02:00
Arne Morten Kvarving 3475da7d8c Rename ebos_simulator members/parameters to simulator 2024-03-06 10:53:00 +01:00
Arne Morten Kvarving d5748b6c55 Drop ebos in function names 2024-03-06 10:13:01 +01:00
Håkon Hægland 8cbb1707e7 Move statements to after target is defined 2024-03-05 11:11:53 +01:00
Håkon Hægland 1c5143f02e Improve CMakeLists.txt
Add the generated .hpp file directly to pybind11 sources instead of
creating a custom target.
2024-03-05 10:48:04 +01:00
Håkon Hægland e20faa255c Add docstrings for Python bindings 2024-03-05 10:18:54 +01:00
Håkon Hægland 757c67f284 Return vectors by value
Return vectors by value instead of unique pointers to arrays.
2024-03-01 14:22:37 +01:00
Håkon Hægland 55aab60549 Get primary variables and fluid state from Python
Added methods to Python module opm.simulators.BlackOilSimulator to
access primary variables and fluid state variables.
2024-03-01 14:22:35 +01:00
Arne Morten Kvarving f8b22631b0 fixed: don't link python module to flow_libblackoil
this leads to ODR violations which causes all sorts
of havoc. this was done to reuse a trivial method,
duplicate it in the python source instead.
2024-02-29 09:24:07 +01:00
Arne Morten Kvarving 4aa6dc355f rename TTag::EclFlowProblemTPFA to TTag::FlowProblemTPFA 2024-02-23 09:27:48 +01:00
Arne Morten Kvarving b09c70213b FlowMainEbos: rename to FlowMain 2024-02-06 10:42:23 +01:00
Håkon Hægland ac927d997b Added a get_dt() method
Added a get_dt() to the opm.simulators.BlackOilSimulator Python module.
This will return the size of the previous simulator time step.
2023-09-08 19:40:42 +02:00
Håkon Hægland e2f62644ae Get cell volumes from Python
Adds a new method get_cell_volumes() to the opm.simulators Python module
that returns a python list of the cell volumes in the black oil
simulator.
2023-09-08 09:39:24 +02:00