SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
split_grid_cartesian.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 split_grid_cartesian(HPROGRAM,KDIM_FULL,KSIZE_FULL,KGRID_PAR,PGRID_PAR)
7 ! ###########################################################
8 !!
9 !! PURPOSE
10 !! -------
11 !! This program splits a PGD grid on several processors (according to host program)
12 !!
13 !! METHOD
14 !! ------
15 !!
16 !! EXTERNAL
17 !! --------
18 !!
19 !!
20 !! IMPLICIT ARGUMENTS
21 !! ------------------
22 !!
23 !!
24 !! REFERENCE
25 !! ---------
26 !!
27 !! AUTHOR
28 !! ------
29 !!
30 !! V. Masson Meteo-France
31 !!
32 !! MODIFICATION
33 !! ------------
34 !!
35 !! Original 08/11
36 !----------------------------------------------------------------------------
37 !
38 !* 0. DECLARATION
39 ! -----------
40 !
43 !
44 !
45 USE yomhook ,ONLY : lhook, dr_hook
46 USE parkind1 ,ONLY : jprb
47 !
48 !
49 IMPLICIT NONE
50 !
51 !* 0.1 Declaration of dummy arguments
52 ! ------------------------------
53 !
54  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! host program
55 INTEGER, INTENT(IN) :: kdim_full ! total number of points
56 INTEGER, INTENT(OUT) :: ksize_full! number of points on this processor
57 INTEGER, INTENT(INOUT) :: kgrid_par ! size of PGRID_PAR pointer
58 REAL, DIMENSION(:), POINTER :: pgrid_par ! parameters defining this grid
59 !
60 !
61 !* 0.2 Declaration of local variables
62 ! ------------------------------
63 !
64 REAL(KIND=JPRB) :: zhook_handle
65 !
66 !* original grid
67 REAL :: zlat0, zlon0
68 INTEGER :: iimax, ijmax
69 REAL, DIMENSION(KDIM_FULL) :: zx, zy, zdx, zdy
70 !
71 !* splitted grid on processor
72 INTEGER :: iimax_split, ijmax_split
73 REAL, DIMENSION(:), ALLOCATABLE :: zx_split, zy_split, zdx_split, zdy_split
74 !
75 !------------------------------------------------------------------------------
76 IF (lhook) CALL dr_hook('SPLIT_GRID_CARTESIAN',0,zhook_handle)
77 !
78 !* 1. Gets Parameters of the Grid
79 !
80  CALL get_gridtype_cartesian(pgrid_par,zlat0,zlon0, &
81  iimax,ijmax, &
82  zx,zy,zdx,zdy )
83 !
84 !
85 !* 2. Splits the (pertinent) parameters of the grid
86 !
87  CALL split_grid_parametern0(hprogram,'CARTESIAN ','IMAX ',iimax,iimax_split)
88  CALL split_grid_parametern0(hprogram,'CARTESIAN ','JMAX ',ijmax,ijmax_split)
89 !
90 ksize_full = iimax_split * ijmax_split
91 !
92 ALLOCATE(zx_split(ksize_full))
93 ALLOCATE(zy_split(ksize_full))
94 ALLOCATE(zdx_split(ksize_full))
95 ALLOCATE(zdy_split(ksize_full))
96  CALL split_grid_parameterx1(hprogram,'CARTESIAN ','XX ',kdim_full,ksize_full,zx,zx_split)
97  CALL split_grid_parameterx1(hprogram,'CARTESIAN ','YY ',kdim_full,ksize_full,zy,zy_split)
98  CALL split_grid_parameterx1(hprogram,'CARTESIAN ','DX ',kdim_full,ksize_full,zdx,zdx_split)
99  CALL split_grid_parameterx1(hprogram,'CARTESIAN ','DY ',kdim_full,ksize_full,zdy,zdy_split)
100 !
101 !
102 !* 3. Stores Parameters of the Grid in grid pointer
103 !
104 nullify(pgrid_par)
105  CALL put_gridtype_cartesian(pgrid_par,zlat0,zlon0, &
106  iimax_split,ijmax_split, &
107  zx_split,zy_split,zdx_split,zdy_split )
108  !
109 !
110 kgrid_par = SIZE(pgrid_par)
111 !
112 DEALLOCATE(zx_split )
113 DEALLOCATE(zy_split )
114 DEALLOCATE(zdx_split)
115 DEALLOCATE(zdy_split)
116 !
117 IF (lhook) CALL dr_hook('SPLIT_GRID_CARTESIAN',1,zhook_handle)
118 !_______________________________________________________________________________
119 !
120 END SUBROUTINE split_grid_cartesian
subroutine split_grid_cartesian(HPROGRAM, KDIM_FULL, KSIZE_FULL, KGRID_PAR, PGRID_PAR)
subroutine put_gridtype_cartesian(PGRID_PAR, PLAT0, PLON0, KIMAX, KJMAX, PX, PY, PDX, PDY)
subroutine split_grid_parametern0(HPROGRAM, HGRID, HREC, KFIELD, KFIELD_SPLIT)
subroutine get_gridtype_cartesian(PGRID_PAR, PLAT0, PLON0, KIMAX, KJMAX, PX, PY, PDX, PDY, KL)
subroutine split_grid_parameterx1(HPROGRAM, HGRID, HREC, KDIM, KSIZE, PFIELD, PFIELD_SPLIT)