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