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.
icbini.F90 in NEMO/branches/2020/tickets_icb_1900/src/OCE/ICB – NEMO

source: NEMO/branches/2020/tickets_icb_1900/src/OCE/ICB/icbini.F90 @ 13365

Last change on this file since 13365 was 13365, checked in by mathiot, 4 years ago

ticket #1900: add compatibility check (nn_fsbc and ln_M2016, SAS and ln_M2016) and rm useless debug print

  • Property svn:keywords set to Id
File size: 25.0 KB
Line 
1MODULE icbini
2   !!======================================================================
3   !!                       ***  MODULE  icbini  ***
4   !! Icebergs:  initialise variables for iceberg tracking
5   !!======================================================================
6   !! History :   -   !  2010-01  (T. Martin & A. Adcroft)  Original code
7   !!            3.3  !  2011-03  (G. Madec)  Part conversion to NEMO form ; Removal of mapping from another grid
8   !!             -   !  2011-04  (S. Alderson)  Split into separate modules ; Restore restart routines
9   !!             -   !  2011-05  (S. Alderson)  generate_test_icebergs restored ; new forcing arrays with extra halo ;
10   !!             -   !                          north fold exchange arrays added
11   !!----------------------------------------------------------------------
12   !!----------------------------------------------------------------------
13   !!   icb_init     : initialise icebergs
14   !!   icb_ini_gen  : generate test icebergs
15   !!   icb_nam      : read iceberg namelist
16   !!----------------------------------------------------------------------
17   USE dom_oce        ! ocean domain
18   USE in_out_manager ! IO routines and numout in particular
19   USE lib_mpp        ! mpi library and lk_mpp in particular
20   USE sbc_oce        ! ocean  : surface boundary condition
21   USE sbc_ice        ! sea-ice: surface boundary condition
22   USE iom            ! IOM library
23   USE fldread        ! field read
24   USE lbclnk         ! lateral boundary condition - MPP link
25   !
26   USE icb_oce        ! define iceberg arrays
27   USE icbutl         ! iceberg utility routines
28   USE icbrst         ! iceberg restart routines
29   USE icbtrj         ! iceberg trajectory I/O routines
30   USE icbdia         ! iceberg budget routines
31
32   IMPLICIT NONE
33   PRIVATE
34
35   PUBLIC   icb_init  ! routine called in nemogcm.F90 module
36
37   CHARACTER(len=100)                                 ::   cn_dir = './'   !: Root directory for location of icb files
38   TYPE(FLD_N)                                        ::   sn_icb          !: information about the calving file to be read
39   TYPE(FLD), PUBLIC, ALLOCATABLE     , DIMENSION(:)  ::   sf_icb          !: structure: file information, fields read
40                                                                           !: used in icbini and icbstp
41   !! * Substitutions
42#  include "do_loop_substitute.h90"
43   !!----------------------------------------------------------------------
44   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
45   !! $Id$
46   !! Software governed by the CeCILL license (see ./LICENSE)
47   !!----------------------------------------------------------------------
48CONTAINS
49
50   SUBROUTINE icb_init( pdt, kt )
51      !!----------------------------------------------------------------------
52      !!                  ***  ROUTINE dom_init  ***
53      !!
54      !! ** Purpose :   iceberg initialization.
55      !!
56      !! ** Method  : - read the iceberg namelist
57      !!              - find non-overlapping processor interior since we can only
58      !!                have one instance of a particular iceberg
59      !!              - calculate the destinations for north fold exchanges
60      !!              - setup either test icebergs or calving file
61      !!----------------------------------------------------------------------
62      REAL(wp), INTENT(in) ::   pdt   ! iceberg time-step (rn_Dt*nn_fsbc)
63      INTEGER , INTENT(in) ::   kt    ! time step number
64      !
65      INTEGER ::   ji, jj, jn               ! dummy loop indices
66      INTEGER ::   i1, i2, i3               ! local integers
67      INTEGER ::   ii, inum, ivar           !   -       -
68      INTEGER ::   istat1, istat2, istat3   !   -       -
69      CHARACTER(len=300) ::   cl_sdist      ! local character
70      !!----------------------------------------------------------------------
71      !
72      CALL icb_nam               ! Read and print namelist parameters
73      !
74      IF( .NOT. ln_icebergs )   RETURN
75      !
76      ! check nn_fsbc
77      IF ( ln_icebergs .AND. ln_M2016 .AND. nn_fsbc /= 1) THEN
78         IF (lwp) WRITE(numout,*) 'The use of ln_M2016 within the iceberg module is only compatible with nn_fsbc == 1'
79         IF (lwp) WRITE(numout,*) 'because it needs the 3d t,s,u,v model data'
80         CALL ctl_stop('Compatibility error in the iceberg module')
81      END IF
82      !
83      !                          ! allocate gridded fields
84      IF( icb_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'icb_alloc : unable to allocate arrays' )
85      !
86      !                          ! initialised variable with extra haloes to zero
87      ssu_e(:,:) = 0._wp   ;   ssv_e(:,:) = 0._wp   ;
88      ua_e(:,:)  = 0._wp   ;   va_e(:,:)  = 0._wp   ;
89      ff_e(:,:)  = 0._wp   ;   sst_e(:,:)  = 0._wp   ;
90      fr_e(:,:)  = 0._wp   ;
91      !
92      IF ( ln_M2016 ) THEN
93         toce_e(:,:,:) = 0._wp
94         uoce_e(:,:,:) = 0._wp
95         voce_e(:,:,:) = 0._wp
96         e3t_e(:,:,:)  = 0._wp
97      END IF
98      !
99#if defined key_si3
100      hi_e(:,:) = 0._wp   ;
101      ui_e(:,:) = 0._wp   ;   vi_e(:,:) = 0._wp   ;
102#endif
103      ssh_e(:,:) = 0._wp  ; 
104      !
105      !                          ! open ascii output file or files for iceberg status information
106      !                          ! note that we choose to do this on all processors since we cannot
107      !                          ! predict where icebergs will be ahead of time
108      IF( nn_verbose_level > 0) THEN
109         CALL ctl_opn( numicb, 'icebergs.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea )
110      ENDIF
111
112      ! set parameters (mostly from namelist)
113      !
114      berg_dt         = pdt
115      first_width (:) = SQRT(  rn_initial_mass(:) / ( rn_LoW_ratio * rn_rho_bergs * rn_initial_thickness(:) )  )
116      first_length(:) = rn_LoW_ratio * first_width(:)
117      rho_berg_1_oce  = rn_rho_bergs / pp_rho_seawater  ! scale factor used for convertion thickness to draft
118      !
119      ! deepest level affected by icebergs
120      ! can be tuned but the safest is this
121      ! (with z* and z~ the depth of each level change overtime, so the more robust micbkb is jpk)
122      micbkb = jpk
123
124      berg_grid%calving      (:,:)   = 0._wp
125      berg_grid%calving_hflx (:,:)   = 0._wp
126      berg_grid%stored_heat  (:,:)   = 0._wp
127      berg_grid%floating_melt(:,:)   = 0._wp
128      berg_grid%maxclass     (:,:)   = nclasses
129      berg_grid%stored_ice   (:,:,:) = 0._wp
130      berg_grid%tmp          (:,:)   = 0._wp
131      src_calving            (:,:)   = 0._wp
132      src_calving_hflx       (:,:)   = 0._wp
133
134      !                          ! domain for icebergs
135      IF( lk_mpp .AND. jpni == 1 )   CALL ctl_stop( 'icbinit: having ONE processor in x currently does not work' )
136      ! NB: the issue here is simply that cyclic east-west boundary condition have not been coded in mpp case
137      ! for the north fold we work out which points communicate by asking
138      ! lbc_lnk to pass processor number (valid even in single processor case)
139      ! borrow src_calving arrays for this
140      !
141      ! pack i and j together using a scaling of a power of 10
142      nicbpack = 10000
143      IF( jpiglo >= nicbpack )   CALL ctl_stop( 'icbini: processor index packing failure' )
144      nicbfldproc(:) = -1
145
146      DO_2D_11_11
147         src_calving_hflx(ji,jj) = narea
148         src_calving     (ji,jj) = nicbpack * mjg(jj) + mig(ji)
149      END_2D
150      CALL lbc_lnk( 'icbini', src_calving_hflx, 'T', 1._wp )
151      CALL lbc_lnk( 'icbini', src_calving     , 'T', 1._wp )
152
153      ! work out interior of processor from exchange array
154      ! first entry with narea for this processor is left hand interior index
155      ! last  entry                               is right hand interior index
156      jj = nlcj/2
157      nicbdi = -1
158      nicbei = -1
159      DO ji = 1, jpi
160         i3 = INT( src_calving(ji,jj) )
161         i2 = INT( i3/nicbpack )
162         i1 = i3 - i2*nicbpack
163         i3 = INT( src_calving_hflx(ji,jj) )
164         IF( i1 == mig(ji) .AND. i3 == narea ) THEN
165            IF( nicbdi < 0 ) THEN   ;   nicbdi = ji
166            ELSE                    ;   nicbei = ji
167            ENDIF
168         ENDIF
169      END DO
170      !
171      ! repeat for j direction
172      ji = nlci/2
173      nicbdj = -1
174      nicbej = -1
175      DO jj = 1, jpj
176         i3 = INT( src_calving(ji,jj) )
177         i2 = INT( i3/nicbpack )
178         i1 = i3 - i2*nicbpack
179         i3 = INT( src_calving_hflx(ji,jj) )
180         IF( i2 == mjg(jj) .AND. i3 == narea ) THEN
181            IF( nicbdj < 0 ) THEN   ;   nicbdj = jj
182            ELSE                    ;   nicbej = jj
183            ENDIF
184         ENDIF
185      END DO
186      !   
187      ! special for east-west boundary exchange we save the destination index
188      i1 = MAX( nicbdi-1, 1)
189      i3 = INT( src_calving(i1,nlcj/2) )
190      jj = INT( i3/nicbpack )
191      ricb_left = REAL( i3 - nicbpack*jj, wp )
192      i1 = MIN( nicbei+1, jpi )
193      i3 = INT( src_calving(i1,nlcj/2) )
194      jj = INT( i3/nicbpack )
195      ricb_right = REAL( i3 - nicbpack*jj, wp )
196     
197      ! north fold
198      IF( npolj > 0 ) THEN
199         !
200         ! icebergs in row nicbej+1 get passed across fold
201         nicbfldpts(:)  = INT( src_calving(:,nicbej+1) )
202         nicbflddest(:) = INT( src_calving_hflx(:,nicbej+1) )
203         !
204         ! work out list of unique processors to talk to
205         ! pack them into a fixed size array where empty slots are marked by a -1
206         DO ji = nicbdi, nicbei
207            ii = nicbflddest(ji)
208            IF( ii .GT. 0 ) THEN     ! Needed because land suppression can mean
209                                     ! that unused points are not set in edge haloes
210               DO jn = 1, jpni
211                  ! work along array until we find an empty slot
212                  IF( nicbfldproc(jn) == -1 ) THEN
213                     nicbfldproc(jn) = ii
214                     EXIT                             !!gm EXIT should be avoided: use DO WHILE expression instead
215                  ENDIF
216                  ! before we find an empty slot, we may find processor number is already here so we exit
217                  IF( nicbfldproc(jn) == ii ) EXIT
218               END DO
219            ENDIF
220         END DO
221      ENDIF
222      !
223      IF( nn_verbose_level > 0) THEN
224         WRITE(numicb,*) 'processor ', narea
225         WRITE(numicb,*) 'jpi, jpj   ', jpi, jpj
226         WRITE(numicb,*) 'nldi, nlei ', nldi, nlei
227         WRITE(numicb,*) 'nldj, nlej ', nldj, nlej
228         WRITE(numicb,*) 'berg i interior ', nicbdi, nicbei
229         WRITE(numicb,*) 'berg j interior ', nicbdj, nicbej
230         WRITE(numicb,*) 'berg left       ', ricb_left
231         WRITE(numicb,*) 'berg right      ', ricb_right
232         jj = nlcj/2
233         WRITE(numicb,*) "central j line:"
234         WRITE(numicb,*) "i processor"
235         WRITE(numicb,*) (INT(src_calving_hflx(ji,jj)), ji=1,jpi)
236         WRITE(numicb,*) "i point"
237         WRITE(numicb,*) (INT(src_calving(ji,jj)), ji=1,jpi)
238         ji = nlci/2
239         WRITE(numicb,*) "central i line:"
240         WRITE(numicb,*) "j processor"
241         WRITE(numicb,*) (INT(src_calving_hflx(ji,jj)), jj=1,jpj)
242         WRITE(numicb,*) "j point"
243         WRITE(numicb,*) (INT(src_calving(ji,jj)), jj=1,jpj)
244         IF( npolj > 0 ) THEN
245            WRITE(numicb,*) 'north fold destination points '
246            WRITE(numicb,*) nicbfldpts
247            WRITE(numicb,*) 'north fold destination procs  '
248            WRITE(numicb,*) nicbflddest
249            WRITE(numicb,*) 'north fold destination proclist  '
250            WRITE(numicb,*) nicbfldproc
251         ENDIF
252         CALL flush(numicb)
253      ENDIF
254     
255      src_calving     (:,:) = 0._wp
256      src_calving_hflx(:,:) = 0._wp
257
258      ! definition of extended surface masked needed by icb_bilin_h
259      tmask_e(:,:) = 0._wp   ;   tmask_e(1:jpi,1:jpj) = tmask(:,:,1)
260      umask_e(:,:) = 0._wp   ;   umask_e(1:jpi,1:jpj) = umask(:,:,1)
261      vmask_e(:,:) = 0._wp   ;   vmask_e(1:jpi,1:jpj) = vmask(:,:,1)
262      CALL lbc_lnk_icb( 'icbini', tmask_e, 'T', +1._wp, 1, 1 )
263      CALL lbc_lnk_icb( 'icbini', umask_e, 'U', +1._wp, 1, 1 )
264      CALL lbc_lnk_icb( 'icbini', vmask_e, 'V', +1._wp, 1, 1 )
265
266      ! definition of extended lat/lon array needed by icb_bilin_h
267      rlon_e(:,:) = 0._wp     ;  rlon_e(1:jpi,1:jpj) = glamt(:,:) 
268      rlat_e(:,:) = 0._wp     ;  rlat_e(1:jpi,1:jpj) = gphit(:,:)
269      CALL lbc_lnk_icb( 'icbini', rlon_e, 'T', +1._wp, 1, 1 )
270      CALL lbc_lnk_icb( 'icbini', rlat_e, 'T', +1._wp, 1, 1 )
271      !
272      ! definnitionn of extennded ff_f array needed by icb_utl_interp
273      ff_e(:,:) = 0._wp       ;  ff_e(1:jpi,1:jpj) = ff_f(:,:)
274      CALL lbc_lnk_icb( 'icbini', ff_e, 'F', +1._wp, 1, 1 )
275
276      ! assign each new iceberg with a unique number constructed from the processor number
277      ! and incremented by the total number of processors
278      num_bergs(:) = 0
279      num_bergs(1) = narea - jpnij
280
281      ! when not generating test icebergs we need to setup calving file
282      IF( nn_test_icebergs < 0 .OR. ln_use_calving ) THEN
283         !
284         ! maximum distribution class array does not change in time so read it once
285         cl_sdist = TRIM( cn_dir )//TRIM( sn_icb%clname )
286         CALL iom_open ( cl_sdist, inum )                              ! open file
287         ivar = iom_varid( inum, 'maxclass', ldstop=.FALSE. )
288         IF( ivar > 0 ) THEN
289            CALL iom_get  ( inum, jpdom_data, 'maxclass', src_calving )   ! read the max distribution array
290            berg_grid%maxclass(:,:) = INT( src_calving )
291            src_calving(:,:) = 0._wp
292         ENDIF
293         CALL iom_close( inum )                                     ! close file
294         !
295         IF( nn_verbose_level > 0) THEN
296            WRITE(numicb,*)
297            WRITE(numicb,*) '          calving read in a file'
298         ENDIF
299         ALLOCATE( sf_icb(1), STAT=istat1 )         ! Create sf_icb structure (calving)
300         ALLOCATE( sf_icb(1)%fnow(jpi,jpj,1), STAT=istat2 )
301         ALLOCATE( sf_icb(1)%fdta(jpi,jpj,1,2), STAT=istat3 )
302         IF( istat1+istat2+istat3 > 0 ) THEN
303            CALL ctl_stop( 'sbc_icb: unable to allocate sf_icb structure' )   ;   RETURN
304         ENDIF
305         !                                          ! fill sf_icb with the namelist (sn_icb) and control print
306         CALL fld_fill( sf_icb, (/ sn_icb /), cn_dir, 'icb_init', 'read calving data', 'namicb' )
307         !
308      ENDIF
309
310      IF( .NOT.ln_rstart ) THEN
311         IF( nn_test_icebergs > 0 )   CALL icb_ini_gen()
312      ELSE
313         IF( nn_test_icebergs > 0 ) THEN
314            CALL icb_ini_gen()
315         ELSE
316            CALL icb_rst_read()
317            l_restarted_bergs = .TRUE.
318         ENDIF
319      ENDIF
320      !
321      IF( nn_sample_rate .GT. 0 ) CALL icb_trj_init( nitend )
322      !
323      CALL icb_dia_init()
324      !
325      IF( nn_verbose_level >= 2 )   CALL icb_utl_print('icb_init, initial status', nit000-1)
326      !
327   END SUBROUTINE icb_init
328
329
330   SUBROUTINE icb_ini_gen()
331      !!----------------------------------------------------------------------
332      !!                  ***  ROUTINE icb_ini_gen  ***
333      !!
334      !! ** Purpose :   iceberg generation
335      !!
336      !! ** Method  : - at each grid point of the test box supplied in the namelist
337      !!                generate an iceberg in one class determined by the value of
338      !!                parameter nn_test_icebergs
339      !!----------------------------------------------------------------------
340      INTEGER                         ::   ji, jj, ibergs
341      TYPE(iceberg)                   ::   localberg ! NOT a pointer but an actual local variable
342      TYPE(point)                     ::   localpt
343      INTEGER                         ::   iyr, imon, iday, ihr, imin, isec
344      INTEGER                         ::   iberg
345      !!----------------------------------------------------------------------
346
347      ! For convenience
348      iberg = nn_test_icebergs
349
350      ! call get_date(Time, iyr, imon, iday, ihr, imin, isec)
351      ! Convert nemo time variables from dom_oce into local versions
352      iyr  = nyear
353      imon = nmonth
354      iday = nday
355      ihr = INT(nsec_day/3600)
356      imin = INT((nsec_day-ihr*3600)/60)
357      isec = nsec_day - ihr*3600 - imin*60
358
359      ! no overlap for icebergs since we want only one instance of each across the whole domain
360      ! so restrict area of interest
361      ! use tmask here because tmask_i has been doctored on one side of the north fold line
362
363      DO jj = nicbdj, nicbej
364         DO ji = nicbdi, nicbei
365            IF( tmask(ji,jj,1) > 0._wp        .AND.                                       &
366                rn_test_box(1) < glamt(ji,jj) .AND. glamt(ji,jj) < rn_test_box(2) .AND.   &
367                rn_test_box(3) < gphit(ji,jj) .AND. gphit(ji,jj) < rn_test_box(4) ) THEN
368               localberg%mass_scaling = rn_mass_scaling(iberg)
369               localpt%xi = REAL( mig(ji), wp )
370               localpt%yj = REAL( mjg(jj), wp )
371               CALL icb_utl_interp( localpt%xi, localpt%yj, plat=localpt%lat, plon=localpt%lon )   
372               localpt%mass      = rn_initial_mass     (iberg)
373               localpt%thickness = rn_initial_thickness(iberg)
374               localpt%width  = first_width (iberg)
375               localpt%length = first_length(iberg)
376               localpt%year = iyr
377               localpt%day = REAL(iday,wp)+(REAL(ihr,wp)+REAL(imin,wp)/60._wp)/24._wp
378               localpt%mass_of_bits = 0._wp
379               localpt%heat_density = 0._wp
380               localpt%uvel = 0._wp
381               localpt%vvel = 0._wp
382               localpt%kb   = 1
383               CALL icb_utl_incr()
384               localberg%number(:) = num_bergs(:)
385               call icb_utl_add(localberg, localpt)
386            ENDIF
387         END DO
388      END DO
389      !
390      ibergs = icb_utl_count()
391      CALL mpp_sum('icbini', ibergs)
392      IF( nn_verbose_level > 0) THEN
393         WRITE(numicb,'(a,i6,a)') 'diamonds, icb_ini_gen: ',ibergs,' were generated'
394      ENDIF
395      !
396   END SUBROUTINE icb_ini_gen
397
398
399   SUBROUTINE icb_nam
400      !!----------------------------------------------------------------------
401      !!                     ***  ROUTINE icb_nam  ***
402      !!
403      !! ** Purpose :   read iceberg namelist and print the variables.
404      !!
405      !! ** input   : - namberg namelist
406      !!----------------------------------------------------------------------
407      INTEGER  ::   jn      ! dummy loop indices
408      INTEGER  ::   ios     ! Local integer output status for namelist read
409      REAL(wp) ::   zfact   ! local scalar
410      !
411      NAMELIST/namberg/ ln_icebergs    , ln_bergdia     , nn_sample_rate      , rn_initial_mass      ,   &
412         &              rn_distribution, rn_mass_scaling, rn_initial_thickness, nn_verbose_write     ,   &
413         &              rn_rho_bergs   , rn_LoW_ratio   , nn_verbose_level    , ln_operator_splitting,   &
414         &              rn_bits_erosion_fraction        , rn_sicn_shift       , ln_passive_mode      ,   &
415         &              ln_time_average_weight          , nn_test_icebergs    , rn_test_box          ,   &
416         &              ln_use_calving , rn_speed_limit , cn_dir, sn_icb      , ln_M2016             ,   &
417         &              cn_icbrst_indir, cn_icbrst_in   , cn_icbrst_outdir    , cn_icbrst_out
418      !!----------------------------------------------------------------------
419
420#if defined key_agrif
421      IF(lwp) THEN
422         WRITE(numout,*)
423         WRITE(numout,*) 'icb_nam : AGRIF is not compatible with namelist namberg :  '
424         WRITE(numout,*) '~~~~~~~   definition of rn_initial_mass(nclasses) with nclasses as PARAMETER '
425         WRITE(numout,*)
426         WRITE(numout,*) '   ==>>>   force  NO icebergs used. The namelist namberg is not read'
427      ENDIF
428      ln_icebergs = .false.     
429      RETURN
430#else
431      IF(lwp) THEN
432         WRITE(numout,*)
433         WRITE(numout,*) 'icb_nam : iceberg initialization through namberg namelist read'
434         WRITE(numout,*) '~~~~~~~~ '
435      ENDIF
436#endif   
437      !                             !==  read namelist  ==!
438      READ  ( numnam_ref, namberg, IOSTAT = ios, ERR = 901)
439901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namberg in reference namelist' )
440      READ  ( numnam_cfg, namberg, IOSTAT = ios, ERR = 902 )
441902   IF( ios >  0 ) CALL ctl_nam ( ios , 'namberg in configuration namelist' )
442      IF(lwm) WRITE ( numond, namberg )
443      !
444      IF(lwp) WRITE(numout,*)
445      IF( ln_icebergs ) THEN
446         IF(lwp) WRITE(numout,*) '   ==>>>   icebergs are used'
447      ELSE
448         IF(lwp) WRITE(numout,*) '   ==>>>   No icebergs used'
449         RETURN
450      ENDIF
451      !
452      IF( nn_test_icebergs > nclasses ) THEN
453         IF(lwp) WRITE(numout,*)
454         IF(lwp) WRITE(numout,*) '   ==>>>   Resetting of nn_test_icebergs to ', nclasses
455         nn_test_icebergs = nclasses
456      ENDIF
457      !
458      IF( nn_test_icebergs < 0 .AND. .NOT. ln_use_calving ) THEN
459         IF(lwp) WRITE(numout,*)
460         IF(lwp) WRITE(numout,*) '   ==>>>   Resetting ln_use_calving to .true. since we are not using test icebergs'
461         ln_use_calving = .true.
462      ENDIF
463      !
464      IF(lwp) THEN                  ! control print
465         WRITE(numout,*)
466         WRITE(numout,*) 'icb_nam : iceberg initialization through namberg namelist read'
467         WRITE(numout,*) '~~~~~~~~ '
468         WRITE(numout,*) '   Calculate budgets                                            ln_bergdia       = ', ln_bergdia
469         WRITE(numout,*) '   Period between sampling of position for trajectory storage   nn_sample_rate = ', nn_sample_rate
470         WRITE(numout,*) '   Mass thresholds between iceberg classes (kg)                 rn_initial_mass     ='
471         DO jn = 1, nclasses
472            WRITE(numout,'(a,f15.2)') '                                                                ', rn_initial_mass(jn)
473         ENDDO
474         WRITE(numout,*) '   Fraction of calving to apply to this class (non-dim)         rn_distribution     ='
475         DO jn = 1, nclasses
476            WRITE(numout,'(a,f10.4)') '                                                                ', rn_distribution(jn)
477         END DO
478         WRITE(numout,*) '   Ratio between effective and real iceberg mass (non-dim)      rn_mass_scaling     = '
479         DO jn = 1, nclasses
480            WRITE(numout,'(a,f10.2)') '                                                                ', rn_mass_scaling(jn)
481         END DO
482         WRITE(numout,*) '   Total thickness of newly calved bergs (m)                    rn_initial_thickness = '
483         DO jn = 1, nclasses
484            WRITE(numout,'(a,f10.2)') '                                                                ', rn_initial_thickness(jn)
485         END DO
486         WRITE(numout,*) '   Timesteps between verbose messages                           nn_verbose_write    = ', nn_verbose_write
487
488         WRITE(numout,*) '   Density of icebergs                           rn_rho_bergs  = ', rn_rho_bergs
489         WRITE(numout,*) '   Initial ratio L/W for newly calved icebergs   rn_LoW_ratio  = ', rn_LoW_ratio
490         WRITE(numout,*) '   Turn on more verbose output                          level  = ', nn_verbose_level
491         WRITE(numout,*) '   Use first order operator splitting for thermodynamics    ',   &
492            &                    'use_operator_splitting = ', ln_operator_splitting
493         WRITE(numout,*) '   Fraction of erosion melt flux to divert to bergy bits    ',   &
494            &                    'bits_erosion_fraction = ', rn_bits_erosion_fraction
495
496         WRITE(numout,*) '   Shift of sea-ice concentration in erosion flux modulation ',   &
497            &                    '(0<sicn_shift<1)    rn_sicn_shift  = ', rn_sicn_shift
498         WRITE(numout,*) '   Do not add freshwater flux from icebergs to ocean                ',   &
499            &                    '                  passive_mode            = ', ln_passive_mode
500         WRITE(numout,*) '   Time average the weight on the ocean   time_average_weight       = ', ln_time_average_weight
501         WRITE(numout,*) '   Create icebergs in absence of a restart file   nn_test_icebergs  = ', nn_test_icebergs
502         WRITE(numout,*) '                   in lon/lat box                                   = ', rn_test_box
503         WRITE(numout,*) '   Use calving data even if nn_test_icebergs > 0    ln_use_calving  = ', ln_use_calving
504         WRITE(numout,*) '   CFL speed limit for a berg            speed_limit                = ', rn_speed_limit
505         WRITE(numout,*) '   Writing Iceberg status information to icebergs.stat file        '
506      ENDIF
507      !
508      ! ensure that the sum of berg input distribution is equal to one
509      zfact = SUM( rn_distribution )
510      IF( zfact /= 1._wp .AND. 0_wp /= zfact ) THEN
511         rn_distribution(:) = rn_distribution(:) / zfact
512         IF(lwp) THEN
513            WRITE(numout,*)
514            WRITE(numout,*) '      ==>>> CAUTION:    sum of berg input distribution = ', zfact
515            WRITE(numout,*) '            *******     redistribution has been rescaled'
516            WRITE(numout,*) '                        updated berg distribution is :'
517            DO jn = 1, nclasses
518               WRITE(numout,'(a,f10.4)') '                                   ',rn_distribution(jn)
519            END DO
520         ENDIF
521      ENDIF
522      IF( MINVAL( rn_distribution(:) ) < 0._wp ) THEN
523         CALL ctl_stop( 'icb_nam: a negative rn_distribution value encountered ==>> change your namelist namberg' )
524      ENDIF
525      !
526   END SUBROUTINE icb_nam
527
528   !!======================================================================
529END MODULE icbini
Note: See TracBrowser for help on using the repository browser.