- Timestamp:
- 2019-06-18T17:48:39+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/UKMO/r6232_collate_bgc_diagnostics/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90
r11132 r11134 40 40 #endif 41 41 USE sbc_oce ! Surface boundary condition variables. 42 USE zdfmxl, ONLY : & 43 & hmld_tref, & 44 #if defined key_karaml 45 & hmld_kara, & 46 & ln_kara, & 47 #endif 48 & hmld, & 49 & hmlp, & 50 & hmlpt 51 #if defined key_bdy 52 USE bdy_oce, ONLY: bdytmask 53 #endif 42 54 43 55 IMPLICIT NONE … … 57 69 #endif 58 70 LOGICAL, PUBLIC :: ln_bkgwri = .FALSE. !: No output of the background state fields 71 LOGICAL, PUBLIC :: ln_avgbkg = .FALSE. !: No output of the mean background state fields 59 72 LOGICAL, PUBLIC :: ln_asmiau = .FALSE. !: No applying forcing with an assimilation increment 60 73 LOGICAL, PUBLIC :: ln_asmdin = .FALSE. !: No direct initialization … … 80 93 INTEGER , PUBLIC :: nitiaustr !: Time step of the start of the IAU interval 81 94 INTEGER , PUBLIC :: nitiaufin !: Time step of the end of the IAU interval 95 INTEGER , PUBLIC :: nitavgbkg !: Number of timesteps to average assim bkg [0,nitavgbkg] 82 96 ! 83 97 INTEGER , PUBLIC :: niaufn !: Type of IAU weighing function: = 0 Constant weighting … … 87 101 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: ssh_bkg, ssh_bkginc ! Background sea surface height and its increment 88 102 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: seaice_bkginc ! Increment to the background sea ice conc 103 104 INTEGER :: mld_choice = 4 !: choice of mld criteria to use for physics assimilation 105 !: 1) hmld - Turbocline/mixing depth [W points] 106 !: 2) hmlp - Density criterion (0.01 kg/m^3 change from 10m) [W points] 107 !: 3) hmld_kara - Kara MLD [Interpolated] 108 !: 4) hmld_tref - Temperature criterion (0.2 K change from surface) [T points] 109 89 110 90 111 !! * Substitutions … … 119 140 INTEGER :: iitiaustr_date ! Date YYYYMMDD of IAU interval start time step 120 141 INTEGER :: iitiaufin_date ! Date YYYYMMDD of IAU interval final time step 142 INTEGER :: isurfstat ! Local integer for status of reading surft variable 143 INTEGER :: iitavgbkg_date ! Date YYYYMMDD of end of assim bkg averaging period 121 144 ! 122 145 REAL(wp) :: znorm ! Normalization factor for IAU weights … … 127 150 REAL(wp) :: zdate_inc ! Time axis in increments file 128 151 ! 152 REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: & 153 & t_bkginc_2d ! file for reading in 2D 154 ! ! temperature increments 155 REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: & 156 & z_mld ! Mixed layer depth 157 129 158 REAL(wp), POINTER, DIMENSION(:,:) :: hdiv ! 2D workspace 130 !! 131 NAMELIST/nam_asminc/ ln_bkgwri, & 159 ! 160 LOGICAL :: lk_surft ! Logical: T => Increments file contains surft variable 161 ! so only apply surft increments. 162 !! 163 NAMELIST/nam_asminc/ ln_bkgwri, ln_avgbkg, & 132 164 & ln_trainc, ln_dyninc, ln_sshinc, & 133 165 & ln_asmdin, ln_asmiau, & 134 166 & nitbkg, nitdin, nitiaustr, nitiaufin, niaufn, & 135 & ln_salfix, salfixmin, nn_divdmp 167 & ln_salfix, salfixmin, nn_divdmp, nitavgbkg, mld_choice 136 168 !!---------------------------------------------------------------------- 137 169 … … 139 171 ! Read Namelist nam_asminc : assimilation increment interface 140 172 !----------------------------------------------------------------------- 173 174 ! Set default values 175 ln_bkgwri = .FALSE. 176 ln_avgbkg = .FALSE. 177 ln_trainc = .FALSE. 178 ln_dyninc = .FALSE. 179 ln_sshinc = .FALSE. 141 180 ln_seaiceinc = .FALSE. 181 ln_asmdin = .FALSE. 182 ln_asmiau = .TRUE. 183 ln_salfix = .FALSE. 142 184 ln_temnofreeze = .FALSE. 185 salfixmin = -9999 186 nitbkg = 0 187 nitdin = 0 188 nitiaustr = 1 189 nitiaufin = 150 190 niaufn = 0 191 nitavgbkg = 1 143 192 144 193 REWIND( numnam_ref ) ! Namelist nam_asminc in reference namelist : Assimilation increment … … 158 207 WRITE(numout,*) ' Namelist namasm : set assimilation increment parameters' 159 208 WRITE(numout,*) ' Logical switch for writing out background state ln_bkgwri = ', ln_bkgwri 209 WRITE(numout,*) ' Logical switch for writing mean background state ln_avgbkg = ', ln_avgbkg 160 210 WRITE(numout,*) ' Logical switch for applying tracer increments ln_trainc = ', ln_trainc 161 211 WRITE(numout,*) ' Logical switch for applying velocity increments ln_dyninc = ', ln_dyninc … … 168 218 WRITE(numout,*) ' Timestep of start of IAU interval in [0,nitend-nit000-1] nitiaustr = ', nitiaustr 169 219 WRITE(numout,*) ' Timestep of end of IAU interval in [0,nitend-nit000-1] nitiaufin = ', nitiaufin 220 WRITE(numout,*) ' Number of timesteps to average assim bkg [0,nitavgbkg] nitavgbkg = ', nitavgbkg 170 221 WRITE(numout,*) ' Type of IAU weighting function niaufn = ', niaufn 171 222 WRITE(numout,*) ' Logical switch for ensuring that the sa > salfixmin ln_salfix = ', ln_salfix 172 223 WRITE(numout,*) ' Minimum salinity after applying the increments salfixmin = ', salfixmin 224 WRITE(numout,*) ' Choice of MLD for physics assimilation mld_choice = ', mld_choice 173 225 ENDIF 174 226 … … 177 229 nitiaustr_r = nitiaustr + nit000 - 1 ! Start of IAU interval referenced to nit000 178 230 nitiaufin_r = nitiaufin + nit000 - 1 ! End of IAU interval referenced to nit000 231 nitavgbkg_r = nitavgbkg + nit000 - 1 ! Averaging period referenced to nit000 179 232 180 233 iiauper = nitiaufin_r - nitiaustr_r + 1 ! IAU interval length … … 186 239 CALL calc_date( nit000, nitiaustr_r, ndate0, iitiaustr_date ) ! IAU start time referenced to ndate0 187 240 CALL calc_date( nit000, nitiaufin_r, ndate0, iitiaufin_date ) ! IAU end time referenced to ndate0 241 CALL calc_date( nit000, nitavgbkg_r, ndate0, iitavgbkg_date ) ! End of assim bkg averaging period referenced to ndate0 188 242 ! 189 243 IF(lwp) THEN … … 197 251 WRITE(numout,*) ' nitiaustr_r = ', nitiaustr_r 198 252 WRITE(numout,*) ' nitiaufin_r = ', nitiaufin_r 253 WRITE(numout,*) ' nitavgbkg_r = ', nitavgbkg_r 199 254 WRITE(numout,*) 200 255 WRITE(numout,*) ' Dates referenced to current cycle:' … … 206 261 WRITE(numout,*) ' iitiaustr_date = ', iitiaustr_date 207 262 WRITE(numout,*) ' iitiaufin_date = ', iitiaufin_date 263 WRITE(numout,*) ' iitavgbkg_date = ', iitavgbkg_date 208 264 ENDIF 209 265 … … 248 304 & CALL ctl_stop( ' nitdin :', & 249 305 & ' Background time step for Direct Initialization is outside', & 306 & ' the cycle interval') 307 308 IF ( nitavgbkg_r > nitend ) & 309 & CALL ctl_stop( ' nitavgbkg_r :', & 310 & ' Assim bkg averaging period is outside', & 250 311 & ' the cycle interval') 251 312 … … 327 388 !-------------------------------------------------------------------- 328 389 329 ALLOCATE( t_bkginc(jpi,jpj,jpk) ) 330 ALLOCATE( s_bkginc(jpi,jpj,jpk) ) 331 ALLOCATE( u_bkginc(jpi,jpj,jpk) ) 332 ALLOCATE( v_bkginc(jpi,jpj,jpk) ) 333 ALLOCATE( ssh_bkginc(jpi,jpj) ) 334 ALLOCATE( seaice_bkginc(jpi,jpj)) 390 IF ( ln_trainc ) THEN 391 ALLOCATE( t_bkginc(jpi,jpj,jpk) ) 392 ALLOCATE( s_bkginc(jpi,jpj,jpk) ) 393 t_bkginc(:,:,:) = 0.0 394 s_bkginc(:,:,:) = 0.0 395 ENDIF 396 IF ( ln_dyninc ) THEN 397 ALLOCATE( u_bkginc(jpi,jpj,jpk) ) 398 ALLOCATE( v_bkginc(jpi,jpj,jpk) ) 399 u_bkginc(:,:,:) = 0.0 400 v_bkginc(:,:,:) = 0.0 401 ENDIF 402 IF ( ln_sshinc ) THEN 403 ALLOCATE( ssh_bkginc(jpi,jpj) ) 404 ssh_bkginc(:,:) = 0.0 405 ENDIF 406 IF ( ln_seaiceinc ) THEN 407 ALLOCATE( seaice_bkginc(jpi,jpj)) 408 seaice_bkginc(:,:) = 0.0 409 ENDIF 335 410 #if defined key_asminc 336 411 ALLOCATE( ssh_iau(jpi,jpj) ) 337 #endif338 t_bkginc(:,:,:) = 0.0339 s_bkginc(:,:,:) = 0.0340 u_bkginc(:,:,:) = 0.0341 v_bkginc(:,:,:) = 0.0342 ssh_bkginc(:,:) = 0.0343 seaice_bkginc(:,:) = 0.0344 #if defined key_asminc345 412 ssh_iau(:,:) = 0.0 346 413 #endif … … 378 445 379 446 IF ( ln_trainc ) THEN 380 CALL iom_get( inum, jpdom_autoglo, 'bckint', t_bkginc, 1 ) 381 CALL iom_get( inum, jpdom_autoglo, 'bckins', s_bkginc, 1 ) 382 ! Apply the masks 383 t_bkginc(:,:,:) = t_bkginc(:,:,:) * tmask(:,:,:) 384 s_bkginc(:,:,:) = s_bkginc(:,:,:) * tmask(:,:,:) 385 ! Set missing increments to 0.0 rather than 1e+20 386 ! to allow for differences in masks 387 WHERE( ABS( t_bkginc(:,:,:) ) > 1.0e+10 ) t_bkginc(:,:,:) = 0.0 388 WHERE( ABS( s_bkginc(:,:,:) ) > 1.0e+10 ) s_bkginc(:,:,:) = 0.0 447 448 !Test if the increments file contains the surft variable. 449 isurfstat = iom_varid( inum, 'bckinsurft', ldstop = .FALSE. ) 450 IF ( isurfstat == -1 ) THEN 451 lk_surft = .FALSE. 452 ELSE 453 lk_surft = .TRUE. 454 CALL ctl_warn( ' Applying 2D temperature increment to bottom of ML: ', & 455 & ' bckinsurft found in increments file.' ) 456 ENDIF 457 458 IF (lk_surft) THEN 459 460 ALLOCATE(z_mld(jpi,jpj)) 461 SELECT CASE(mld_choice) 462 CASE(1) 463 z_mld = hmld 464 CASE(2) 465 z_mld = hmlp 466 CASE(3) 467 #if defined key_karaml 468 IF ( ln_kara ) THEN 469 z_mld = hmld_kara 470 ELSE 471 CALL ctl_stop("Kara mixed layer not calculated as ln_kara=.false.") 472 ENDIF 473 #else 474 CALL ctl_stop("Kara mixed layer not defined in current version of NEMO") ! JW: Safety feature, should be removed 475 ! once the Kara mixed layer is available 476 #endif 477 CASE(4) 478 z_mld = hmld_tref 479 END SELECT 480 481 ALLOCATE( t_bkginc_2d(jpi,jpj) ) 482 CALL iom_get( inum, jpdom_autoglo, 'bckinsurft', t_bkginc_2d, 1) 483 #if defined key_bdy 484 DO jk = 1,jpkm1 485 WHERE( z_mld(:,:) > fsdepw(:,:,jk) ) 486 t_bkginc(:,:,jk) = t_bkginc_2d(:,:) * 0.5 * & 487 & ( 1 + cos( (fsdept(:,:,jk)/z_mld(:,:) ) * rpi ) ) 488 489 t_bkginc(:,:,jk) = t_bkginc(:,:,jk) * bdytmask(:,:) 490 ELSEWHERE 491 t_bkginc(:,:,jk) = 0. 492 ENDWHERE 493 ENDDO 494 #else 495 t_bkginc(:,:,:) = 0. 496 #endif 497 s_bkginc(:,:,:) = 0. 498 499 DEALLOCATE(z_mld, t_bkginc_2d) 500 501 ELSE 502 503 CALL iom_get( inum, jpdom_autoglo, 'bckint', t_bkginc, 1 ) 504 CALL iom_get( inum, jpdom_autoglo, 'bckins', s_bkginc, 1 ) 505 ! Apply the masks 506 t_bkginc(:,:,:) = t_bkginc(:,:,:) * tmask(:,:,:) 507 s_bkginc(:,:,:) = s_bkginc(:,:,:) * tmask(:,:,:) 508 ! Set missing increments to 0.0 rather than 1e+20 509 ! to allow for differences in masks 510 WHERE( ABS( t_bkginc(:,:,:) ) > 1.0e+10 ) t_bkginc(:,:,:) = 0.0 511 WHERE( ABS( s_bkginc(:,:,:) ) > 1.0e+10 ) s_bkginc(:,:,:) = 0.0 512 513 ENDIF 514 389 515 ENDIF 390 516 … … 892 1018 ENDIF 893 1019 1020 #if defined key_asminc 1021 ELSE 1022 ssh_iau(:,:) = 0._wp 1023 #endif 894 1024 ENDIF 895 1025
Note: See TracChangeset
for help on using the changeset viewer.