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.
icetab.F90 in branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3 – NEMO

source: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icetab.F90 @ 8554

Last change on this file since 8554 was 8554, checked in by clem, 7 years ago

put ridge/raft in 1D

File size: 5.3 KB
RevLine 
[8420]1MODULE icetab
2   !!======================================================================
3   !!                       ***  MODULE icetab   ***
[8534]4   !!   sea-ice : transform 1D (2D) array to a 2D (1D) table
[8420]5   !!======================================================================
6#if defined key_lim3
7   !!----------------------------------------------------------------------
[8534]8   !!   'key_lim3'                                       ESIM sea-ice model
[8420]9   !!----------------------------------------------------------------------
[8534]10   !!   tab_3d_2d  : 3-D <==> 2-D
11   !!   tab_2d_3d  : 2-D <==> 3-D
[8420]12   !!   tab_2d_1d  : 2-D <==> 1-D
13   !!   tab_1d_2d  : 1-D <==> 2-D
14   !!----------------------------------------------------------------------
15   USE par_oce
16   USE ice, ONLY : jpl
17   
18   IMPLICIT NONE
19   PRIVATE
20
21   PUBLIC   tab_3d_2d
22   PUBLIC   tab_2d_1d
23   PUBLIC   tab_2d_3d
24   PUBLIC   tab_1d_2d
25
26   !!----------------------------------------------------------------------
[8486]27   !! NEMO/ICE 4.0 , NEMO Consortium (2017)
[8420]28   !! $Id: icetab.F90 8369 2017-07-25 14:38:38Z clem $
29   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
30   !!----------------------------------------------------------------------
31CONTAINS
32
33   SUBROUTINE tab_3d_2d( ndim1d, tab_ind, tab1d, tab2d )
34      !!----------------------------------------------------------------------
35      !!                  ***  ROUTINE tab_2d_1d  ***
36      !!----------------------------------------------------------------------
37      INTEGER                         , INTENT(in   ) ::   ndim1d   ! 1d size
38      INTEGER , DIMENSION(ndim1d)     , INTENT(in   ) ::   tab_ind  ! input index
39      REAL(wp), DIMENSION(jpi,jpj,jpl), INTENT(in   ) ::   tab2d    ! input 2D field
40      REAL(wp), DIMENSION(ndim1d,jpl) , INTENT(  out) ::   tab1d    ! output 1D field
41      !
42      INTEGER ::   jl, jn, jid, jjd
43      !!----------------------------------------------------------------------
44      DO jl = 1, jpl
45         DO jn = 1, ndim1d
46            jid          = MOD( tab_ind(jn) - 1 , jpi ) + 1
47            jjd          =    ( tab_ind(jn) - 1 ) / jpi + 1
48            tab1d(jn,jl) = tab2d(jid,jjd,jl)
49         END DO
50      END DO
51   END SUBROUTINE tab_3d_2d
52
[8486]53
[8420]54   SUBROUTINE tab_2d_1d( ndim1d, tab_ind, tab1d, tab2d )
55      !!----------------------------------------------------------------------
56      !!                  ***  ROUTINE tab_2d_1d  ***
57      !!----------------------------------------------------------------------
58      INTEGER                     , INTENT(in   ) ::   ndim1d   ! 1d size
59      INTEGER , DIMENSION(ndim1d) , INTENT(in   ) ::   tab_ind  ! input index
60      REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) ::   tab2d    ! input 2D field
61      REAL(wp), DIMENSION(ndim1d) , INTENT(  out) ::   tab1d    ! output 1D field
62      !
63      INTEGER ::   jn , jid, jjd
64      !!----------------------------------------------------------------------
65      DO jn = 1, ndim1d
66         jid        = MOD( tab_ind(jn) - 1 , jpi ) + 1
67         jjd        =    ( tab_ind(jn) - 1 ) / jpi + 1
68         tab1d( jn) = tab2d( jid, jjd)
69      END DO
70   END SUBROUTINE tab_2d_1d
71
[8486]72
[8420]73   SUBROUTINE tab_2d_3d( ndim1d, tab_ind, tab1d, tab2d )
74      !!----------------------------------------------------------------------
75      !!                  ***  ROUTINE tab_2d_1d  ***
76      !!----------------------------------------------------------------------
77      INTEGER                         , INTENT(in   ) ::   ndim1d    ! 1D size
78      INTEGER , DIMENSION(ndim1d)     , INTENT(in   ) ::   tab_ind   ! input index
79      REAL(wp), DIMENSION(ndim1d,jpl) , INTENT(in   ) ::   tab1d     ! input 1D field
80      REAL(wp), DIMENSION(jpi,jpj,jpl), INTENT(  out) ::   tab2d     ! output 2D field
81      !
82      INTEGER ::   jl, jn, jid, jjd
83      !!----------------------------------------------------------------------
84      DO jl = 1, jpl
85         DO jn = 1, ndim1d
86            jid               = MOD( tab_ind(jn) - 1 ,  jpi ) + 1
87            jjd               =    ( tab_ind(jn) - 1 ) / jpi  + 1
88            tab2d(jid,jjd,jl) = tab1d(jn,jl)
89         END DO
90      END DO
91   END SUBROUTINE tab_2d_3d
92
[8486]93
[8420]94   SUBROUTINE tab_1d_2d( ndim1d, tab_ind, tab1d, tab2d )
95      !!----------------------------------------------------------------------
96      !!                  ***  ROUTINE tab_2d_1d  ***
97      !!----------------------------------------------------------------------
98      INTEGER                     , INTENT(in   ) ::   ndim1d    ! 1D size
99      INTEGER , DIMENSION(ndim1d) , INTENT(in   ) ::   tab_ind   ! input index
100      REAL(wp), DIMENSION(ndim1d) , INTENT(in   ) ::   tab1d     ! input 1D field
101      REAL(wp), DIMENSION(jpi,jpj), INTENT(  out) ::   tab2d     ! output 2D field
102      !
103      INTEGER ::   jn , jid, jjd
104      !!----------------------------------------------------------------------
105      DO jn = 1, ndim1d
106         jid             = MOD( tab_ind(jn) - 1 ,  jpi ) + 1
107         jjd             =    ( tab_ind(jn) - 1 ) / jpi  + 1
108         tab2d(jid, jjd) = tab1d( jn)
109      END DO
110   END SUBROUTINE tab_1d_2d
111
[8486]112#else
113   !!----------------------------------------------------------------------
[8534]114   !!   Default option           Dummy module         NO ESIM sea-ice model
[8486]115   !!----------------------------------------------------------------------
[8420]116#endif
[8486]117
[8420]118   !!======================================================================
119END MODULE icetab
Note: See TracBrowser for help on using the repository browser.