Optimization#
A numerical model calibration should yield a computationally functional, and physically, at least a reasonably accurate model. Model calibration has already been covered in the results analysis section of the steady Telemac2d tutorial. This chapter first provides more tips to increase the physical correctness of a model, especially regarding the conservation of mass, which can sometimes be challenging in Telemac. Additionally, advanced calibration methods that use supervised machine learning to improve physical model accuracy are presented.
Goals and requirements
This tutorial explains how a Telemac model can be refined by improving its computational stability, and physical correctness. Thus, it is relevant after setting up a Telemac model, as explained for a simple case in the steady 2d chapter.
Computing Time#
Some of the keywords in TELEMAC’s steering (*.cas
) file affect computation speed.
Use the ACCURACY and MAXIMUM ITERATION keywords to yield faster convergence.
Deactivate
TIDAL FLATS
, even though deactivating tidal flats can not be recommended to yield physically meaningful and stable models.When using the GMRES solver (
SOLVER : 7
), varying the solver options may aid to reduce the total calculation time.Make sure to use the default
MATRIX STORAGE : 3
keyword.Use an earlier simulation (e.g., with a coarser mesh) to initiate the model with the
COMPUTATION CONTINUED : YES
andPREVIOUS COMPUTATION FILE : *.slf
keywords (see section 4.1.3 in the Telemac2d manual).
Moreover, Telemac2d provides a way to stop a simulation (step) when fluxes stabilize. To enable this feature, add the following block in the steering (*.cas
) file:
/ steady state stop criteria in steering.cas
STOP IF A STEADY STATE IS REACHED : YES / default is NO
STOP CRITERIA : 1.E-3;1.E-3;1.E-3 / use list of three values - defaults are 1.E-4
However, stop criteria are not functional for non-stationary flows (e.g., Von Karmàn [VK30] vortex street downstream of bridge piers). Read more about the convergence stop criteria in the Telemac2d manual (section 5.1).
More recommendations are in the user manual
The Telemac2d manual provides more recommendations for computing time, stability, and model optimization, including the mesh, in section 16.
Stability & Physical Correctness#
Accuracy#
When the accuracy keywords are improperly defined, TELEMAC may not be able to end the simulation. In this case, make sure to comment out the accuracy keywords and let TELEMAC use its default values:
/ SOLVER ACCURACY : 1.E-4
/ ACCURACY FOR DIFFUSION OF TRACERS : 1.E-4
/ ACCURACY OF K : 1.E-6
/ ACCURACY OF EPSILON : 1.E-6
/ ACCURACY OF SPALART-ALLMARAS : 1.E-6
Variable Time-Steps and CFL Condition#
Unstable simulations may occur when the CFL condition is insufficiently fulfilled. To ensure that the CFL condition is respected, enable variable timestep calculation and use the DESIRED COURANT NUMBER keyword (default value 1
), for example:
TIME STEP : 5
VARIABLE TIME-STEP : YES
DURATION : 5000
DESIRED COURANT NUMBER : 0.9
Note that the TIME STEP is still required because the GRAPHIC PRINTOUT PERIOD is a multiple of the defined TIME STEP.
Use the DURATION keyword
A variable timestep calculation may run eternally. Assigning the DURATION keyword avoids such eternal runs.
Implicitation#
To increase model stability, modify the following variables or make sure that the variables are within reasonable ranges in the CAS file:
IMPLICITATION FOR DEPTH
should be between0.5
and0.6
.IMPLICITATION FOR VELOCITIES
should be between0.5
and0.6
.IMPLICITATION FOR DIFFUSION
should be1.
or smaller.
Surface Oscillations (Wiggles)#
When physically non-meaningful gradients or oscillations occur at the water surface or the bathymetry has steep slopes, the following keyword settings may help:
FREE SURFACE GRADIENT
- default is1.0
, but it can be reduced to0.1
to achieve stability (nevertheless, start with going incrementally down, such as a value of0.9
).DISCRETIZATIONS IN SPACE : 12;11
- uses quasi-bubble spatial discretization with 4-node triangles for velocity.
Residual Mass Errors#
To reduce residual mass errors use in the steering file:
CONTINUITY CORRECTION : YES
Divergence#
To limit divergence issues, use the CONTROL OF LIMITS
and LIMIT VALUES
keywords. The LIMIT VALUES
keyword is a list of 8 integers for minimum and maximum values for H, U, V, and T (tracers). The implementation in the steering file looks like this:
CONTROL OF LIMITS : YES / default is NO
LIMIT VALUES : -1000;9000;-1000;1000;-1000;1000;-1000;1000 / default mins and max for H, U, V, tracer
Tidal Flats#
Wetting and drying of grid cells, for instance, during a simulation of dam breaks or flood hydrographs, may lead to model instability. While the Tidal Flats section in the Telemac2d steady modeling tutorial suggests physically and computationally meaningful keyword option combinations, section 16.5 in the Telemac2d manual recommends using the following settings in the steering file as conservative choices from the BAW’s Wesel example.
VELOCITY PROFILES : 4;0
TURBULENCE MODEL : 1
VELOCITY DIFFUSIVITY : 2.
TIDAL FLATS : YES
OPTION FOR THE TREATMENT OF TIDAL FLATS : 1
TREATMENT OF NEGATIVE DEPTHS : 2
FREE SURFACE GRADIENT COMPATIBILITY : 0.9
H CLIPPING : NO
TYPE OF ADVECTION : 1;5
SUPG OPTION : 0;0
TREATMENT OF THE LINEAR SYSTEM : 2
SOLVER : 2
PRECONDITIONING : 2
SOLVER ACCURACY : 1.E-5
CONTINUITY CORRECTION : YES
How to find the Wesel example
This example is typically installed in the following directory:
/telemac/v8p4/examples/telemac2d/wesel/
Discretization Scheme#
The default setting of DISCRETIZATIONS IN SPACE : 11;11
assigns a linear discretization for velocity and water depth, which is computationally fast but potentially unstable (read more in the section on general Telemac2d parameters). To overcome stability issues related to the discretization scheme, consider using DISCRETIZATIONS IN SPACE : 12;11
. In addition, setting FREE SURFACE GRADIENT COMPATIBILITY : 0.01
(i.e., close to zero) may aid in troubleshooting stability issues related to the discretization of velocity and depth.
Exceeding Maximum Iterations#
This section is co-authored by Federica Scolari.
A simulation may print EXCEEDING MAXIMUM ITERATIONS
warnings in the Terminal:
GRACJG (BIEF) : EXCEEDING MAXIMUM ITERATIONS: 50 RELATIVE PRECISION: 0.7234532E-01
GRACJG (BIEF) : EXCEEDING MAXIMUM ITERATIONS: 50 RELATIVE PRECISION: NaN
GRACJG (BIEF) : EXCEEDING MAXIMUM ITERATIONS: 50 RELATIVE PRECISION: NaN
GRACJG (BIEF) : EXCEEDING MAXIMUM ITERATIONS: 50 RELATIVE PRECISION: NaN
GRACJG (BIEF) : EXCEEDING MAXIMUM ITERATIONS: 50 RELATIVE PRECISION: NaN
GRACJG (BIEF) : EXCEEDING MAXIMUM ITERATIONS: 50 RELATIVE PRECISION: NaN
GRACJG (BIEF) : EXCEEDING MAXIMUM ITERATIONS: 50 RELATIVE PRECISION: NaN
EXCEEDING MAXIMUM ITERATIONS
warnings may occur when using SCHEME FOR ADVECTION OF […] keywords with the values 3
, 4
, 5
, 13
, or 14
. The reason is that these schemes yield CFL conditions of less than 1 by triggering iterative, adaptive timestepping. To troubleshoot EXCEEDING MAXIMUM ITERATIONS
warnings, try the following options:
Decrease the timestep gradually.
Decrease the solver accuracy (e.g. from
1.E-8
to1.E-6
).Use other values for
SCHEME FOR ADVECTION OF [...]
.Increase the
MAXIMUM NUMBER OF ITERATIONS FOR SOLVER
keyword value, but do not exceed200
.Change the
VELOCITY PROFILE
type (read this eBook’s instructions for 2d or 3d).Cold starts (i.e., defining initial conditions with the INITIAL CONDITIONS keyword in the steering file) may not converge. Therefore, either
increase the
PRESCRIBED FLOWRATES
gradually (or in a liquid boundary file), orcreate an initial conditions Selafin file, assigning a water depth at the inlet nodes.
Bayesian Calibration#
Requirements
Be comfortable with supervised learning concepts (read on hydro-informatics.com), and familiarize with the required vocabulary.
This section is under construction
Until we have found the time to describe Bayesian calibration with the usual hydro-informatics.com quality, we invite you to take a look at our open-access publication on coupling Telemac with surrogate models for Bayesian optimizations: Mouris et al. [MAES+23]. More information can also be found in Schwindt et al. [SCMM+23], Mohammadi et al. [MKG+18], and Oladyshkin et al. [OMKN20].