The TELEMAC-MASCARET system  trunk
api_instance_sis.f
Go to the documentation of this file.
1 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 !
5  MODULE api_instance_sis
6 !
8  USE bief
9  USE bief_def
11  IMPLICIT NONE
12 
13  PRIVATE
14 
15  PUBLIC :: create_instance_sis
16  PUBLIC :: delete_instance_sis
17  PUBLIC :: check_instance_sis
18  PUBLIC :: get_instance_error_sis
19  PUBLIC :: instance_sis
20  PUBLIC :: instance_list_sis
21 !
22  ! TYPE FOR API COUPLED CALL
23  TYPE telemac_cpl
24  INTEGER, POINTER :: loopcount, graphcount, listcount
25  INTEGER, POINTER :: nit
26  TYPE(bief_obj), POINTER :: u, v
27  TYPE(bief_obj), POINTER :: h, hn, hprop
28  TYPE(bief_obj), POINTER :: zf, uetcar, cf, ks
29  TYPE(api_cpl) :: sis_cpl
30  CHARACTER(LEN=24) :: code
31  INTEGER, POINTER :: pericou
32  INTEGER, POINTER :: compleo
33  TYPE(bief_obj), POINTER :: u3d, v3d
34  DOUBLE PRECISION :: t
35  DOUBLE PRECISION :: dt
36  TYPE(bief_obj), POINTER :: visc
37  TYPE(bief_obj), POINTER :: flbor,dm1
38  INTEGER :: solsys
39  TYPE(bief_obj), POINTER :: uconv, vconv, zconv
40  TYPE(bief_obj), POINTER :: thetaw, hw, tw, uw
41  LOGICAL :: yagout
42  END TYPE telemac_cpl
43 
44  TYPE instance_sis
45  ! RUN POSITION
46  INTEGER myposition
47  ! ERROR MESSAGE
48  CHARACTER(LEN=200) :: error_message
49  ! LIST OF ALL THE VARIABLE FOR MODEL
50  TYPE(bief_obj), POINTER :: q !FLOW RATE
51  TYPE(bief_obj), POINTER :: e !EVOLUTION
52  TYPE(bief_obj), POINTER :: tob !SHEAR STRESS
53  TYPE(bief_obj), POINTER :: z !FREE SURFACE ELEVATION
54  TYPE(bief_obj), POINTER :: zf !BOTTOM ELEVATION
55  TYPE(bief_obj), POINTER :: zf_c !EVOLUTION DUE TO BEDLOAD
56  ! LIST OF ALL THE IMPOSED VALUES AT THE BOUNDARY
57  TYPE(bief_obj), POINTER :: qbor !IMPOSED SOLID TRANSPORT
58  TYPE(bief_obj), POINTER :: ebor !
59  TYPE(bief_obj), POINTER :: cbor !IMPOSED CONCENTRATION
60  TYPE(bief_obj), POINTER :: flbor !
61 
62  TYPE(bief_obj), POINTER :: chestr !BOTTOM FRICTION COEFF
63  TYPE(bief_obj), POINTER :: flbor_sis !FLUX AT THE BOUNDARIES
64 !
65  TYPE(bief_mesh), POINTER :: mesh
66 !
67  TYPE(bief_obj), POINTER :: lihbor
68  TYPE(bief_obj), POINTER :: clu !MODIFIED LIUBOR
69  TYPE(bief_obj), POINTER :: clv !MODIFIED LIVBOR
70  TYPE(bief_obj), POINTER :: liqbor
71  TYPE(bief_obj), POINTER :: licbor !CL TYPE FOR CONCENTRATION
72  TYPE(bief_obj), POINTER :: liebor
73  TYPE(bief_obj), POINTER :: numliq !LIQUID BOUNDARY NUMBERING
74 !
75  INTEGER, POINTER :: nit !NUMBER OF ITERATIONS
76  INTEGER, POINTER :: lt !CURRENT ITERATION
77  DOUBLE PRECISION, POINTER :: dt !TIME STEP
78 !
79  !FILES
80  TYPE(bief_file), POINTER :: sis_files(:)
81  INTEGER :: maxlu_sis !MAX RANK OF LOGIAL UNITS
82  INTEGER, POINTER :: sisres
83  INTEGER, POINTER :: sisgeo
84  INTEGER, POINTER :: siscli
85  !OTHER SIMULATION PARAMETES
86 
87  !PARAMETERS OF INTEREST FOR UNCERTAINTY SUDY
88  DOUBLE PRECISION, POINTER :: d50(:) !MEAN SEDIMENT DIAMETER
89  DOUBLE PRECISION, POINTER :: cbor_classe(:) !IMPOSED CONCENTRATION IN CASFILE
90  DOUBLE PRECISION, POINTER :: mpm !MEYER-PETER AND MULLER COEFFICIENT
91  DOUBLE PRECISION, POINTER :: partheniades ! PARTHENIADES CONSTANT
92  TYPE(bief_obj), POINTER :: mpm_aray !MPM COEFFICIENT
93  DOUBLE PRECISION, POINTER :: ac(:) !CRITICAL SHIELDS PARAMETER
94  DOUBLE PRECISION, POINTER :: xwc(:) ! SETTLING VELOCITY
95  DOUBLE PRECISION, POINTER :: xkv !COEFFICIENT FUNCTION OF THE POROSITY
96  DOUBLE PRECISION, POINTER :: csf_sable !1 - POROSITY
97  DOUBLE PRECISION, POINTER :: kspratio ! SKIN FRICTION / MEAN DIAMETER
98  DOUBLE PRECISION, POINTER :: phised ! FRICTION ANGLE OF THE SEDIMENT
99  DOUBLE PRECISION, POINTER :: beta2 ! PARAMETER FOR DEVIATION
100  DOUBLE PRECISION, POINTER :: alpha ! SECONDARY CURRENTS COEFFICIENT
101  TYPE(bief_obj), POINTER :: cs ! CONCENTRATION AT TIME N
102  INTEGER, POINTER :: nsicla ! NUMBER OF SIZE-CLASSES OF BED MATERIAL
104  INTEGER :: nbmaxnshare
105  INTEGER, POINTER :: nptir
106 
107 !
108  !VARIABLES FOR SISYPHE CALL, NECESSARY FOR THE COUPLING
109  TYPE(telemac_cpl) :: tel
111  LOGICAL :: cpl_t2d_sis
113  END TYPE
114 
115 !!!!!!!!!!!!!!!!!!!!!!!!!!!!MODULE BEGINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
116  INTEGER, PARAMETER :: max_instances=10
117  TYPE(instance_sis), POINTER :: instance_list_sis(:)
118  LOGICAL, ALLOCATABLE :: used_instance(:)
119 !
120  CONTAINS
121 !
122  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
124  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
128  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
129  SUBROUTINE create_instance_sis(ID,IERR)
130  ! initialise instance for sysiphe
131  INTEGER, INTENT(OUT) :: ID
132  INTEGER, INTENT(OUT) :: IERR
133 !
134  INTEGER :: I
135  id = 0
136  ierr = 0
137  ! If first time creating an instance allocating the instance array
138  IF(.NOT. ALLOCATED(used_instance)) THEN
139  ALLOCATE(used_instance(max_instances),stat=ierr)
140  IF(ierr.NE.0) THEN
141  err_mess = 'ERROR WHILE ALLOCATING USED INSTANCE ARRAY'
142  RETURN
143  ENDIF
144  used_instance = .false.
145  ALLOCATE(instance_list_sis(max_instances),stat=ierr)
146  IF(ierr.NE.0) THEN
147  err_mess = 'ERROR WHILE ALLOCATING INSTANCE ARRAY'
148  RETURN
149  ENDIF
150  ENDIF
151 !
152  ! look for the first instance available
153  i = 1
154  DO WHILE(used_instance(i).AND.i.LE.max_instances)
155  i = i + 1
156  ENDDO
157  id = i
158  used_instance(id) = .true.
159 !
160  ! if still equals 0 no available instance was found then we crash
161  IF(id.EQ.(max_instances+1))THEN
162  ierr = max_instance_error
163  err_mess = "MAX INSTANCE REACHED "
164  RETURN
165  ENDIF
166 !
167  instance_list_sis(id)%CPL_T2D_SIS = .false.
168  CALL update_instance_sis(id, ierr)
169  instance_list_sis(id)%TEL%SIS_CPL%NSIS_CFD = 1
170  instance_list_sis(id)%TEL%SIS_CPL%SISYPHE_CFD = .false.
171  instance_list_sis(id)%TEL%SIS_CPL%CONSTFLOW = .false.
172  instance_list_sis(id)%TEL%SIS_CPL%CHARR = .false.
173  instance_list_sis(id)%TEL%SIS_CPL%SUSP = .false.
174  instance_list_sis(id)%TEL%CODE = 'SISYPHE '
175  instance_list_sis(id)%MYPOSITION = no_position
176  instance_list_sis(id)%TEL%T = 0.d0
177  instance_list_sis(id)%TEL%SOLSYS = 1 !Not existant in sisyphe
178 
179  END SUBROUTINE create_instance_sis
180  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
182  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
186  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
187  SUBROUTINE update_instance_sis(ID,IERR)
188  ! initialise instance for sisyphe
189  INTEGER, INTENT(IN) :: ID
190  INTEGER, INTENT(OUT) :: IERR
191 
192  ierr = 0
193  instance_list_sis(id)%Q => q
194  instance_list_sis(id)%E => e
195  instance_list_sis(id)%TOB => tob
196  instance_list_sis(id)%Z => z
197  instance_list_sis(id)%ZF => zf
198  instance_list_sis(id)%ZF_C => zf_c
199  instance_list_sis(id)%QBOR => qbor
200  instance_list_sis(id)%EBOR => ebor
201  instance_list_sis(id)%CBOR => cbor
202  instance_list_sis(id)%FLBOR => flbor
203  instance_list_sis(id)%CHESTR => chestr
204  instance_list_sis(id)%FLBOR_SIS => flbor_sis
205  instance_list_sis(id)%MESH => mesh
206  instance_list_sis(id)%LIHBOR => lihbor
207  instance_list_sis(id)%CLU => clu
208  instance_list_sis(id)%CLV => clv
209  instance_list_sis(id)%CS => cs
210  instance_list_sis(id)%LIQBOR => liqbor
211  instance_list_sis(id)%LICBOR => licbor
212  instance_list_sis(id)%LIEBOR => liebor
213  instance_list_sis(id)%NUMLIQ => numliq
214  instance_list_sis(id)%NIT => npas
215  instance_list_sis(id)%LT => lt
216  instance_list_sis(id)%DT => delt
217  instance_list_sis(id)%SIS_FILES => sis_files
218  instance_list_sis(id)%MAXLU_SIS = maxlu_sis
219  instance_list_sis(id)%SISRES => sisres
220  instance_list_sis(id)%SISGEO => sisgeo
221  instance_list_sis(id)%SISCLI => siscli
222  !Incertainty variables
223  instance_list_sis(id)%D50 => fdm
224  instance_list_sis(id)%CBOR_CLASSE => cbor_classe
225  instance_list_sis(id)%MPM => mpm
226  instance_list_sis(id)%PARTHENIADES=> partheniades
227  instance_list_sis(id)%MPM_ARAY => mpm_aray
228  instance_list_sis(id)%AC => ac
229  instance_list_sis(id)%XWC => xwc
230  instance_list_sis(id)%XKV => xkv
231  instance_list_sis(id)%CSF_SABLE => csf_sable
232  instance_list_sis(id)%KSPRATIO => kspratio
233  instance_list_sis(id)%PHISED => phised
234  instance_list_sis(id)%BETA2 => beta2
235  instance_list_sis(id)%ALPHA => alpha
236  instance_list_sis(id)%NSICLA => nsicla
237 
238  instance_list_sis(id)%NPTIR => nptir
239  instance_list_sis(id)%NBMAXNSHARE = nbmaxnshare
240  ! <new_link>
241 
242  ! INITIALISATIONS POUR UN CAS SANS COUPLAGE
243  IF(.NOT.instance_list_sis(id)%CPL_T2D_SIS) THEN
244 
245  instance_list_sis(id)%TEL%LOOPCOUNT => lt
246  instance_list_sis(id)%TEL%GRAPHCOUNT => leopr
247  instance_list_sis(id)%TEL%LISTCOUNT => lispr
248  instance_list_sis(id)%TEL%NIT => npas
249  instance_list_sis(id)%TEL%COMPLEO => lt
250  instance_list_sis(id)%TEL%YAGOUT = .false.
251  instance_list_sis(id)%TEL%U => t1
252  instance_list_sis(id)%TEL%V => t1
253  instance_list_sis(id)%TEL%H => t1
254  instance_list_sis(id)%TEL%HN => t1
255  instance_list_sis(id)%TEL%HPROP => t1
256  instance_list_sis(id)%TEL%ZF => t1
257  instance_list_sis(id)%TEL%UETCAR => t1
258  instance_list_sis(id)%TEL%CF => t1
259  instance_list_sis(id)%TEL%KS => t1
260  instance_list_sis(id)%TEL%PERICOU => percou
261  instance_list_sis(id)%TEL%U3D => t1
262  instance_list_sis(id)%TEL%V3D => t1
263  instance_list_sis(id)%TEL%VISC => t1
264  instance_list_sis(id)%TEL%DT = delt
265  instance_list_sis(id)%TEL%FLBOR => t1
266  instance_list_sis(id)%TEL%DM1 => t1
267  instance_list_sis(id)%TEL%UCONV => t1
268  instance_list_sis(id)%TEL%VCONV => t1
269  instance_list_sis(id)%TEL%ZCONV => t1
270  instance_list_sis(id)%TEL%THETAW => t1
271  instance_list_sis(id)%TEL%HW => t1
272  instance_list_sis(id)%TEL%TW => t1
273  instance_list_sis(id)%TEL%UW => t1
274 
275  ENDIF
276 !
277  END SUBROUTINE update_instance_sis
278 !
279  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
281  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
285  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
286  SUBROUTINE delete_instance_sis(ID,IERR)
287  INTEGER, INTENT(IN) :: ID
288  INTEGER, INTENT(OUT) :: IERR
289 !
290  ierr = 0
291  !
292  CALL check_instance_sis(id,ierr)
293  IF(ierr.NE.0) RETURN
294  used_instance(id) = .false.
295  END SUBROUTINE delete_instance_sis
296 
297  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
299  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
303  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
304  SUBROUTINE check_instance_sis(ID,IERR)
305  INTEGER, INTENT(IN) :: ID
306  INTEGER, INTENT(OUT) :: IERR
307 !
308  ierr = 0
309  IF(id.LE.0 .OR. id.GT.max_instances) THEN
311  err_mess = 'INVALID INSTANCE NUMBER'
312  RETURN
313  ENDIF
314  IF(.NOT.used_instance(id)) THEN
315  ierr = unused_instance_error
316  err_mess = 'INSTANCE NUMBER WAS NOT CREATED'
317  RETURN
318  ENDIF
319  CALL update_instance_sis(id, ierr)
320  END SUBROUTINE check_instance_sis
321 
322 !
323  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
325  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
328  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
329  SUBROUTINE get_instance_error_sis(ID,MESS)
330  INTEGER, INTENT(IN) :: ID
331  CHARACTER(LEN=200), INTENT(OUT) :: MESS
332 !
333  mess = instance_list_sis(id)%ERROR_MESSAGE
334 !
335  END SUBROUTINE get_instance_error_sis
336  END MODULE api_instance_sis
337 
type(bief_obj), target thetaw
double precision, dimension(:), allocatable, target cbor_classe
type(instance_sis), dimension(:), pointer, public instance_list_sis
type(bief_obj), target numliq
double precision, target phised
type(bief_obj), target vconv
type(bief_obj), target e
type(bief_obj), target licbor
type(bief_obj), target ks
double precision, target xkv
subroutine, public delete_instance_sis(ID, IERR)
type(bief_obj), target zf_c
type(bief_obj), target hprop
integer, target nptir
Definition: bief_def.f:48
type(bief_obj), target uconv
logical, dimension(:), allocatable used_instance
type(bief_obj), target clu
type(bief_obj), target ebor
double precision, dimension(nsiclm), target xwc
type(bief_obj), target zf
type(bief_obj), target cbor
integer, parameter max_instance_error
type(bief_obj), target cs
type(bief_obj), target flbor_sis
double precision, target partheniades
subroutine update_instance_sis(ID, IERR)
type(bief_obj), target lihbor
double precision, target dt
double precision, target delt
integer, parameter maxlu_sis
type(bief_obj), target mpm_aray
type(bief_obj), target liebor
type(bief_obj), target tw
type(bief_obj), pointer t1
integer, parameter no_position
integer, parameter max_instances
subroutine, public create_instance_sis(ID, IERR)
type(bief_obj), target cf
double precision, dimension(nsiclm), target fdm
type(bief_obj), target hw
type(bief_obj), target qbor
type(bief_obj), target q
type(bief_obj), target z
integer, parameter invalid_instance_num_error
type(bief_obj), target liqbor
type(bief_obj), target chestr
integer, parameter nbmaxnshare
Definition: bief_def.f:52
type(bief_obj), target clv
double precision, target kspratio
type(bief_obj), target hn
double precision, target alpha
subroutine, public check_instance_sis(ID, IERR)
character(len=error_mess_len) err_mess
Error message.
type(bief_obj), target tob
type(bief_obj), target flbor
type(bief_mesh), target mesh
type(bief_obj), target uw
integer, parameter unused_instance_error
double precision, target beta2
double precision, dimension(nsiclm), target ac
double precision, target mpm
double precision, target csf_sable
type(bief_file), dimension(maxlu_sis), target sis_files
subroutine, public get_instance_error_sis(ID, MESS)
Definition: bief.f:3