SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
init_io_surf_oln.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 ! #########
6  SUBROUTINE init_io_surf_ol_n (DTCO, DGU, U, &
7  hprogram,hmask,hscheme,haction)
8 ! ######################
9 !
10 !!**** *INIT_IO_SURF_OL* Keep in memory the netcdf ID of the output files
11 !!
12 !! PURPOSE
13 !! -------
14 !
15 !!
16 !!** IMPLICIT ARGUMENTS
17 !! ------------------
18 !! None
19 !!
20 !! REFERENCE
21 !! ---------
22 !!
23 !! AUTHOR
24 !! ------
25 !! F. Habets *Meteo France*
26 !!
27 !! MODIFICATIONS
28 !! -------------
29 !! modified 05/04 by P. LeMoigne *Meteo France*
30 !! modified 06/10 by S. Faroux *Meteo France*
31 !!=================================================================
32 !
33 !* 0. DECLARATIONS
34 ! ------------
35 !
38 USE modd_surf_atm_n, ONLY : surf_atm_t
39 !
41 !
42 USE modd_surfex_mpi, ONLY : nrank, npio
43 !
44 USE modn_io_offline, ONLY : xtstep_output
45 !
46 USE modi_get_luout
48 USE modi_get_dim_full_n
49 USE modi_get_size_full_n
50 USE modi_get_type_dim_n
51 USE modi_init_io_surf_mask_n
53 !
54 USE modd_surfex_mpi, ONLY : wlog_mpi
55 !
56 USE yomhook ,ONLY : lhook, dr_hook
57 USE parkind1 ,ONLY : jprb
58 !
59 IMPLICIT NONE
60 !
61 !
62 TYPE(data_cover_t), INTENT(INOUT) :: dtco
63 TYPE(diag_surf_atm_t), INTENT(INOUT) :: dgu
64 TYPE(surf_atm_t), INTENT(INOUT) :: u
65 !
66  CHARACTER(LEN=6), INTENT(IN) :: hprogram
67  CHARACTER(LEN=6), INTENT(IN) :: hmask
68  CHARACTER(LEN=6), INTENT(IN) :: hscheme
69  CHARACTER(LEN=5), INTENT(IN) :: haction
70 !
71 REAL :: zden
72 INTEGER :: iresp ! IRESP : return-code if a problem appears
73  CHARACTER(LEN=100):: ycomment ! Comment string
74 INTEGER :: ilu,iret, il, ifull
75 INTEGER :: iluout
76 REAL(KIND=JPRB) :: zhook_handle
77 !------------------------------------------------------------------------------
78 IF (lhook) CALL dr_hook('INIT_IO_SURF_OL_N',0,zhook_handle)
79 !
80 lmask = .true.
81 !
82  CALL get_luout(hprogram,iluout)
83 !
84 !$OMP BARRIER
85 !
86 IF (haction=='READ') THEN
87  CALL read_surf(&
88  'OFFLIN','DIM_FULL',ifull,iret)
89 ELSE
90  CALL get_dim_full_n(u, &
91  ifull)
92 ENDIF
93 !
94 ! size by MPI task. NINDEX is supposed to be initialized at this step.
95  CALL get_size_full_n(u, &
96  'OFFLIN',ifull,ilu)
97 !
98 il = ilu
99  CALL get_type_dim_n(dtco, u, &
100  hmask,il)
101  CALL init_io_surf_mask_n(dtco, u, &
102  hmask, il, iluout, ilu, nmask)
103 !
104 IF (haction=='READ' .AND. lhook) CALL dr_hook('INIT_IO_SURF_OL_N',1,zhook_handle)
105 IF (haction=='READ') RETURN
106 !
107 IF (nrank==npio) THEN
108  !
109  ycomment=''
110  !
111  IF (xtstep_output == floor(xtstep_output/86400.)*86400) THEN
112  zden = 86400.
113  ELSEIF (xtstep_output == floor(xtstep_output/3600.)*3600) THEN
114  zden = 3600.
115  ELSEIF (xtstep_output == floor(xtstep_output/60.)*60) THEN
116  zden = 60.
117  ELSE
118  zden = 1.
119  ENDIF
120  !
121  IF (.NOT.ltime_written(1)) THEN
122  xtype=1
123  CALL write_surf(dgu, u, &
124  hprogram,'time',xtstep_output/zden*xstartw,iresp,hcomment=ycomment)
125  ltime_written(1)=.true.
126  ENDIF
127  !
128  IF (hscheme.NE.'NONE ') THEN
129  !
130  IF (hmask=='NATURE' .AND. .NOT.ltime_written(2)) THEN
131  xtype=2
132  CALL write_surf(dgu, u, &
133  hprogram,'time',xtstep_output/zden*xstartw,iresp,hcomment=ycomment)
134  ltime_written(2)=.true.
135  ENDIF
136  !
137  IF (hmask=='SEA ' .AND. .NOT.ltime_written(3)) THEN
138  xtype=3
139  CALL write_surf(dgu, u, &
140  hprogram,'time',xtstep_output/zden*xstartw,iresp,hcomment=ycomment)
141  ltime_written(3)=.true.
142  ENDIF
143  !
144  IF (hmask=='WATER ' .AND. .NOT.ltime_written(4)) THEN
145  xtype=4
146  CALL write_surf(dgu, u, &
147  hprogram,'time',xtstep_output/zden*xstartw,iresp,hcomment=ycomment)
148  ltime_written(4)=.true.
149  ENDIF
150  !
151  IF (hmask=='TOWN ' .AND. .NOT.ltime_written(5)) THEN
152  xtype=5
153  CALL write_surf(dgu, u, &
154  hprogram,'time',xtstep_output/zden*xstartw,iresp,hcomment=ycomment)
155  ltime_written(5)=.true.
156  ENDIF
157  !
158  ENDIF
159  !
160 ENDIF
161 !
162 !------------------------------------------------------------------------------
163 IF (lhook) CALL dr_hook('INIT_IO_SURF_OL_N',1,zhook_handle)
164 !------------------------------------------------------------------------------
165 !
166 END SUBROUTINE init_io_surf_ol_n
subroutine get_type_dim_n(DTCO, U, HTYPE, KDIM)
subroutine get_dim_full_n(U, KDIM_FULL)
subroutine init_io_surf_ol_n(DTCO, DGU, U, HPROGRAM, HMASK, HSCHEME, HACTION)
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:6
subroutine wlog_mpi(HLOG, PLOG, KLOG, KLOG2, OLOG)
subroutine get_size_full_n(U, HPROGRAM, KDIM_FULL, KSIZE_FULL)
subroutine init_io_surf_mask_n(DTCO, U, HMASK, KSIZE, KLUOUT, KFULL, KMASK)