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.
limtab_2.F90 in branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/LIM_SRC_2 – NEMO

source: branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/LIM_SRC_2/limtab_2.F90 @ 9309

Last change on this file since 9309 was 6486, checked in by davestorkey, 8 years ago

Remove SVN keywords from UKMO/dev_r5518_GO6_package branch.

File size: 3.4 KB
RevLine 
[821]1MODULE limtab_2
[3]2   !!======================================================================
[821]3   !!                       ***  MODULE limtab_2   ***
[2715]4   !!   LIM : transform 1D (2D) array to a 2D (1D) table
[3]5   !!======================================================================
[821]6#if defined key_lim2
[3]7   !!----------------------------------------------------------------------
[2715]8   !!   tab_2d_1d  : 2-D <==> 1-D
9   !!   tab_1d_2d  : 1-D <==> 2-D
[3]10   !!----------------------------------------------------------------------
11   USE par_kind
12
13   IMPLICIT NONE
14   PRIVATE
15
[2715]16   PUBLIC   tab_2d_1d_2   ! called by limthd
17   PUBLIC   tab_1d_2d_2   ! called by limthd
[3]18
19   !!----------------------------------------------------------------------
[2715]20   !! NEMO/LIM2 4.0 , UCL - NEMO Consortium (2010)
[1156]21   !! $Id$
[2715]22   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
[3]23   !!----------------------------------------------------------------------
24CONTAINS
25
[821]26   SUBROUTINE tab_2d_1d_2 ( ndim1d, tab1d, tab2d, ndim2d_x, ndim2d_y, tab_ind )
[2715]27      !!----------------------------------------------------------------------
28      !!                  ***  ROUTINE tab_2d_1d  ***
29      !!----------------------------------------------------------------------
30      INTEGER                               , INTENT(in   ) ::   ndim1d, ndim2d_x, ndim2d_y   ! 1D & 2D sizes
31      REAL(wp), DIMENSION(ndim2d_x,ndim2d_y), INTENT(in   ) ::   tab2d                        ! input 2D field
32      INTEGER , DIMENSION(ndim1d)           , INTENT(in   ) ::   tab_ind                      ! input index
33      REAL(wp), DIMENSION(ndim1d)           , INTENT(  out) ::   tab1d                        ! output 1D field
34      !
35      INTEGER ::   jn , jid, jjd
36      !!----------------------------------------------------------------------
[3]37      DO jn = 1, ndim1d
[2715]38         jid        = MOD( tab_ind(jn) - 1 , ndim2d_x ) + 1
39         jjd        =    ( tab_ind(jn) - 1 ) / ndim2d_x + 1
[3]40         tab1d( jn) = tab2d( jid, jjd)
41      END DO
[821]42   END SUBROUTINE tab_2d_1d_2
[3]43
44
[821]45   SUBROUTINE tab_1d_2d_2 ( ndim1d, tab2d, tab_ind, tab1d, ndim2d_x, ndim2d_y )
[2715]46      !!----------------------------------------------------------------------
47      !!                  ***  ROUTINE tab_2d_1d  ***
48      !!----------------------------------------------------------------------
49      INTEGER                               , INTENT(in   ) ::   ndim1d, ndim2d_x, ndim2d_y   ! 1d & 2D sizes
50      REAL(wp), DIMENSION(ndim1d)           , INTENT(in   ) ::   tab1d                        ! input 1D field
51      INTEGER , DIMENSION(ndim1d)           , INTENT(in   ) ::   tab_ind                      ! input index
52      REAL(wp), DIMENSION(ndim2d_x,ndim2d_y), INTENT(  out) ::   tab2d                        ! output 2D field
53      !
54      INTEGER ::   jn , jid, jjd
55      !!----------------------------------------------------------------------
[3]56      DO jn = 1, ndim1d
[2715]57         jid             = MOD( tab_ind(jn) - 1 , ndim2d_x ) + 1
[3]58         jjd             =    ( tab_ind(jn) - 1 ) / ndim2d_x  + 1
59         tab2d(jid, jjd) = tab1d( jn)
60      END DO
[821]61   END SUBROUTINE tab_1d_2d_2
[3]62
[2715]63#else
64   !!----------------------------------------------------------------------
65   !!   Default option        Dummy module             NO LIM sea-ice model
66   !!----------------------------------------------------------------------
[3]67#endif
[2715]68   !!======================================================================
[821]69END MODULE limtab_2
Note: See TracBrowser for help on using the repository browser.