Commit 438eb068 authored by Lukas Riedel's avatar Lukas Riedel

Added reference tests for Muphi and parallel execution tests

* added new CI jobs for parallel execution and reference tests
* added Muphi reference test which now reads tolerance explicitly
* Fixed computation of L2 error and default tolerances in compare_grid
parent eeb3070d
......@@ -66,7 +66,7 @@ test:exec_cmds:
name: "$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/build-cmake/Testing
expire_in: 2 days
expire_in: 1 day
test:ode:
stage: test
......@@ -79,7 +79,7 @@ test:ode:
name: "$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/build-cmake/Testing
expire_in: 2 days
expire_in: 1 day
test:ode-update_dune:
stage: test
......@@ -94,7 +94,33 @@ test:ode-update_dune:
name: "$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/build-cmake/Testing
expire_in: 2 days
expire_in: 1 day
test:parallel:
stage: test
dependencies:
- build:main
script:
- $DUNECONTROL --only=dorie configure
- $DUNECONTROL --only=dorie make test_run_parallel
artifacts:
name: "$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/build-cmake/Testing
expire_in: 1 day
test:reference:
stage: test
dependencies:
- build:main
script:
- $DUNECONTROL --only=dorie configure
- $DUNECONTROL --only=dorie make test_run_ref
artifacts:
name: "$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/build-cmake/Testing
expire_in: 1 day
deploy:build_docs:
stage: deploy
......
......@@ -54,4 +54,5 @@ def evaluate(iniinfo,runtime):
l2 = np.sqrt(np.mean(np.square(diff))) # RMS error
print("L2: {:.2e}".format(l2))
return bool(l2 < 5E-3)
meantol = float(iniinfo['_reference.meantol'])
return bool(l2 < meantol)
......@@ -75,7 +75,7 @@ def _compare_max_norm(residuals, atol, rtol):
def _compare_l2_norm(residuals, grid, abstol):
passed = True
for var, res in residuals.items():
l2 = np.sqrt(grid.integrate(res**2) / grid.integrate(1))
l2 = np.sqrt(np.sum(grid.integrate(res**2) / grid.integrate(1)))
if np.all(l2 > abstol):
print("Data in variable {} does not match".format(var))
print("\tL2 error: {}".format(l2))
......@@ -83,7 +83,7 @@ def _compare_l2_norm(residuals, grid, abstol):
return passed
def compare(grid1,grid2,abstol=1E-6,reltol=1E-3,strict=False):
def compare(grid1,grid2,abstol=1E-7,reltol=1E-7,strict=False):
if not isinstance(grid1,BaseGrid) or not isinstance(grid2,BaseGrid):
raise TypeError("Inputs must be of type BaseGrid (got: {} and {})"\
.format(type(grid1),type(grid2)))
......
......@@ -19,37 +19,48 @@ dorie_add_system_test(dorie ode_linear_interpolator.mini)
add_custom_target(test_run_ode
COMMAND ctest --output-on-failure --tests-regex ^dorie_ode.+$)
# dorie_add_system_test(dorie muphi.mini)
# dorie_add_system_test_dependency(dorie_muphi dorie-rfg_muphi_pfg)
# dorie run: Reference tests
dorie_add_system_test(dorie-rfg parfield_muphi.mini)
dorie_add_system_test(dorie muphi.mini)
set_tests_properties(dorie-rfg_ref_muphi_pfg PROPERTIES FIXTURES_SETUP muphi_ref)
set_tests_properties(dorie_ref_muphi PROPERTIES FIXTURES_REQUIRED muphi_ref)
add_custom_target(test_run_ref
COMMAND ctest --output-on-failure --tests-regex ^.+_ref_.+$
)
# dorie_add_system_test(dorie reference_2d.mini)
# dorie_add_system_test(dorie reference_3d.mini)
# dorie_add_system_test(dorie reference_evaporation.mini)
# dorie_add_system_test(dorie reference_interpolators.mini)
# # dorie in parallel
# dorie_add_system_test(dorie parallel_reference.mini)
# dorie_add_system_test(dorie parallel_reference_compare.mini)
# dorie_add_system_test_dependency(dorie_parallel_reference_compare_0000 dorie_parallel_reference_0000)
# dorie_add_system_test_dependency(dorie_parallel_reference_compare_0001 dorie_parallel_reference_0000)
# dorie_add_system_test_dependency(dorie_parallel_reference_compare_0002 dorie_parallel_reference_0001)
# dorie_add_system_test_dependency(dorie_parallel_reference_compare_0003 dorie_parallel_reference_0001)
# dorie in parallel
dorie_add_system_test(dorie parallel_reference.mini)
dorie_add_system_test(dorie parallel_reference_compare.mini)
set_tests_properties(dorie_parallel_reference_0000 PROPERTIES FIXTURES_SETUP dorie_par)
set_tests_properties(dorie_parallel_reference_0001 PROPERTIES FIXTURES_SETUP dorie_par)
set_tests_properties(dorie_parallel_reference_compare_0000 PROPERTIES FIXTURES_REQUIRED dorie_par)
set_tests_properties(dorie_parallel_reference_compare_0001 PROPERTIES FIXTURES_REQUIRED dorie_par)
set_tests_properties(dorie_parallel_reference_compare_0002 PROPERTIES FIXTURES_REQUIRED dorie_par)
set_tests_properties(dorie_parallel_reference_compare_0003 PROPERTIES FIXTURES_REQUIRED dorie_par)
add_custom_target(test_run_parallel
COMMAND ctest --output-on-failure --tests-regex ^dorie_parallel_.+$
)
# dorie pfg
# dorie exec tests
dorie_add_system_test(dorie-rfg parfield.mini)
# dorie_add_system_test(dorie-rfg parfield_muphi.mini)
# dorie run
dorie_add_system_test(dorie run.mini)
set_tests_properties(dorie-rfg_exec_0000 PROPERTIES FIXTURES_SETUP dorie_run)
set_tests_properties(dorie_exec_run PROPERTIES FIXTURES_REQUIRED dorie_run)
# dorie plot
dorie_add_system_test(dorie plot.mini)
dorie_add_system_test_dependency(dorie_exec_plot dorie_exec_run)
set_tests_properties(dorie_exec_run PROPERTIES FIXTURES_SETUP dorie_plot)
set_tests_properties(dorie_exec_plot PROPERTIES FIXTURES_REQUIRED dorie_plot)
# dorie create
dorie_add_system_test(dorie create.mini)
add_custom_target(test_dorie_exec
......
include ${CMAKE_BINARY_DIR}/doc/default_files/config.ini
__name = muphi
__name = ref_muphi
_test_command = run
_asset_path = "${CMAKE_CURRENT_LIST_DIR}"
_evaluation = muphi
_reference.path = {_asset_path}/references/muphi/
_reference.meantol = 5E-3
output.fileName = muphi | unique name
output.outputPath = muphi | unique name
......
include ${CMAKE_BINARY_DIR}/doc/default_files/parfield.ini
__name = muphi_pfg
__name = ref_muphi_pfg
_test_command = pfg
[general]
......
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