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/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/OBS – NEMO

source: branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/OBS/mpp_map.F90 @ 3211

Last change on this file since 3211 was 3211, checked in by spickles2, 12 years ago

Stephen Pickles, 11 Dec 2011

Commit to bring the rest of the DCSE NEMO development branch
in line with the latest development version. This includes
array index re-ordering of all OPA_SRC/.

  • Property svn:keywords set to Id
File size: 2.9 KB
Line 
1MODULE mpp_map
2   !!======================================================================
3   !!                       ***  MODULE mpp_mpa  ***
4   !! NEMOVAR: MPP global grid point mapping to processors
5   !!======================================================================
6   !! History :  2.0  ! 2007-08  (K. Mogensen)  Original code
7   !!----------------------------------------------------------------------
8
9   !!----------------------------------------------------------------------
10   !!  mppmap_init : Initialize mppmap.
11   !!----------------------------------------------------------------------
12   USE par_kind, ONLY :   wp            ! Precision variables
13   USE par_oce , ONLY :   jpi, jpj      ! Ocean parameters
14   USE dom_oce , ONLY :   mig, mjg, nldi, nlei, nldj, nlej, narea   ! Ocean space and time domain variables
15#if defined key_mpp_mpi
16   USE lib_mpp, ONLY :   mpi_comm_opa   ! MPP library
17#endif
18   USE in_out_manager   ! I/O manager
19
20   IMPLICIT NONE
21   PRIVATE
22
23   PUBLIC ::   mppmap_init, mppmap   !: ???
24
25   INTEGER, DIMENSION(:,:), ALLOCATABLE ::   mppmap   ! ???
26
27   !! * Control permutation of array indices
28   !! No array indices to control
29
30   !!----------------------------------------------------------------------
31   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
32   !! $Id$
33   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
34   !!----------------------------------------------------------------------
35CONTAINS
36
37   SUBROUTINE mppmap_init
38      !!----------------------------------------------------------------------
39      !!               ***  ROUTINE mppmap_init ***
40      !!         
41      !! ** Purpose : Setup a global map of processor rank for all gridpoints
42      !!
43      !! ** Method  : MPI all reduce.
44      !!
45      !! ** Action  : This does only work for MPI.
46      !!
47      !! References : http://www.mpi-forum.org
48      !!----------------------------------------------------------------------
49      INTEGER, DIMENSION(:,:), ALLOCATABLE ::   imppmap   !
50#if defined key_mpp_mpi
51      INTEGER :: ierr
52
53INCLUDE 'mpif.h'
54#endif
55      !!----------------------------------------------------------------------
56
57      ALLOCATE( &
58         & mppmap(jpiglo,jpjglo) &
59         & )
60
61      ! Initialize local imppmap
62
63      ALLOCATE( &
64         & imppmap(jpiglo,jpjglo) &
65         & )
66      imppmap(:,:) = 0
67
68      ! Setup local grid points
69      imppmap(mig(nldi):mig(nlei),mjg(nldj):mjg(nlej)) = narea 
70     
71      ! Get global data
72
73#if defined key_mpp_mpi
74
75      ! Call the MPI library to find the max across processors
76      CALL mpi_allreduce( imppmap, mppmap, jpiglo*jpjglo, mpi_integer,   &
77         &                mpi_max, mpi_comm_opa, ierr )
78#else     
79     
80      ! No MPP: Just copy the data
81      mppmap(:,:) = imppmap(:,:)
82#endif
83      !
84   END SUBROUTINE mppmap_init
85
86   !!======================================================================
87END MODULE mpp_map
Note: See TracBrowser for help on using the repository browser.