Está en la página 1de 115

EDF R&D

NATIONAL HYDRAULICS AND ENVIRONMENT LABORATORY


NUMERICAL AND PHYSICAL MODELLING IN RIVER AND COASTAL HYDRODYNAMICS
6 quai Watier - 78401 CHATOU CEDEX, +33 (1) 30 87 79 46

January 6 2014
Front Page

Adding a particle transport module to Telemac-2D with applications to algae


blooms and oil spills

Antoine JOLY

Cedric GOEURY

Jean-michel HERVOUET

H-P74-2013-02317-EN 1.0
This manual is part of the documentation on the TELEMAC hydro-informatic system. It describes
developments which have been done in Telemac-2D to allow different classes of bodies to be
modelled. The basis for the developments is that the Eulerian flow field modelled by Telemac-2D will
be used to transport these bodies using a Lagrangian model. The presence of bodies in a flow and the
transport patterns of these bodies is a classic problem in fluid mechanics. So, it is important to develop
tools predicting the motion of those particles, as they can hinder the operation of many industrial
structures and affect severely the environment. In this report the approach to model the transport of
particles in Telemac-2D is presented, and two new problems can now be modelled: algae blooms and
oil spills. The algal bloom problematic was chosen because the regions of Normandy and Brittany of
France have seen mass depositions of algae blooms in the recent years. The oil spill problematic was
motivated to provide decisional tools, and to fulfil operational needs, for risks connected to oil spill
drifts in continental waters (rivers, lakes, estuaries). We describe in this manual algae and oil particles
transport processes as well as their implementation (numerical and physical parameters, input and
output data files). After a general introduction in section 1, the theoretical background of both algae
blooms and oil spill models are explained in section 2. Then, the third section describes how these
models have been written within Telemac-2D to make use of multiprocessor parallelism. The section 4
consist of a user guide of particle modules in Telemac-2D. The section 5 is devoted to validations and
examples of application of oil and algae modules. Finally, the section 6 presents a methodological
guide to add particle transport modules to Telemac-2D. As such guidelines and advice are given in
this last section to allow a user to develop new particle transport models in Telem

Accessibility: Free Special mention: Declassification:


Front page Page I of III EDF SA 2013
EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 1.0

Validation workflow

Author Antoine JOLY 11/15/13

Reviewer Nicole GOUTAL 11/21/13

Approval Charles BODEL 12/30/13

Pre-diffusion
Recipient

Damien Violeau

Rza Issa

Riadh Ata

Business code E961/P10VU0/E01PILOTAGE

Accessibility: Free Page II of III EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 1.0

Diffusion list
Group

P7-LNHE

Recipient Entity / Structure Diffusion

Accessibility: Free Page III of III EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

AVERTISSEMENT / CAUTION

Laccs ce document, ainsi que son utilisation, sont strictement limits aux personnes expressment
habilites par EDF.
EDF ne pourra tre tenu responsable, au titre dune action en responsabilit contractuelle, en respons-
abilit dlictuelle ou de tout autre action, de tout dommage direct ou indirect, ou de quelque nature quil
soit, ou de tout prjudice, notamment, de nature financier ou commercial, rsultant de lutilisation dune
quelconque information contenue dans ce document.
Les donnes et informations contenues dans ce document sont fournies en ltat sans aucune garantie
expresse ou tacite de quelque nature que ce soit.
Toute modification, reproduction, extraction dlments, rutilisation de tout ou partie de ce document
sans autorisation pralable crite dEDF ainsi que toute diffusion externe EDF du prsent document ou
des informations quil contient est strictement interdite sous peine de sanctions.

-------

The access to this document and its use are strictly limited to the persons expressly authorized to do so
by EDF.
EDF shall not be deemed liable as a consequence of any action, for any direct or indirect damage, includ-
ing, among others, commercial or financial loss arising from the use of any information contained in this
document.
This document and the information contained therein are provided as are without any warranty of any
kind, either expressed or implied.
Any total or partial modification, reproduction, new use, distribution or extraction of elements of this doc-
ument or its content, without the express and prior written consent of EDF is strictly forbidden. Failure to
comply to the above provisions will expose to sanctions.

Accessibilit : Libre Page 1 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Executive Summary

This manual is part of the documentation on the TELEMAC hydro-informatic system. It describes devel-
opments which have been done in Telemac-2D to allow different classes of bodies to be modelled. The
basis for the developments is that the Eulerian flow field modelled by Telemac-2D will be used to transport
these bodies using a Lagrangian model.
The presence of bodies in a flow and the transport patterns of these bodies is a classic problem in fluid
mechanics. So, it is important to develop tools predicting the motion of those particles, as they can hinder
the operation of many industrial structures and affect severely the environment.
In this report the approach to model the transport of particles in Telemac-2D is presented, and two new
problems can now be modelled: algae blooms and oil spills. The algal bloom problematic was chosen
because the regions of Normandy and Brittany of France have seen mass depositions of algae blooms in
the recent years. The oil spill problematic was motivated to provide decisional tools, and to fulfil operational
needs, for risks connected to oil spill drifts in continental waters (rivers, lakes, estuaries).
We describe in this manual algae and oil particles transport processes as well as their implementation
(numerical and physical parameters, input and output data files). After a general introduction in section
1, the theoretical background of both algae blooms and oil spill models are explained in section 2. Then,
the third section describes how these models have been written within Telemac-2D to make use of multi-
processor parallelism. The section 5 consist of a user guide of particle modules in Telemac-2D. The section
6 is devoted to validations and examples of application of oil and algae modules. Finally, the section 7
presents a methodological guide to add particle transport modules to Telemac-2D. As such guidelines and
advice are given in this last section to allow a user to develop new particle transport models in Telemac-2D.
We recall here that oil and algae modules, as well as other modules of the Telemac system, are open
source and can be downloaded on the site (www.opentelemac.org). Difficulties related to installation,
bug reports as well as suggestions for future development are welcome and need to be submitted through
the forum to the development team.

Accessibilit : Libre Page 2 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Sommaire / Summary
AVERTISSEMENT / CAUTION 1

Executive Summary 2

1 Introduction 5

2 Theoretical background 6
2.1 Hydrodynamic model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Particle transport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Algae bloom transport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.1 Notations used to develop the algae bloom transport module . . . . . . . . . . . . . . . . . . 8
2.3.2 Fluid velocity model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.3 Dynamic properties of solid particle motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3.4 Physical properties of algae . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.5 Numerical approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.4 Oil spill transport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4.2 Notations used to develop the oil spill transport module . . . . . . . . . . . . . . . . . . . . . 15
2.4.3 Transport model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.4.3.1 Advection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.4.3.2 Diffusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.4.4 Shoreline Oiling Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4.4.1 Oil beaching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4.4.2 Oil refloating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.4.5 Weathering processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.4.5.1 Spreading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.4.5.2 Mass transfer processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.4.6 Switching from Lagrangian to Eulerian formulation . . . . . . . . . . . . . . . . . . . . . . . . 22
2.4.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3 Numerical methods for transport equations 25


3.1 Fractional steps method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.2 Resolution of advection: the method of characteristics . . . . . . . . . . . . . . . . . . . . . . . 25
3.3 Calculation of characteristic curve (C) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.4 Barycentric coordinates calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

4 Parallelism of particle transport model 29


4.1 General principles of parallelism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.2 Parallel simple fluid particle transport in Telemac-2D . . . . . . . . . . . . . . . . . . . . . . . . 29
4.2.1 Description of the module STREAMLINE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.2.2 Using STREAMLINE for particle transport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.3 Algae bloom specificities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.4 Oil spill specificities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

5 User guide for particle transport int Telemac-2D 36


5.1 Drogue transport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.1.1 Input files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.1.2 Steering file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.1.3 The fortran file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.1.4 Output files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.1.5 The Telemac Result file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
5.1.6 The output DROGUES FILE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
5.2 Algae bloom modelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.2.1 Input files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.2.2 Steering file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.2.3 The fortran file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

Accessibilit : Libre Page 3 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

5.2.4 Additional functionalities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39


5.2.5 Output files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.3 Oil spill modelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.3.1 Input files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.3.2 Steering file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.3.3 Oil spill steering file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.3.4 The OIL_FLOT subroutine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.3.5 Output files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

6 Application test cases 44


6.1 Algae particles validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
6.1.1 Description of the test case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
6.1.2 Analysis of the results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
6.1.3 Set-up for the simulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
6.1.4 Results of the simulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.2 Oil spill examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
6.2.1 Description of the artificial river test case (riv_art) . . . . . . . . . . . . . . . . . . . . . . . 51
6.2.2 Description of the Gironde estuary test case (estu_gir) . . . . . . . . . . . . . . . . . . . . 55

7 Future developments 61
7.1 Applying these developments to new bodies or adding new features . . . . . . . . . . . . . . . 61
7.1.1 Feature of Fortran 90 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
7.1.2 Developments to existing subroutines necessary for the transport of new bodies . . . . . . . 62
7.2 Adding new features to the algae bloom transport model . . . . . . . . . . . . . . . . . . . . . . 63
7.2.1 Add a new body type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
7.2.2 Adding new features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
7.3 Add a new feature to oil particles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
7.3.1 Programming in the module OILSPILL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

References 65

A Configuration for the obstructed channel flow validation case 67


A.1 Mesh used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
A.2 Steering File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
A.3 Fortran File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

B Example of a Fortran file recording algae exiting a domain 92

Accessibilit : Libre Page 4 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

1 Introduction

The presence of bodies in a flow and the transport patterns of these bodies is a classic problem in fluid
mechanics. Its analysis is required, whether it is for the transport of sediments along a coastline, the
apparition of air bubbles in pipe flow or aerosols released by fossil fuels. It is important to develop tools
predicting the motion of those particles, as they can hinder the operation of many industrial structures and
affect severely the environment.
As such developments have been done in Telemac-2D to allow different classes of bodies to be modelled.
The basis for the developments is that the Eulerian flow field modelled by Telemac-2D will be used to
transport these bodies using a Lagrangian model. This allows a flow dependent on large scale physical
processes to be modelled using the full capabilities of the code, and at the same time considering the
smaller scale effects affecting the bodies. For example to model algae blooms or oil spills in views of
protecting industrial structures the tidal flow needs to be modelled for several hours (12-24) along a region
of a few thousand square kilometres, and at the same time the physical characteristics of the body and
the turbulence generated by the flow need to be taken into account, both of these are of much smaller
scales (ranging from centimetres to meters and seconds to minutes). As such the mixed Eulerian and
Lagrangian approach allows physical processes of greatly varying scales to be modelled.
In addition the mixed Eulerian and Lagrangian approach chosen will allow future developments to be
added easily to the model so that further parameters that affect individual particles can be easily included.
These parameters can include a change of density, change of composition of oil spills, or even the death
of individuals in algae blooms. Furthermore the developments presented in this report will assume that
the bodies are passive. This means that they will not affect the flow, and therefore for a study already
modelled using Telemac-2D, adding particle transport should be easily done by a user.
In this report the approach to model two type of particles in Telemac-2D will be presented, and two new
problems can now be modelled: algae blooms and oil spills. The algal bloom problematic was chosen
because the regions of Normandy and Brittany of France have seen mass depositions of algae blooms
in the recent years. As such these algae blooms can affect the operation of industrial structures situated
along the coast. This motivated the PhD thesis by Joly [16], from which most of the developments are
based. The oil spill problematic was motivated to provide decisional tools, and to fulfil operational needs,
for risks connected to oil spill drifts in continental waters (rivers, lakes, estuaries). In fact, the application
of the European Water Framework Directive and the monitoring obligation on water quality for human
consumption and industrial activities created a need for water quality assessment and monitoring systems.
This initiated the MigrHycar project1 , partly funded by the French Research Agency (ANR). It is within the
framework of this research project that the PhD thesis by Goeury [11] developped the presented oil spill
model.
This report is then divided in six sections. The section 2 will describe the theoretical background of both
algae blooms and oil spill models. The third section will describe how these models have been written
within Telemac-2D to make use of multi-processor parallelism. The section 5 will consist of a user guide of
these two new modules in Telemac-2D. The section 6 will give validations and examples of application of
these modules. In the end this report should be seen as a methodological guide to add particle transport
modules to Telemac-2D. As such guidelines and advice will be given in section 7 to allow a user to develop
new particle transport models in Telemac-2D.

1 http://www.migrhycar.com

Accessibilit : Libre Page 5 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

2 Theoretical background

2.1 Hydrodynamic model

In this work, hydrodynamics is provided to particle transport models using Telemac-2D, which is a depth-
averaged hydrodynamic model. Telemac-2D was developed by the National Hydraulics and Environment
Laboratory (Laboratoire National dHydraulique et Environnement - LNHE) of the Research and Develop-
ment Directorate of the French Electricity Board (EDF-DRD), in collaboration with other research institutes:
Artelia, BAW, CETMEF, Daresbury Laboratory and HR Wallingford. This open source freeware program
(available at www.opentelemac.org) solves the free surface flow equations using the depth-averaged
hydrostatic Navier-Stokes equations, as derived first by Barr de Saint-Venant in 1871:

h
+ (hu) + (hv) =0 (1a)
t x y
hu Zs ( )
+ (huu) + (huv) = gh + hFx + he
(u) (1b)
t x y x
hv Zs ( )
+ (huv) + (hvv) = gh + hFy + he
(v) (1c)
t x y y

Where x and y are the horizontal Cartesian coordinates, t is the time, u and v are the horizontal com-
ponents of the depth-averaged velocity, h is the water depth, e is an effective diffusion representing
depth-averaged turbulent viscosity t and dispersion, Zs is the free surface elevation, Fx and Fy are the
forcing terms (friction, and so on).
It should be stated that these equations might change later on the report, according to the different modules
considered. The two modules (algae blooms and oil spill) are fairly complex and therefore they each have
their own notations used to explain the theory. These specific notations are summarised in tables 1 and
2.
The main results at each node of the computational mesh are the depth of water and the depth-averaged
velocity components. The main applications of Telemac-2D are in free-surface maritime and river hy-
draulics and the program is able to take the following phenomena into account:

Propagation of long waves, considering non-linear effects


Bed friction

Influence of Coriolis force


Influence of meteorological factors: atmospheric pressure and wind

Turbulence
Torrent and river subcritical flows

Influence of horizontal temperature or salinity gradients on density


Cartesian or spherical coordinates for large domains

Dry areas in the computational domain: intertidal flats and flood plains
Current entrainment and diffusion of a tracer, with source and sink terms

Monitoring of floats and Lagrangian drifts

More information are available in the Telemac User Guide2 .


2 http://www.opentelemac.org/index.php/manuals/viewcategory/13-telemac-2d

Accessibilit : Libre Page 6 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

2.2 Particle transport

In the introduction it was mentioned that the mixed Eulerian and Lagrangian approach was chosen so
that a wide range of physical scales could be modelled. The validity of this approach will now be anal-
ysed. Poelma et al. [23] gives an overview of parameters that can be used to categorise a particle laden
flows. Considering this approach the non-dimensional number f , which represents the volume fraction
of particles as introduced by Elghobashi [7], will be considered:

Nr
f = (2)
Vol

Nr is the number of particles present in the flow, is the volume occupied by a single particle and Vol is
the total volume occupied by the particles and the fluid. Elghobashi [7] showed that for volume fraction of
particles smaller than 106 a one way fluidparticle coupling can be done. This means that the information
from the fluid is given to the particle motion, but there is no transfer of information from the particles to the
fluid flow. A quick calculation shows that a volume fraction of 106 can correspond to the case where 100
particles with a volume of 0.001 m3 are transported in a volume of fluid 500 100 2 = 100 000 m3 . This
is typical of several particle problems within a coastal environment.
Another useful non-dimensional quantity is the particle Stokes number St introduced by Eaton and Fessler
[6]:

p
St = (3a)
s
(2p + f ) D2
p = (3b)
36f
( ) 12
s = (3c)

Where p is the particle density, f is the fluid density, D is a characteristic length of the body, is the
kinematic molecular viscosity and is the dissipation rate of the turbulent kinetic energy. This Stokes
number can be considered as the relationship between two characteristic times. p which is the relaxation
time for a particle experiencing only Stokes drag, and s which is the characteristic time for the small
turbulent eddies. Eaton and Fessler [6] show that particles with a Stokes number lower than 0.01 follow
almost exactly all the fluid fluctuations and that for a Stokes number greater than 25 the particles do not
respond to the small scale fluctuations. The second case is of particular interest as it allows particles to
ignore the small scales of turbulence. The oil spill module in Telemac-2D will follow this assumption, but
it will also assume that the particle relaxation time is small with respect to the large scale of turbulence,
and therefore the physical properties of the oil particles will not affect its motion. This allows the use
of Brownian Motion. However [16] has shown that algae bloom simulations are typically in between the
range 0.01 - 25, and therefore they will be partially affected by the small turbulent eddies, and a more
complete turbulence model will need to be used. It also means that the physical properties of the algae
will affect its own motion.
Therefore the parameter f shows the range for which the particle transport modules developed in
Telemac-2D will be valid, as they assume that the particles will not affect the flow. The parameter St
shows the range for which a simple turbulence model can be used, and those for which a more complex
turbulence and particle motion model needs to be used.
Using these definitions the particles will be modelled in Telemac-2D by first calculating the flow, then using
these properties to transport each individual particle. The motion of each particle will not affect the flow,
nor the other particles.

Accessibilit : Libre Page 7 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

2.3 Algae bloom transport

2.3.1 Notations used to develop the algae bloom transport module

As stated in the previous section the small scales of turbulence need to be taken into account and the
physical properties of each algae particle will stop it from following blindly the flow. This requires a specific
notation to be used, and it will be explained in table 1.

Table 1: Notations used to develop the algae bloom transport module.

Notation Description
CD Drag coefficient
D Characteristic length of the particle
M Added mass constant for an isotropic body
P Fluid pressure
Re Particle Reynolds number
S Cross-sectional area of the solid body
Tt Turbulent characteristic time
U Fluid velocity
V Particle velocity
dWi (t) Represents a Wiener process
X Particle position
dt Numerical time step
k Turbulent kinetic energy
m Mass of the body
Turbulent kinetic energy dissipation rate
Kinematic viscosity of the fluid
Volume of the body

Characters in bold represent vectors and a character followed by the subscript i will represent components
of direction of a vector. Furthermore an over bar (eg. in Ui ) indicates a mean flow component, from a
turbulent point of view. This should not be mistaken with depth averaged flow components, such as
defined in the shallow water equations, even though it will be assumed that these are the same, for the
ease of use within Telemac-2D.
In addition the particle Reynolds number is given by:

|U V| D
Re = (4)

2.3.2 Fluid velocity model

The turbulent fluctuations required to model the algae particles will be modelled through the use of a
stochastic turbulence Lagrangian model. The model chosen here is the Simplified Langevin Model for
turbulence in inhomogeneous turbulent flow [25]:

( )
1 P 1 3 [ ]
dUi (t) = dt + C0 Ui (t) Ui dt + C0 dWi (t) (5)
f xi 2 4 k

As a reminder, U represents the fluid velocities, P represents the fluid pressure, k is the turbulent kinetic
energy, is its dissipation rate and dWi (t) represents a Wiener process. In addition, C0 is a constant used
in the Simplified Langevin Model, typically set to 2.1.

Accessibilit : Libre Page 8 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

In this equation all the mean flow components P , Ui , k and are evaluated at the fluid particle position
Xi (t). These can be obtained from Telemac-2D, where it is assumed that the depth-averaged properties
are equal to the mean flow properties (i.e. Ui , k a,d ). Furthermore P /xi is calculated using the time
derivative of the fluid velocities.
In addition the development of equation 5 requires the time step to be s dt Tt , where s is the
characteristic time scale of the small turbulent eddies (see equation 3c) and Tt is an integral time scale,
defined by the following equation:

1 k
Tt = 1 3 (6)
2 + 4 C0

This time scale is close to the characteristic time for the large turbulent eddies, and therefore will be
referred to later on as the turbulent characteristic time. Furthermore another notation for the Simplified
Langevin Model is often used:

1
dUi (t) = Ui (t)dt + Ci (t)dt + Bi (t)dWi (t) (7)
Tt

Where the coefficient Ci regroups the mean flow components:

1 P 1
Ci = + Ui (8)
f xi Tt

And the coefficient Bi is standard deviation of the stochastic term:


Bi = C0 (9)

More information on Lagrangian stochastic fluid velocity models can be found in Pope [24].

2.3.3 Dynamic properties of solid particle motion

It has already been established that the particles will not affect the general flow surrounding it, but it should
also be noted that even though the bodies are large enough that their physical characteristics need to be
taken into account, they are small enough that the flow variations are negligible along a length scale of
the same order as the size of the particle. In turbulent flows this means that the turbulent structure do not
rotate the bodies, and therefore they will keep the same orientation in time and are assumed irrotational. In
Joly [16] it has therefore been shown that the algae particle motion can be modelled using the buoyancy
force, the drag force, the momentum of the body and the Basset history force. Furthermore the algae
particles have been simplified to isotropic bodies. The velocity components can therefore be modelled
with the following equation:

dVi dUi d 1
m =f M (Vi Ui ) + f SCD (Re) |U V| (Ui Vi )
dt dt dt 2
4 d
+ CB t (Ui (t) Vi (t)) + Ci,Bas + (m f ) gi (10)
3 dt

As a reminder, V is the particle velocity, m is the mass of the body, is the volume of the body, M is the
added mass constant for an isotropic body, S is the cross-sectional area of the solid body, CD is the drag

Accessibilit : Libre Page 9 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

coefficient, Re is the particle Reynolds number, D is the characteristic length of the particle and is the
kinematic viscosity. In addition, CB is the Basset history force constant given by:


CB = 6D2 f (11)

Finally, Ci,Bas is the Basset history force components independent of the current time, which is given in
detail in Joly [16].
Furthermore, equation 10 can be simplified as:

dVi =Fa dUi + Fb (Ui Vi ) dt + Fi,c dt (12)

This equation can be used numerically, with dt being the numerical time step. In this equation the first
coefficient is linked to the evolution of the fluid, and it is given by the following equation:


f + M + 34 CB dt
Fa = (13)
m + M + 34 CB dt

The second coefficient is linked to the velocity differences between the fluid and the solid body:

f SCD |U V|
Fb = ( ) (14)
2 m + M + 43 CB dt

The final coefficient depends on constant values (during time t):

(mf ) gi + Ci,Bas
Fi,c = (15)
m + M + 43 CB dt

Out of those coefficients the most important one is Fb , as it can be used to define the particle relaxation
time part . This characteristic time is a measure of how fast a particle will react to flow variations, and it is
given by the following definition:

1
part = (16)
Fb

2.3.4 Physical properties of algae

Since the algae particles have been reduced to isotropic bodies, the simplest form will be to assume that
these particles can be modelled as solid spheres. Therefore the characteristic length of the particle is
given by the sphere diameter Ds and the following components can be used within equations 12 - 15:

|U V| Ds
Res = (17a)

Ds2
Ss = (17b)
4
Ds3
s = (17c)
6

Accessibilit : Libre Page 10 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

The drag coefficient will then be given by the following equation [1]:

[ ]1/10
1
CD,sphere = + 4 (18a)
(1 + 2 )1 + (3 )1
1 =(24Re1s )
10
+ (21Re0,67
s )10 + (4Re0,33
s )10 + (0, 4)10 (18b)
1
2 = (18c)
(0, 148Re0,11
s )10 + (0, 5)10

3 =(1, 57 108 Re1,625


s )10 (18d)
1
4 = (18e)
(6 1017 Re2,63
s )10 + (0, 2)10

And the added mass constant Ms for a sphere given as [30]:

1
Ms = f s (19)
2

The first algae considered are Ulva, as these are the main algae causing a problem in the North of France.
These algae have a very weak grip on the sea bed and are therefore easily carried by a current. They are
only slightly denser than water, around 1050 kg/m3 . These algae are very thin, two cells thick (therefore
about 50 m), but characteristic length in the order of 5 cm, see figure 1.

Accessibilit : Libre Page 11 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

(a) Ulva scandinavica3 (b) Iridaea Flaccida4

Figure 1: Example of algae.

Because of their size the inertial properties of such particles can be very significant. However since these
algal particles are transported over a large distance and because they can fold over it can be assumed that
their orientation will only play a minor part in their transport, and it is assumed that they can be modelled
similarly as spheres. However there are a few modifications that can be done to correspond better to
their specificities. Firstly the algae will be considered as disks that are 5 cm in diameter (Da ) and 50 m
in thickness (ta ). For modelling purpose it will be assumed that they can be folded and will resemble a
sphere when transported by the flow. Therefore the inertial properties of an alga will be normalised using
the maximum projected area [10]. This means that the Reynolds number, the surface area and the volume
used to find the drag coefficient and added mass tensor are defined by:

|U V| Da
Rea = (20a)

Da2
Sa = (20b)
4
a =Sa ta (20c)

Gaylord et al. [10] provide experimental values for the drag coefficient and added mass tensor of three
algae of different shape. Out of these algae Iridaea Flaccida is the closest in shape to the Ulvas. These
experimental values will be linked to the values for a sphere, such as given by Almedeij [1], in figure 2.

3 source: http://www.marevita.org
4 source: Gaylord et al. [10]

Accessibilit : Libre Page 12 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

0.6

0.4
CD

0.2

0.
104 105
Rep

Figure 2: The drag coefficient for an Iridaea flaccida. . represents the experimental values given in
Gaylord et al. [10], . represents the best fit line of those values and . represents the
empirical formula for a sphere given by Almedeij [1].

Figure 2 shows that the drag coefficient of an alga particle is lower than that of a sphere for high particle
Reynolds number. However it should be noted that the lowest value of the Reynolds number from the
experimental data is still rather high (around 2 105 ). This is why the best fit line of the experimental drag
coefficient increases rapidly after the known values. In order to stop the model from overestimating the
drag coefficient it is assumed that for the particle Reynolds number at the intersection of the best fit line
and the spherical drag coefficient (Re = 14073 in figure 2) and under, the value for the drag coefficient
should be that of a sphere, but calculated with the properties of an alga. The drag coefficient for an Iridaea
flaccida alga is therefore given in the following equation:

{
exp (6.822121 0.800627 ln (Re)) if Re > 14073
CD,a = (21)
CD,sphere (Rea ) if Re < 14073

Where CD,sphere is given by equation 18, described later on. In the same paper by Gaylord et al. [10] an
estimate of the added mass constant is given for the same alga (it is simplified to an isotropic body, see
equation 19):

M = Ma =3.57f a (22)

The drag coefficients and added mass for the different algae particles presented in Gaylord et al. [10] will
also be made available in the algae transport module of Telemac.

2.3.5 Numerical approach

The previous three sections allow algae particles to be transported using a three-equation model:

1
dUi = Ui dt + Ci dt + Bi dWi (23a)
Tt
1
dVi =Fa dUi + (Ui Vi ) dt + Fi,c dt (23b)
part
dXi =Vi dt (23c)

Accessibilit : Libre Page 13 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

As is visible from this equation there are two characteristic times, the particle relaxation time part and
the integral time scale Tt and dt is now considered as a numerical time step. These two characteristic
times can be very limiting, as to solve the solid particle velocities explicitly one must satisfy dt part , but
to solve for the fluid particle velocities one must satisfy dt Tt . However there is no reason why these
two characteristic times would be of the same order, or even constant in space and time. It fact in any
simulation the two times will have a range covering several orders and are almost always very different.
The numerical resolution of this problem is therefore given in Joly [16].

2.4 Oil spill transport

2.4.1 Introduction

The purpose of the numerical model is to provide short-term forecasting in relatively calm waters. Con-
sequently, biological processes which affect the oil spill over a long time can be neglected, as well as
dispersion and emulsification phenomena (which are mainly caused by breaking waves). When oil is
spilled on the water surface, it spreads due to inertia, gravity, viscous and surface tension forces. This
forms what is known as an oil slick. Furthermore this surface slick is transported by the advection and
the turbulent diffusion due to current and wind action. The oil slick composition changes due to weather-
ing processes such as evaporation and dissolution, whereas oil components dissolved in the water are
volatilized to the atmosphere (Figure 3).

Figure 3: Fate and Transport of oil slick

The oil spill model we introduce here combines an Eulerian and a Lagrangian approach. The Lagrangian
model simulates the transport of an oil spill near the surface. The oil slick is represented by a large set
of hydrocarbon particles. Each particle is considered as a mixture of discrete non-interacting hydrocar-
bon components. Particles are therefore represented by component categories (soluble and unsoluble
component), and the fate of each component is tracked separately. Each particle is associated, amongst
other properties, to an area, a mass, its barycentric coordinates within the element it is located in, and the
physico- chemical properties of each of its components (cf. section 4.4).
The model accounts for the main processes that act on the spilled oil: advection, effect of wind, diffusion,
evaporation and dissolution. Though generally considered to be a minor process, dissolution is important
from the point of view of toxicity. To simulate soluble oil component dissolution in water, an Eulerian
advection-diffusion model is used. The fraction of each dissolved component is represented by a tracer
whose mass directly depends on the dissolved mass of oil particles. The hydrodynamic data required for
either Lagrangian and Eulerian transport approaches are provided by Telemac-2D hydrodynamic model
(cf. section 2.1).

Accessibilit : Libre Page 14 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

2.4.2 Notations used to develop the oil spill transport module

Specific notation to be used when mention is made the the oil spill module, and it will be explained in table
2.

Table 2: Notations used to develop the oil spill transport module.

Notation Description
Ap Particle area
Ar(j) Partial particle area at node j
Ci Concentration of oil component i in the water
Cv Sediment oil content
Dp Depth of oil penetration on the shore
Kdiss Mass transfer coefficient
Kevap Evaporation mass transfer coefficient
Kvol Overall volatilization rate coefficient
Ls Width of the shore
M Maximum oil mass deposited on the shore
Mwi Molar mass of oil component i
Pi Is the vapor pressure of oil component i
Pref loat Probability of oil refloating
S Oil slick spreading area after the initial phase
Si Solubility of the oil component i in water
Sin Initial oil slick spreading area
SHP (j) Barycentric coordinate at node j
Surfshore Shore surface
T Ambient temperature
TBi Boiling point of oil component i
Tm Maximum oil slick thickness
V Node volume
Vo Volume of spilled oil
X Particle position
Xi Molar fraction of the oil component i
g Acceleration due to gravity
h Water depth
kf Oil removal rate
mi Mass of oil component i
u Depth-averaged fluid velocity
t Numerical time step
Oil and water densities relation
Hi Molar enthalpy of oil component i
t Turbulent viscosity
e Water kinematic viscosity
o Oil density
w Water density
(t) A vector with independent, standardized random components

The oil and water densities relation is given by the following formula:

w o
= (24)
w

Accessibilit : Libre Page 15 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

2.4.3 Transport model

Advection of particles is already included in the Telemac model (cf. section 5.1), in this part, we just
discuss the advection field and how diffusion is addressed.

2.4.3.1 Advection

On the free surface, the drifting of the oil slick is induced by the flow velocity and by the action of wind.
The oil slick drift velocity is expressed as:

uoil = uc + uw (25)

where uoil is the oil slick velocity vector, uc is the current velocity vector at the free surface, uw is the wind
velocity vector above the water surface and represents the drift of the surface slick due to the wind.

Estimation of the current velocity at the free surface: Assuming a logarithmic profile for the vertical
velocity, the current surface velocity vector uc can be related to the depth-averaged velocity vector u and
the non-dimensional friction coefficient Cf as:

( )
1 Cf
uc = u 1 + (26)
2

Where is the von Karman constant ( = 0.41). The friction coefficient Cf is calculated in Telemac-2D
according to the friction law chosen (Chezy, Strickler, Haaland, Nikuradse or Manning).

Wind effect on the oil spill drift: The force acting on a floating solid body with constant flow velocity
is:

1
F= SCd |U| U (27)
2

Where U is the flow surface velocity vector, S is the projected area of the solid body, is the fluid density
and Cd is the drag friction coefficient. If the solid moves with velocity v, it is necessary to replace the fluid
surface velocity vector U by the relative velocity vector ur = v U in equation (27).

Figure 4: Fate and Transport of oil slick

Accessibilit : Libre Page 16 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Newtons second law at steady state applied to the particle advected by wind and current (Figure 4) can
be expressed as:
w Sc Cd,c |v uc | (v uc ) + a Sw Cd,w |v uw | (v uw ) = 0 (28)

Where a is the air density, w is the water density, Cd,c is the drag coefficient in the water, Cd,w is the
drag coefficient in the air, Sw is the partial projected area of the solid body subjected to the wind, Sa is the
partial projected area of the solid body subjected to the current, uc is the current water velocity vector and
uw is the wind velocity vector.
By decomposing the velocity vector of the solid body as v = uc + uw , the following relationship is
obtained:

uc + uw
v= (29a)
1+

a Sw Cd,w
= (29b)
w Sc Cd,c

This approach can be applied to an oil slick by approximating the drag forces with the friction forces exerted
by the wind and the water on the slick surface. Therefore, the partial projected areas, Sw and Sc , must be
replaced by the complete slick surface. This surface is equal above and below the water surface. If the
friction coefficients for water and air are also assumed to be equal, the wind drift factor can be simplified
to:

a
= 0.036 (30)
w

The oil spill drift velocity induced by wind action is 3.6% of the wind velocity vector. This theorical result
is close to the empirical drift factor usually used in oil spill models. According to ASCE Task Committee
[2], this drift velocity typically varies from 2.5% to 4.4% of the wind velocity vector, with a mean value
comprised between 3% and 3.5%.
Consequently, with the free surface velocity relationship and the value of the wind drift factor, the oil slick
drift velocity uoil can be written as:

( )
1 Cf
uoil =u 1+ + 0.036uw (31)
2

2.4.3.2 Diffusion

Turbulent eddies affect the motion of petroleum particles in water and randomize their trajectory. Con-
sequently, a stochastic approach is adopted in order to take this phenomenon into account. The non-
conservative formulation of advection-diffusion equation is well-adapted to modelling transport and dis-
persion of continuous contaminants, but, since the present model uses a discrete particle description of
contaminant transport and dispersion, a transformation must be applied to obtain a Lagrangian equation.
Let us start with a depth-averaged definition of this equation:

( )
C 1 ht
+ u (C) = C (32)
t h c

As a reminder, h is the water depth and t is the turbulent viscosity. In addition C will be used to describe
a depth-averaged pollutant concentration and c represents the neutral turbulent Schmidt number. The
latter can be set to c = 0.72 [29].

Accessibilit : Libre Page 17 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

The weathering process is dealt with in a further fractional step, and therefore not added to this equation. A
transformation must be applied to equation (32) to obtain a Lagrangian equation. The first transformation
step consists of interpreting the concentration C(X, t) as a probability P (X, t) of finding a particle at a
location X at a time t. Then, the development of the diffusion term in equation (32) leads to the Fokker-
Planck equation:
[ ( )] ( )
P 1 ht t
= u P + P (33)
t h c c

Equation 33 can be solved with a Langevin equation [9]. This gives the following solution for a hydrocarbon
particle position vector X(t):

[ ( )]
1 ht 2t
X(t + t) = X(t) + u t + t(t) (34)
h c c

Where t is a numerical time step and (t) is a vector with independent, standardized random components.
In the above relationship, quantities h and t are computed from Telemac-2D (cf. section 2.1) and the
depth-averaged velocity vector u must be replaced by the oil slick velocity vector uoil (Eq. (25)).

2.4.4 Shoreline Oiling Model

Because many environmental resource area are located near the coast, oil spill modelling needs to ac-
curately estimate the rate of beaching oil on the shoreline. In fact, the oil/shoreline interactions affect
assessments of oil spill impact on environment. Theses information are meant to be used in the decision-
making process after an oil spill pollution and/or to study scenarios of potential impacts of pollutions on a
given site.

2.4.4.1 Oil beaching

In the oil spill model, presented here, when an oil particle reaches a shoreline, it may be deposited if one
of the following deposition statements is verified:

The slick thickness is greater than the water level under the oil slick.
The size of the bottom roughness is greater than the water level.

Then, the oil particle is deposited on the shoreline if the oil volume deposited does not exceed the maxi-
mum surface loading and maximum subsurface loading given by Cheng et al. [4]:

M = o (Surfshore Tm + Cv Dv Ls ) (35)

Where M is the maximum oil mass deposited on the shore, Surfshore the shore surface, o the oil density,
Tm the maximum oil thickness, Cv the sediment oil content, Ls the width of the shore, Dp the depth of oil
penetration on the shore.
The oil-holding capacity of a shore depends on both oil and beach characteristics. The parameters Cv ,
Dp and Tm are derived from real oil spill observations and their values are summarized in the following
table 3:

Accessibilit : Libre Page 18 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Maximun Surface Oil loading


oil thickness (Tm ) Oil capacity capacity (Cv )
(mm) by in subsurface estimated
Shoreline oil viscosity (m3 oil/m2 sediment)
type Depth of Oil
Light Medium High oil percent Light Medium High
< 30 30 2000 > 2000 penetration by < 30 30 2000 > 2000
mm2 /s mm2 /s mm2 /s (mm) volume (%) mm2 /s mm2 /s mm2 /s

Sandy beach 4 17 25 50 9,8 0,0040 0,0170 0,0250

Gravel 2 9 15 180 8,3 0,0021 0,0091 0,0151

Rocky shore 1 5 10 0 0 0,0010 0,0050 0,0100

Table 3: Oil-holding capacity [26]

2.4.4.2 Oil refloating

An oil particle previously deposited on the shore can be picked up again as a result of hydrodynamic
variations (tidal phenomenon for example). This phenomenon is taken into account if these following
release statements are verified:

The water level under the oil slick is greater than the slick thickness.
The water level is greater than the size of the bottom roughness.

However, even if the previous conditions are not satisfied, random phenomena such as gusts of wind or
waves induced by boats act on the spilled oil. In order to account for the amount of oil removed by these
processes, the probabilistic approach suggested by Danchuk and Wilson [5] is used.
The oil removal rate kf is used to determine the probability of a particle of oil refloating Pref loat :

Pref loat = 1 exp (kf t) (36)

The oil removal rate (kf ) has units day 1 , and depends on shore characteristics (sand: kf = 0.25; gravel:
kf = 0.15; rock: kf = 0.8 [26]).
Refloating for a particle is determined by choosing a random number R, which is uniformly distributed
between 0 and 1. The particle refloats if R(0, 1) < Pref loat .

2.4.5 Weathering processes

2.4.5.1 Spreading

Spreading is the most important weathering process. In fact, all mass transfer phenomena which occur
during an oil spill are influenced by the area of the surface slick. Oil discharged into a water surface will
immediately start to increase its surface area. This slick expansion is controlled by mechanical forces
such as gravity, inertia, surface tension and viscosity [8]. In the oil spill model, three spreading models
are implemented. In this part, only two of them are described because among the implemented model,
there is a constant spreading model where the user is free to chose a constant area for each oil particle
(cf. section 5.3.3).

Accessibilit : Libre Page 19 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Fays spreading formulas: The first model is based on the well-known Fay spreading formulas. We
follow the same initialisation procedure as the ADIOS model5 , because the time of the first Fays spreading
stage (called gravity-inertial spreading) is quite short. Therefore it is assumed that, during this stage, none
of the weathering processes are taking place. So, the initial area Sin , after the oil spill release, is set to
the area obtained at the end of the gravity-inertial phase:

( ) 16
k4 gVo5
Sin = v2 (37)
ki e2

Where e is the water kinematic viscosity, g is the acceleration due to gravity, Vo is the volume of spilled
oil, is a parameter which relates the oil and water densities and kv , ki are two constants which can be
set to 1.53 and 1.14 respectively.
According to Maroihi et al. [21], experiments show that more than 90% of the surface slick is controlled
by gravity. This area is surrounded by a thinner oil slick controlled by surface tension. Due to these
considerations, the tension surface effect on spreading is neglected. Consequently, the evolution of the
oil slick expansion, in the first spreading model, is determined by the second phase of the Fays formulas
(called gravity-viscous spreading):

( 3
) 13
gVo2 t 2
S = kv2 (38)
e

Layer averaged Navier-Stokes oil slick formulation: However the model proposed by Fay [8] does
not even consider the oil viscosity and would be more convenient for calm water. More recently, based on
the layer averaged Navier-Stokes formulation proposed by Warluzel and Benque [31], Maroihi et al. [21]
have described the spreading process as follows:

S arctan (aS) =4t (39)



wa oa ow 2 2K
with = and a = (40)
K 3Vo o g

Where wa is the water-air surface tension, oa is the oil-air surface tension, ow is the oil-water surface
tension and K is the friction coefficient at the oil water interface.
Because, as seen previously, the surface tension is neglected and the friction coefficient is K = (o o )/e
(where e is the slick thickness and o is the oil kinematic viscosity), the slick surface formulation (40) can
be simplified to:

( ) 14
27 Vo3 g
S= t (41)
2 o

This formulation is the second spreading model.


The previous expressions (Eq.(41) and Eq.(38)) are used to determine each particle area Ap . In Telemac-
2D, Equations 38 and 41 have been modified slightly to be independant of the number of oil particle
chosen, i.e. the sum of the individual particle spreading areas (Ap ) is equal to the total spreading area (S)
regardless of the number of particles chosen. The main advantage of these equations is that they contain
few parameters: the oil density o , the oil kinematic viscosity o and the volume of spilled oil Vo .
1 http://response.restoration.noaa.gov/adios

Accessibilit : Libre Page 20 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

2.4.5.2 Mass transfer processes

The mass transfer between two phases is quantified theoretically, based on the hypothesis that the mass
transfer resistance is located close to the interface between the two phases. In the next sections, all pro-
cesses are based on Whitmans (1923) theory, which formulates the mass transfer flux for mass transfer
phenomena.
Furthermore, it should be noted that for all mass transfer processes the underscript i and j will represent
oil components, and not components of direction.

Evaporation: Evaporation is the most important mass transfer process that oil undergoes after a spill.
In a few days, light crude or refined products can lose up to 75% of their volume. An understanding of
evaporation is important both from the practical viewpoint of cleaning up spills and for developing predictive
models. The evaporation model used is based on a pseudo-component approach. The change in mass
of the petroleum component i is characterized, using the molar flux expression of Stiver and Mackay [27]
and the thermodynamic phase equilibrium equation, by the following relationship:

dmi Pi mi
= Kevap Ap mj (42a)
dt j Mwj RT
[ ( )]
Hi TBi
Pi = exp 1 (42b)
RTBi T

where mi is the mass of the component i, Kevap is the evaporation mass transfer coefficient, Pi represents
the vapor pressure of component i, Mwj is the molar mass of component j, R is the universal gas constant
(8.3144621 JK-1 mol1 ), t is the ambient temperature, TBi is the boiling point of component i and Hi is
the molar enthalpy of component i.
The Gray-Watson method [3] is used to determine the molar enthalpy Hi in equation (42b):

( )m
T
Hi (t) = TBi R ln(82.06TBi ) 3 2
TBi
T
with m = 0.41330.2575 (43)
TBi

With the molar mass of component i calculated according to Jones [19] and the previous relationship
(Eq. 43), all component parameters (Mwj , Hi , TBi ) can be expressed as a function of the components
boiling point TBi . Therefore, the parameters of the evaporation algorithm are the components boiling point
TBi and the initial petroleum composition, which are characterized by the distillation curve, and the mass
transfer coefficient Kevap . In this model this coefficient is calculated according to the theory of Mackay
and Matsugu [20].

Dissolution: Dissolution is an important phenomenon from a toxicological and environmental point of


view, although it only accounts for a negligible fraction of the oil mass. The oil quantity affected by this
process is about 1% of the initial mass. Based on Whitmans (1923) theory, the evolution of the dissolved
concentration is described by a first order differential equation:

dCi
=(Si Xi Ci ) (44a)
dt
Kdiss Ap
= (44b)
V

Accessibilit : Libre Page 21 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Where Si is the solubility of the component i in water, Xi is the molar fraction of component i, Kdiss is the
mass transfer coefficient, Ap is the particle area and V is the node volume.
By solving equation (44a), the concentration of dissolved component i in the water column at time t (Cin+1 )
as a function of the concentration at the previous time step (Cin and t 1) is given by the following relation:

Cin+1 = Si Xin + [Cin Si Xin ] exp (t) (45)

The order of magnitude of the dissolved mass transfer coefficient Kdiss is of several cm h1 [14, 33]. Using
the relationship linking mass and concentration, the mass loss at time t (n + 1)t for each component
i can be deduced:

massn+1
i massni = [1 exp (t)] (Si Xin Cin ) V (46)

Volatilization: Dissolved oil components can be volatilized into the atmosphere only in areas not cov-
ered by the surface slick. The volatilization flux according to Whitman [32] is expressed as follows:

Fi = Kvol Ci (47)

Where Fi is the mass flux of component i (kg m2 s1 ), Ci is the concentration of component i in the
water (kg m3 ) and Kvol is the overall volatilization rate coefficient (m s1 ).
This flux expression contains only one parameter, the volatilization rate coefficient Kvol . As for the disso-
lution mass transfer coefficient, different values can be found in the literature [15].

2.4.6 Switching from Lagrangian to Eulerian formulation

Telemac-2D is based on a vertex centred finite-element formulation, which means that variables are de-
fined on mesh nodes. If we consider a particle P inside an element (Figure 5a), its dissolved mass must
be distributed between the elements nodes.

(a) (b)

Figure 5: Particle P inside an element (a) and node area (b)

Therefore, in order to compute the coefficient j at each node j, the area of each particle (AP ) is distributed
between the nodes of the local element using the following formula:

Accessibilit : Libre Page 22 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

AP SHP (j) = Ar (j) (48)

Where SHP (j) is the barycentric coordinate at node j and Ar(j) is the partial particle area at node j.
A node area is defined around each mesh node by adding the quadrilaterals defined by the medians of
each triangular element (grey area in Figure 5b). This is equivalent to the integral of test functions [13].
The volume Vj is obtained by multiplying the node area by the depth of the node.
The previous steps allow the coefficient j to be calculated at each node j of each element that contains a
particle. The dissolved mass of component i in the water column is defined at each node j by the following
relation:

idiss = [1 exp (j t)] (Si Xi Ci ) Vj


massn+1 n n
(49)

The total amount of dissolved mass for each particle component i is:


num node

massn+1
idiss = massn+1
idiss (50)
tot
j=0

Thus, the quantity of tracer at the time step t, at node j, added by dissolution is defined by:

massn+1
idiss
Cjn+1 = Cjn + (51)
Vj

The mass is conserved to machine accuracy in this process. The advection-diffusion equation (Eq. 32)
can then be used to simulate the transport and dispersion of dissolved oil in the water column. The
useful parameters for the dissolution algorithm are the solubility of the component i in water (Si ) and the
dissolution mass transfer coefficient (Kdiss ), which are available in the literature.

2.4.7 Summary

A Lagrangian/Eulerian oil spill model has been developed within the TELEMAC hydro-informatic system
(cf. Figure 6). The oil spill prediction is directly related to the quality of the hydrodynamic model. The
Lagrangian approach, used to predict the surface oil slick transport, is based on the method of charac-
teristics whereas the oil dissolution in the water column is governed by an Eulerian advection-diffusion
equation. The oil spill model aims to simulate the processes of advection, turbulent diffusion, evapora-
tion, volatilization and dissolution in the water column. These various physical processes (transport and
weathering processes), although occurring simultaneously are treated successively in the same time step
using the fractional step method.

Accessibilit : Libre Page 23 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Figure 6: Model organization chart

Accessibilit : Libre Page 24 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

3 Numerical methods for transport equations

The treatment of transport equations is one of the strategic points in the numerical resolution of fluid
mechanics equations. The hyperbolic nature of these equations implies that the space derivatives need
an upwind treatment [13]. There are several finite element methods in TELEMAC to treat the advective
part of the Saint-Venant equations: Streamline Upwind Petrov-Galerkin (SUPG), Distributive schemes N
and PSI, and so on.
We will only describe the method of characteristics in this report as it is very convenient for particle trans-
port, but more information on these other methods can be found in [13] or [28]. Furthermore this method
is not often used in CFD codes because of its difficult implementation. Nonetheless it is commonly applied
to solve advective terms in TELEMAC, be it in sequential or in parallel with domain decomposition.

3.1 Fractional steps method

The fractional steps method consists of solving a partial differential equation in a number of distinct frac-
tional steps. Let f be a scalar defined by the following equation (Navier-Stokes or Saint-Venant equations):

f
+ advective term = diffusion term + source term + pressure term (52)
t

The time discretization of the scalar f is given by:

f f n+1 fD + fD fC + fC f n
= (53)
t t

Where f n is the value of scalar f at time tn , and f n+1 is the value at time tn+1 = tn + t. fC is the value
of scalar f after it has been advected and fD is that scalar after diffusion and convection has been taken
into account.
This leads to a successive resolution of three steps:

fC f n
First step : t = advective term
fD fC
Second step : t = diffusion term + source term
f n+1 fD
Third step : t = pressure term

This resolution method is commonly used in the TELEMAC system in order to solve the Navier-Stokes
equations in Telmac-3D and the Saint-Venant Equation in Telemac-2D. By analogy with the TELEMAC
system, a fractional step method is also used for oil spill modelling (transport and weathering processes)
and algae bloom modelling (transport only). This means that different physical processes, although oc-
curring simultaneously, are solved successively in the same time step.

3.2 Resolution of advection: the method of characteristics

This method of characteristics is used to solve the advection step (first step):

fC f n
= advective term (54)
t

Lets consider the transport equation of the scalar f quantity as follows:

Accessibilit : Libre Page 25 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

f f = 0
+U (55)
t

This equation can be used express the scalar f quantity transport along the direction vector x at the velocity
. By considering dx = U
U , equation (55) can be rewritten as:
dt

df (x(t), t) dx f
=f +
dt dt t
f
=U f +
=0 (56)
t

Using equation 56 the variation of f can be written as:

f
df = dt + f dx
t
=U f dt + f dx
( )
= U dt + dx f (57)

Consequently, the total variation of the quantity f (df (x(t), t)/dt) is equal to zero on the characteristic
curve (C) described by the equation d x
dt = U . So, the variation of the scalar f on the characteristic curve
(C) during a time step is obtained by the integration between the time steps tn and tn+1 :

tn+1
df (x(t), t)
dt =f n+1 (P ) f n (Q) = 0 (58)
tn dt
f n+1 (P ) =f n (Q) (59)

Q represents the foot of the characteristic curve passing through P at the time step tn+1 . The term foot
refers to the intersection between the characteristic curve (C) and the hyperplane t = tn . So, in order to
find the value of the scalar f at point P and at time tn+1 , it is necessary to:

finding the foot of the characteristic (point Q) by calculating the characteristic curve described by the
equation d x
dt = U ,

interpolating at point Q the value of scalar f at the time step tn .

3.3 Calculation of characteristic curve (C)

To calculate the characteristic curve at time tn the time step t = tn+1 tn is divided in sub-iterations such
as t = t/nsub , while assuming that the flow velocity U will remain constant during each sub-iteration.
This allows the characteristic curve to be computed with greater accuracy. As a reminder we want to know
the value of f n at point Q, as this will give the value of f n+1 at point P . We will therefore start at point P
and go up the velocity field defined at time tn to arrive at point Q, and interpolate its value ( see figure 7).

Accessibilit : Libre Page 26 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Figure 7: Method of characteristics. The dotted line represents the characteristic curve (C) in a mesh.

Therefore from point P , a sequence of point P = P0 , ..., Pk , Pk+1 , ...Pn = Q is created. At each sub-
iteration t, we move from the position Pk to Pk+1 according to the following steps:

We start from the point Pk of velocity UPk and we arrive at the point Pk+1 based on the equation:
dx Pk+1 = Pk UP t
=U k
(60)
dt
We relocate the position Pk+1 in the arrival element: calculation of barycentric coordinate (1 , 2 , 3 )
The velocity UPk+1 is calculated by linear interpolation based on barycentric coordinates:
UPk+1 = 1 U1 + 2 U2 + 3 U3 (61)

The process is repeated in order to determine the position Pk+2 , and so on...

In the models presented in this user guide, the floating bodies are modelled by a Lagragian approach. This
approach represents floating bodies by a large set of particles. The transport of each particle is treated
based on the method described above. However for the Lagragian model, we advance in time, that is to
say, a particle locating at point Q is advected to the point P (P is not necessarily a mesh node) following
the characteristic curve.

3.4 Barycentric coordinates calculation

Figure 8: Point M inside an element.

Accessibilit : Libre Page 27 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

The definition of barycentric coordinates allows to write, for a point M (x, y) located in the triangular element
of nodes (N 1(X1 , y1 ), N 2(X2 , y2 ), N 3(X3 , y3 )) (cf. Figure 8), the following relationship:


OM =1 ON1 + 2 ON2 + 3 ON3 (62a)

3
i =1 (62b)
i=1

By projecting the relationship 62 on the cartesian coordinates (x, y ), it is possible to write:

x = (1 2 3 )x1 + 2 x2 + 3 x3 (63)
y = (1 2 3 )y1 + 2 y2 + 3 y3 (64)

( ) ( )( )
x x1 x2 x1 x3 x1 2
=
y y1 y2 y1 y3 y1 3
( ) ( )
x x1 2
=J (65)
y y1 3

By noting the reversal matrix J, the expression of barycentric coordinates can be expressed as:

Area of triange N\
2 M N3
1 =1 2 3 = (66a)
\
Area of triange N1 N2 N3
(y3 y1 )(x x1 ) (x3 x1 )(y y1 ) Area of triange N\1 M N3
2 = = (66b)
det(J) Area of triange N\1 N2 N3

(y2 y1 )(x x1 ) + (x2 x1 )(y y1 ) Area of triange N\ 1 M N2


3 = = (66c)
det(J) Area of triange N\ 1 N2 N3

More generally, it can be noticed that the barycentric coordinate i at point M is equal to the area triangle
made by point M and the two nodes opposite of node Ni over the area of the element (cf. figure 9).

Figure 9: Representation of the barycentric coordinate of node i

Accessibilit : Libre Page 28 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

So, with knowledge of the barycentric coordinates, it is possible to interpolate the functions f (x, y) within
an element according to the values of the function at the nodes of the element :

f (M ) = 1 f (N 1) + 2 f (N 2) + 3 f (N 3) (67)

4 Parallelism of particle transport model

4.1 General principles of parallelism

Parallelism in Telemac-2D is done by dividing the domain into several sub-domains. Each available pro-
cessor is then allocated a sub-domain for which it solves the flow. Each processor only communicates
with other processors for the border elements. This allows to limit communication in between proces-
sors, as to have a successful parallel code the calculations in each processor should be longer than the
communications. To apply this logic to particle transport each processor will calculate the path of all the
particles within its sub-domain, and only communicate with other processors if particles exit or enter the
sub-domain. This will mean that the particles might not be evenly spread out amongst all the available pro-
cessors, but it will limit communications between processors to a portion of particles, as the flow conditions
at their position will be readily available.
There are therefore a few necessary steps to calculate the path of particles. Firstly the code used should
have routines available to interpolate specific fluid quantities at the position of each particle. Secondly the
code should be able to figure out when a particle has exited an element, and it should have a table of the
neighbouring elements, and in which processor these are.

4.2 Parallel simple fluid particle transport in Telemac-2D

In Telemac-2D particle transport is done using the subroutines, FLOT and DERIVE as well as the module
STREAMLINE. Subroutine FLOT defines the original position of the particles and the subroutine DERIVE
calculates the particle transport as well as writes the particle position file. The module STREAMLINE
regroups several subroutines that can be used to follow the path of a fluid particle, and it is used to
calculate the characteristics in Telemac-2D, see section 3.

4.2.1 Description of the module STREAMLINE

The module STREAMLINE is used to follow the path of a scalar quantity in the flow. This path is calculated
by using the flow velocities to calculate its trajectory during one time step. As the flow is fixed during
the time step the trajectory is a portion of a streamline (hence the name of the module). This trajectory
can therefore represent a fluid particle, but STREAMLINE can also be used to calculate a trajectory going
against the flow. This way a scalar quantity can be interpolated at the end of the path, as is necessary for
the method of characteristics.
The module STREAMLINE is therefore used to solve for the method of characteristics in Telemac-2D.
The main subroutine within this module is SCARACT, but there are several other subroutines. These are
either used to communicate with other processors, to follow the path of a fluid property or subroutines
that have been recently developed for algae and oil particle transport. Furthermore several variables
are defined within this module, but the main ones are SENDCHAR, RECVCHAR HEAPCHAR, HEAPCOUNTS,
SENDCOUNTS, RECVCOUNTS, SDISPLS and RDISPLS, which are temporary variables that will be filled up
to exchange information across processors.
The path of a scalar quantity is calculated by making a call to the subroutine SCARACT. We will now
describe all the steps that are undertaken in this subroutine.

Accessibilit : Libre Page 29 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

1. All temporary variables are initialised


This means that a check is made to ensure that all the variables that will be used for inter processor
communications have the correct size.

2. We begin at the foot of the characteristic


Using SCARACT we want to follow the trajectory starting from a node in the mesh and computed
using the fluid velocities. This can obviously be done for any position, the only imperative is that the
element at the foot of this trajectory is known as well as the barycentric coordinates.

3. The path of a scalar quantity is followed


In this step a trajectory is calculated using the the flow velocities (either going upstream or down-
stream). To do this a call is made to a subroutine entitled SCHAR{XX}[_OPTN], where the {XX} is
replaced with the element type and [_OPTN] is linked to optional arguments of SCARACT. Several
steps are made in this subroutine:
(a) A sub time step is defined so that it takes roughly 3 steps to cross an element.
(b) The path is calculated using the position at the beginning of the time step, the element number
and the barycentric coordinates. These coordinates are recalculated at the end of the time
step.
(c) The trajectory is continued unless all the time steps are completed or it has crossed one of the
elements edge.
(d) If the trajectory crosses one of the elements edge the number of the neighbouring element
needs to be found. This is done using IFABOR where 4 scenarii can occur:
i. The neighbouring element is within the same sub-domain.
If this is the case then the element number for the trajectory is updated and the barycentric
coordinates are recalculated. The path is then continued (we go back to step 3b).
ii. The neighbouring element is outside a fluid boundary. If this is the case then the path is
stopped.
iii. The neighbouring element is outside a solid boundary. If this is the case then the path is
projected along this boundary, but still within the domain. A check is repeated to see if the
path is still within its original element (go back to step 3d).
iv. The neighbouring element is in another sub-domain. All the important information are
stored into HEAPCHAR using COLLECT_CHAR. In this step the original processor number,
the new processor number, the element number in the new processor, the barycentric
coordinates, the displacement and the fraction of the path followed are all stored into
HEAPCHAR. In addition the number of lost characteristics NCHARA will be increased by 1
and the trajectory will be stopped.
(e) For all characteristics (even those that exit the sub-domain) the position at the end of the tra-
jectory is returned.
4. The scalar quantity is interpolated at the returned position
This is done using the barycentric coordinates, even for lost characteristics where its value will
be updated later on (this can be done as even for lost characteristics barycentric coordinates and
element number are still defined).
5. Characteristics are exchanged between processors
This is done in several steps:
(a) The number of sent characteristics (NSEND) and lost characteristics (NLOSTCHAR) are updated
using NCHARA
(b) The subroutine PREP_INITIAL_SEND is called so that the information in HEAPCHAR is placed
into SENDCHAR. This step is necessary to allow all lost characteristics to be grouped in terms
of destination processor.
(c) Information is exchanged between processors with subroutine GLOB_CHAR_COMM. In this sub-
routine the information in SENDCHAR is exchanged into RECVCHAR for all processors using a
MPI_ALLTOALLV call.

Accessibilit : Libre Page 30 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

6. The path of the lost characteristics are continued


The call to SCHAR{XX}[_OPTN] is repeated, but now with the last argument set to .TRUE. and
the barycentric coordinates and element numbers set to buffer variables. This allows information
in RECVCHAR to be used. The characteristic trajectory is therefore continued through the following
steps:

(a) Information in RECVCHAR is loaded into the buffer arguments and the barycentric coordinates
are recalculated.
(b) A check is done to see if the beginning of the path is placed at the correct element number, as
it was defined in RECVCHAR.
i. If this is not the case steps 3d-i to 3d-iv are repeated.
ii. Otherwise the trajectory is continued as normal, and the steps 3b to 3e are repeated.
(c) At the end of this step some of the characteristics trajectories might still not be completed, the
only difference is that these characteristics will be stored in RECVCHAR and not HEAPCHAR.

7. The scalar quantity is interpolated at the returned position


This step is done only for the characteristics that were received at the end of step 5c and the value
interpolated is placed in the basket of RECVCHAR

8. A check is done to see if some characteristics are still lost


This is done with HEAPFOUND, where the number of lost characteristics are defined with SENDCOUNTS,
and completed trajectories are accounted for in HEAPCOUNTS and they are stored in HEAPCHAR.
9. Remaining lost characteristics are exchanged between processors
If there are still lost characteristics then information is exchanged with the following steps. Otherwise
no communication is required.

(a) The subroutine PREP_LOST_AGAIN is called so that the information stored in RECVCHAR is
placed in SENDCHAR.
(b) The steps from 5c onwards are repeated until all the paths are complete.

10. Trajectories that were completed outside of their starting processor need to be sent back
This is done using the following steps:

(a) The subroutine PREP_SENDBACK is used so that the information that needs to be sent back to
the original processor is added from HEAPCHAR to SENDCHAR.
(b) Information is exchanged between processors with subroutine GLOB_CHAR_COMM so that the
information in SENDCHAR is exchanged into RECVCHAR for all processors.
(c) Subroutine INTRODUCE_RECVCHAR is used to load the data from the basket of RECVCHAR into
the required value.

In addition the subroutine SCARACT can be used with the optional argument APOST=.TRUE. so that the
last step sends to the original processor: the processor number, the element number and barycentric
coordinates at the end of the path. This option is used so that SCARACT can be used to follow the path of
a particle.

4.2.2 Using STREAMLINE for particle transport

The module STREAMLINE can be used for fluid particle transport (i.e. particles that will follow blindly the
flow). The step by step approach is given in figure 10.

Accessibilit : Libre Page 31 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Telemac-2D .

In steering file define the number


of particles released (NUMBER OF
DROGUES) and the period used to Module STREAMLINE
write the result file (PRINTOUT PE-
RIOD FOR DROGUES). Subroutine ADD_PARTICLE

Adds particles to the correct


processor.
Subroutine FLOT

Add particles to the flow using Subroutine SCARACT


ADD_PARTICLES.
Subroutine used for the method
of the characteristics. It fol-
lows the flow and returns
Subroutine DERIVE the element number and
barycentric coordinates at the
Follow particles in the flow using end of the path. The option
SCARACT with the optional argument APOST=.TRUE. returns the
APOST=.TRUE. number of the next subdomain
at the end of the path.
If the particles stayed in the domain,
the final positions are given using the Subroutine SEND_PARTICLES
barycentric coordinates.
Sends the barycentric coordi-
The subroutine SEND_PARTICLES is nates and tag to other proces-
used to send the remaining particles. sors if necessary and then uses
the subroutine ADD_PARTICLE
Delete particles that have been sent to add the particles. However it
using DEL_PARTICLE. does not delete particles once
they have been sent.
Write the result files at every time
step defined by the PRINTOUT PE- Subroutine DEL_PARTICLE
RIOD FOR DROGUES.
This subroutine removes a par-
ticle from its processor.

Figure 10: Particle transport in Telemac-2D flow chart.

Furthermore in the numerical simulations, the solid boundaries were treated in such a way that particles
whose path in one time step crossed a solid boundary were projected along the boundary. Particles exiting
through a liquid boundary were removed.

4.3 Algae bloom specificities

The idea used to model the algae in parallel in Telemac-2D is to follow as closely as possible the approach
described in the previous section, which is used for drogue transport. Therefore the routines FLOT and
DERIVE, and the module STREAMLINE will also be used. However modifications have been done to
modify the calculated transport, and subroutines have been added to send the additional information to
other processors.
The step by step approach is shown in figure 11.

Accessibilit : Libre Page 32 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Telemac-2D .

In steering file define the number


of particles released (NUMBER OF
DROGUES) and the period used
to write the result file (PRINTOUT
PERIOD FOR DROGUES). Further-
more define algae transport (ALGAE
TRANSPORT MODEL), then algae di-
ameter (DIAMETER OF ALGAE), den-
sity (DENSITY OF ALGAE), thickness
(THICKNESS OF ALGAE) and type Module STREAMLINE
(ALGAE TYPE).
Module ALGAE_TRANSP Subroutine ADD_PARTICLE

Module which stores all the Adds particles to the correct


variables used in algae trans- Subroutine FLOT processor.
port, and the subroutines used
to calculate this transport. Add particles to the flow using Subroutine BIEF_INTERP
ADD_PARTICLES. Define AL-
Subroutine INTERP_ALGAE GAE_START in the module AL-
Interpolates variables according
GAE_TRANSP.
to the correct element type.
Subroutine which interpo-
lates all the mean flow prop- Subroutine SCARACT
erties using the subroutine Subroutine DERIVE
BIEF_INTERP in module Subroutine used here to re-
STREAMLINE. Interpolate the mean fluid properties turn the element number and
at the position of the algae particles processor number after the
Subroutine DISP_ALGAE using INTERP_ALGAE. particle transport. The op-
tion AALG=.TRUE. stops the
Subroutine which calculates the Calculate the displacement of the al- method of characteristics from
transport of algae particles. gae particles using DISP_ALGAE. being used so that the dis-
placement is not recalculated.
Use subroutine SCARACT with the op-
tional argument APOST=.TRUE. and Subroutine SEND_INFO_ALG
AALG=.TRUE. to find the element
and processor at the end of the dis- Sends all the information as-
placement. sociated with each particles
that is used in the subroutine
If the particles stayed in the domain, DISP_ALGAE. However it does
the final positions are given using the not send or delete particle po-
barycentric coordinates. sitions once they have been
sent.
The subroutine SEND_INFO_ALG is
used to send the algae information of Subroutine SEND_PARTICLES
the remaining particles.
Sends the barycentric coordi-
The subroutine SEND_PARTICLES is nates and tag to other proces-
used to send the remaining particles. sors if necessary and then uses
the subroutine ADD_PARTICLE
Delete algae information for the par- to add the particles. However it
ticles that have been sent using does not delete particles once
DEL_INFO_ALG. they have been sent.

Delete particles that have been sent Subroutine DEL_INFO_ALG


using DEL_PARTICLE.
This subroutine removes the
Write the result files at every time algae information of a particle
step defined by the PRINTOUT PE- from its processor, but does not
RIOD FOR DROGUES. remove the particle.

Subroutine DEL_PARTICLE

This subroutine removes a par-


ticle from its processor.

Figure 11: Particle transport in Telemac-2D flow chart. The text in red shows modifications that were
necessary for the algae transport.

Accessibilit : Libre Page 33 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

4.4 Oil spill specificities

In order to model oil spill, an oil FORTRAN structure has been created. This structure contained all infor-
mation necessary to compute tansport and weathering processes:
TYPE COMPO
DOUBLE PRECISION::SOL ! SOLUBILITY
DOUBLE PRECISION::MASS ! MASS
DOUBLE PRECISION::TB ! BOILING POINT
END TYPE COMPO

TYPE OIL_PART
INTEGER::STATE ! STATE OF THE PARTICLE
INTEGER::ELTOIL ! ELEMENT NUMBER WHERE THE PARTICLE IS LOCATED
INTEGER::TPSECH ! ITERATION OF THE BEACHING OIL
INTEGER::ID ! PARTCLE TAG NUMBER
DOUBLE PRECISION::XOIL,YOIL ! PARTICLE COORDINATES
DOUBLE PRECISION::MASS0 ! INITIAL MASS OF THE PARTICLE
DOUBLE PRECISION::MASS ! MASS OF THE PARTICLE
DOUBLE PRECISION::MASS_EVAP ! EVAPORATED MASS OF THE PARTICLE
DOUBLE PRECISION::MASS_DISS ! DISSOLVED MASS OF THE PARTICLE
DOUBLE PRECISION::SURFACE ! AREA OF THE PARTICLE
DOUBLE PRECISION,DIMENSION(3)::SHPOIL ! BARYCENTRIC COORDINATES
TYPE(COMPO),DIMENSION(:),ALLOCATABLE::COMPO ! UNSOLUBLE OIL COMPONENT
TYPE(COMPO),DIMENSION(:),ALLOCATABLE::HAP ! SOLUBLE OIL COMPONENT
END TYPE OIL_PART

The idea used to model oil slick transport in parallel in Telemac-2D is to follow as closely as possible
the approach used for drogue transport. Therefore the module STREAMLINE will be used. However
modifications have been done to modify the calculated transport, and subroutines have been added to
send the information necessary to compute the oil spill processes (such as mass of each component
contained in the oil particle, and so on) to other processors.
The step by step approach is shown in figure 12.

Accessibilit : Libre Page 34 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Telemac-2D .

In steering file define the number


of particles released (NUMBER OF
DROGUES), the period used to write
the result file (PRINTOUT PERIOD
FOR DROGUES) and the name of the
result file (DROGUE FILE). Further-
more define oil spill (OIL SPILL
MODEL) and the file name of the oil-
spill steering file (OILSPILL STEER- Module STREAMLINE
ING FILE).
Module OILSPILL Subroutine ADD_PARTICLE

Subroutine OIL_SPILL_2D Add particles to the correst pro-


Subroutine OIL_FLOT
cessor
Main oil spill program file con-
Add oil particles to the flow using
taining the call of the oil spill Subroutine BIEF_INTERP
ADD_PARTICLES and initialize the
subroutine
oil particle features
Interpolate variables according
Subroutine OIL_FLOT to the correct element type

Initialize the oil particle features Subroutine OIL_DERIVE Subroutine SCARACT

Subroutine OIL_SPREADING Only for not stranded particle, trans- Routine used here to follows
fer oil particle feature into work tables the path of the particle to re-
Compute the area expansion of XFLOT, YFLOT, SHPFLO and ELT- turns the element number and
oil particles FLO processor number.

Subroutine OIL_REFLOATING Use subroutine SCARACT with the op- Subroutine OIL_SEND_INFO
tional argument APOST=.TRUE. and
Compute the release of oil to find the element and processor at Send all the information asso-
beaching particles the end of the displacement. ciated with each oil particles
that is used in the subroutine
Subroutine OIL_DERIVE Reconstruct the table ISUB and ELT- OIL_SPILL_2D. However it
FLO for all particles (even stranded) does not send or delete particle
as the work table SHPFLO for the par- positions once they have been
Compute the oil displacement
in the domain ticles exit and enter to another subdo- sent
main
Subroutine OIL_BEACHING Subroutine SEND_PARTICLES
If the particles stayed in the domain,
the final positions are given using the Send the eigen values and tag
Compute the rate of beaching
eigen values to other processors if neces-
oil on the shoreline
sary and then uses the subrou-
Subroutine OIL_EVAPORATION The subroutine OIL_SEND_INFO is tine ADD_PARTICLE to add the
used to send the oil information nec- particles. However it does not
essary to the weathering processes of delete particles once they have
Compute the oil component
the remaining particles been sent
mass transfer flux between the
oil slick and the atmosphere
The subroutine SEND_PARTICLES is Subroutine
used to send the remaining particles OIL_DELETE_PARTICLES
Subroutine OIL_DISSOLUTION
Delete oil information for parti- This subroutine removes a oil
Compute the mass transfer flux
cles that have been sent using particle from its processor
of oil soluble component be-
OIL_DELETE_PARTICLE
tween the oil slick and the wa-
ter
Write the result files at every time
Subroutine step defined by the PRINTOUT PE-
OIL_VOLATILIZATION RIOD FOR DROGUES

Compute the mass transfer flux


of oil dissolved component be-
tween the water and the atmo-
sphere

Figure 12: Particle transport in Telemac-2D flow chart. The text in red shows modifications that were
necessary for the oil spill transport.

Accessibilit : Libre Page 35 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

5 User guide for particle transport int Telemac-2D

5.1 Drogue transport

5.1.1 Input files

The minimum set of input files to run any simulation in Telemac-2D is to include the steering file (text file
cas), the geometry file (format selafin slf), and the boundary conditions file (text file cli). Furthermore to
run any particle transport model (including for oil spill computation and algae bloom propagation) a Fortran
file needs to be added.

5.1.2 Steering file

The steering file contains the necessary information to run a Telemac computation, as well as the values
of parameters that are different from the defaults. The following essential information must be specified
in the Telemac-2D steering file to run a particle transport model:

The number of particles released.


The frequency of the drogues printout period.
The name of the tecplot file containing the particle positions in time.

Keywords
NUMBER OF DROGUES (= number chosen by the user)

PRINTOUT PERIOD FOR DROGUES (= number chosen by the user)


DROGUES FILE (= name chosen by .the user)

STOCHASTIC DIFFUSION MODEL (= 0 or 1)


If the STOCHASTIC DIFFUSION MODEL is set to 1, a stochastic model based on the diffusion
coeffcient computed by the turbulence model is choosen else there is no diffusion consider
during the particle transport.

5.1.3 The fortran file

Once the number of released drogues has been defined in the steering file the subroutine FLOT is used to
define the position and time of release. This is done by using the variable LT, which is the iteration step of
the simulation. This variable is used to release particles at a specific time. The subroutine ADD_PARTICLE
is then used to set the initial values of variables XFLOT, YFLOT and TAGFLO, which are the two-dimensional
position components and an identifier of the particle. An example of this is put in comments within the
subroutine FLOT.

Modifications to subroutine FLOT


Use LT to define when to release particles.
Call ADD_PARTICLE to define XFLOT, YFLOT and TAGFLO

5.1.4 Output files

During a drogues computation, the Telemac-2D software produces at least two output files:

Accessibilit : Libre Page 36 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

the Telemac-2D results file

the output DROGUES FILE

5.1.5 The Telemac Result file

This is the file in which Telemac-2D stores information during the computation. It is normally in Selafin
format. It contains first of all information on the mesh geometry, then the names of the stored variables.
It then contains the time for each time step and the values of the different variables for all mesh points.
For complementary information on the Telemac Result file, the reader may refer to the Telemac-2d user
guide.

5.1.6 The output DROGUES FILE

This is a formatted file created by Telemac-2D during the computation. It stores drogue positions in
Tecplot format. To visualize the drogue positions with Tecplot software, the user must:

Use the File>Load Data File(s) command to load the Telemac result data file

Use the File>Load Data File(s) command to load the Tecplot drogue file file

WARNING
. result data you have already loaded, select Add
In order to add the Tecplot drogue file to Telemac
to current data set in the Load Data File Warning dialog (cf. Figure 13). The Load Data File
Warning dialog will appear after you have selected the file and zones and/or variables to load.

Figure 13: Load Data File Warning dialog

Once you have loaded your Tecplot data, the drogue positions will be considered as Scatter plots
by Tecplot software. Scatter plots are plots of symbols at the data points in a field. To add a scatter
layer to your plot, activate the Scatter toggle in the Sidebar. To be visible in your plot, the Scatter layer
which contains the Tecplot drogue file must be turned on and the Scatter layer containing the Telemac
result data must be turned off. This is done by selecting Yes or No from the [Scat Show] button
drop-down menu on the Scatter page of the Zone Style dialog (cf. Figure 14).

Accessibilit : Libre Page 37 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Figure 14: Zone Style dialog

Then, you can modify your Scatter plot using the Scatter page of the Zone Style dialog and the Scatter
submenu of the Plot menu. You can control any of the following attributes for a zone or group of zones
from the Scatter page of the Zone Style dialog. For complementary information on the Tecplot procedure,
the reader may refer to the Tecplot user guide 6 .

Change the drogue output format


It is possible to develop a new drogue output format.
. This must be done in the subroutine DERIVE.
So, a fortran file including the subroutine DERIVE with the new format definition for the drogue file
needs to be added with the input files.

5.2 Algae bloom modelling

5.2.1 Input files

There are no additional input files needed other than for drogue transport.

5.2.2 Steering file

In addition to the necessary information for running the Telemac-2D hydrodynamic model, the following
essential information must be specified in the Telemac steering file to run a algae bloom propagation
model:

The number of particle released.

The frequency of the algae printout period.


The name of the tecplot file containing the alage particle positions in time.

The option setting the particles as algae.


The type of algae particles considered:

1. Spheres
2. Iridaea Flaccida [10]
3. Pelvetiopsis Limitata [10]
4. Gigartina Leptorhynchos [10]
The physical properties of the algae (diameter, density and thickness).
1 http://www.tecplot.com/support/documentation/

Accessibilit : Libre Page 38 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Keywords
NUMBER OF DROGUES (= number chosen by the user)
PRINTOUT PERIOD FOR DROGUES (= number chosen by the user)

DROGUES FILE (= name chosen by the user)


ALGAE TRANSPORT MODEL (= 0 or 1. to define algae transport)

ALGAE TYPE (= option chosen by the user)


DIAMETER OF ALGAE (= value set by the user)

DENSITY OF ALGAE (= value set by the user)


THICKNESS OF ALGAE (= value set by the user)

WARNING
.
Even though some of the previous keywords make references to drogues, they are also used for
algae blooms.

WARNING
.
To use the algae particle transport module it is necessary to use the k- turbulence model, i.e. the
option TURBULENCE MODEL = 3 needs to be set in the steering file.

5.2.3 The fortran file

Once algae transport has been defined in the steering file, the subroutine FLOT is used to define the
position and time of release. This is done by defining the variable ALGAE_START and using the variable LT
to release particles. In addition the subroutine ADD_PARTICLE is used to set the initial values of variables
XFLOT, YFLOT and TAGFLO, which are the two-dimensional position components and an identifier of the
particle. An example how to use FLOT to release algae particles is put in comments within the subroutine.

Modifications to subroutine FLOT for algae transport


Add the command USE ALGAE_TRANSP at the beginning of the routine
Define ALGAE_START, which will be used. as the release time of the algae

Use LT to release particles


Call ADD_PARTICLE to define XFLOT, YFLOT and TAGFLO

WARNING .
ALGAE_START needs to be greater or equal to 1.

5.2.4 Additional functionalities

Furthermore in section A.3 of the appendix there is an example of a fortran file which includes modifications
that make use of the algae particle position and velocities using the subroutine UTIMP_TELEMAC2D. In
section B of the appendix there is another example of a fortran file that modifies the subroutine DERIVE
to record particles exiting the domain.

Accessibilit : Libre Page 39 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

5.2.5 Output files

There are no additional output files provided than for drogue transport.

5.3 Oil spill modelling

5.3.1 Input files

In addition to the minimum set of input files necessary to model particle transport, an oil spill computation
also needs the oil spill steering file. Furthermore to run oil spill model a Fortran file including the routine
OIL_FLOT needs to be added.

WARNING .
The subroutine FLOT should not be used.

5.3.2 Steering file

In addition to the necessary information for running the Telemac-2D hydrodynamic model the following
essential information must be specified in the Telemac steering file to run an oil spill propagation model:

The use of the oil spill model must be declared.

The name of the oil spill steering file which contains the oil characteristic.
The number of oil particle release during the oil spill.

The frequency of the drogues printout period.

The name of the tecplot oil file containing the oil displacement.

Keywords
OIL SPILL MODEL (=1)

OILSPILL STEERING FILE (= name chosen by the user)


.
NUMBER OF DROGUES (= number chosen by the user)

PRINTOUT PERIOD FOR DROGUES (= number chosen by the user)


DROGUES FILE (= name chosen by the user)

WARNING
.
Even though some of the previous keywords make references to drogues, they are also used for oil
spills.

With the oilspill module, it is possible to take into account the transport of soluble oil components in water
(whose presence has no effect on the hydrodynamics). These may or may not be diffused within the flow
but their characteristics need to be defined in the OILSPILL STEERING FILE. If these components are
allowed to diffuse in the flow they are then treated with the tracer transport computations of Telemac-2D.
This implies that the logical keyword TRACER is set to YES and the NUMBER OF TRACER must be set to
the number of the oil soluble component. In addition the following keywords can be specified:

Accessibilit : Libre Page 40 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

If the initial value of the tracer is constant throughout the domain (for example no tracer), it is simply
a question of placing the keyword INITIAL VALUE OF TRACER with the required value in the
steering file.

The way of treating advection is specified in the third value of the keyword TYPE OF ADVECTION.
The possibilities are the same as for velocity or depth advection.

When solving the tracer transport equations, the user can choose whether or not to take into account
diffusion phenomena, using the logical word TRACER DIFFUSION (default value YES).

Furthermore, the tracer diffusion coefficient should be specified using the real keyword TRACER
DIFFUSION COEFFICIENT (default value 0.0). This parameter has a very important influence on
tracer diffusion in time.

Additional keywords for soluble oil components diffusion


TRACER = YES
NUMBER OF TRACER (= values of oil soluble components)
.
INITIAL VALUE OF TRACER (= values set by the user)
TYPE OF ADVECTION (= numerical scheme set by the user)

TRACER DIFFUSION (= logical value set by the user)


TRACER DIFFUSION COEFFICIENT (= value set by the user)

For complementary information on the use of TRACER in Telemac2d, the reader may refer to the Telmac
2d user guide.

Important information
If the number of oil dissolved component in water
. is greater than 1, the result file can contained
the sum of dissoved oil concentration. The user must only add the variable for graphic printout N:
VARIABLES FOR GRAPHIC PRINTOUTS: ....,N

WARNING
.
With the variable for graphic printout N, be careful not to have private tables or change the table
PRIVE1 in the subroutine PRERES_TELEMAC2D.F by the table PRIVEX (where X is the number
chosen by the user).

5.3.3 Oil spill steering file

As seen previously, the OILSPILL STEERING FILE name is given by the user in the Telemac steering
file. This file contains all information on oil calculation based on the oil composition considered by the
user.

The number of unsoluble components in oil.

The parameters of these components such as the mass fraction (%) and boiling point of each com-
ponent (K).

The number of soluble components in oil

The parameters of these components such as the mass fraction (%), boiling point (K), solubility
(Kg/m3 ) and the mass transfer coefficient of dissolution and volatilization phenomena (m/s)

The oil density

Accessibilit : Libre Page 41 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

The oil viscosity (m2 /s)

The volume of spilled oil (m3 )


The water surface temperature (K)

The spreading model chosen by the user :


1. Fays model
2. MigrHycar model
3. Constant area model

WARNING
The parameters of soluble (or unsoluble) components need to be informed only if the number
of these component is not null
.
If the sum of all mass fraction components is not equal to 1, the run is interrupted and an error
message displayed:

WARNING::THE SUM OF EACH COMPONENT MASS FRACTION IS NOT EQUAL TO 1.


PLEASE, MODIFIED THE INPUT STEERING FILE

An example of the oil spill stering file is given.

OILSPILL STEERING FILE


NUMBER OF UNSOLUBLE COMPONENTS IN OIL
6
UNSOLUBLE COMPONENTS PARAMETERS (FRAC MASS, TEB)
5.1D-02 , 402.32D0
9.2D-02 , 428.37D0
3.16D-01 , 458.37D0
3.5156D-01 , 503.37D0
8.5D-02 , 543.37D0
9.4D-02 , 628.37D0
NUMBER OF SOLUBLE COMPONENTS IN OIL
4
SOLUBLE COMPONENTS PARAMETERS (FRAC MASS, TEB, SOL, KDISS, KVOL)
.
1.D-02 , 497.05D0 , 0.018D0 , 1.25D-05 , 5.0D-05
3.2D-04 , 551.52D0 , 0.00176D0 , 5.63D-06 , 1.51D-05
1.D-04 , 674.68D0 , 2.0D-04 , 2.D-06 , 4.085D-07
2.D-05 , 728.15D0 , 1.33D-06 , 1.33D-06 , 1.20D-07
OIL DENSITY
830.D0
OIL VISCOSITY
4.2D-6
OIL SPILL VOLUME
2.02D-5
WATER TEMPERATURE
292.05
SPREADING MODEL(1 =FAYS MODEL, 2 = MIGRHYCAR MODEL, 3 = CONSTANT AREA)
2

If in the previous steering file, the SPREADING MODEL is set to 3, two lines must be added to the previous
example :

Accessibilit : Libre Page 42 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

WARNING
If in the previous steering file, the SPREADING . MODEL is set to 3, two lines must be added to the
previous example :
CONSTANT AREA VALUE CHOSEN BY THE USER FOR EACH PARTICLE
1 (example if the user wants area particle equal to 1 m2 )

5.3.4 The OIL_FLOT subroutine

After inserting the OIL_FLOT subroutine in the FORTRAN file, the user must modify it in order to indicate
the release time step, together with the coordinates of the release point. If the release point coordinates
are outside the domain, the run is interrupted and an error message displayed. In addition, if a particle
leaves the domain during the simulation, it is of course no longer monitored but its previous track remains
in the results file for consultation.

Modifications to subroutine OIL_FLOT


The release time step in the first condition statement and the coordinates of the release point
(COORD_X, COORD_Y) must be changed:

....
!
IF(LT.EQ.10000) THEN
NUM_GLO=0
NUM_MAX=0
NUM_LOC=0
COORD_X=0.D0
COORD_Y=0.D0
NUM_MAX=INT(SQRT(REAL(NFLOT_MAX)))
DO K=1,NUM_MAX .
DO J=1,NUM_MAX
COORD_X=336000.D0+REAL(J)
COORD_Y=371000.D0+REAL(K)
NUM_GLO=NUM_GLO+1
NFLOT_OIL=0
CALL ADD_PARTICLE(COORD_X,COORD_Y,0.D0,NUM_GLO,NFLOT_OIL,
& 1,XFLOT,YFLOT,YFLOT,TAGFLO,
& SHPFLO,SHPFLO,ELTFLO,ELTFLO,MESH,1,
& 0.D0,0.D0,0.D0,0.D0,0,0)
....
END DO
END DO
ENDIF

5.3.5 Output files

There are no additional output files provided than for drogue transport.

WARNING
.
If the user wants to develop a new drogue output format for oil spill, it must be done in the subroutine
OIL_DERIVE and not in the subroutine DERIVE used for the drogue and algue transport.

Accessibilit : Libre Page 43 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

6 Application test cases

6.1 Algae particles validation

6.1.1 Description of the test case

To validate the algae bloom transport model the experiment presented in Joly [16] and Joly et al. [18] will
be modelled. More validation of the theory can also be found in Joly et al. [17]. The flow configuration
of this experiment is that of partially obstructed open flat bed channel flow, which has the advantage of
generating a large recirculation pattern downstream of the obstructing groyne. In this experiment a fluid
with a density of 1000 kg/m3 and a flow rate of 0.5 m/s was imposed in a 2 m wide channel which was
obstructed by a groyne 0.5 m long and 0.1 m thick. The water depth was imposed to be 0.3 m before the flow
arrived at the groyne. The groyne was constructed high enough to stop overtopping. The experimental
setup is described in figure 15, and the Reynolds number was thus 106 .

0.5 m/s .

imposed
Inflow with depth
constant of 0.3 m
2m
depth of on the
0.1 m outflow
0.3 m
boundary
.

0.5 m
.

. .
. .

y x
.

Figure 15: Experimental setup for a partially obstructed flat bed open channel flow (top view).

The flow velocities are well modelled using Telemac-2D. In this case the flow is modelled using a k-
closure and it is validated against experimental measurements and another simulation performed with
OpenFoam, which solves the two-dimensional Navier-Stokes equations with a k- closure using a finite
volumes method [22]. The horizontal fluid velocities are presented in figure 16.

Accessibilit : Libre Page 44 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

2
.

1.5
y (m)

0.5 .
.

Ux (m/s)
0.
0 0.5 0 0.5 0 0.5 0 0.5 0 0.5 0 0.5 0 0.5
. .

2
. .

0 1 2 3 4 5
x (m)

Figure 16: Profiles of the horizontal velocity plotted at different locations along the canal. The small axis
marked on top of the x-axis represent the values of velocity magnitude. . are experimental
results, . are results found using version 6.3 of Telemac-2D and . are results found
using OpenFoam.

Spheres 6 mm in diameter (Ds ) and of density s = 2200 kgm3 were released in the flow one at a time at
fixed intervals (about 1 Hz). This was done to ensure that particles would not affect each others motion.
Several particles were released at different positions in the flow and the trajectories for these particles
were recorded at different locations. The trajectories of these particles were measured with a camera
that was placed above the flow so that the position of particles entering a window of measurement were
recorded, see figure 17. The process used to extract the trajectories is presented in Joly [16].

Camera

z Plexiglas surface
x

Window 1 Window 2 Window 3


Particle
.

. .
. .

.
23

4
23
05

1.

2.
0
0.

1.
1.

0.

x(m)
(a) Schematic diagram (side view) (b) Photograph

Figure 17: Experimental setup to record the particle trajectories.

Accessibilit : Libre Page 45 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

6.1.2 Analysis of the results

In this report only the particles released at position (0.175,0.45) and recorded using window 2 (see figure
17a). More results are presented in Joly [16].
To analyse the trajectories of the particles, the window of measurements is then divided into four quad-
rants. From the recorded particle trajectories we can measure the proportion of particles released into
the flow entering each quadrant of the window of measurement, and the mean time of residence inside
this quadrant. The same thing was done for the artificial particles in the simulations. These results were
non-dimensionnalised using the following equations :

NQ
Nres,Qi = 4 i (68a)
j NQj
4
TQi / j TQj
Tres,Qi = 4 (68b)
NQi / j NQj

Where Nres,Qi and Tres,Qi represent the non-dimensionnalised proportion of particles and mean time of
residence inside a quadrant Qi . NQi is the number of particles recorded in a quadrant and TQi is the
cumulative time spend by all the particles present in this quadrant. This method of writing the results
ensure that any experimental measurement for which the recordings were not complete do not seem
disproportional to the numerical simulations.
These results are plotted in figures 19 and 20, where for each quadrant the value of interest is plotted
along a line going from the inner most corner to the outter most corner. The length scales for these values
are chosen in such a way that the maximum value is placed on the outer most corner. The points plotted
for each quadrant are then linked together to form an area. An annotated example is found in figure 18.

1.5
Window of
measurement

0.5
A shaded zone 0.5
1 linking the
| |
proportion of
y (m)

particles present 0.2 5


|
5 0.2| The four
in each quadrant quadrants
for a simulation

0.5 .
Scale in this
Particle in- quadrant
jection point 5 0.2
0.2| |
5
.

0.5
0. . .
0.5
| |
0.4 0.2
. .

0 0.2 0.4 0.6 0.8 1 1.2 1.4


x (m)

Figure 18: An annotated example to explain how the proportion of particles entering each quadrant of a
window of measurement are presented. . shows the experimental measurements, .
shows the simulation using Telemac-2D.

The velocity of the particles were also analysed. To do so, profile plots were done of the properties of the
particles crossing the line at x = 0.55 m. These figures can be found in figures 21 to 23.

6.1.3 Set-up for the simulations

In this section results will be presented for simulations done using version 6.3 of Telemac-2D, and the algae
particle module. Simulations that run on different amount of processors will be tested. In the simulations
1000 spheres will be released with diameter 0.006 m and density 2200 kgm3 .

Accessibilit : Libre Page 46 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Keywords
NUMBER OF DROGUES = 1000

ALGAE TRANSPORT MODEL = 1


.
ALGAE TYPE = 1

DIAMETER OF ALGAE = 0.006


DENSITY OF ALGAE = 2200.

Furthermore, particles will be released at the first time step, as a previous calculation with the stabilized
flow will be used to set the initial conditions. Particles will be released at position (0.175,0.45).

Modifications to subroutine FLOT


...

USE ALGAE_TRANSP
...

ALGAE_START=1
! .
IF(LT.EQ.ALGAE_START) THEN
DO I=1,NFLOT_MAX
CALL ADD_PARTICLE(0.175D0,0.45D0,0.D0,I,NFLOT,
& NFLOT_MAX,XFLOT,YFLOT,YFLOT,TAGFLO,
& SHPFLO,SHPFLO,ELTFLO,ELTFLO,MESH,1,
& 0.D0,0.D0,0.D0,0.D0,0,0)
END DO
ENDIF

A description of the mesh used and the complete steering and fortran files can be found in appendix A.

6.1.4 Results of the simulations

The first result presented will be the proportion of particles entering a quadrant and their mean time of
residence. These results will be compared to experimental results, and they are presented in figures 19
and 20. As a reminder for the following results, when a simulation is said to run with 0 processors it means
that one processor will be used, but Telemac-2D wont make use of the MPI libraries. This is in contrast
to the simulations said to run using one or more processors where calls to the MPI libraries are made.

Accessibilit : Libre Page 47 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

1.5

0.5
0.5
1 | |
y (m)

0.2 5
|
5 0.2|

0.5 .

5 0.2
0.2| |
5

.
0.5
0. . .
0.5
| |
0.4 0.2
. .

0 0.2 0.4 0.6 0.8 1 1.2 1.4


x (m)

Figure 19: Partially obstructed channel flow: proportion of released particles entering a quadrant of the
window of measurement. . shows the experimental measurements, . shows the
simulation using 0 processors, . shows the simulation using 1 processors, . shows
the simulation using 2 processors, . shows the simulation using 4 processors and .
shows the simulation using 8 processors.

1.5

2.5
2.5
1 | |
y (m)

1.2 5
|
5 1.2|

0.5 .

5 1.2
1.2| |
5
.

2.5
0. . .
2.5
| |
0.4 0.2
. .

0 0.2 0.4 0.6 0.8 1 1.2 1.4


x (m)

Figure 20: Partially obstructed channel flow: mean particles residence time inside a quadrant of the win-
dow of measurement. . shows the experimental measurements, . shows the simu-
lation using 0 processors, . shows the simulation using 1 processors, . shows the
simulation using 2 processors, . shows the simulation using 4 processors and . shows
the simulation using 8 processors.

As can be seen from figures 19 and 20 the ALGAE_TRANSP module of Telemac-2D models accurately the
position of spherical particles. There is only the mean time of residence of the bottom right corner which
has noticeable differences. This would suggest that the center of the recirculation pattern might be a bit
off when modelled in Telemac-2D. Furthermore the result seem independent of the number of processors
used (which is expected).
The next results will assess the ability of the model to predict the velocities of the particles released in the
flow. In figures 21 to 23 profiles will be shown of the fraction of particles crossing the section defined by
x = 0.55 m, as well as the horizontal and vertical velocities (Vx and Vy ).

Accessibilit : Libre Page 48 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

1.5
y (m)

0.5

0.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
N

Figure 21: Partially obstructed channel flow: fraction of particles crossing the section defined by x = 0.55
m. . shows the experimental results, . shows the values calculated with 0 processors,
. shows the values calculated with 2 processors, . shows the values calculated with
4 processors and . shows the values calculated with 8 processors.

1.5
y (m)

0.5

0.
0.2 0 0.2 0.4 0.6 0.8 1
Vx (m/s)

Figure 22: Partially obstructed channel flow: horizontal velocity of particles crossing the section defined
by x = 0.55 m. . shows the experimental results, . shows the values calculated with
0 processors, . shows the values calculated with 1 processors, . shows the values
calculated with 2 processors, . shows the values calculated with 4 processors and .
shows the values calculated with 8 processors.

Accessibilit : Libre Page 49 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

1.5
y (m)

0.5

0.
0.15 0.1 0.05 0 0.05 0.1 0.15 0.2 0.25 0.3
Vy (m/s)

Figure 23: Partially obstructed channel flow: vertical velocity of particles crossing the section defined by
x = 0.55 m. . shows the experimental results, . shows the values calculated with
0 processors, . shows the values calculated with 1 processors, . shows the values
calculated with 2 processors, . shows the values calculated with 4 processors and .
shows the values calculated with 8 processors.

The results presented in figures 21 to 23 shows again that the module ALGAE_TRANSP models accurately
the velocity. The only region of error would for the vertical velocity near the solid boundaries, but this
probably linked to the previous mis-estimation of the center of the recirculation pattern in Telemac-2D.
Furthermore the result are still independent of the number of processors used.
The final useful information will be the computing times of the model for different processors and for a
different amount of particles. As a summary from the information given in appendix A the mesh has 36 996
nodes and 73 346 elements, and the simulation runs for 20 040 time steps. All the computation information
can be found in table 4.

Table 4: Computation time in Telemac-2D for particle transported in a partially obstructed channel flow on
a HP xw6600 machine.

Computation time
Number of Processors
0 particle 1000 particles 10 000 particles
0 1 h 53 m 2 h 28 m
1 1 h 49 m 1 h 54 m 2 h 26 m
2 0 h 53 m 0 h 59 m 1 h 41 m
4 0 h 22 m 0 h 29 m 1 h 31 m
8 0 h 16 m 0 h 23 m 1 h 30 m

6.2 Oil spill examples

Verification of the numerical model was carried out by simulating benchmark test cases presented in
Goeury [11] and Goeury et al. [12]. This part is dedicated to the test cases provided with the oil spill
model.

/V6P3/examples/telemac2d/riv_art
/V6P3/examples/telemac2d/estu_gir

Accessibilit : Libre Page 50 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

6.2.1 Description of the artificial river test case (riv_art)

Experimental device

Within the framework of the MigrHycar research project, an artificial river test campaign was conducted
by Veolia Environment Research and Innovation (UBA, Berlin). During the tests, four hydrocarbons were
tested: heavy fuel oil, home heating oil, kerosene and SP95E10. The main objective of these experiments
is to observe the capacity of the pollutant to dissolve PAHs according to four variable parameters, such
as flow velocity, the injection position, the oil volume and the presence of obstacles.
The UBA (Umweltbundesamt German Federal Agency for the Environment) has on its site 16 identical
systems of artificial rivers with each 100 m in circumference. Among these rivers called FSA (acronym
for Fliess und StillgewssersimulationsAnlage: simulator rivers and lakes), eight are located outdoors.
A water flow is generated in these rivers with a screw pump. A system for continuous measurement of
physical parameters river is installed for each river, and there is one weather station. For the purpose of
the project, two rivers were linked together to increase the installation length and sinuosity (Figure 24).

Figure 24: Artificial river sketch.

Experimental protocol

The release of the hydrocarbon is achieved through a ring on water surface, the pollutant is injected inside
it (Figure 25). Then, the ring is removed to allow the pollutant transport.

(a) (b)

Figure 25: Release device (a); heavy fuel spilled in the flume (b).

To observe the evolution of the concentration of dissolved PAHs, a fluorescence probe is used. Every
morning a sample called white is made to know the initial concentration of PAHs already present in the
channel. When the signal (%) is approximately on the peak, a water sample is taken during 30 seconds
using an automatic device located with the probe. The samples are then sent to the CEDRE for the
analysis of oil dissolved concentrations which allow to determine the real concentration as function of

Accessibilit : Libre Page 51 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

time.

Set-up for the simulation

In the test case, a kerosene spill in the artificial river is reproduced.


Mesh characteristics
The mesh to model the artificial river includes only triangular elements. It is composed of about 43000
elements and 23234 nodes. The maximum distance between two nodes is 0.08 m. The mesh file entitled
geo_t2d_riv_art.slf contains all the information concerning the mesh.
Telemac steering file
The flow velocity and surface elevation are imposed respectively on inflow and outflow boundary con-
ditions. For shoreline nodes, solid wall conditions are considered. A previous calculation (file entitled
t2d_riv_art.prec) with the stabilized flow is used to set the initial conditions. All information neces-
sary for the hydrodynamic computation are set on the Telemac steering file entitled t2d_riv_art.cas.
In addition to the hydrodynamic conditions, the Telemac steering file also contains the information needed
to compute the oil spill in the artificial chanel. In the simulation, 1156 oil particles are released. Each parti-
cle has associated to it, amongst other properties, four soluble components, so the NUMBER OF TRACER
is set to four in the Telemac steering file.

Keywords
Specific keywords for the oil spill

OIL SPILL MODEL = YES


OILSPILL STEERING FILE = oilspill.txt

NUMBER OF DROGUES = 1156


PRINTOUT PERIOD FOR DROGUES = 100

DROGUE FILE = oil_displacement.dat


Specific keywords for the tracers .

NUMBER OF TRACERS = 4

INITIAL VALUES OF TRACERS = 0.;0.;0.;0.


COEFFICIENT FOR DIFFUSION OF TRACERS = 0.000001

SOLVER FOR DIFFUSION OF TRACERS = 4


ACCURACY FOR DIFFUSION OF TRACERS = 1.E20

IMPLICITATION COEFFICIENT OF TRACERS = 1


OPTION FOR THE DIFFUSION OF TRACERS = 2

Oilspill steering file


The product characteristics which are essential for the oil spill computation such as the volume of the
oil spill, the petroleum composition, physical properties amongst other properties are filled in the oilspill
steering file oilspill.txt.

Accessibilit : Libre Page 52 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

OILSPILL STEERING FILE


NUMBER OF UNSOLUBLE COMPONENTS IN OIL
6
UNSOLUBLE COMPONENTS PARAMETERS (FRAC MASS, TEB)
5.1D-02 , 402.32D0
9.2D-02 , 428.37D0
3.16D-01 , 458.37D0
3.5156D-01 , 503.37D0
8.5D-02 , 543.37D0
9.4D-02 , 628.37D0
NUMBER OF SOLUBLE COMPONENTS IN OIL
4
SOLUBLE COMPONENTS PARAMETERS (FRAC MASS, TEB, SOL, KDISS, KVOL)
.
1.D-02 , 497.05D0 , 0.018D0 , 1.25D-05 , 5.0D-05
3.2D-04 , 551.52D0 , 0.00176D0 , 5.63D-06 , 1.51D-05
1.D-04 , 674.68D0 , 2.0D-04 , 2.D-06 , 4.085D-07
2.D-05 , 728.15D0 , 1.33D-06 , 1.33D-06 , 1.20D-07
OIL DENSITY
830.D0
OIL VISCOSITY
4.2D-6
OIL SPILL VOLUME
2.02D-5
WATER TEMPERATURE
292.05
SPREADING MODEL(1 =FAYS MODEL, 2 = MIGRHYCAR MODEL, 3 = CONSTANT AREA)
2

Fortran file
In order to define the time and the position of the oil spill, the Fortran file entitled t2d_riv_art.f
containing the subroutine OIL_FLOT must be declared in the Telemac steering file. In the artificial river
test case, the oil particles are released at the time step number 10 at position (24,0.925).

Accessibilit : Libre Page 53 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Modifications to subroutine OIL_FLOT


....
!
IF(LT.EQ.10) THEN
NUM_GLO=0
NUM_MAX=0
NUM_LOC=0
COORD_X=0.D0
COORD_Y=0.D0
NUM_MAX=INT(SQRT(REAL(NFLOT_MAX)))
DO K=1,NUM_MAX
DO J=1,NUM_MAX .
COORD_X=24.D0+0.001D0*REAL(J)
COORD_Y=0.925D0+0.001D0*REAL(K)
NUM_GLO=NUM_GLO+1
NFLOT_OIL=0
CALL ADD_PARTICLE(COORD_X,COORD_Y,0.D0,NUM_GLO,NFLOT_OIL,
& 1,XFLOT,YFLOT,YFLOT,TAGFLO,
& SHPFLO,SHPFLO,ELTFLO,ELTFLO,MESH,1,
& 0.D0,0.D0,0.D0,0.D0,0,0)
....
END DO
END DO
ENDIF

Results of the simulations

In the simulation, a kerosene spill which occurs in the first artificial river curve is considered. The particles
represent the oil surface slick whereas the eulerian tracer represents the dissolved petroleum in the water
column. Simulations that run on different amount of processors have been tested. The numerical and
experimental concentrations of the petroleum dissolved in the water column are shown in Figure 26.

. . results
Experimental
30 . .
Numerical results (1 proc)
. .
concentration (ng/l)

Numerical results (4 proc)


. .
Numerical results (8 proc)
20

10

0.
0 100 200 300 400 500 600 700 800 900 1 000
time (s)

Figure 26: Kerosene concentration evolution in the water column

The numerical dissolved and dispersed hydrocarbon concentrations in the water column has the same
order of magnitude and compares well with experiment. However, the numerical concentration peaks for
each case arrive earlier in comparison to the experimental concentration peak. This phenomenon can

Accessibilit : Libre Page 54 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

be explained by the outdoor conditions which cannot be modelled, such as gusts of wind. The results
presented in the previous figure are independent of the number of processors used. The computation
time of the model for different processors are summarized in the table 5.

Table 5: Computation time in Telemac-2D for particle transported in the artificial river on a HP xw6600
machine.

Number of Processors Computation time


1 1 h 30 m 22 s
4 0 h 28 m 11 s
8 0 h 20 m 10 s

6.2.2 Description of the Gironde estuary test case (estu_gir)

Intoduction

The Gironde estuary, located southwest of France, extends from the confluence of the Garonne and
Dordogne rivers to the mouth on the Atlantic coastline. Some water intake operators and a nuclear power
plant are located on the coast of Gironde estuary. An oil spill can have a strong impact on the management
of these industries. So, it is important to be able to model accurately an oil spill which would occur in the
estuary. The objectif of this test case is to show the use of the oil spill model in a real configuration.

Set-up for the simulation

Mesh characteristics
The numerical domain covers the whole estuary: from the Bay of Biscay to La Reole and Pessac, con-
sidered as the limit of the tide influence in the tributaries. The unstructured triangular mesh comprises
22650 nodes. The cell lengths extend from 50 m in the refined central part and up to 2 km in the maritime
boundary. The mesh file entitled geo_t2d_estu_gir.slf contains all the information concerning the
mesh.
Telemac steering file
Flow rates are imposed at the upstream boundary and the tide height at the maritime downstream bound-
ary for the hydrodynamics. All information necessary for the hydrodynamic computation are set on the
Telemac steering file entitled t2d_estu_gir.cas. In addition to the hydrodynamic conditions, the
Telemac steering file also contains the information needed to compute the oil spill in the artificial chanel.
In the simulation, 961 oil particles are released. Each particle has associated to it, amongst other proper-
ties, four soluble components, so the NUMBER OF TRACER is set to four in the Telemac steering file.

Accessibilit : Libre Page 55 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Keywords
Specific keywords for the oil spill

OIL SPILL MODEL = YES

OILSPILL STEERING FILE = oilspill.txt


NUMBER OF DROGUES = 961

PRINTOUT PERIOD FOR DROGUES = 20


DROGUE FILE = oil_displacement.dat

Specific keywords for the tracers .

NUMBER OF TRACERS = 4

INITIAL VALUES OF TRACERS = 0.;0.;0.;0.


COEFFICIENT FOR DIFFUSION OF TRACERS = 0.000001

SOLVER FOR DIFFUSION OF TRACERS = 4


ACCURACY FOR DIFFUSION OF TRACERS = 1.E20

IMPLICITATION COEFFICIENT OF TRACERS = 1


OPTION FOR THE DIFFUSION OF TRACERS = 2

Oilspill steering file


The product characteristics which are essential for the oil spill computation such as the volume of the
oil spill, the petroleum composition, physical properties amongst other properties are filled in the oilspill
steering file oilspill.txt.

Accessibilit : Libre Page 56 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

OILSPILL STEERING FILE


NUMBER OF UNSOLUBLE COMPONENTS IN OIL
6
UNSOLUBLE COMPONENTS PARAMETERS (FRAC MASS, TEB)
3.456D-02 , 525.09D0
6.49D-02 , 527.65D0
1.93054D-01 , 702.704D0
1.773D-01 , 823.16D0
1.814D-01 , 967.48D0
3.129D-01 , 1123.16D0
NUMBER OF SOLUBLE COMPONENTS IN OIL
4
SOLUBLE COMPONENTS PARAMETERS (FRAC MASS, TEB, SOL, KDISS, KVOL)
.
0.01964D0 , 491.11D0 , 0.032D0 , 5.56D-06 , 1.20D-05
0.0069D0 , 609.15D0 , 0.0005D0 , 5.56D-06 , 1.20D-05
0.008646D0 , 611.454D0 , 0.0012D0 , 5.56D-06 , 1.20D-05
0.00007D0 , 734.65D0 , 2.55D-06 , 5.56D-06 , 1.20D-05
OIL DENSITY
940.D0
OIL VISCOSITY
25.D-6
OIL SPILL VOLUME
1.5957D0
WATER TEMPERATURE
291.15
SPREADING MODEL(1 =FAYS MODEL, 2 = MIGRHYCAR MODEL, 3 = CONSTANT AREA)
1

Fortran file
In order to define the time and the position of the oil spill, the Fortran file entitled t2d_estu_gir.f
containing the subroutine OIL_FLOT must be declared in the Telemac steering file. In the artificial river
test case, the oil particles are released at the time step number 10000 at position (336000.D0,371000.D0).

Accessibilit : Libre Page 57 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Modifications to subroutine OIL_FLOT


....
!
IF(LT.EQ.10000) THEN
NUM_GLO=0
NUM_MAX=0
NUM_LOC=0
COORD_X=0.D0
COORD_Y=0.D0
NUM_MAX=INT(SQRT(REAL(NFLOT_MAX)))
DO K=1,NUM_MAX
DO J=1,NUM_MAX .
COORD_X=336000.D0+REAL(J)
COORD_Y=371000.D0+REAL(K)
NUM_GLO=NUM_GLO+1
NFLOT_OIL=0
CALL ADD_PARTICLE(COORD_X,COORD_Y,0.D0,NUM_GLO,NFLOT_OIL,
& 1,XFLOT,YFLOT,YFLOT,TAGFLO,
& SHPFLO,SHPFLO,ELTFLO,ELTFLO,MESH,1,
& 0.D0,0.D0,0.D0,0.D0,0,0)
....
END DO
END DO
ENDIF

Results of the simulations

In the simulation presented on Figure 27, a hypothetical heavy fuel spill is considered to occur with an
initial oil volume of 1 m3 at the mouth of the estuary. After one day, the shape of the slick is shown on
Figure 27. Even if the surface slick is not stranded, some dissoled heavy fuel components reached the
estuary coast. This phenomenon can have a strong impact for intake operators. Thus, it is important to
follow up the dissolved oil in the water column and the surface slick for operational management of risks.

Accessibilit : Libre Page 58 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Figure 27: Simulation result of heavy fuel spill in Gironde estuary.

In order to visualize the influence of wind on the water surface, a simulation is computed with the same
previous hydrodynamic conditions and with a north-easterly wind.
As shown on Figure 28, wind action can not be neglected in oil spill computation. A difficulty of oil spill
modelling is the need to properly reproduce the transport of oil pollution which is governed by the currents
and weather conditions. Moreover, the results presented in Figure 28 are influenced by the adherence of
the oil slick to the estuary banks. However, this parameter is very delicate because it depends no just on
the location (distinguishing between different type of bank as implemented in the current oil spill model but
also on the date on which the simulated spill took place (different vegetation depending on the season).

Accessibilit : Libre Page 59 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

t = 3h30 t = 7h15

t = 15h t = 24h

Figure 28: Wind effect on oil spill transport (: oil spill with north-easterly wind, : oil spill without wind)

Accessibilit : Libre Page 60 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

7 Future developments

7.1 Applying these developments to new bodies or adding new features

This section details the way to implement new bodies in Telemac-2D.

7.1.1 Feature of Fortran 90

In this section we will give a quick explaination of several features of Fortran 90 that have been used to
add algae or oil particles, and that can be used for other type of particles. For a more detailed explanation
please refer to Fortran 90 book.
Structure
Fortran 90 can be used to create structures. The following is an example of the creation of a point type
structure composed of two real numbers, and a circle structure, composed of a centre and a radius:
TYPE point
REAL :: x,y
END TYPE

TYPE circle
TYPE(point) :: centre
REAL :: radius
END TYPE

It can be observed that the centre is itself a structure of a type previously defined. Once the structure has
been defined, objects of this type can be declared:
TYPE(circle) :: ROND
ROND will be a circle with its centre and radius; the latter are obtained thanks to the % component selector.
Thus the radius of ROND will be the real ROND%radius.
Module
Modules are like INCLUDE statements, but are more clever, so that INCLUDE should now always be
avoided. As a matter of fact, modules can be used to define global variables that will be accessible to all
subroutines. With the following module:
MODULE EXAMPLE
INTEGER EX1,EX2,EX3,EX4
END MODULE EXAMPLE
All the subroutines beginning with the statement: USE EXAMPLE will have access to the same numbers
EX1, ... EX4. With INCLUDE statements, it would be only local variables without link to EX1,...
declared in other subroutines.
Modules will thus be used to define global variables that will be accessed via a USE statement. If only
one or several objects must be accessed, the ONLY statement may be used, as in the example below:
USE EXAMPLE, ONLY : EX1,EX2
This will avoid name conflicts and secures programming.
Modules are also used to store interfaces that will be shared between several subroutines.

Accessibilit : Libre Page 61 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

7.1.2 Developments to existing subroutines necessary for the transport of new bodies

In addition to all subroutines that are needed to define the transport of those new bodies in order to get
this transport to work in parallel there are a few necessary steps that need to be followed.
It is recommended to start by defining a type for the particle in the module DECLARATIONS_PARALLEL
that will regroup all the important particle variables. As an example here is the type used for algae particles:

TYPE ALG_TYPE
SEQUENCE ! NECESSARY TO DEFINE MPI TYPE ALG_CHAR
INTEGER :: MYPID ! PARTITION OF THE TRACEBACK ORIGIN (HEAD)
INTEGER :: NEPID ! THE NEIGHBOUR PARTITION THE TRACEBACK ENTERS TO
INTEGER :: IGLOB ! THE GLOBAL NUMBER OF THE PARTICLES
INTEGER :: FLAG ! USED TO ALIGN FIELDS
DOUBLE PRECISION :: VX,VY,VZ ! THE (X,Y,Z) PARTICLE VELOCITY
DOUBLE PRECISION :: UX,UY,UZ ! THE (X,Y,Z) FLUID VELOCITY
DOUBLE PRECISION :: UX_AV,UY_AV,UZ_AV ! THE (X,Y,Z) AVERAGE FLUID VELOCITY
DOUBLE PRECISION :: K_AV,EPS_AV ! THE VALUES OF K AND EPS
DOUBLE PRECISION :: H_FLU ! THE WATER DEPTH AT POSITION OF VELOCITY
DOUBLE PRECISION :: PSI(3*101) ! VARIABLE PSI USED FOR THE BASSET FORCE
END TYPE ALG_TYPE

WARNING
When defining a type the memory blocks need to be of a multiple of the biggest variable in order
to allow variables following this structure to be exchanged in between processors. In the example
above the biggest variable is DOUBLE PRECISION. . Since INTEGER variables are 4 times smaller
than DOUBLE PRECISION they need to be defined in groups of 4. This is why the variable FLAG
has been defined in the type ALG_TYPE.
Furthermore the command SEQUENCE is used at the beginning of a structure type to make sure all
these variables are in order, which necessary for memory exchange in between processors.

Once this type has been defined (lets call it PART_TYPE) it needs to be used to define variables that will
be sent, received or collected. These variables will be allocated for the total number of particles that will
be released in the flow (i.e. NFLOT_MAX). For simplicity we will refer to these variables as SENDPART,
RECVPART and HEAPPART.

WARNING
Variables SENDPART, RECVPART and HEAPPART . need to be defined in module STREAMLINE so
that they can be used with variables HEAPCOUNTS, SENDCOUNTS, RECVCOUNTS, SDISPLS and
RDISPLS.

The next step is to define an MPI type for PART_TYPE. It is recommended to copy the subroutine
ORG_CHARAC_TYPE1, rename it and adapt it to your particle type. This last step is done by modify-
ing variables CH_BLENGTH, CH_DELTA and CH_TYPES. These variables should have dimensions equal
to one more than the number of variables in PART_TYPE. Furthermore the first variable in the call to
P_MPI_TYPE_CREATE_STRUCT should be modified to equal this dimension. The MPI type for these new
bodies will be referred to as PART_CHAR.

Define PART_CHAR
Copy and rename subroutine ORG_CHARAC_TYPE1
.
Modify CH_BLENGTH, CH_DELTA and CH_TYPES
Change the call to P_MPI_TYPE_CREATE_STRUCT to use the correct dimensions

Accessibilit : Libre Page 62 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

The next step for the developer is to modify the subroutine DERIVE to calculate the transport of the par-
ticles. If the new bodies follow exactly the flow then the subroutine SCARACT can be used as is. If the
bodies follow a Brownian motion the subroutine SCARACT can also be used as is, but with the variable
ASTOCHA=.TRUE. and AVISC=VISC. Finally, if the transport needs to be specified then the subroutine
SCARACT can be used with conditions AALG=.TRUE. and APOST=.TRUE. to find the element number,
barycentric coordinates and processor number at the end of the path.
The developer then needs to modify subroutine DERIVE so that the particle information are sent to all
the other processors. This is done once the final position of the particle is known, but before the particle
positions are sent, by making a call to a subroutine that we will call SEND_INFO_PART, where the variables
SENDPART, RECVPART and HEAPPART will be updated.

WARNING .
The subroutine SEND_INFO_PART also needs to be in module STREAMLINE.

SEND_INFO_PART should be a copy of SEND_PARTICLES where HEAPCHAR, SENDPART and RECVPART


are updated instead of HEAPCHAR, SENDCHAR and RECVCHAR. This also requires a new subroutine
PREP_INITIAL_SEND_PART, which is a copy of PREP_INITIAL_SEND but for which the correct vari-
ables are updated. Finally a copy of the subroutine GLOB_CHAR_COMM with SENDPART, RECVPART and
PART_CHAR instead of SENDCHAR, RECVCHAR and CHARACTERISTIC will be used in SEND_INFO_PART.

WARNING
.
In the copy of GLOB_CHAR_COMM the call to P_MPI_ALLTOALLV needs to be modified to an exact
duplicate, but with a different name, to work with all Fortran compilers.

Furthermore when writing the subroutine SEND_INFO_PART it is important not to remove the particles
after communication, this will be done with another subroutine, which we will call DEL_INFO_PART. This
subroutine should be called before DEL_PARTICLES, and it should remove all the variables that were
sent to another processor in SEND_INFO_PART.

7.2 Adding new features to the algae bloom transport model

7.2.1 Add a new body type

The algae transport module has been designed so that any body that can be simplified to an isotropic body
can be added to this module. This can be done by making the variables ALGTYP equal to 5 or greater. It
is then necessary to go into the subroutine DISP_ALGAE and use ALGTYP to modify the cross-sectional
area (S), volume (OMEGA), added mass constant (M) and drag coefficient (CD).

Variables dependent on the body type


ALGTYP : integer used to specify body type
S : cross-sectional area
.
OMEGA : volume
M : added mass constant

CD : drag coefficient

7.2.2 Adding new features

If one wants to add another variable to define the algae bloom transport (such as age, for example) then
there are a few steps necessary steps to ensure that it will work in parallel.

Accessibilit : Libre Page 63 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Changes to DECLARATIONS_PARALLEL

A new variable needs to be added to the structure ALG_TYPE

Warning
To avoid some trouble with the memory allocation, if the variable added is an INTEGER, place
.
it on top of the list, before the DOUBLE PRECISION variables, and ensure that all integers are
of a multiple of four.
If necessary variable FLAG can be removed.

Changes to ORG_CHARAC_TYPE_ALG
Change the dimension of CH_BLENGTH, CH_DELTA and CH_TYPES from 18 to 19
Add 1 at the end of CH_BLENGTH=(/1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1/)
Add 0 at the end of CH_DELTA=(/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0/)
Use P_MPI_TYPE_GET_EXTENT to modify the CH_DELTA of the new variable
Assign the correct MPI type of the variable in CH_TYPES
Change the call to P_MPI_TYPE_CREATE_STRUCT to use the correct dimensions

Allocate and initialise this new variable in ALLOC_ALGAE


Update the variables in subroutines SEND_INFO_ALG and DEL_INFO_ALG

Subroutines that need to be modified


DECLARATIONS_PARALLEL

ORG_CHARAC_TYPE_ALG
.
ALLOC_ALGAE

SEND_INFO_ALG
DEL_INFO_ALG

7.3 Add a new feature to oil particles

7.3.1 Programming in the module OILSPILL

If one wants to add another variable to define the algae bloom transport (such as density, for example)
then there are a few steps necessary steps to ensure that it will work in parallel.

Changes to DECLARATIONS_PARALLEL

A new variable needs to be added to the structure OIL_TYPE

Warning
.
To avoid some trouble with the memory allocation, if the variable added is an INTEGER, place
it on top of the list, before the DOUBLE PRECISION variables, and ensure that all integers are
of a multiple of four.

Changes to OIL_ORG_CHARAC_TYPE
Change the dimension of CH_BLENGTH, CH_DELTA and CH_TYPES from 20 to 21

Accessibilit : Libre Page 64 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

Add 1 at the end of CH_BLENGTH=(/1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1/)


Add 0 at the end of CH_DELTA=(/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0/)
Use P_MPI_TYPE_GET_EXTENT to modify the CH_DELTA of the new variable
Assign the correct MPI type of the variable in CH_TYPES
Change the call to P_MPI_TYPE_CREATE_STRUCT to use the correct dimensions

Set to zero the variable in the section INITIALIZATION of the subroutine OIL_SPILL_2D
Initialise this new variable in OIL_FLOT

Update the variables in subroutines OIL_SEND_INFO and OIL_DELETE_PARTICLE

Subroutines that need to be modified


DECLARATIONS_PARALLEL
OIL_ORG_CHARAC_TYPE

OIL_SPILL_2D .

OIL_FLOT

OIL_SEND_INFO
OIL_DELETE_PARTICLE

References
[1] J. Almedeij. Drag coefficient of flow around a sphere: Matching asymptotically the wide trend. Powder
Technology, 186:218223, 2008.

[2] ASCE Task Committee. State-of-the-art review of modeling transport and fate of oil spills. J. Hydraulic
Eng., 122:594609, 1996.

[3] R.S. Boethling, D. Mackay, and W.J. Lyman. Handbook of Property Estimation Methods for Chemi-
cals : Environmental and Health Sciences. CRC Press LLC, 2000.

[4] N-S. Cheng, A.W-K Law, and A.N. Findikakis. Oil transport in the surf zone. Journal of Hydraulic
Engineering, 126:803809, 2000.

[5] S. Danchuk and C.D. Wilson. Effects of shoreline sensitivity on oil spill trajectory modeling of the
Lower Mississipi River. Environment Sciences Pollution Res, 17:331340, 2010.

[6] J. K. Eaton and J. R. Fessler. Preferential concentration of particles by turbulence. International


Journal of Multiphase Flow, 20(Suppl.):169209, 1994.

[7] S. Elghobashi. An updated classification map of particle-laden turbulent flows. In S. Balachandar and
A. Prosperetti, editors, Proceedings of the IUTAM Symposium on Computational Multiphase Flow,
Springer, 2006.
[8] J.A. Fay. Physical processes in the spread of oil on a water surface. Proceeding of the joint confer-
ence on prevention and control of oil spills, 1971. American Petroleum Institute.
[9] C. Gardiner. Handbook of stochastic Method for Physics, Chemistry and the Natural Sciences.
Springer Series in Synergetics, Stuttgard, 2004.
[10] B. Gaylord, C. A. Blanchette, and M. W. Denny. Mechanical consequences of size in wave-swept
algae. Ecological monographs, 64(3):287313, 1994.

Accessibilit : Libre Page 65 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

[11] C. Goeury. Modlisation du transport des nappes dhydrocarbures en zones continentales et estu-
ariennes. PhD thesis, Universit Paris-Est, 2012.
[12] C. Goeury, J.-M. Hervouet, and I. Baudin-Bizien andF. Thouvenel. A Lagrangian/Eulerian oil spill
model for continental waters. Journal of Hydraulic Research, 2013. in press.
[13] J.-M. Hervouet. Hydrodynamics of Free Surface Flows: Modelling with the finite element method.
Edition Wiley, 2007.
[14] D.E. Hibbs, Y.F. Chen, J.S. Gulliver, and V.R. Voller. A two-phase riverine spill model. International
Oil Spill Conference, pages 567571, 1997.
[15] D.E. Hibbs, J.S. Gulliver, V.R. Voller, and Y.-F. Chen. An acqueous concentration model for riverine
spills. Journal of Hazardous Materials, pages 3753, 1999.
[16] A. Joly. Modelling of the transport of algae in a coastal environment using a stochastic method. PhD
thesis, Universit Paris-Est, 2011.
[17] A. Joly, F. Moulin, D. Violeau, and D. Astruc. Diffusion in grid turbulence of isotropic macro-particles
using a Lagrangian stochastic method: Theory and validation. Physics of Fluids, 24(103303), 2012.
[18] A. Joly, D. Violeau, F. Moulin, D. Astruc, and C. Kassiotis. Transport of isotropic particles in a partially
obstructed channel flow. Journal of Hydraulic Research, 50(3):324337, 2012.
[19] R.K. Jones. A Simplified Pseudo-component Oil Evaporation model. Proceedings of the Twentieth
Artic and Marine Oilspill Program, 1997.
[20] D. Mackay and R.S. Matsugu. Evaporation Rates of Liquid Hydrocarbon Spills On Land and Water.
The Canadian Journal of Chemical Engineering, 51:434439, 1973.
[21] K. Maroihi, E. Deleersnijder, and A. Loffet. Simulation mathmatique des nappes dhydrocarbures et
comparaison avec les observations par tldtection. Hydrocol. Appl., 4:2331, 1992.
[22] Open CFD. OpenFOAM user guide, 2011. http://www.openfoam.com/.
[23] C. Poelma, J. Westerweel, and G. Ooms. Particle-fluid interactions in grid-generated turbulence.
Journal of Fluid Mechanics, 589:315351, 2007.
[24] S. Pope. Turbulent Flows. Cambridge University Press, Cambridge, 2000.
[25] S. Pope. Lagrangian PDF methods for turbulent flows. Annual Review of Fluid Mechanics, 26:2363,
2004.
[26] D. Schmidt Etkin, D. French McCay, and J. Michel. Review of the State-of-the-Art on the model-
ing interaction between spilled oil and shorelines for the development of algorithms for oil spill risk
analysis modeling. Technical report, US Department of Interior, 2007.
[27] W. Stiver and D. Mackay. Evaporation Rate of Spills of Hydrocarbons and Petroleum Mixtures.
Environmental Science & technology, 18(11):834840, 1984.
[28] Telemac Systems. TELEMAC-2D software Version 6.0 User Manual, 2010. http://www.
opentelemac.org.
[29] D. Violeau. Explicit algebraic Reynolds stresses and scalar fluxes for density-stratified shear flows.
Physic of Fluids 21:035103, 2009.
[30] P.-L. Viollet, J.-P. Chabard, P. Esposito, and D. Laurence. Mcanique des fluides applique. Presses
de lEcole Nationale des Ponts et Chausses, Paris, 2002.
[31] A. Warluzel and J.P. Benque. Un modle mathmatique de transport et dtalement dune nappe
dhydrocarbure. AIRH, 17:199212, 1981.
[32] W.G. Whitman. The two-film theory of absorption. Chemical and Metallurgical Engineering, 1923.
[33] P. Yapa and H. Shen. Modeling River Oil-Spills - A Review. Journal of Hydraulic Research, 41:
339351, 1994.

Accessibilit : Libre Page 66 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

A Configuration for the obstructed channel flow validation case

This section presents the details used for the validation case presented in section 6.1. It is a useful
example for a user wanting to see how to make use of the particle positions and velocities.

A.1 Mesh used

The mesh consist of the mesh has 36 996 nodes and 73 346 elements. The mesh elements size was about
0.1 m at the inflow, 0.015 m around the groyne and 0.3 m at the outflow. A picture of the mesh can be
found in figure 29.

Figure 29: Mesh used to simulate the obstructed channel flow.

Accessibilit : Libre Page 67 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

A.2 Steering File

/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/
/*/ /*/
/*/ Transport of particles in an obstructed channel flow /*/
/*/ /*/
/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/
/
PARALLEL PROCESSORS : 4
// DEBUGGER : 1
/-----------------------------------------------------------------------/
/ COMPUTING ENVIRONMENT
/-----------------------------------------------------------------------/
/
FORTRAN FILE :
./canal_chatou.f
BOUNDARY CONDITIONS FILE :
../GEOMETRIE/canal_chatou.cli
GEOMETRY FILE :
../GEOMETRIE/canal_chatou.bin
RESULTS FILE :
../RESULTATS/canal_chatou.res
COMPUTATION CONTINUED = YES
PREVIOUS COMPUTATION FILE =
../RESULTATS/canal_chatou_ini.res
INITIAL TIME SET TO ZERO = YES
/----------------------------------------------------------------------/
/ ALGAE OPTIONS
/----------------------------------------------------------------------/
NUMBER OF DROGUES = 1000
PRINTOUT PERIOD FOR DROGUES = 40
DROGUES FILE = ../RESULTATS/pos_part.dat
ALGAE TRANSPORT MODEL = YES
DIAMETRE OF ALGAE = 0.006
DENSITY OF ALGAE = 2200.0
ALGAE TYPE = 1
/
/----------------------------------------------------------------------/
/ GENERALS OPTIONS
/----------------------------------------------------------------------/
/
/
EQUATIONS : SAINT-VENANT EF
VARIABLES FOR GRAPHIC PRINTOUTS :
B,U,V,H,S,W,L,M,N,D,K,E
TIME STEP : 0.0025
NUMBER OF TIME STEPS : 20040
GRAPHIC PRINTOUT PERIOD : 40
LISTING PRINTOUT PERIOD : 400
/
/---------------------------------------------------------------------/
/ INITIAL CONDITIONS
/---------------------------------------------------------------------/
/
INITIAL CONDITIONS : CONSTANT ELEVATION
COTE INITIALE : 0.3
/

Accessibilit : Libre Page 68 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

/----------------------------------------------------------------------/
/ CONDITIONS ON THE LIMITS
/----------------------------------------------------------------------/
/
LAW OF BOTTOM FRICTION : 3
FRICTION COEFFICIENT : 66.471
PRESCRIBED FLOWRATES : 0.0;0.3
PRESCRIBED ELEVATIONS : 0.27;0.3
/
/----------------------------------------------------------------------/
/ NUMERICAL OPTIONS
/----------------------------------------------------------------------/
/
TURBULENCE MODEL : 3
/
SOLVER ACCURACY : 1.E-6
MAXIMUM NUMBER OF ITERATIONS FOR SOLVER : 500
TREATMENT OF THE LINEAR SYSTEM : 2
SOLVER : 7
/
SUPG OPTION : 1;2
SOLVER OPTION : 3
DISCRETIZATIONS IN SPACE : 12 ; 11
/
&FIN

Accessibilit : Libre Page 69 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

A.3 Fortran File

C======================================================================
C ANT1 14/06/2013
C======================================================================
C SPHERE TRANSPORT IN A PARTIALY OBSTRUCTED CHANNEL
C MODIFICATIONS:
C - MODULE MESURES_POSITIONS USED TO RECORD PARTICLE POSITIONS
C - MODULE PNTS_MESURE USED TO RECORD FLUID VELOCITIES
C - SUBROUTINE FLOT USED TO RELEASE PARTICLES
C - SUBROUTINE UTIMP_TELEMAC2D USED CALL SUBROUTINES RECORDING
C PARTICLE AND FLUID POSITION OR VELOCITIES
C - SUBROUTINE MESURES_ALG RECORDS PARTICLE POSITIONS
C - SUBROUTINE MESURES_PROF_VIT RECORDS PARTICLE VELOCITIES
C - SUBROUTINE ENR_FLU RECORDS FLUID VELOCITIES
C
C======================================================================
C
MODULE MESURES_POSITIONS
C**********************************************************************
C DECLARATION OF VARIABLES USED TO RECORD RESULTS
C**********************************************************************
C PARAMETRES USED TO DESCRIBE THE RECORDED CASE
INTEGER,PARAMETER :: MESURE=2
INTEGER,PARAMETER :: LACHE=2
INTEGER,PARAMETER :: VIT=1
C TO DEFINE THE INITIAL PARTICLE POSITION
DOUBLE PRECISION:: X_INI
DOUBLE PRECISION:: Y_INI
C RESULT FILES
CHARACTER (LEN=50) :: F_MES_ALG
CHARACTER (LEN=50) :: F_PROF_VIT
LOGICAL :: INIT_MES
DATA INIT_MES /.TRUE./
LOGICAL :: INIT_PROF
DATA INIT_PROF /.TRUE./
C POSITIONS OF THE QUADRANTS
DOUBLE PRECISION:: X_HD_1
DOUBLE PRECISION:: X_HD_2
DOUBLE PRECISION:: Y_HD_1
DOUBLE PRECISION:: Y_HD_2
C
DOUBLE PRECISION:: X_BD_1
DOUBLE PRECISION:: X_BD_2
DOUBLE PRECISION:: Y_BD_1
DOUBLE PRECISION:: Y_BD_2
C
DOUBLE PRECISION:: X_HG_1
DOUBLE PRECISION:: X_HG_2
DOUBLE PRECISION:: Y_HG_1
DOUBLE PRECISION:: Y_HG_2
C
DOUBLE PRECISION:: X_BG_1
DOUBLE PRECISION:: X_BG_2
DOUBLE PRECISION:: Y_BG_1
DOUBLE PRECISION:: Y_BG_2
C RECORDED VARIABLES IN EACH QUADRANT

Accessibilit : Libre Page 70 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

INTEGER:: N_HD
INTEGER:: N_BD
INTEGER:: N_HG
INTEGER:: N_BG
INTEGER,DIMENSION(:,:),ALLOCATABLE:: PRESENCE
DOUBLE PRECISION,DIMENSION(:),ALLOCATABLE:: RESID
DOUBLE PRECISION:: T_START
DOUBLE PRECISION:: T_END
INTEGER:: N_TOT
LOGICAL:: YES_START
C VARIABLES USED TO RECORD VELOCITY PROFILES
DOUBLE PRECISION ::X_PROF
INTEGER ,PARAMETER ::NY=10
DOUBLE PRECISION ::Y_PROF(NY)
DOUBLE PRECISION ::DY_PROF
INTEGER ::N_PROF(NY)
DOUBLE PRECISION ::UX_PROF(NY)
DOUBLE PRECISION ::UY_PROF(NY)
DOUBLE PRECISION ::VX_PROF(NY)
DOUBLE PRECISION ::VY_PROF(NY)
C VARIABLES USED TO WRITE THE RESULTS
INTEGER ::N_WRI(NY)
DOUBLE PRECISION ::UX_WRI(NY)
DOUBLE PRECISION ::UY_WRI(NY)
DOUBLE PRECISION ::VX_WRI(NY)
DOUBLE PRECISION ::VY_WRI(NY)
END MODULE

MODULE PNTS_MESURE
C**********************************************************************
C DECLARATION OF VARIABLES USED TO RECORD THE FLOW
C**********************************************************************
INTEGER ,PARAMETER :: NY_PR=101
INTEGER ,PARAMETER :: NX_PR=7
DOUBLE PRECISION :: X_PROF(NX_PR,NY_PR)
DOUBLE PRECISION :: Y_PROF(NX_PR,NY_PR)
INTEGER :: ELEM_PROF(NX_PR,NY_PR)
DOUBLE PRECISION :: DET_PROF(3,NX_PR,NY_PR)
INTEGER :: PROC_PROF(NX_PR,NY_PR)
C
DOUBLE PRECISION :: U_MES(NX_PR,NY_PR)
DOUBLE PRECISION :: V_MES(NX_PR,NY_PR)
DOUBLE PRECISION :: K_MES(NX_PR,NY_PR)
DOUBLE PRECISION :: EPS_MES(NX_PR,NY_PR)
DOUBLE PRECISION :: H_MES(NX_PR,NY_PR)
END MODULE

! ***************
SUBROUTINE FLOT
! ***************
!
&(XFLOT,YFLOT,NFLOT,NFLOT_MAX,X,Y,IKLE,NELEM,NELMAX,NPOIN,
& TAGFLO,SHPFLO,ELTFLO,MESH,LT,NIT,AT)
!
!***********************************************************************
! TELEMAC2D V6P3 21/08/2010

Accessibilit : Libre Page 71 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

!***********************************************************************
!
!brief THE USER MUST GIVE :
!+
!+
!+ 1) THE TIMESTEP WHEN THE FLOATING BODY IS RELEASED.
!+
!+
!+ 2) THE TIME WHEN THE COMPUTATION IS STOPPED FOR THIS FLOATING BODY.
!+
!+
!+ 3) THE INITIAL POSITION OF THE FLOATING BODY AT THE TIME OF RELEASE.
!
!history J-M JANIN (LNH)
!+ 17/08/1994
!+ V5P2
!+
!
!history N.DURAND (HRW), S.E.BOURBAN (HRW)
!+ 13/07/2010
!+ V6P0
!+ Translation of French comments within the FORTRAN sources into
!+ English comments
!
!history N.DURAND (HRW), S.E.BOURBAN (HRW)
!+ 21/08/2010
!+ V6P0
!+ Creation of DOXYGEN tags for automated documentation and
!+ cross-referencing of the FORTRAN sources
!
!history J-M HERVOUET (EDF R&D, LNHE)
!+ 22/02/2013
!+ V6P3
!+ New version called at every time step, compatible with //.
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!| AT |-->| TIME
!| ELTFLO |<->| NUMBERS OF ELEMENTS WHERE ARE THE FLOATS
!| LT |-->| CURRENT TIME STEP
!| MESH |<->| MESH STRUCTURE
!| NFLOT |-->| NUMBER OF FLOATS
!| NFLOT_MAX |-->| MAXIMUM NUMBER OF FLOATS
!| NIT |-->| NUMBER OF TIME STEPS
!| NPOIN |-->| NUMBER OF POINTS IN THE MESH
!| SHPFLO |<->| BARYCENTRIC COORDINATES OF FLOATS IN THEIR
!| | | ELEMENTS.
!| X,Y |-->| COORDINATES OF POINTS IN THE MESH
!| XFLOT,YFLOT |<--| POSITIONS OF FLOATING BODIES
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
USE BIEF
USE STREAMLINE, ONLY : ADD_PARTICLE,DEL_PARTICLE
USE ALGAE_TRANSP
!
IMPLICIT NONE
INTEGER LNG,LU
COMMON/INFO/LNG,LU

Accessibilit : Libre Page 72 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

!
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
!
INTEGER, INTENT(IN) :: NPOIN,NIT,NFLOT_MAX,LT
INTEGER, INTENT(IN) :: NELEM,NELMAX
INTEGER, INTENT(IN) :: IKLE(NELMAX,3)
INTEGER, INTENT(INOUT) :: NFLOT
INTEGER, INTENT(INOUT) :: TAGFLO(NFLOT_MAX)
INTEGER, INTENT(INOUT) :: ELTFLO(NFLOT_MAX)
DOUBLE PRECISION, INTENT(IN) :: X(NPOIN),Y(NPOIN),AT
DOUBLE PRECISION, INTENT(INOUT) :: XFLOT(NFLOT_MAX)
DOUBLE PRECISION, INTENT(INOUT) :: YFLOT(NFLOT_MAX)
DOUBLE PRECISION, INTENT(INOUT) :: SHPFLO(3,NFLOT_MAX)
TYPE(BIEF_MESH) , INTENT(INOUT) :: MESH
!
INTEGER :: I
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
!
! EXAMPLE : AT ITERATION 1 AND EVERY 10 ITERATIONS AFTER 600
! A PARTICLE IS RELEASED WITH COORDINATES
! X=-220.
! Y=400.D0+LT/3.D0
! AND TAG NUMBER LT
!
! IF(LT.LE.600.AND.(10*(LT/10).EQ.LT.OR.LT.EQ.1)) THEN
! CALL ADD_PARTICLE(-220.D0,400.D0+LT/3.D0,0.D0,LT,NFLOT,
! & NFLOT_MAX,XFLOT,YFLOT,YFLOT,TAGFLO,
! & SHPFLO,SHPFLO,ELTFLO,ELTFLO,MESH,1,
! & 0.D0,0.D0,0.D0,0.D0,0,0)
! ENDIF
!
! EXAMPLE : PARTICLE WITH TAG 20 REMOVED AT ITERATION 600
!
! IF(LT.EQ.600) THEN
! CALL DEL_PARTICLE(20,NFLOT,NFLOT_MAX,
! & XFLOT,YFLOT,YFLOT,TAGFLO,SHPFLO,SHPFLO,
! & ELTFLO,ELTFLO,MESH%TYPELM)
! ENDIF
!
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
!
! EXAMPLE : FOR ALGAE PARTICLE TRANSPORT
! => ALGAE_START NEEDS TO BE DEFINED
!
! ALGAE_START=2
!
! IF(LT.EQ.MAX(1,ALGAE_START)) THEN
! DO I=1,NFLOT_MAX
! CALL ADD_PARTICLE(0.175D0,0.45D0,0.D0,I,NFLOT,
! & NFLOT_MAX,XFLOT,YFLOT,YFLOT,TAGFLO,
! & SHPFLO,SHPFLO,ELTFLO,ELTFLO,MESH,1,
! & 0.D0,0.D0,0.D0,0.D0,0,0)
! END DO
! ENDIF
!
!-----------------------------------------------------------------------
ALGAE_START=1

Accessibilit : Libre Page 73 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

!
IF(LT.EQ.ALGAE_START) THEN
DO I=1,NFLOT_MAX
CALL ADD_PARTICLE(0.175D0,0.45D0,0.D0,I,NFLOT,
& NFLOT_MAX,XFLOT,YFLOT,YFLOT,TAGFLO,
& SHPFLO,SHPFLO,ELTFLO,ELTFLO,MESH,1,
& 0.D0,0.D0,0.D0,0.D0,0,0)
END DO
ENDIF
!-----------------------------------------------------------------------
!
RETURN
END SUBROUTINE FLOT

! **************************
SUBROUTINE UTIMP_TELEMAC2D
! **************************
!
&(LTL,ATL,GRADEBL,GRAPRDL,LISDEBL,LISPRDL)
!
!***********************************************************************
! TELEMAC2D V6P1 21/08/2010
!***********************************************************************
!
!brief WRITES OUT ADDITIONAL OUTPUT REQUIRED BY THE USER.
!
!note THIS SUBROUTINE IS CALLED IN THE SAME PLACES AS THE
!+ MAIN TELEMAC2D OUTPUT SUBROUTINE (NAMED DESIMP),
!+ I.E. CALLED TWICE:
!+
!note (1) ONCE PER RUN, WHEN LTL==0, INDEPENDENTLY OF WHETHER
!+ OUTPUT OF INITIAL CONDITIONS : YES IS SET OR NOT
!note (2) EACH TIME STEP JUST AFTER DESIMP-OUTPUT
!
!warning USER SUBROUTINE; DOES NOTHING BY DEFAULT
!
!history JACEK A. JANKOWSKI PINXIT, BAW KARLSRUHE, JACEK.JANKOWSKI@BAW.DE
!+ **/08/2003
!+ V5P4
!+
!
!history N.DURAND (HRW), S.E.BOURBAN (HRW)
!+ 13/07/2010
!+ V6P0
!+ Translation of French comments within the FORTRAN sources into
!+ English comments
!
!history N.DURAND (HRW), S.E.BOURBAN (HRW)
!+ 21/08/2010
!+ V6P0
!+ Creation of DOXYGEN tags for automated documentation and
!+ cross-referencing of the FORTRAN sources
!

Accessibilit : Libre Page 74 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!| ATL |-->| TIME OF TIME STEP, IN SECONDS
!| GRADEBL |-->| FIRST TIME STEP FOR GRAPHIC OUTPUTS
!| GRAPRDL |-->| PERIOD OF GRAPHIC OUTPUTS
!| LISDEBL |-->| FIRST TIME STEP FOR LISTING OUTPUTS
!| LISPRDL |-->| PERIOD OF LISTING OUTPUTS
!| LTL |-->| CURRENT TIME STEP
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
USE BIEF
USE DECLARATIONS_TELEMAC
USE DECLARATIONS_TELEMAC2D
! DAJ
! OPEN VARIABLES RELATED TO ALGAE TRANSPORT
USE ALGAE_TRANSP
! FAJ
!
IMPLICIT NONE
INTEGER LNG,LU
COMMON/INFO/LNG,LU
!
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
!
DOUBLE PRECISION, INTENT(IN) :: ATL
INTEGER, INTENT(IN) :: LTL,GRADEBL,GRAPRDL,LISDEBL,LISPRDL
!
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
!
!
!***********************************************************************
! USER OUTPUT

! DAJ
! RECORD FLUID VELOCITIES AT EVERY GRAPHIC PRINTOUT PERIOD
IF(MOD(LT,LEOPRD).EQ.0)THEN
CALL ENR_FLU(MESH%IKLE%I,3)
END IF

! RECORD VELOCITY PROFILES


CALL MESURES_PROF_VIT(NCSIZE,IPID,NFLOT_MAX,NFLOT,XFLOT%R,
& YFLOT%R,DX_A%R,DY_A%R,V_X%R,V_Y%R,V_X_0%R,
& V_Y_0%R,U_X%R,U_Y%R,U_X_0%R,U_Y_0%R)

! RECORD PARTICLE POSITION


CALL MESURES_ALG(NFLOT_MAX,NFLOT,XFLOT%R,YFLOT%R,TAGFLO%I,LT,
& DT,DT,NCSIZE,IPID)

! IF(MOD(LT,FLOPRD).EQ.0)THEN
! ! RECORD VELOCITY PROFILES
! CALL MESURES_PROF_VIT(NCSIZE,IPID,NFLOT_MAX,NFLOT,XFLOT%R,
! & YFLOT%R,DX_A%R,DY_A%R,V_X%R,V_Y%R,V_X_0%R,
! & V_Y_0%R,U_X%R,U_Y%R,U_X_0%R,U_Y_0%R)
!
! ! RECORD PARTICLE POSITION
! CALL MESURES_ALG(NFLOT_MAX,NFLOT,XFLOT%R,YFLOT%R,TAGFLO%I,LT,

Accessibilit : Libre Page 75 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

! & DT*REAL(FLOPRD),DT,NCSIZE,IPID)
! END IF

! FAJ

!
!
!
!-----------------------------------------------------------------------
!
RETURN
END SUBROUTINE UTIMP_TELEMAC2D

C **********************
SUBROUTINE MESURES_ALG
C **********************
C
&(NP_TOT,N_A,X_A,Y_A,TAG,LT,DT,DTREAL,NCSIZE,IPID)
C
C***********************************************************************
C ANTOINE JOLY
C
C***********************************************************************
C
C SUBROUTINE USED TO RECORD PARTICLE POSITIONS
C
C-----------------------------------------------------------------------
C ARGUMENTS
C .________________.____.______________________________________________.
C | NOM |MODE| ROLE |
C |________________|____|______________________________________________|
C |________________|____|______________________________________________|
C MODE : -->(DONNEE NON MODIFIEE), <--(RESULTAT), <-->(DONNEE MODIFIEE)
C
C-----------------------------------------------------------------------
C
C APPELE PAR : TELMAC
C
C SOUS-PROGRAMME APPELE : NEANT
C
C***********************************************************************
C
USE MESURES_POSITIONS
C

IMPLICIT NONE
C INPUT VARIABLES
INTEGER ,INTENT(IN) :: NP_TOT,N_A,NCSIZE,IPID
DOUBLE PRECISION,INTENT(IN) :: X_A(NP_TOT)
DOUBLE PRECISION,INTENT(IN) :: Y_A(NP_TOT)
INTEGER ,INTENT(IN) :: TAG(NP_TOT)

Accessibilit : Libre Page 76 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

INTEGER ,INTENT(IN) :: LT
DOUBLE PRECISION,INTENT(IN) :: DT
DOUBLE PRECISION,INTENT(IN) :: DTREAL
C VARIABLES FOR LOOPS
INTEGER :: I_A
INTEGER :: I_Q
C VARIABLES USED TO WRITE RESULT FILES
DOUBLE PRECISION:: T_START_W
DOUBLE PRECISION:: T_END_W
INTEGER:: N_TOT_W
INTEGER:: N_HD_W
INTEGER:: N_BD_W
INTEGER:: N_HG_W
INTEGER:: N_BG_W
DOUBLE PRECISION:: RESID_W(4)
DOUBLE PRECISION:: X_DEC(10),Y_DEC(10)
DOUBLE PRECISION:: N_HD_N
DOUBLE PRECISION:: N_BD_N
DOUBLE PRECISION:: N_HG_N
DOUBLE PRECISION:: N_BG_N
DOUBLE PRECISION:: RSD_HD_N
DOUBLE PRECISION:: RSD_BD_N
DOUBLE PRECISION:: RSD_HG_N
DOUBLE PRECISION:: RSD_BG_N
INTEGER:: SUM_N
DOUBLE PRECISION:: SUM_RSD
DOUBLE PRECISION:: MAX_N
DOUBLE PRECISION:: MAX_RSD
C VARIABLES USED IN PARALLEL
INTEGER P_ISUM,P_IMAX
DOUBLE PRECISION P_DSUM,P_DMIN,P_DMAX
EXTERNAL P_ISUM,P_IMAX,P_DSUM,P_DMIN,P_DMAX

C
C-----------------------------------------------------------------------
C DEFINE THE QUARTERS
C-----------------------------------------------------------------------
C AT THE FIRST TIME STEP
IF(INIT_MES)THEN
INIT_MES=.FALSE.
C DEFINE RELEASE POINT
IF(LACHE.EQ.1)THEN
X_INI=-1.3D0
Y_INI=0.19D0
ELSEIF(LACHE.EQ.2)THEN
X_INI=0.175D0
Y_INI=0.45D0
ELSEIF(LACHE.EQ.3)THEN
X_INI=-0.19D0
Y_INI=0.25D0
ELSEIF(LACHE.EQ.4)THEN
X_INI=0.98D0
Y_INI=0.55D0
END IF
C DEFINE THE WINDOW OF MEASUREMENT
IF(MESURE.EQ.1)THEN
X_HG_1=-1.05D0

Accessibilit : Libre Page 77 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

X_HG_2=-0.55D0
Y_HG_1=0.5D0
Y_HG_2=1.0D0
C
X_BG_1=-1.05D0
X_BG_2=-0.55D0
Y_BG_1=0.D0
Y_BG_2=0.5D0
C
X_HD_1=-0.55D0
X_HD_2=-0.05D0
Y_HD_1=0.5D0
Y_HD_2=1.0D0
C
X_BD_1=-0.55D0
X_BD_2=-0.05D0
Y_BD_1=0.D0
Y_BD_2=0.5D0
C
ELSEIF(MESURE.EQ.2)THEN
X_HG_1=0.225D0
X_HG_2=0.725D0
Y_HG_1=0.5D0
Y_HG_2=1.0D0
C
X_BG_1=0.225D0
X_BG_2=0.725D0
Y_BG_1=0.D0
Y_BG_2=0.5D0
C
X_HD_1=0.725D0
X_HD_2=1.225D0
Y_HD_1=0.5D0
Y_HD_2=1.0D0
C
X_BD_1=0.725D0
X_BD_2=1.225D0
Y_BD_1=0.D0
Y_BD_2=0.5D0
C
ELSEIF(MESURE.EQ.3)THEN
X_HG_1=1.4D0
X_HG_2=1.9D0
Y_HG_1=0.5D0
Y_HG_2=1.0D0
C
X_BG_1=1.4D0
X_BG_2=1.9D0
Y_BG_1=0.D0
Y_BG_2=0.5D0
C
X_HD_1=1.9D0
X_HD_2=2.4D0
Y_HD_1=0.5D0
Y_HD_2=1.0D0
C
X_BD_1=1.9D0

Accessibilit : Libre Page 78 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

X_BD_2=2.4D0
Y_BD_1=0.D0
Y_BD_2=0.5D0
END IF
C OPEN RESULT FILE
IF(MESURE.EQ.1.AND.LACHE.EQ.1)THEN
F_MES_ALG=../../RESULTATS/mesure1_lache1_bass.txt
ELSEIF(MESURE.EQ.2.AND.LACHE.EQ.2)THEN
F_MES_ALG=../../RESULTATS/mesure2_lache2_bass.txt
ELSEIF(MESURE.EQ.2.AND.LACHE.EQ.3)THEN
F_MES_ALG=../../RESULTATS/mesure2_lache3_bass.txt
ELSEIF(MESURE.EQ.3.AND.LACHE.EQ.2)THEN
F_MES_ALG=../../RESULTATS/mesure3_lache2_bass.txt
ELSEIF(MESURE.EQ.3.AND.LACHE.EQ.4)THEN
F_MES_ALG=../../RESULTATS/mesure3_lache4_bass.txt
END IF
C INITIALISE THE VARIABLES
N_HD=0
N_BD=0
N_HG=0
N_BG=0
IF(ALLOCATED(PRESENCE))DEALLOCATE(PRESENCE)
ALLOCATE(PRESENCE(NP_TOT,4))
IF(ALLOCATED(RESID))DEALLOCATE(RESID)
ALLOCATE(RESID(4))
DO I_A=1,NP_TOT
DO I_Q=1,4
! PRESENCE(I_A,I_Q)=.FALSE.
PRESENCE(I_A,I_Q)=0
END DO
END DO
DO I_Q=1,4
RESID(I_Q)=0.D0
END DO
C
YES_START=.TRUE.
T_START=1.D10
T_END=0.D0
END IF
C-----------------------------------------------------------------------
C CALCULATE THE VARIABLES FOR EACH QUARTER
C-----------------------------------------------------------------------
C
N_TOT=0
C
DO I_A=1,N_A
IF(X_A(I_A).GE.X_HD_1.AND.X_A(I_A).LE.X_HD_2.AND.
& Y_A(I_A).GE.Y_HD_1.AND.Y_A(I_A).LE.Y_HD_2)THEN
IF(PRESENCE(TAG(I_A),1).EQ.0)THEN
N_HD=N_HD+1
PRESENCE(TAG(I_A),1)=PRESENCE(TAG(I_A),1)+1
ELSE
RESID(1)=RESID(1)+DT
END IF
IF(YES_START)THEN
T_START=LT*DTREAL
YES_START=.FALSE.

Accessibilit : Libre Page 79 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

END IF
IF(LT*DTREAL.GT.T_END)T_END=LT*DTREAL
END IF
C
IF(X_A(I_A).GE.X_BD_1.AND.X_A(I_A).LE.X_BD_2.AND.
& Y_A(I_A).GE.Y_BD_1.AND.Y_A(I_A).LE.Y_BD_2)THEN
IF(PRESENCE(TAG(I_A),2).EQ.0)THEN
N_BD=N_BD+1
PRESENCE(TAG(I_A),2)=PRESENCE(TAG(I_A),2)+1
ELSE
RESID(2)=RESID(2)+DT
END IF
IF(YES_START)THEN
T_START=LT*DTREAL
YES_START=.FALSE.
END IF
IF(LT*DTREAL.GT.T_END)T_END=LT*DTREAL
END IF
C
IF(X_A(I_A).GE.X_HG_1.AND.X_A(I_A).LE.X_HG_2.AND.
& Y_A(I_A).GE.Y_HG_1.AND.Y_A(I_A).LE.Y_HG_2)THEN
IF(PRESENCE(TAG(I_A),3).EQ.0)THEN
N_HG=N_HG+1
PRESENCE(TAG(I_A),3)=PRESENCE(TAG(I_A),3)+1
ELSE
RESID(3)=RESID(3)+DT
END IF
IF(YES_START)THEN
T_START=LT*DTREAL
YES_START=.FALSE.
END IF
IF(LT*DTREAL.GT.T_END)T_END=LT*DTREAL
END IF
C
IF(X_A(I_A).GE.X_BG_1.AND.X_A(I_A).LE.X_BG_2.AND.
& Y_A(I_A).GE.Y_BG_1.AND.Y_A(I_A).LE.Y_BG_2)THEN
IF(PRESENCE(TAG(I_A),4).EQ.0)THEN
N_BG=N_BG+1
PRESENCE(TAG(I_A),4)=PRESENCE(TAG(I_A),4)+1
ELSE
RESID(4)=RESID(4)+DT
END IF
IF(YES_START)THEN
T_START=LT*DTREAL
YES_START=.FALSE.
END IF
IF(LT*DTREAL.GT.T_END)T_END=LT*DTREAL
END IF
END DO
C
C-----------------------------------------------------------------------
C COMMUNICATE RESULTS FOUND IN EACH PROCESSOR
C-----------------------------------------------------------------------
C
IF(NCSIZE.GT.0)THEN
DO I_A=1,NP_TOT
PRESENCE(I_A,1)=P_IMAX(PRESENCE(I_A,1))

Accessibilit : Libre Page 80 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

PRESENCE(I_A,2)=P_IMAX(PRESENCE(I_A,2))
PRESENCE(I_A,3)=P_IMAX(PRESENCE(I_A,3))
PRESENCE(I_A,4)=P_IMAX(PRESENCE(I_A,4))
C
IF(PRESENCE(I_A,1).GT.0.OR.PRESENCE(I_A,2).GT.0.OR.
& PRESENCE(I_A,3).GT.0.OR.PRESENCE(I_A,4).GT.0)THEN
N_TOT=N_TOT+1
END IF
END DO
ELSE
DO I_A=1,NP_TOT
IF(PRESENCE(I_A,1).GT.0.OR.PRESENCE(I_A,2).GT.0.OR.
& PRESENCE(I_A,3).GT.0.OR.PRESENCE(I_A,4).GT.0)THEN
N_TOT=N_TOT+1
END IF
END DO
END IF
!
C-----------------------------------------------------------------------
C CALCULATE THE VARIABLES USED FOR THE RESULT FILE
C-----------------------------------------------------------------------
C IN PARRALLEL
IF(NCSIZE.GT.0)THEN
T_START_W=P_DMIN(T_START)
T_END_W=P_DMAX(T_END)
N_TOT_W=N_TOT
N_HD_W=P_ISUM(N_HD)
N_BD_W=P_ISUM(N_BD)
N_HG_W=P_ISUM(N_HG)
N_BG_W=P_ISUM(N_BG)
RESID_W(1)=P_DSUM(RESID(1))
RESID_W(2)=P_DSUM(RESID(2))
RESID_W(3)=P_DSUM(RESID(3))
RESID_W(4)=P_DSUM(RESID(4))

IF(IPID.EQ.0)THEN
C DEFINE THE COORDINATES OF THE QUARTERS
X_DEC(1)=X_BG_1
Y_DEC(1)=Y_BG_1
X_DEC(2)=X_BD_2
Y_DEC(2)=Y_BD_1
X_DEC(3)=X_HD_2
Y_DEC(3)=Y_HD_2
X_DEC(4)=X_HG_1
Y_DEC(4)=Y_HG_2
X_DEC(5)=X_BG_1
Y_DEC(5)=Y_BG_1
X_DEC(6)=X_BG_2
Y_DEC(6)=Y_BG_1
X_DEC(7)=X_HG_2
Y_DEC(7)=Y_HG_2
X_DEC(8)=X_HG_1
Y_DEC(8)=Y_HG_2
X_DEC(9)=X_HG_1
Y_DEC(9)=Y_HG_1
X_DEC(10)=X_HD_2
Y_DEC(10)=Y_HD_1

Accessibilit : Libre Page 81 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

C CALCULATE THE SUMS


SUM_N=N_HD_W+N_BD_W+N_HG_W+N_BG_W
SUM_RSD=RESID_W(1)+RESID_W(2)+RESID_W(3)+RESID_W(4)
C CALCULATE THE NON-DIMENSIONNAL PROPORTION AND TIME OF RESIDENCE
IF(SUM_N.NE.0)THEN
N_BG_N=REAL(N_BG_W)/REAL(SUM_N)
N_HG_N=REAL(N_HG_W)/REAL(SUM_N)
N_HD_N=REAL(N_HD_W)/REAL(SUM_N)
N_BD_N=REAL(N_BD_W)/REAL(SUM_N)
ELSE
N_BG_N=0.D0
N_HG_N=0.D0
N_HD_N=0.D0
N_BD_N=0.D0
END IF

IF(SUM_RSD.NE.0)THEN
IF(N_BG_N.GT.0.D0)THEN
RSD_BG_N=RESID_W(4)/SUM_RSD/N_BG_N
ELSE
RSD_BG_N=0.D0
ENDIF
IF(N_HG_N.GT.0.D0)THEN
RSD_HG_N=RESID_W(3)/SUM_RSD/N_HG_N
ELSE
RSD_HG_N=0.D0
ENDIF
IF(N_HD_N.GT.0.D0)THEN
RSD_HD_N=RESID_W(1)/SUM_RSD/N_HD_N
ELSE
RSD_HD_N=0.D0
ENDIF
IF(N_BD_N.GT.0.D0)THEN
RSD_BD_N=RESID_W(2)/SUM_RSD/N_BD_N
ELSE
RSD_BD_N=0.D0
ENDIF
ELSE
RSD_BG_N=0.D0
RSD_HG_N=0.D0
RSD_HD_N=0.D0
RSD_BD_N=0.D0
END IF
END IF
C IN SEQUENTIAL
ELSE
C DEFINE THE COORDINATES OF THE QUARTERS
X_DEC(1)=X_BG_1
Y_DEC(1)=Y_BG_1
X_DEC(2)=X_BD_2
Y_DEC(2)=Y_BD_1
X_DEC(3)=X_HD_2
Y_DEC(3)=Y_HD_2
X_DEC(4)=X_HG_1
Y_DEC(4)=Y_HG_2
X_DEC(5)=X_BG_1
Y_DEC(5)=Y_BG_1

Accessibilit : Libre Page 82 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

X_DEC(6)=X_BG_2
Y_DEC(6)=Y_BG_1
X_DEC(7)=X_HG_2
Y_DEC(7)=Y_HG_2
X_DEC(8)=X_HG_1
Y_DEC(8)=Y_HG_2
X_DEC(9)=X_HG_1
Y_DEC(9)=Y_HG_1
X_DEC(10)=X_HD_2
Y_DEC(10)=Y_HD_1
C CALCULATE THE SUMS
SUM_N=N_HD+N_BD+N_HG+N_BG
SUM_RSD=RESID(1)+RESID(2)+RESID(3)+RESID(4)
C CALCULATE THE NON-DIMENSIONNAL PROPORTION AND TIME OF RESIDENCE
IF(SUM_N.NE.0)THEN
N_BG_N=REAL(N_BG)/REAL(SUM_N)
N_HG_N=REAL(N_HG)/REAL(SUM_N)
N_HD_N=REAL(N_HD)/REAL(SUM_N)
N_BD_N=REAL(N_BD)/REAL(SUM_N)
ELSE
N_BG_N=0.D0
N_HG_N=0.D0
N_HD_N=0.D0
N_BD_N=0.D0
END IF

IF(SUM_RSD.NE.0)THEN
IF(N_BG_N.GT.0.D0)THEN
RSD_BG_N=RESID(4)/SUM_RSD/N_BG_N
ELSE
RSD_BG_N=0.D0
ENDIF
IF(N_HG_N.GT.0.D0)THEN
RSD_HG_N=RESID(3)/SUM_RSD/N_HG_N
ELSE
RSD_HG_N=0.D0
ENDIF
IF(N_HD_N.GT.0.D0)THEN
RSD_HD_N=RESID(1)/SUM_RSD/N_HD_N
ELSE
RSD_HD_N=0.D0
ENDIF
IF(N_BD_N.GT.0.D0)THEN
RSD_BD_N=RESID(2)/SUM_RSD/N_BD_N
ELSE
RSD_BD_N=0.D0
ENDIF
ELSE
RSD_BG_N=0.D0
RSD_HG_N=0.D0
RSD_HD_N=0.D0
RSD_BD_N=0.D0
END IF
END IF
C-----------------------------------------------------------------------
! WRITE RESULTS
C-----------------------------------------------------------------------

Accessibilit : Libre Page 83 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

IF(IPID.EQ.0)THEN
C DEFINE THE SCALLING FACTORS
MAX_N=0.5D0
MAX_RSD=2.5D0
C
9401 FORMAT(A,1X,A,1X,A,I1,1X,A,I1,1X,A,I1,1X,A,I1,1X,A,1X,A)
OPEN(9994,FILE=F_MES_ALG)
WRITE(9994,(A))# canal_chatou.f
WRITE(9994,(A,F3.1))# Max N_part = ,MAX_N
WRITE(9994,(A,F3.1))# Max t_resid = ,MAX_RSD
WRITE(9994,(A))# In calc :
WRITE(9994,(A,F5.3))# Max N_part = ,
* MAX(N_BG_N,N_HG_N,N_HD_N,N_BD_N)
WRITE(9994,(A,F5.3))# Max t_resid = ,
* MAX(RSD_BG_N,RSD_HG_N,RSD_HD_N,RSD_BD_N)
C
WRITE(9994,9401) x_decoup,y_decoup,x_np_,NCSIZE,
& y_np_,NCSIZE,x_rsd_,NCSIZE,y_rsd_,NCSIZE,
& x_rel,y_rel
WRITE(9994,(8F12.5)) X_DEC(1),Y_DEC(1),
& X_BG_2-N_BG_N/MAX_N*(X_BG_2-X_BG_1),
& Y_BG_2-N_BG_N/MAX_N*(Y_BG_2-Y_BG_1),
& X_BG_2-RSD_BG_N/MAX_RSD*(X_BG_2-X_BG_1),
& Y_BG_2-RSD_BG_N/MAX_RSD*(Y_BG_2-Y_BG_1),
& X_INI,Y_INI
WRITE(9994,(6F12.5)) X_DEC(2),Y_DEC(2),
& X_HG_2-N_HG_N/MAX_N*(X_HG_2-X_HG_1),
& Y_HG_1+N_HG_N/MAX_N*(Y_HG_2-Y_HG_1),
& X_HG_2-RSD_HG_N/MAX_RSD*(X_HG_2-X_HG_1),
& Y_HG_1+RSD_HG_N/MAX_RSD*(Y_HG_2-Y_HG_1)
WRITE(9994,(6F12.5)) X_DEC(3),Y_DEC(3),
& X_HD_1+N_HD_N/MAX_N*(X_HD_2-X_HD_1),
& Y_HD_1+N_HD_N/MAX_N*(Y_HD_2-Y_HD_1),
& X_HD_1+RSD_HD_N/MAX_RSD*(X_HD_2-X_HD_1),
& Y_HD_1+RSD_HD_N/MAX_RSD*(Y_HD_2-Y_HD_1)
WRITE(9994,(6F12.5)) X_DEC(4),Y_DEC(4),
& X_BD_1+N_BD_N/MAX_N*(X_BD_2-X_BD_1),
& Y_BD_2-N_BD_N/MAX_N*(Y_BD_2-Y_BD_1),
& X_BD_1+RSD_BD_N/MAX_RSD*(X_BD_2-X_BD_1),
& Y_BD_2-RSD_BD_N/MAX_RSD*(Y_BD_2-Y_BD_1)
WRITE(9994,(6F12.5)) X_DEC(5),Y_DEC(5),
& X_BG_2-N_BG_N/MAX_N*(X_BG_2-X_BG_1),
& Y_BG_2-N_BG_N/MAX_N*(Y_BG_2-Y_BG_1),
& X_BG_2-RSD_BG_N/MAX_RSD*(X_BG_2-X_BG_1),
& Y_BG_2-RSD_BG_N/MAX_RSD*(Y_BG_2-Y_BG_1)
WRITE(9994,(2F12.5)) X_DEC(6),Y_DEC(6)
WRITE(9994,(2F12.5)) X_DEC(7),Y_DEC(7)
WRITE(9994,(2F12.5)) X_DEC(8),Y_DEC(8)
WRITE(9994,(2F12.5)) X_DEC(9),Y_DEC(9)
WRITE(9994,(2F12.5)) X_DEC(10),Y_DEC(10)
CLOSE(9994)
END IF
C
RETURN
END SUBROUTINE MESURES_ALG

Accessibilit : Libre Page 84 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

C ***************************
SUBROUTINE MESURES_PROF_VIT
C ***************************
C
&(NCSIZE,IPID,NP_TOT,N_A,X_A,Y_A,DX,DY,V_X,V_Y,V_X_0,V_Y_0,U_X,
& U_Y,U_X_0,U_Y_0)
C
C***********************************************************************
C ANTOINE JOLY
C
C***********************************************************************
C
C SUBROUTINE USED TO RECORD THE PARTICLE VELOCITY PROFILES
C
C-----------------------------------------------------------------------
C ARGUMENTS
C .________________.____.______________________________________________.
C | NOM |MODE| ROLE |
C |________________|____|______________________________________________|
C |________________|____|______________________________________________|
C MODE : -->(DONNEE NON MODIFIEE), <--(RESULTAT), <-->(DONNEE MODIFIEE)
C
C-----------------------------------------------------------------------
C
C APPELE PAR : TELMAC
C
C SOUS-PROGRAMME APPELE : NEANT
C
C***********************************************************************
C
USE MESURES_POSITIONS
C

IMPLICIT NONE
C INPUT VARIABLES
INTEGER ,INTENT(IN) ::NCSIZE,IPID
C INPUT VARIABLES FOR THE BODIES
INTEGER ,INTENT(IN) ::NP_TOT
INTEGER ,INTENT(IN) ::N_A
DOUBLE PRECISION,INTENT(IN) ::X_A(NP_TOT)
DOUBLE PRECISION,INTENT(IN) ::Y_A(NP_TOT)
DOUBLE PRECISION,INTENT(IN) ::DX(NP_TOT)
DOUBLE PRECISION,INTENT(IN) ::DY(NP_TOT)
DOUBLE PRECISION ::X_A_0
DOUBLE PRECISION ::Y_A_0
DOUBLE PRECISION,INTENT(IN) ::V_X(NP_TOT)
DOUBLE PRECISION,INTENT(IN) ::V_Y(NP_TOT)
DOUBLE PRECISION,INTENT(IN) ::V_X_0(NP_TOT)
DOUBLE PRECISION,INTENT(IN) ::V_Y_0(NP_TOT)
DOUBLE PRECISION,INTENT(IN) ::U_X(NP_TOT)
DOUBLE PRECISION,INTENT(IN) ::U_Y(NP_TOT)
DOUBLE PRECISION,INTENT(IN) ::U_X_0(NP_TOT)
DOUBLE PRECISION,INTENT(IN) ::U_Y_0(NP_TOT)
C VARIABLES USED IN LOOPS
INTEGER :: I_A
INTEGER :: I_Y
C VARIABLES USED TO RECORD THE PROFILES

Accessibilit : Libre Page 85 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

DOUBLE PRECISION ::X_MULT


INTEGER:: SUM_N
C VARIABLES USED IN PARALLEL
INTEGER P_ISUM
DOUBLE PRECISION P_DSUM
EXTERNAL P_ISUM,P_DSUM
C-----------------------------------------------------------------------
C DEFINE THE VARIABLES FOR THE VELOCITY PROFILES
C-----------------------------------------------------------------------
IF(INIT_PROF)THEN
INIT_PROF=.FALSE.
C
IF(VIT.EQ.1)THEN
X_PROF=0.55D0
END IF
C
DY_PROF=2.D0/REAL(NY)
C
DO I_Y=1,NY
Y_PROF(I_Y)=REAL(I_Y)*DY_PROF-DY_PROF/2.D0
C
N_PROF(I_Y)=0
UX_PROF(I_Y)=0.D0
UY_PROF(I_Y)=0.D0
VX_PROF(I_Y)=0.D0
VY_PROF(I_Y)=0.D0
END DO
END IF
C-----------------------------------------------------------------------
C CALCULATE THE VELOCITY PROFILES
C-----------------------------------------------------------------------

DO I_A=1,N_A
X_A_0=X_A(I_A)-DX(I_A)
Y_A_0=Y_A(I_A)-DY(I_A)
IF((X_A_0.LT.X_PROF.AND.X_A(I_A).GE.X_PROF).OR.
& (X_A_0.GE.X_PROF.AND.X_A(I_A).LT.X_PROF))THEN
IF(X_A(I_A).EQ.X_A_0)THEN
X_MULT=0.D0
ELSE
X_MULT=(X_PROF-X_A_0)/(X_A(I_A)-X_A_0)
END IF
C
DO I_Y=1,NY
IF(Y_PROF(I_Y)-DY_PROF/2.D0.LT.
& Y_A_0+X_MULT*(Y_A(I_A)-Y_A_0).AND.
& Y_PROF(I_Y)+DY_PROF/2.D0.GE.
& Y_A_0+X_MULT*(Y_A(I_A)-Y_A_0))THEN

N_PROF(I_Y)=N_PROF(I_Y)+1
C
IF(U_X_0(I_A).GE.1000000.D0)THEN
! THE PARTICLE WAS IN ANOTHER PROCESSOR AT TIME LT_0 (OBSOLESCENT)
UX_PROF(I_Y)=UX_PROF(I_Y)+U_X(I_A)
UY_PROF(I_Y)=UY_PROF(I_Y)+U_Y(I_A)
VX_PROF(I_Y)=VX_PROF(I_Y)+V_X(I_A)
VY_PROF(I_Y)=VY_PROF(I_Y)+V_Y(I_A)

Accessibilit : Libre Page 86 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

ELSE
UX_PROF(I_Y)=UX_PROF(I_Y)+U_X_0(I_A)+X_MULT*(U_X(I_A)
& -U_X_0(I_A))
UY_PROF(I_Y)=UY_PROF(I_Y)+U_Y_0(I_A)+X_MULT*(U_Y(I_A)
& -U_Y_0(I_A))
VX_PROF(I_Y)=VX_PROF(I_Y)+V_X_0(I_A)+X_MULT*(V_X(I_A)
& -V_X_0(I_A))
VY_PROF(I_Y)=VY_PROF(I_Y)+V_Y_0(I_A)+X_MULT*(V_Y(I_A)
& -V_Y_0(I_A))
END IF

END IF
END DO
END IF
END DO

C-----------------------------------------------------------------------
C SEND THESE INFORMATION TO PROCESSOR 0
C-----------------------------------------------------------------------
IF(NCSIZE.GT.1) THEN
SUM_N=0
DO I_Y=1,NY
N_WRI(I_Y)=P_ISUM(N_PROF(I_Y))
UX_WRI(I_Y)=P_DSUM(UX_PROF(I_Y))
UY_WRI(I_Y)=P_DSUM(UY_PROF(I_Y))
VX_WRI(I_Y)=P_DSUM(VX_PROF(I_Y))
VY_WRI(I_Y)=P_DSUM(VY_PROF(I_Y))
!
SUM_N=SUM_N+N_WRI(I_Y)
END DO
ELSE
SUM_N=0
DO I_Y=1,NY
N_WRI(I_Y)=N_PROF(I_Y)
UX_WRI(I_Y)=UX_PROF(I_Y)
UY_WRI(I_Y)=UY_PROF(I_Y)
VX_WRI(I_Y)=VX_PROF(I_Y)
VY_WRI(I_Y)=VY_PROF(I_Y)
!
SUM_N=SUM_N+N_WRI(I_Y)
END DO
END IF
C IGNORE VALUES THAT ARE TO LOW (NUMERICAL NOISE)
DO I_Y=1,NY
IF(SUM_N.NE.0)THEN
IF(N_WRI(I_Y)/REAL(SUM_N).LE.0.001)THEN
N_WRI(I_Y)=0
UX_WRI(I_Y)=0.D0
UY_WRI(I_Y)=0.D0
VX_WRI(I_Y)=0.D0
VY_WRI(I_Y)=0.D0
END IF
END IF
END DO
C
C-----------------------------------------------------------------------
C WRITE THE RESULTS

Accessibilit : Libre Page 87 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

C-----------------------------------------------------------------------
C
IF(IPID.EQ.0)THEN
WRITE(F_PROF_VIT,(A,I1,A))
& ../../RESULTATS/prof_vit_,VIT,.txt
9401 FORMAT(A)
9402 FORMAT(6F16.8)
C
OPEN(9994,FILE=F_PROF_VIT)
WRITE(9994,9401) #canal_chatou.f
WRITE(9994,(A,F5.3)) #Velocity profil at x =,X_PROF
WRITE(9994,(A,I6)) #Sum_N = ,SUM_N
WRITE(9994,9401) Y N U_X U_Y V_X V_Y
DO I_Y=1,NY
IF(N_WRI(I_Y).NE.0)THEN
WRITE(9994,9402) Y_PROF(I_Y),REAL(N_WRI(I_Y))/REAL(SUM_N),
& UX_WRI(I_Y)/REAL(N_WRI(I_Y)),UY_WRI(I_Y)/REAL(N_WRI(I_Y)),
& VX_WRI(I_Y)/REAL(N_WRI(I_Y)),VY_WRI(I_Y)/REAL(N_WRI(I_Y))
&
ELSE
WRITE(9994,9402) Y_PROF(I_Y),0.D0,0.D0,0.D0,0.D0,0.D0
END IF
END DO
C
CLOSE(9994)
C
END IF
C
RETURN
END
C

C ************************
SUBROUTINE ENR_FLU
C *************************
C
*(IKLE,N_NODE)
C
C***********************************************************************
C ANTOINE JOLY
C
C***********************************************************************
C
C SUBROUTINE USED TO RECORD FLUID VELOCITY PROFILES
C
C-----------------------------------------------------------------------
C ARGUMENTS
C .________________.____.______________________________________________.
C | NOM |MODE| ROLE |
C |________________|____|______________________________________________|
C |________________|____|______________________________________________|
C MODE : -->(DONNEE NON MODIFIEE), <--(RESULTAT), <-->(DONNEE MODIFIEE)
C
C-----------------------------------------------------------------------
C
C APPELE PAR : TELMAC
C

Accessibilit : Libre Page 88 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

C SOUS-PROGRAMME APPELE : NEANT


C
C***********************************************************************
C
USE BIEF
USE DECLARATIONS_TELEMAC
USE DECLARATIONS_TELEMAC2D,ONLY:X,Y,LT,NELEM,MESH,UCONV,VCONV,AK,
* EP,H
USE PNTS_MESURE
C
IMPLICIT NONE
C IMPORT MESH VARIABLES
INTEGER ,INTENT(IN) :: N_NODE
INTEGER ,INTENT(IN) :: IKLE(NELEM,N_NODE)
C VARIABLES USED TO FIND ELEMENT VALUES OF THE MESUREMENT POINT
INTEGER :: IELEM,N1,N2,N3
DOUBLE PRECISION :: DET1,DET2,DET3
DOUBLE PRECISION :: A,B
C VARIABLES USED TO INTERPOLATE FLUID VARIABLES
DOUBLE PRECISION :: LAMBDA1,LAMBDA2,LAMBDA3
DOUBLE PRECISION,DIMENSION(:),POINTER:: U
DOUBLE PRECISION,DIMENSION(:),POINTER:: V
DOUBLE PRECISION,DIMENSION(:),POINTER:: K
DOUBLE PRECISION,DIMENSION(:),POINTER:: EPS
DOUBLE PRECISION,DIMENSION(:),POINTER:: H2
C VARIABLES USED IN LOOPS
INTEGER :: IX,IY,IPROC
C TEMPORARY VARIABLES
CHARACTER(LEN=30) :: TEMP
INTEGER :: IOS
INTEGER :: I_TEMP
U=>UCONV%R
V=>VCONV%R
K=>AK%R
EPS=>EP%R
H2=>H%R
C***********************************************************************
C
C-----------------------------------------------------------------------
C DEFINE THE MESUREMENT POINTS
C-----------------------------------------------------------------------
IF(LT.EQ.0)THEN
DO IX=1,NX_PR
DO IY=1,NY_PR
IF(IX.EQ.1)X_PROF(IX,IY)=-2.D0
IF(IX.EQ.2)X_PROF(IX,IY)=0.D0
IF(IX.EQ.3)X_PROF(IX,IY)=1.D0
IF(IX.EQ.4)X_PROF(IX,IY)=2.D0
IF(IX.EQ.5)X_PROF(IX,IY)=3.D0
IF(IX.EQ.6)X_PROF(IX,IY)=4.D0
IF(IX.EQ.7)X_PROF(IX,IY)=5.D0
C
Y_PROF(IX,IY)=REAL(IY-1)*2.D0/REAL(NY_PR-1)
IF(IY.EQ.1)Y_PROF(IX,IY)=0.01D0
IF(IY.EQ.NY_PR)Y_PROF(IX,IY)=1.99D0

PROC_PROF(IX,IY)=-1

Accessibilit : Libre Page 89 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

ELEM_PROF(IX,IY)=-1
C
DO IELEM=1,NELEM
N1=IKLE(IELEM,1)
N2=IKLE(IELEM,2)
N3=IKLE(IELEM,3)
A=(X(N3)-X(N2))*(Y_PROF(IX,IY)-Y(N2))
B=(Y(N3)-Y(N2))*(X_PROF(IX,IY)-X(N2))
DET1=A-B
A=(X(N1)-X(N3))*(Y_PROF(IX,IY)-Y(N3))
B=(Y(N1)-Y(N3))*(X_PROF(IX,IY)-X(N3))
DET2=A-B
A=(X(N2)-X(N1))*(Y_PROF(IX,IY)-Y(N1))
B=(Y(N2)-Y(N1))*(X_PROF(IX,IY)-X(N1))
DET3=A-B
IF(DET1.GE.0.D0.AND.DET2.GE.0.D0.AND.DET3.GE.0.D0)THEN
PROC_PROF(IX,IY)=IPID
ELEM_PROF(IX,IY)=IELEM
DET_PROF(1,IX,IY)=DET1
DET_PROF(2,IX,IY)=DET2
DET_PROF(3,IX,IY)=DET3
END IF
END DO
END DO
END DO
END IF
C-----------------------------------------------------------------------
C INTERPOLATE FLUID VARIABLES AT MEASUREMENT POINTS
C-----------------------------------------------------------------------
IF(LT.GT.0)THEN
DO IX=1,NX_PR
DO IY=1,NY_PR
IF(ELEM_PROF(IX,IY).EQ.-1)THEN
PROC_PROF(IX,IY)=0
U_MES(IX,IY)=0.D0
V_MES(IX,IY)=0.D0
K_MES(IX,IY)=0.D0
EPS_MES(IX,IY)=0.D0
H_MES(IX,IY)=0.D0
ELSE
N1=IKLE(ELEM_PROF(IX,IY),1)
N2=IKLE(ELEM_PROF(IX,IY),2)
N3=IKLE(ELEM_PROF(IX,IY),3)
LAMBDA1=DET_PROF(1,IX,IY)*MESH%SURDET%R(ELEM_PROF(IX,IY))
LAMBDA2=DET_PROF(2,IX,IY)*MESH%SURDET%R(ELEM_PROF(IX,IY))
LAMBDA3=DET_PROF(3,IX,IY)*MESH%SURDET%R(ELEM_PROF(IX,IY))
U_MES(IX,IY)=U(N1)*LAMBDA1+U(N2)*LAMBDA2+U(N3)*LAMBDA3
V_MES(IX,IY)=V(N1)*LAMBDA1+V(N2)*LAMBDA2+V(N3)*LAMBDA3
K_MES(IX,IY)=K(N1)*LAMBDA1+K(N2)*LAMBDA2+K(N3)*LAMBDA3
EPS_MES(IX,IY)=EPS(N1)*LAMBDA1+EPS(N2)*LAMBDA2
* +EPS(N3)*LAMBDA3
H_MES(IX,IY)=H2(N1)*LAMBDA1+H2(N2)*LAMBDA2+H2(N3)*LAMBDA3
END IF
END DO
END DO
C-----------------------------------------------------------------------
C COMMUNICATE WITH OTHER PROCESSORS IN PARRALLEL

Accessibilit : Libre Page 90 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

C-----------------------------------------------------------------------
! WRITE THE VALUES IN TEMPORARY FILES
IF(NCSIZE.GT.1) THEN
IF(IPID.NE.0)THEN
WRITE(TEMP,(A,I3.3,A))./prof_cour_temp_p,IPID,.txt
OPEN(1,FILE=TEMP,FORM=UNFORMATTED)
WRITE(1)0
DO IX=1,NX_PR
DO IY=1,NY_PR
IF(PROC_PROF(IX,IY).EQ.IPID)THEN
WRITE(1)IX,IY
WRITE(1)U_MES(IX,IY),V_MES(IX,IY),K_MES(IX,IY),
* EPS_MES(IX,IY),H_MES(IX,IY)
END IF
END DO
END DO
CLOSE(1)
END IF
! SYNCHRONISE THE PROCESSORS
CALL P_SYNC()
! READ THE VALUES IN TEMPORARY FILES
IF(IPID.EQ.0)THEN
DO IPROC=1,NCSIZE-1
WRITE(TEMP,(A,I3.3,A))./prof_cour_temp_p,IPROC,.txt
OPEN(2,FILE=TEMP,FORM=UNFORMATTED)
READ(2)I_TEMP
IOS=0
DO WHILE(IOS.EQ.0)
READ(2,IOSTAT=IOS)IX,IY
IF(IOS.NE.0)EXIT
READ(2)U_MES(IX,IY),V_MES(IX,IY),K_MES(IX,IY),
* EPS_MES(IX,IY),H_MES(IX,IY)
END DO
CLOSE(2)
END DO
END IF
END IF
END IF
C-----------------------------------------------------------------------
C WRITE THE RESULT FILE
C-----------------------------------------------------------------------
IF(LT.GT.0.AND.IPID.EQ.0)THEN
OPEN(3,FILE=../../RESULTATS/profils_cour_tel_v6p3.txt)
C WRITE THE HEADER
WRITE(3,*) # canal_chatou.f
WRITE(3,*) # k=10*k
WRITE(3,*) # eps=25*eps
21 FORMAT(A,I1,A,1X)
DO IX=1,NX_PR
WRITE(3,21,ADVANCE=NO) u_plus_x_,IX,_tel
WRITE(3,21,ADVANCE=NO) k_plus_x_,IX,_tel
WRITE(3,21,ADVANCE=NO) eps_plus_x_,IX,_tel
WRITE(3,21,ADVANCE=NO) y_,IX,_tel
END DO
WRITE(3,(1X))
C WRITE THE RESULTS
22 FORMAT(F12.6)

Accessibilit : Libre Page 91 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

DO IY=1,NY_PR
DO IX=1,NX_PR
WRITE(3,22,ADVANCE=NO)X_PROF(IX,IY)+U_MES(IX,IY)
WRITE(3,22,ADVANCE=NO)X_PROF(IX,IY)+K_MES(IX,IY)*10.D0
WRITE(3,22,ADVANCE=NO)X_PROF(IX,IY)+EPS_MES(IX,IY)*25.D0
WRITE(3,22,ADVANCE=NO)Y_PROF(IX,IY)
END DO
WRITE(3,(1X))
END DO
END IF
CLOSE(3)
C
RETURN
END SUBROUTINE ENR_FLU

B Example of a Fortran file recording algae exiting a domain

C======================================================================
C ANT1 17/07/2013
C======================================================================
C ALGAE TRANSPORT KEEPING TRACK OF PARTICLES EXITING THE DOMAIN
C MODIFICATIONS:
C - SUBROUTINE FLOT USED TO RELEASE PARTICLES, WITH AN EXTRA
C USE DECLARATION TO GET VARIABLE DT
C - SUBROUTINE UTIMP_TELEMAC2D USED CALL SUBROUTINE RECORDING
C PARTICLE EXITING THE DOMAIN
C - SUBROUTINE ALG_EXIT RECORDS PARTICLES EXITING THE DOMAIN
C - SUBROUTINE DERIVE MODIFIED TO KEEP TRACK OF THE PARTICLES
C EXITING THE DOMAIN
C
C======================================================================
C
! ***************
SUBROUTINE FLOT
! ***************
!
&(XFLOT,YFLOT,NFLOT,NFLOT_MAX,X,Y,IKLE,NELEM,NELMAX,NPOIN,
& TAGFLO,SHPFLO,ELTFLO,MESH,LT,NIT,AT)
!
!***********************************************************************
! TELEMAC2D V6P3 21/08/2010
!***********************************************************************
!
!brief THE USER MUST GIVE :
!+
!+
!+ 1) THE TIMESTEP WHEN THE FLOATING BODY IS RELEASED.
!+
!+
!+ 2) THE TIME WHEN THE COMPUTATION IS STOPPED FOR THIS FLOATING BODY.
!+
!+
!+ 3) THE INITIAL POSITION OF THE FLOATING BODY AT THE TIME OF RELEASE.
!
!history J-M JANIN (LNH)
!+ 17/08/1994

Accessibilit : Libre Page 92 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

!+ V5P2
!+
!
!history N.DURAND (HRW), S.E.BOURBAN (HRW)
!+ 13/07/2010
!+ V6P0
!+ Translation of French comments within the FORTRAN sources into
!+ English comments
!
!history N.DURAND (HRW), S.E.BOURBAN (HRW)
!+ 21/08/2010
!+ V6P0
!+ Creation of DOXYGEN tags for automated documentation and
!+ cross-referencing of the FORTRAN sources
!
!history J-M HERVOUET (EDF R&D, LNHE)
!+ 22/02/2013
!+ V6P3
!+ New version called at every time step, compatible with //.
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!| AT |-->| TIME
!| ELTFLO |<->| NUMBERS OF ELEMENTS WHERE ARE THE FLOATS
!| LT |-->| CURRENT TIME STEP
!| MESH |<->| MESH STRUCTURE
!| NFLOT |-->| NUMBER OF FLOATS
!| NFLOT_MAX |-->| MAXIMUM NUMBER OF FLOATS
!| NIT |-->| NUMBER OF TIME STEPS
!| NPOIN |-->| NUMBER OF POINTS IN THE MESH
!| SHPFLO |<->| BARYCENTRIC COORDINATES OF FLOATS IN THEIR
!| | | ELEMENTS.
!| X,Y |-->| COORDINATES OF POINTS IN THE MESH
!| XFLOT,YFLOT |<--| POSITIONS OF FLOATING BODIES
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
USE BIEF
USE STREAMLINE, ONLY : ADD_PARTICLE,DEL_PARTICLE
USE ALGAE_TRANSP
USE DECLARATIONS_TELEMAC2D, ONLY : DT
!
IMPLICIT NONE
INTEGER LNG,LU
COMMON/INFO/LNG,LU
!
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
!
INTEGER, INTENT(IN) :: NPOIN,NIT,NFLOT_MAX,LT
INTEGER, INTENT(IN) :: NELEM,NELMAX
INTEGER, INTENT(IN) :: IKLE(NELMAX,3)
INTEGER, INTENT(INOUT) :: NFLOT
INTEGER, INTENT(INOUT) :: TAGFLO(NFLOT_MAX)
INTEGER, INTENT(INOUT) :: ELTFLO(NFLOT_MAX)
DOUBLE PRECISION, INTENT(IN) :: X(NPOIN),Y(NPOIN),AT
DOUBLE PRECISION, INTENT(INOUT) :: XFLOT(NFLOT_MAX)
DOUBLE PRECISION, INTENT(INOUT) :: YFLOT(NFLOT_MAX)
DOUBLE PRECISION, INTENT(INOUT) :: SHPFLO(3,NFLOT_MAX)
TYPE(BIEF_MESH) , INTENT(INOUT) :: MESH

Accessibilit : Libre Page 93 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

!
INTEGER :: I
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
!
! EXAMPLE : AT ITERATION 1 AND EVERY 10 ITERATIONS AFTER 600
! A PARTICLE IS RELEASED WITH COORDINATES
! X=-220.
! Y=400.D0+LT/3.D0
! AND TAG NUMBER LT
!
! IF(LT.LE.600.AND.(10*(LT/10).EQ.LT.OR.LT.EQ.1)) THEN
! CALL ADD_PARTICLE(-220.D0,400.D0+LT/3.D0,0.D0,LT,NFLOT,
! & NFLOT_MAX,XFLOT,YFLOT,YFLOT,TAGFLO,
! & SHPFLO,SHPFLO,ELTFLO,ELTFLO,MESH,1,
! & 0.D0,0.D0,0.D0,0.D0,0,0)
! ENDIF
!
! EXAMPLE : PARTICLE WITH TAG 20 REMOVED AT ITERATION 600
!
! IF(LT.EQ.600) THEN
! CALL DEL_PARTICLE(20,NFLOT,NFLOT_MAX,
! & XFLOT,YFLOT,YFLOT,TAGFLO,SHPFLO,SHPFLO,
! & ELTFLO,ELTFLO,MESH%TYPELM)
! ENDIF
!
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
!
! EXAMPLE : FOR ALGAE PARTICLE TRANSPORT
! => ALGAE_START NEEDS TO BE DEFINED
!
! ALGAE_START=2
!
! IF(LT.EQ.MAX(1,ALGAE_START)) THEN
! DO I=1,NFLOT_MAX
! CALL ADD_PARTICLE(0.175D0,0.45D0,0.D0,I,NFLOT,
! & NFLOT_MAX,XFLOT,YFLOT,YFLOT,TAGFLO,
! & SHPFLO,SHPFLO,ELTFLO,ELTFLO,MESH,1,
! & 0.D0,0.D0,0.D0,0.D0,0,0)
! END DO
! ENDIF
!
!-----------------------------------------------------------------------
ALGAE_START=INT(45000.0/DT)
!
IF(LT.EQ.MAX(1,ALGAE_START)) THEN
! DEFINE INITAL POSITION
IF(ALLOCATED(X_INIT))DEALLOCATE(X_INIT)
ALLOCATE(X_INIT(NFLOT_MAX))
IF(ALLOCATED(Y_INIT))DEALLOCATE(Y_INIT)
ALLOCATE(Y_INIT(NFLOT_MAX))
!
DO I=1,NFLOT_MAX
X_INIT(I)=476823.D0-(SQRT(REAL(NFLOT_MAX))-1.D0)/2.D0*1.D0+
* MODULO(I,INT(SQRT(REAL(NFLOT_MAX))))*1.D0
Y_INIT(I)=241652.D0-(SQRT(REAL(NFLOT_MAX))-1.D0)/2.D0*1.D0+
* INT(REAL(I)/SQRT(REAL(NFLOT_MAX))+0.5D0)*1.D00+
* INT(REAL(I)/SQRT(REAL(NFLOT_MAX))+0.5D0)*1.D0

Accessibilit : Libre Page 94 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

END DO
!
DO I=1,NFLOT_MAX
CALL ADD_PARTICLE(X_INIT(I),Y_INIT(I),0.D0,I,NFLOT,
& NFLOT_MAX,XFLOT,YFLOT,YFLOT,TAGFLO,
& SHPFLO,SHPFLO,ELTFLO,ELTFLO,MESH,1,
& 0.D0,0.D0,0.D0,0.D0,0,0)
END DO
ENDIF
!-----------------------------------------------------------------------
!
RETURN
END SUBROUTINE FLOT

! **************************
SUBROUTINE UTIMP_TELEMAC2D
! **************************
!
&(LTL,ATL,GRADEBL,GRAPRDL,LISDEBL,LISPRDL)
!
!***********************************************************************
! TELEMAC2D V6P1 21/08/2010
!***********************************************************************
!
!brief WRITES OUT ADDITIONAL OUTPUT REQUIRED BY THE USER.
!
!note THIS SUBROUTINE IS CALLED IN THE SAME PLACES AS THE
!+ MAIN TELEMAC2D OUTPUT SUBROUTINE (NAMED DESIMP),
!+ I.E. CALLED TWICE:
!+
!note (1) ONCE PER RUN, WHEN LTL==0, INDEPENDENTLY OF WHETHER
!+ OUTPUT OF INITIAL CONDITIONS : YES IS SET OR NOT
!note (2) EACH TIME STEP JUST AFTER DESIMP-OUTPUT
!
!warning USER SUBROUTINE; DOES NOTHING BY DEFAULT
!
!history JACEK A. JANKOWSKI PINXIT, BAW KARLSRUHE, JACEK.JANKOWSKI@BAW.DE
!+ **/08/2003
!+ V5P4
!+
!
!history N.DURAND (HRW), S.E.BOURBAN (HRW)
!+ 13/07/2010
!+ V6P0
!+ Translation of French comments within the FORTRAN sources into
!+ English comments
!
!history N.DURAND (HRW), S.E.BOURBAN (HRW)
!+ 21/08/2010
!+ V6P0
!+ Creation of DOXYGEN tags for automated documentation and
!+ cross-referencing of the FORTRAN sources
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!| ATL |-->| TIME OF TIME STEP, IN SECONDS
!| GRADEBL |-->| FIRST TIME STEP FOR GRAPHIC OUTPUTS

Accessibilit : Libre Page 95 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

!| GRAPRDL |-->| PERIOD OF GRAPHIC OUTPUTS


!| LISDEBL |-->| FIRST TIME STEP FOR LISTING OUTPUTS
!| LISPRDL |-->| PERIOD OF LISTING OUTPUTS
!| LTL |-->| CURRENT TIME STEP
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
USE BIEF
USE DECLARATIONS_TELEMAC
USE DECLARATIONS_TELEMAC2D
! DAJ
! OPEN VARIABLES RELATED TO ALGAE TRANSPORT
USE ALGAE_TRANSP
! FAJ
!
IMPLICIT NONE
INTEGER LNG,LU
COMMON/INFO/LNG,LU
!
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
!
DOUBLE PRECISION, INTENT(IN) :: ATL
INTEGER, INTENT(IN) :: LTL,GRADEBL,GRAPRDL,LISDEBL,LISPRDL
!
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
!
!
!***********************************************************************
! USER OUTPUT

! DAJ
IF(LT.GE.ALGAE_START)THEN
! CALCULATE THE NUMBER OF PARTICLES EXITING THE DOMAIN
CALL ALG_EXIT(LT,DT,NFLOT_MAX,NFLOT,ELTFLO%I,NCSIZE,IPID,
* MESH%IKLE%I,NELMAX,3,MESH%KNOLG%I,NPOIN)
END IF
! FAJ

!
!
!
!-----------------------------------------------------------------------
!
RETURN
END SUBROUTINE UTIMP_TELEMAC2D

C
C *********************
SUBROUTINE ALG_EXIT
C *********************
C
*(LT,DT,NFLOT_MAX,NFLOT,ELEM_ALG,NCSIZE,IPID,IKLE,NELMAX,NDP,
* KNOLG,NPOIN)
C
C***********************************************************************
C ANTOINE JOLY

Accessibilit : Libre Page 96 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

C
C***********************************************************************
C
C SUBROUTINE USED TO RECORD PARTICLES EXITING A DOMAIN
C
C-----------------------------------------------------------------------
C ARGUMENTS
C .________________.____.______________________________________________.
C | NOM |MODE| ROLE |
C |________________|____|______________________________________________|
C |________________|____|______________________________________________|
C MODE : -->(DONNEE NON MODIFIEE), <--(RESULTAT), <-->(DONNEE MODIFIEE)
C
C-----------------------------------------------------------------------
C
C APPELE PAR : TELMAC
C
C SOUS-PROGRAMME APPELE : NEANT
C
C***********************************************************************
C
IMPLICIT NONE
C INPUT VARIABLES
INTEGER ,INTENT(IN) :: LT
DOUBLE PRECISION,INTENT(IN) :: DT
INTEGER ,INTENT(IN) :: NFLOT_MAX
INTEGER ,INTENT(IN) :: NFLOT
INTEGER ,INTENT(IN) :: ELEM_ALG(NFLOT_MAX)
INTEGER ,INTENT(IN) :: NCSIZE,IPID
INTEGER , INTENT(IN) :: NELMAX
INTEGER , INTENT(IN) :: NDP
INTEGER , INTENT(IN) :: IKLE(NELMAX,NDP)
INTEGER , INTENT(IN) :: NPOIN
INTEGER , INTENT(IN) :: KNOLG(NPOIN)
C LOOP VARIABLES
INTEGER :: I_P
INTEGER :: IB
C ELEMENTS PER BOUNDARY
INTEGER ,PARAMETER :: NB1=8
INTEGER ,PARAMETER :: NB2=8
INTEGER ,PARAMETER :: NB3=8
INTEGER ,PARAMETER :: NB4=8
INTEGER :: EL_B1(NT1)
INTEGER :: EL_B2(NT2)
INTEGER :: EL_B3(NT3)
INTEGER :: EL_B4(NT4)
C NUMBER OF PARTICLES PER BOUNDARY
INTEGER :: BOUNDARY1
INTEGER :: BOUNDARY2
INTEGER :: BOUNDARY3
INTEGER :: BOUNDARY4
INTEGER :: OTHER
DATA BOUNDARY1 /0/
DATA BOUNDARY2 /0/
DATA BOUNDARY3 /0/
DATA BOUNDARY4 /0/
DATA OTHER /0/

Accessibilit : Libre Page 97 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

SAVE BOUNDARY1,BOUNDARY2,BOUNDARY3,BOUNDARY4,OTHER
INTEGER :: BOUNDARY1_P
INTEGER :: BOUNDARY2_P
INTEGER :: BOUNDARY3_P
INTEGER :: BOUNDARY4_P
INTEGER :: OTHER_P
C VARIABLES TO READ PARTICLES THAT EXITED THE DOMAIN
CHARACTER(LEN=100) TEMP_OUT_FILE
INTEGER :: ITEMP
INTEGER :: IOS
C FUNCTIONS USED IN PARALLEL
INTEGER P_ISUM
EXTERNAL P_ISUM
C
C OPEN RESULT FILE
IF(NCSIZE.GT.0)THEN
IF(IPID.EQ.0)THEN
OPEN(9994,FILE=../../RESULTATS/sortie_alg.txt)
END IF
ELSE
OPEN(9994,FILE=../../RESULTATS/sortie_alg.txt)
END IF
9401 FORMAT(F9.1,5I6)
C
C-----------------------------------------------------------------------
C DEFINE THE ELEMENTS OF THE BOUNDARIES OF INTEREST
C-----------------------------------------------------------------------
C
EL_B1(1)=35
EL_B1(2)=170
EL_B1(3)=632
EL_B1(4)=62
EL_B1(5)=712
EL_B1(6)=432
EL_B1(7)=612
EL_B1(8)=41
C
EL_B2(1)=7
EL_B2(2)=748
EL_B2(3)=272
EL_B2(4)=809
EL_B2(5)=609
EL_B2(6)=211
EL_B2(7)=311
EL_B2(8)=5
C
EL_B3(1)=38
EL_B3(2)=720
EL_B3(3)=132
EL_B3(4)=103
EL_B3(5)=575
EL_B3(6)=764
EL_B3(7)=60
EL_B3(8)=8
C
EL_B4(1)=6
EL_B4(2)=713

Accessibilit : Libre Page 98 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

EL_B4(3)=570
EL_B4(4)=69
EL_B4(5)=673
EL_B4(6)=319
EL_B4(7)=117
EL_B4(8)=18

C-----------------------------------------------------------------------
C CALCULATE THE PARTICLES THAT HAVE EXITED THE DOMAIN
C-----------------------------------------------------------------------
C LIRE TEMPORARY FILE OF EACH PROCESSOR
WRITE(TEMP_OUT_FILE,(A,I1,A))tmp_out_,IPID,.txt
OPEN(9999,FILE=TEMP_OUT_FILE)
READ(9999,*,IOSTAT=IOS)ITEMP
IOS=0
DO WHILE(IOS.EQ.0)
READ(9999,*,IOSTAT=IOS)ITEMP
IF(IOS.NE.0)EXIT
DO IB=1,NB1
IF(KNOLG(IKLE(-ITEMP,1)).EQ.EL_B1(IB))THEN
BOUNDARY1=BOUNDARY1+1
GOTO 20
END IF
IF(KNOLG(IKLE(-ITEMP,2)).EQ.EL_B1(IB))THEN
BOUNDARY1=BOUNDARY1+1
GOTO 20
END IF
IF(KNOLG(IKLE(-ITEMP,3)).EQ.EL_B1(IB))THEN
BOUNDARY1=BOUNDARY1+1
GOTO 20
END IF
END DO
C
DO IB=1,NB2
IF(KNOLG(IKLE(-ITEMP,1)).EQ.EL_B2(IB))THEN
BOUNDARY2=BOUNDARY2+1
GOTO 20
END IF
IF(KNOLG(IKLE(-ITEMP,2)).EQ.EL_B2(IB))THEN
BOUNDARY2=BOUNDARY2+1
GOTO 20
END IF
IF(KNOLG(IKLE(-ITEMP,3)).EQ.EL_B2(IB))THEN
BOUNDARY2=BOUNDARY2+1
GOTO 20
END IF
END DO
C
DO IB=1,NB3
IF(KNOLG(IKLE(-ITEMP,1)).EQ.EL_B3(IB))THEN
BOUNDARY3=BOUNDARY3+1
GOTO 20
END IF
IF(KNOLG(IKLE(-ITEMP,2)).EQ.EL_B3(IB))THEN
BOUNDARY3=BOUNDARY3+1
GOTO 20
END IF

Accessibilit : Libre Page 99 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

IF(KNOLG(IKLE(-ITEMP,3)).EQ.EL_B3(IB))THEN
BOUNDARY3=BOUNDARY3+1
GOTO 20
END IF
END DO
C
DO IB=1,NB4
IF(KNOLG(IKLE(-ITEMP,1)).EQ.EL_B4(IB))THEN
BOUNDARY4=BOUNDARY4+1
GOTO 20
END IF
IF(KNOLG(IKLE(-ITEMP,2)).EQ.EL_B4(IB))THEN
BOUNDARY4=BOUNDARY4+1
GOTO 20
END IF
IF(KNOLG(IKLE(-ITEMP,3)).EQ.EL_B4(IB))THEN
BOUNDARY4=BOUNDARY4+1
GOTO 20
END IF
END DO
C
OTHER=OTHER+1
C
20 CONTINUE
C
END DO
C
CLOSE(9999)
C
C-----------------------------------------------------------------------
C WRITE RESULT FILE
C-----------------------------------------------------------------------
IF(NCSIZE.GT.0)THEN
BOUNDARY1_P=P_ISUM(BOUNDARY1)
BOUNDARY2_P=P_ISUM(BOUNDARY2)
BOUNDARY3_P=P_ISUM(BOUNDARY3)
BOUNDARY4_P=P_ISUM(BOUNDARY4)
OTHER_P=P_ISUM(OTHER)
IF(IPID.EQ.0)THEN
WRITE(9994,9401) REAL(LT)*DT,BOUNDARY1_P,BOUNDARY2_P,
* BOUNDARY3_P,BOUNDARY4_P,OTHER_P
END IF
ELSE
WRITE(9994,9401) REAL(LT)*DT,BOUNDARY1,BOUNDARY2,BOUNDARY3,
* BOUNDARY4,OTHER
END IF
C
RETURN
END
C
C
C
C
! *****************
SUBROUTINE DERIVE
! *****************
!

Accessibilit : Libre Page 100 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

&(U,V,W,DT,AT,X,Y,Z,IKLE,IFABOR,LT,IELM,IELMU,NDP,NPOIN,NPOIN2,
& NELEM,NELMAX,SURDET,XFLOT,YFLOT,ZFLOT,
& SHPFLO,SHZFLO,TAGFLO,ELTFLO,ETAFLO,
& NFLOT,NFLOT_MAX,FLOPRD,MESH,UL,
& ISUB,DX,DY,DZ,ELTBUF,SHPBUF,SHZBUF,SIZEBUF,STOCHA,VISC,
& AALGAE,DALGAE,RALGAE,EALGAE,ALGTYP,AK,EP,H)
!
!***********************************************************************
! BIEF V6P3 21/08/2010
!***********************************************************************
!
!brief - COMPUTES THE BARYCENTRIC COORDINATES OF A FLOAT
!+ IN THE MESH AT THE TIME OF RELEASE.
!+
!+ - COMPUTES THE SUCCESSIVE POSITIONS OF THIS FLOAT
!+ WHICH IS CARRIED WITHOUT FRICTION BY THE CURRENT
!+ (SUBSEQUENT TIMESTEPS).
!
!history J-M JANIN (LNH)
!+ 18/08/94
!+ V5P1
!+ Original version.
!
!history N.DURAND (HRW), S.E.BOURBAN (HRW)
!+ 13/07/2010
!+ V6P0
!+ Translation of French comments within the FORTRAN sources into
!+ English comments
!
!history N.DURAND (HRW), S.E.BOURBAN (HRW)
!+ 21/08/2010
!+ V6P0
!+ Creation of DOXYGEN tags for automated documentation and
!+ cross-referencing of the FORTRAN sources
!
!history J-M HERVOUET (LNHE)
!+ 19/06/2012
!+ V6P2
!+ Adapted for calling SCARACT instead of CHAR11. However parallelism
!+ will require further modifications.
!
!history J-M HERVOUET (LNHE)
!+ 12/03/2013
!+ V6P3
!+ New file format for Tecplot. Works in parallel. Works in 3D.
!
!history J-M HERVOUET (LNHE)
!+ 12/03/2013
!+ V6P3
!+ Arguments STOCHA and VISC added
!
!history A Joly
!+ 20/06/2013
!+ V6P3
!+ New conditions added to treat algae transport
!+ - Only tested in 2D
!+ - Does not work for quadratic elements

Accessibilit : Libre Page 101 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!| DT |-->| TIME STEP (I.E. TIME INTERVAL).
!| DX |<->| WORK ARRAY (DISPLACEMENTS ALONG X)
!| DY |<->| WORK ARRAY (DISPLACEMENTS ALONG Y)
!| DZ |<->| WORK ARRAY (DISPLACEMENTS ALONG Z)
!| ELTBUF |<->| WORK ARRAY
!| ELTFLO |<->| NUMBERS OF ELEMENTS WHERE ARE THE FLOATS
!| ETAFLO |<->| LEVELS WHERE ARE THE FLOATS
!| FLOPRD |-->| NUMBER OF TIME STEPS BETWEEB TWO RECORDS
!| | | FOR FLOATS POSITIONS.
!| IELM |-->| TYPE OF ELEMENT.
!| IELMU |-->| TYPE OF ELEMENT FOR VELOCITIES.
!| IFABOR |-->| ELEMENTS BEHIND THE EDGES OF ANOTHER ELEMENT
!| | | IF IFABOR NEGATIVE OR 0, THE EDGE IS A
!| | | LIQUID OR PERIODIC BOUNDARY
!| IKLE |-->| CONNECTIVITY TABLE.
!| ISUB |<->| ARRIVAL SUB-DOMAIN OF PARTICLES.
!| LT |-->| TIME STEP NUMBER.
!| MESH |<->| MESH STRUCTURE.
!| NDP |-->| NUMBER OF POINTS PER ELEMENT
!| NELEM |-->| NUMBER OF ELEMENTS
!| NELMAX |-->| MAXIMUM NUMBER OF ELEMENTS IN 2D
!| NFLOT |<->| NUMBER OF FLOATS.
!| NFLOT_MAX |<->| MAXIMUM NUMBER OF FLOATS.
!| NPOIN |-->| NUMBER OF POINTS
!| NPOIN2 |-->| NUMBER OF POINTS IN 2D MESH
!| SHPBUF |<->| WORK ARRAY
!| SHPFLO |<->| BARYCENTRIC COORDINATES OF FLOATS IN THEIR
!| | | ELEMENTS.
!| SHZBUF |<->| WORK ARRAY
!| SHZFLO |<->| BARYCENTRIC COORDINATE ON VERTICAL
!| SIZEBUF |-->| DILMENSION OF SOME WORK ARRAYS
!| SURDET |-->| 1/DETERMINANT, USED IN ISOPARAMETRIC
!| | | TRANSFORMATION.
!| TAGFLO |-->| TAGS OF FLOATS
!| U |-->| X-COMPONENT OF VELOCITY
!| UL |-->| LOGICAL UNIT OF OUTPUT FILE
!| V |-->| Y-COMPONENT OF VELOCITY
!| W |-->| Z-COMPONENT OF VELOCITY
!| X |-->| ABSCISSAE OF POINTS IN THE MESH
!| Y |-->| ORDINATES OF POINTS IN THE MESH
!| Z |-->| ELEVATIONS OF POINTS IN THE MESH
!| XFLOT |<->| ABSCISSAE OF FLOATS
!| YFLOT |<->| ORDINATES OF FLOATS
!| ZFLOT |<->| ELEVATIONS OF FLOATS
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
USE BIEF, EX_DERIVE => DERIVE
USE STREAMLINE
USE ALGAE_TRANSP
!
IMPLICIT NONE
INTEGER LNG,LU
COMMON/INFO/LNG,LU
!
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Accessibilit : Libre Page 102 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

!
INTEGER , INTENT(IN) :: NPOIN,LT,IELM,IELMU,NDP,NELEM
INTEGER , INTENT(IN) :: FLOPRD,NELMAX,UL,SIZEBUF,NPOIN2
INTEGER , INTENT(IN) :: NFLOT_MAX,STOCHA
INTEGER , INTENT(INOUT) :: NFLOT
DOUBLE PRECISION, INTENT(IN) :: DT,AT
DOUBLE PRECISION, INTENT(IN) :: U(NPOIN),V(NPOIN),W(NPOIN)
DOUBLE PRECISION, INTENT(IN) :: X(NPOIN),Y(NPOIN),Z(NPOIN)
INTEGER , INTENT(IN) :: IKLE(NELMAX,NDP)
INTEGER , INTENT(IN) :: IFABOR(NELMAX,NDP)
DOUBLE PRECISION, INTENT(IN) :: SURDET(NELEM)
DOUBLE PRECISION, INTENT(INOUT) :: XFLOT(NFLOT_MAX),DX(NFLOT_MAX)
DOUBLE PRECISION, INTENT(INOUT) :: YFLOT(NFLOT_MAX),DY(NFLOT_MAX)
DOUBLE PRECISION, INTENT(INOUT) :: ZFLOT(NFLOT_MAX),DZ(NFLOT_MAX)
INTEGER , INTENT(INOUT) :: TAGFLO(NFLOT_MAX)
INTEGER , INTENT(INOUT) :: ELTFLO(NFLOT_MAX)
INTEGER , INTENT(INOUT) :: ETAFLO(NFLOT_MAX)
INTEGER , INTENT(INOUT) :: ELTBUF(SIZEBUF)
INTEGER , INTENT(INOUT) :: ISUB(NFLOT_MAX)
DOUBLE PRECISION, INTENT(INOUT) :: SHPFLO(NDP,NFLOT_MAX)
DOUBLE PRECISION, INTENT(INOUT) :: SHZFLO(NFLOT_MAX)
DOUBLE PRECISION, INTENT(INOUT) :: SHPBUF(NDP,SIZEBUF)
DOUBLE PRECISION, INTENT(INOUT) :: SHZBUF(SIZEBUF)
TYPE(BIEF_OBJ) , INTENT(IN) :: VISC
TYPE(BIEF_MESH) , INTENT(INOUT) :: MESH
LOGICAL , OPTIONAL, INTENT(IN) :: AALGAE
DOUBLE PRECISION, OPTIONAL, INTENT(IN) :: AK(NPOIN),EP(NPOIN)
DOUBLE PRECISION, OPTIONAL, INTENT(IN) :: H(NPOIN)
DOUBLE PRECISION, OPTIONAL, INTENT(IN) :: DALGAE,RALGAE,EALGAE
INTEGER , OPTIONAL, INTENT(IN) :: ALGTYP
!
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
!
INTEGER IFLOT,FRE(1),FREBUF(1),IPROC,NFLOTG,NPLAN,ELT
INTEGER N1,N2,N3,N4,N5,N6,NOMB,SENS
!
DOUBLE PRECISION ZSTAR(1)
!
CHARACTER(LEN=32) TEXTE(3)
CHARACTER(LEN=72) LIGNE
!
LOGICAL YESITIS
!
TYPE(BIEF_OBJ) :: SVOID
!
INTEGER P_ISUM
EXTERNAL P_ISUM
!
CHARACTER(LEN=11) EXTENS
EXTERNAL EXTENS
!
LOGICAL DEJA
DATA DEJA/.FALSE./
! DAJ
! CREATE A TEMPORARY FILE TO WRITE PARTICLES THAT HAVE EXITED THE DOMAIN
CHARACTER(LEN=100) TEMP_OUT_FILE
! FAJ

Accessibilit : Libre Page 103 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

!
! DEFINE VARIABLES THAT ARE USED IN ALGAE TRANSPORT
! THESE ARE NECESSARY IF NFLOT_MAX IS TOO LARGE
!
LOGICAL INIT_ALG
DATA INIT_ALG/.TRUE./
LOGICAL ALGAE
INTEGER SIZEBUF2
DOUBLE PRECISION,DIMENSION(:) ,ALLOCATABLE::BUFF_1D
DOUBLE PRECISION,DIMENSION(:,:),ALLOCATABLE::BUFF_2D
!
SAVE
!
!-----------------------------------------------------------------------
!
! CHECKING ARGUMENTS FOR ALGAE
!
IF(PRESENT(AALGAE)) THEN
ALGAE=AALGAE
ELSE
ALGAE=.FALSE.
ENDIF
IF(ALGAE) THEN
IF(.NOT.PRESENT(AK).OR.
& .NOT.PRESENT(EP).OR.
& .NOT.PRESENT(H).OR.
& .NOT.PRESENT(DALGAE).OR.
& .NOT.PRESENT(RALGAE).OR.
& .NOT.PRESENT(EALGAE).OR.
& .NOT.PRESENT(ALGTYP)) THEN
WRITE(LU,*) DERIVE: MISSING ARGUMENTS FOR ALGAE
CALL PLANTE(1)
STOP
ENDIF
ENDIF
!
!-----------------------------------------------------------------------
!
! PARAMETERISING THE CALL TO SCARACT
!
! NUMBER OF PLANES
NPLAN=NPOIN/NPOIN2
! NO VARIABLE TO INTERPOLATE AT THE FOOT OF CHARACTERISTICS
NOMB=0
! FORWARD TRACKING
SENS=1
!
IF(IELM.NE.11.AND.IELM.NE.41) THEN
IF(LNG.EQ.1) WRITE(LU,123) IELM
IF(LNG.EQ.2) WRITE(LU,124) IELM
123 FORMAT(1X,DERIVE : TYPE DELEMENT NON PREVU : ,1I6)
124 FORMAT(1X,DERIVE : UNEXPECTED TYPE OF ELEMENT: ,1I6)
CALL PLANTE(1)
STOP
ENDIF
!
!-----------------------------------------------------------------------

Accessibilit : Libre Page 104 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

!
! INITIALISING SVOID AND HEADER OF A TECPLOT FILE
!
IF(.NOT.DEJA) THEN
!
! THOUGH NOMB = 0, THESE COMPONENTS WILL BE USED IN SCARACT
!
SVOID%TYPE=2
SVOID%DIM1=1
ALLOCATE(SVOID%R(1))
!
! HEADER OF TECPLOT FILE
!
IF(IPID.EQ.0) THEN
TEXTE(1)=X
TEXTE(2)=Y
IF(LNG.EQ.1) THEN
TEXTE(3)=COTE Z M
ELSE
TEXTE(3)=ELEVATION Z M
ENDIF
IF(LNG.EQ.1) THEN
WRITE(UL,100) TITLE = FICHIER DES FLOTTEURS
ELSE
WRITE(UL,100) TITLE = DROGUES FILE
ENDIF
IF(IELM.EQ.11) THEN
WRITE(UL,100) VARIABLES = LABELS,//
& TEXTE(1)//,//TEXTE(2)//,COLOUR
ELSEIF(IELM.EQ.41) THEN
WRITE(UL,100) VARIABLES = LABELS,//
& TEXTE(1)//,//TEXTE(2)//,//TEXTE(3)//,COLOUR
ENDIF
ENDIF
DEJA=.TRUE.
100 FORMAT(A)
ENDIF
!
SVOID%ELM=IELM
!
!-----------------------------------------------------------------------
!
! TRAJECTORIES COMPUTED FOR ALL POINTS
!
! ALLOCATE THE ALGAE VARIABLES IF NEEDED
!
IF(ALGAE.AND.INIT_ALG) THEN
INIT_ALG=.FALSE.
! VERIFY THAT THE BUFFER SIZE IS BIG ENOUGH FOR PARTICLE TRANSPORT
IF(NFLOT_MAX.GT.SIZEBUF)THEN
SIZEBUF2=NFLOT_MAX
ALLOCATE(BUFF_1D(SIZEBUF2))
ALLOCATE(BUFF_2D(NDP,SIZEBUF2))
ENDIF
ENDIF
!
IF(ALGAE) THEN

Accessibilit : Libre Page 105 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

IF(LT.EQ.MAX(1,ALGAE_START)) THEN
IF(IELMU.EQ.11) THEN
CALL INTERP_ALGAE(NFLOT,NFLOT_MAX,SHPFLO,SHZFLO,ELTFLO,
& U_X_AV_0%R,U_Y_AV_0%R,U_Z_AV_0%R,K_AV_0%R,EPS_AV_0%R,
& H_FLU%R,NPOIN,IELM,NDP,NPLAN,NELMAX,IKLE,SHZBUF,IELMU,
& NPOIN,U,V,W,AK,EP,H)
CALL INTERP_ALGAE(NFLOT,NFLOT_MAX,SHPFLO,SHZFLO,ELTFLO,
& U_X_AV%R,U_Y_AV%R,U_Z_AV%R,K_AV%R,EPS_AV%R,
& H_FLU%R,NPOIN,IELM,NDP,NPLAN,NELMAX,IKLE,SHZBUF,IELMU,
& NPOIN,U,V,W,AK,EP,H)
ELSEIF(IELMU.EQ.12) THEN
CALL INTERP_ALGAE(NFLOT,NFLOT_MAX,SHPFLO,SHZFLO,ELTFLO,
& U_X_AV_0%R,U_Y_AV_0%R,U_Z_AV_0%R,K_AV_0%R,EPS_AV_0%R,
& H_FLU%R,NPOIN,IELM,NDP,NPLAN,NELMAX,IKLE,SHZBUF,IELMU,
& NPOIN+NELMAX,U,V,W,AK,EP,H)
CALL INTERP_ALGAE(NFLOT,NFLOT_MAX,SHPFLO,SHZFLO,ELTFLO,
& U_X_AV%R,U_Y_AV%R,U_Z_AV%R,K_AV%R,EPS_AV%R,
& H_FLU%R,NPOIN,IELM,NDP,NPLAN,NELMAX,IKLE,SHZBUF,IELMU,
& NPOIN+NELMAX,U,V,W,AK,EP,H)
ENDIF
ENDIF
ENDIF
!
! -----------------
! IF ALGAE IS .TRUE., THEN USE ALGAE TRANSPORT
! OTHERWISE THIS IS A NORMAL DROGUE TRANSPORT
! -----------------
!
IF(ALGAE)THEN
!
! FILL I_A_GL, WHICH WILL BE USED TO VERIFY THAT THE ALGAE INFO IS SENT IN
! THE SAME FASHION AS THE PARTICLE POSITIONS
!
DO IFLOT=1,NFLOT
I_A_GL%I(IFLOT)=TAGFLO(IFLOT)
END DO
!
IF(IELMU.EQ.11)THEN
CALL INTERP_ALGAE(NFLOT,NFLOT_MAX,SHPFLO,SHZFLO,ELTFLO,
& U_X_AV%R,U_Y_AV%R,U_Z_AV%R,K_AV%R,EPS_AV%R,
& H_FLU%R,NPOIN,IELM,NDP,NPLAN,NELMAX,IKLE,SHZBUF,IELMU,
& NPOIN,U,V,W,AK,EP,H)
ELSEIF(IELMU.EQ.12)THEN
CALL INTERP_ALGAE(NFLOT,NFLOT_MAX,SHPFLO,SHZFLO,ELTFLO,
& U_X_AV%R,U_Y_AV%R,U_Z_AV%R,K_AV%R,EPS_AV%R,
& H_FLU%R,NPOIN,IELM,NDP,NPLAN,NELMAX,IKLE,SHZBUF,IELMU,
& NPOIN+NELMAX,U,V,W,AK,EP,H)
END IF
!
CALL DISP_ALGAE(NFLOT_MAX,NFLOT,MESH%DIM,DT,ALGAE_START,
& U_X_AV_0%R,U_Y_AV_0%R,U_Z_AV_0%R,K_AV_0%R,
& EPS_AV_0%R,H_FLU%R,U_X_AV%R,U_Y_AV%R,U_Z_AV%R,
& U_X_0%R,U_Y_0%R,U_Z_0%R,V_X_0%R,V_Y_0%R,V_Z_0%R,
& DX,DY,DZ,ELTFLO,U_X%R,U_Y%R,U_Z%R,V_X%R,V_Y%R,
& V_Z%R,XFLOT,YFLOT,ZFLOT,LT,DALGAE,RALGAE,EALGAE,
& ALGTYP)
!

Accessibilit : Libre Page 106 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

! FIND THE ELEMENT AND SUBDOMAIN AFTER THE TRANSPORT (WITH A VERIFICATION
! IF SIZEBUF.LT.NFLOT_MAX)
!
IF(NFLOT_MAX.GT.SIZEBUF)THEN
CALL SCARACT(SVOID,SVOID,U,V,W,W,X,Y,ZSTAR,ZSTAR,
& XFLOT,YFLOT,
& ZFLOT,ZFLOT,
& DX,DY,
& DZ,DZ,Z,
& SHPFLO,SHZFLO,SHZFLO,
& SURDET,DT,IKLE,IFABOR,ELTFLO,ETAFLO,
& FRE,ELTBUF,ISUB,IELM,IELMU,
& NELEM,NELMAX,
& NOMB,NPOIN,NPOIN2,NDP,NPLAN,1,MESH,NFLOT,NPOIN2,SENS,
& BUFF_2D,BUFF_1D,BUFF_1D,FREBUF,SIZEBUF2,
& AALG=ALGAE,APOST=.TRUE.)
ELSE
CALL SCARACT(SVOID,SVOID,U,V,W,W,X,Y,ZSTAR,ZSTAR,
& XFLOT,YFLOT,
& ZFLOT,ZFLOT,
& DX,DY,
& DZ,DZ,Z,
& SHPFLO,SHZFLO,SHZFLO,
& SURDET,DT,IKLE,IFABOR,ELTFLO,ETAFLO,
& FRE,ELTBUF,ISUB,IELM,IELMU,
& NELEM,NELMAX,
& NOMB,NPOIN,NPOIN2,NDP,NPLAN,1,MESH,NFLOT,NPOIN2,SENS,
& SHPBUF,SHZBUF,SHZBUF,FREBUF,SIZEBUF,
& AALG=ALGAE,APOST=.TRUE.)
ENDIF
ELSE
CALL SCARACT(SVOID,SVOID,U,V,W,W,X,Y,ZSTAR,ZSTAR,
& XFLOT,YFLOT,ZFLOT,ZFLOT,
& DX,DY,DZ,DZ,Z,SHPFLO,SHZFLO,SHZFLO,SURDET,DT,
& IKLE,IFABOR,ELTFLO,ETAFLO,
& FRE,ELTBUF,ISUB,IELM,IELMU,NELEM,NELMAX,
& NOMB,NPOIN,NPOIN2,NDP,NPLAN,1,MESH,NFLOT,NPOIN2,SENS,
& SHPBUF,SHZBUF,SHZBUF,FREBUF,SIZEBUF,
& APOST=.TRUE.,ASTOCHA=STOCHA,AVISC=VISC)
! APOST=.TRUE. OTHERWISE ISUB IS NOT FILLED
ENDIF
!
! DAJ
! OPEN AND WRITE IN TEMPORARY FILE THE ELEMENT NUMBER IF PARTICLES HAVE
! EXITED THE DOMAIN
WRITE(TEMP_OUT_FILE,(A,I1,A))tmp_out_,IPID,.txt
OPEN(9999,FILE=TEMP_OUT_FILE)
WRITE(9999,*)0
DO IFLOT=1,NFLOT
IF(ELTFLO(IFLOT).LT.0) THEN
WRITE(9999,*)ELTFLO(IFLOT)
END IF
END DO
CLOSE(9999)
! FAJ
!-----------------------------------------------------------------------
!

Accessibilit : Libre Page 107 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

IF(NCSIZE.GT.1.AND.NFLOT.GT.0) THEN
!
! IN // XFLOT AND YFLOT MAY HAVE BEEN DESTROYED BY SCARACT
! BECAUSE RE-USED FOR GENERATIONS OF LOST PARTICLES
! THEY ARE REDONE HERE FOR PARTICLES WHICH ARE STILL IN THE
! SUB-DOMAIN
!
IF(IELM.EQ.11) THEN
DO IFLOT=1,NFLOT
IF(ISUB(IFLOT).EQ.IPID) THEN
ELT=ELTFLO(IFLOT)
IF(ELT.GT.0) THEN
N1=IKLE(ELT,1)
N2=IKLE(ELT,2)
N3=IKLE(ELT,3)
XFLOT(IFLOT)=SHPFLO(1,IFLOT)*X(N1)
& +SHPFLO(2,IFLOT)*X(N2)
& +SHPFLO(3,IFLOT)*X(N3)
YFLOT(IFLOT)=SHPFLO(1,IFLOT)*Y(N1)
& +SHPFLO(2,IFLOT)*Y(N2)
& +SHPFLO(3,IFLOT)*Y(N3)
ENDIF
ENDIF
ENDDO
ELSEIF(IELM.EQ.41) THEN
DO IFLOT=1,NFLOT
IF(ISUB(IFLOT).EQ.IPID) THEN
ELT=ELTFLO(IFLOT)
IF(ELT.GT.0) THEN
N1=IKLE(ELT,1)+NPOIN2*(ETAFLO(IFLOT)-1)
N2=IKLE(ELT,2)+NPOIN2*(ETAFLO(IFLOT)-1)
N3=IKLE(ELT,3)+NPOIN2*(ETAFLO(IFLOT)-1)
N4=IKLE(ELT,1)+NPOIN2* ETAFLO(IFLOT)
N5=IKLE(ELT,2)+NPOIN2* ETAFLO(IFLOT)
N6=IKLE(ELT,3)+NPOIN2* ETAFLO(IFLOT)
XFLOT(IFLOT)=SHPFLO(1,IFLOT)*X(N1)
& +SHPFLO(2,IFLOT)*X(N2)
& +SHPFLO(3,IFLOT)*X(N3)
YFLOT(IFLOT)=SHPFLO(1,IFLOT)*Y(N1)
& +SHPFLO(2,IFLOT)*Y(N2)
& +SHPFLO(3,IFLOT)*Y(N3)
ZFLOT(IFLOT)=(Z(N1)*SHPFLO(1,IFLOT)
& +Z(N2)*SHPFLO(2,IFLOT)
& +Z(N3)*SHPFLO(3,IFLOT))*(1.D0-SHZFLO(IFLOT))
& +(Z(N4)*SHPFLO(1,IFLOT)
& +Z(N5)*SHPFLO(2,IFLOT)
& +Z(N6)*SHPFLO(3,IFLOT))*SHZFLO(IFLOT)
ENDIF
ENDIF
ENDDO
ENDIF
!
ENDIF
!
! SEND THE ALGAE INFORMATION IF IT IS NECESSARY
!
IF(NCSIZE.GT.1.AND.ALGAE) THEN

Accessibilit : Libre Page 108 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

CALL SEND_INFO_ALG(XFLOT,YFLOT,ZFLOT,SHPFLO,SHZFLO,ELTFLO,
& ETAFLO,ISUB,I_A_GL%I,ELTBUF,NDP,NFLOT,NFLOT_MAX,
& MESH,NPLAN,U_X_AV%R,U_Y_AV%R,U_Z_AV%R,K_AV%R,
& EPS_AV%R,H_FLU%R,U_X%R,U_Y%R,U_Z%R,V_X%R,V_Y%R,
& V_Z%R,NWIN,MESH%DIM,PSI)
ENDIF
!
! SENDING THE PARTICLES THAT MIGRATED TO ANOTHER SUB-DOMAIN
!
IF(NCSIZE.GT.1) THEN
IF(ALGAE) THEN
CALL SEND_PARTICLES(XFLOT,YFLOT,ZFLOT,SHPFLO,SHZFLO,ELTFLO,
& ETAFLO,ISUB,TAGFLO,NDP,NFLOT,NFLOT_MAX,
& MESH,NPLAN,DX=DX,DY=DY,DZ=DZ)
ELSE
CALL SEND_PARTICLES(XFLOT,YFLOT,ZFLOT,SHPFLO,SHZFLO,ELTFLO,
& ETAFLO,ISUB,TAGFLO,NDP,NFLOT,NFLOT_MAX,
& MESH,NPLAN)
ENDIF
ENDIF
!
!-----------------------------------------------------------------------
!
! CASE OF LOST FLOATS (EXITED OR NOW REMOVED AFTER BEING SENT TO
! ANOTHER SUB-DOMAIN)
!
IFLOT=1
IF(NCSIZE.GT.1) THEN
!
! IN // MODE
!
11 CONTINUE
! LOST OR MIGRATED FLOATS
IF(NFLOT.GT.0.AND.NCSIZE.GT.1) THEN
IF(ELTFLO(IFLOT).LE.0.OR.ISUB(IFLOT).NE.IPID) THEN
! IF(ISUB(IFLOT).NE.IPID) THEN
!
! REMOVE ALGAE INFORMATION FROM A SUB DOMAIN IF IT IS NECESSARY
!
IF(ALGAE) THEN
CALL DEL_INFO_ALG(TAGFLO(IFLOT),NFLOT,NFLOT_MAX,
& MESH%TYPELM,I_A_GL%I,ELTBUF,V_X%R,V_Y%R,V_Z%R,
& U_X%R,U_Y%R,U_Z%R,U_X_AV%R,U_Y_AV%R,U_Z_AV%R,
& K_AV%R,EPS_AV%R,H_FLU%R,NWIN,MESH%DIM,PSI)
ENDIF
!
IF(ALGAE) THEN
CALL DEL_PARTICLE(TAGFLO(IFLOT),NFLOT,NFLOT_MAX,XFLOT,
& YFLOT,ZFLOT,TAGFLO,SHPFLO,SHZFLO,ELTFLO,
& ETAFLO,MESH%TYPELM,
& DX=DX,DY=DY,DZ=DZ,ISUB=ISUB)
ELSE
CALL DEL_PARTICLE(TAGFLO(IFLOT),NFLOT,NFLOT_MAX,XFLOT,
& YFLOT,ZFLOT,TAGFLO,SHPFLO,SHZFLO,ELTFLO,
& ETAFLO,MESH%TYPELM,
& ISUB=ISUB)
ENDIF

Accessibilit : Libre Page 109 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

!
! THE SAME IFLOT IS NOW A NEW PARTICLE AND MUST BE CHECKED AGAIN!
IF(IFLOT.LE.NFLOT) GO TO 11
ENDIF
!
IF(ALGAE)THEN
! UPDATE DX_A,DY_A,DZ_A
DX_A%R(IFLOT)=DX(IFLOT)
DY_A%R(IFLOT)=DY(IFLOT)
DZ_A%R(IFLOT)=DZ(IFLOT)
ENDIF
!
IFLOT=IFLOT+1
IF(IFLOT.LE.NFLOT) GO TO 11
ENDIF
!
ELSE
!
! IN SCALAR MODE
!
10 CONTINUE
! LOST FLOATS ONLY
IF(NFLOT.GT.0) THEN
IF(ELTFLO(IFLOT).LE.0) THEN
!
! REMOVE INFORMATION FROM A SUB DOMAIN IF NECESSARY
!
IF(ALGAE) THEN
CALL DEL_INFO_ALG(TAGFLO(IFLOT),NFLOT,NFLOT_MAX,
& MESH%TYPELM,I_A_GL%I,ELTBUF,V_X%R,V_Y%R,V_Z%R,
& U_X%R,U_Y%R,U_Z%R,U_X_AV%R,U_Y_AV%R,U_Z_AV%R,
& K_AV%R,EPS_AV%R,H_FLU%R,NWIN,MESH%DIM,PSI)
CALL DEL_PARTICLE(TAGFLO(IFLOT),NFLOT,NFLOT_MAX,XFLOT,
& YFLOT,ZFLOT,TAGFLO,SHPFLO,SHZFLO,ELTFLO,
& ETAFLO,MESH%TYPELM,DX=DX,DY=DY,DZ=DZ)
ELSE
CALL DEL_PARTICLE(TAGFLO(IFLOT),NFLOT,NFLOT_MAX,XFLOT,
& YFLOT,ZFLOT,TAGFLO,SHPFLO,SHZFLO,ELTFLO,
& ETAFLO,MESH%TYPELM)
ENDIF
!
! THE SAME IFLOT IS NOW A NEW PARTICLE AND MUST BE CHECKED AGAIN!
IF(IFLOT.LE.NFLOT) GO TO 10
ENDIF
!
IF(ALGAE)THEN
! UPDATE DX_A,DY_A,DZ_A
DX_A%R(IFLOT)=DX(IFLOT)
DY_A%R(IFLOT)=DY(IFLOT)
DZ_A%R(IFLOT)=DZ(IFLOT)
ENDIF
!
IFLOT=IFLOT+1
IF(IFLOT.LE.NFLOT) GO TO 10
ENDIF
!
ENDIF

Accessibilit : Libre Page 110 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

!
!-----------------------------------------------------------------------
!
! TECPLOT FILE
!
IF(NCSIZE.GT.1) THEN
!
! WAITING ALL PROCESSORS (SO THAT NFLOT IS UPDATED FOR ALL
! BEFORE CALLING P_ISUM)
!
CALL P_SYNC
!
! PARALLEL VERSION
!
NFLOTG=P_ISUM(NFLOT)
IF(NFLOTG.GT.0.AND.(LT.EQ.1.OR.(LT/FLOPRD)*FLOPRD.EQ.LT)) THEN
!
! 1) EVERY PROCESSOR WRITES ITS OWN DATA IN A FILE WITH EXTENSION
!
IF(NFLOT.GT.0) THEN
OPEN(99,FILE=EXTENS(NCSIZE,IPID+1),
& FORM=FORMATTED,STATUS=NEW)
IF(IELM.EQ.11) THEN
DO IFLOT=1,NFLOT
WRITE(99,300) TAGFLO(IFLOT),XFLOT(IFLOT),
& YFLOT(IFLOT),1
ENDDO
ELSE
DO IFLOT=1,NFLOT
WRITE(99,301) TAGFLO(IFLOT),XFLOT(IFLOT),
& YFLOT(IFLOT),ZFLOT(IFLOT),1
ENDDO
ENDIF
CLOSE(99)
ENDIF
!
! 2) WAITING ALL PROCESSORS
!
CALL P_SYNC
!
! 3) PROCESSOR 0 READS ALL EXISTING FILES AND MERGES
! THEM IN THE FINAL FILE
!
IF(IPID.EQ.0) THEN
WRITE(UL,200) ZONE DATAPACKING=POINT, T=G_,AT,
& seconds,, I=,NFLOTG,, SOLUTIONTIME=,AT
DO IPROC=1,NCSIZE
INQUIRE(FILE=EXTENS(NCSIZE,IPROC),EXIST=YESITIS)
IF(YESITIS) THEN
OPEN(99,FILE=EXTENS(NCSIZE,IPROC),
& FORM=FORMATTED,STATUS=OLD)
22 CONTINUE
READ(99,100,ERR=23,END=23) LIGNE
WRITE(UL,*) LIGNE
GO TO 22
23 CONTINUE
CLOSE(99,STATUS=DELETE)

Accessibilit : Libre Page 111 sur 112 EDF SA 2013


EDF R&D Adding a particle transport module to Telemac-2D with applications to algae blooms and oil spills H-P74-2013-02317-EN
Version 0.3

ENDIF
ENDDO
ENDIF
!
ENDIF
!
ELSE
!
! SCALAR VERSION
!
IF(NFLOT.GT.0.AND.(LT.EQ.1.OR.(LT/FLOPRD)*FLOPRD.EQ.LT)) THEN
WRITE(UL,200) ZONE DATAPACKING=POINT, T=G_,AT,
& seconds,, I=,NFLOT,, SOLUTIONTIME=,AT
IF(IELM.EQ.11) THEN
DO IFLOT=1,NFLOT
WRITE(UL,300) TAGFLO(IFLOT),XFLOT(IFLOT),YFLOT(IFLOT),1
ENDDO
ELSE
DO IFLOT=1,NFLOT
WRITE(UL,301) TAGFLO(IFLOT),XFLOT(IFLOT),
& YFLOT(IFLOT),ZFLOT(IFLOT),1
ENDDO
ENDIF
200 FORMAT(A,F12.4,A,A,I4,A,F12.4)
300 FORMAT(I6,,,F16.8,,,F16.8,,,I2)
301 FORMAT(I6,,,F16.8,,,F16.8,,,F16.8,,,I2)
ENDIF
!
ENDIF
!
!-----------------------------------------------------------------------
!
RETURN
END SUBROUTINE DERIVE

Accessibilit : Libre Page 112 sur 112 EDF SA 2013

También podría gustarte