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

dorie.testtools consists of two submodules:

  • dorie.testtools.evaluation, containing all modules responsible for the evaluation of
    the system tests
  • dorie.testtools.utilities, which contains convenience functions that are included by
    the evaluation modules and are too specific to be contained in dorie.utilities

The utilities module

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

dorie.testtools.utilities.statistics.autocorrelation(H, pad=None)[source]

Calculates the autocorrelation of an array via ffts.

\[ \begin{align}\begin{aligned}\text{autocovariance}(H,x) = \text{fft}^{-1}(|\text{fft}(H - \overline{H},k)|^2,x)\\\text{autocorrelation}(H,x) = \text{autocovariance}(x) / \text{autocovariance}(0)\end{aligned}\end{align} \]
Parameters:
  • H – input array
  • pad – Pads each axis of the input with pad[i] zeros before and after each FFT.
dorie.testtools.utilities.statistics.norm_L2(a, x)[source]

Decorators

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