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