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

Guillaume Samson
committed
! ensure that nn_verbose_write is a multiple of nn_fsbc
IF (MOD(nn_verbose_write, nn_fsbc) /= 0) THEN
CALL ctl_stop( 'icb_nam: nn_verbose_write is not a multiple of nn_fsbc')
END IF
!
! ensure that nn_sample_rate is a multiple of nn_fsbc
IF (MOD(nn_sample_rate, nn_fsbc) /= 0) THEN
CALL ctl_stop( 'icb_nam: nn_sample_rate is not a multiple of nn_fsbc')
END IF
!
END SUBROUTINE icb_nam
!!======================================================================
END MODULE icbini