dorie.testtools

What is dorie.testtools?

dorie.testtools provides the following components

  • a wrapper script to run automated tests created with dune-testtools

  • evaluation scripts to process the run data and determine pass or fail for each test

How to use dorie.testtools

The dorie.testtools wrappers are called via the CMake interface provided by dune-testtools (CMake macro add_dune_system_test). The SCRIPT parameter allows to specify the script to be called.

The dorie.testtools scripts

test_dorie.py

This script parses the given parameter file, executes DORiE, and passes the result to the corresponding evaluation module. The behavior is controlled by special parameter keys to be provided in the ini file.

Parameter keys:

  • _evaluation: Specifies the evaluation script that is to be called. Can be the name of any module in dorie.testtools.evaluation.

  • __inifile_optionkey: The argument that is passed to the DORiE executable before the parameter file. This should be run in most situations.

All command line arguments are passed through the dune-testtools CMake machinery and parsed by the dune.testtools python package.

The dorie.testtools core modules

The module is intended to be called via the internal wrapper dorie.testtools.wrapper.test_dorie.py.

dorie.testtools.wrapper.test_dorie.test_dorie(iniinfo, inifile, executable)[source]

Parses the parameter file, calls DORiE, calls the evaluation routines and exits with 0 (pass) or 1 (fail).

You can specify which command of the dorie wrapper to test with the _test_command key (e.g. run for dorie run). Options to the dorie wrapper can be specified with _test_command_options. The last argument given to the dorie wrapper is specified with _test_target (defaults to the ini file).

dorie.testtools consists of multiple submodules:

  • dorie.testtools.utilities, which contains convenience functions that are included by

    the evaluation modules and are too specific to be contained in dorie.utilities

  • Evaluation modules for the system tests, where each module corresponds to one

    of the supported commands of the dorie wrapper script.

The dorie_create module

The dorie_pfg module

The dorie_plot module

Dummy module without actual evaluation scripts.

The dorie_run module

The utilities module

The MuPhi output file reader

dorie.testtools.utilities.muphi_reader.read(filename)[source]

Functions that reads and parses a binary file created by muPhi. Specification according to muPhi docs:

  • three 32-bit integers encoding number of grid cells per dimension

  • three single-precision floats encoding grid extensions in each dimension

  • array data as double precision floats

Returns the array data and a meshgrid (assumes that the grid is regularly spaced).

Parameters

filename (str) – path to the muPhi binary (.bin) file

Raises

RuntimeError – if the input file is not readable

Returns

grid cells, data array

Return type

(list of numpy arrays, numpy array)

Richards equation definitions

dorie.testtools.utilities.richards_equation.k(h, k0, tau, alpha, n, **kwargs)[source]

Returns the conductivity \(K\) as given by the Mualem-van Genuchten parameterization:

\[K = K_0 (1 + (\alpha h)^n)^{1-1/n} (1 - (1 - \frac{1}{(1+(\alpha h)^n)^{1-1/n}})^2)\]
Parameters
  • h (float) – Matric head

  • K0 (float) – Saturated hydraulic conductivity

  • tau (float) – \(\tau\)

  • alpha (float) – \(\alpha\)

  • n (float) – \(n\)

dorie.testtools.utilities.richards_equation.richards(y, h, jw, param)[source]

Returns \(du/dy\) as given by the Richards equation in a 1-dimensional medium with constant inflow:

\[\frac{\partial u}{\partial y} = -1 - j_w/a\]
Parameters
  • y (float) – Current depth

  • h (float) – Matric head

  • jw (float) – Inflow at the top of the domain

  • param (callable) – Function that accepts y and returns material parameters as a dict

dorie.testtools.utilities.richards_equation.van_genuchten(h, alpha, n, theta_r, theta_s)[source]

Returns the water content \(\Theta\) as given by van Genuchten:

\[\Theta = (1 + (\alpha h)^n)^{1/n - 1} (\theta_s - \theta_r) + \theta_r\]
Parameters
  • h (float) – Matric head

  • alpha (float) – \(\alpha\)

  • n (float) – \(n\)

  • theta_r (float) – \(\theta_r\)

  • theta_s (float) – \(\theta_s\)

Statistical tools

Decorators

dorie.testtools.utilities.decorators.evaluation_script(func)[source]