SURFEX v8.1
General documentation of Surfex
ini_ssowork.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 ini_ssowork(PMESHLENGTH,PDLAT,PDLON)
7 ! ###############################################
8 !
9 !!**** *INI_SSOWORK* initializes and allocate work arrays for SSO reading
10 !!
11 !! PURPOSE
12 !! -------
13 !!
14 !! METHOD
15 !! ------
16 !!
17 !
18 !! EXTERNAL
19 !! --------
20 !!
21 !! IMPLICIT ARGUMENTS
22 !! ------------------
23 !!
24 !! REFERENCE
25 !! ---------
26 !!
27 !! AUTHOR
28 !! ------
29 !!
30 !! V. Masson Meteo-France
31 !!
32 !! MODIFICATION
33 !! ------------
34 !!
35 !! Original 10/12/97
36 !!
37 !
38 USE modd_surfex_mpi, ONLY : nrank, npio
39 USE modd_pgdwork, ONLY : nsso, nsso_all, xsso_all
40 USE modd_surf_par, ONLY : nundef, xundef
41 USE modd_surfex_mpi, ONLY : nindex
42 !
43 !
44 USE yomhook ,ONLY : lhook, dr_hook
45 USE parkind1 ,ONLY : jprb
46 !
47 IMPLICIT NONE
48 !
49 !----------------------------------------------------------------------------
50 !
51 !* 0.1 Declaration of arguments
52 ! ------------------------
53 !
54 REAL, OPTIONAL, INTENT(IN) :: PMESHLENGTH ! average mesh length in degrees
55 REAL, OPTIONAL, INTENT(IN) :: PDLAT ! input file mesh size (in latitude, degrees)
56 REAL, OPTIONAL, INTENT(IN) :: PDLON ! input file mesh size (in longitude, degrees)
57 
58 INTEGER :: IDIMF
59 REAL(KIND=JPRB) :: ZHOOK_HANDLE
60 !
61 !----------------------------------------------------------------------------
62 !
63 !
64 !* 1. Adapt subgrid mesh to input file resolution
65 ! -------------------------------------------
66 !
67 IF (lhook) CALL dr_hook('INI_SSOWORK',0,zhook_handle)
68 !
69 idimf = SIZE(nindex)
70 !
71 IF (PRESENT(pmeshlength) .AND. PRESENT(pdlat) .AND. PRESENT(pdlon)) THEN
72  IF (pdlat/= xundef .AND. pdlon /= xundef) THEN
73  nsso = nint( 2. * pmeshlength / (pdlat + pdlon) )
74  nsso = max(nsso,3)
75  nsso = min(nsso,10)
76  ELSE
77  nsso = 10
78  END IF
79 ELSE
80  nsso = 10
81 END IF
82 !
83 !----------------------------------------------------------------------------
84 !
85 !* 2. Allocate subgrid arrays
86 ! -----------------------
87 !
88 IF (ALLOCATED(xsso_all)) DEALLOCATE(xsso_all)
89 !
90 ALLOCATE(xsso_all(idimf,nsso,nsso))
91 xsso_all(:,:,:) = -xundef
92 !
93 IF (ALLOCATED(nsso_all)) DEALLOCATE(nsso_all)
94 !
95 ALLOCATE(nsso_all(idimf,nsso,nsso))
96 nsso_all(:,:,:) = 0
97 !
98 IF (lhook) CALL dr_hook('INI_SSOWORK',1,zhook_handle)
99 !
100 !----------------------------------------------------------------------------
101 !
102 END SUBROUTINE ini_ssowork
real, parameter xundef
integer, dimension(:,:,:), allocatable nsso_all
integer, parameter jprb
Definition: parkind1.F90:32
integer, parameter nundef
subroutine ini_ssowork(PMESHLENGTH, PDLAT, PDLON)
Definition: ini_ssowork.F90:7
logical lhook
Definition: yomhook.F90:15
real, dimension(:,:,:), allocatable xsso_all
integer, dimension(:), allocatable nindex