Commit Graph
26 Commits
Author SHA1 Message Date
Svenn Tveit 116e22e58c Safe creation of OnePhaseSimulator object in tests 2025-09-23 13:20:10 +02:00
Svenn Tveit fc3e1bb73f Tests for OnePhaseSimulator 2025-09-23 12:54:27 +02:00
Arne Morten Kvarving 7679d64ed1 Merge pull request #6488 from svenn-t/fix_pygaswater_tests
Fix Python gas-water simulator test failures
2025-09-23 08:31:49 +02:00
Håkon Hægland c195df978d Refactor: Use factory fixtures for simulator creation in tests
Move simulator instantiation to factory functions that automatically
disable async ECL output. This prevents future contributors from
forgetting the --enable-async-ecl-output=false flag.

- Add create_black_oil_simulator/create_gas_water_simulator to pytest_common
- Define ENABLE_ASYNC_ECL_OUTPUT_FLAG constant
- Update all tests to use factory functions
- No functional changes, pure refactoring
2025-09-23 05:09:20 +02:00
Håkon Hægland 831354a0db Fix race condition in Python tests by disabling async ECL output
Add --enable-async-ecl-output=false to all Python simulator tests to prevent
race condition between async file writing tasklets and pushd context manager.

Problem:
- Tests use pushd() to change directory before running simulations
- Simulator dispatches async tasklets to write ECL output files
- pushd context exits before async writes complete
- Tasklets write files in wrong directory (build/python/ instead of test_data/)
- Causes confusing error messages and misplaced output files

Solution:
- Disable async ECL output during tests for deterministic behavior
- Files now created in correct locations within test_data/ directories
- Eliminates "Can not open EclFile" errors in logs
- Makes test execution predictable and synchronous
2025-09-22 20:46:10 +02:00
Svenn Tveit b79d16c3e8 Fix failures in docker tests 2025-09-19 14:18:22 +02:00
Svenn Tveit 753fcc2ec4 Cleaned up formatting 2025-09-17 10:06:50 +02:00
Svenn Tveit a69e10485b Clarify ordering and clean up doc in rest of the tests 2025-09-17 10:06:50 +02:00
Håkon Hægland b5e7ccc0b1 Clarify why test case ordering is necessary
and delete comment in code about static variables that can no longer be
reproduced.
2025-09-17 10:06:49 +02:00
Svenn Tveit 67a701ef4f Tests for PyGasWaterSimulator 2025-09-17 10:06:49 +02:00
Arne Morten Kvarving 4d5a67fa82 added: ability to pass command line parameters from python 2024-11-28 09:14:53 +01:00
hnil 6609d9fbcb changed references 2024-08-29 11:19:29 +02:00
hnil 5c0176371c -- fixed reference 2024-08-28 13:27:46 +02:00
Tor Harald Sandve 8e490e9b3f relax python tests slightly 2024-08-16 10:18:50 +02:00
Kai Bao 027c3ba0fc using one day time step for SPE1CASE1a/SPE1CASE1.DATA
to avoid time stepping change causes test failures for the python tests
2024-06-19 13:42:55 +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
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
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
Håkon Hægland 3c0498e55f Dynamically update schedule from Python
Adds some test cases that show how injection properties in Opm::Schedule
can be dynamically modified from Python.
2022-06-10 11:31:48 +02:00
Håkon Hægland 91ac3a2a32 Dynamically update schedule from Python
Adds some methods that enables Opm::Schedule to be dynamically modified
from Python. A test case in test_schedule.py illustrates the use case.
2022-05-05 13:10:39 +02:00
Håkon Hægland 5ad65c70ee Initialize blackoil simulator from schedule shared with Python.
Adds a new constructor to Main.hpp that takes shared pointers to Deck,
EclipseState, Schedule, and SummaryConfig. This makes it possible to
share these variables with Python without worrying about lifetime issues
of the underlying C++ objects. For example, a Python script can first
create an opm.io.schedule.Schedule object which is modified from Python.
Then, assume the same Python script creates an
opm.simulators.BlackOilSimulator which is initialized with the same
schedule object. Since the underlying C++ object is a shared pointer,
the Schedule object in Python may go out of scope (get deleted by Python)
without having the C++ schedule object being deleted. And the Python
BlackOilSimulator may continue to be used after the Python Schedule object
has been deleted since it still has a valid C++ schedule object.
2021-09-21 15:52:59 +02:00
Håkon Hægland b680d96198 The data directory is relative to the parent.
The test data directory is relative to the parent directory, not the
current directory.
2020-11-05 09:48:39 +01:00
Joakim Hove 68e8c4a900 Use python pushd 2020-11-04 14:24:39 +01:00
Håkon Hægland 7011a6c0b7 Restore cwd after each unittest.
Restores the original cwd after each unittest in test_basic.py. Also
simplifies add_test() in python/simulators/CMakeLists.txt such that the
Bash script wrapper run-python-tests.sh is no longer needed to run the
tests.
2020-11-04 13:51:36 +01:00
Håkon Hægland 648bab7108 Implements access to the porosity from Python.
Implements access (read/write) to the porosity from Python.
2020-11-03 17:18:14 +01:00