Skip to content
m-giraud edited this page Jan 3, 2023 · 22 revisions

How to - for the Python binding

Make a domain periodic

A 3D grid of a domain 10*10*53 cm3, with cells of size 2*2*1 cm3 is created by

N = 53 # z - resolution

s.createGrid([-5., -5., -53.], [5., 5., 0.], [5, 5, N], periodic = True) # [cm]

s.initializeProblem()

the optional third argument defines that the domain is periodic (in x and y)

Make a domain periodic using the .input file

[Soil.Grid]

UpperRight = 0.05 0.05 0

LowerLeft = -0.05 -0.05 -0.53

Cells = 10 10 53

Periodic = True

First define the Periodic parameter in the .input File, then use the .input file by

s = RichardsWrapper(RichardsSP())

s.initialize(["", "test.input"])

s.createGridFromInput("Soil")

s.initializeProblem()

Define van Genuchten parameters for several soil layers

sand = [0.045, 0.43, 0.15, 3, 1000]

loam = [0.08, 0.43, 0.04, 1.6, 50]

First define and initialise your soil problem, e.g.,

s = RichardsWrapper(RichardsSP())

s.initialize()

s.setVGParameters([sand, loam])

Then define soil layers by material numbers and their bottom and upper depth

s.setLayersZ([2, 2, 1, 1], [-200., -50., -50., 0.]) # sample points ([1], [cm])

Then set the van Genuchten parameters

s.initializeProblem()

Define van Genuchten parameters for several soil layers in the input file

[Soil.VanGenuchten]

# Sand over Loam

Qr = 0.045 0.08

Qs = 0.43 0.43

Alpha = 0.15 0.04 # [1/cm]

N = 3 1.6

Ks = 1000 50 # [cm/d]

[Soil.Layer]

Z = -2 -0.5 -0.5 0

Number = 2 2 1 1

Set soil initial condition as hydrostatic equilibrium

in the input file we give a look up table with two sample points (in between linear interpolation is used):

[Soil.IC]

P = -644.8 -659.8

Z = -.15 0.

in Python:

cpp_base = RichardsSP()

s = RichardsWrapper(cpp_base)

s.initialize()

s.createGrid(min_b, max_b, cell_number, periodic) # [cm], grid has to created before setting equilibrium to "True" in initial conditions

s.setHomogeneousIC(initial, True) # cm pressure head, equilibrium

How to - for the jülich supercomputer

To install and run CPlantBox on a Jülich supercomputer (juwels or jureca), run the following commands:

module --force purge
module load Stages/2020
module load GCC/10.3.0
module load ParaStationMPI/5.4.10-1
module load GCCcore/.10.3.0
module load Python/3.8.5
module load OpenCV
module load CMake
module load SciPy-Stack

then, create and activate a conda environment

conda create -n "cpbenv" python=3.8
conda activate cpbenv

then run the dumux-rosi installation file for JSC, available at: https://github.com/Plant-Root-Soil-Interactions-Modelling/dumux-rosi/blob/master/installdrosi_JSC.py

when using dumux-rosi, import plantbox before importing rosi_richards:

import plantbox
from rosi_richards import RichardsSP