Note
Go to the end to download the full example code.
Weill et al example#
Weill, S., et al. « Coupling Water Flow and Solute Transport into a Physically-Based Surface–Subsurface Hydrological Model ». Advances in Water Resources, vol. 34, no 1, janvier 2011, p. 128‑36. DOI.org (Crossref), https://doi.org/10.1016/j.advwatres.2010.10.001.
The CATHY gitbucket repository provides the Weill et al. dataset example to test the installation. On top of that, we provide a computational notebook code to reproduce the results using the pyCATHY wrapper (BenjMy/pycathy_wrapper).
The notebook illustrate how to work interactively: execute single cell, see partial results at different processing steps (preprocessing, processing, output)… You can share it to work collaboratively on it by sharing the link and execute it from another PC without any installation required.
Estimated time to run the notebook = 5min
🏁 Initiate CATHY object
simu.run_preprocessor(verbose=False)
# simu.run_processor(IPRT1=3,verbose=True)
# simu.read_inputs('atmbc')
simu.update_parm(TIMPRTi=[1800,7200])
# simu.atmbc
simu.parm
# simu.grid3d
# len(simu.grid3d["mesh_tetra"])
simu.run_processor(IPRT1=2,
DTMIN=1e-2,
DTMAX=1e2,
DELTAT=5,
TRAFLAG=0,
verbose=False
)
🍳 gfortran compilation
👟 Run preprocessor
🔄 Update parm file
🔄 Update hap.in file
🔄 Update dem_parameters file
🔄 Update dem_parameters file
🔄 Update parm file
🛠 Recompile src files [14s]
🍳 gfortran compilation [20s]
b''
👟 Run processor
pl = pv.Plotter(notebook=False)
cplt.show_vtk(unit="pressure",
timeStep=1,
path=simu.workdir + "/weill_exemple/vtk/",
ax=pl,
)
pl.show()
plot pressure
pl = pv.Plotter(notebook=True)
cplt.show_vtk(unit="pressure",
timeStep=1,
path=simu.workdir + "/weill_exemple/vtk/",
ax=pl,
)
pl.show()
plot pressure
<PIL.Image.Image image mode=RGB size=1024x768 at 0x7F7D71205F00>
cplt.show_vtk_TL(
unit="pressure",
notebook=False,
path=simu.workdir + "/weill_exemple/vtk/",
show=False,
x_units='days',
clim = [0.55,0.70],
savefig=True,
)
days
plot pressure
Time= [0.]
/home/runner/work/pycathy_wrapper/pycathy_wrapper/examples/SSHydro/../SSHydro//weill_exemple/vtk/100.vtk
[0.]
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pyvista/plotting/plotter.py:4796: PyVistaDeprecationWarning: This method is deprecated and will be removed in a future version of PyVista. Directly modify the scalars of a mesh in-place instead.
warnings.warn(
/home/runner/work/pycathy_wrapper/pycathy_wrapper/examples/SSHydro/../SSHydro//weill_exemple/vtk/101.vtk
[1895.11582]
/home/runner/work/pycathy_wrapper/pycathy_wrapper/examples/SSHydro/../SSHydro//weill_exemple/vtk/102.vtk
[7200.]
/home/runner/work/pycathy_wrapper/pycathy_wrapper/examples/SSHydro/../SSHydro//weill_exemple/vtk/103.vtk
[7200.]
gif saved/home/runner/work/pycathy_wrapper/pycathy_wrapper/examples/SSHydro/../SSHydro//weill_exemple/vtk/pressure.gif
Total running time of the script: (1 minutes 1.997 seconds)