The TELEMAC-MASCARET system  trunk
cvsp_init_gaia.f
Go to the documentation of this file.
1 ! *************************
2  SUBROUTINE cvsp_init_gaia
3 ! *************************
4 !
5 !***********************************************************************
6 ! GAIA V8P1 16/05/2017
7 !***********************************************************************
8 !
10 ! OR USER CODING
11 !
15 !
20 !
25 !
30 !
31 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33 !
35  USE cvsp_outputfiles_gaia, ONLY: cp
36  USE interface_parallel, ONLY : p_dsum
38 !
39  IMPLICIT NONE
40 !
41  INTEGER I,J,K,L,M,ICLA
42  DOUBLE PRECISION DEPTH
43  LOGICAL RET
44 !
45 !-----------------------------------------------------------------------
46 !
47  cp = .true.
48  IF(cp) WRITE(lu,*) 'CVSP_INIT_GAIA'
49 
50 ! !==== conversion of mass to thickness and fraction =============!
51  DO icla = 1,nsicla ! convert for layer-1 for each sand class,
52  DO k=1,nomblay
53  DO i = 1,npoin
54  IF(es(i,k).GT.0.d0) THEN
55  avail(i,k,icla)
56  & = mass_sand(icla,k,i) * mpa2t(icla) / es(i,k) ! mass to fraction
57  ELSE
58  avail(i,k,icla) = 0.d0
59  ENDIF
60  ENDDO
61  ENDDO
62  ENDDO
63 !
64  DO j=1,npoin
65  DO k=1,nomblay
66  ret = cvsp_check_l_gaia(j,k,' CVSP_INIT_GAIA: ')
67  ENDDO
68  ENDDO
69 !
70  ALLOCATE(pro_d(npoin,pro_max_max,nsicla))
71  ALLOCATE(pro_f(npoin,pro_max_max,nsicla))
72  ALLOCATE(pro_max(npoin))
73 
74  DO j=1,npoin
75  DO k=1,pro_max_max
76  DO i=1,nsicla
77  pro_d(j,k,i) = zf%R(j)
78  pro_f(j,k,i) = 0.d0
79  ENDDO
80  ENDDO
81  ENDDO
82 !
83 !-----------------------------------------------------------------------
84 !
85  DO j=1,npoin
86  depth = 0.d0 ! INIT DEPTH OF THE VSP
87 ! NLAYER IS NOT DEFINED
88  nlayer%I(j) = nomblay
89  pro_max(j) = 2* nlayer%I(j) ! 2 SECTION POINTS PER LAYER
90  l = pro_max(j)
91 !
92  DO i=1,nsicla
93  pro_d(j,l,i) = zf%R(j)
94  pro_f(j,l,i) = avail(j,1,i)
95  ENDDO
96 !
97 !-----------------------------------------------------------------------
98 ! BUILDING SECTIONS
99 !-----------------------------------------------------------------------
100 !
101  DO m=1,nlayer%I(j) - 1
102  depth = depth + es(j,m)
103  l = l - 1
104  DO i=1,nsicla
105  pro_d(j,l,i) = zf%R(j) - depth
106  pro_f(j,l,i) = avail(j,m,i)
107  ENDDO
108  l = l - 1
109  DO i=1,nsicla
110  pro_d(j,l,i) = zf%R(j) - depth
111  pro_f(j,l,i) = avail(j,m+1,i)
112  ENDDO
113  ENDDO
114 !
115 !-----------------------------------------------------------------------
116 ! BOTTOM / RIGID BED
117 !-----------------------------------------------------------------------
118 !
119  l = l - 1
120  DO i=1,nsicla
121  pro_d(j,l,i) = zr%R(j)
122  pro_f(j,l,i) = avail(j,nlayer%I(j),i)
123  ENDDO
124 !
125  CALL cvsp_compress_dp_gaia(j,1.d-5)
126 !
127 !-----------------------------------------------------------------------
128 ! USER CODING
129 !-----------------------------------------------------------------------
130 ! PRO_MAX(J) = PRO_MAX_MAX
131 ! DO K=1,PRO_MAX(J)
132 ! DO I=1,NSICLA
133 ! PRO_D(J,K,I) = (ZF%R(J)-ZF%R(J))/PRO_MAX(J)*K
134 ! PRO_F(J,K,1) = 1.D0 / NSICLA
135 ! ENDDO
136 !-----------------------------------------------------------------------
137 ! FINAL CHECKS
138 !-----------------------------------------------------------------------
139  IF (abs(zf%R(j) - zr%R(j) - depth).GT.10.d-6) THEN
140  WRITE(lu,*)'Depth Synchro Error for Point J: ',j
141  WRITE(lu,*)zf%R(j),zr%R(j),depth,abs(zf%R(j)-zr%R(j)-depth)
142  ENDIF
143 !
144  ENDDO !J=1,NPOIN
145 !-----------------------------------------------------------------------
146  DO j=1,npoin
147  DO l=1,pro_max(j)
148  ret = cvsp_check_f_gaia(j,l,'AfterLAY: ')
149  END DO
150  CALL cvsp_check_steady_gaia(j)
151  END DO
152 
153 !-----------------------------------------------------------------------
155 
156 !INITIALISIATION OUTPUT TO SERAFIN FILE
159 !
160 ! CALCULATING THE VOLUME SEEN FROM CVSM MODEL
161  DO i = 1, nsicla
162  voltot(i) = 0.d0
163  ENDDO
164 !
165  DO i=1,nsicla
166  DO j=1,npoin
167  DO k=1,pro_max(j)-1
168  voltot(i) = voltot(i) + (pro_f(j,k,i)+pro_f(j,k+1,i))/2.d0
169  & *(pro_d(j,k+1,i)-pro_d(j,k,i))*volu2d%R(j)
170  ENDDO
171  ENDDO
172  ENDDO
173  IF(ncsize.GT.1) THEN
174  DO i=1,nsicla
175  voltot(i) = p_dsum(voltot(i))
176  ENDDO
177  ENDIF
178 ! NO MASS BALANCE FOR THE CURRENT STATE
179  DO i=1,nsicla
180  volini(i) = voltot(i)
181  ENDDO
182 !
183  RETURN
184  END SUBROUTINE cvsp_init_gaia
recursive logical function cvsp_check_l_gaia(J, K, SOMETEXT)
subroutine cvsp_check_anything_gaia
type(bief_obj), target nlayer
Number of layers for each point.
integer, target nomblay
Number of bed load model layers = NUMSTRAT+1 to take the active layer into account.
type(bief_obj), target zr
Non erodable (rigid) bottom elevation.
type(bief_obj), target volu2d
Integral of bases.
double precision, dimension(:,:), allocatable, target es
Layer thicknesses as double precision.
subroutine cvsp_check_steady_gaia(J)
double precision, dimension(:,:,:), allocatable, target mass_sand
Surface mass of sand (kg/m2), for isand,ilayer,ipoin.
subroutine cvsp_output_init_gaia
logical cvsm_out_full
C-VSM_FULL WRITES OUT (OR NOT) EVER.
logical cp
Logical for debug printouts.
subroutine cvsp_compress_dp_gaia(J, THRESHOLD)
double precision, dimension(nsiclm) voltot
Total volume of sediment of each class.
subroutine cvsp_init_gaia
Definition: cvsp_init_gaia.f:4
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 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.
recursive logical function cvsp_check_f_gaia(J, K, SOMETEXT)
integer pro_max_max
Maximum Number of Profile SECTIONS.
type(bief_obj), target zf
Bottom elevation.
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.
double precision, dimension(:,:,:), allocatable, target avail
Sediment fraction for each layer, class, point.
subroutine cvsp_write_profile_gaia
double precision, dimension(nsiclm) volini
Initial volume of sediment of each class for CVSM.
integer, pointer npoin
Number of 2d points in the mesh.