SURFEX v8.1
General documentation of Surfex
prep_isba_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_isba_ascllv (DTCO, UG, U, USS, HPROGRAM,HSURF,KLUOUT,PFIELD)
7 ! #################################################################################
8 !
9 !!**** *PREP_ISBA_ASCLLV* - prepares ISBA field from prescribed values
10 !!
11 !! PURPOSE
12 !! -------
13 !
14 !!** METHOD
15 !! ------
16 !!
17 !! REFERENCE
18 !! ---------
19 !!
20 !!
21 !! AUTHOR
22 !! ------
23 !! P. Le Moigne
24 !!
25 !! MODIFICATIONS
26 !! -------------
27 !! Original 03/2007
28 !!------------------------------------------------------------------
29 !
30 !
31 !
32 !
34 !
37 USE modd_surf_atm_n, ONLY : surf_atm_t
38 USE modd_sso_n, ONLY : sso_t
39 !
40 USE modd_prep, ONLY : cinterp_type
42 USE modd_pgdwork, ONLY : catype
43 USE modd_data_cover_par, ONLY : nvegtype
44 USE modd_surf_par, ONLY : xundef
45 USE modd_prep_isba, ONLY : ctype_hug , ctype_tg , &
46  cfile_hug_surf, cfile_tg_surf, &
47  cfile_hug_root, cfile_tg_root, &
48  cfile_hug_deep, cfile_tg_deep
50 USE modi_get_latlonmask_n
51 USE modi_abor1_sfx
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_ISBA_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, 'FULL ',nl)
126 !
127 !* 2. get nature dimension
128 !
129  CALL get_type_dim_n(dtco, u, 'NATURE',il)
130 !
131 ALLOCATE(zfield(il,3))
132 !
133 !* 3. get grid informations known over full grid
134 !
136 !
137 !
138 SELECT CASE(hsurf)
139 !
140 !
141 !* 4. Profile of soil relative humidity
142 !
143  CASE('WG ')
144 
145  CALL pgd_field(dtco, ug, u, uss, hprogram,'HUG_SURF: relative humidity','NAT',cfile_hug_surf, &
146  ctype_hug,xundef,zfield(:,1))
147  CALL pgd_field(dtco, ug, u, uss, hprogram,'HUG_ROOT: relative humidity','NAT',cfile_hug_root, &
148  ctype_hug,xundef,zfield(:,2))
149  CALL pgd_field(dtco, ug, u, uss, hprogram,'HUG_DEEP: relative humidity','NAT',cfile_hug_deep, &
150  ctype_hug,xundef,zfield(:,3))
151 
152  ALLOCATE(pfield(il,3,nvegtype))
153  DO jv=1,nvegtype
154  pfield(:,1,jv) = zfield(:,1)
155  pfield(:,2,jv) = zfield(:,2)
156  pfield(:,3,jv) = zfield(:,3)
157  END DO
158 
159 !* 5. Profile of temperatures
160 
161  CASE('TG ')
162 
163  CALL pgd_field(dtco, ug, u, uss, hprogram,'TG_SURF: temperature','NAT',cfile_tg_surf, &
164  ctype_tg,xundef,zfield(:,1))
165  CALL pgd_field(dtco, ug, u, uss, hprogram,'TG_ROOT: temperature','NAT',cfile_tg_root, &
166  ctype_tg,xundef,zfield(:,2))
167  CALL pgd_field(dtco, ug, u, uss, hprogram,'TG_DEEP: temperature','NAT',cfile_tg_deep, &
168  ctype_tg,xundef,zfield(:,3))
169 
170  ALLOCATE(pfield(il,3,nvegtype))
171  DO jv=1,nvegtype
172  pfield(:,1,jv) = zfield(:,1)
173  pfield(:,2,jv) = zfield(:,2)
174  pfield(:,3,jv) = zfield(:,3)
175  END DO
176 !
177  CASE DEFAULT
178  CALL abor1_sfx('PREP_ISBA_ASCLLV: '//trim(hsurf)//" initialization not implemented !")
179 !
180 END SELECT
181 !
182 !* 6. Interpolation method
183 ! --------------------
184 !
185 cinterp_type='NONE '
186 DEALLOCATE(zfield)
187 !
188 DEALLOCATE(nnum)
189 IF (nrank/=npio) THEN
190  DEALLOCATE(nindex,ug%XGRID_FULL_PAR)
191  ALLOCATE(nindex(0))
192 ENDIF
193 !
194 IF (lhook) CALL dr_hook('PREP_ISBA_ASCLLV',1,zhook_handle)
195 !
196 !-------------------------------------------------------------------------------------
197 END SUBROUTINE prep_isba_ascllv
subroutine get_type_dim_n(DTCO, U, HTYPE, KDIM)
static const char * trim(const char *name, int *n)
Definition: drhook.c:2383
subroutine get_latlonmask_n(UG, OLATLONMASK, HGRID, PGRID_PAR, KGRID_PAR
character(len=3) catype
logical, dimension(720, 360) llatlonmask
subroutine prep_isba_ascllv(DTCO, UG, U, USS, HPROGRAM, HSURF, KLUOUT, PFIELD)
character(len=6) cinterp_type
Definition: modd_prep.F90:40
integer, dimension(:), allocatable nnum
subroutine abor1_sfx(YTEXT)
Definition: abor1_sfx.F90:7
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