Commit 04b8de72 authored by Lukas Riedel's avatar Lukas Riedel

Update ODE tests to work with new parameterization scheme

* Add standard YAML file with parameters for sand and silt.
* Modify create_param_maps.py for creating an H5 datafile with maps
    for tests.
* Add a new target 'prepare_testing' for creating the H5 datafile
    before running system or unit tests. It is a dependency of
    'system_tests' and 'unit_tests' (but not 'test').
* Add gitignore exception for H5 datafile.
* Remove creation of H5 datafile from GitLab CI config.
parent e71e039e
......@@ -5,6 +5,7 @@ build-cmake/
python/dorie/wrapper/pf_from_file.py
python/dorie/wrapper/test_dorie.py
python/dorie/cli/cmds.py
test/maps/cell_ids.h5
# Ignore temporary and auto-generated files #
*~
......
......@@ -176,12 +176,6 @@ test:unit-tests:
- $DUNECONTROL --only=dorie bexec
"./run-in-dune-env python3 -m pip install gcovr"
- $DUNECONTROL --only=dorie configure
# create map for the grid creator test
- $RUN_IN_DUNE_ENV python3
$CI_PROJECT_DIR/test/maps/create_param_maps.py
$CI_PROJECT_DIR/test/maps/cell_ids.h5
- $DUNECONTROL --only=dorie make unit_tests
# report coverage
- cd $CI_PROJECT_DIR/build-cmake
......
......@@ -10,6 +10,13 @@ add_custom_target(system_tests
COMMAND ctest --output-on-failure --exclude-regex ^ut.+$
)
# create the mapping datafile as preparation for all tests
add_custom_target(prepare_testing
COMMAND ${DUNE_PYTHON_VIRTUALENV_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/maps/create_param_maps.py ${PROJECT_SOURCE_DIR}/test/maps/cell_ids.h5
)
add_dependencies(system_tests prepare_testing)
add_dependencies(unit_tests prepare_testing)
#
# .. cmake_function:: add_coverage_links
#
......
......@@ -10,9 +10,21 @@ def create_and_write_datasets(args):
grid_test_3d = np.zeros((10, 10, 10), dtype=np.int_)
grid_test_3d[5:, :, :] = 1
ode_layered_160 = np.zeros((160, 1), dtype=np.int_)
ode_layered_160[80:, ...] = 1
ode_layered_40 = np.zeros((40, 1), dtype=np.int_)
ode_layered_40[20:, ...] = 1
ode_layered_20 = np.zeros((20, 1), dtype=np.int_)
ode_layered_20[10:, ...] = 1
f = h5py.File(args.path, 'w')
f.create_dataset("grid_test_2d", data=grid_test_2d)
f.create_dataset("grid_test_3d", data=grid_test_3d)
f.create_dataset("ode_layered_160", data=ode_layered_160)
f.create_dataset("ode_layered_40", data=ode_layered_40)
f.create_dataset("ode_layered_20", data=ode_layered_20)
f.close()
def parse_cli():
......
......@@ -11,7 +11,7 @@ output.verbose = 0
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
parameters.arrayFile = "{_asset_path}/parfields/sand.h5"
parameters.file = "{_asset_path}/param/param.yml"
time.end = 1E7
time.maxTimestep = 1E7
......@@ -24,6 +24,9 @@ grid.gridType = rectangular
grid.initialLevel = 0
grid.cells = 1 160, 1 40, 1 20 | expand prec
grid.mappingFile = none
grid.globalIndex = 0
[_ode]
flux = -5.55e-6
head_abstol = 3E-6, 2E-8, 6E-8 | expand prec
......
......@@ -11,7 +11,7 @@ output.verbose = 0
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
parameters.arrayFile = "{_asset_path}/parfields/silt.h5"
parameters.file = "{_asset_path}/param/param.yml"
time.end = 1E7
time.maxTimestep = 1E7
......@@ -24,6 +24,9 @@ grid.gridType = rectangular
grid.initialLevel = 0
grid.cells = 1 160, 1 40, 1 20 | expand prec
grid.mappingFile = none
grid.globalIndex = 1
[_ode]
flux = -5.55e-6
head_abstol = 6E-6, 4E-6, 9E-6 | expand prec
......
......@@ -11,7 +11,7 @@ output.verbose = 0
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
parameters.arrayFile = "{_asset_path}/parfields/layered.h5"
parameters.file = "{_asset_path}/param/param.yml"
time.end = 1E7
time.maxTimestep = 1E7
......@@ -24,6 +24,9 @@ grid.gridType = rectangular
grid.initialLevel = 0
grid.cells = 1 160, 1 40, 1 20 | expand prec
grid.mappingFile = "{_asset_path}/maps/cell_ids.h5"
grid.mappingFileDataset = ode_layered_160, ode_layered_40, ode_layered_20 | expand prec
[_ode]
flux = -5.55e-6
head_abstol = 3E-5, 4E-8, 4E-6 | expand prec
......
volumes:
sand:
index: 0
type: MvG
parameters:
alpha: -2.3
n: 4.17
k0: 2.2E-5
theta_r: 0.03
theta_s: 0.31
tau: -1.1
silt:
index: 1
type: MvG
parameters:
alpha: -0.7
n: 1.3
k0: 1.0E-5
theta_r: 0.01
theta_s: 0.41
tau: 0.0
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment