New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
mpp_map.F90 in branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/OBS – NEMO

source: branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/OBS/mpp_map.F90 @ 2287

Last change on this file since 2287 was 2287, checked in by smasson, 14 years ago

update licence of all NEMO files...

  • Property svn:keywords set to Id
File size: 3.0 KB
Line 
1MODULE mpp_map
2   !!======================================================================
3   !!                       ***  MODULE mpp_mpa  ***
4   !! NEMOVAR: MPP global grid point mapping to processors
5   !!======================================================================
6
7   !!----------------------------------------------------------------------
8   !! mppmap      : Global array which maps i,j to area number.
9   !! mppmap_init : Initialize mppmap.
10   !!----------------------------------------------------------------------
11   !! * Modules used   
12   USE par_kind, ONLY : &   ! Precision variables
13      & wp
14   USE par_oce, ONLY : &    ! Ocean parameters
15      & jpi,   &
16      & jpj
17   USE dom_oce, ONLY : &    ! Ocean space and time domain variables
18      & mig,   &
19      & mjg,   & 
20      & nldi,  &
21      & nlei,  &
22      & nldj,  &
23      & nlej,  &
24      & narea 
25#if defined key_mpp_mpi
26   USE lib_mpp, ONLY : &    ! MPP library
27      & mpi_comm_opa
28#endif
29   USE in_out_manager
30
31   IMPLICIT NONE
32
33   !! * Routine accessibility
34   PRIVATE
35
36   PUBLIC &
37      & mppmap_init,        &
38      & mppmap
39
40   !! * Module variables
41
42   INTEGER, DIMENSION(:,:), ALLOCATABLE :: &
43      & mppmap
44
45   !!----------------------------------------------------------------------
46   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
47   !! $Id$
48   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
49   !!----------------------------------------------------------------------
50
51CONTAINS
52
53   SUBROUTINE mppmap_init
54      !!----------------------------------------------------------------------
55      !!               ***  ROUTINE mppmap_init ***
56      !!         
57      !! ** Purpose : Setup a global map of processor rank for all gridpoints
58      !!
59      !! ** Method  : MPI all reduce.
60      !!
61      !! ** Action  : This does only work for MPI.
62      !!              It does not work for SHMEM.
63      !!
64      !! References : http://www.mpi-forum.org
65      !!
66      !! History :
67      !!        !  07-08  (K. Mogensen)  Original code
68      !!----------------------------------------------------------------------
69
70      !! * Arguments
71      INTEGER, DIMENSION(:,:), ALLOCATABLE :: imppmap
72#if defined key_mpp_mpi
73      !! * Local declarations
74      INTEGER :: ierr
75INCLUDE 'mpif.h'
76#endif
77
78      ALLOCATE( &
79         & mppmap(jpiglo,jpjglo) &
80         & )
81
82      ! Initialize local imppmap
83
84      ALLOCATE( &
85         & imppmap(jpiglo,jpjglo) &
86         & )
87      imppmap(:,:) = 0
88
89      ! Setup local grid points
90      imppmap(mig(nldi):mig(nlei),mjg(nldj):mjg(nlej)) = narea 
91     
92      ! Get global data
93
94#if defined key_mpp_mpi
95
96      ! Call the MPI library to find the max across processors
97
98      CALL mpi_allreduce( imppmap, mppmap, jpiglo*jpjglo, mpi_integer, &
99         &                mpi_max, mpi_comm_opa, ierr )
100#elif defined key_mpp_shmem
101#error "Only MPI support for MPP in NEMOVAR"
102#else     
103     
104      ! Just copy the data
105
106      mppmap(:,:) = imppmap(:,:)
107
108#endif
109
110   END SUBROUTINE mppmap_init
111
112END MODULE mpp_map
Note: See TracBrowser for help on using the repository browser.