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/releases/r4.0/r4.0-HEAD/src/OCE/ICB – NEMO

source: NEMO/releases/r4.0/r4.0-HEAD/src/OCE/ICB/icbini.F90 @ 15367

Last change on this file since 15367 was 15367, checked in by davestorkey, 3 years ago

r4.0-HEAD : fix for wind forcing of icebergs #2728

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