SURFEX v8.1
General documentation of Surfex
write_pgd_surf_atmn.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 write_pgd_surf_atm_n (YSC, HPROGRAM)
7 ! ####################################
8 !
9 !!**** *WRITE_PGD_SURF_ATM_n* - routine to write pgd surface variables
10 !! in their respective files or in file
11 !!
12 !! PURPOSE
13 !! -------
14 !!
15 !!** METHOD
16 !! ------
17 !!
18 !! EXTERNAL
19 !! --------
20 !!
21 !!
22 !! IMPLICIT ARGUMENTS
23 !! ------------------
24 !!
25 !! REFERENCE
26 !! ---------
27 !!
28 !!
29 !! AUTHOR
30 !! ------
31 !! B. Decharme *Meteo France*
32 !!
33 !! MODIFICATIONS
34 !! -------------
35 !! Original 05/2011 according to previous write_surf_atmn.f90
36 !-------------------------------------------------------------------------------
37 !
38 !* 0. DECLARATIONS
39 ! ------------
40 !
41 !
42 USE modd_surfex_n, ONLY : surfex_t
43 !
44 USE modd_surf_conf, ONLY : cprogname
45 USE modd_surf_par, ONLY : nversion, nbugfix
46 USE modd_io_surf_fa, ONLY : lfanocompact
47 !
49 !
50 USE modi_init_io_surf_n
52 USE modi_write_pgd_sea_n
53 USE modi_write_pgd_inland_water_n
54 USE modi_write_pgd_nature_n
55 USE modi_write_pgd_town_n
56 USE modi_end_io_surf_n
57 !
58 USE modi_flag_update
59 !
60 USE modi_writesurf_cover_n
61 USE modi_writesurf_sso_n
62 USE modi_writesurf_dummy_n
63 USE modi_writesurf_snap_n
64 USE modi_writesurf_ch_emis_n
65 USE modi_write_grid
66 !
67 USE modi_write_ecoclimap2_data
68 !
69 USE yomhook ,ONLY : lhook, dr_hook
70 USE parkind1 ,ONLY : jprb
71 !
72 IMPLICIT NONE
73 !
74 !* 0.1 Declarations of arguments
75 ! -------------------------
76 !
77 !
78 TYPE(surfex_t), INTENT(INOUT) :: YSC
79 !
80  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! program calling surf. schemes
81 !
82 !* 0.2 Declarations of local variables
83 ! -------------------------------
84 !
85  CHARACTER(LEN=3) :: YWRITE
86  CHARACTER(LEN=100) :: YCOMMENT
87 INTEGER :: IRESP
88 REAL(KIND=JPRB) :: ZHOOK_HANDLE
89 !-------------------------------------------------------------------------------
90 !
91 IF (lhook) CALL dr_hook('WRITE_PGD_SURF_ATM_N',0,zhook_handle)
92 !
93 !* 0. Initialize some options:
94 ! ------------------------
95 !
96 CPROGNAME = HPROGRAM
97 !
98  CALL flag_update(ysc%IM%ID%O, ysc%DUO, .false.,.true.,.false.,.false.)
99 !
100 !* 1. Configuration and cover fields:
101 ! ------------------------------
102 !
103 !
104 ! Initialisation for IO
105 !
106  CALL init_io_surf_n(ysc%DTCO, ysc%U, hprogram,'FULL ','SURF ','WRITE')
107 !
108 ywrite='PGD'
109 ycomment='(-)'
110  CALL write_surf( ysc%DUO%CSELECT, hprogram,'VERSION',nversion,iresp,ycomment)
111  CALL write_surf( ysc%DUO%CSELECT, hprogram,'BUG ',nbugfix ,iresp,ycomment)
112  CALL write_surf( ysc%DUO%CSELECT, hprogram,'STORAGETYPE',ywrite,iresp,ycomment)
113 !
114  CALL write_surf( ysc%DUO%CSELECT, hprogram,'SPLIT_PATCH',lsplit_patch,iresp,ycomment)
115 !
116  CALL write_surf( ysc%DUO%CSELECT, hprogram,'SEA ',ysc%U%CSEA ,iresp,ycomment)
117  CALL write_surf( ysc%DUO%CSELECT, hprogram,'WATER ',ysc%U%CWATER ,iresp,ycomment)
118  CALL write_surf( ysc%DUO%CSELECT, hprogram,'NATURE',ysc%U%CNATURE,iresp,ycomment)
119  CALL write_surf( ysc%DUO%CSELECT, hprogram,'TOWN ',ysc%U%CTOWN ,iresp,ycomment)
120 !
121  CALL write_surf( ysc%DUO%CSELECT, hprogram,'DIM_FULL ',ysc%U%NDIM_FULL,iresp,hcomment=ycomment)
122  CALL write_surf( ysc%DUO%CSELECT, hprogram,'DIM_SEA ',ysc%U%NDIM_SEA, iresp,hcomment=ycomment)
123  CALL write_surf( ysc%DUO%CSELECT, hprogram,'DIM_NATURE',ysc%U%NDIM_NATURE,iresp,hcomment=ycomment)
124  CALL write_surf( ysc%DUO%CSELECT, hprogram,'DIM_WATER ',ysc%U%NDIM_WATER, iresp,hcomment=ycomment)
125  CALL write_surf( ysc%DUO%CSELECT, hprogram,'DIM_TOWN ',ysc%U%NDIM_TOWN, iresp,hcomment=ycomment)
126  CALL write_surf( ysc%DUO%CSELECT, hprogram,'ECOCLIMAP ',ysc%U%LECOCLIMAP ,iresp,ycomment)
127  CALL write_surf( ysc%DUO%CSELECT, hprogram,'ECOSG ',ysc%U%LECOSG ,iresp,ycomment)
128  CALL write_surf( ysc%DUO%CSELECT, hprogram,'WATER_TO_NAT',ysc%U%LWATER_TO_NATURE,iresp,ycomment)
129  CALL write_surf( ysc%DUO%CSELECT, hprogram,'TOWN_TO_ROCK',ysc%U%LTOWN_TO_ROCK,iresp,ycomment)
130  CALL write_surf( ysc%DUO%CSELECT, hprogram,'GARDEN',ysc%U%LGARDEN,iresp,ycomment)
131 IF (hprogram.NE.'BINARY' .AND. hprogram.NE.'TEXTE ') THEN
132  CALL write_ecoclimap2_data( ysc%DUO%CSELECT, hprogram)
133 ENDIF
134 !
135  CALL write_grid(ysc%DUO%CSELECT, hprogram,ysc%UG%G%CGRID,ysc%UG%G%XGRID_PAR,&
136  ysc%UG%G%XLAT,ysc%UG%G%XLON,ysc%UG%G%XMESH_SIZE,iresp)
137 !
138  CALL writesurf_cover_n(ysc%DUO%CSELECT, ysc%U, hprogram)
139  CALL writesurf_sso_n(ysc%DUO%CSELECT, ysc%USS, hprogram)
140  CALL writesurf_dummy_n(ysc%DUO%CSELECT, ysc%DUU, hprogram)
141 !
142 ycomment='CH_EMIS'
143  CALL write_surf( ysc%DUO%CSELECT, &
144  hprogram,'CH_EMIS',ysc%CHU%LCH_EMIS,iresp,hcomment=ycomment)
145 !
146 IF (ysc%CHU%LCH_EMIS) THEN
147  ycomment='CH_EMIS_OPT'
148  CALL write_surf( ysc%DUO%CSELECT, &
149  hprogram,'CH_EMIS_OPT',ysc%CHU%CCH_EMIS,iresp,hcomment=ycomment)
150 END IF
151 !
152 IF (ysc%CHU%LCH_EMIS) THEN
153  IF (ysc%CHU%CCH_EMIS=='AGGR') THEN
154  CALL writesurf_ch_emis_n(ysc%DUO%CSELECT, ysc%CHE, hprogram)
155  ELSE IF (ysc%CHU%CCH_EMIS=='SNAP') THEN
156  CALL writesurf_snap_n(ysc%DUO%CSELECT, ysc%CHN, hprogram)
157  ENDIF
158 ENDIF
159 !
160 ! End of IO
161 !
162  CALL end_io_surf_n(hprogram)
163 !
164 !
165 !* 2. Sea
166 ! ---
167 !
168 IF (ysc%U%NDIM_SEA>0) CALL write_pgd_sea_n(ysc%DTCO, ysc%DUO%CSELECT, ysc%U, &
169  ysc%SM%DTS, ysc%SM%G, ysc%SM%S, hprogram)
170 !
171 !
172 !* 3. Inland water
173 ! ------------
174 !
175 IF (ysc%U%NDIM_WATER>0) CALL write_pgd_inland_water_n(ysc%DTCO, ysc%DUO%CSELECT, ysc%U, &
176  ysc%WM%G, ysc%WM%W, ysc%FM%G, ysc%FM%F, &
177  hprogram)
178 !
179 !
180 !* 4. Vegetation scheme
181 ! -----------------
182 !
183 IF (ysc%U%NDIM_NATURE>0) CALL write_pgd_nature_n(ysc%DTCO, ysc%DUO%CSELECT, ysc%U, &
184  ysc%DTZ, ysc%IM, hprogram)
185 !
186 !
187 !* 5. Urban scheme
188 ! ------------
189 !
190 IF (ysc%U%NDIM_TOWN>0) CALL write_pgd_town_n(ysc%DTCO, ysc%DUO%CSELECT, ysc%U, &
191  ysc%TM, ysc%GDM, ysc%GRM, hprogram)
192 !
193 !
194 IF (lhook) CALL dr_hook('WRITE_PGD_SURF_ATM_N',1,zhook_handle)
195 !
196 !-------------------------------------------------------------------------------
197 !
198 END SUBROUTINE write_pgd_surf_atm_n
subroutine write_pgd_surf_atm_n(YSC, HPROGRAM)
subroutine write_pgd_sea_n(DTCO, HSELECT, U, DTS, G, S, HPROGRAM)
subroutine writesurf_snap_n(HSELECT, CHN, HPROGRAM)
subroutine write_ecoclimap2_data(HSELECT, HPROGRAM)
integer, parameter jprb
Definition: parkind1.F90:32
character(len=6) cprogname
subroutine writesurf_sso_n(HSELECT, USS, HPROGRAM)
subroutine flag_update(DIO, DUO, ONOWRITE_CANOPY, OPGD, OPROVAR_TO_DIAG, OSELE
Definition: flag_update.F90:8
subroutine end_io_surf_n(HPROGRAM)
Definition: end_io_surfn.F90:7
subroutine write_grid(HSELECT, HPROGRAM, HGRID, PGRID_PAR, PLAT, PLON,
Definition: write_grid.F90:7
subroutine writesurf_ch_emis_n(HSELECT, CHE, HPROGRAM)
subroutine write_pgd_nature_n(DTCO, HSELECT, U, DTZ, IM, HPROGRAM
logical lhook
Definition: yomhook.F90:15
subroutine write_pgd_town_n(DTCO, HSELECT, U, TM, GDM, GRM, HPROG
subroutine writesurf_cover_n(HSELECT, U, HPROGRAM)
subroutine write_pgd_inland_water_n(DTCO, HSELECT, U, WG, W, FG,
subroutine writesurf_dummy_n(HSELECT, DUU, HPROGRAM)
logical, save lfanocompact
subroutine init_io_surf_n(DTCO, U, HPROGRAM, HMASK, HSCHEME, HACTION