Hydraulic simulations

A hydraulic simulation computes water depths and flow velocities for the discharge of the case. aXqua runs hydraulic simulations in a fixed order, from the fastest model to the most detailed one, and each model starts from the result of the previous one.

aXqua warm-up concept

At the beginning of a simulation, nothing is known about the flow: the riverbed is dry, and the model first has to fill the reach with water until the outflow equals the inflow. This filling is of no interest in itself, but it consumes computing time. The more detailed a model is, the more expensive the filling becomes.

aXqua therefore lets the cheapest model do this work. The sequence is:

  1. TELEMAC-2D dry run. The depth-averaged model starts on the dry riverbed and runs until the flow is steady. It typically takes minutes to a few hours.

  2. TELEMAC-3D (optional). The 3D model starts from the 2D result. The reach is already filled, and only the vertical distribution of the velocity has to develop.

  3. OpenFOAM (optional). The OpenFOAM model starts from the TELEMAC result. The position of the water surface, the wetted area and the velocities are taken from it.

The TELEMAC run that precedes an OpenFOAM simulation is called the warm-up. It has three effects on the OpenFOAM model: the cells below the water surface start filled with moving water, the top of the mesh is placed shortly above the water surface so that few cells contain only air, and the mesh is limited to the wetted part of the reach. If the case has no steady 2D result yet, aXqua runs a coarse TELEMAC simulation on its own for this purpose, which takes about one minute for a small reach.

The warm-up is active by default and should not be disabled. Without it, OpenFOAM starts with a flat lid high above the terrain, the mesh contains many times more air cells, and the filling of the reach has to be computed by the most expensive model. In the plugin, the warm-up is the check box Use TELEMAC warm-up on the sub-tab OpenFOAM of the tab Simulations (OpenFOAM). In the case file, it is the setting openfoam.pre_run.enabled, which is enabled by default.

TELEMAC dry runs 2D/3D

A dry run is a simulation that starts from a dry riverbed (Initial conditions).

2D. After preprocessing, click Submit in the box Steady 2D on the tab Simulations > Baseline (Telemac) of the plugin. The run appears in the job list below the tabs with its progress. In a terminal, the command is:

axqua submit <case-file> --kind steady
The sub-tab Baseline (Telemac) of the tab Simulations

The tab Simulations, sub-tab Baseline (Telemac). (1) The sub-tabs of the tab Simulations. (2) The box Steady 2D with its state. (3) Submit starts the simulation. (4) Load results adds the result to the map. (5) The job list with the state and the progress of every job.

When the run has finished, aXqua evaluates whether the flow is steady. It reads the discharge through every open boundary from the output of TELEMAC and writes the following files into axqua-case/simulation/:

File

Content

flux-convergence.png, extracted-fluxes.csv

Discharge through each open boundary over the simulated time.

convergence-rate.png, convergence-rate.csv

Relative difference between inflow and outflow over the simulated time.

wetting-report.csv

Wetted area, divided into flowing water, stagnant thin water films and isolated puddles.

outlet-profile.csv

Water surface near the outflow boundary, with a note whether the prescribed water level dams up the flow or draws it down.

backwater-reach.png, backwater-reach.csv, backwater-reach.json

How far upstream a change of the water level at the outflow boundary reaches, and how much of it remains at the measurement points (backwater reach).

The run is steady when the relative difference between inflow and outflow stays below hydrodynamics.flux_tolerance. If this is not the case at the end of the run, increase hydrodynamics.duration and repeat the run. The wetting report complements this criterion: a simulation can have balanced discharges and still show water in places where the real reach is dry. Large areas of stagnant film usually indicate a start with too much water or a downstream water level that is too high. The backwater reach answers a question of the calibration: whether the measurement points lie where the water level at the outflow boundary, which is an assumption of the model, still acts on the flow.

Load results adds the result (r2d.slf) to the QGIS project as water depth and flow velocity layers.

3D. A TELEMAC-3D simulation requires the steady 2D result. In the box Steady 3D on the same tab, Build writes the 3D steering files and Submit starts the run. aXqua determines the number of vertical layers from the water depth and the cell size. The build provides two variants. The hydrostatic variant is faster and is run first, to verify that inflow and outflow balance in 3D as well. The non-hydrostatic variant (hydrodyn) additionally resolves vertical accelerations, which matter at steep changes of the bed. The option Variant of the box selects which of the two Submit starts, and Load results adds the depth-averaged result to the map. In a terminal:

axqua submit <case-file> --kind build-3d
axqua submit <case-file> --kind steady-3d
axqua submit <case-file> --kind steady-3d --option variant=hydrodyn

The number of vertical layers is a choice of its own, which is examined with a separate study (Vertical convergence tab). In a shallow reach with a fine mesh, only few layers fit over the water depth, and a 3D TELEMAC simulation then adds little information to the 2D result.

TELEMAC hotstarts

A hotstart is a simulation that continues from the final state of a previous simulation instead of starting dry. The reach is then already filled, which saves the filling time in every subsequent run.

Steady hotstart. When the dry run has reached a steady state, aXqua writes the steering file hotstart2d.cas next to the model. It continues from the result of the dry run with unchanged boundary conditions. The calibration uses this file: each of its many runs changes a parameter slightly and starts from the steady state (Calibration & validation).

Unsteady hotstart (varying discharge). To simulate a flood wave, enter a discharge time series under boundaries.inflow (Liquid boundaries) and repeat the preprocessing. aXqua then additionally writes the steering file unsteady2d.cas. The unsteady run starts from the steady result, so that the reach is filled when the flood wave arrives, and writes its own result r2d-unsteady.slf. Submitting the run writes unsteady2d.cas again from the case file: a time series that was changed later needs no new mesh, and changes made in the steering file by hand are replaced. Run the steady simulation first; aXqua refuses a steady result that is missing, belongs to an earlier mesh or was overwritten by an unsteady run. The steady discharge of the case (boundaries.prescribed_flowrate) should therefore equal the first value of the time series. Start the run with Submit on the Unsteady 2D tab, where the option Run in 3D selects the 3D model, or in a terminal:

axqua submit <case-file> --kind unsteady
axqua submit <case-file> --kind unsteady --option mode_3d=true

The duration of the unsteady run follows from the time series. With the outflow condition stage_discharge, the downstream water level follows the rating curve during the flood wave. Without a rating curve of its own, the case gets one that covers the discharges of the time series (rating-curve-unsteady.csv).

Temperature dynamics

The water temperature of a river varies over the day and along the reach. It depends on the temperature of the inflow, on the sun, the air and the bed, and on groundwater that returns to the river. aXqua computes it together with the unsteady run of TELEMAC-2D, with the thermal process of WAQTEL, the water quality module of TELEMAC.

What is computed. The temperature is a tracer, which is a quantity that the water carries with it. Three processes change it at a point of the river. The flow transports it (advection). Turbulence mixes it with the surrounding water (diffusion; the model uses the turbulent viscosity for this). And heat enters or leaves the water through its surface and through the bed:

\[\frac{\partial T}{\partial t} + \mathbf{u} \cdot \nabla T = \frac{1}{h} \nabla \cdot \left( h \, \nu_t \, \nabla T \right) + \frac{H_s + H_l + H_e + H_c + H_b}{\rho \, c_p \, h}\]

where \(T\) is the depth-averaged water temperature, \(\mathbf{u}\) the flow velocity, \(h\) the water depth, \(\nu_t\) the turbulent viscosity, \(\rho\) the density and \(c_p\) the specific heat capacity of water. The heat fluxes are the solar radiation \(H_s\), the longwave radiation of the sky and of the water \(H_l\), evaporation \(H_e\), the heat exchange with the air \(H_c\) and the heat exchange with the bed \(H_b\). The fluxes are those of Dorthe et al. (2025). Shallow water warms and cools faster than deep water, because the same flux acts on less water.

Only the heat fluxes are specific to the temperature. The transport and the mixing are the same for every substance that is dissolved in the water.

Note

Other tracers, such as salt or a dye, are not yet available.

The data. Open the case settings, page Hydraulic simulation, frames Water temperature. Tick Simulate the water temperature in the unsteady run first: until then, the other settings of the temperature are grayed out. Settings that most cases leave at their default, such as the albedo of the water or the number of directions of the horizon, are offered under Add setting… of their frame. The frames hold:

  • Inflow. The time series under boundaries.inflow needs dates, and a discharge and a temperature column for every inflow line, for example Q LB and T LB for the inflow line with the name LB.

  • Weather. A table with the time, the air temperature, the humidity and the global radiation of a station near the reach. Wind, air pressure and cloud cover are used where the table has them. The tables of MeteoSwiss and of the German weather service DWD are recognized.

  • Shade. A surface model with trees and buildings. aXqua computes for every point of the mesh when the sun is hidden and how much of the sky is visible.

  • Bed and groundwater. The bed is a layer of sediment that takes up heat by day and returns it at night. Where the case has an exchange with a porous body (Liquid boundaries), the water that returns from it has the temperature heat.groundwater_temperature. With heat.groundwater_from_river, it has instead the mean inflow temperature of the last heat.groundwater_window hours (24 by default), weighted by the discharge of the inflow lines. Until a whole window has passed, it takes the mean of the first window. Use this when the runs cover more than one season: on the Isar, a constant temperature calibrated in March made the side arms 3 °C too warm in February. It needs the exchange in its fortran implementation.

Enter the offset of every clock from UTC (Coordinated Universal Time), for example 1 for Central European Time. A time stamp with a zone of its own, such as 2025-03-18T12:00+01:00, is read with that zone, and the offset counts only for stamps without one. A wrong offset shifts the sun against the water and shows as a wrong time of the highest temperature.

The run. Run the steady simulation first and then the unsteady one, as for a flood wave (TELEMAC hotstarts). The result r2d-unsteady.slf contains the water temperature, the temperature of the bed, and the mean, the highest and the lowest water temperature of every point after the hour heat.statistics_from. Load results adds them to the map. The water of the start has one temperature everywhere, so choose the window of the statistics late enough for this water to have left the reach.

Comparison with measurements. When the case names the temperatures of loggers (heat.observations) and their positions (heat.observation_points), the run ends with a comparison in axqua-case/postprocessing/water-temperature/:

File

Content

scores.csv

For every logger: the mean error (bias), the mean absolute error (MAE) and the root mean square error (RMSE), with the measured and the simulated range.

scores-reference.csv

The same for the inflow temperature without a model. A simulation is useful only if it is better than this.

comparison.png, series.csv

Measured and simulated temperatures over time.

Check the loggers before using them. A sensor that the sun or the air reaches reads too high by day. On the Isar, two sensors of one logger differed by up to 3.5 °C.

Calibration. The flow is calibrated first (Calibration & validation). The calibration of the temperature keeps it and varies the parameters under heat.calibrate: a factor on the wind function, the thermal diffusivity of the bed and the temperature of returning groundwater (unless it follows the river). The targets are the mean, the highest and the lowest temperature of every logger. In the box of the calibration, tick Calibrate the water temperature instead of the flow, or use the terminal:

axqua submit <case-file> --kind calibration --option heat=true --option sensitivity=true
axqua submit <case-file> --kind calibration --option heat=true

The error of every target combines two standard deviations in °C: heat.observation_error, the error of the loggers, and heat.model_error, what the model cannot reproduce with any parameter set (0 by default). Unlike for water depths and velocities, no share of the measured value is added, because a temperature in °C has no natural zero: 10 % would make a logger at 15 °C five times as uncertain as one at 3 °C. After the initial design, the log states by how much its best set misses the targets and which heat.model_error would make that the expected misfit. On the Isar, the best of 32 sets missed by 0.43 K, which with loggers of 0.3 K gives a model error of 0.31 K. Without a model error, the error assumes that the model could fit the loggers better than any of its runs does, and the posterior comes out narrower than the data support.

The posterior is the accepted part of a random sample of the prior ranges, heat.prior_samples parameter sets (50,000 by default). The surrogate evaluates them in seconds. A small error accepts few of them: on the Isar, 63 of 5,000 at 0.3 K.

Start with the sensitivity. It is one run that shows how far both ends of the range of every parameter move the temperatures (sensitivity.csv in calibration-validation/heat/). A parameter whose whole range moves them by less than the error of the loggers cannot be calibrated with these measurements. Leave it out, or choose a longer period.

The temperature does not act on the flow in this model. One run can therefore carry many parameter sets, each as a temperature of its own in the same flow. On the Isar (26,553 points), a run with 32 sets took 3.6 times as long as a run with one. The initial simulations of the calibration use this; the setting heat.sets_per_run is the number of sets in one run. The simulations of the active learning still run one set at a time.

After the calibration. On the tab of the unsteady simulation, tick Use the calibrated values of the water temperature (--option calibrated_heat=true in the terminal). The run takes the calibrated values of the temperature without changing the case file and ends with the comparison with the loggers described above.

Note

The validation of a calibrated temperature in a second period is not yet available in the plugin.

OpenFOAM

An OpenFOAM simulation resolves the flow in three dimensions together with the water surface. It is required where the vertical structure of the flow matters, for example at structures or in a fishway. The settings are described in OpenFOAM choices.

  1. Build. Go to the tab Simulations, sub-tab OpenFOAM. The box Free surface (VOF) contains the check box Use TELEMAC warm-up. As long as the check box is not changed, the case file decides, in which the warm-up is enabled by default. Leave it unchanged or ticked (aXqua warm-up concept) and click Build. aXqua runs the warm-up if the case has no steady 2D result yet, creates the mesh and writes the OpenFOAM case into axqua-case/openfoam/. With the box cleared, the model is built without a TELEMAC result, and OpenFOAM has to fill the dry riverbed itself.

  2. Run. Click Submit. The run has two stages: a short first stage with a small time step, in which the water surface settles, and the main stage. The progress display shows the Courant number (Co) and the time step (dt). In a healthy run, the time step stays near a constant value. A time step that falls by orders of magnitude indicates a problem, typically air that is accelerated to unrealistic velocities.

  3. Evaluate. After the run, aXqua reports the discharge of water at the inflow and the outflow and compares their relative difference with hydrodynamics.flux_tolerance, which is the same criterion as for TELEMAC. Water that leaves the model through its top is part of this balance and is reported as a share of the discharge. aXqua also reports whether water reached the lid or the lateral limits of the mesh. In that case, the mesh has constrained the flow, and openfoam.freeboard or openfoam.wet_margin has to be increased. Water can also leave through the top while the water surface stays well below it, as traces of water that the air carries away from a smeared surface (OpenFOAM choices).

The sub-tab OpenFOAM of the tab Simulations

The tab Simulations, sub-tab OpenFOAM. (1) The check box Use TELEMAC warm-up. In the state shown, the case file decides, in which the warm-up is enabled by default. (2) Build creates the OpenFOAM model. (3) Submit starts the simulation.

In a terminal, the commands are:

axqua submit <case-file> --kind openfoam-build
axqua submit <case-file> --kind openfoam-run

Before the first vof run of a new case, run the model once in the mode rigid-lid with a coarse mesh (cell_size_factor of 3 to 5). This run takes minutes and reveals most setup errors.

A new run or a new build replaces the earlier results. A run starts from the initial state. Before it starts, aXqua therefore moves the results of the earlier run into the folder previous-run/ in the folder of the OpenFOAM model: the time folders, the processor folders of a parallel run, postProcessing/ with the discharge records, VTK/, depth-averaged.slf and the reports. A new build does the same, because a result cannot be continued on another mesh. Only one earlier run is kept, and the next run or build replaces the folder, so copy a result that is to be kept to another place first. A parallel run that was not reconstructed keeps its result in the processor folders. The predefined figures read it from there, and ParaView reads it with the case type Decomposed Case.

The result seen from above. After a run, aXqua sums the water of each column of the mesh and writes the water depth and the depth-averaged velocity of the last time step into the file depth-averaged.slf in the folder of the OpenFOAM model. The file has the same variables as a TELEMAC result. Load results on the sub-tab OpenFOAM adds it to the map with the same styles as a 2D result, so that the two models can be compared directly. The complete three-dimensional result is opened in ParaView with the file case.foam in the same folder.

Starting a fine model from a coarse one. A three-dimensional model often has a lower or higher resistance than the 2D model it starts from, so that the water level of the whole reach has to adjust. That takes thousands of seconds of simulated time, and on a fine mesh, this costs days. It is faster to let a coarse model reach the steady state first and to start the fine model from its result:

  1. Build and run the model with a large cell_size, for example 2 m with 8 layers, and a long end_time. Check in the report that inflow and outflow agree.

  2. Build the fine model with the option hotstart set to the file depth-averaged.slf of the coarse model, and run it. In a terminal:

    axqua submit <case-file> --kind openfoam-build --option hotstart=<folder of the coarse model>/depth-averaged.slf
    axqua submit <case-file> --kind openfoam-run
    

The coarse and the fine model need different folders. The entry project.openfoam_dir in the case file of the coarse model gives it its own folder, while both case files share the TELEMAC model.

On the Isar example, the model with 2 m cells and 8 layers (56,000 cells) computed 3000 s of simulated time in 2.3 hours on 8 processor cores. The model with 1 m cells and 14 layers (290,000 cells) started from its result computed 1500 s in 9.1 hours on 16 cores; its outflow stayed within 1 % of the inflow after 500 s. Both ran while another simulation used the other half of the computer.