SURFEX v8.1
General documentation of Surfex
prep_flake_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_flake_ascllv (DTCO, UG, U, USS, &
7  HPROGRAM,HSURF,KLUOUT,PFIELD)
8 ! #################################################################################
9 !
10 !!**** *PREP_FLAKE_ASCLLV* - prepares FLAKE 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_surf_par, ONLY : xundef
47 USE modi_get_latlonmask_n
48 !
49 !
50 USE yomhook ,ONLY : lhook, dr_hook
51 USE parkind1 ,ONLY : jprb
52 !
53 USE modi_get_type_dim_n
54 !
55 IMPLICIT NONE
56 !
57 #ifdef SFX_MPI
58 include "mpif.h"
59 #endif
60 !
61 !* 0.1 declarations of arguments
62 !
63 !
64 TYPE(data_cover_t), INTENT(INOUT) :: DTCO
65 TYPE(surf_atm_grid_t), INTENT(INOUT) :: UG
66 TYPE(surf_atm_t), INTENT(INOUT) :: U
67 TYPE(sso_t), INTENT(INOUT) :: USS
68 !
69  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! program calling surf. schemes
70  CHARACTER(LEN=7), INTENT(IN) :: HSURF ! type of field
71 INTEGER, INTENT(IN) :: KLUOUT ! logical unit of output listing
72 REAL, POINTER, DIMENSION(:,:) :: PFIELD ! field to interpolate horizontally
73 !
74 !* 0.2 declarations of local variables
75 !
76 INTEGER :: IL
77 !
78 INTEGER, DIMENSION(0:NPROC-1) :: INB
79 INTEGER :: INFOMPI, JJ
80 !
81 REAL, ALLOCATABLE, DIMENSION(:) :: ZFIELD
82 REAL(KIND=JPRB) :: ZHOOK_HANDLE
83 !
84 !-------------------------------------------------------------------------------------
85 !
86 IF (lhook) CALL dr_hook('PREP_FLAKE_ASCLLV',0,zhook_handle)
87 !
88 IF (.NOT.ALLOCATED(nnum)) THEN
89  ALLOCATE(nnum(u%NDIM_FULL))
90  IF (nrank/=npio) THEN
91  IF (ALLOCATED(nindex)) DEALLOCATE(nindex)
92  ALLOCATE(nindex(u%NDIM_FULL))
93  ENDIF
94  IF (nrank==npio) THEN
95  inb(:) = 0
96  DO jj=1,u%NDIM_FULL
97  inb(nindex(jj)) = inb(nindex(jj))+1
98  nnum(jj) = inb(nindex(jj))
99  ENDDO
100  ENDIF
101  IF (nproc>1) THEN
102 #ifdef SFX_MPI
103  CALL mpi_bcast(nindex,SIZE(nindex)*kind(nindex)/4,mpi_integer,npio,ncomm,infompi)
104  CALL mpi_bcast(nnum,SIZE(nnum)*kind(nnum)/4,mpi_integer,npio,ncomm,infompi)
105  CALL mpi_bcast(ug%NGRID_FULL_PAR,kind(ug%NGRID_FULL_PAR)/4,mpi_integer,npio,ncomm,infompi)
106 #endif
107  IF (nrank/=npio) ALLOCATE(ug%XGRID_FULL_PAR(ug%NGRID_FULL_PAR))
108 #ifdef SFX_MPI
109  CALL mpi_bcast(ug%XGRID_FULL_PAR,&
110  SIZE(ug%XGRID_FULL_PAR)*kind(ug%XGRID_FULL_PAR)/4,mpi_real,npio,ncomm,infompi)
111 #endif
112  ENDIF
113 ENDIF
114 !
115 catype = 'ARI'
116 !
117 !* 1. get full dimension of grid
118 !
119  CALL get_type_dim_n(dtco, u, 'FULL ',nl)
120 !
121 !* 2. get water dimension
122 !
123  CALL get_type_dim_n(dtco, u, 'WATER ',il)
124 !
125 ALLOCATE(zfield(il))
126 !
127 !* 3. get grid informations known over full grid
128 !
130 !
131 !
132 SELECT CASE(hsurf)
133 !
134 !
135 !* 5. surface temperature
136 
137  CASE('TS ')
138 
139  CALL pgd_field(dtco, ug, u, uss, hprogram,'TS_WATER: temperature','WAT',cfile_flake, &
140  ctype,xundef,zfield(:))
141 
142  ALLOCATE(pfield(il,1))
143  pfield(:,1) = zfield(:)
144 
145 END SELECT
146 !
147 !* 6. Interpolation method
148 ! --------------------
149 !
150 cinterp_type='NONE '
151 DEALLOCATE(zfield)
152 !
153 DEALLOCATE(nnum)
154 IF (nrank/=npio) THEN
155  DEALLOCATE(nindex,ug%XGRID_FULL_PAR)
156  ALLOCATE(nindex(0))
157 ENDIF
158 !
159 IF (lhook) CALL dr_hook('PREP_FLAKE_ASCLLV',1,zhook_handle)
160 !
161 !-------------------------------------------------------------------------------------
162 END SUBROUTINE prep_flake_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
integer, dimension(:), allocatable nnum
real, parameter xundef
integer, parameter jprb
Definition: parkind1.F90:32
real, dimension(:), pointer xgrid_par
character(len=6) ctype
logical lhook
Definition: yomhook.F90:15
character(len=10) cgrid
integer, dimension(:), allocatable nindex
subroutine prep_flake_ascllv(DTCO, UG, U, USS, HPROGRAM, HSURF, KLUOUT, PFIELD)
character(len=28) cfile_flake