SURFEX v8.1
General documentation of Surfex
prep_teb_greenroof_ascllv.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 prep_teb_greenroof_ascllv (DTCO, UG, U, USS, &
7  HPROGRAM,HSURF,KLUOUT,PFIELD)
8 ! #################################################################################
9 !
10 !!**** *PREP_TEB_GREENROOF_ASCLLV* - prepares ISBA field from prescribed values
11 !!
12 !! PURPOSE
13 !! -------
14 !
15 !!** METHOD
16 !! ------
17 !!
18 !! Based on "prep_teb_garden_ASCLLV"
19 !!
20 !! REFERENCE
21 !! ---------
22 !!
23 !!
24 !! AUTHOR
25 !! ------
26 !! A. Lemonsu & C. de Munck
27 !!
28 !! MODIFICATIONS
29 !! -------------
30 !! Original 07/2011
31 !!------------------------------------------------------------------
32 !
33 !
34 !
35 !
37 !
40 USE modd_surf_atm_n, ONLY : surf_atm_t
41 USE modd_sso_n, ONLY : sso_t
42 !
43 USE modd_prep, ONLY : cinterp_type
45 USE modd_pgdwork, ONLY : catype
46 USE modd_data_cover_par, ONLY : nvegtype
47 USE modd_surf_par, ONLY : xundef
48 USE modd_prep_teb_greenroof,ONLY : ctype_hug , ctype_tg , &
49  cfile_hug_surf_gr, cfile_tg_surf_gr, &
50  cfile_hug_root_gr, cfile_tg_root_gr, &
51  cfile_hug_deep_gr, cfile_tg_deep_gr
53 USE modi_get_latlonmask_n
54 !
55 !
56 USE yomhook ,ONLY : lhook, dr_hook
57 USE parkind1 ,ONLY : jprb
58 !
59 USE modi_get_type_dim_n
60 !
61 IMPLICIT NONE
62 !
63 #ifdef SFX_MPI
64 include "mpif.h"
65 #endif
66 !
67 !* 0.1 declarations of arguments
68 !
69 !
70 TYPE(data_cover_t), INTENT(INOUT) :: DTCO
71 TYPE(surf_atm_grid_t), INTENT(INOUT) :: UG
72 TYPE(surf_atm_t), INTENT(INOUT) :: U
73 TYPE(sso_t), INTENT(INOUT) :: USS
74 !
75  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! program calling surf. schemes
76  CHARACTER(LEN=7), INTENT(IN) :: HSURF ! type of field
77 INTEGER, INTENT(IN) :: KLUOUT ! logical unit of output listing
78 REAL, POINTER, DIMENSION(:,:,:) :: PFIELD ! field to interpolate horizontally
79 !
80 !* 0.2 declarations of local variables
81 !
82 INTEGER :: JV ! loop counter
83 INTEGER :: JLAYER
84 INTEGER :: IL
85 !
86 INTEGER, DIMENSION(0:NPROC-1) :: INB
87 INTEGER :: INFOMPI, JJ
88 !
89 REAL, ALLOCATABLE, DIMENSION(:,:) :: ZFIELD
90 REAL(KIND=JPRB) :: ZHOOK_HANDLE
91 !
92 !-------------------------------------------------------------------------------------
93 !
94 IF (lhook) CALL dr_hook('PREP_TEB_GREENROOF_ASCLLV',0,zhook_handle)
95 !
96 IF (.NOT.ALLOCATED(nnum)) THEN
97  ALLOCATE(nnum(u%NDIM_FULL))
98  IF (nrank/=npio) THEN
99  IF (ALLOCATED(nindex)) DEALLOCATE(nindex)
100  ALLOCATE(nindex(u%NDIM_FULL))
101  ENDIF
102  IF (nrank==npio) THEN
103  inb(:) = 0
104  DO jj=1,u%NDIM_FULL
105  inb(nindex(jj)) = inb(nindex(jj))+1
106  nnum(jj) = inb(nindex(jj))
107  ENDDO
108  ENDIF
109  IF (nproc>1) THEN
110 #ifdef SFX_MPI
111  CALL mpi_bcast(nindex,SIZE(nindex)*kind(nindex)/4,mpi_integer,npio,ncomm,infompi)
112  CALL mpi_bcast(nnum,SIZE(nnum)*kind(nnum)/4,mpi_integer,npio,ncomm,infompi)
113  CALL mpi_bcast(ug%NGRID_FULL_PAR,kind(ug%NGRID_FULL_PAR)/4,mpi_integer,npio,ncomm,infompi)
114 #endif
115  IF (nrank/=npio) ALLOCATE(ug%XGRID_FULL_PAR(ug%NGRID_FULL_PAR))
116 #ifdef SFX_MPI
117  CALL mpi_bcast(ug%XGRID_FULL_PAR,&
118  SIZE(ug%XGRID_FULL_PAR)*kind(ug%XGRID_FULL_PAR)/4,mpi_real,npio,ncomm,infompi)
119 #endif
120  ENDIF
121 ENDIF
122 !
123 catype = 'ARI'
124 !
125 !* 1. get full dimension of grid
126 !
127  CALL get_type_dim_n(dtco, u, &
128  'FULL ',nl)
129 !
130 !* 2. get nature dimension
131 !
132  CALL get_type_dim_n(dtco, u, &
133  'TOWN ',il)
134 !
135 ALLOCATE(zfield(il,3))
136 !
137 !* 3. get grid informations known over full grid
138 !
139  CALL get_latlonmask_n(ug, &
141 !
142 !
143 SELECT CASE(hsurf)
144 !
145 !
146 !* 4. Profile of soil relative humidity
147 !
148  CASE('WG ')
149 
150  CALL pgd_field(dtco, ug, u, uss, &
151  hprogram,'HUG_SURF: relative humidity','TWN',cfile_hug_surf_gr, &
152  ctype_hug,xundef,zfield(:,1))
153  CALL pgd_field(dtco, ug, u, uss, &
154  hprogram,'HUG_ROOT: relative humidity','TWN',cfile_hug_root_gr, &
155  ctype_hug,xundef,zfield(:,2))
156  CALL pgd_field(dtco, ug, u, uss, &
157  hprogram,'HUG_DEEP: relative humidity','TWN',cfile_hug_deep_gr, &
158  ctype_hug,xundef,zfield(:,3))
159 
160  ALLOCATE(pfield(il,3,nvegtype))
161  DO jv=1,nvegtype
162  pfield(:,1,jv) = zfield(:,1)
163  pfield(:,2,jv) = zfield(:,2)
164  pfield(:,3,jv) = zfield(:,3)
165  END DO
166 
167 !* 5. Profile of temperatures
168 
169  CASE('TG ')
170 
171  CALL pgd_field(dtco, ug, u, uss, &
172  hprogram,'TG_SURF: temperature','TWN',cfile_tg_surf_gr, &
173  ctype_tg,xundef,zfield(:,1))
174  CALL pgd_field(dtco, ug, u, uss, &
175  hprogram,'TG_ROOT: temperature','TWN',cfile_tg_root_gr, &
176  ctype_tg,xundef,zfield(:,2))
177  CALL pgd_field(dtco, ug, u, uss, &
178  hprogram,'TG_DEEP: temperature','TWN',cfile_tg_deep_gr, &
179  ctype_tg,xundef,zfield(:,3))
180 
181  ALLOCATE(pfield(il,3,nvegtype))
182  DO jv=1,nvegtype
183  pfield(:,1,jv) = zfield(:,1)
184  pfield(:,2,jv) = zfield(:,2)
185  pfield(:,3,jv) = zfield(:,3)
186  END DO
187 
188 END SELECT
189 !
190 !* 6. Interpolation method
191 ! --------------------
192 !
193 cinterp_type='NONE '
194 DEALLOCATE(zfield)
195 !
196 DEALLOCATE(nnum)
197 IF (nrank/=npio) THEN
198  DEALLOCATE(nindex,ug%XGRID_FULL_PAR)
199  ALLOCATE(nindex(0))
200 ENDIF
201 !
202 IF (lhook) CALL dr_hook('PREP_TEB_GREENROOF_ASCLLV',1,zhook_handle)
203 !
204 !-------------------------------------------------------------------------------------
205 END SUBROUTINE prep_teb_greenroof_ascllv
subroutine get_type_dim_n(DTCO, U, HTYPE, KDIM)
subroutine get_latlonmask_n(UG, OLATLONMASK, HGRID, PGRID_PAR, KGRID_PAR
character(len=3) catype
logical, dimension(720, 360) llatlonmask
character(len=6) cinterp_type
Definition: modd_prep.F90:40
subroutine prep_teb_greenroof_ascllv(DTCO, UG, U, USS, HPROGRAM, HSURF, KLUOUT, PFIELD)
integer, dimension(:), allocatable nnum
real, parameter xundef
integer, parameter jprb
Definition: parkind1.F90:32
real, dimension(:), pointer xgrid_par
logical lhook
Definition: yomhook.F90:15
character(len=10) cgrid
integer, dimension(:), allocatable nindex