The TELEMAC-MASCARET system  trunk
bed1_update.f
Go to the documentation of this file.
1 ! *********************
2  SUBROUTINE bed1_update
3 ! *********************
4 !
5  &(zr,zf,volu2d)
6 !
7 !***********************************************************************
8 ! GAIA
9 !***********************************************************************
10 !
13 !
14 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19 !
20  USE bief
22  & mass_mud_tot,mass_mud,mass_sand,nsand,nmud,ratio_mud,ratio_sand,
23  & ratio_mud_sand,nomblay,conc_mud,es,xkv0,xmvs0,min_sed_mass_comp,
24  & npoin,masstot,num_icla_imud,num_icla_isand,nsicla,
25  & num_isand_icla
27  USE interface_parallel, ONLY : p_sum
28  IMPLICIT NONE
29 !
30 !!-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
31 !
32  type(bief_obj), INTENT(INOUT) :: zr,zf
33  type(bief_obj), INTENT(IN) :: volu2d
34 !
35 !!-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36 !
37  INTEGER IPOIN,ILAYER,ISAND,IMUD,ICLA,K,J,I
38  DOUBLE PRECISION TOT,TERM,DISCR,XMVS_LAY
39 !
40 !!-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41 !
42 !--------------------------------------------------------------------------------------
43 ! ONLY MASS_SAND_TOT(1,IPOIN) SET TO ZERO SINCE AFTER BEDLOAD
44 ! MASS_SAND (BUT ONLY THE FIRST LAYER) IS UPDATED IN BEDLOAD_MAIN
45 ! to do for all the layers if masses are updated/computed somewhere before
46 ! VARIOUS MASSES ARE STILL IN [kg/m2]
47  DO ipoin = 1,npoin
48 !
49  DO ilayer = 1,nomblay
50  mass_mix_tot(ilayer,ipoin) = 0.d0
51  mass_sand_tot(ilayer,ipoin) = 0.d0
52  mass_mud_tot(ilayer,ipoin) = 0.d0
53 !
54  IF(nmud.NE.0)THEN
55  DO imud = 1,nmud
56 ! THIS CLIPPING IS - A PRIORI - NOT MANDATORY
57  IF(mass_mud(imud,ilayer,ipoin).LT.0.d0)THEN
58  mass_mud(imud,ilayer,ipoin) = 0.d0
59  ENDIF
60  ENDDO
61  ENDIF
62 !
63  IF(nsand.NE.0)THEN
64  DO isand = 1,nsand
65 ! THIS CLIPPING IS - A PRIORI - NOT MANDATORY
66  IF(mass_sand(isand,ilayer,ipoin).LT.0.d0)THEN
67  mass_sand(isand,ilayer,ipoin) = 0.d0
68  ENDIF
69  ENDDO
70  ENDIF
71  ENDDO
72 !
73  ENDDO
74 !
75 !-----------------------------------------------------------------------------
76 ! UPDATES TOT MASS PER LAYER
77 ! here we receive MASS_SAND(ISAND,ILAYER,IPOIN) or
78 ! MASS_MUD(IMUD,ILAYER,IPOIN) after bedload/suspension/...
79 !
80  IF(nsand.GE.1) THEN
81  DO ipoin = 1,npoin
82  DO ilayer = 1,nomblay
83  DO isand = 1,nsand
84  mass_sand_tot(ilayer,ipoin) = mass_sand_tot(ilayer,ipoin)
85  & + mass_sand(isand,ilayer,ipoin)
86  ENDDO
87  ENDDO
88  ENDDO
89  ENDIF
90  IF(nmud.GE.1) THEN
91  DO ipoin = 1,npoin
92  DO ilayer = 1,nomblay
93  DO imud = 1,nmud
94  mass_mud_tot(ilayer,ipoin) = mass_mud_tot(ilayer,ipoin)
95  & + mass_mud(imud,ilayer,ipoin)
96  ENDDO
97  ENDDO
98  ENDDO
99  ENDIF
100 !
101  DO ipoin = 1,npoin
102  DO ilayer = 1,nomblay
103  mass_mix_tot(ilayer,ipoin) = mass_sand_tot(ilayer,ipoin)
104  & + mass_mud_tot(ilayer,ipoin)
105  ENDDO
106  ENDDO
107 !
108 ! COMPUTES MASS RATIOS PER LAYER (SAND CLASSES)
109 !
110  IF(nsand.GE.1)THEN
111 !
112  DO ipoin = 1,npoin
113  DO ilayer = 1,nomblay
114  tot = 0.d0
115  DO isand = 1,nsand
116  IF(isand.NE.nsand) THEN
117  IF(mass_sand_tot(ilayer,ipoin).GE.min_sed_mass_comp)THEN
118  ratio_sand(isand,ilayer,ipoin) =
119  & min(1.d0,mass_sand(isand,ilayer,ipoin)
120  & / mass_sand_tot(ilayer,ipoin))
121  tot = tot + ratio_sand(isand,ilayer,ipoin)
122  ELSE
123  ratio_sand(isand,ilayer,ipoin) = 0.d0
124  ENDIF
125  ELSE
126  ratio_sand(nsand,ilayer,ipoin) = 1.d0-tot
127  ENDIF
128  ENDDO
129  ENDDO
130  ENDDO
131 !
132  ENDIF
133 !
134 ! COMPUTES MASS RATIOS PER LAYER (MUD CLASSES)
135 !
136  IF(nmud.GE.1)THEN
137 !
138  DO ipoin = 1,npoin
139  DO ilayer = 1,nomblay
140  tot = 0.d0
141  DO imud = 1,nmud
142  IF (imud.NE.nmud)THEN
143  IF(mass_mud_tot(ilayer,ipoin).GE.min_sed_mass_comp)THEN
144  ratio_mud(imud,ilayer,ipoin) =
145  & min(1.d0,mass_mud(imud,ilayer,ipoin)
146  & / mass_mud_tot(ilayer,ipoin))
147  tot = tot + ratio_mud(imud,ilayer,ipoin)
148  ELSE
149  ratio_mud(imud,ilayer,ipoin) = 0.d0
150  ENDIF
151  ELSE
152  ratio_mud(nmud,ilayer,ipoin) = 1.d0-tot
153  ENDIF
154  ENDDO
155  ENDDO
156  ENDDO
157 !
158  ENDIF
159 !
160 ! COMPUTES SAND-MUD MASS RATIOS PER LAYER
161 !
162  IF(nmud.EQ.0) THEN
163  DO ipoin=1,npoin
164  DO ilayer=1,nomblay
165  ratio_mud_sand(ilayer,ipoin) = 0.d0
166  ENDDO
167  ENDDO
168  ELSEIF(nsand.EQ.0) THEN
169  DO ipoin=1,npoin
170  DO ilayer=1,nomblay
171  ratio_mud_sand(ilayer,ipoin) = 1.d0
172  ENDDO
173  ENDDO
174  ELSE
175 ! NSAND AND NMUD GT 0 (IF NSAND AND NMUD EQ 0: WHAT ARE YOU
176 ! DOING IS GAIA?)
177  DO ipoin = 1,npoin
178  DO ilayer = 1,nomblay
179  IF(mass_mix_tot(ilayer,ipoin).GE.min_sed_mass_comp)THEN
180  ratio_mud_sand(ilayer,ipoin)= min(1.d0,
181  & mass_mud_tot(ilayer,ipoin)
182  & / mass_mix_tot(ilayer,ipoin))
183  ELSE
184 ! CHOICE TO DO, BUT NO EROSION OF THIS LAYER IN SUSPENSION_ERODE
185  ratio_mud_sand(ilayer,ipoin) = 1.d0
186  ENDIF
187  ENDDO
188  ENDDO
189  ENDIF
190 !
191 ! COMPUTE THICKNESS [m]
192 !
193  IF (nsand.EQ.0)THEN
194  DO ilayer = 1,nomblay
195  DO ipoin = 1,npoin
196  es(ipoin,ilayer) = mass_mix_tot(ilayer,ipoin)
197  & /conc_mud(ilayer,ipoin)
198  ENDDO
199  ENDDO
200  ELSE
201  DO ilayer = 1,nomblay
202 
203  DO ipoin = 1,npoin
204  xmvs_lay=0.d0
205  DO isand = 1,nsand ! AVERAGE DENSITY OF SAND FOR THE LAYER
206  xmvs_lay=xmvs_lay+
207  & ratio_sand(isand,ilayer,ipoin)*xmvs0(num_isand_icla(isand))
208  ENDDO
209 ! TTERM REPRESENTS THE DIFFERENCE BETWEEN MUD VOLUME AND VOID VOLUME
210  term=0.d0
211  IF(nmud.GT.0) THEN
212  term=ratio_mud_sand(ilayer,ipoin)/conc_mud(ilayer,ipoin)-
213  & (xkv0(ilayer)*(1.d0-ratio_mud_sand(ilayer,ipoin)))/
214  & (xmvs_lay*(1.d0-xkv0(ilayer)))
215  ENDIF
216  discr=max(0.d0,term)
217 ! IF DISCR IS POSITIVE IT MEANS THAT MUD VOLUME IS LARGER THAN VOID VOLUME
218 ! IF DISCR IS NEGATIVE, THE VOID VOLUME IS NOT COMPLETELY FILLED BY MUD
219  es(ipoin,ilayer)=mass_mix_tot(ilayer,ipoin)*
220  & ((1.d0-ratio_mud_sand(ilayer,ipoin))/
221  & (xmvs_lay*(1.d0-xkv0(ilayer)))+ discr)
222  ENDDO
223  ENDDO
224  ENDIF
225 !
226 ! COMPUTE ZF (NOTE: THIS COULD BE MOVED)
227 !
228  DO ipoin = 1,npoin
229  zf%R(ipoin) = zr%R(ipoin)
230  DO ilayer = 1,nomblay
231  zf%R(ipoin) = zf%R(ipoin) + es(ipoin,ilayer)
232  ENDDO
233  ENDDO
234 !
235 ! COMPUTES MASSTOT AT EVERY TIME STEP, FOR EVERY CLASS
236 ! NECESSARY FOR BALANCE
237 ! MAYBE TO DO ONLY AT THE LAST TIME STEP?
238 !
239  DO icla=1,nsicla
240  masstot(icla)=0.d0
241  ENDDO
242 !
243  DO icla=1,nsicla
244  k = num_icla_imud(icla)
245  j = num_icla_isand(icla)
246  IF(j.GT.0) THEN
247  DO ipoin=1,npoin
248  DO i=1,nomblay
249  masstot(icla)= masstot(icla) +
250  & mass_sand(j,i,ipoin)*volu2d%R(ipoin)
251  ENDDO
252  ENDDO
253  ENDIF
254  IF(k.GT.0) THEN
255  DO ipoin=1,npoin
256  DO i=1,nomblay
257  masstot(icla)= masstot(icla) +
258  & mass_mud(k,i,ipoin)*volu2d%R(ipoin)
259  ENDDO
260  ENDDO
261  ENDIF
262  ENDDO
263 !
264  IF(ncsize.GT.1) THEN
265  DO i=1,nsicla
266  masstot(i)=p_sum(masstot(i))
267  ENDDO
268  ENDIF
269 !!-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
270 !
271  RETURN
272  END
double precision, dimension(:,:), allocatable mass_sand_tot
Surface total mass of sand (kg/m2), for ilayer,ipoin.
subroutine bed1_update(ZR, ZF, VOLU2D)
Definition: bed1_update.f:7
double precision, dimension(:,:), allocatable mass_mix_tot
Surface total mass of sediments (kg/m2), for ilayer,ipoin.
Definition: bief.f:3