The TELEMAC-MASCARET system  trunk
api_run_t3d.f
Go to the documentation of this file.
1 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 !
5  MODULE api_run_t3d
6 !
7  USE bief !, ONLY : BIEF_OPEN_FILES, BIEF_INIT, INCLUS
11  USE interface_telemac3d !, ONLY : TELEMAC3D, LECDON_TELEMAC3D
12  USE declarations_parallel, ONLY : comm
16  USE interface_gaia
17 !
19 
20  IMPLICIT NONE
21  PRIVATE
22  ! COMMON VALUES TO DEFINE OUTPUT + LANGUAGE
23 !
24  INTEGER tdeb(8),tfin(8),ncar,nit_ori
25  DOUBLE PRECISION :: dt_ori
26 !
27  CHARACTER(LEN=24), PARAMETER :: code1='TELEMAC3D '
28  CHARACTER(LEN=24), PARAMETER :: code2='SISYPHE '
29  CHARACTER(LEN=24), PARAMETER :: code3='TOMAWAC '
30  CHARACTER(LEN=24), PARAMETER :: code4='WAQTEL '
31  CHARACTER(LEN=24), PARAMETER :: code5='GAIA '
32 !
33  CHARACTER(LEN=MAXLENTMPDIR) path
34 
35  LOGICAL :: gaia_cpl, waq_cpl
36 
37 !
38 ! List the public subroutines
39 !
40  PUBLIC :: run_set_config_t3d_d
41  PUBLIC :: run_read_case_t3d_d
42  PUBLIC :: run_allocation_t3d_d
43  PUBLIC :: run_init_t3d_d
44  PUBLIC :: run_timestep_t3d_d
45  PUBLIC :: run_finalize_t3d_d
46 
47  CONTAINS
48  ! SET THE LU AND LNG VALUES
49  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
51  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60  SUBROUTINE run_set_config_t3d_d(INST, U_LU, U_LNG, U_COMM,
61  & U_STD_OUTPUT, IERR)
62  TYPE(instance_t3d), INTENT(INOUT) :: inst
63  INTEGER, INTENT(IN) :: U_LU, U_LNG, U_COMM
64  LOGICAL, INTENT(IN) :: U_STD_OUTPUT
65  INTEGER, INTENT(OUT) :: IERR
66 !
67  ierr = 0
68 !
69  lu = u_lu
70  lng = u_lng
71  comm = u_comm
72  std_output = u_std_output
73 !
74  END SUBROUTINE run_set_config_t3d_d
75 !
76 !!!!!!! FUNCTION HANDLING THE EXECUTION OF THE SIMULATION
77 !
78  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
91  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92  SUBROUTINE run_read_case_t3d_d(INST,CAS_FILE, DICO_FILE,INIT,IERR,
93  & WAQ_CAS_FILE,WAQ_DICO_FILE,
94  & GAIA_CAS_FILE,GAIA_DICO_FILE)
95 
96  TYPE(instance_t3d), INTENT(INOUT) :: INST
97  CHARACTER(LEN=250), INTENT(IN) :: CAS_FILE
98  CHARACTER(LEN=250), INTENT(IN) :: DICO_FILE
99  LOGICAL, INTENT(IN) :: INIT
100  INTEGER, INTENT(OUT) :: IERR
101  CHARACTER(LEN=250), INTENT(IN) :: GAIA_CAS_FILE
102  CHARACTER(LEN=250), INTENT(IN) :: GAIA_DICO_FILE
103  CHARACTER(LEN=250), INTENT(IN) :: WAQ_CAS_FILE
104  CHARACTER(LEN=250), INTENT(IN) :: WAQ_DICO_FILE
105 !
106  CHARACTER(LEN=250) MOTCAR(inst%maxkeyword)
107  CHARACTER(LEN=250) FILE_DESC(4,inst%maxkeyword)
108 
109 !
110  ierr = 0
111 !
112  CALL bief_init(path,ncar,init)
113 !
114 ! INITIAL TIME FOR COMPUTATION DURATION
115 !
116  CALL date_and_time(values=tdeb)
117 !
118 ! PRINTS BANNER TO LISTING
119 !
120  CALL print_header(code1,' ')
121 !
122 !-----------------------------------------------------------------------
123 !
124 ! READS THE STEERING FILE
125  CALL lecdon_telemac3d(motcar,file_desc,
126  & path,ncar,
127  & cas_file,dico_file,
128  & gaia_cas_file=gaia_cas_file,
129  & gaia_dico_file=gaia_dico_file)
130 
131  gaia_cpl = inclus(inst%COUPLING,'GAIA')
132  waq_cpl = inclus(inst%COUPLING,'WAQTEL')
133 
134  ! Gaia coupling
135  IF(gaia_cpl) THEN
136 !
137  IF ((gaia_cas_file(1:1).EQ.' ').OR.
138  & (gaia_dico_file(1:1).EQ.' ')) THEN
139  ierr = file_not_found_error
140  err_mess = 'THE COUPLING CAS AND DICO FILES ARE MISSING FOR'
141  & //trim(code4)
142  RETURN
143  ENDIF
144 !
145  CALL print_header(code5,code1)
146 !
147  CALL lecdon_gaia(motcar,file_desc,path,ncar,code1,
148  & gaia_cas_file, gaia_dico_file)
149 !
150  ENDIF
151 
152  ! Waqtel coupling
153  IF(waq_cpl) THEN
154 !
155  IF ((waq_cas_file(1:1).EQ.' ').OR.
156  & (waq_dico_file(1:1).EQ.' ')) THEN
157  ierr = file_not_found_error
158  err_mess = 'THE COUPLING CAS AND DICO FILES ARE MISSING FOR'
159  & //trim(code4)
160  RETURN
161  ENDIF
162 
163  CALL print_header(code4,code1)
164 !
165  CALL lecdon_waqtel(file_desc,path,ncar,
166  & waq_cas_file,waq_dico_file)
167 !
168  ENDIF
169 !
170 !-----------------------------------------------------------------------
171 !
172  END SUBROUTINE run_read_case_t3d_d
173 !
174  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
180  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
181  SUBROUTINE run_allocation_t3d_d(INST,IERR)
182  TYPE(instance_t3d), INTENT(INOUT) :: INST
183  INTEGER, INTENT(OUT) :: IERR
184 !
185  INTEGER :: IFLOT
186 !
187 ! OPENS THE FILES FOR TELEMAC3D
188 !
189  ierr = 0
190 !
191  iflot = 0
192 !
193  CALL bief_open_files(code1,inst%T3D_FILES,
194  & inst%MAXLU_T3D,
195  & path,ncar,
196  & 1,.true.)
197 !
198 !-----------------------------------------------------------------------
199 !
200 ! ALLOCATES MEMORY
201 !
202  CALL point_telemac3d
203 !
204 !-----------------------------------------------------------------------
205 !
206 ! INITIALISES GAIA
207 !
208  IF(gaia_cpl) THEN
209 !
210  CALL bief_open_files(code5,inst%GAI_FILES,inst%MAXLU_GAI,
211  & path,ncar,2,.true.)
212 !
213  CALL config_code(1)
214 !
215 ! MEMORY ORGANISATION
216 !
217  CALL point_gaia
218 !
219  ENDIF
220 !
221 !-----------------------------------------------------------------------
222 !
223 ! INITIALISES WAQTEL
224 !
225  IF(waq_cpl) THEN
226 !
227  CALL bief_open_files(code4,inst%WAQ_FILES,inst%MAXLU_WAQ,path,
228  & ncar,4,.true.)
229 !
230  CALL config_code(1)
231 !
232 ! MEMORY ORGANISATION
233 !
235 !
236  ENDIF
237 !
238 !-----------------------------------------------------------------------
239 !
240 !
241  END SUBROUTINE run_allocation_t3d_d
242 !
243  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
245  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
249  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
250  SUBROUTINE run_init_t3d_d(INST,IERR)
251 !
252  TYPE(instance_t3d), INTENT(INOUT) :: INST
253  INTEGER, INTENT(OUT) :: IERR
254 !
255  ierr = 0
256 !
257  nit_ori = inst%NIT
258  dt_ori = inst%DT
259  CALL telemac3d(pass=0,nit_ori=nit_ori)
260 !
261  END SUBROUTINE run_init_t3d_d
262 !
263  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
265  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
269  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
270  SUBROUTINE run_timestep_t3d_d(INST,IERR)
271 !
272  TYPE(instance_t3d), INTENT(INOUT) :: INST
273  INTEGER, INTENT(OUT) :: IERR
274 !
275  ierr = 0
276 !
277  inst%NIT = inst%LT
278  CALL telemac3d(pass=1,nit_ori=nit_ori)
279  END SUBROUTINE run_timestep_t3d_d
280 !
281  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
283  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
287  !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
288 !
289  SUBROUTINE run_finalize_t3d_d(INST,IERR)
290 !
291  TYPE(instance_t3d), INTENT(INOUT) :: INST
292  INTEGER, INTENT(OUT) :: IERR
293 !
294  ierr = 0
295 !
296  CALL bief_close_files(inst%T3D_FILES,
297  & inst%MAXLU_T3D,.false.)
298 
299  IF(waq_cpl) THEN
300  CALL config_code(4)
301  CALL bief_close_files(inst%WAQ_FILES,
302  & inst%MAXLU_WAQ,.false.)
303  CALL deall_waqtel
304  ENDIF
305  !
306  IF(gaia_cpl) THEN
307  CALL config_code(5)
308  CALL bief_close_files(inst%GAI_FILES,
309  & inst%MAXLU_GAI,.false.)
310  CALL deall_gaia
311  ENDIF
312 !
313 ! DEALLOCATE ALL OF BIEF AND TELEMAC3D ARRAYS
314  CALL deall_telemac3d()
315  CALL deall_bief()
316 !
317  WRITE(lu,11)
318 11 FORMAT(1x,///,1x,'CORRECT END OF RUN',///)
319 !
320 ! TIME OF END OF COMPUTATION
321 !
322  CALL date_and_time(values=tfin)
323  CALL elapse(tdeb,tfin)
324  ! Closing log files
325  IF(ipid.NE.0) THEN
326  CLOSE(lu)
327  ELSE
328  IF(.NOT.std_output) CLOSE(lu)
329  ENDIF
330 !
331  END SUBROUTINE run_finalize_t3d_d
332 !
333  END MODULE api_run_t3d
character(len=maxlentmpdir) path
Definition: api_run_t3d.f:34
subroutine bief_init(CHAINE, NCAR, PINIT)
Definition: bief_init.f:7
subroutine, public run_allocation_t3d_d(INST, IERR)
Definition: api_run_t3d.f:183
integer, parameter file_not_found_error
type(bief_mesh), target mesh2d
subroutine, public run_timestep_t3d_d(INST, IERR)
Definition: api_run_t3d.f:272
logical gaia_cpl
Definition: api_run_t3d.f:36
subroutine lecdon_waqtel(FILE_DESC, PATH, NCAR, CAS_FILE, DICO_FILE)
Definition: lecdon_waqtel.f:7
subroutine point_gaia
Definition: point_gaia.f:4
subroutine point_telemac3d
integer, parameter maxkeyword
character(len=24), parameter code4
Definition: api_run_t3d.f:31
integer ncar
Definition: api_run_t3d.f:25
character(len=24), parameter code1
Definition: api_run_t3d.f:28
subroutine elapse(TDEB, TFIN)
Definition: elapse.f:7
subroutine lecdon_gaia(MOTCAR, FILE_DESC, PATH, NCAR, CODE, CAS_FILE, DICO_FILE)
Definition: lecdon_gaia.f:7
subroutine, public run_init_t3d_d(INST, IERR)
Definition: api_run_t3d.f:252
logical function inclus(C1, C2)
Definition: inclus.f:7
character(len=24), parameter code3
Definition: api_run_t3d.f:30
integer nit_ori
Definition: api_run_t3d.f:25
subroutine, public run_finalize_t3d_d(INST, IERR)
Definition: api_run_t3d.f:291
integer, dimension(8) tfin
Definition: api_run_t3d.f:25
subroutine deall_telemac3d
subroutine config_code(ICODE)
Definition: config_code.f:7
subroutine point_waqtel(MESH2D, IELM1, MESH3D, IELM3)
Definition: point_waqtel.f:7
subroutine, public run_read_case_t3d_d(INST, CAS_FILE, DICO_FILE, INIT, IERR, WAQ_CAS_FILE, WAQ_DICO_FILE, GAIA_CAS_FILE, GAIA_DICO_FILE)
Definition: api_run_t3d.f:96
double precision, dimension(:), pointer x
character(len=24), parameter code2
Definition: api_run_t3d.f:29
subroutine lecdon_telemac3d(MOTCAR, FILE_DESC, PATH, NCAR, CAS_FILE, DICO_FILE, GAIA_CAS_FILE, GAIA_DICO_FILE)
character(len=error_mess_len) err_mess
Error message.
double precision dt_ori
Definition: api_run_t3d.f:26
logical waq_cpl
Definition: api_run_t3d.f:36
subroutine bief_open_files(CODE, FILES, NFILES, PATH, NCAR, ICODE, FULLNAME)
subroutine, public run_set_config_t3d_d(INST, U_LU, U_LNG, U_COMM, U_STD_OUTPUT, IERR)
Definition: api_run_t3d.f:63
subroutine telemac3d(PASS, NIT_ORI)
Definition: telemac3d.F:7
subroutine deall_gaia
Definition: deall_gaia.f:4
character(len=24), parameter code5
Definition: api_run_t3d.f:32
subroutine bief_close_files(FILES, NFILES, PEXIT)
subroutine deall_bief
Definition: deall_bief.f:4
integer, dimension(8) tdeb
Definition: api_run_t3d.f:25
type(bief_mesh), target mesh3d
Definition: bief.f:3