mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-24 12:36:25 -06:00
Added Python based integration test to check TRAN?
This commit is contained in:
parent
be71a2f8b2
commit
b60f1ac5e7
@ -149,5 +149,11 @@ if (HAVE_OPM_DATA)
|
||||
set_tests_properties(compare_restart_files PROPERTIES DEPENDS flow_SPE1CASE2_restart) # Compares the restart files from tests flow_SPE1CASE2_restart and flow_SPE1CASE2
|
||||
|
||||
add_test( NAME flow_sequential_SPE1 COMMAND flow_sequential ${OPM_DATA_ROOT}/spe1/SPE1CASE1.DATA )
|
||||
if (ERT_PYTHON_PATH)
|
||||
include(OpmPythonTest)
|
||||
|
||||
opm_add_python_test( check_INIT_SPE1 ${PROJECT_SOURCE_DIR}/tests/compare_INIT.py $<TARGET_FILE:flow> ${OPM_DATA_ROOT}/spe1/SPE1CASE1.DATA ${OPM_DATA_ROOT}/spe1/eclipse-simulation/SPE1CASE1.INIT TRANX TRANY TRANZ PORO PORV PERMX )
|
||||
opm_add_python_test( check_INIT_NORNE ${PROJECT_SOURCE_DIR}/tests/compare_INIT.py $<TARGET_FILE:flow> ${OPM_DATA_ROOT}/norne/NORNE_ATW2013.DATA ${OPM_DATA_ROOT}/norne/ECL.2014.2/NORNE_ATW2013.INIT PORO PORV PERMX )
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
37
tests/compare_INIT.py
Executable file
37
tests/compare_INIT.py
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python
|
||||
import subprocess
|
||||
import sys
|
||||
import os.path
|
||||
|
||||
from ert.ecl import EclFile
|
||||
from ert.test import TestAreaContext
|
||||
|
||||
|
||||
def compare_files( flow_file , ref_file , kw_list):
|
||||
flow = EclFile( flow_file )
|
||||
ref = EclFile( ref_file )
|
||||
|
||||
for kw in kw_list:
|
||||
flow_kw = flow[kw][0]
|
||||
ref_kw = ref[kw][0]
|
||||
|
||||
if not flow_kw.equal_numeric( ref_kw , epsilon = 1e-3 ):
|
||||
sys.exit("Keyword:%s was different in flow simulation and reference")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
flow = sys.argv[1]
|
||||
data_file = sys.argv[2]
|
||||
ref_init_file = sys.argv[3]
|
||||
kw_list = sys.argv[4:]
|
||||
|
||||
with TestAreaContext("flow_init") as ta:
|
||||
subprocess.check_call( [flow , "nosim=true" , data_file ] )
|
||||
|
||||
compare_files( os.path.splitext( os.path.basename( data_file ) )[0] + ".INIT" , ref_init_file , kw_list)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user