Using HydroBayesCal with TELEMAC
This page explains how to run a surrogate-assisted Bayesian calibration of a TELEMAC (2D/3D) model. It complements the generic Bayesian Calibration Workflow and the binding walk-through in TELEMAC & OpenFOAM Bindings.
Prerequisites
A working TELEMAC v9 installation with its Python API reachable. Follow the installation guide at hydro-informatics.com/install-telemac and the HydroBayesCal Installation page for coupling the two environments.
A fully functional TELEMAC model that runs to completion on its own before you start any calibration.
HydroBayesCal installed in an environment that is loaded together with the TELEMAC environment variables (see Installation —
env-scripts/activateHBCtelemac.sh).
Note
With TELEMAC v9 the solver is launched through telemac2d.py /
telemac3d.py from the active systel configuration (pysource
file). HydroBayesCal calls these launchers for you; you only need the
combined environment loaded so that telemac2d.py is on the PATH.
The TELEMAC simulation folder
Collect all files needed for one TELEMAC run into a single model directory
(model_dir). A typical hydrodynamic setup contains:
File |
Purpose |
|---|---|
|
Steering (control) file with the numerical configuration. Its name is
passed as |
|
Boundary-condition file (type and location of the boundaries). |
|
SELAFIN geometry/mesh file. |
|
Friction (roughness) table, required when calibrating friction zones
(passed as |
|
Liquid boundary conditions for unsteady flow (if applicable). |
rating curve / stage-discharge |
Outflow boundary definition (if applicable). |
Measurement / calibration points
The calibration targets are provided in a CSV file (calibration_pts_file_path)
with one row per measurement location. The header uses the coordinates and, for
each calibration quantity, a <quantity>_DATA and a <quantity>_ERROR
column (matched case-insensitively):
X, Y, WATER DEPTH_DATA, WATER DEPTH_ERROR, SCALAR VELOCITY_DATA, SCALAR VELOCITY_ERROR
...
The _ERROR column holds the measurement error in the physical units of the
quantity. Measurements and the computational mesh (.slf) must use the same
coordinate reference system so modelled and measured values can be compared.
TELEMAC-specific parameters
In addition to the common Functioning of the HydroSimulations Class parameters, the
TelemacModel class accepts:
Parameter |
Description |
|---|---|
|
Hydrodynamic solver: |
|
Name of the |
|
Name of the |
|
Base name of the results |
|
GAIA steering file for morphodynamics (optional). |
Calibration parameters and TELEMAC keywords
For TELEMAC, each entry of calibration_parameters must match a keyword in
the model files:
Steering-file keywords must be written exactly as in the
.casfile, using=(not:). See the TELEMAC user manuals.calibration_parameters = ["LAW OF FRICTION ON LATERAL BOUNDARIES", "INITIAL ELEVATION", "BOTTOM FRICTION"]
Friction zones are calibrated per zone; the zone names must be defined in the
.tblfriction file, and each name must containzone/Zone/ZONEas a prefix. See friction (roughness) zones.calibration_parameters = ["zone1", "zone2", "Zone3"]
calibration_quantities / extraction_quantities use SELAFIN variable
names, e.g. "WATER DEPTH", "SCALAR VELOCITY", "TURBULENT ENERG",
"VELOCITY U", "VELOCITY V", "CUMUL BED EVOL".
Note
Bayesian active learning only handles numeric (scalar) parameters. A parameter that takes a non-numeric value (e.g. a solver-type keyword) cannot be used as a calibration parameter.
Running the calibration
Define a configuration file (see the example config_Telemac.py) and launch
the TELEMAC driver:
python bal_telemac.py --config config_Telemac.py
The driver builds a TelemacModel, sets up the experimental design, runs the
initial simulations, trains the GPE and performs Bayesian Active Learning.
Equivalently, in a script:
from hydroBayesCal.telemac.control_telemac import TelemacModel
model = TelemacModel(
control_file="tel_model.cas",
tm_xd="Telemac2d",
friction_file="friction.tbl",
results_filename_base="results",
model_dir="/path/to/telemac_simulation",
res_dir="/path/to/results",
calibration_pts_file_path="/path/to/measurements-calibration.csv",
n_cpus=8,
init_runs=15,
max_runs=30,
calibration_parameters=["zone1", "zone2", "BOTTOM FRICTION"],
param_values=[[0.011, 0.79], [0.011, 0.79], [0.018, 0.028]],
calibration_quantities=["WATER DEPTH", "SCALAR VELOCITY"],
extraction_quantities=["WATER DEPTH", "SCALAR VELOCITY", "TURBULENT ENERG"],
)
See TELEMAC & OpenFOAM Bindings for the full driver, the experiment-design and BAL functions, and the structure of the output folders.
See also
Installation — environment and TELEMAC setup.
Bayesian Calibration Workflow — the calibration workflow and all configuration parameters.
Using HydroBayesCal with OpenFOAM — the analogous OpenFOAM guide.