Tests for OnePhaseSimulator

This commit is contained in:
Svenn Tveit committed 2025-09-23 12:54:27 +02:00
1 parent 5153cd6fc0
commit fc3e1bb73f
4 files changed
+263

No files matched your search

+14
View File
@@ -8,6 +8,7 @@ class TestBasic(unittest.TestCase):
def setUpClass(cls):
test_dir = Path(os.path.dirname(__file__))
cls.data_dir_bo = test_dir.parent.joinpath("test_data/SPE1CASE1a")
cls.data_dir_op = test_dir.parent.joinpath("test_data/SPE1CASE1")
cls.data_dir_gw = test_dir.parent.joinpath("test_data/SPE1CASE2")
# IMPORTANT: Since all the python unittests run in the same process we must be
@@ -49,6 +50,19 @@ class TestBasic(unittest.TestCase):
T = sim.get_fluidstate_variable(name='T')
self.assertAlmostEqual(T[0], 288.705, places=3, msg='value of temperature')
def test_02_onephase(self):
with pushd(self.data_dir_op):
sim = OnePhaseSimulator("SPE1CASE1_WATER.DATA")
sim.setup_mpi(False, False)
sim.step_init()
sim.step()
water_pressure = sim.get_fluidstate_variable(name='pw')
self.assertAlmostEqual(water_pressure[0], 44780102.277570, delta=1e4, msg='value of water pressure')
rho_w = sim.get_fluidstate_variable(name='rho_w')
self.assertAlmostEqual(rho_w[0], 1003.182858, places=3, msg='value of water density')
Sw = sim.get_fluidstate_variable(name='Sw')
self.assertAlmostEqual(Sw[0], 1.0, places=5, msg='value of water saturation')
# IMPORTANT: This test must be run last since it calls MPI_Finalize()
def test_99_gaswater(self):
with pushd(self.data_dir_gw):