The TELEMAC-MASCARET system  trunk
cvsp_check_mass_bilan_gaia.f
Go to the documentation of this file.
1 ! *************************************
3 ! *************************************
4 !
5 !
6 !***********************************************************************
7 ! GAIA V8P1 25/02/2019
8 !***********************************************************************
9 !
11 !
12 !
16 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 
20 !
22  USE interface_parallel, ONLY : p_dsum
23 
24  IMPLICIT NONE
25 
26  INTEGER I,K,J,IFRLIQ,IPTFR
27  DOUBLE PRECISION KORR, VCUMUCL_ACT,FLUXTCLA,VOLNESTORCL
28  DOUBLE PRECISION VCUMUCL
29  LOGICAL RET, CVSP_CHECK_F_GAIA
30 !
31 ! CALCULATING TOTAL VOLUME PER CLASS
32  DO i=1,nsicla
33  voltot(i) = 0.d0
34  DO j=1,npoin
35  DO k=1,pro_max(j)-1
36  voltot(i) = voltot(i) + (pro_f(j,k,i)+pro_f(j,k+1,i))/2.d0
37  & *(pro_d(j,k+1,i)-pro_d(j,k,i))*volu2d%R(j)
38  ENDDO
39  END DO
40  END DO
41  IF(ncsize.GT.1) THEN
42  DO i=1,nsicla
43  voltot(i) = p_dsum(voltot(i))
44  ENDDO
45  ENDIF
46 !
47  DO i = 1,nsicla
48 !
49 ! COMPUTES THE FREE FLUXES BY CLASS
50 !
51  fluxtcla=0.d0
52  IF(nfrliq.GT.0.AND.charr) THEN
53  IF(nptfr.GT.0) THEN
54  DO iptfr=1,nptfr
55  ifrliq=numliq%I(iptfr)
56  IF(ifrliq.GT.0) THEN
57  fluxtcla=fluxtcla+flbcla%ADR(i)%P%R(iptfr)
58  ENDIF
59  ENDDO
60  ENDIF
61  IF(ncsize.GT.1) fluxtcla=p_dsum(fluxtcla)
62  ENDIF
63 !
64 ! CALCULATING VOLUME OVER OPEN BOUNDARY
65  vcumucl_act = - fluxtcla*dt/(1.d0-xkv0(1))
66 !
67 ! CORRECTING
68  korr = 0.d0
69 ! CONVERTING MASS NESTOR TO VOLUME NESTOR
70  volnestorcl = massnestor(i)*mpa2t(i)
71 ! CONVERTING MASS OVER BOUNDARIES (KG/S)*DT TO VOLUME
72  vcumucl = mcumucla(i)*mpa2t(i)*dt
73 ! CONVERTING INITIAL MASS TO VOLUME
74 ! VOLINI = MASS0TOT(I)*MPA2T(I)
75 ! USING THE INITIAL MASS FROM CVSP_INIT_GAIA AND NOT CONVERTING FROM THE MASSES
76  IF(abs(volini(i)+vcumucl+vcumucl_act+volnestorcl-
77  & voltot(i)).GT.1.d-13) THEN
78  korr = voltot(i) / (volini(i)+vcumucl+vcumucl_act
79  & +volnestorcl)
80  ENDIF
81  IF(korr.GT.0.d0) THEN
82  DO j=1,npoin
83  DO k = 1, pro_max(j)
84  pro_f(j,k,i) = pro_f(j,k,i)/korr
85  ENDDO
86  ENDDO
87  ENDIF
88  END DO ! I=1,NSICLA
89 !
90 ! ADDITIONAL CHECK FOR PRO_F
91  DO j=1,npoin
92  DO k = 1, pro_max(j)
93  ret = cvsp_check_f_gaia(j,k,'check_mass: ')
94  ENDDO
95  END DO
96 !
97  RETURN
98  END SUBROUTINE
integer, pointer nptfr
Number of boundary points.
type(bief_obj), target volu2d
Integral of bases.
double precision, target dt
Time step It may be different from the one in TELEMAC because of the morphological factor...
type(bief_obj), target numliq
Liquid boundary numbering.
subroutine cvsp_check_mass_bilan_gaia
double precision, dimension(nsiclm) massnestor
Sediment mass from Nestor per class per time step.
double precision, dimension(nsiclm) voltot
Total volume of sediment of each class.
integer, target nsicla
Number of sediment classes of bed material (less than NISCLM)
double precision, dimension(:,:,:), allocatable, target pro_f
Vertical sorting profile: fraction for each layer, class, point.
double precision, dimension(nlaymax), target xkv0
Initial porosity by layers.
double precision function p_dsum(MYPART)
Definition: p_dsum.F:7
double precision, dimension(:,:,:), allocatable, target pro_d
Vertical sorting profile: depth for each layer, class, point.
double precision, dimension(:), allocatable, target mpa2t
conversion mass per area to thickness
integer, dimension(:), allocatable pro_max
Maximum layer number in a vertical sorting profile for each point.
logical, target charr
Include bedload in the simulation.
double precision, dimension(:), allocatable mcumucla
cumulated mass through bedload boundary per class per time step (kg/s)
integer nfrliq
Number of liquid boundaries.
double precision, dimension(nsiclm) volini
Initial volume of sediment of each class for CVSM.
integer, pointer npoin
Number of 2d points in the mesh.
type(bief_obj), target flbcla
Fluxes at boundary for every class.