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.F90 in trunk/NEMO/LIM_SRC_3 – NEMO

source: trunk/NEMO/LIM_SRC_3/limtab.F90 @ 1146

Last change on this file since 1146 was 1146, checked in by rblod, 16 years ago

Add svn Id (first try), see ticket #210

  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1MODULE limtab
2   !!======================================================================
3   !!                       ***  MODULE limtab   ***
4   !!              transform 1D (2D) array to a 2D (1D) table
5   !!======================================================================
6#if defined key_lim3
7   !!----------------------------------------------------------------------
8   !!   'key_lim3'                                      LIM3 sea-ice model
9   !!----------------------------------------------------------------------
10   !!   tab_2d_1d  : 2-D to 1-D
11   !!   tab_1d_2d  : 1-D to 2-D
12   !!----------------------------------------------------------------------
13   !! * Modules used
14   USE par_kind
15
16   IMPLICIT NONE
17   PRIVATE
18
19   !! * Routine accessibility
20   PUBLIC tab_2d_1d  ! called by lim_ther
21   PUBLIC tab_1d_2d  ! called by lim_ther
22
23   !!----------------------------------------------------------------------
24   !!   LIM 3.0,  UCL-ASTR-LOCEAN-IPSL (2008)
25   !! $ Id: $
26   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
27   !!----------------------------------------------------------------------
28CONTAINS
29
30   SUBROUTINE tab_2d_1d ( ndim1d, tab1d, tab2d, ndim2d_x, ndim2d_y, tab_ind )
31
32      INTEGER, INTENT(in) :: &
33         ndim1d, ndim2d_x, ndim2d_y
34
35      REAL(wp), DIMENSION (ndim2d_x, ndim2d_y), INTENT(in) ::  &
36         tab2d
37
38      INTEGER, DIMENSION ( ndim1d), INTENT ( in) :: &
39         tab_ind
40
41      REAL(wp), DIMENSION(ndim1d), INTENT ( out) ::  & 
42         tab1d
43
44      INTEGER ::  &
45         jn , jid, jjd
46
47      DO jn = 1, ndim1d
48         jid        = MOD( tab_ind(jn) - 1, ndim2d_x ) + 1
49         jjd        = ( tab_ind(jn) - 1 ) / ndim2d_x + 1
50         tab1d( jn) = tab2d( jid, jjd)
51      END DO
52
53   END SUBROUTINE tab_2d_1d
54
55
56   SUBROUTINE tab_1d_2d ( ndim1d, tab2d, tab_ind, tab1d, ndim2d_x, ndim2d_y )
57
58      INTEGER, INTENT ( in) :: &
59         ndim1d, ndim2d_x, ndim2d_y
60
61      INTEGER, DIMENSION (ndim1d) , INTENT (in) :: &
62         tab_ind
63
64      REAL(wp), DIMENSION(ndim1d), INTENT (in) ::  &
65         tab1d 
66
67      REAL(wp), DIMENSION (ndim2d_x, ndim2d_y), INTENT ( out) :: &
68         tab2d
69
70      INTEGER :: &
71         jn, jid, jjd
72
73      DO jn = 1, ndim1d
74         jid             = MOD( tab_ind(jn) - 1, ndim2d_x) + 1
75         jjd             =    ( tab_ind(jn) - 1 ) / ndim2d_x  + 1
76         tab2d(jid, jjd) = tab1d( jn)
77      END DO
78
79   END SUBROUTINE tab_1d_2d
80
81#endif
82END MODULE limtab
Note: See TracBrowser for help on using the repository browser.