SURFEX v8.1
General documentation of Surfex
get_near_meshes_conf_proj.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 get_near_meshes_conf_proj(KGRID_PAR,KL,PGRID_PAR,KNEAR_NBR,KNEAR)
7 ! ##############################################################
8 !
9 !!**** *GET_NEAR_MESHES_CONF_PROJ* get the near grid mesh indices
10 !!
11 !! PURPOSE
12 !! -------
13 !!
14 !! METHOD
15 !! ------
16 !!
17 !! REFERENCE
18 !! ---------
19 !!
20 !! AUTHOR
21 !! ------
22 !!
23 !! V. Masson Meteo-France
24 !!
25 !! MODIFICATION
26 !! ------------
27 !!
28 !! Original 03/2004
29 !!
30 !----------------------------------------------------------------------------
31 !
32 !* 0. DECLARATION
33 ! -----------
34 !
35 USE modd_surfex_mpi, ONLY : nindex, nrank, nnum
36 !
38 !
39 !
40 USE yomhook ,ONLY : lhook, dr_hook
41 USE parkind1 ,ONLY : jprb
42 !
43 IMPLICIT NONE
44 !
45 !* 0.1 Declaration of arguments
46 ! ------------------------
47 !
48 INTEGER, INTENT(IN) :: KGRID_PAR ! size of PGRID_PAR
49 INTEGER, INTENT(IN) :: KL ! number of points
50 INTEGER, INTENT(IN) :: KNEAR_NBR ! number of nearest points wanted
51 REAL, DIMENSION(KGRID_PAR), INTENT(IN) :: PGRID_PAR ! grid parameters
52 INTEGER, DIMENSION(:,:),POINTER :: KNEAR ! near mesh indices
53 !
54 !* 0.2 Declaration of other local variables
55 ! ------------------------------------
56 !
57 INTEGER :: IIMAX, IJMAX
58 INTEGER :: JI, JJ
59 INTEGER :: JX, JY
60 INTEGER :: JL
61 INTEGER :: IDIST
62 INTEGER :: ICOUNT
63 REAL(KIND=JPRB) :: ZHOOK_HANDLE
64 !----------------------------------------------------------------------------
65 !
66 IF (lhook) CALL dr_hook('GET_NEAR_MESHES_CONF_PROJ',0,zhook_handle)
67  CALL get_gridtype_conf_proj(pgrid_par,kimax=iimax,kjmax=ijmax)
68 !
69 knear(:,:) = 0
70 !
71 idist = int(sqrt(float(knear_nbr)))
72 !
73 IF (iimax*ijmax==kl) THEN
74  DO jj=1,ijmax
75  DO ji=1,iimax
76  icount = 0
77  jl = ji + iimax * (jj-1)
78  IF (nindex(jl)==nrank) THEN
79  knear(nnum(jl),:) = 0
80  DO jx=-(idist-1)/2,idist/2
81  DO jy=-(idist-1)/2,idist/2
82  IF (ji+jx>0 .AND. ji+jx<iimax+1 .AND. jj+jy>0 .AND. jj+jy<ijmax+1) THEN
83  icount = icount + 1
84  knear(nnum(jl),icount) = (ji+jx) + iimax * (jj+jy-1)
85  END IF
86  END DO
87  END DO
88  ENDIF
89  END DO
90  END DO
91 END IF
92 IF (lhook) CALL dr_hook('GET_NEAR_MESHES_CONF_PROJ',1,zhook_handle)
93 !
94 !-------------------------------------------------------------------------------
95 !
96 END SUBROUTINE get_near_meshes_conf_proj
integer, dimension(:), allocatable nnum
integer, parameter jprb
Definition: parkind1.F90:32
subroutine get_near_meshes_conf_proj(KGRID_PAR, KL, PGRID_PAR, KNEAR_
subroutine get_gridtype_conf_proj(PGRID_PAR, PLAT0, PLON0, PRPK, PBETA
logical lhook
Definition: yomhook.F90:15
integer, dimension(:), allocatable nindex