SURFEX v8.1
General documentation of Surfex
zoom_pgd_orography.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 zoom_pgd_orography (DTCO, UG, U, USS, GCP, &
7  HPROGRAM,PSEA,PWATER,HINIFILE,HINIFILETYPE)
8 ! ###########################################################
9 
10 !!
11 !! PURPOSE
12 !! -------
13 !! This program prepares the physiographic data fields.
14 !!
15 !! METHOD
16 !! ------
17 !!
18 !! EXTERNAL
19 !! --------
20 !!
21 !!
22 !! IMPLICIT ARGUMENTS
23 !! ------------------
24 !!
25 !!
26 !! REFERENCE
27 !! ---------
28 !!
29 !! AUTHOR
30 !! ------
31 !!
32 !! V. Masson Meteo-France
33 !!
34 !! MODIFICATION
35 !! ------------
36 !!
37 !! Original 13/10/03
38 !----------------------------------------------------------------------------
39 !
40 !* 0. DECLARATION
41 ! -----------
42 !
44 !
46 USE modd_surf_atm_n, ONLY : surf_atm_t
47 USE modd_sso_n, ONLY : sso_t
49 !
51 USE modd_surf_par, ONLY : xundef
52 !
53 USE modi_open_aux_io_surf
55 USE modi_close_aux_io_surf
56 USE modi_prep_grid_extern
57 USE modi_hor_interpol
58 USE modi_prep_output_grid
60 !
61 USE yomhook ,ONLY : lhook, dr_hook
62 USE parkind1 ,ONLY : jprb
63 !
64 USE modi_clean_prep_output_grid
65 !
66 USE modi_get_luout
67 IMPLICIT NONE
68 !
69 !* 0.1 Declaration of dummy arguments
70 ! ------------------------------
71 !
72 TYPE(data_cover_t), INTENT(INOUT) :: DTCO
73 !
74 TYPE(surf_atm_grid_t), INTENT(INOUT) :: UG
75 TYPE(surf_atm_t), INTENT(INOUT) :: U
76 TYPE(sso_t), INTENT(INOUT) :: USS
77 TYPE(grid_conf_proj_t),INTENT(INOUT) :: GCP
78 !
79  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! program calling
80 REAL, DIMENSION(:), INTENT(IN) :: PSEA ! sea fraction
81 REAL, DIMENSION(:), INTENT(IN) :: PWATER ! inland water fraction
82  CHARACTER(LEN=28), INTENT(IN) :: HINIFILE ! input atmospheric file name
83  CHARACTER(LEN=6), INTENT(IN) :: HINIFILETYPE! input atmospheric file type
84 !
85 !
86 !* 0.2 Declaration of local variables
87 ! ------------------------------
88 !
89 INTEGER :: IINFO_ll
90 INTEGER :: IRESP
91 INTEGER :: ILUOUT
92 INTEGER :: INI ! total 1D dimension (input field)
93 INTEGER :: IL ! total 1D dimension (output field)
94 REAL, DIMENSION(:), POINTER :: ZZS
95 REAL, DIMENSION(:), POINTER :: ZAVG_ZS
96 REAL, DIMENSION(:), POINTER :: ZSIL_ZS
97 REAL, DIMENSION(:), POINTER :: ZSSO_STDEV
98 REAL, DIMENSION(:), POINTER :: ZMIN_ZS
99 REAL, DIMENSION(:), POINTER :: ZMAX_ZS
100 REAL, DIMENSION(:), POINTER :: ZSSO_ANIS
101 REAL, DIMENSION(:), POINTER :: ZSSO_DIR
102 REAL, DIMENSION(:), POINTER :: ZSSO_SLOPE
103 REAL, DIMENSION(:), POINTER :: ZAOSIP
104 REAL, DIMENSION(:), POINTER :: ZAOSIM
105 REAL, DIMENSION(:), POINTER :: ZAOSJP
106 REAL, DIMENSION(:), POINTER :: ZAOSJM
107 REAL, DIMENSION(:), POINTER :: ZHO2IP
108 REAL, DIMENSION(:), POINTER :: ZHO2IM
109 REAL, DIMENSION(:), POINTER :: ZHO2JP
110 REAL, DIMENSION(:), POINTER :: ZHO2JM
111  CHARACTER(LEN=12) :: YRECFM ! Name of the article to be read
112 REAL(KIND=JPRB) :: ZHOOK_HANDLE
113 !------------------------------------------------------------------------------
114 IF (lhook) CALL dr_hook('ZOOM_PGD_OROGRAPHY',0,zhook_handle)
115  CALL get_luout(hprogram,iluout)
116 !
117 !* 1. Preparation of IO for reading in the file
118 ! -----------------------------------------
119 !
120 !* Note that all points are read, even those without physical meaning.
121 ! These points will not be used during the horizontal interpolation step.
122 ! Their value must be defined as XUNDEF.
123 !
124 ! get the local sizes of model 1
125  CALL goto_model_mnh(u,hprogram, 1, iinfo_ll)
126  CALL open_aux_io_surf(hinifile,hinifiletype,'FULL ')
127 !
128 !------------------------------------------------------------------------------
129 !
130 !* 2. Reading of grid
131 ! ---------------
132 !
133  CALL prep_output_grid(ug%G, ug%G, u%NSIZE_FULL, iluout)
134 !
135  CALL prep_grid_extern(gcp,hinifiletype,iluout,cingrid_type,cinterp_type,ini)
136 !
137 !------------------------------------------------------------------------------
138 !
139 !* 3. Reading of orographic parameters
140 ! --------------------------------
141 !
142 ALLOCATE(zzs(ini))
143 !
144 ALLOCATE(zavg_zs(ini))
145 ALLOCATE(zsil_zs(ini))
146 ALLOCATE(zsso_stdev(ini))
147 ALLOCATE(zmin_zs(ini))
148 ALLOCATE(zmax_zs(ini))
149 !
150 ALLOCATE(zsso_anis(ini))
151 ALLOCATE(zsso_dir(ini))
152 ALLOCATE(zsso_slope(ini))
153 !
154 ALLOCATE(zaosip(ini))
155 ALLOCATE(zaosim(ini))
156 ALLOCATE(zaosjp(ini))
157 ALLOCATE(zaosjm(ini))
158 ALLOCATE(zho2ip(ini))
159 ALLOCATE(zho2im(ini))
160 ALLOCATE(zho2jp(ini))
161 ALLOCATE(zho2jm(ini))
162 !
163 yrecfm='ZS'
164  CALL read_surf(hprogram,yrecfm,zzs,iresp,hdir='A')
165 !
166 yrecfm='AVG_ZS'
167  CALL read_surf(hprogram,yrecfm,zavg_zs,iresp,hdir='A')
168 yrecfm='SIL_ZS'
169  CALL read_surf(hprogram,yrecfm,zsil_zs,iresp,hdir='A')
170 yrecfm='SSO_STDEV'
171  CALL read_surf(hprogram,yrecfm,zsso_stdev,iresp,hdir='A')
172 yrecfm='MIN_ZS'
173  CALL read_surf(hprogram,yrecfm,zmin_zs,iresp,hdir='A')
174 yrecfm='MAX_ZS'
175  CALL read_surf(hprogram,yrecfm,zmax_zs,iresp,hdir='A')
176 !
177 yrecfm='SSO_ANIS'
178  CALL read_surf(hprogram,yrecfm,zsso_anis,iresp,hdir='A')
179 yrecfm='SSO_DIR'
180  CALL read_surf(hprogram,yrecfm,zsso_dir,iresp,hdir='A')
181 yrecfm='SSO_SLOPE'
182  CALL read_surf(hprogram,yrecfm,zsso_slope,iresp,hdir='A')
183 !
184 yrecfm='AOSIP'
185  CALL read_surf(hprogram,yrecfm,zaosip,iresp,hdir='A')
186 yrecfm='AOSIM'
187  CALL read_surf(hprogram,yrecfm,zaosim,iresp,hdir='A')
188 yrecfm='AOSJP'
189  CALL read_surf(hprogram,yrecfm,zaosjp,iresp,hdir='A')
190 yrecfm='AOSJM'
191  CALL read_surf(hprogram,yrecfm,zaosjm,iresp,hdir='A')
192 yrecfm='HO2IP'
193  CALL read_surf(hprogram,yrecfm,zho2ip,iresp,hdir='A')
194 yrecfm='HO2IM'
195  CALL read_surf(hprogram,yrecfm,zho2im,iresp,hdir='A')
196 yrecfm='HO2JP'
197  CALL read_surf(hprogram,yrecfm,zho2jp,iresp,hdir='A')
198 yrecfm='HO2JM'
199  CALL read_surf(hprogram,yrecfm,zho2jm,iresp,hdir='A')
200 !
201  CALL close_aux_io_surf(hinifile,hinifiletype)
202 !------------------------------------------------------------------------------
203 !
204 !* 4. Interpolations
205 ! --------------
206 !
207 il = SIZE(ug%G%XLAT)
208 !
209 ALLOCATE(u%XZS (il))
210 !
211 ALLOCATE(uss%XAVG_ZS (il))
212 ALLOCATE(uss%XSIL_ZS (il))
213 ALLOCATE(uss%XSSO_STDEV (il))
214 ALLOCATE(uss%XMIN_ZS (il))
215 ALLOCATE(uss%XMAX_ZS (il))
216 !
217 ALLOCATE(uss%XSSO_ANIS (il))
218 ALLOCATE(uss%XSSO_DIR (il))
219 ALLOCATE(uss%XSSO_SLOPE (il))
220 !
221 ALLOCATE(uss%XAOSIP (il))
222 ALLOCATE(uss%XAOSIM (il))
223 ALLOCATE(uss%XAOSJP (il))
224 ALLOCATE(uss%XAOSJM (il))
225 ALLOCATE(uss%XHO2IP (il))
226 ALLOCATE(uss%XHO2IM (il))
227 ALLOCATE(uss%XHO2JP (il))
228 ALLOCATE(uss%XHO2JM (il))
229 !
230  CALL zoom(iluout,zzs,u%XZS)
231  CALL zoom(iluout,zavg_zs,uss%XAVG_ZS)
232  CALL zoom(iluout,zsil_zs,uss%XSIL_ZS)
233  CALL zoom(iluout,zmin_zs,uss%XMIN_ZS)
234  CALL zoom(iluout,zmax_zs,uss%XMAX_ZS)
235 !
236 linterp(:)=(psea(:)<1.)
237  CALL zoom(iluout,zsso_stdev,uss%XSSO_STDEV)
238  CALL zoom(iluout,zsso_anis,uss%XSSO_ANIS)
239  CALL zoom(iluout,zsso_dir,uss%XSSO_DIR)
240  CALL zoom(iluout,zsso_slope,uss%XSSO_SLOPE)
241  CALL zoom(iluout,zaosip,uss%XAOSIP)
242  CALL zoom(iluout,zaosim,uss%XAOSIM)
243  CALL zoom(iluout,zaosjp,uss%XAOSJP)
244  CALL zoom(iluout,zaosjm,uss%XAOSJM)
245  CALL zoom(iluout,zho2ip,uss%XHO2IP)
246  CALL zoom(iluout,zho2im,uss%XHO2IM)
247  CALL zoom(iluout,zho2jp,uss%XHO2JP)
248  CALL zoom(iluout,zho2jm,uss%XHO2JM)
249 !
250 !* coherence with land sea mask
251 !
252 WHERE(psea==1.) u%XZS=0.
253 WHERE(psea(:)==1.) uss%XSSO_STDEV(:) = xundef
254 WHERE(pwater(:)==1.) uss%XSSO_STDEV(:) = 0.
255 WHERE(psea(:)>0.) uss%XMIN_ZS(:) = 0.
256 WHERE(psea(:)==1.) uss%XMAX_ZS(:) = 0.
257 !
258 WHERE (psea(:)==1.)
259  uss%XSSO_ANIS (:) = xundef
260  uss%XSSO_DIR (:) = xundef
261  uss%XSSO_SLOPE(:) = xundef
262 END WHERE
263 !
264 WHERE (pwater(:)==1.)
265  uss%XSSO_ANIS (:) = 1.
266  uss%XSSO_DIR (:) = 0.
267  uss%XSSO_SLOPE(:) = 0.
268 END WHERE
269 !
270 WHERE (psea(:)==1.)
271  uss%XHO2IP(:) = xundef
272  uss%XHO2IM(:) = xundef
273  uss%XHO2JP(:) = xundef
274  uss%XHO2JM(:) = xundef
275  uss%XAOSIP(:) = xundef
276  uss%XAOSIM(:) = xundef
277  uss%XAOSJP(:) = xundef
278  uss%XAOSJM(:) = xundef
279 END WHERE
280 !
281 WHERE (pwater(:)==1.)
282  uss%XHO2IP(:) = 0.
283  uss%XHO2IM(:) = 0.
284  uss%XHO2JP(:) = 0.
285  uss%XHO2JM(:) = 0.
286  uss%XAOSIP(:) = 0.
287  uss%XAOSIM(:) = 0.
288  uss%XAOSJP(:) = 0.
289  uss%XAOSJM(:) = 0.
290 END WHERE
291 !
292 ! go back to child model
293  CALL goto_model_mnh(u,hprogram, 2, iinfo_ll)
294 !_______________________________________________________________________________
295 DEALLOCATE(zzs )
296 !
297 DEALLOCATE(zavg_zs )
298 DEALLOCATE(zsil_zs )
299 DEALLOCATE(zsso_stdev )
300 DEALLOCATE(zmin_zs )
301 DEALLOCATE(zmax_zs )
302 !
303 DEALLOCATE(zsso_anis )
304 DEALLOCATE(zsso_dir )
305 DEALLOCATE(zsso_slope )
306 !
307 DEALLOCATE(zaosip )
308 DEALLOCATE(zaosim )
309 DEALLOCATE(zaosjp )
310 DEALLOCATE(zaosjm )
311 DEALLOCATE(zho2ip )
312 DEALLOCATE(zho2im )
313 DEALLOCATE(zho2jp )
314 DEALLOCATE(zho2jm )
315 !_______________________________________________________________________________
317 !_______________________________________________________________________________
318 IF (lhook) CALL dr_hook('ZOOM_PGD_OROGRAPHY',1,zhook_handle)
319 CONTAINS
320 !
321 SUBROUTINE zoom(KLUOUT,PFIELDIN,PFIELDOUT)
322 INTEGER, INTENT(IN) :: KLUOUT
323 REAL, DIMENSION(:), POINTER :: PFIELDIN
324 REAL, DIMENSION(:), INTENT(OUT) :: PFIELDOUT
325 REAL, DIMENSION(:,:), POINTER :: ZFIELDIN
326 REAL, DIMENSION(:,:), POINTER :: ZFIELDOUT
327 REAL(KIND=JPRB) :: ZHOOK_HANDLE
328 IF (lhook) CALL dr_hook('ZOOM',0,zhook_handle)
329 ALLOCATE(zfieldin(SIZE(pfieldin, 1),1))
330 ALLOCATE(zfieldout(SIZE(pfieldout,1),1))
331 zfieldin(:,1) = pfieldin(:)
332  CALL hor_interpol(dtco, u, gcp, kluout,zfieldin,zfieldout)
333 pfieldout(:) = zfieldout(:,1)
334 DEALLOCATE(zfieldin )
335 DEALLOCATE(zfieldout)
336 IF (lhook) CALL dr_hook('ZOOM',1,zhook_handle)
337 
338 END SUBROUTINE zoom
339 !
340 END SUBROUTINE zoom_pgd_orography
character(len=10) cingrid_type
Definition: modd_prep.F90:39
subroutine clean_prep_output_grid
character(len=6) cinterp_type
Definition: modd_prep.F90:40
subroutine close_aux_io_surf(HFILE, HFILETYPE)
subroutine prep_grid_extern(GCP, HFILETYPE, KLUOUT, HGRIDTYPE, HINTER
real, parameter xundef
logical, dimension(:), allocatable linterp
Definition: modd_prep.F90:43
subroutine hor_interpol(DTCO, U, GCP, KLUOUT, PFIELDIN, PFIELDOUT)
Definition: hor_interpol.F90:7
integer, parameter jprb
Definition: parkind1.F90:32
subroutine goto_model_mnh(U, HPROGRAM, KMI, KINFO_ll)
subroutine prep_output_grid(UG, G, KSIZE_FULL, KLUOUT)
subroutine zoom_pgd_orography(DTCO, UG, U, USS, GCP, HPROGRAM, PSEA, PWATER, HINIFILE, HINIF
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:7
logical lhook
Definition: yomhook.F90:15
subroutine zoom(KLUOUT, PFIELDIN, PFIELDOUT)
subroutine open_aux_io_surf(HFILE, HFILETYPE, HMASK, HDIR)