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.
iceini.F90 in branches/2013/dev_LOCEAN_2013/NEMOGCM/NEMO/LIM_SRC_3 – NEMO

source: branches/2013/dev_LOCEAN_2013/NEMOGCM/NEMO/LIM_SRC_3/iceini.F90 @ 4147

Last change on this file since 4147 was 4147, checked in by cetlod, 10 years ago

merge in dev_LOCEAN_2013, the 1st development branch dev_r3853_CNRS9_Confsetting, from its starting point ( r3853 ) on the trunk: see ticket #1169

  • Property svn:keywords set to Id
File size: 12.1 KB
Line 
1MODULE iceini
2   !!======================================================================
3   !!                       ***  MODULE iceini   ***
4   !!   Sea-ice model : LIM Sea ice model Initialization
5   !!======================================================================
6   !! History :  3.0  ! 2008-03  (M. Vancoppenolle) LIM-3 original code
7   !!            3.3  ! 2010-12  (G. Madec) add call to lim_thd_init and lim_thd_sal_init
8   !!            4.0  ! 2011-02  (G. Madec) dynamical allocation
9   !!----------------------------------------------------------------------
10#if defined key_lim3
11   !!----------------------------------------------------------------------
12   !!   'key_lim3'                                     LIM sea-ice model
13   !!----------------------------------------------------------------------
14   !!   ice_init      : sea-ice model initialization
15   !!----------------------------------------------------------------------
16   USE phycst         ! physical constants
17   USE dom_oce        ! ocean domain
18   USE sbc_oce        ! Surface boundary condition: ocean fields
19   USE sbc_ice        ! Surface boundary condition: ice   fields
20   USE ice            ! LIM variables
21   USE par_ice        ! LIM parameters
22   USE dom_ice        ! LIM domain
23   USE thd_ice        ! LIM thermodynamical variables
24   USE limitd_me      ! LIM ice thickness distribution
25   USE limmsh         ! LIM mesh
26   USE limistate      ! LIM initial state
27   USE limrst         ! LIM restart
28   USE limthd         ! LIM ice thermodynamics
29   USE limthd_sal     ! LIM ice thermodynamics: salinity
30   USE limvar         ! LIM variables
31   USE limsbc         ! LIM surface boundary condition
32   USE in_out_manager ! I/O manager
33   USE lib_mpp        ! MPP library
34   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 
35
36   IMPLICIT NONE
37   PRIVATE
38
39   PUBLIC   ice_init   ! called by sbcice_lim.F90
40
41   !!----------------------------------------------------------------------
42   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
43   !! $Id$
44   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
45   !!----------------------------------------------------------------------
46CONTAINS
47
48   SUBROUTINE ice_init
49      !!----------------------------------------------------------------------
50      !!                  ***  ROUTINE ice_init  ***
51      !!
52      !! ** purpose :   Allocate all the dynamic arrays of the LIM-3 modules
53      !!----------------------------------------------------------------------
54      INTEGER :: ierr
55      !!----------------------------------------------------------------------
56
57      !                                ! Allocate the ice arrays
58      ierr =        ice_alloc        ()      ! ice variables
59      ierr = ierr + dom_ice_alloc    ()      ! domain
60      ierr = ierr + sbc_ice_alloc    ()      ! surface forcing
61      ierr = ierr + thd_ice_alloc    ()      ! thermodynamics
62      ierr = ierr + lim_itd_me_alloc ()      ! ice thickness distribution - mechanics
63      !
64      IF( lk_mpp    )   CALL mpp_sum( ierr )
65      IF( ierr /= 0 )   CALL ctl_stop('STOP', 'ice_init : unable to allocate ice arrays')
66      !
67      !                                ! adequation jpk versus ice/snow layers/categories
68      IF( jpl   > jpk  .OR.  jpm    > jpk .OR.                                    &
69          jkmax > jpk  .OR.  nlay_s > jpk      )   CALL ctl_stop( 'STOP',         &
70         &     'ice_init: the 3rd dimension of workspace arrays is too small.',   &
71         &     'use more ocean levels or less ice/snow layers/categories.' )
72
73                                       ! Open the reference and configuration namelist files and namelist output file
74      CALL ctl_opn( numnam_ice_ref, 'namelist_ice_ref',    'OLD',     'FORMATTED', 'SEQUENTIAL', -1, numout, lwp ) 
75      CALL ctl_opn( numnam_ice_cfg, 'namelist_ice_cfg',    'OLD',     'FORMATTED', 'SEQUENTIAL', -1, numout, lwp )
76      CALL ctl_opn( numoni,         'output.namelist.ice', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp )
77      !
78      CALL ice_run                     ! set some ice run parameters
79      !
80      CALL lim_thd_init                ! set ice thermodynics parameters
81      !
82      CALL lim_thd_sal_init            ! set ice salinity parameters
83      !
84      rdt_ice   = nn_fsbc * rdttra(1)  ! sea-ice timestep
85      r1_rdtice = 1._wp / rdt_ice      ! sea-ice timestep inverse
86      !
87      CALL lim_msh                     ! ice mesh initialization
88      !
89      CALL lim_itd_ini                 ! ice thickness distribution initialization
90      !
91      CALL lim_sbc_init                ! ice surface boundary condition   
92
93
94      !                                ! Initial sea-ice state
95      IF( .NOT.ln_rstart ) THEN              ! start from rest
96         numit = 0
97         numit = nit000 - 1
98         CALL lim_istate                        ! start from rest: sea-ice deduced from sst
99         CALL lim_var_agg(1)                    ! aggregate category variables in bulk variables
100         CALL lim_var_glo2eqv                   ! convert global variables in equivalent variables
101      ELSE                                   ! start from a restart file
102         CALL lim_rst_read                      ! read the restart file
103         numit = nit000 - 1
104         CALL lim_var_agg(1)                    ! aggregate ice variables
105         CALL lim_var_glo2eqv                   ! convert global var in equivalent variables
106      ENDIF
107      !
108      fr_i(:,:) = at_i(:,:)           ! initialisation of sea-ice fraction
109      !
110      nstart = numit  + nn_fsbc     
111      nitrun = nitend - nit000 + 1 
112      nlast  = numit  + nitrun 
113      !
114      IF( nstock == 0  )   nstock = nlast + 1
115      !
116   END SUBROUTINE ice_init
117
118
119   SUBROUTINE ice_run
120      !!-------------------------------------------------------------------
121      !!                  ***  ROUTINE ice_run ***
122      !!                 
123      !! ** Purpose :   Definition some run parameter for ice model
124      !!
125      !! ** Method  :   Read the namicerun namelist and check the parameter
126      !!              values called at the first timestep (nit000)
127      !!
128      !! ** input   :   Namelist namicerun
129      !!-------------------------------------------------------------------
130      NAMELIST/namicerun/ cn_icerst_in, cn_icerst_out, ln_limdyn, acrit, hsndif, hicdif, cai, cao, ln_nicep
131      INTEGER  ::   ios                 ! Local integer output status for namelist read
132      !!-------------------------------------------------------------------
133      !                   
134      REWIND( numnam_ice_ref )              ! Namelist namicerun in reference namelist : Parameters for ice
135      READ  ( numnam_ice_ref, namicerun, IOSTAT = ios, ERR = 901)
136901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicerun in reference namelist', lwp )
137
138      REWIND( numnam_ice_cfg )              ! Namelist namicerun in configuration namelist : Parameters for ice
139      READ  ( numnam_ice_cfg, namicerun, IOSTAT = ios, ERR = 902 )
140902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicerun in configuration namelist', lwp )
141      WRITE ( numoni, namicerun )
142      !
143      IF( lk_mpp .AND. ln_nicep ) THEN
144         ln_nicep = .FALSE.
145         CALL ctl_warn( 'ice_run : specific control print for LIM3 desactivated with MPI' )
146      ENDIF       
147      !
148      IF(lwp) THEN                        ! control print
149         WRITE(numout,*)
150         WRITE(numout,*) 'ice_run : ice share parameters for dynamics/advection/thermo of sea-ice'
151         WRITE(numout,*) ' ~~~~~~'
152         WRITE(numout,*) '   switch for ice dynamics (1) or not (0)      ln_limdyn   = ', ln_limdyn
153         WRITE(numout,*) '   minimum fraction for leads in the NH (SH)  acrit(1/2)   = ', acrit(:)
154         WRITE(numout,*) '   computation of temp. in snow (=0) or not (=9999) hsndif = ', hsndif
155         WRITE(numout,*) '   computation of temp. in ice  (=0) or not (=9999) hicdif = ', hicdif
156         WRITE(numout,*) '   atmospheric drag over sea ice                           = ', cai
157         WRITE(numout,*) '   atmospheric drag over ocean                             = ', cao
158         WRITE(numout,*) '   Several ice points in the ice or not in ocean.output    = ', ln_nicep
159      ENDIF
160      !
161   END SUBROUTINE ice_run
162
163
164   SUBROUTINE lim_itd_ini
165      !!------------------------------------------------------------------
166      !!                ***  ROUTINE lim_itd_ini ***
167      !!
168      !! ** Purpose :   Initializes the ice thickness distribution
169      !! ** Method  :   ...
170      !!------------------------------------------------------------------
171      INTEGER  ::   jl, jm               ! dummy loop index
172      REAL(wp) ::   zc1, zc2, zc3, zx1   ! local scalars
173      !!------------------------------------------------------------------
174
175      IF(lwp) WRITE(numout,*)
176      IF(lwp) WRITE(numout,*) 'lim_itd_ini : Initialization of ice thickness distribution '
177      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~'
178
179      !------------------------------------------------------------------------------!
180      ! 1) Ice thickness distribution parameters initialization   
181      !------------------------------------------------------------------------------!
182
183      !- Types boundaries (integer)
184      !----------------------------
185      ice_cat_bounds(1,1) = 1
186      ice_cat_bounds(1,2) = jpl
187
188      !- Number of ice thickness categories in each ice type
189      DO jm = 1, jpm
190         ice_ncat_types(jm) = ice_cat_bounds(jm,2) - ice_cat_bounds(jm,1) + 1 
191      END DO
192
193      !- Make the correspondence between thickness categories and ice types
194      !---------------------------------------------------------------------
195      DO jm = 1, jpm       !over types
196         DO jl = ice_cat_bounds(jm,1), ice_cat_bounds(jm,2) !over thickness categories
197            ice_types(jl) = jm
198         END DO
199      END DO
200
201      IF(lwp) THEN 
202         WRITE(numout,*) ' Number of ice types jpm =      ', jpm
203         WRITE(numout,*) ' Number of ice categories jpl = ', jpl
204         DO jm = 1, jpm
205            WRITE(numout,*) ' Ice type ', jm
206            WRITE(numout,*) ' Number of thickness categories ', ice_ncat_types(jm)
207            WRITE(numout,*) ' Thickness category boundaries  ', ice_cat_bounds(jm,1:2)
208         END DO
209         WRITE(numout,*) 'Ice type vector', ice_types(1:jpl)
210         WRITE(numout,*)
211      ENDIF
212
213      !- Thickness categories boundaries
214      !----------------------------------
215      hi_max(:) = 0._wp
216      hi_max_typ(:,:) = 0._wp
217
218      !- Type 1 - undeformed ice
219      zc1 =  3._wp / REAL( ice_cat_bounds(1,2) - ice_cat_bounds(1,1) + 1 , wp )
220      zc2 = 10._wp * zc1
221      zc3 =  3._wp
222
223      DO jl = ice_cat_bounds(1,1), ice_cat_bounds(1,2)
224         zx1 = REAL( jl-1 , wp ) / REAL( ice_cat_bounds(1,2) - ice_cat_bounds(1,1) + 1 , wp )
225         hi_max(jl) = hi_max(jl-1) + zc1 + zc2 * (1._wp + TANH( zc3 * (zx1 - 1._wp ) ) )
226      END DO
227
228      !- Fill in the hi_max_typ vector, useful in other circumstances
229      ! Tricky trick: hi_max_typ is actually not used in the code and will be removed in a
230      ! next flyspray at this time, the tricky trick will also be removed (Martin, march 08)
231      DO jl = ice_cat_bounds(1,1), ice_cat_bounds(1,2)
232         hi_max_typ(jl,1) = hi_max(jl)
233      END DO
234
235      IF(lwp) WRITE(numout,*) ' Thickness category boundaries independently of ice type '
236      IF(lwp) WRITE(numout,*) ' hi_max ', hi_max(0:jpl)
237
238      IF(lwp) WRITE(numout,*) ' Thickness category boundaries inside ice types '
239      IF(lwp) THEN
240         DO jm = 1, jpm
241            WRITE(numout,*) ' Type number ', jm
242            WRITE(numout,*) ' hi_max_typ : ', hi_max_typ(0:ice_ncat_types(jm),jm)
243         END DO
244      ENDIF
245      !
246      DO jl = 1, jpl
247         hi_mean(jl) = ( hi_max(jl) + hi_max(jl-1) ) * 0.5_wp
248      END DO
249      !
250      tn_ice(:,:,:) = t_su(:,:,:)
251      !
252   END SUBROUTINE lim_itd_ini
253
254#else
255   !!----------------------------------------------------------------------
256   !!   Default option :        Empty module           NO LIM sea-ice model
257   !!----------------------------------------------------------------------
258CONTAINS
259   SUBROUTINE ice_init        ! Empty routine
260   END SUBROUTINE ice_init
261#endif
262
263   !!======================================================================
264END MODULE iceini
Note: See TracBrowser for help on using the repository browser.