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