- 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
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
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.
This seems to be a more stable approach as it does not produce
```
/usr/bin/python3.9: can't open file
'/home/mblatt/src/dune/opm-2.9/opm-common//install.py': [Errno 2] No such file or directory
```
for rebuilds after failed attempts.
Convert the Python opm package from a regular package to a namespace
package such that opm-simulators and opm-common can contribute to the
package from different filesystem paths. In this way, the two packages
opm.simulators and opm.io (in opm-common) can have a different parent
filesystem path.
Instead of always using site-packages we query the sitepackages path
from Python. If it matches dist-packages then we use dist-packages if
we install below /usr, otherwise site-packages is used.
This will also make sure that the Python files end up in the same
location as for the ones of opm-common. This should make using them
easier.