File: use_case_flood_model.rst

package info (click to toggle)
openturns 1.26-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 67,708 kB
  • sloc: cpp: 261,605; python: 67,030; ansic: 4,378; javascript: 406; sh: 185; xml: 164; makefile: 101
file content (463 lines) | stat: -rw-r--r-- 15,666 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
.. _use-case-flood-model:

A flood model
=============


Introduction
------------

The following figure presents a dyke protecting industrial facilities.
When the river level exceeds the dyke height, flooding occurs.
The model is based on a crude simplification of the 1D hydrodynamical equations of Saint-Venant
under the assumptions of uniform and constant flow rate and large rectangular sections.
This model was first introduced in [deRocquigny2006]_, and then used in [Limbourg2010]_,
[deRocquigny2012]_, [iooss2015]_, [baudin2015]_.

.. figure:: ../_static/flooding_section.png
    :align: center
    :alt: flooding section
    :width: 50%

    **Figure 1.** Flooding section.


Height independent random variables are considered:

  - :math:`Q`: flow rate :math:`[m^3 s^{-1}]`;
  - :math:`K_s`: Strickler :math:`[m^{1/3} s^{-1}]`;
  - :math:`Z_v`: downstream height :math:`[m]`;
  - :math:`Z_m`: upstream height :math:`[m]`;
  - :math:`B`: river width :math:`[m]`;
  - :math:`L`: river length :math:`[m]`;
  - :math:`Z_b`: altitude of the river banks :math:`[m]`;
  - :math:`H_d`: height of the dyke :math:`[m]`.

When the Strickler coefficient increases, the riverbed generates less friction.

The altitude of the dyke is:

.. math::
    Z_d = Z_b + H_d


The slope :math:`\alpha` of the river is assumed to be close to zero, which implies:

.. math::
    \alpha = \frac{Z_m - Z_v}{L},

if :math:`Z_m \geq Z_v`.
The water depth is ([deRocquigny2012]_ eq. 3.2 page 79) :

.. math::
    H = \left(\frac{Q}{K_s B \sqrt{\alpha}}\right)^{0.6},


for any :math:`K_s, Q>0`.
The flood altitude is:

.. math::
    Z_c = H + Z_v.


The altitude of the surface of the water is greater than the altitude of
the top of the dyke (i.e. there is a flood) if ([deRocquigny2012]_ eq. 3.3 page 79):

.. math::
    S = Z_c - Z_d

is greater than zero.

The following figure presents the model with more details.

.. figure:: ../_static/flooding_section_detail.png
    :align: center
    :alt: flooding section details
    :width: 50%

    **Figure 2.** Flooding section detail.

The cost :math:`C` can be decomposed into the building of the dyke and
the cost of the flood ([iooss2015]_ eq. 5.3 page 103):

.. math::
    C = C_d + C_s

where the cost of the dyke is:

.. math::
    C_d
    =\begin{cases}
    \frac{8}{20}   & \textrm{if } H_d < 8 \\
    \frac{H_d}{20} & \textrm{otherwise},
    \end{cases}

and the cost of the flood is:

.. math::
    C_s
    =\begin{cases}
    1 - 0.8 \exp(-\frac{1000}{S^4}) & \textrm{if } S < 0, \\
    1 & \textrm{otherwise}.
    \end{cases}


We assume that the 8 inputs have the following distributions.
We consider 2 different set of hypotheses.

- In the hypothesis where :math:`H_d` is low, then its distribution
  is uniform in the interval :math:`[2, 4]`.
- In the hypothesis where :math:`H_d` is high, then its distribution
  is uniform in the interval :math:`[7, 9]`.
  This is the hypothesis used in [iooss2015]_.

+----------------+-----------------------------------------------+
| Input variable | Distribution                                  |
+================+===============================================+
| :math:`Q`      | Gumbel(mode=1013, scale=558), :math:`Q` > 0   |
+----------------+-----------------------------------------------+
| :math:`K_s`    | Normal(mu=30.0, sigma=7.5), :math:`K_s` > 0   |
+----------------+-----------------------------------------------+
| :math:`Z_v`    | Uniform(a=49, b=51)                           |
+----------------+-----------------------------------------------+
| :math:`Z_m`    | Uniform(a=54, b=56)                           |
+----------------+-----------------------------------------------+
| :math:`B`      | Triangular(min=295, mode=300, max=305)        |
+----------------+-----------------------------------------------+
| :math:`L`      | Triangular(min=4990, mode=5000, max=5010)     |
+----------------+-----------------------------------------------+
| :math:`Z_b`    | Triangular(min=55, mode=55.5, max=56)         |
+----------------+-----------------------------------------------+
| :math:`H_d`    | Uniform(min=2, max=4)                         |
+----------------+-----------------------------------------------+

**Table 1.** Distribution of the input random variables in the scenario where :math:`H_d` is low.

+----------------+-----------------------------------------------+
| Input variable | Distribution                                  |
+================+===============================================+
| :math:`H_d`    | Uniform(min=7, max=9)                         |
+----------------+-----------------------------------------------+

**Table 2.** Distribution of the input random variables in the scenario where :math:`H_d` is high.
The other variables have the same distribution.

Moreover, we assume that the input random variables are independent.

We want to estimate the flood probability:

 .. math::
    P_f = \Prob{S > 0}.

The results depend on the hypothesis chosen for :math:`H_d`.

- If :math:`H_d` is low, then :math:`P_f = 7.3 \times 10^{-4}`
  (with coefficient of variation lower than 0.01).
  In this case, the model is mostly additive.
- If :math:`H_d` is high, then :math:`P_f = 7.6 \times 10^{-5}`
  (with coefficient of variation lower than 0.01).
  In this case, the model for :math:`C` has interactions, mainly for :math:`Q`,
  :math:`K_s`, :math:`Z_v` and :math:`H_d`.
  The model is mostly additive for :math:`H` and :math:`S`.

Analysis of the model
---------------------

The next figure presents the river height :math:`H` depending on the flowrate
:math:`Q` when the other parameters are set to their mean values.
We see that the river height as a power model shape which is a property
of the Manning-Strickler model.

.. plot::

    import openturns as ot
    import openturns.viewer as otv
    from openturns.usecases import flood_model

    fm = flood_model.FloodModel()
    heightInputDistribution, heightModel = fm.getHeightModel()

    # %%
    # Set all inputs to constants, except Q
    indices = [1, 2, 3]
    referencePoint = [heightInputDistribution.getMarginal(i).getMean()[0] for i in indices]
    heightModelvsQ = ot.ParametricFunction(heightModel, indices, referencePoint)
    qRange = fm.Q.getRange()
    qMin = qRange.getLowerBound()[0]
    qMax = qRange.getUpperBound()[0]
    graph = heightModelvsQ.draw(qMin, qMax, 200)
    otv.View(graph)

The next figure plots the cost :math:`C` depending on the overflow :math:`S`
in the default scenario where the dyke height is low.
It makes use of a Quasi Monte Carlo sample of size :math:`n = 10000`.

.. plot::

    import openturns as ot
    import openturns.viewer as otv
    from openturns.usecases import flood_model

    fm = flood_model.FloodModel()

    sampleSize = 10000
    experiment = ot.LowDiscrepancyExperiment(ot.SobolSequence(), fm.distribution, sampleSize, True)
    inputSample = experiment.generate()
    outputSample = fm.model(inputSample)

    graph = ot.Graph("Scenario: dyke is low", "S", "C", True)
    cloud = ot.Cloud(outputSample[:, 1], outputSample[:, 2])
    graph.add(cloud)
    otv.View(graph)

The next figure plots the cost :math:`C` depending on the dyke height :math:`H_d`
when the other parameters are set to their mean values.
We notice that the cost first decreases because the flooding cost decreases
when the dyke height increases.
Then the cost increases because cost of the dyke increases when the
dyke height increases.

.. plot::

    import openturns as ot
    import openturns.viewer as otv
    from openturns.usecases import flood_model

    fm = flood_model.FloodModel()

    # Set all inputs to constants, except Hd
    indices = [0, 1, 2, 3, 4, 5, 6]
    referencePoint = [fm.distribution.getMarginal(i).getMean()[0] for i in indices]
    costModelvsHd = ot.ParametricFunction(fm.model.getMarginal(2), indices, referencePoint)
    hdMin = 0.0
    hdMax = 12.0
    graph = costModelvsHd.draw(hdMin, hdMax, 200)
    otv.View(graph)

The next figure presents the distribution of the three outputs in the
default scenario where the height of the dyke is low.
It is based on a Monte-Carlo sample of size :math:`n = 1000` and uses
the histogram to estimate the density of the output of the model.

.. plot::

    import openturns as ot
    import openturns.viewer as otv
    from matplotlib import pyplot as plt
    from openturns.usecases import flood_model

    fm = flood_model.FloodModel()

    outputDimension = fm.model.getOutputDimension()

    # Make a plot
    sampleSize = 1000
    inputSample = fm.distribution.getSample(sampleSize)
    outputSample = fm.model(inputSample)
    grid = ot.GridLayout(1, outputDimension)
    for i in range(outputDimension):
        marginalOutputSample = outputSample.getMarginal(i)
        graph = ot.HistogramFactory().build(marginalOutputSample).drawPDF()
        graph.setLegends([""])
        if i > 0:
            graph.setYTitle("")
        grid.setGraph(0, i, graph)

    grid.setTitle("Scenario: dyke is low")
    _ = otv.View(grid, figure_kw={"figsize": (8.0, 2.5)})
    plt.subplots_adjust(wspace=0.4, top=0.8)

The next figure presents the distribution of the three outputs in the
scenario where the height of the dyke is high.

.. plot::

    import openturns as ot
    import openturns.viewer as otv
    from matplotlib import pyplot as plt
    from openturns.usecases import flood_model

    fm = flood_model.FloodModel(distributionHdLow=False)

    outputDimension = fm.model.getOutputDimension()

    # Make a plot
    sampleSize = 1000
    inputSample = fm.distribution.getSample(sampleSize)
    outputSample = fm.model(inputSample)
    grid = ot.GridLayout(1, outputDimension)
    for i in range(outputDimension):
        marginalOutputSample = outputSample.getMarginal(i)
        graph = ot.HistogramFactory().build(marginalOutputSample).drawPDF()
        graph.setLegends([""])
        if i > 0:
            graph.setYTitle("")
        grid.setGraph(0, i, graph)

    grid.setTitle("Default scenario: dyke is high")
    _ = otv.View(grid, figure_kw={"figsize": (8.0, 2.5)})
    plt.subplots_adjust(wspace=0.4, top=0.8)

The next figure presents the Sobol' indices of the three outputs in the
scenario where the height of the dyke is low.
We estimate the Sobol' indices from sampling, using a root sample
size equal to :math:`n = 2^{13}` and the Sobol' low discrepancy sequence.

.. plot::

    import openturns as ot
    import openturns.viewer as otv
    from matplotlib import pyplot as plt
    from openturns.usecases import flood_model

    fm = flood_model.FloodModel()
    outputDimension = fm.model.getOutputDimension()

    sampleSize = 2**13
    sie = ot.SobolIndicesExperiment(fm.distribution, sampleSize)
    inputDesign = sie.generate()
    input_names = fm.distribution.getDescription()
    inputDesign.setDescription(input_names)
    inputDesign.getSize()
    outputDesign = fm.model(inputDesign)

    # Make a plot
    grid = ot.GridLayout(outputDimension, 1)
    grid.setTitle(f"n = {sampleSize}")
    for i in range(outputDimension):
        marginalOutputSample = outputDesign.getMarginal(i)
        sensitivityAnalysis = ot.SaltelliSensitivityAlgorithm(
            inputDesign, marginalOutputSample, sampleSize
        )
        graph = sensitivityAnalysis.draw()
        graph.setTitle(marginalOutputSample.getDescription()[0])
        grid.setGraph(i, 0, graph)
    grid.setTitle("Default scenario: dyke is low")
    view = otv.View(
        grid,
        figure_kw={"figsize": (7.0, 9.0)},
        legend_kw={"bbox_to_anchor": (1.0, 1.0), "loc": "upper left"},
    )
    plt.subplots_adjust(wspace=0.4, hspace=0.5, right=0.7)

The next figure presents the Sobol' indices of the three outputs in the
scenario where the height of the dyke is high.

.. plot::

    import openturns as ot
    import openturns.viewer as otv
    from matplotlib import pyplot as plt
    from openturns.usecases import flood_model

    fm = flood_model.FloodModel(distributionHdLow=False)
    outputDimension = fm.model.getOutputDimension()

    sampleSize = 2**13
    sie = ot.SobolIndicesExperiment(fm.distribution, sampleSize)
    inputDesign = sie.generate()
    input_names = fm.distribution.getDescription()
    inputDesign.setDescription(input_names)
    inputDesign.getSize()
    outputDesign = fm.model(inputDesign)

    # Make a plot
    grid = ot.GridLayout(outputDimension, 1)
    grid.setTitle(f"n = {sampleSize}")
    for i in range(outputDimension):
        marginalOutputSample = outputDesign.getMarginal(i)
        sensitivityAnalysis = ot.SaltelliSensitivityAlgorithm(
            inputDesign, marginalOutputSample, sampleSize
        )
        graph = sensitivityAnalysis.draw()
        graph.setTitle(marginalOutputSample.getDescription()[0])
        grid.setGraph(i, 0, graph)
    grid.setTitle("Scenario: dyke is high")
    view = otv.View(
        grid,
        figure_kw={"figsize": (7.0, 9.0)},
        legend_kw={"bbox_to_anchor": (1.0, 1.0), "loc": "upper left"},
    )
    plt.subplots_adjust(wspace=0.4, hspace=0.5, right=0.7)

The next figure presents the Sobol' indices of the height model output
with four inputs :math:`(Q, K_s, Z_v, Z_m)` only.
This is a simpler model that leads to a simplified analysis.

.. plot::

    import openturns as ot
    import openturns.viewer as otv
    from matplotlib import pyplot as plt
    from openturns.usecases import flood_model

    fm = flood_model.FloodModel()
    heightInputDistribution, heightModel = fm.getHeightModel()
    outputDimension = heightModel.getOutputDimension()

    sampleSize = 2**13
    sie = ot.SobolIndicesExperiment(heightInputDistribution, sampleSize)
    inputDesign = sie.generate()
    input_names = heightInputDistribution.getDescription()
    inputDesign.setDescription(input_names)
    inputDesign.getSize()
    outputDesign = heightModel(inputDesign)

    # Make a plot
    sensitivityAnalysis = ot.SaltelliSensitivityAlgorithm(
        inputDesign, outputDesign, sampleSize
    )
    graph = sensitivityAnalysis.draw()
    graph.setTitle("Height model with (Q, K_s, Z_v, Z_m) as inputs")
    graph.setLegendCorner([1.0, 1.0])
    graph.setLegendPosition('upper left')
    view = otv.View(
        graph,
        figure_kw={"figsize": (6.0, 4.0)},
    )
    plt.subplots_adjust(right=0.7)

Analysis of the calibration problem
-----------------------------------

In this section, we analyse why calibrating the parameters of this model
may raise some difficulties.

First, the slope :math:`\alpha` only depends on the difference :math:`Z_m - Z_v`.
This is why :math:`Z_v` and :math:`Z_m` cannot be identified at the same time.
In algebraic terms, there is an infinite number of couples :math:`(Z_v, Z_m)` which
generate the same difference :math:`Z_m - Z_v`.

Second, the denominator of the expression of :math:`H` involves the product
:math:`K_s B \sqrt{\alpha}`.
In algebraic terms, there is an infinite number of couples :math:`(K_s, \alpha)` which
generate the same product :math:`K_s \sqrt{\alpha}`.
This is why either :math:`K_s` or :math:`\alpha` can be identified separately,
but not at the same time.
This shows that only one parameter can be identified.

Hence, calibrating this model requires some regularization which can be done
by Bayesian methods.

References
----------

* [deRocquigny2006]_
* [Limbourg2010]_
* [deRocquigny2012]_
* [iooss2015]_
* [baudin2015]_

API documentation
-----------------

.. currentmodule:: openturns.usecases.flood_model

.. autoclass:: FloodModel
    :noindex:

Examples based on this use case
-------------------------------

.. minigallery:: openturns.usecases.flood_model.FloodModel