Implement new parameterization data input
Description
With the new data structures almost ready, a new data input scheme can be established. The new scheme aims at being more customizable while always ensuring that grid intersections coincide with parameterization singularities ("compatible mesh"). The latter is achieved by the data structure itself.
For the new parameter input, we generally have to discern two use cases. For both, we want to end up with a data structure that maps an entity (or its index) to the soil medium it belongs to.
-
A (unstructured) grid is created from a GMSH file.
GMSH supports the definition of multiple "physical" entities on a mesh. When reading the mesh file, the grid entities can be mapped to the ID of the physical entity they belong to by their index (using a
Dune::Mapper
). -
A regular (but possibly unstructured) grid is created with the
GridFactory
.In this case, we require additional input in the form of a data file. When building a grid with
x \times y \times z
cells, a dataset with equal dimensions and extensions is required. For each cell, it states an medium index:id = data[z][y][x]
. H5 is a suitable format, and we can re-useDorie::H5File
.
Both use cases can/should encompass the usage of Python scripts: With pygmsh
, one can easily write a .geo
GMSH input file with Python and afterwards compile it to a mesh (this requires the GMSH CLI to be installed). Also, it's really easy to write a multi-dimensional H5 file with h5py
and numpy
.
For the input of the parameters themselves, we use a new file in YAML format. It specifies the name of the soil layer, its id, the parameterization type, and the parameters themselves. The hierarchical layout of YAML makes it easy to hand over sub-nodes to the respective data structures for readout.
In the first implementation, we drop Miller scaling.
Proposal
-
Remove the Parameter Field Generator
- Install
pygmsh
andh5py
intovirtualenv
- Recommend installing the GMSH CLI
- Give example files and instructions on how to generate input files
- Install
-
Rework
H5File
to also read datasets ofH5_NATIVE_INT
values -
Rework
RichardsSimulation
to build grid itself- Two modes:
gmsh
andregular
: Read GMSH file or build grid withGridFactory
- Create mapping from cell ids to soil medium id
- Leave option for building
RichardsSimulation
with a grid instance
- Two modes:
-
Read
param.yml
- Create
RichardsParameterization
instances from input file - Build parameter map from mapping between cells ids and medium ids
- Create
-
Adapt CLI
Use case flow chart
param.yml
layout
---
sand_1: # name
type: MvG # Mualem–van Genuchten
index: 1 # layer index for reference
parameters:
alpha: -10.0
K_0: 1E-5
n:
tau:
theta_r:
theta_s:
my_layer:
type: # ...
# ...
How to test the implementation?
- tests work with new exemplary/default input files
Add test executables for
- Reading arbitrary H5 files.
- Correct grid cell - medium id mapping for 2D and 3D test cases, respectively.
Related issues
See #63 (closed)