The TELEMAC-MASCARET system  trunk
nametrac_waqtel.F
Go to the documentation of this file.
1 ! **************************
2  SUBROUTINE nametrac_waqtel
3 ! **************************
4 !
5  & (nametrac,ntrac,process)
6 !
7 !
8 !***********************************************************************
9 ! WAQTEL V8P2
10 !***********************************************************************
11 !
12 !brief Gives names to tracers added by the water quality
13 !
14 !
15 !history R.ATA
16 !+ 12/09/2014
17 !+ V7P0
18 !+ CREATION
19 !
20 !history M.JODEAU
21 !+ 05/2016
22 !+ V7P3
23 !+ AED2 coupling
24 !
25 !history S.E. BOURBAN (HRW)
26 !+ 07/06/2017
27 !+ V7P3
28 !+ Re-working NAMETRAC to avoid conflicting naming convention
29 !+ between user defined tracers, water quality processes and
30 !+ ice processes.
31 !
32 !history S.E. BOURBAN (HRW)
33 !+ 21/09/2017
34 !+ V7P3
35 !+ WAQPROCESS is now a prime number, so that multiple processes
36 !+ can be called by multiplication of the prime numbers.
37 !
38 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39 !| NAMETRAC |<->| ARRAY OF NAMES OF TRACERS
40 !| NTRAC |-->| MODIFYING NUMBER OF TRACER IF NECESARY
41 !| PROCESS |-->| USED TO FILTER ACCESS TO WATER QUALITY PROCESSES
42 !| | | PROCESS CAN BE DIFFERENT FROM WAQPROCESS, AND
43 !| | | IF 1, THEN ONLY THE INITIAL SETTING IS DONE
44 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45 !
48  USE interface_waqtel, ex_nametrac_waqtel => nametrac_waqtel
49 #if defined HAVE_AED2
50  USE t3d_aed2
51 #endif
52 !
53  IMPLICIT NONE
54 !
55 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
56 !
57 !
58  INTEGER , INTENT(IN ):: PROCESS
59  INTEGER , INTENT(INOUT):: NTRAC
60  CHARACTER(LEN=32), INTENT(INOUT):: NAMETRAC(*)
61 !
62 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
63 !
64 ! AED2
65 #if defined HAVE_AED2
66  CHARACTER(LEN=16),ALLOCATABLE :: NAMESAED2(:)
67 #endif
68  INTEGER I
69  LOGICAL :: FOUND
70 !
71 !-----------------------------------------------------------------------
72 !
73  found = .false.
74 !
75 !-----------------------------------------------------------------------
76 !
77 ! INITIALISATION
78 !
79  IF( process.EQ.1 ) THEN
80  found = .true.
81 
82  waqtr = 0
83  ranktr = 0
84 !
85 ! SORTING INDICES BY GROUPS
86 !
87  rank_oxygn = 0 ! GROUP O2 TRACERS
88  rank_bioma = 0 ! GROUP BIOMASS TRACERS
89  rank_eutro = 0 ! GROUP EUTRO TRACERS
90  rank_micro = 0 ! GROUP MICROPOL TRACERS
91  rank_therm = 0 ! GROUP THERMIC TRACER
92 !
93  nwaq_aed2 = 0
94  rank_aed2 = 0 ! GROUP AED2 TRACERS
95 !
96  nwaq_degra = 0
97  rank_degra = 0 ! GROUP TRACERS WITH A DEGRADATION LAW
98 !
99 ! INDICES OF UNIQUE TRACERS
100 !
101  ind_t = 0 ! TEMPERATURE
102  ind_s = 0 ! SALINITY
103  ind_o2 = 0 ! DISSOLVED O2
104  ind_ol = 0 ! ORGANIC LOAD
105  ind_nh4 = 0 ! NH4 LOAD
106  ind_phy = 0 ! PHYTO BIOMASS
107  ind_po4 = 0 ! DISSOLVED PO4
108  ind_por = 0 ! POR NON ASSIM
109  ind_no3 = 0 ! DISSOLVED NO3
110  ind_nor = 0 ! NOR NON ASSIM
111  ind_ss = 0 ! SUSPENDED LOAD
112  ind_sf = 0 ! BED SEDIMENTS
113  ind_c = 0 ! MICRO POLLUTANT
114  ind_css = 0 ! ABS. SUSP. LOAD.
115  ind_csf = 0 ! ABSORB. BED SED.
116 
117 !
118  ELSE IF( process*int(waqprocess/process).NE.waqprocess ) THEN
119  WRITE(lu,21) process,waqprocess
120 21 FORMAT(1x,'NAMETRAC_WAQTEL: PROCESS CALLED ',i4,
121  & ' IS NOT A MULTIPLYING VALUE OF WAQ: ',i4)
122  CALL plante(1)
123  stop
124  ENDIF
125 !
126 !-----------------------------------------------------------------------
127 !
128 ! THERMIC MODULE
129 !
130  IF( 11*int(process/11).EQ.process ) THEN
131  found = .true.
132 !
133 ! 1. ~~> TEMPERATURE
134  IF( ind_t.EQ.0 ) THEN
135  CALL addtracer(nametrac,ntrac,
136  & ind_t,.true.,
137  & 'TEMPERATURE ','TEMPERATURE ',' oC ')
138  waqtr = waqtr + 1
139  ranktr(waqtr) = ind_t
140  ENDIF
141  rank_therm(1) = ind_t
142 !
143  ENDIF
144 !
145 !-----------------------------------------------------------------------
146 !
147 ! AED2 COUPLING
148 !
149  IF( 13*int(process/13).EQ.process ) THEN
150 #if defined HAVE_AED2
151  found = .true.
152 !
153 ! 1. ~~> TEMPERATURE
154  IF( ind_t.EQ.0 ) THEN
155  CALL addtracer(nametrac,ntrac,
156  & ind_t,.true.,
157  & 'TEMPERATURE ','TEMPERATURE ',' oC ')
158  waqtr = waqtr + 1
159  ranktr(waqtr) = ind_t
160  ENDIF
161 !
162 ! 2. ~~> SALINITY
163  IF( ind_s.EQ.0 ) THEN
164  CALL addtracer(nametrac,ntrac,
165  & ind_s,.true.,
166  & 'SALINITE ','SALINITY ',' g/l ')
167  waqtr = waqtr + 1
168  ranktr(waqtr) = ind_s
169  ENDIF
170 !
171  CALL names_var_aed2(nwqvars,namesaed2)
172 ! I. ~~> AED2 VARIABLES
174  DO i = 1,nwqvars
175  IF( namesaed2(i) == 'CAR_pH ' ) THEN
176  CALL addtracer(nametrac,ntrac,
177  & rank_aed2(i),.true.,
178  & namesaed2(i),namesaed2(i),' -/m3 ')
179  ELSE
180  CALL addtracer(nametrac,ntrac,
181  & rank_aed2(i),.true.,
182  & namesaed2(i),namesaed2(i),' mmol/m3 ')
183  ENDIF
184  IF( rank_aed2(i).EQ.ntrac ) THEN
185  waqtr = waqtr + 1
186  ranktr(waqtr) = rank_aed2(i)
187  ENDIF
188  ENDDO
189 !
190 #else
191  WRITE(lu,*) 'ERROR: AED2 LIBRARY NOT COMPILED'
192  CALL plante(1)
193  stop
194 #endif
195  ENDIF
196 !
197 !-----------------------------------------------------------------------
198 !
199 ! O2 MODULE
200 !
201  IF( 2*int(process/2).EQ.process ) THEN
202  found = .true.
203 !
204 ! 1. ~~> DISSOLVED O2
205  IF( ind_o2.EQ.0 ) THEN
206  CALL addtracer(nametrac,ntrac,
207  & ind_o2,.true.,
208  & 'O2 DISSOUS ','DISSOLVED O2 ',' mgO2/l ')
209  waqtr = waqtr + 1
210  ranktr(waqtr) = ind_o2
211  ENDIF
212  rank_oxygn(1) = ind_o2
213 !
214 ! 2. ~~> ORGANIC LOAD
215  IF( ind_ol.EQ.0 ) THEN
216  CALL addtracer(nametrac,ntrac,
217  & ind_ol,.true.,
218  & 'CHARGE ORGANIQUE','ORGANIC LOAD ',' mgO2/l ')
219  waqtr = waqtr + 1
220  ranktr(waqtr) = ind_ol
221  ENDIF
222  rank_oxygn(2) = ind_ol
223 !
224 ! 3. ~~> NH4 LOAD
225  IF( ind_nh4.EQ.0 ) THEN
226  CALL addtracer(nametrac,ntrac,
227  & ind_nh4,.true.,
228  & 'CHARGE NH4 ','NH4 LOAD ',' mgNH4/l ')
229  waqtr = waqtr + 1
230  ranktr(waqtr) = ind_nh4
231  ENDIF
232  rank_oxygn(3) = ind_nh4
233 !
234  ENDIF
235 !
236 !-----------------------------------------------------------------------
237 !
238 ! BIOMASS MODULE
239 !
240  IF( 3*int(process/3).EQ.process ) THEN
241  found = .true.
242 !
243 ! 1. ~~> PHYTO BIOMASS
244  IF( ind_phy.EQ.0 ) THEN
245  CALL addtracer(nametrac, ntrac,
246  & ind_phy,.true.,
247  & 'BIOMASSE PHYTO ','PHYTO BIOMASS ',' micro_g/l ')
248  waqtr = waqtr + 1
249  ranktr(waqtr) = ind_phy
250  ENDIF
251  rank_bioma(1) = ind_phy
252 !
253 ! 2. ~~> DISSOLVED PO4
254  IF( ind_po4.EQ.0 ) THEN
255  CALL addtracer(nametrac,ntrac,
256  & ind_po4,.true.,
257  & 'PO4 DISSOUS ','DISSOLVED PO4 ',' mg/l ')
258  waqtr = waqtr + 1
259  ranktr(waqtr) = ind_po4
260  ENDIF
261  rank_bioma(2) = ind_po4
262 !
263 ! 3. ~~> POR NON ASSIM
264  IF( ind_por.EQ.0 ) THEN
265  CALL addtracer(nametrac,ntrac,
266  & ind_por,.true.,
267  & 'POR NON ASSIMILE','POR NON ASSIM ',' mg/l ')
268  waqtr = waqtr + 1
269  ranktr(waqtr) = ind_por
270  ENDIF
271  rank_bioma(3) = ind_por
272 !
273 ! 4. ~~> DISSOLVED NO3
274  IF( ind_no3.EQ.0 ) THEN
275  CALL addtracer(nametrac,ntrac,
276  & ind_no3,.true.,
277  & 'NO3 DISSOUS ','DISSOLVED NO3 ',' mg/l ')
278  waqtr = waqtr + 1
279  ranktr(waqtr) = ind_no3
280  ENDIF
281  rank_bioma(4) = ind_no3
282 !
283 ! 5. ~~> NOR NON ASSIM
284  IF( ind_nor.EQ.0 ) THEN
285  CALL addtracer(nametrac,ntrac,
286  & ind_nor,.true.,
287  & 'NOR NON ASSIMILE','NOR NON ASSIM ',' mg/l ')
288  waqtr = waqtr + 1
289  ranktr(waqtr) = ind_nor
290  ENDIF
291  rank_bioma(5) = ind_nor
292 !
293  ENDIF
294 !
295 !-----------------------------------------------------------------------
296 !
297 ! EUTRO MODULE
298 !
299  IF( 5*int(process/5).EQ.process ) THEN
300  found = .true.
301 !
302 ! 1. ~~> PHYTO BIOMASS
303  IF( ind_phy.EQ.0 ) THEN
304  CALL addtracer(nametrac,ntrac,
305  & ind_phy,.true.,
306  & 'BIOMASSE PHYTO ','PHYTO BIOMASS ',' micro_g/l ')
307  waqtr = waqtr + 1
308  ranktr(waqtr) = ind_phy
309  ENDIF
310  rank_eutro(1) = ind_phy
311 !
312 ! 2. ~~> DISSOLVED PO4
313  IF( ind_po4.EQ.0 ) THEN
314  CALL addtracer(nametrac,ntrac,
315  & ind_po4,.true.,
316  & 'PO4 DISSOUS ','DISSOLVED PO4 ',' mg/l ')
317  waqtr = waqtr + 1
318  ranktr(waqtr) = ind_po4
319  ENDIF
320  rank_eutro(2) = ind_po4
321 !
322 ! 3. ~~> POR NON ASSIMIL
323  IF( ind_por.EQ.0 ) THEN
324  CALL addtracer(nametrac,ntrac,
325  & ind_por,.true.,
326  & 'POR NON ASSIMILE','POR NON ASSIMIL ',' mg/l ')
327  waqtr = waqtr + 1
328  ranktr(waqtr) = ind_por
329  ENDIF
330  rank_eutro(3) = ind_por
331 !
332 ! 4. ~~> DISSOLVED NO3
333  IF( ind_no3.EQ.0 ) THEN
334  CALL addtracer(nametrac,ntrac,
335  & ind_no3,.true.,
336  & 'NO3 DISSOUS ','DISSOLVED NO3 ',' mg/l ')
337  waqtr = waqtr + 1
338  ranktr(waqtr) = ind_no3
339  ENDIF
340  rank_eutro(4) = ind_no3
341 !
342 ! 5. ~~> NOR NON ASSIM
343  IF( ind_nor.EQ.0 ) THEN
344  CALL addtracer(nametrac,ntrac,
345  & ind_nor,.true.,
346  & 'NOR NON ASSIMILE','NOR NON ASSIM ',' mg/l ')
347  waqtr = waqtr + 1
348  ranktr(waqtr) = ind_nor
349  ENDIF
350  rank_eutro(5) = ind_nor
351 !
352 ! 6. ~~> NH4 LOAD
353  IF( ind_nh4.EQ.0 ) THEN
354  CALL addtracer(nametrac,ntrac,
355  & ind_nh4,.true.,
356  & 'CHARGE NH4 ','NH4 LOAD ',' mgNH4/l ')
357  waqtr = waqtr + 1
358  ranktr(waqtr) = ind_nh4
359  ENDIF
360  rank_eutro(6) = ind_nh4
361 !
362 ! 7. ~~> ORGANIC LOAD
363  IF( ind_ol.EQ.0 ) THEN
364  CALL addtracer(nametrac,ntrac,
365  & ind_ol,.true.,
366  & 'CHARGE ORGANIQUE','ORGANIC LOAD ',' mgO2/l ')
367  waqtr = waqtr + 1
368  ranktr(waqtr) = ind_ol
369  ENDIF
370  rank_eutro(7) = ind_ol
371 !
372 ! 8. ~~> DISSOLVED O2
373  IF( ind_o2.EQ.0 ) THEN
374  CALL addtracer(nametrac,ntrac,
375  & ind_o2,.true.,
376  & 'O2 DISSOUS ','DISSOLVED O2 ',' mgO2/l ')
377  waqtr = waqtr + 1
378  ranktr(waqtr) = ind_o2
379  ENDIF
380  rank_eutro(8) = ind_o2
381 !
382  ENDIF
383 !
384 !-----------------------------------------------------------------------
385 !
386 ! MICROPOL MODULE
387 !
388  IF( 7*int(process/7).EQ.process ) THEN
389  found = .true.
390 !
391 ! 1. ~~> SUSPENDED LOAD
392  IF( ind_ss.EQ.0 ) THEN
393  CALL addtracer(nametrac,ntrac,
394  & ind_ss,.true.,
395  & 'MAT. EN SUSP. ','SUSPENDED LOAD ',' mg/l ')
396  waqtr = waqtr + 1
397  ranktr(waqtr) = ind_ss
398  ENDIF
399  rank_micro(1) = ind_ss
400 !
401 ! 2. ~~> BED SEDIMENTS
402  IF( ind_sf.EQ.0 ) THEN
403  CALL addtracer(nametrac,ntrac,
404  & ind_sf,.true.,
405  & 'SEDIMENT DU FOND','BED SEDIMENTS ',' mg/l ')
406  waqtr = waqtr + 1
407  ranktr(waqtr) = ind_sf
408  ENDIF
409  rank_micro(2) = ind_sf
410 !
411 ! 3. ~~> MICRO POLLUTANT
412  IF( ind_c.EQ.0 ) THEN
413  CALL addtracer(nametrac,ntrac,
414  & ind_c,.true.,
415  & 'MICRO POLLUANT ','MICRO POLLUTANT ',' mg/l ')
416  waqtr = waqtr + 1
417  ranktr(waqtr) = ind_c
418  ENDIF
419  rank_micro(3) = ind_c
420 !
421 ! 4. ~~> ABS. SUSP. LOAD.
422  IF( ind_css.EQ.0 ) THEN
423  CALL addtracer(nametrac,ntrac,
424  & ind_css,.true.,
425  & 'MES ABSORBEE ','ABS. SUSP. LOAD.',' mg/l ')
426  waqtr = waqtr + 1
427  ranktr(waqtr) = ind_css
428  ENDIF
429  rank_micro(4) = ind_css
430 !
431 ! 5. ~~> ABSORB. BED SED.
432  IF( ind_csf.EQ.0 ) THEN
433  CALL addtracer(nametrac,ntrac,
434  & ind_csf,.true.,
435  & 'SED. FOND. ABS. ','ABSORB. BED SED.',' mg/l ')
436  waqtr = waqtr + 1
437  ranktr(waqtr) = ind_csf
438  ENDIF
439  rank_micro(5) = ind_csf
440 !
441  ENDIF
442 !
443 !-----------------------------------------------------------------------
444 !
445 ! DEGRADATION LAW
446 !
447  IF( 17*int(process/17).EQ.process ) THEN
448  found = .true.
449 !
450  DO i = 1,ntrac
451  waqtr = waqtr + 1
452  ranktr(waqtr) = waqtr
453  nwaq_degra = nwaq_degra + 1
455  ENDDO
456 !
457  ENDIF
458 !
459 !-----------------------------------------------------------------------
460 !
461 ! GHOST PROCESS IN WAITING FOR THE MERGE WITH ICE PROCESS
462 !
463  IF( 19*int(process/19).EQ.process ) THEN
464  found = .true.
465  ENDIF
466 !
467 !-----------------------------------------------------------------------
468 !
469 ! UNKNOWN PROCESS
470 !
471  IF( .NOT.found ) THEN
472  WRITE(lu,20) process
473 20 FORMAT(1x,'NAMETRAC_WAQTEL: UNKNOWN WAQ MODULE: ',i4)
474  CALL plante(1)
475  stop
476  ENDIF
477 !
478 !-----------------------------------------------------------------------
479 !
480  RETURN
481  END SUBROUTINE nametrac_waqtel
integer, dimension(maxwqvar) rank_aed2
integer, dimension(maxwqvar) ranktr
integer, dimension(nwaq_therm) rank_therm
subroutine, public names_var_aed2(NV_AED2, NAMESAED2)
Definition: t3d_aed2.F90:347
integer, dimension(maxwqvar) rank_degra
integer, dimension(nwaq_micro) rank_micro
integer, dimension(nwaq_eutro) rank_eutro
integer, dimension(nwaq_bioma) rank_bioma
subroutine addtracer(NAMETRAC, MTRAC, ITRAC, ADD, NAME1, NAME2, UNIT0)
Definition: addtracer.f:7
subroutine nametrac_waqtel(NAMETRAC, NTRAC, PROCESS)
integer, dimension(nwaq_oxygn) rank_oxygn