SURFEX v8.1
General documentation of Surfex
pgd_surf_atm.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 pgd_surf_atm (YSC,HPROGRAM,HFILE,HFILETYPE,OZS)
7 ! ###########################################################
8 !!
9 !! PURPOSE
10 !! -------
11 !! This program prepares the physiographic data fields.
12 !!
13 !! METHOD
14 !! ------
15 !!
16 !! EXTERNAL
17 !! --------
18 !!
19 !!
20 !! IMPLICIT ARGUMENTS
21 !! ------------------
22 !!
23 !!
24 !! REFERENCE
25 !! ---------
26 !!
27 !! AUTHOR
28 !! ------
29 !!
30 !! V. Masson Meteo-France
31 !!
32 !! MODIFICATION
33 !! ------------
34 !!
35 !! Original 13/10/03
36 !! A. Lemonsu 05/2009 Ajout de la clef LGARDEN pour TEB
37 !! J. Escobar 11/2013 Add USE MODI_READ_NAM_PGD_CHEMISTRY
38 !! B. Decharme 02/2014 Add LRM_RIVER
39 !----------------------------------------------------------------------------
40 !
41 !* 0. DECLARATION
42 ! -----------
43 !
44 !
45 USE modd_surfex_n, ONLY : surfex_t
46 !
47 USE modd_surfex_mpi, ONLY : nrank, npio, nsize, nindex, nnum
48 !
49 USE modd_surf_conf, ONLY : cprogname
51 !
52 USE modi_get_size_full_n
53 USE modi_get_luout
54 USE modi_read_pgd_arrange_cover
55 USE modi_read_pgd_cover_garden
56 USE modi_ini_data_cover
57 USE modi_read_pgd_schemes
58 USE modi_read_nam_pgd_chemistry
59 USE modi_read_nam_write_cover_tex
60 USE modi_write_cover_tex_start
61 USE modi_write_cover_tex_cover
62 USE modi_latlon_grid
63 USE modi_put_pgd_grid
64 USE modi_latlonmask
65 USE modi_pgd_frac
66 USE modi_pgd_cover
67 USE modi_pgd_orography
68 USE modi_pgd_nature
69 USE modi_pgd_town
70 USE modi_pgd_inland_water
71 USE modi_pgd_sea
72 USE modi_pgd_dummy
73 USE modi_pgd_chemistry
74 USE modi_pgd_chemistry_snap
75 USE modi_write_cover_tex_end
76 USE modi_init_read_data_cover
77 !
78 USE yomhook ,ONLY : lhook, dr_hook
79 USE parkind1 ,ONLY : jprb
80 !
81 IMPLICIT NONE
82 !
83 !* 0.1 Declaration of dummy arguments
84 ! ------------------------------
85 !
86 !
87 TYPE(surfex_t), INTENT(INOUT) :: YSC
88 !
89  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! program calling
90  CHARACTER(LEN=28), INTENT(IN) :: HFILE ! atmospheric file name
91  CHARACTER(LEN=6), INTENT(IN) :: HFILETYPE! atmospheric file type
92 LOGICAL, INTENT(IN) :: OZS ! .true. if orography is imposed by atm. model
93 !
94 !* 0.2 Declaration of local variables
95 ! ------------------------------
96 !
97 LOGICAL :: LRM_RIVER !delete inland river coverage. Default is false
98 !
99 INTEGER :: ISIZE_FULL, JI, IDIM_FULL
100 INTEGER :: ILUOUT ! logical unit of output listing file
101 !
102 REAL(KIND=JPRB) :: ZHOOK_HANDLE
103 !
104 !------------------------------------------------------------------------------
105 IF (lhook) CALL dr_hook('PGD_SURF_ATM',0,zhook_handle)
106 !
107 lrm_river = .false.
108 !
109 CPROGNAME=HPROGRAM
110 !
111  CALL get_luout(hprogram,iluout)
112 !
113 !* 1. Set default constant values
114 ! ---------------------------
115 !
116 !* 1.2 surface schemes
117  CALL read_pgd_schemes(hprogram, ysc%U%CNATURE, ysc%U%CSEA, ysc%U%CTOWN, ysc%U%CWATER)
118 !
119  CALL read_nam_write_cover_tex(hprogram)
120 !
121 !-------------------------------------------------------------------------------
122 !
123 !* 2. Grid
124 ! ----
125 !
126 ALLOCATE(ysc%UG%G%XLAT (ysc%U%NSIZE_FULL))
127 ALLOCATE(ysc%UG%G%XLON (ysc%U%NSIZE_FULL))
128 ALLOCATE(ysc%UG%G%XMESH_SIZE(ysc%U%NSIZE_FULL))
129 ALLOCATE(ysc%UG%XJPDIR (ysc%U%NSIZE_FULL))
130  CALL latlon_grid(ysc%UG%G, ysc%U%NSIZE_FULL, ysc%UG%XJPDIR)
131 !
132 !
133 !* 2.3 Stores the grid in the module MODD_PGD_GRID
134 !
135  CALL put_pgd_grid(ysc%UG%G%CGRID, ysc%U%NSIZE_FULL,ysc%UG%G%NGRID_PAR, ysc%UG%G%XGRID_PAR)
136 !
137 IF (hprogram=='MESONH') THEN
138  idim_full = ysc%U%NDIM_FULL
139  ysc%U%NDIM_FULL = nl
140  nsize = nl
141  ALLOCATE(nindex(nl))
142  nindex(:) = 0
143  ALLOCATE(nnum(nl))
144  DO ji = 1,nl
145  nnum(ji) = ji
146  ENDDO
147 ENDIF
148 !
149 IF (.NOT.ASSOCIATED(ysc%UG%XGRID_FULL_PAR)) THEN
150  ALLOCATE(ysc%UG%XGRID_FULL_PAR(SIZE(ysc%UG%G%XGRID_PAR)))
151  ysc%UG%XGRID_FULL_PAR(:) = ysc%UG%G%XGRID_PAR(:)
152  ysc%UG%NGRID_FULL_PAR = ngrid_par
153 ENDIF
154 !
155 !* 2.4 mask to limit the number of input data to read
156  CALL latlonmask(ysc%UG%G%CGRID, ysc%UG%NGRID_FULL_PAR, ysc%UG%XGRID_FULL_PAR, llatlonmask)
157 !
158 !-------------------------------------------------------------------------------
159 !
160 !* 3. surface cover
161 ! -------------
162 !
163  CALL pgd_frac(ysc%DTCO, ysc%UG, ysc%U, ysc%USS, hprogram)
164 !
165  CALL read_pgd_arrange_cover(hprogram, ysc%U%LWATER_TO_NATURE, ysc%U%LTOWN_TO_ROCK)
166 !
167  CALL read_pgd_cover_garden(hprogram, ysc%U%LGARDEN)
168 !
169  CALL init_read_data_cover(hprogram)
170 !
171  CALL ini_data_cover(ysc%DTCO, ysc%U)
172 IF (ysc%U%LECOCLIMAP) CALL pgd_cover(ysc%DTCO, ysc%UG, ysc%U, ysc%USS, hprogram,lrm_river)
173 !
174 IF (nrank==npio) THEN
175  CALL write_cover_tex_start(hprogram)
177 ENDIF
178 !
179 !-------------------------------------------------------------------------------
180 !
181 !* 4. Orography
182 ! ---------
183 !
184  CALL pgd_orography(ysc%DTCO, ysc%UG, ysc%U, ysc%USS, hprogram, hfile, hfiletype, ozs)
185 !
186 !_______________________________________________________________________________
187 !
188 !* 5. Additionnal fields for nature scheme
189 ! ------------------------------------
190 !
191 IF (ysc%U%NDIM_NATURE>0) CALL pgd_nature(ysc%DTCO, ysc%DTZ, ysc%IM, ysc%UG, ysc%U, ysc%USS, hprogram)
192 !_______________________________________________________________________________
193 !
194 !* 6. Additionnal fields for town scheme
195 ! ----------------------------------
196 !
197 IF (ysc%U%NDIM_TOWN>0) CALL pgd_town(ysc%DTCO, ysc%UG, ysc%U, ysc%USS, &
198  ysc%IM%DTV, ysc%TM, ysc%GDM, ysc%GRM, hprogram)
199 !_______________________________________________________________________________
200 !
201 !* 7. Additionnal fields for inland water scheme
202 ! ------------------------------------------
203 !
204 IF (ysc%U%NDIM_WATER>0) CALL pgd_inland_water(ysc%DTCO, ysc%FM%G, ysc%FM%F, ysc%UG, ysc%U, &
205  ysc%USS, ysc%WM%G, ysc%WM%W, hprogram,lrm_river)
206 !_______________________________________________________________________________
207 !
208 !* 8. Additionnal fields for sea scheme
209 ! ---------------------------------
210 !
211 IF (ysc%U%NDIM_SEA>0) CALL pgd_sea(ysc%DTCO, ysc%SM%DTS, ysc%SM%G, ysc%SM%S, &
212  ysc%UG, ysc%U, ysc%USS, hprogram)
213 !_______________________________________________________________________________
214 !
215 !* 9. Dummy fields
216 ! ------------
217 !
218  CALL pgd_dummy(ysc%DTCO, ysc%DUU, ysc%UG, ysc%U, ysc%USS, hprogram)
219 !_______________________________________________________________________________
220 !
221 !* 10. Chemical Emission fields
222 ! ------------------------
223 !
224  CALL read_nam_pgd_chemistry(hprogram,ysc%CHU%CCH_EMIS)
225 IF (ysc%CHU%CCH_EMIS=='SNAP') THEN
226  CALL pgd_chemistry_snap(ysc%CHN, ysc%DTCO, ysc%UG, ysc%U, ysc%USS, &
227  hprogram,ysc%CHU%LCH_EMIS)
228 ELSE IF (ysc%CHU%CCH_EMIS=='AGGR') THEN
229  CALL pgd_chemistry(ysc%CHE, ysc%DTCO, ysc%UG, ysc%U, ysc%USS, &
230  hprogram,ysc%CHU%LCH_EMIS)
231 ENDIF
232 !_______________________________________________________________________________
233 !
234 !* 11. Writing in cover latex file
235 ! ---------------------------
236 !
237 IF (nrank==npio) CALL write_cover_tex_end(hprogram)
238 !
239 IF (hprogram=='MESONH') THEN
240  ysc%U%NDIM_FULL = idim_full
241 ENDIF
242 !
243 IF (lhook) CALL dr_hook('PGD_SURF_ATM',1,zhook_handle)
244 !_______________________________________________________________________________
245 !
246 END SUBROUTINE pgd_surf_atm
subroutine pgd_inland_water(DTCO, FG, F, UG, U, USS, WG, W, HPROG
subroutine write_cover_tex_end(HPROGRAM)
subroutine latlon_grid(G, KL, PDIR)
Definition: latlon_grid.F90:7
subroutine pgd_frac(DTCO, UG, U, USS, HPROGRAM)
Definition: pgd_frac.F90:7
subroutine latlonmask(HGRID, KGRID_PAR, PGRID_PAR, OLATLONMASK)
Definition: latlonmask.F90:7
subroutine pgd_chemistry_snap(CHN, DTCO, UG, U, USS, HPROGRAM, OCH_EMIS)
subroutine init_read_data_cover(HPROGRAM)
logical, dimension(720, 360) llatlonmask
subroutine pgd_dummy(DTCO, DUU, UG, U, USS, HPROGRAM)
Definition: pgd_dummy.F90:7
subroutine pgd_orography(DTCO, UG, U, USS, HPROGRAM, HFILE, HFILE
subroutine pgd_surf_atm(YSC, HPROGRAM, HFILE, HFILETYPE, OZS)
Definition: pgd_surf_atm.F90:7
integer, dimension(:), allocatable nnum
subroutine read_nam_pgd_chemistry(HPROGRAM, HCH_EMIS)
subroutine pgd_cover(DTCO, UG, U, USS, HPROGRAM, ORM_RIVER)
Definition: pgd_cover.F90:7
integer, parameter jprb
Definition: parkind1.F90:32
character(len=6) cprogname
subroutine read_pgd_cover_garden(HPROGRAM, OGARDEN)
subroutine pgd_chemistry(CHE, DTCO, UG, U, USS, HPROGRAM, OCH_EMIS)
subroutine pgd_town(DTCO, UG, U, USS, DTV, TM, GDM, GRM, HPROGRAM
Definition: pgd_town.F90:7
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:7
logical lhook
Definition: yomhook.F90:15
subroutine pgd_sea(DTCO, DTS, SG, S, UG, U, USS, HPROGRAM)
Definition: pgd_sea.F90:7
subroutine pgd_nature(DTCO, DTZ, IM, UG, U, USS, HPROGRAM)
Definition: pgd_nature.F90:7
integer, dimension(:), allocatable nindex
subroutine read_pgd_schemes(HPROGRAM, HNATURE, HSEA, HTOWN, HWATER)
subroutine put_pgd_grid(HGRID, KSIZE_FULL, KGRID_PAR, PGRID_PAR)
Definition: put_pgd_grid.F90:7
subroutine write_cover_tex_start(HPROGRAM)
subroutine ini_data_cover(DTCO, U)
subroutine write_cover_tex_cover
subroutine read_nam_write_cover_tex(HPROGRAM)
subroutine read_pgd_arrange_cover(HPROGRAM, OWATER_TO_NATURE, OTOWN_