Changeset 8813
- Timestamp:
- 2017-11-24T17:56:51+01:00 (6 years ago)
- Location:
- branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/CONFIG/SHARED/namelist_ice_lim3_ref
r8637 r8813 41 41 &namitd ! Ice discretization 42 42 !------------------------------------------------------------------------------ 43 rn_himean = 2.0 ! expected domain-average ice thickness (m) 43 ln_cat_hfn = .true. ! ice categories are defined by a function following rn_himean**(-0.05) 44 rn_himean = 2.0 ! expected domain-average ice thickness (m) 45 ln_cat_usr = .false. ! ice categories are defined by rn_catbnd below (m) 46 rn_catbnd = 0.,0.45,1.1,2.1,3.7,6.0 44 47 rn_himin = 0.1 ! minimum ice thickness (m) used in remapping 45 48 / … … 90 93 !------------------------------------------------------------------------------ 91 94 ln_rhg_EVP = .true. ! EVP rheology 92 rn_creepl = 1.0e-12 ! creep limit [1/s] 95 ln_aEVP = .false. ! adaptive rheology (Kimmritz et al. 2016 & 2017) 96 rn_creepl = 2.0e-9 ! creep limit [1/s] 93 97 rn_ecc = 2.0 ! eccentricity of the elliptical yield curve 94 98 nn_nevp = 120 ! number of EVP subcycles … … 118 122 ! = 2 Redistribute a single flux over categories 119 123 ! ==> coupled mode only 124 nice_jules = 1 ! Jules coupling (0=OFF, 1=EMULATED, 2=ACTIVE) 120 125 / 121 126 !------------------------------------------------------------------------------ … … 136 141 ! Obs: 0.1-0.5 (Lecomte et al, JAMES 2013) 137 142 rn_kappa_i = 1.0 ! radiation attenuation coefficient in sea ice [1/m] 138 ln_dqns_i = .true. ! change the surface non-solar flux with surface temperature (T) or not (F)139 143 / 140 144 !------------------------------------------------------------------------------ -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/LIM_SRC_3/ice.F90
r8637 r8813 178 178 ! 179 179 ! !!** ice-rheology namelist (namrhg) ** 180 LOGICAL , PUBLIC :: ln_aEVP !: using adaptive EVP (T or F) 180 181 REAL(wp), PUBLIC :: rn_creepl !: creep limit : has to be under 1.0e-9 181 182 REAL(wp), PUBLIC :: rn_ecc !: eccentricity of the elliptical yield curve … … 194 195 ! ! using T-ice and albedo sensitivity 195 196 ! ! = 2 Redistribute a single flux over categories 197 198 INTEGER , PUBLIC :: nice_jules !: Choice of jules coupling 199 ! ! Associated indices 200 INTEGER , PUBLIC, PARAMETER :: np_jules_OFF = 0 !: no Jules coupling (ice thermodynamics forced via qsr and qns) 201 INTEGER , PUBLIC, PARAMETER :: np_jules_EMULE = 1 !: emulated Jules coupling via icethd_zdf.F90 (BL99) (1st round compute qcn and qsr_tr, 2nd round use it) 202 INTEGER , PUBLIC, PARAMETER :: np_jules_ACTIVE = 2 !: active Jules coupling (SM0L) (compute qcn and qsr_tr via sbcblk.F90 or sbccpl.F90) 196 203 197 204 ! !!** ice-salinity namelist (namthd_sal) ** -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/LIM_SRC_3/ice1d.F90
r8692 r8813 33 33 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: ftr_ice_1d 34 34 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: qsr_ice_1d 35 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: fr1_i0_1d36 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: fr2_i0_1d37 35 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: qns_ice_1d 38 36 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: t_bo_1d 39 37 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: rn_amax_1d 38 39 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: qml_ice_1d !: heat available for snow / ice surface melting [W/m2] 40 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: qcn_ice_1d !: heat available for snow / ice surface sublimation¬ [W/m2] 41 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: qsr_ice_tr_1d !: solar flux transmitted below the ice surface¬ [W/m2] 40 42 41 43 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: hfx_sum_1d … … 96 98 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: evap_ice_1d !: <==> the 2D evap_ice 97 99 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: qprec_ice_1d !: <==> the 2D qprec_ice 98 ! ! to reintegrate longwave flux inside the ice thermodynamics99 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: i0 !: fraction of radiation transmitted to the ice100 100 101 101 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: t_su_1d !: <==> the 2D t_su … … 178 178 ALLOCATE( nptidx (jpij) , & 179 179 & qlead_1d (jpij) , ftr_ice_1d(jpij) , qsr_ice_1d (jpij) , & 180 & fr1_i0_1d(jpij) , fr2_i0_1d (jpij) , qns_ice_1d(jpij) , & 180 & qns_ice_1d(jpij) , & 181 & qml_ice_1d(jpij), qcn_ice_1d(jpij) , qsr_ice_tr_1d(jpij) , & 181 182 & t_bo_1d (jpij) , & 182 183 & hfx_sum_1d(jpij) , hfx_bom_1d(jpij) ,hfx_bog_1d(jpij) , & … … 194 195 & wfx_snw_sub_1d(jpij), wfx_snw_dyn_1d(jpij), wfx_ice_sub_1d(jpij), wfx_err_sub_1d(jpij) , & 195 196 & wfx_lam_1d(jpij) , wfx_dyn_1d(jpij), wfx_pnd_1d(jpij),dqns_ice_1d(jpij) , evap_ice_1d (jpij), & 196 & qprec_ice_1d(jpij), i0 (jpij) ,&197 & qprec_ice_1d(jpij), & 197 198 & sfx_bri_1d (jpij) , sfx_bog_1d (jpij) , sfx_bom_1d (jpij) , sfx_sum_1d (jpij), & 198 199 & sfx_sni_1d (jpij) , sfx_opw_1d (jpij) , sfx_res_1d (jpij) , sfx_sub_1d (jpij), & … … 200 201 ! 201 202 ii = ii + 1 202 ALLOCATE( t_su_1d (jpij) , t_si_1d (jpij) , a_i_1d (jpij) , a_ib_1d(jpij) , &203 & h_i_1d (jpij) , h_ib_1d (jpij) , h_s_1d (jpij) , fc_su (jpij) , fc_bo_i(jpij) , 204 & dh_s_tot (jpij) , dh_i_surf (jpij) , dh_i_sub(jpij) , &203 ALLOCATE( t_su_1d (jpij) , t_si_1d (jpij) , a_i_1d (jpij) , a_ib_1d(jpij) , & 204 & h_i_1d (jpij) , h_ib_1d (jpij) , h_s_1d (jpij) , fc_su (jpij) , fc_bo_i(jpij) , & 205 & dh_s_tot (jpij) , dh_i_surf (jpij) , dh_i_sub(jpij) , & 205 206 & dh_i_bott(jpij) , dh_s_mlt(jpij), dh_snowice(jpij) , s_i_1d (jpij) , s_i_new(jpij) , & 206 207 & a_ip_1d (jpij) , v_ip_1d (jpij) , v_i_1d (jpij) , v_s_1d (jpij) , & … … 210 211 ii = ii + 1 211 212 ALLOCATE( t_s_1d (jpij,nlay_s) , t_i_1d (jpij,nlay_i) , sz_i_1d(jpij,nlay_i) , & 212 & e_i_1d (jpij,nlay_i) , e_s_1d (jpij,nlay_s) , 213 & e_i_1d (jpij,nlay_i) , e_s_1d (jpij,nlay_s) , & 213 214 & eh_i_old(jpij,0:nlay_i+1) , h_i_old(jpij,0:nlay_i+1) , STAT=ierr(ii) ) 214 215 ! … … 220 221 ! 221 222 ii = ii + 1 222 ALLOCATE( a_i_2d (jpij,jpl) , a_ib_2d(jpij,jpl) , h_i_2d (jpij,jpl) , h_ib_2d(jpij,jpl) , & 223 & v_i_2d (jpij,jpl) , v_s_2d (jpij,jpl) , oa_i_2d(jpij,jpl) , sv_i_2d(jpij,jpl) , & 224 & a_ip_2d(jpij,jpl) , v_ip_2d(jpij,jpl) , t_su_2d(jpij,jpl) , STAT=ierr(ii) ) 223 ALLOCATE( a_i_2d(jpij,jpl) , a_ib_2d(jpij,jpl) , h_i_2d(jpij,jpl) , h_ib_2d(jpij,jpl) , & 224 & v_i_2d(jpij,jpl) ,v_s_2d(jpij,jpl) ,oa_i_2d(jpij,jpl) ,sv_i_2d(jpij,jpl) , & 225 & a_ip_2d(jpij,jpl) ,v_ip_2d(jpij,jpl) ,t_su_2d(jpij,jpl) , & 226 & STAT=ierr(ii) ) 225 227 226 228 ice1D_alloc = MAXVAL( ierr(:) ) -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/LIM_SRC_3/icedyn_rhg.F90
r8586 r8813 78 78 CASE( np_rhgEVP ) ! Elasto-Viscous-Plastic ! 79 79 ! !------------------------! 80 CALL ice_dyn_rhg_evp( kt, stress1_i, stress2_i, stress12_i, u_ice, v_ice,shear_i, divu_i, delta_i )80 CALL ice_dyn_rhg_evp( kt, stress1_i, stress2_i, stress12_i, shear_i, divu_i, delta_i ) 81 81 ! 82 82 END SELECT … … 107 107 INTEGER :: ios, ioptio ! Local integer output status for namelist read 108 108 !! 109 NAMELIST/namdyn_rhg/ ln_rhg_EVP, rn_creepl, rn_ecc , nn_nevp, rn_relast109 NAMELIST/namdyn_rhg/ ln_rhg_EVP, ln_aEVP, rn_creepl, rn_ecc , nn_nevp, rn_relast 110 110 !!------------------------------------------------------------------- 111 111 ! … … 125 125 WRITE(numout,*) ' Namelist namdyn_rhg:' 126 126 WRITE(numout,*) ' rheology EVP (icedyn_rhg_evp) ln_rhg_EVP = ', ln_rhg_EVP 127 WRITE(numout,*) ' use adaptive EVP (aEVP) ln_aEVP = ', ln_aEVP 127 128 WRITE(numout,*) ' creep limit rn_creepl = ', rn_creepl 128 129 WRITE(numout,*) ' eccentricity of the elliptical yield curve rn_ecc = ', rn_ecc … … 137 138 IF( ioptio /= 1 ) CALL ctl_stop( 'ice_dyn_rhg_init: choose one and only one ice rheology' ) 138 139 ! 139 IF( ln_rhg_EVP ) CALL rhg_evp_rst( 'READ' ) !* read or initialize all required files140 IF( ln_rhg_EVP ) CALL rhg_evp_rst( 'READ' ) !* read or initialize all required files 140 141 ! 141 142 END SUBROUTINE ice_dyn_rhg_init -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/LIM_SRC_3/icedyn_rhg_evp.F90
r8637 r8813 16 16 !! 'key_lim3' ESIM sea-ice model 17 17 !!---------------------------------------------------------------------- 18 !! ice_dyn_rhg_evp : computes ice velocities from EVP rheology 18 !! ice_dyn_rhg_evp : computes ice velocities from EVP rheology 19 !! rhg_evp_rst : read/write EVP fields in ice restart 19 20 !!---------------------------------------------------------------------- 20 21 USE phycst ! Physical constant … … 24 25 USE ice ! sea-ice: ice variables 25 26 USE icedyn_rdgrft ! sea-ice: ice strength 27 USE bdy_oce , ONLY : ln_bdy 28 USE bdyice 29 #if defined key_agrif 30 USE agrif_lim3_interp 31 #endif 26 32 ! 27 33 USE in_out_manager ! I/O manager … … 31 37 USE lbclnk ! lateral boundary conditions (or mpp links) 32 38 USE prtctl ! Print control 33 !34 #if defined key_agrif35 USE agrif_lim3_interp36 #endif37 USE bdy_oce , ONLY: ln_bdy38 USE bdyice39 39 40 40 IMPLICIT NONE … … 53 53 CONTAINS 54 54 55 SUBROUTINE ice_dyn_rhg_evp( kt, pstress1_i, pstress2_i, pstress12_i, u_ice, v_ice,pshear_i, pdivu_i, pdelta_i )55 SUBROUTINE ice_dyn_rhg_evp( kt, pstress1_i, pstress2_i, pstress12_i, pshear_i, pdivu_i, pdelta_i ) 56 56 !!------------------------------------------------------------------- 57 57 !! *** SUBROUTINE ice_dyn_rhg_evp *** 58 !! EVP-C-grid58 !! EVP-C-grid 59 59 !! 60 60 !! ** purpose : determines sea ice drift from wind stress, ice-ocean … … 95 95 !! 5) Diagnostics including charge ellipse 96 96 !! 97 !! ** Notes : There is the possibility to use mEVP from Bouillon 2013 98 !! (by uncommenting some lines in part 3 and changing alpha and beta parameters) 99 !! but this solution appears very unstable (see Kimmritz et al 2016) 97 !! ** Notes : There is the possibility to use aEVP from the nice work of Kimmritz et al. (2016 & 2017) 98 !! by setting up ln_aEVP=T (i.e. changing alpha and beta parameters). 99 !! This is an upgraded version of mEVP from Bouillon et al. 2013 100 !! (i.e. more stable and better convergence) 100 101 !! 101 102 !! References : Hunke and Dukowicz, JPO97 102 103 !! Bouillon et al., Ocean Modelling 2009 103 104 !! Bouillon et al., Ocean Modelling 2013 105 !! Kimmritz et al., Ocean Modelling 2016 & 2017 104 106 !!------------------------------------------------------------------- 105 INTEGER, INTENT(in) :: kt ! time step 106 REAL(wp), DIMENSION(:,:), INTENT(inout) :: pstress1_i, pstress2_i, pstress12_i 107 REAL(wp), DIMENSION(:,:), INTENT(inout) :: u_ice, v_ice 108 REAL(wp), DIMENSION(:,:), INTENT( out) :: pshear_i, pdivu_i, pdelta_i 107 INTEGER , INTENT(in ) :: kt ! time step 108 REAL(wp), DIMENSION(:,:), INTENT(inout) :: pstress1_i, pstress2_i, pstress12_i ! 109 REAL(wp), DIMENSION(:,:), INTENT( out) :: pshear_i , pdivu_i , pdelta_i ! 109 110 !! 110 111 INTEGER :: ji, jj ! dummy loop indices 111 112 INTEGER :: jter ! local integers 112 113 ! 113 114 REAL(wp) :: zrhoco ! rau0 * rn_cio 114 115 REAL(wp) :: zdtevp, z1_dtevp ! time step for subcycling 115 116 REAL(wp) :: ecc2, z1_ecc2 ! square of yield ellipse eccenticity 116 REAL(wp) :: z beta, zalph1, z1_alph1, zalph2, z1_alph2 ! alpha and beta from Bouillon 2009 and 2013117 REAL(wp) :: zalph1, z1_alph1, zalph2, z1_alph2 ! alpha coef from Bouillon 2009 or Kimmritz 2017 117 118 REAL(wp) :: zm1, zm2, zm3, zmassU, zmassV ! ice/snow mass 118 119 REAL(wp) :: zdelta, zp_delf, zds2, zdt, zdt2, zdiv, zdiv2 ! temporary scalars 119 120 REAL(wp) :: zTauO, zTauB, zTauE, zvel ! temporary scalars 120 121 ! 121 122 REAL(wp) :: zresm ! Maximal error on ice velocity 122 123 REAL(wp) :: zintb, zintn ! dummy argument 123 124 REAL(wp) :: zfac_x, zfac_y 124 125 REAL(wp) :: zshear, zdum1, zdum2 125 126 ! 126 127 REAL(wp), DIMENSION(jpi,jpj) :: z1_e1t0, z1_e2t0 ! scale factors 127 128 REAL(wp), DIMENSION(jpi,jpj) :: zp_delt ! P/delta at T points 128 ! 129 REAL(wp), DIMENSION(jpi,jpj) :: zbeta ! beta coef from Kimmritz 2017 130 ! 131 REAL(wp), DIMENSION(jpi,jpj) :: zdt_m ! (dt / ice-snow_mass) on T points 129 132 REAL(wp), DIMENSION(jpi,jpj) :: zaU , zaV ! ice fraction on U/V points 130 REAL(wp), DIMENSION(jpi,jpj) :: zmU_t, zmV_t ! ice/snow mass/dton U/V points133 REAL(wp), DIMENSION(jpi,jpj) :: zmU_t, zmV_t ! (ice-snow_mass / dt) on U/V points 131 134 REAL(wp), DIMENSION(jpi,jpj) :: zmf ! coriolis parameter at T points 132 135 REAL(wp), DIMENSION(jpi,jpj) :: zTauU_ia , ztauV_ia ! ice-atm. stress at U-V points … … 134 137 REAL(wp), DIMENSION(jpi,jpj) :: v_oceU, u_oceV, v_iceU, u_iceV ! ocean/ice u/v component on V/U points 135 138 REAL(wp), DIMENSION(jpi,jpj) :: zfU , zfV ! internal stresses 136 139 ! 137 140 REAL(wp), DIMENSION(jpi,jpj) :: zds ! shear 138 141 REAL(wp), DIMENSION(jpi,jpj) :: zs1, zs2, zs12 ! stress tensor components 139 142 REAL(wp), DIMENSION(jpi,jpj) :: zu_ice, zv_ice, zresr ! check convergence 140 143 REAL(wp), DIMENSION(jpi,jpj) :: zpice ! array used for the calculation of ice surface slope: 141 142 ! ice top surface if ice is embedded144 ! ! ocean surface (ssh_m) if ice is not embedded 145 ! ! ice top surface if ice is embedded 143 146 REAL(wp), DIMENSION(jpi,jpj) :: zCorx, zCory ! Coriolis stress array 144 147 REAL(wp), DIMENSION(jpi,jpj) :: ztaux_oi, ztauy_oi ! Ocean-to-ice stress array 145 148 ! 146 149 REAL(wp), DIMENSION(jpi,jpj) :: zswitchU, zswitchV ! dummy arrays 147 150 REAL(wp), DIMENSION(jpi,jpj) :: zmaskU, zmaskV ! mask for ice presence … … 179 182 #endif 180 183 ! 184 !!gm for Clem: OPTIMIZATION: I think zfmask can be computed one for all at the initialization.... 181 185 !------------------------------------------------------------------------------! 182 186 ! 0) mask at F points for the ice … … 231 235 232 236 ! alpha parameters (Bouillon 2009) 233 zalph1 = ( 2._wp * rn_relast * rdt_ice ) * z1_dtevp 234 zalph2 = zalph1 * z1_ecc2 235 236 ! alpha and beta parameters (Bouillon 2013) 237 !!zalph1 = 40. 238 !!zalph2 = 40. 239 !!zbeta = 3000. 240 !!zbeta = REAL( nn_nevp ) ! close to classical EVP of Hunke (2001) 241 242 z1_alph1 = 1._wp / ( zalph1 + 1._wp ) 243 z1_alph2 = 1._wp / ( zalph2 + 1._wp ) 244 237 IF( .NOT. ln_aEVP ) THEN 238 zalph1 = ( 2._wp * rn_relast * rdt_ice ) * z1_dtevp 239 zalph2 = zalph1 * z1_ecc2 240 241 z1_alph1 = 1._wp / ( zalph1 + 1._wp ) 242 z1_alph2 = 1._wp / ( zalph2 + 1._wp ) 243 ENDIF 244 245 245 ! Initialise stress tensor 246 246 zs1 (:,:) = pstress1_i (:,:) … … 266 266 IF( ln_ice_embd ) THEN !== embedded sea ice: compute representative ice top surface ==! 267 267 ! 268 ! average interpolation coeff as used in dynspg = (1/nn_fsbc) * {SUM[n/nn_fsbc], n=0,nn_fsbc-1}269 ! = (1/nn_fsbc)^2 * {SUM[n] , n=0,nn_fsbc-1}268 ! average interpolation coeff as used in dynspg = (1/nn_fsbc) * {SUM[n/nn_fsbc], n=0,nn_fsbc-1} 269 ! = (1/nn_fsbc)^2 * {SUM[n] , n=0,nn_fsbc-1} 270 270 zintn = REAL( nn_fsbc - 1 ) / REAL( nn_fsbc ) * 0.5_wp 271 271 ! 272 ! average interpolation coeff as used in dynspg = (1/nn_fsbc) *{SUM[1-n/nn_fsbc], n=0,nn_fsbc-1}272 ! average interpolation coeff as used in dynspg = (1/nn_fsbc) * {SUM[1-n/nn_fsbc], n=0,nn_fsbc-1} 273 273 ! = (1/nn_fsbc)^2 * (nn_fsbc^2 - {SUM[n], n=0,nn_fsbc-1}) 274 274 zintb = REAL( nn_fsbc + 1 ) / REAL( nn_fsbc ) * 0.5_wp … … 304 304 zmf(ji,jj) = zm1 * ff_t(ji,jj) 305 305 306 ! dt/m at T points (for alpha and beta coefficients) 307 zdt_m(ji,jj) = zdtevp / MAX( zm1, zmmin ) 308 306 309 ! m/dt 307 310 zmU_t(ji,jj) = zmassU * z1_dtevp 308 311 zmV_t(ji,jj) = zmassV * z1_dtevp 309 312 310 313 ! Drag ice-atm. 311 314 zTauU_ia(ji,jj) = zaU(ji,jj) * utau_ice(ji,jj) … … 326 329 END DO 327 330 END DO 328 CALL lbc_lnk ( zmf, 'T', 1. )331 CALL lbc_lnk_multi( zmf, 'T', 1., zdt_m, 'T', 1. ) 329 332 ! 330 333 !------------------------------------------------------------------------------! … … 380 383 ! P/delta at T points 381 384 zp_delt(ji,jj) = strength(ji,jj) / ( zdelta + rn_creepl ) 385 386 ! alpha & beta for aEVP 387 ! gamma = 0.5*P/(delta+creepl) * (c*pi)**2/Area * dt/m 388 ! alpha = beta = sqrt(4*gamma) 389 IF( ln_aEVP ) THEN 390 zalph1 = MAX( 50._wp, rpi * SQRT( 0.5_wp * zp_delt(ji,jj) * r1_e1e2t(ji,jj) * zdt_m(ji,jj) ) ) 391 z1_alph1 = 1._wp / ( zalph1 + 1._wp ) 392 zalph2 = zalph1 393 z1_alph2 = z1_alph1 394 ENDIF 382 395 383 396 ! stress at T points … … 392 405 DO ji = 1, jpim1 393 406 407 ! alpha & beta for aEVP 408 IF( ln_aEVP ) THEN 409 zalph2 = MAX( 50._wp, rpi * SQRT( 0.5_wp * zp_delt(ji,jj) * r1_e1e2t(ji,jj) * zdt_m(ji,jj) ) ) 410 z1_alph2 = 1._wp / ( zalph2 + 1._wp ) 411 zbeta(ji,jj) = zalph2 412 ENDIF 413 394 414 ! P/delta at F points 395 415 zp_delf = 0.25_wp * ( zp_delt(ji,jj) + zp_delt(ji+1,jj) + zp_delt(ji,jj+1) + zp_delt(ji+1,jj+1) ) … … 411 431 & ) * 2._wp * r1_e1u(ji,jj) & 412 432 & ) * r1_e1e2u(ji,jj) 413 414 433 ! 434 ! !--- V points 415 435 zfV(ji,jj) = 0.5_wp * ( ( zs1(ji,jj+1) - zs1(ji,jj) ) * e1v(ji,jj) & 416 436 & - ( zs2(ji,jj+1) * e1t(ji,jj+1) * e1t(ji,jj+1) - zs2(ji,jj) * e1t(ji,jj) * e1t(ji,jj) & … … 419 439 & ) * 2._wp * r1_e2v(ji,jj) & 420 440 & ) * r1_e1e2v(ji,jj) 421 422 441 ! 442 ! !--- u_ice at V point 423 443 u_iceV(ji,jj) = 0.5_wp * ( ( u_ice(ji,jj ) + u_ice(ji-1,jj ) ) * e2t(ji,jj+1) & 424 444 & + ( u_ice(ji,jj+1) + u_ice(ji-1,jj+1) ) * e2t(ji,jj ) ) * z1_e2t0(ji,jj) * vmask(ji,jj,1) 425 426 445 ! 446 ! !--- v_ice at U point 427 447 v_iceU(ji,jj) = 0.5_wp * ( ( v_ice(ji ,jj) + v_ice(ji ,jj-1) ) * e1t(ji+1,jj) & 428 448 & + ( v_ice(ji+1,jj) + v_ice(ji+1,jj-1) ) * e1t(ji ,jj) ) * z1_e1t0(ji,jj) * umask(ji,jj,1) 429 !430 449 END DO 431 450 END DO 432 451 ! 433 452 ! --- Computation of ice velocity --- ! 434 ! Bouillon et al. 2013 (eq 47-48) => unstable unless alpha, beta are chosen wisely and large nn_nevp453 ! Bouillon et al. 2013 (eq 47-48) => unstable unless alpha, beta vary as in Kimmritz 2016 & 2017 435 454 ! Bouillon et al. 2009 (eq 34-35) => stable 436 455 IF( MOD(jter,2) == 0 ) THEN ! even iterations … … 438 457 DO jj = 2, jpjm1 439 458 DO ji = fs_2, fs_jpim1 440 459 ! !--- tau_io/(v_oce - v_ice) 441 460 zTauO = zaV(ji,jj) * zrhoco * SQRT( ( v_ice (ji,jj) - v_oce (ji,jj) ) * ( v_ice (ji,jj) - v_oce (ji,jj) ) & 442 461 & + ( u_iceV(ji,jj) - u_oceV(ji,jj) ) * ( u_iceV(ji,jj) - u_oceV(ji,jj) ) ) 443 462 ! !--- Ocean-to-Ice stress 444 463 ztauy_oi(ji,jj) = zTauO * ( v_oce(ji,jj) - v_ice(ji,jj) ) 445 446 464 ! 465 ! !--- tau_bottom/v_ice 447 466 zvel = MAX( zepsi, SQRT( v_ice(ji,jj) * v_ice(ji,jj) + u_iceV(ji,jj) * u_iceV(ji,jj) ) ) 448 467 zTauB = - tau_icebfr(ji,jj) / zvel 449 450 468 ! 469 ! !--- Coriolis at V-points (energy conserving formulation) 451 470 zCory(ji,jj) = - 0.25_wp * r1_e2v(ji,jj) * & 452 471 & ( zmf(ji,jj ) * ( e2u(ji,jj ) * u_ice(ji,jj ) + e2u(ji-1,jj ) * u_ice(ji-1,jj ) ) & 453 472 & + zmf(ji,jj+1) * ( e2u(ji,jj+1) * u_ice(ji,jj+1) + e2u(ji-1,jj+1) * u_ice(ji-1,jj+1) ) ) 454 455 473 ! 474 ! !--- Sum of external forces (explicit solution) = F + tau_ia + Coriolis + spg + tau_io 456 475 zTauE = zfV(ji,jj) + zTauV_ia(ji,jj) + zCory(ji,jj) + zspgV(ji,jj) + ztauy_oi(ji,jj) 457 458 476 ! 477 ! !--- landfast switch => 0 = static friction ; 1 = sliding friction 459 478 rswitch = 1._wp - MIN( 1._wp, ABS( SIGN( 1._wp, ztauE - tau_icebfr(ji,jj) ) - SIGN( 1._wp, zTauE ) ) ) 460 ! 461 ! !--- ice velocity using implicit formulation (cf Madec doc & Bouillon 2009) 479 ! 480 IF( ln_aEVP ) THEN !--- ice velocity using aEVP (Kimmritz et al 2016 & 2017) 481 v_ice(ji,jj) = ( ( rswitch * ( zmV_t(ji,jj) * ( zbeta(ji,jj) * v_ice(ji,jj) + v_ice_b(ji,jj) ) & ! previous velocity 482 & + zTauE + zTauO * v_ice(ji,jj) & ! F + tau_ia + Coriolis + spg + tau_io(only ocean part) 483 & ) / MAX( zepsi, zmV_t(ji,jj) * ( zbeta(ji,jj) + 1._wp ) + zTauO - zTauB ) & ! m/dt + tau_io(only ice part) + landfast 484 & + ( 1._wp - rswitch ) * v_ice(ji,jj) * MAX( 0._wp, 1._wp - zdtevp * rn_lfrelax ) & ! static friction => slow decrease to v=0 485 & ) * zswitchV(ji,jj) + v_oce(ji,jj) * ( 1._wp - zswitchV(ji,jj) ) & ! v_ice = v_oce if mass < zmmin 486 & ) * zmaskV(ji,jj) 487 ELSE !--- ice velocity using EVP implicit formulation (cf Madec doc & Bouillon 2009) 462 488 v_ice(ji,jj) = ( ( rswitch * ( zmV_t(ji,jj) * v_ice(ji,jj) & ! previous velocity 463 489 & + zTauE + zTauO * v_ice(ji,jj) & ! F + tau_ia + Coriolis + spg + tau_io(only ocean part) … … 466 492 & ) * zswitchV(ji,jj) + v_oce(ji,jj) * ( 1._wp - zswitchV(ji,jj) ) & ! v_ice = v_oce if mass < zmmin 467 493 & ) * zmaskV(ji,jj) 468 ! 469 ! Bouillon 2013 470 !!v_ice(ji,jj) = ( zmV_t(ji,jj) * ( zbeta * v_ice(ji,jj) + v_ice_b(ji,jj) ) & 471 !! & + zfV(ji,jj) + zCory(ji,jj) + zTauV_ia(ji,jj) + zTauO * v_oce(ji,jj) + zspgV(ji,jj) & 472 !! & ) / MAX( zmV_t(ji,jj) * ( zbeta + 1._wp ) + zTauO - zTauB, zepsi ) * zswitchV(ji,jj) 473 ! 494 ENDIF 474 495 END DO 475 496 END DO … … 483 504 ! 484 505 DO jj = 2, jpjm1 485 DO ji = fs_2, fs_jpim1 486 487 ! tau_io/(u_oce - u_ice) 506 DO ji = fs_2, fs_jpim1 507 ! !--- tau_io/(u_oce - u_ice) 488 508 zTauO = zaU(ji,jj) * zrhoco * SQRT( ( u_ice (ji,jj) - u_oce (ji,jj) ) * ( u_ice (ji,jj) - u_oce (ji,jj) ) & 489 509 & + ( v_iceU(ji,jj) - v_oceU(ji,jj) ) * ( v_iceU(ji,jj) - v_oceU(ji,jj) ) ) 490 491 ! Ocean-to-Ice stress 510 ! !--- Ocean-to-Ice stress 492 511 ztaux_oi(ji,jj) = zTauO * ( u_oce(ji,jj) - u_ice(ji,jj) ) 493 494 ! tau_bottom/u_ice512 ! 513 ! !--- tau_bottom/u_ice 495 514 zvel = MAX( zepsi, SQRT( v_iceU(ji,jj) * v_iceU(ji,jj) + u_ice(ji,jj) * u_ice(ji,jj) ) ) 496 515 zTauB = - tau_icebfr(ji,jj) / zvel 497 498 ! Coriolis at U-points (energy conserving formulation)516 ! 517 ! !--- Coriolis at U-points (energy conserving formulation) 499 518 zCorx(ji,jj) = 0.25_wp * r1_e1u(ji,jj) * & 500 519 & ( zmf(ji ,jj) * ( e1v(ji ,jj) * v_ice(ji ,jj) + e1v(ji ,jj-1) * v_ice(ji ,jj-1) ) & 501 520 & + zmf(ji+1,jj) * ( e1v(ji+1,jj) * v_ice(ji+1,jj) + e1v(ji+1,jj-1) * v_ice(ji+1,jj-1) ) ) 502 503 ! Sum of external forces (explicit solution) = F + tau_ia + Coriolis + spg + tau_io521 ! 522 ! !--- Sum of external forces (explicit solution) = F + tau_ia + Coriolis + spg + tau_io 504 523 zTauE = zfU(ji,jj) + zTauU_ia(ji,jj) + zCorx(ji,jj) + zspgU(ji,jj) + ztaux_oi(ji,jj) 505 506 ! landfast switch => 0 = static friction ; 1 = sliding friction524 ! 525 ! !--- landfast switch => 0 = static friction ; 1 = sliding friction 507 526 rswitch = 1._wp - MIN( 1._wp, ABS( SIGN( 1._wp, ztauE - tau_icebfr(ji,jj) ) - SIGN( 1._wp, zTauE ) ) ) 508 509 ! ice velocity using implicit formulation (cf Madec doc & Bouillon 2009) 527 ! 528 IF( ln_aEVP ) THEN !--- ice velocity using aEVP (Kimmritz et al 2016 & 2017) 529 u_ice(ji,jj) = ( ( rswitch * ( zmU_t(ji,jj) * ( zbeta(ji,jj) * u_ice(ji,jj) + u_ice_b(ji,jj) ) & ! previous velocity 530 & + zTauE + zTauO * u_ice(ji,jj) & ! F + tau_ia + Coriolis + spg + tau_io(only ocean part) 531 & ) / MAX( zepsi, zmU_t(ji,jj) * ( zbeta(ji,jj) + 1._wp ) + zTauO - zTauB ) & ! m/dt + tau_io(only ice part) + landfast 532 & + ( 1._wp - rswitch ) * u_ice(ji,jj) * MAX( 0._wp, 1._wp - zdtevp * rn_lfrelax ) & ! static friction => slow decrease to v=0 533 & ) * zswitchU(ji,jj) + u_oce(ji,jj) * ( 1._wp - zswitchU(ji,jj) ) & ! v_ice = v_oce if mass < zmmin 534 & ) * zmaskU(ji,jj) 535 ELSE !--- ice velocity using EVP implicit formulation (cf Madec doc & Bouillon 2009) 510 536 u_ice(ji,jj) = ( ( rswitch * ( zmU_t(ji,jj) * u_ice(ji,jj) & ! previous velocity 511 537 & + zTauE + zTauO * u_ice(ji,jj) & ! F + tau_ia + Coriolis + spg + tau_io(only ocean part) … … 514 540 & ) * zswitchU(ji,jj) + u_oce(ji,jj) * ( 1._wp - zswitchU(ji,jj) ) & ! v_ice = v_oce if mass < zmmin 515 541 & ) * zmaskU(ji,jj) 516 ! Bouillon 2013 517 !!u_ice(ji,jj) = ( zmU_t(ji,jj) * ( zbeta * u_ice(ji,jj) + u_ice_b(ji,jj) ) & 518 !! & + zfU(ji,jj) + zCorx(ji,jj) + zTauU_ia(ji,jj) + zTauO * u_oce(ji,jj) + zspgU(ji,jj) & 519 !! & ) / MAX( zmU_t(ji,jj) * ( zbeta + 1._wp ) + zTauO - zTauB, zepsi ) * zswitchU(ji,jj) 542 ENDIF 520 543 END DO 521 544 END DO … … 532 555 DO jj = 2, jpjm1 533 556 DO ji = fs_2, fs_jpim1 534 535 ! tau_io/(u_oce - u_ice) 557 ! !--- tau_io/(u_oce - u_ice) 536 558 zTauO = zaU(ji,jj) * zrhoco * SQRT( ( u_ice (ji,jj) - u_oce (ji,jj) ) * ( u_ice (ji,jj) - u_oce (ji,jj) ) & 537 559 & + ( v_iceU(ji,jj) - v_oceU(ji,jj) ) * ( v_iceU(ji,jj) - v_oceU(ji,jj) ) ) 538 539 ! Ocean-to-Ice stress 560 ! !--- Ocean-to-Ice stress 540 561 ztaux_oi(ji,jj) = zTauO * ( u_oce(ji,jj) - u_ice(ji,jj) ) 541 542 ! tau_bottom/u_ice562 ! 563 ! !--- tau_bottom/u_ice 543 564 zvel = MAX( zepsi, SQRT( v_iceU(ji,jj) * v_iceU(ji,jj) + u_ice(ji,jj) * u_ice(ji,jj) ) ) 544 565 zTauB = - tau_icebfr(ji,jj) / zvel 545 546 ! Coriolis at U-points (energy conserving formulation)566 ! 567 ! !--- Coriolis at U-points (energy conserving formulation) 547 568 zCorx(ji,jj) = 0.25_wp * r1_e1u(ji,jj) * & 548 569 & ( zmf(ji ,jj) * ( e1v(ji ,jj) * v_ice(ji ,jj) + e1v(ji ,jj-1) * v_ice(ji ,jj-1) ) & 549 570 & + zmf(ji+1,jj) * ( e1v(ji+1,jj) * v_ice(ji+1,jj) + e1v(ji+1,jj-1) * v_ice(ji+1,jj-1) ) ) 550 551 ! Sum of external forces (explicit solution) = F + tau_ia + Coriolis + spg + tau_io571 ! 572 ! !--- Sum of external forces (explicit solution) = F + tau_ia + Coriolis + spg + tau_io 552 573 zTauE = zfU(ji,jj) + zTauU_ia(ji,jj) + zCorx(ji,jj) + zspgU(ji,jj) + ztaux_oi(ji,jj) 553 554 ! landfast switch => 0 = static friction ; 1 = sliding friction574 ! 575 ! !--- landfast switch => 0 = static friction ; 1 = sliding friction 555 576 rswitch = 1._wp - MIN( 1._wp, ABS( SIGN( 1._wp, ztauE - tau_icebfr(ji,jj) ) - SIGN( 1._wp, zTauE ) ) ) 556 557 ! ice velocity using implicit formulation (cf Madec doc & Bouillon 2009) 577 ! 578 IF( ln_aEVP ) THEN !--- ice velocity using aEVP (Kimmritz et al 2016 & 2017) 579 u_ice(ji,jj) = ( ( rswitch * ( zmU_t(ji,jj) * ( zbeta(ji,jj) * u_ice(ji,jj) + u_ice_b(ji,jj) ) & ! previous velocity 580 & + zTauE + zTauO * u_ice(ji,jj) & ! F + tau_ia + Coriolis + spg + tau_io(only ocean part) 581 & ) / MAX( zepsi, zmU_t(ji,jj) * ( zbeta(ji,jj) + 1._wp ) + zTauO - zTauB ) & ! m/dt + tau_io(only ice part) + landfast 582 & + ( 1._wp - rswitch ) * u_ice(ji,jj) * MAX( 0._wp, 1._wp - zdtevp * rn_lfrelax ) & ! static friction => slow decrease to v=0 583 & ) * zswitchU(ji,jj) + u_oce(ji,jj) * ( 1._wp - zswitchU(ji,jj) ) & ! v_ice = v_oce if mass < zmmin 584 & ) * zmaskU(ji,jj) 585 ELSE !--- ice velocity using EVP implicit formulation (cf Madec doc & Bouillon 2009) 558 586 u_ice(ji,jj) = ( ( rswitch * ( zmU_t(ji,jj) * u_ice(ji,jj) & ! previous velocity 559 587 & + zTauE + zTauO * u_ice(ji,jj) & ! F + tau_ia + Coriolis + spg + tau_io(only ocean part) 560 588 & ) / MAX( zepsi, zmU_t(ji,jj) + zTauO - zTauB ) & ! m/dt + tau_io(only ice part) + landfast 561 589 & + ( 1._wp - rswitch ) * u_ice(ji,jj) * MAX( 0._wp, 1._wp - zdtevp * rn_lfrelax ) & ! static friction => slow decrease to v=0 562 & ) * zswitchU(ji,jj) + u_oce(ji,jj) * ( 1._wp - zswitchU(ji,jj) ) & ! v_ice = v_oce if mass < zmmin 590 & ) * zswitchU(ji,jj) + u_oce(ji,jj) * ( 1._wp - zswitchU(ji,jj) ) & ! v_ice = v_oce if mass < zmmin 563 591 & ) * zmaskU(ji,jj) 564 ! Bouillon 2013 565 !!u_ice(ji,jj) = ( zmU_t(ji,jj) * ( zbeta * u_ice(ji,jj) + u_ice_b(ji,jj) ) & 566 !! & + zfU(ji,jj) + zCorx(ji,jj) + zTauU_ia(ji,jj) + zTauO * u_oce(ji,jj) + zspgU(ji,jj) & 567 !! & ) / MAX( zmU_t(ji,jj) * ( zbeta + 1._wp ) + zTauO - zTauB, zepsi ) * zswitchU(ji,jj) 592 ENDIF 568 593 END DO 569 594 END DO … … 578 603 DO jj = 2, jpjm1 579 604 DO ji = fs_2, fs_jpim1 580 581 ! tau_io/(v_oce - v_ice) 605 ! !--- tau_io/(v_oce - v_ice) 582 606 zTauO = zaV(ji,jj) * zrhoco * SQRT( ( v_ice (ji,jj) - v_oce (ji,jj) ) * ( v_ice (ji,jj) - v_oce (ji,jj) ) & 583 607 & + ( u_iceV(ji,jj) - u_oceV(ji,jj) ) * ( u_iceV(ji,jj) - u_oceV(ji,jj) ) ) 584 585 ! Ocean-to-Ice stress 608 ! !--- Ocean-to-Ice stress 586 609 ztauy_oi(ji,jj) = zTauO * ( v_oce(ji,jj) - v_ice(ji,jj) ) 587 588 ! tau_bottom/v_ice610 ! 611 ! !--- tau_bottom/v_ice 589 612 zvel = MAX( zepsi, SQRT( v_ice(ji,jj) * v_ice(ji,jj) + u_iceV(ji,jj) * u_iceV(ji,jj) ) ) 590 613 ztauB = - tau_icebfr(ji,jj) / zvel 591 592 ! Coriolis at V-points (energy conserving formulation)614 ! 615 ! !--- Coriolis at v-points (energy conserving formulation) 593 616 zCory(ji,jj) = - 0.25_wp * r1_e2v(ji,jj) * & 594 617 & ( zmf(ji,jj ) * ( e2u(ji,jj ) * u_ice(ji,jj ) + e2u(ji-1,jj ) * u_ice(ji-1,jj ) ) & 595 618 & + zmf(ji,jj+1) * ( e2u(ji,jj+1) * u_ice(ji,jj+1) + e2u(ji-1,jj+1) * u_ice(ji-1,jj+1) ) ) 596 597 ! Sum of external forces (explicit solution) = F + tau_ia + Coriolis + spg + tau_io619 ! 620 ! !--- Sum of external forces (explicit solution) = F + tau_ia + Coriolis + spg + tau_io 598 621 zTauE = zfV(ji,jj) + zTauV_ia(ji,jj) + zCory(ji,jj) + zspgV(ji,jj) + ztauy_oi(ji,jj) 599 600 ! landfast switch => 0 = static friction (tau_icebfr > zTauE); 1 = sliding friction622 ! 623 ! !--- landfast switch => 0 = static friction ; 1 = sliding friction 601 624 rswitch = 1._wp - MIN( 1._wp, ABS( SIGN( 1._wp, zTauE - tau_icebfr(ji,jj) ) - SIGN( 1._wp, zTauE ) ) ) 602 603 ! ice velocity using implicit formulation (cf Madec doc & Bouillon 2009) 625 ! 626 IF( ln_aEVP ) THEN !--- ice velocity using aEVP (Kimmritz et al 2016 & 2017) 627 v_ice(ji,jj) = ( ( rswitch * ( zmV_t(ji,jj) * ( zbeta(ji,jj) * v_ice(ji,jj) + v_ice_b(ji,jj) ) & ! previous velocity 628 & + zTauE + zTauO * v_ice(ji,jj) & ! F + tau_ia + Coriolis + spg + tau_io(only ocean part) 629 & ) / MAX( zepsi, zmV_t(ji,jj) * ( zbeta(ji,jj) + 1._wp ) + zTauO - zTauB ) & ! m/dt + tau_io(only ice part) + landfast 630 & + ( 1._wp - rswitch ) * v_ice(ji,jj) * MAX( 0._wp, 1._wp - zdtevp * rn_lfrelax ) & ! static friction => slow decrease to v=0 631 & ) * zswitchV(ji,jj) + v_oce(ji,jj) * ( 1._wp - zswitchV(ji,jj) ) & ! v_ice = v_oce if mass < zmmin 632 & ) * zmaskV(ji,jj) 633 ELSE !--- ice velocity using EVP implicit formulation (cf Madec doc & Bouillon 2009) 604 634 v_ice(ji,jj) = ( ( rswitch * ( zmV_t(ji,jj) * v_ice(ji,jj) & ! previous velocity 605 635 & + zTauE + zTauO * v_ice(ji,jj) & ! F + tau_ia + Coriolis + spg + tau_io(only ocean part) … … 608 638 & ) * zswitchV(ji,jj) + v_oce(ji,jj) * ( 1._wp - zswitchV(ji,jj) ) & ! v_ice = v_oce if mass < zmmin 609 639 & ) * zmaskV(ji,jj) 610 ! Bouillon 2013 611 !!v_ice(ji,jj) = ( zmV_t(ji,jj) * ( zbeta * v_ice(ji,jj) + v_ice_b(ji,jj) ) & 612 !! & + zfV(ji,jj) + zCory(ji,jj) + zTauV_ia(ji,jj) + zTauO * v_oce(ji,jj) + zspgV(ji,jj) & 613 !! & ) / MAX( zmV_t(ji,jj) * ( zbeta + 1._wp ) + zTauO - zTauB, zepsi ) * zswitchV(ji,jj) 640 ENDIF 614 641 END DO 615 642 END DO … … 820 847 END SUBROUTINE ice_dyn_rhg_evp 821 848 849 822 850 SUBROUTINE rhg_evp_rst( cdrw, kt ) 823 851 !!--------------------------------------------------------------------- -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/LIM_SRC_3/iceforcing.F90
r8637 r8813 99 99 !! 100 100 !! ** Action : It provides the following fields used in sea ice model: 101 !! fr1_i0 , fr2_i0 = 1sr & 2nd fraction of qsr penetration in ice [%]102 101 !! emp_oce , emp_ice = E-P over ocean and sea ice [Kg/m2/s] 103 102 !! sprecip = solid precipitation [Kg/m2/s] … … 142 141 ! 143 142 CASE( jp_blk ) !--- bulk formulation 144 CALL blk_ice_flx( t_su, alb_ice ) !145 IF( ln_mixcpl ) CALL sbc_cpl_ice_flx( picefr=at_i_b, palbi=alb_ice, psst=sst_m, pist=t_su )143 CALL blk_ice_flx( t_su, h_s, h_i, alb_ice ) ! 144 IF( ln_mixcpl ) CALL sbc_cpl_ice_flx( picefr=at_i_b, palbi=alb_ice, psst=sst_m, pist=t_su, phs=h_s, phi=h_i ) 146 145 IF( nn_iceflx /= 2 ) CALL ice_flx_dist( t_su, alb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_iceflx ) 147 146 ! 148 147 CASE ( jp_purecpl ) !--- coupled formulation 149 CALL sbc_cpl_ice_flx( picefr=at_i_b, palbi=alb_ice, psst=sst_m, pist=t_su )148 CALL sbc_cpl_ice_flx( picefr=at_i_b, palbi=alb_ice, psst=sst_m, pist=t_su, phs=h_s, phi=h_i ) 150 149 IF( nn_iceflx == 2 ) CALL ice_flx_dist( t_su, alb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_iceflx ) 151 150 ! … … 268 267 INTEGER :: ios, ioptio ! Local integer output status for namelist read 269 268 !! 270 NAMELIST/namforcing/ rn_cio, rn_blow_s, nn_iceflx 269 NAMELIST/namforcing/ rn_cio, rn_blow_s, nn_iceflx, nice_jules 271 270 !!------------------------------------------------------------------- 272 271 ! … … 285 284 WRITE(numout,*) '~~~~~~~~~~~~~~~' 286 285 WRITE(numout,*) ' Namelist namforcing:' 287 WRITE(numout,*) ' drag coefficient for oceanic stress rn_cio = ', rn_cio 288 WRITE(numout,*) ' coefficient for ice-lead partition of snowfall rn_blow_s = ', rn_blow_s 289 WRITE(numout,*) ' Multicategory heat flux formulation nn_iceflx = ', nn_iceflx 286 WRITE(numout,*) ' drag coefficient for oceanic stress rn_cio = ', rn_cio 287 WRITE(numout,*) ' coefficient for ice-lead partition of snowfall rn_blow_s = ', rn_blow_s 288 WRITE(numout,*) ' Multicategory heat flux formulation nn_iceflx = ', nn_iceflx 289 WRITE(numout,*) ' Jules coupling (0=no, 1=emulated, 2=active) nice_jules = ', nice_jules 290 290 ENDIF 291 291 ! -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/LIM_SRC_3/iceistate.F90
r8637 r8813 48 48 TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: si ! structure of input fields (file informations, fields read) 49 49 ! 50 ! ** namelist (namini) **50 ! !! ** namelist (namini) ** 51 51 LOGICAL :: ln_iceini ! initialization or not 52 52 LOGICAL :: ln_iceini_file ! Ice initialization state from 2D netcdf file … … 91 91 !! where there is no ice (clem: I do not know why, is it mandatory?) 92 92 !!-------------------------------------------------------------------- 93 INTEGER :: ji, jj, jk, jl ! dummy loop indices 93 INTEGER :: ji, jj, jk, jl ! dummy loop indices 94 INTEGER :: i_hemis, i_fill, jl0 ! local integers 94 95 REAL(wp) :: ztmelts, zdh 95 INTEGER :: i_hemis, i_fill, jl096 96 REAL(wp) :: zarg, zV, zconv, zdv, zfac 97 97 INTEGER , DIMENSION(4) :: itest … … 100 100 REAL(wp), DIMENSION(jpi,jpj) :: zht_i_ini, zat_i_ini, zvt_i_ini !data from namelist or nc file 101 101 REAL(wp), DIMENSION(jpi,jpj) :: zts_u_ini, zht_s_ini, zsm_i_ini, ztm_i_ini !data from namelist or nc file 102 REAL(wp), DIMENSION(jpi,jpj,jpl) :: zh_i_ini , za_i_ini!data by cattegories to fill102 REAL(wp), DIMENSION(jpi,jpj,jpl) :: zh_i_ini , za_i_ini !data by cattegories to fill 103 103 !-------------------------------------------------------------------- 104 104 … … 116 116 tn_ice(:,:,jl) = rt0 * tmask(:,:,1) 117 117 END DO 118 119 ! init basal temperature (considered at freezing point) 118 ! 119 ! init basal temperature (considered at freezing point) [Kelvin] 120 120 CALL eos_fzp( sss_m(:,:), t_bo(:,:) ) 121 121 t_bo(:,:) = ( t_bo(:,:) + rt0 ) * tmask(:,:,1) … … 142 142 zvt_i_ini(:,:) = zht_i_ini(:,:) * zat_i_ini(:,:) 143 143 ! 144 !!---------------!144 ! !---------------! 145 145 ELSE ! Read namelist ! 146 146 ! !---------------! 147 148 ! no ice if sst <= t-freez + ttest 149 WHERE( ( sst_m(:,:) - (t_bo(:,:) - rt0) ) * tmask(:,:,1) >= rn_thres_sst ) ; zswitch(:,:) = 0._wp 150 ELSEWHERE ; zswitch(:,:) = tmask(:,:,1) 147 ! no ice if sst <= t-freez + ttest 148 WHERE( ( sst_m(:,:) - (t_bo(:,:) - rt0) ) * tmask(:,:,1) >= rn_thres_sst ) ; zswitch(:,:) = 0._wp 149 ELSEWHERE ; zswitch(:,:) = tmask(:,:,1) 151 150 END WHERE 152 151 ! 153 152 ! assign initial thickness, concentration, snow depth and salinity to an hemisphere-dependent array 154 153 WHERE( ff_t(:,:) >= 0._wp ) … … 242 241 ! 243 242 ENDIF 244 243 ! 245 244 ! Compatibility tests 246 245 zconv = ABS( zat_i_ini(ji,jj) - SUM( za_i_ini(ji,jj,1:jpl) ) ) ! Test 1: area conservation 247 246 IF ( zconv < epsi06 ) itest(1) = 1 248 247 ! 249 248 zconv = ABS( zat_i_ini(ji,jj) * zht_i_ini(ji,jj) & ! Test 2: volume conservation 250 249 & - SUM( za_i_ini (ji,jj,1:jpl) * zh_i_ini (ji,jj,1:jpl) ) ) 251 250 IF ( zconv < epsi06 ) itest(2) = 1 252 251 ! 253 252 IF ( zh_i_ini(ji,jj,i_fill) >= hi_max(i_fill-1) ) itest(3) = 1 ! Test 3: thickness of the last category is in-bounds ? 254 253 ! 255 254 itest(4) = 1 256 255 DO jl = 1, i_fill … … 260 259 END DO ! end iteration on categories 261 260 ! !---------------------------- 262 !263 261 IF( lwp .AND. SUM(itest) /= 4 ) THEN 264 262 WRITE(numout,*) … … 270 268 WRITE(numout,*) ' zht_i_ini : ', zht_i_ini(ji,jj) 271 269 ENDIF 272 270 ! 273 271 ENDIF 274 272 ! … … 279 277 ! 4) Fill in sea ice arrays 280 278 !--------------------------------------------------------------------- 281 279 ! 282 280 ! Ice concentration, thickness and volume, ice salinity, ice age, surface temperature 283 281 DO jl = 1, jpl ! loop over categories … … 289 287 o_i(ji,jj,jl) = 0._wp ! age (0 day) 290 288 t_su(ji,jj,jl) = zswitch(ji,jj) * zts_u_ini(ji,jj) + ( 1._wp - zswitch(ji,jj) ) * rt0 ! surf temp 291 289 ! 292 290 IF( zht_i_ini(ji,jj) > 0._wp )THEN 293 291 h_s(ji,jj,jl)= h_i(ji,jj,jl) * ( zht_s_ini(ji,jj) / zht_i_ini(ji,jj) ) ! snow depth … … 295 293 h_s(ji,jj,jl)= 0._wp 296 294 ENDIF 297 295 ! 298 296 ! This case below should not be used if (h_s/h_i) is ok in namelist 299 297 ! In case snow load is in excess that would lead to transformation from snow to ice … … 303 301 h_i(ji,jj,jl) = MIN( hi_max(jl), h_i(ji,jj,jl) + zdh ) 304 302 h_s(ji,jj,jl) = MAX( 0._wp, h_s(ji,jj,jl) - zdh * rhoic * r1_rhosn ) 305 303 ! 306 304 ! ice volume, salt content, age content 307 305 v_i (ji,jj,jl) = h_i(ji,jj,jl) * a_i(ji,jj,jl) ! ice volume … … 312 310 END DO 313 311 END DO 314 315 ! for constant salinity in time 316 IF( nn_icesal /= 2 ) THEN 312 ! 313 IF( nn_icesal /= 2 ) THEN ! for constant salinity in time 317 314 CALL ice_var_salprof 318 315 sv_i = s_i * v_i 319 316 ENDIF 320 317 ! 321 318 ! Snow temperature and heat content 322 319 DO jk = 1, nlay_s … … 327 324 ! Snow energy of melting 328 325 e_s(ji,jj,jk,jl) = zswitch(ji,jj) * rhosn * ( cpic * ( rt0 - t_s(ji,jj,jk,jl) ) + lfus ) 329 326 ! 330 327 ! Mutliply by volume, and divide by number of layers to get heat content in J/m2 331 328 e_s(ji,jj,jk,jl) = e_s(ji,jj,jk,jl) * v_s(ji,jj,jl) * r1_nlay_s … … 334 331 END DO 335 332 END DO 336 333 ! 337 334 ! Ice salinity, temperature and heat content 338 335 DO jk = 1, nlay_i … … 343 340 sz_i(ji,jj,jk,jl) = zswitch(ji,jj) * zsm_i_ini(ji,jj) + ( 1._wp - zswitch(ji,jj) ) * rn_simin 344 341 ztmelts = - tmut * sz_i(ji,jj,jk,jl) + rt0 !Melting temperature in K 345 342 ! 346 343 ! heat content per unit volume 347 e_i(ji,jj,jk,jl) = zswitch(ji,jj) * rhoic * ( cpic * ( ztmelts - t_i(ji,jj,jk,jl) ) &348 + lfus * ( 1._wp - (ztmelts-rt0) / MIN((t_i(ji,jj,jk,jl)-rt0),-epsi20) )&349 - rcp* ( ztmelts - rt0 ) )350 344 e_i(ji,jj,jk,jl) = zswitch(ji,jj) * rhoic * ( cpic * ( ztmelts - t_i(ji,jj,jk,jl) ) & 345 & + lfus * ( 1._wp - (ztmelts-rt0) / MIN( (t_i(ji,jj,jk,jl)-rt0) , -epsi20 ) ) & 346 & - rcp * ( ztmelts - rt0 ) ) 347 ! 351 348 ! Mutliply by ice volume, and divide by number of layers to get heat content in J/m2 352 349 e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * v_i(ji,jj,jl) * r1_nlay_i … … 355 352 END DO 356 353 END DO 357 354 ! 358 355 tn_ice (:,:,:) = t_su (:,:,:) 359 356 ! 360 357 ! Melt pond volume and fraction 361 358 IF ( ln_pnd_CST .OR. ln_pnd_H12 ) THEN ; zfac = 1._wp … … 368 365 a_ip(:,:,:) = a_ip_frac(:,:,:) * a_i (:,:,:) 369 366 v_ip(:,:,:) = h_ip (:,:,:) * a_ip(:,:,:) 370 367 ! 371 368 ELSE ! if ln_iceini=false 372 369 a_i (:,:,:) = 0._wp … … 379 376 s_i (:,:,:) = 0._wp 380 377 o_i (:,:,:) = 0._wp 381 378 ! 382 379 e_i(:,:,:,:) = 0._wp 383 380 e_s(:,:,:,:) = 0._wp 384 381 ! 385 382 DO jl = 1, jpl 386 383 DO jk = 1, nlay_i … … 391 388 END DO 392 389 END DO 393 390 ! 394 391 a_ip(:,:,:) = 0._wp 395 392 v_ip(:,:,:) = 0._wp 396 393 a_ip_frac(:,:,:) = 0._wp 397 394 h_ip (:,:,:) = 0._wp 398 395 ! 399 396 ENDIF ! ln_iceini 400 397 ! 401 398 at_i (:,:) = 0.0_wp 402 399 DO jl = 1, jpl … … 405 402 ! 406 403 ! --- set ice velocities --- ! 407 u_ice (:,:) 408 v_ice (:,:) 404 u_ice (:,:) = 0._wp 405 v_ice (:,:) = 0._wp 409 406 ! 410 407 !---------------------------------------------- … … 415 412 ! 416 413 IF( ln_ice_embd ) THEN ! embedded sea-ice: deplete the initial ssh below sea-ice area 417 414 ! 418 415 sshn(:,:) = sshn(:,:) - snwice_mass(:,:) * r1_rau0 419 416 sshb(:,:) = sshb(:,:) - snwice_mass(:,:) * r1_rau0 420 417 ! 421 418 IF( .NOT.ln_linssh ) THEN 422 419 ! 423 420 WHERE( ht_0(:,:) > 0 ) ; z2d(:,:) = 1._wp + sshn(:,:)*tmask(:,:,1) / ht_0(:,:) 424 421 ELSEWHERE ; z2d(:,:) = 1._wp ; END WHERE 425 422 ! 426 423 DO jk = 1,jpkm1 ! adjust initial vertical scale factors 427 424 e3t_n(:,:,jk) = e3t_0(:,:,jk) * z2d(:,:) … … 429 426 e3t_a(:,:,jk) = e3t_n(:,:,jk) 430 427 END DO 431 428 ! 432 429 ! Reconstruction of all vertical scale factors at now and before time-steps 433 430 ! ========================================================================= … … 478 475 !! CALL dia_wri_state( 'output.init', nit000 ) 479 476 !!! 480 477 ! 481 478 END SUBROUTINE ice_istate 479 482 480 483 481 SUBROUTINE ice_istate_init … … 485 483 !! *** ROUTINE ice_istate_init *** 486 484 !! 487 !! ** Purpose : Definition of initial state of the ice 488 !! 489 !! ** Method : Read the namini namelist and check the parameter 490 !! values called at the first timestep (nit000) 491 !! 492 !! ** input : 493 !! Namelist namini 494 !! 495 !! history : 496 !! 8.5 ! 03-08 (C. Ethe) original code 497 !! 8.5 ! 07-11 (M. Vancoppenolle) rewritten initialization 485 !! ** Purpose : Definition of initial state of the ice 486 !! 487 !! ** Method : Read the namini namelist and check the parameter 488 !! values called at the first timestep (nit000) 489 !! 490 !! ** input : Namelist namini 491 !! 498 492 !!----------------------------------------------------------------------------- 499 ! 500 INTEGER :: ios,ierr,inum_ice ! Local integer output status for namelist read 501 INTEGER :: ji,jj 502 INTEGER :: ifpr, ierror 493 INTEGER :: ji, jj 494 INTEGER :: ios, ierr, inum_ice ! Local integer output status for namelist read 495 INTEGER :: ifpr, ierror 503 496 ! 504 497 CHARACTER(len=256) :: cn_dir ! Root directory for location of ice files … … 515 508 READ ( numnam_ice_ref, namini, IOSTAT = ios, ERR = 901) 516 509 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namini in reference namelist', lwp ) 517 510 ! 518 511 REWIND( numnam_ice_cfg ) ! Namelist namini in configuration namelist : Ice initial state 519 512 READ ( numnam_ice_cfg, namini, IOSTAT = ios, ERR = 902 ) 520 513 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namini in configuration namelist', lwp ) 521 514 IF(lwm) WRITE ( numoni, namini ) 522 515 ! 523 516 slf_i(jp_hti) = sn_hti ; slf_i(jp_hts) = sn_hts 524 517 slf_i(jp_ati) = sn_ati ; slf_i(jp_tsu) = sn_tsu … … 545 538 WRITE(numout,*) ' initial ice/snw temp in the south rn_tmi_ini_s = ', rn_tmi_ini_s 546 539 ENDIF 547 540 ! 548 541 IF( ln_iceini_file ) THEN ! Ice initialization using input file 549 542 ! … … 553 546 CALL ctl_stop( 'Ice_ini in iceistate: unable to allocate si structure' ) ; RETURN 554 547 ENDIF 555 548 ! 556 549 DO ifpr = 1, jpfldi 557 550 ALLOCATE( si(ifpr)%fnow(jpi,jpj,1) ) 558 551 ALLOCATE( si(ifpr)%fdta(jpi,jpj,1,2) ) 559 552 END DO 560 553 ! 561 554 ! fill si with slf_i and control print 562 555 CALL fld_fill( si, slf_i, cn_dir, 'ice_istate', 'ice istate ini', 'numnam_ice' ) 563 556 ! 564 557 CALL fld_read( nit000, 1, si ) ! input fields provided at the current time-step 565 558 ! 566 559 ENDIF 567 560 ! 568 561 END SUBROUTINE ice_istate_init 569 562 -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/LIM_SRC_3/iceitd.F90
r8637 r8813 13 13 !! 'key_lim3' ESIM sea-ice model 14 14 !!---------------------------------------------------------------------- 15 !! ice_itd_init : read ice thicknesses mean and min from namelist 16 !! ice_itd_rem : redistribute ice thicknesses after thermo growth and melt 17 !! ice_itd_reb : rebin ice thicknesses into bounded categories 15 !! ice_itd_rem : redistribute ice thicknesses after thermo growth and melt 16 !! itd_glinear : build g(h) satisfying area and volume constraints 17 !! itd_shiftice : shift ice across category boundaries, conserving everything 18 !! ice_itd_reb : rebin ice thicknesses into bounded categories 19 !! ice_itd_init : read ice thicknesses mean and min from namelist 18 20 !!---------------------------------------------------------------------- 19 21 USE dom_oce ! ocean domain … … 36 38 PUBLIC ice_itd_reb ! called in icecor 37 39 38 ! ** namelist (namitd) ** 39 REAL(wp) :: rn_himean ! mean thickness of the domain 40 40 INTEGER :: nice_catbnd ! choice of the type of ice category function 41 ! ! associated indices: 42 INTEGER, PARAMETER :: np_cathfn = 1 ! categories defined by a function 43 INTEGER, PARAMETER :: np_catusr = 2 ! categories defined by the user 44 ! 45 ! !! ** namelist (namitd) ** 46 LOGICAL :: ln_cat_hfn ! ice categories are defined by function like rn_himean**(-0.05) 47 REAL(wp) :: rn_himean ! mean thickness of the domain 48 LOGICAL :: ln_cat_usr ! ice categories are defined by rn_catbnd 49 REAL(wp), DIMENSION(0:100) :: rn_catbnd ! ice categories bounds 50 ! 41 51 !!---------------------------------------------------------------------- 42 52 !! NEMO/ICE 4.0 , NEMO Consortium (2017) … … 65 75 REAL(wp) :: zx3 66 76 REAL(wp) :: zslope ! used to compute local thermodynamic "speeds" 67 77 ! 68 78 INTEGER , DIMENSION(jpij) :: iptidx ! compute remapping or not 69 79 INTEGER , DIMENSION(jpij,jpl-1) :: jdonor ! donor category index … … 97 107 !----------------------------------------------------------------------------------------------- 98 108 IF( npti > 0 ) THEN 99 109 ! 100 110 zdhice(:,:) = 0._wp 101 111 zhbnew(:,:) = 0._wp 102 112 ! 103 113 CALL tab_3d_2d( npti, nptidx(1:npti), h_i_2d (1:npti,1:jpl), h_i ) 104 114 CALL tab_3d_2d( npti, nptidx(1:npti), h_ib_2d(1:npti,1:jpl), h_i_b ) 105 115 CALL tab_3d_2d( npti, nptidx(1:npti), a_i_2d (1:npti,1:jpl), a_i ) 106 116 CALL tab_3d_2d( npti, nptidx(1:npti), a_ib_2d (1:npti,1:jpl), a_i_b ) 107 117 ! 108 118 DO jl = 1, jpl 109 119 ! Compute thickness change in each ice category … … 112 122 END DO 113 123 END DO 114 124 ! 115 125 ! --- New boundaries for category 1:jpl-1 --- ! 116 126 DO jl = 1, jpl - 1 … … 135 145 ! 1) hn(t+1)+espi < Hn* < hn+1(t+1)-epsi 136 146 ! Note: hn(t+1) must not be too close to either HR or HL otherwise a division by nearly 0 is possible 137 ! in i ce_itd_glinear in the case (HR-HL) = 3(Hice - HL) or = 3(HR - Hice)147 ! in itd_glinear in the case (HR-HL) = 3(Hice - HL) or = 3(HR - Hice) 138 148 IF( a_i_2d(ji,jl ) > epsi10 .AND. h_i_2d(ji,jl ) > ( zhbnew(ji,jl) - epsi10 ) ) nptidx(ji) = 0 139 149 IF( a_i_2d(ji,jl+1) > epsi10 .AND. h_i_2d(ji,jl+1) < ( zhbnew(ji,jl) + epsi10 ) ) nptidx(ji) = 0 140 150 ! 141 151 ! 2) Hn-1 < Hn* < Hn+1 142 152 IF( zhbnew(ji,jl) < hi_max(jl-1) ) nptidx(ji) = 0 143 153 IF( zhbnew(ji,jl) > hi_max(jl+1) ) nptidx(ji) = 0 144 154 ! 145 155 END DO 146 156 END DO … … 153 163 zhbnew(ji,jpl) = hi_max(jpl) 154 164 ENDIF 155 165 ! 156 166 ! --- 1 additional condition for remapping (1st category) --- ! 157 167 ! H0+epsi < h1(t) < H1-epsi 158 168 ! h1(t) must not be too close to either HR or HL otherwise a division by nearly 0 is possible 159 ! in i ce_itd_glinear in the case (HR-HL) = 3(Hice - HL) or = 3(HR - Hice)169 ! in itd_glinear in the case (HR-HL) = 3(Hice - HL) or = 3(HR - Hice) 160 170 IF( h_ib_2d(ji,1) < ( hi_max(0) + epsi10 ) ) nptidx(ji) = 0 161 171 IF( h_ib_2d(ji,1) > ( hi_max(1) - epsi10 ) ) nptidx(ji) = 0 … … 165 175 ! 3) Identify cells where remapping 166 176 !----------------------------------------------------------------------------------------------- 167 ipti = 0 ;iptidx(:) = 0177 ipti = 0 ; iptidx(:) = 0 168 178 DO ji = 1, npti 169 179 IF( nptidx(ji) /= 0 ) THEN … … 197 207 ! 198 208 ! --- g(h) for category 1 --- ! 199 CALL i ce_itd_glinear( zhb0(1:npti) , zhb1(1:npti) , h_ib_1d(1:npti) , a_i_1d(1:npti) , & ! in200 & 209 CALL itd_glinear( zhb0(1:npti) , zhb1(1:npti) , h_ib_1d(1:npti) , a_i_1d(1:npti) , & ! in 210 & g0 (1:npti,1), g1 (1:npti,1), hL (1:npti,1), hR (1:npti,1) ) ! out 201 211 ! 202 212 ! Area lost due to melting of thin ice … … 240 250 ! 241 251 ! --- g(h) for each thickness category --- ! 242 CALL i ce_itd_glinear( zhbnew(1:npti,jl-1), zhbnew(1:npti,jl), h_i_1d(1:npti) , a_i_1d(1:npti) , & ! in243 & 252 CALL itd_glinear( zhbnew(1:npti,jl-1), zhbnew(1:npti,jl), h_i_1d(1:npti) , a_i_1d(1:npti) , & ! in 253 & g0 (1:npti,jl ), g1 (1:npti,jl), hL (1:npti,jl), hR (1:npti,jl) ) ! out 244 254 ! 245 255 END DO … … 281 291 ! 6) Shift ice between categories 282 292 !---------------------------------------------------------------------------------------------- 283 CALL i ce_itd_shiftice ( jdonor(1:npti,:), zdaice(1:npti,:), zdvice(1:npti,:) )293 CALL itd_shiftice ( jdonor(1:npti,:), zdaice(1:npti,:), zdvice(1:npti,:) ) 284 294 285 295 !---------------------------------------------------------------------------------------------- … … 289 299 CALL tab_2d_1d( npti, nptidx(1:npti), a_i_1d (1:npti), a_i(:,:,1) ) 290 300 CALL tab_2d_1d( npti, nptidx(1:npti), a_ip_1d (1:npti), a_ip(:,:,1) ) 291 301 ! 292 302 DO ji = 1, npti 293 303 IF ( a_i_1d(ji) > epsi10 .AND. h_i_1d(ji) < rn_himin ) THEN … … 309 319 310 320 311 SUBROUTINE i ce_itd_glinear( HbL, Hbr, phice, paice, pg0, pg1, phL, phR )312 !!------------------------------------------------------------------ 313 !! *** ROUTINE i ce_itd_glinear ***321 SUBROUTINE itd_glinear( HbL, Hbr, phice, paice, pg0, pg1, phL, phR ) 322 !!------------------------------------------------------------------ 323 !! *** ROUTINE itd_glinear *** 314 324 !! 315 325 !! ** Purpose : build g(h) satisfying area and volume constraints (Eq. 6 and 9) … … 367 377 END DO 368 378 ! 369 END SUBROUTINE i ce_itd_glinear370 371 372 SUBROUTINE i ce_itd_shiftice( kdonor, pdaice, pdvice )373 !!------------------------------------------------------------------ 374 !! *** ROUTINE i ce_itd_shiftice ***379 END SUBROUTINE itd_glinear 380 381 382 SUBROUTINE itd_shiftice( kdonor, pdaice, pdvice ) 383 !!------------------------------------------------------------------ 384 !! *** ROUTINE itd_shiftice *** 375 385 !! 376 386 !! ** Purpose : shift ice across category boundaries, conserving everything … … 486 496 END DO 487 497 END DO 488 498 ! 489 499 DO jk = 1, nlay_i !--- Ice heat content 490 500 DO ji = 1, npti … … 529 539 CALL tab_2d_3d( npti, nptidx(1:npti), t_su_2d(1:npti,1:jpl), t_su ) 530 540 ! 531 END SUBROUTINE i ce_itd_shiftice541 END SUBROUTINE itd_shiftice 532 542 533 543 … … 550 560 ! 551 561 IF( kt == nit000 .AND. lwp ) WRITE(numout,*) '-- ice_itd_reb: rebining ice thickness distribution' 552 562 ! 553 563 jdonor(:,:) = 0 554 564 zdaice(:,:) = 0._wp … … 587 597 ! 588 598 IF( npti > 0 ) THEN 589 CALL i ce_itd_shiftice( jdonor(1:npti,:), zdaice(1:npti,:), zdvice(1:npti,:) ) ! Shift jl=>jl+1599 CALL itd_shiftice( jdonor(1:npti,:), zdaice(1:npti,:), zdvice(1:npti,:) ) ! Shift jl=>jl+1 590 600 ! Reset shift parameters 591 601 jdonor(1:npti,jl) = 0 … … 618 628 ! 619 629 IF( npti > 0 ) THEN 620 CALL i ce_itd_shiftice( jdonor(1:npti,:), zdaice(1:npti,:), zdvice(1:npti,:) ) ! Shift jl+1=>jl630 CALL itd_shiftice( jdonor(1:npti,:), zdaice(1:npti,:), zdvice(1:npti,:) ) ! Shift jl+1=>jl 621 631 ! Reset shift parameters 622 632 jdonor(1:npti,jl) = 0 … … 629 639 END SUBROUTINE ice_itd_reb 630 640 641 631 642 SUBROUTINE ice_itd_init 632 643 !!------------------------------------------------------------------ … … 637 648 !! ** input : Namelist namitd 638 649 !!------------------------------------------------------------------- 639 INTEGER :: jl ! dummy loop index640 INTEGER :: ios ! Local integer output status for namelist read650 INTEGER :: jl ! dummy loop index 651 INTEGER :: ios, ioptio ! Local integer output status for namelist read 641 652 REAL(wp) :: zhmax, znum, zden, zalpha ! - - 642 ! !643 NAMELIST/namitd/ rn_himean, rn_himin653 ! 654 NAMELIST/namitd/ ln_cat_hfn, rn_himean, ln_cat_usr, rn_catbnd, rn_himin 644 655 !!------------------------------------------------------------------ 645 656 ! … … 647 658 READ ( numnam_ice_ref, namitd, IOSTAT = ios, ERR = 901) 648 659 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namitd in reference namelist', lwp ) 649 660 ! 650 661 REWIND( numnam_ice_cfg ) ! Namelist namitd in configuration namelist : Parameters for ice 651 662 READ ( numnam_ice_cfg, namitd, IOSTAT = ios, ERR = 902 ) … … 658 669 WRITE(numout,*) '~~~~~~~~~~~~' 659 670 WRITE(numout,*) ' Namelist namitd: ' 660 WRITE(numout,*) ' mean ice thickness in the domain rn_himean = ', rn_himean 661 WRITE(numout,*) ' minimum ice thickness rn_himin = ', rn_himin 671 WRITE(numout,*) ' Ice categories are defined by a function of rn_himean**(-0.05) ln_cat_hfn = ', ln_cat_hfn 672 WRITE(numout,*) ' mean ice thickness in the domain rn_himean = ', rn_himean 673 WRITE(numout,*) ' Ice categories are defined by rn_catbnd ln_cat_usr = ', ln_cat_usr 674 WRITE(numout,*) ' ice categories boundaries (m) rn_catbnd = ', rn_catbnd 675 WRITE(numout,*) ' minimum ice thickness rn_himin = ', rn_himin 662 676 ENDIF 663 677 ! … … 665 679 ! Thickness categories boundaries ! 666 680 !-----------------------------------! 667 ! 668 zalpha = 0.05_wp ! max of each category (from h^(-alpha) function) 669 zhmax = 3._wp * rn_himean 670 DO jl = 1, jpl 671 znum = jpl * ( zhmax+1 )**zalpha 672 zden = REAL( jpl-jl , wp ) * ( zhmax + 1._wp )**zalpha + REAL( jl , wp ) 673 hi_max(jl) = ( znum / zden )**(1./zalpha) - 1 674 END DO 681 ! !== set the choice of ice categories ==! 682 ioptio = 0 683 IF( ln_cat_hfn ) THEN ; ioptio = ioptio + 1 ; nice_catbnd = np_cathfn ; ENDIF 684 IF( ln_cat_usr ) THEN ; ioptio = ioptio + 1 ; nice_catbnd = np_catusr ; ENDIF 685 IF( ioptio /= 1 ) CALL ctl_stop( 'ice_itd_init: choose one and only one ice categories boundaries' ) 686 ! 687 SELECT CASE( nice_catbnd ) 688 ! !------------------------! 689 CASE( np_cathfn ) ! h^(-alpha) function 690 ! !------------------------! 691 zalpha = 0.05_wp 692 zhmax = 3._wp * rn_himean 693 DO jl = 1, jpl 694 znum = jpl * ( zhmax+1 )**zalpha 695 zden = REAL( jpl-jl , wp ) * ( zhmax + 1._wp )**zalpha + REAL( jl , wp ) 696 hi_max(jl) = ( znum / zden )**(1./zalpha) - 1 697 END DO 698 ! !------------------------! 699 CASE( np_catusr ) ! user defined 700 ! !------------------------! 701 DO jl = 0, jpl 702 hi_max(jl) = rn_catbnd(jl) 703 END DO 704 ! 705 END SELECT 675 706 ! 676 707 DO jl = 1, jpl ! mean thickness by category -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/LIM_SRC_3/icestp.F90
r8637 r8813 153 153 !------------------------------------------------------! 154 154 ! It provides the following fields used in sea ice model: 155 ! fr1_i0 , fr2_i0 = 1sr & 2nd fraction of qsr penetration in ice [%]156 155 ! emp_oce , emp_ice = E-P over ocean and sea ice [Kg/m2/s] 157 156 ! sprecip = solid precipitation [Kg/m2/s] … … 320 319 IF(lwp) WRITE(numout,*) ' nn_monocat forced to 0 as jpl>1, i.e. multi-category case is chosen' 321 320 ENDIF 322 323 324 321 ! IF ( jpl == 1 .AND. nn_monocat == 0 ) THEN 322 ! CALL ctl_stop( 'STOP', 'par_init : if jpl=1 then nn_monocat should be between 1 and 4' ) 323 ! ENDIF 325 324 ! 326 325 IF( ln_bdy .AND. ln_icediachk ) CALL ctl_warn('par_init: online conservation check does not work with BDY') -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/LIM_SRC_3/icethd.F90
r8637 r8813 26 26 USE sbc_oce , ONLY : sss_m, sst_m, e3t_m, utau, vtau, ssu_m, ssv_m, frq_m, qns_tot, qsr_tot, sprecip, ln_cpl 27 27 USE sbc_ice , ONLY : qsr_oce, qns_oce, qemp_oce, qsr_ice, qns_ice, dqns_ice, evap_ice, qprec_ice, qevap_ice, & 28 & fr1_i0, fr2_i028 & qml_ice, qcn_ice, qsr_ice_tr 29 29 USE ice1D ! sea-ice: thermodynamics variables 30 30 USE icethd_zdf ! sea-ice: vertical heat diffusion … … 383 383 CALL tab_2d_1d( npti, nptidx(1:npti), qprec_ice_1d(1:npti), qprec_ice ) 384 384 CALL tab_2d_1d( npti, nptidx(1:npti), qsr_ice_1d (1:npti), qsr_ice (:,:,kl) ) 385 CALL tab_2d_1d( npti, nptidx(1:npti), fr1_i0_1d (1:npti), fr1_i0 )386 CALL tab_2d_1d( npti, nptidx(1:npti), fr2_i0_1d (1:npti), fr2_i0 )387 385 CALL tab_2d_1d( npti, nptidx(1:npti), qns_ice_1d (1:npti), qns_ice (:,:,kl) ) 388 386 CALL tab_2d_1d( npti, nptidx(1:npti), ftr_ice_1d (1:npti), ftr_ice (:,:,kl) ) … … 393 391 CALL tab_2d_1d( npti, nptidx(1:npti), fhtur_1d (1:npti), fhtur ) 394 392 CALL tab_2d_1d( npti, nptidx(1:npti), fhld_1d (1:npti), fhld ) 393 394 CALL tab_2d_1d( npti, nptidx(1:npti), qml_ice_1d (1:npti), qml_ice (:,:,kl) ) 395 CALL tab_2d_1d( npti, nptidx(1:npti), qcn_ice_1d (1:npti), qcn_ice (:,:,kl) ) 396 CALL tab_2d_1d( npti, nptidx(1:npti), qsr_ice_tr_1d(1:npti), qsr_ice_tr (:,:,kl) ) 395 397 ! 396 398 CALL tab_2d_1d( npti, nptidx(1:npti), wfx_snw_sni_1d(1:npti), wfx_snw_sni ) … … 498 500 CALL tab_1d_2d( npti, nptidx(1:npti), wfx_spr_1d (1:npti), wfx_spr ) 499 501 CALL tab_1d_2d( npti, nptidx(1:npti), wfx_lam_1d (1:npti), wfx_lam ) 500 CALL tab_ 2d_1d( npti, nptidx(1:npti), wfx_pnd_1d (1:npti), wfx_pnd )502 CALL tab_1d_2d( npti, nptidx(1:npti), wfx_pnd_1d (1:npti), wfx_pnd ) 501 503 ! 502 504 CALL tab_1d_2d( npti, nptidx(1:npti), sfx_bog_1d (1:npti), sfx_bog ) -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/LIM_SRC_3/icethd_dh.F90
r8637 r8813 130 130 !------------------------------------------------------------------------------! 131 131 ! 132 DO ji = 1, npti 133 zdum = qns_ice_1d(ji) + ( 1._wp - i0(ji) ) * qsr_ice_1d(ji) - fc_su(ji) 132 SELECT CASE ( nice_jules ) 133 ! 134 CASE ( np_jules_ACTIVE ) 135 ! 136 DO ji = 1, npti 137 zq_su(ji) = MAX( 0._wp, qml_ice_1d(ji) * rdt_ice ) 138 END DO 139 ! 140 CASE ( np_jules_EMULE ) 141 ! 142 DO ji = 1, npti 143 zdum = ( qns_ice_1d(ji) + qsr_ice_1d(ji) - qsr_ice_tr_1d(ji) - fc_su(ji) ) 144 qml_ice_1d(ji) = zdum * MAX( 0._wp , SIGN( 1._wp, t_su_1d(ji) - rt0 ) ) 145 zq_su(ji) = MAX( 0._wp, qml_ice_1d(ji) * rdt_ice ) 146 END DO 147 ! 148 CASE ( np_jules_OFF ) 149 ! 150 DO ji = 1, npti 151 zdum = ( qns_ice_1d(ji) + qsr_ice_1d(ji) - qsr_ice_tr_1d(ji) - fc_su(ji) ) 152 zdum = zdum * MAX( 0._wp , SIGN( 1._wp, t_su_1d(ji) - rt0 ) ) 153 zq_su(ji) = MAX( 0._wp, zdum * rdt_ice ) 154 END DO 155 ! 156 END SELECT 157 ! 158 DO ji = 1, npti 134 159 zf_tt(ji) = fc_bo_i(ji) + fhtur_1d(ji) + fhld_1d(ji) 135 136 zq_su (ji) = MAX( 0._wp, zdum * rdt_ice ) * MAX( 0._wp , SIGN( 1._wp, t_su_1d(ji) - rt0 ) )137 160 zq_bo (ji) = MAX( 0._wp, zf_tt(ji) * rdt_ice ) 138 161 END DO -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/LIM_SRC_3/icethd_zdf.F90
r8637 r8813 15 15 !! 'key_lim3' ESIM sea-ice model 16 16 !!---------------------------------------------------------------------- 17 !! ice_thd_zdf : select the appropriate routine for vertical heat diffusion calculation 18 !! ice_thd_zdf_BL99 : 19 !! ice_thd_enmelt : 20 !! ice_thd_zdf_init : 21 !!---------------------------------------------------------------------- 17 22 USE dom_oce ! ocean space and time domain 18 23 USE phycst ! physical constants (ocean directory) … … 34 39 LOGICAL :: ln_cndi_U64 ! thermal conductivity: Untersteiner (1964) 35 40 LOGICAL :: ln_cndi_P07 ! thermal conductivity: Pringle et al (2007) 36 REAL(wp) :: rn_cnd_s ! thermal conductivity of the snow [W/m/K]37 41 REAL(wp) :: rn_kappa_i ! coef. for the extinction of radiation Grenfell et al. (2006) [1/m] 38 LOGICAL :: ln_dqns_i ! change non-solar surface flux with changing surface temperature (T) or not (F) 39 42 REAL(wp), PUBLIC :: rn_cnd_s ! thermal conductivity of the snow [W/m/K] 43 44 INTEGER :: nice_zdf ! Choice of the type of vertical heat diffusion formulation 45 ! ! associated indices: 46 INTEGER, PARAMETER :: np_BL99 = 1 ! Bitz and Lipscomb (1999) 47 48 INTEGER, PARAMETER :: np_zdf_jules_OFF = 0 ! compute all temperatures from qsr and qns 49 INTEGER, PARAMETER :: np_zdf_jules_SND = 1 ! compute conductive heat flux and surface temperature from qsr and qns 50 INTEGER, PARAMETER :: np_zdf_jules_RCV = 2 ! compute snow and inner ice temperatures from qcnd 51 40 52 !!---------------------------------------------------------------------- 41 53 !! NEMO/ICE 4.0 , NEMO Consortium (2017) … … 48 60 !!------------------------------------------------------------------- 49 61 !! *** ROUTINE ice_thd_zdf *** 50 !! ** Purpose : 51 !! This routine determines the time evolution of snow and sea-ice 52 !! temperature profiles. 53 !! ** Method : 54 !! This is done by solving the heat equation diffusion with 55 !! a Neumann boundary condition at the surface and a Dirichlet one 56 !! at the bottom. Solar radiation is partially absorbed into the ice. 57 !! The specific heat and thermal conductivities depend on ice salinity 58 !! and temperature to take into account brine pocket melting. The 59 !! numerical 60 !! scheme is an iterative Crank-Nicolson on a non-uniform multilayer grid 61 !! in the ice and snow system. 62 !! 63 !! ** Purpose : select the appropriate routine for the computation 64 !! of vertical diffusion 65 !!------------------------------------------------------------------- 66 67 SELECT CASE ( nice_zdf ) ! Choose the vertical heat diffusion solver 68 ! 69 ! !------------- 70 CASE( np_BL99 ) ! BL99 solver 71 ! !------------- 72 SELECT CASE( nice_jules ) 73 CASE( np_jules_OFF ) ; CALL ice_thd_zdf_BL99 ( np_zdf_jules_OFF ) ! No Jules coupler 74 CASE( np_jules_EMULE ) ; CALL ice_thd_zdf_BL99 ( np_zdf_jules_SND ) ! Jules coupler is emulated (send/recieve) 75 CALL ice_thd_zdf_BL99 ( np_zdf_jules_RCV ) 76 CASE( np_jules_ACTIVE ) ; CALL ice_thd_zdf_BL99 ( np_zdf_jules_RCV ) ! Jules coupler is active (receive only) 77 END SELECT 78 END SELECT 79 80 END SUBROUTINE ice_thd_zdf 81 82 83 SUBROUTINE ice_thd_zdf_BL99( k_jules ) 84 !!------------------------------------------------------------------- 85 !! *** ROUTINE ice_thd_zdf_BL99 *** 86 !! 87 !! ** Purpose : computes the time evolution of snow and sea-ice temperature 88 !! profiles, using the original Bitz and Lipscomb (1999) algorithm 89 !! 90 !! ** Method : solves the heat equation diffusion with a Neumann boundary 91 !! condition at the surface and a Dirichlet one at the bottom. 92 !! Solar radiation is partially absorbed into the ice. 93 !! The specific heat and thermal conductivities depend on ice 94 !! salinity and temperature to take into account brine pocket 95 !! melting. The numerical scheme is an iterative Crank-Nicolson 96 !! on a non-uniform multilayer grid in the ice and snow system. 62 97 !! 63 98 !! The successive steps of this routine are … … 83 118 !! total ice/snow thickness : h_i_1d, h_s_1d 84 119 !!------------------------------------------------------------------- 120 INTEGER, INTENT(in) :: k_jules ! Jules coupling (0=OFF, 1=RECEIVE, 2=SEND) 121 ! 85 122 INTEGER :: ji, jk ! spatial loop index 86 123 INTEGER :: jm ! current reference number of equation … … 88 125 INTEGER :: iconv ! number of iterations in iterative procedure 89 126 INTEGER :: iconv_max = 50 ! max number of iterations in iterative procedure 90 127 ! 91 128 INTEGER, DIMENSION(jpij) :: jm_min ! reference number of top equation 92 129 INTEGER, DIMENSION(jpij) :: jm_max ! reference number of bottom equation 93 130 ! 94 131 REAL(wp) :: zg1s = 2._wp ! for the tridiagonal system 95 132 REAL(wp) :: zg1 = 2._wp ! … … 101 138 REAL(wp) :: zdti_bnd = 1.e-4_wp ! maximal authorized error on temperature 102 139 REAL(wp) :: ztmelt_i ! ice melting temperature 103 REAL(wp) :: z1_hsu104 140 REAL(wp) :: zdti_max ! current maximal error on temperature 105 141 REAL(wp) :: zcpi ! Ice specific heat 106 142 REAL(wp) :: zhfx_err, zdq ! diag errors on heat 107 143 REAL(wp) :: zfac ! dummy factor 108 144 ! 109 145 REAL(wp), DIMENSION(jpij) :: isnow ! switch for presence (1) or absence (0) of snow 110 146 REAL(wp), DIMENSION(jpij) :: ztsub ! surface temperature at previous iteration 111 147 REAL(wp), DIMENSION(jpij) :: zh_i, z1_h_i ! ice layer thickness 112 148 REAL(wp), DIMENSION(jpij) :: zh_s, z1_h_s ! snow layer thickness 113 REAL(wp), DIMENSION(jpij) :: zfsw ! solar radiation absorbed at the surface114 149 REAL(wp), DIMENSION(jpij) :: zqns_ice_b ! solar radiation absorbed at the surface 115 150 REAL(wp), DIMENSION(jpij) :: zfnet ! surface flux function 116 151 REAL(wp), DIMENSION(jpij) :: zdqns_ice_b ! derivative of the surface flux function 117 REAL(wp), DIMENSION(jpij) :: zftrice ! solar radiation transmitted through the ice118 152 ! 153 REAL(wp), DIMENSION(jpij ) :: ztsuold ! Old surface temperature in the ice 119 154 REAL(wp), DIMENSION(jpij,nlay_i) :: ztiold ! Old temperature in the ice 120 155 REAL(wp), DIMENSION(jpij,nlay_s) :: ztsold ! Old temperature in the snow … … 136 171 REAL(wp), DIMENSION(jpij) :: zq_ini ! diag errors on heat 137 172 REAL(wp), DIMENSION(jpij) :: zghe ! G(he), th. conduct enhancement factor, mono-cat 138 173 ! 174 REAL(wp) :: zfr1, zfr2, zfrqsr_tr_i ! dummy factor 175 ! 139 176 ! Mono-category 140 177 REAL(wp) :: zepsilon ! determines thres. above which computation of G(h) is done … … 162 199 ELSEWHERE ; z1_h_i(1:npti) = 0._wp 163 200 END WHERE 164 201 ! 165 202 WHERE( zh_s(1:npti) >= epsi10 ) ; z1_h_s(1:npti) = 1._wp / zh_s(1:npti) 166 203 ELSEWHERE ; z1_h_s(1:npti) = 0._wp 167 204 END WHERE 168 205 ! 169 ! temperatures 170 ztsub (1:npti) = t_su_1d(1:npti) ! temperature at the previous iteration 206 ! Store initial temperatures and non solar heat fluxes 207 IF ( k_jules == np_zdf_jules_OFF .OR. k_jules == np_zdf_jules_SND ) THEN ! OFF or SND mode 208 ! 209 ztsub (1:npti) = t_su_1d(1:npti) ! surface temperature at iteration n-1 210 ztsuold(1:npti) = t_su_1d(1:npti) ! surface temperature initial value 211 zdqns_ice_b(1:npti) = dqns_ice_1d(1:npti) ! derivative of incoming nonsolar flux 212 zqns_ice_b (1:npti) = qns_ice_1d(1:npti) ! store previous qns_ice_1d value 213 ! 214 t_su_1d(1:npti) = MIN( t_su_1d(1:npti), rt0 - ztsu_err ) ! required to leave the choice between melting or not 215 ! 216 ENDIF 217 ! 171 218 ztsold (1:npti,:) = t_s_1d(1:npti,:) ! Old snow temperature 172 219 ztiold (1:npti,:) = t_i_1d(1:npti,:) ! Old ice temperature 173 t_su_1d(1:npti) = MIN( t_su_1d(1:npti), rt0 - ztsu_err ) ! necessary 174 ! 220 175 221 !------------- 176 222 ! 2) Radiation 177 223 !------------- 178 z1_hsu = 1._wp / 0.1_wp ! threshold for the computation of i0179 DO ji = 1, npti180 ! --- Computation of i0 --- !181 ! i0 describes the fraction of solar radiation which does not contribute182 ! to the surface energy budget but rather penetrates inside the ice.183 ! We assume that no radiation is transmitted through the snow184 ! If there is no no snow185 ! zfsw = (1-i0).qsr_ice is absorbed at the surface186 ! zftrice = io.qsr_ice is below the surface187 ! ftr_ice = io.qsr_ice.exp(-k(h_i)) transmitted below the ice188 ! fr1_i0_1d = i0 for a thin ice cover, fr1_i0_2d = i0 for a thick ice cover189 zfac = MAX( 0._wp , 1._wp - ( h_i_1d(ji) * z1_hsu ) )190 i0(ji) = ( 1._wp - isnow(ji) ) * ( fr1_i0_1d(ji) + zfac * fr2_i0_1d(ji) )191 192 ! --- Solar radiation absorbed / transmitted at the surface --- !193 ! Derivative of the non solar flux194 zfsw (ji) = qsr_ice_1d(ji) * ( 1 - i0(ji) ) ! Shortwave radiation absorbed at surface195 zftrice(ji) = qsr_ice_1d(ji) * i0(ji) ! Solar radiation transmitted below the surface layer196 zdqns_ice_b(ji) = dqns_ice_1d(ji) ! derivative of incoming nonsolar flux197 zqns_ice_b (ji) = qns_ice_1d(ji) ! store previous qns_ice_1d value198 END DO199 200 224 ! --- Transmission/absorption of solar radiation in the ice --- ! 201 zradtr_s(1:npti,0) = zftrice(1:npti) 225 ! zfr1 = ( 0.18 * ( 1.0 - 0.81 ) + 0.35 * 0.81 ) ! standard value 226 ! zfr2 = ( 0.82 * ( 1.0 - 0.81 ) + 0.65 * 0.81 ) ! zfr2 such that zfr1 + zfr2 to equal 1 227 ! 228 ! DO ji = 1, npti 229 ! 230 ! zfac = MAX( 0._wp , 1._wp - ( h_i_1d(ji) * 10._wp ) ) 231 ! 232 ! zfrqsr_tr_i = zfr1 + zfac * zfr2 ! below 10 cm, linearly increase zfrqsr_tr_i until 1 at zero thickness 233 ! IF ( h_s_1d(ji) >= 0.0_wp ) zfrqsr_tr_i = 0._wp ! snow fully opaque 234 ! 235 ! qsr_ice_tr_1d(ji) = zfrqsr_tr_i * qsr_ice_1d(ji) ! transmitted solar radiation 236 ! 237 ! zfsw(ji) = qsr_ice_1d(ji) - qsr_ice_tr_1d(ji) 238 ! zftrice(ji) = qsr_ice_tr_1d(ji) 239 ! i0(ji) = zfrqsr_tr_i 240 ! 241 ! END DO 242 243 zradtr_s(1:npti,0) = qsr_ice_tr_1d(1:npti) 202 244 DO jk = 1, nlay_s 203 245 DO ji = 1, npti … … 208 250 END DO 209 251 END DO 210 211 zradtr_i(1:npti,0) = zradtr_s(1:npti,nlay_s) * isnow(1:npti) + zftrice(1:npti) * ( 1._wp - isnow(1:npti) )252 ! 253 zradtr_i(1:npti,0) = zradtr_s(1:npti,nlay_s) * isnow(1:npti) + qsr_ice_tr_1d(1:npti) * ( 1._wp - isnow(1:npti) ) 212 254 DO jk = 1, nlay_i 213 255 DO ji = 1, npti … … 218 260 END DO 219 261 END DO 220 262 ! 221 263 ftr_ice_1d(1:npti) = zradtr_i(1:npti,nlay_i) ! record radiation transmitted below the ice 222 264 ! … … 273 315 ! 274 316 SELECT CASE ( nn_monocat ) 275 317 ! 276 318 CASE ( 1 , 3 ) 277 319 ! 278 320 zepsilon = 0.1_wp 279 321 DO ji = 1, npti … … 284 326 ENDIF 285 327 END DO 286 328 ! 287 329 END SELECT 288 330 ! … … 330 372 END DO 331 373 END DO 332 ! 333 !---------------------------- 334 ! 6) surface flux computation 335 !---------------------------- 336 IF ( ln_dqns_i ) THEN 337 DO ji = 1, npti 338 ! update of the non solar flux according to the update in T_su 374 375 ! 376 !----------------------------------------! 377 ! ! 378 ! JULES IF (OFF or SND MODE) ! 379 ! ! 380 !----------------------------------------! 381 ! 382 383 IF ( k_jules == np_zdf_jules_OFF .OR. k_jules == np_zdf_jules_SND ) THEN ! OFF or SND mode 384 385 ! 386 ! In OFF mode the original BL99 temperature computation is used 387 ! (with qsr_ice, qns_ice and dqns_ice as inputs) 388 ! 389 ! In SND mode, the computation is required to compute the conduction fluxes 390 ! 391 392 !---------------------------- 393 ! 6) surface flux computation 394 !---------------------------- 395 396 DO ji = 1, npti 397 ! update of the non solar flux according to the update in T_su 339 398 qns_ice_1d(ji) = qns_ice_1d(ji) + dqns_ice_1d(ji) * ( t_su_1d(ji) - ztsub(ji) ) 340 399 END DO 341 ENDIF 342 343 DO ji = 1, npti 344 zfnet(ji) = zfsw(ji) + qns_ice_1d(ji) ! incoming = net absorbed solar radiation + non solar total flux (LWup, LWdw, SH, LH) 345 END DO 346 ! 347 !---------------------------- 348 ! 7) tridiagonal system terms 349 !---------------------------- 350 !!layer denotes the number of the layer in the snow or in the ice 351 !!jm denotes the reference number of the equation in the tridiagonal 352 !!system, terms of tridiagonal system are indexed as following : 353 !!1 is subdiagonal term, 2 is diagonal and 3 is superdiagonal one 354 355 !!ice interior terms (top equation has the same form as the others) 356 ztrid (1:npti,:,:) = 0._wp 357 zindterm(1:npti,:) = 0._wp 358 zindtbis(1:npti,:) = 0._wp 359 zdiagbis(1:npti,:) = 0._wp 360 361 DO jm = nlay_s + 2, nlay_s + nlay_i 400 401 DO ji = 1, npti 402 zfnet(ji) = qsr_ice_1d(ji) - qsr_ice_tr_1d(ji) + qns_ice_1d(ji) ! net heat flux = net solar - transmitted solar + non solar 403 END DO 404 ! 405 !---------------------------- 406 ! 7) tridiagonal system terms 407 !---------------------------- 408 !!layer denotes the number of the layer in the snow or in the ice 409 !!jm denotes the reference number of the equation in the tridiagonal 410 !!system, terms of tridiagonal system are indexed as following : 411 !!1 is subdiagonal term, 2 is diagonal and 3 is superdiagonal one 412 413 !!ice interior terms (top equation has the same form as the others) 414 ztrid (1:npti,:,:) = 0._wp 415 zindterm(1:npti,:) = 0._wp 416 zindtbis(1:npti,:) = 0._wp 417 zdiagbis(1:npti,:) = 0._wp 418 419 DO jm = nlay_s + 2, nlay_s + nlay_i 362 420 DO ji = 1, npti 363 421 jk = jm - nlay_s - 1 … … 367 425 zindterm(ji,jm) = ztiold(ji,jk) + zeta_i(ji,jk) * zradab_i(ji,jk) 368 426 END DO 369 ENDDO370 371 jm = nlay_s + nlay_i + 1372 DO ji = 1, npti427 END DO 428 429 jm = nlay_s + nlay_i + 1 430 DO ji = 1, npti 373 431 !!ice bottom term 374 432 ztrid(ji,jm,1) = - zeta_i(ji,nlay_i)*zkappa_i(ji,nlay_i-1) … … 377 435 zindterm(ji,jm) = ztiold(ji,nlay_i) + zeta_i(ji,nlay_i) * & 378 436 & ( zradab_i(ji,nlay_i) + zkappa_i(ji,nlay_i) * zg1 * t_bo_1d(ji) ) 379 ENDDO380 381 382 DO ji = 1, npti437 END DO 438 439 440 DO ji = 1, npti 383 441 ! !---------------------! 384 IF ( h_s_1d(ji) > 0.0 ) THEN ! snow-covered cells !442 IF ( h_s_1d(ji) > 0.0 ) THEN ! snow-covered cells ! 385 443 ! !---------------------! 386 444 ! snow interior terms (bottom equation has the same form as the others) … … 428 486 & ( zradab_s(ji,1) + zkappa_s(ji,0) * zg1s * t_su_1d(ji) ) 429 487 ENDIF 430 !!---------------------!488 ! !---------------------! 431 489 ELSE ! cells without snow ! 432 490 ! !---------------------! … … 453 511 ztrid(ji,jm_min(ji),1) = 0.0 454 512 ztrid(ji,jm_min(ji),2) = zdqns_ice_b(ji) - zkappa_i(ji,0) * 2.0 455 ztrid(ji,jm_min(ji),3) = zkappa_i(ji,0) * 2.0513 ztrid(ji,jm_min(ji),3) = zkappa_i(ji,0) * 2.0 456 514 ztrid(ji,jm_min(ji)+1,1) = -zkappa_i(ji,0) * 2.0 * zeta_i(ji,1) 457 515 ztrid(ji,jm_min(ji)+1,2) = 1.0 + zeta_i(ji,1) * ( zkappa_i(ji,0) * 2.0 + zkappa_i(ji,1) ) … … 488 546 zdiagbis(ji,jm_min(ji)) = ztrid(ji,jm_min(ji),2) 489 547 ! 490 END DO491 !492 !------------------------------493 ! 8) tridiagonal system solving494 !------------------------------495 ! Solve the tridiagonal system with Gauss elimination method.496 ! Thomas algorithm, from Computational fluid Dynamics, J.D. ANDERSON, McGraw-Hill 1984497 jm_maxt = 0498 jm_mint = nlay_i+5499 DO ji = 1, npti500 jm_mint = MIN(jm_min(ji),jm_mint)501 jm_maxt = MAX(jm_max(ji),jm_maxt)502 END DO503 504 DO jk = jm_mint+1, jm_maxt548 END DO 549 ! 550 !------------------------------ 551 ! 8) tridiagonal system solving 552 !------------------------------ 553 ! Solve the tridiagonal system with Gauss elimination method. 554 ! Thomas algorithm, from Computational fluid Dynamics, J.D. ANDERSON, McGraw-Hill 1984 555 jm_maxt = 0 556 jm_mint = nlay_i+5 557 DO ji = 1, npti 558 jm_mint = MIN(jm_min(ji),jm_mint) 559 jm_maxt = MAX(jm_max(ji),jm_maxt) 560 END DO 561 562 DO jk = jm_mint+1, jm_maxt 505 563 DO ji = 1, npti 506 564 jm = min(max(jm_min(ji)+1,jk),jm_max(ji)) … … 508 566 zindtbis(ji,jm) = zindterm(ji,jm) - ztrid(ji,jm,1) * zindtbis(ji,jm-1) / zdiagbis(ji,jm-1) 509 567 END DO 510 END DO511 512 DO ji = 1, npti568 END DO 569 570 DO ji = 1, npti 513 571 ! ice temperatures 514 572 t_i_1d(ji,nlay_i) = zindtbis(ji,jm_max(ji)) / zdiagbis(ji,jm_max(ji)) 515 END DO516 517 DO jm = nlay_i + nlay_s, nlay_s + 2, -1573 END DO 574 575 DO jm = nlay_i + nlay_s, nlay_s + 2, -1 518 576 DO ji = 1, npti 519 577 jk = jm - nlay_s - 1 520 578 t_i_1d(ji,jk) = ( zindtbis(ji,jm) - ztrid(ji,jm,3) * t_i_1d(ji,jk+1) ) / zdiagbis(ji,jm) 521 579 END DO 522 END DO523 524 DO ji = 1, npti580 END DO 581 582 DO ji = 1, npti 525 583 ! snow temperatures 526 584 IF( h_s_1d(ji) > 0._wp ) THEN 527 585 t_s_1d(ji,nlay_s) = ( zindtbis(ji,nlay_s+1) - ztrid(ji,nlay_s+1,3) * t_i_1d(ji,1) ) & 528 586 & / zdiagbis(ji,nlay_s+1) 529 587 ENDIF 530 588 ! surface temperature … … 534 592 & ( isnow(ji) * t_s_1d(ji,1) + ( 1._wp - isnow(ji) ) * t_i_1d(ji,1) ) ) / zdiagbis(ji,jm_min(ji)) 535 593 ENDIF 536 END DO537 !538 !--------------------------------------------------------------539 ! 9) Has the scheme converged ?, end of the iterative procedure540 !--------------------------------------------------------------541 ! check that nowhere it has started to melt542 ! zdti_max is a measure of error, it has to be under zdti_bnd543 zdti_max = 0._wp544 DO ji = 1, npti594 END DO 595 ! 596 !-------------------------------------------------------------- 597 ! 9) Has the scheme converged ?, end of the iterative procedure 598 !-------------------------------------------------------------- 599 ! check that nowhere it has started to melt 600 ! zdti_max is a measure of error, it has to be under zdti_bnd 601 zdti_max = 0._wp 602 DO ji = 1, npti 545 603 t_su_1d(ji) = MAX( MIN( t_su_1d(ji) , rt0 ) , rt0 - 100._wp ) 546 604 zdti_max = MAX( zdti_max, ABS( t_su_1d(ji) - ztsub(ji) ) ) 547 END DO548 549 DO jk = 1, nlay_s605 END DO 606 607 DO jk = 1, nlay_s 550 608 DO ji = 1, npti 551 609 t_s_1d(ji,jk) = MAX( MIN( t_s_1d(ji,jk), rt0 ), rt0 - 100._wp ) 552 610 zdti_max = MAX( zdti_max, ABS( t_s_1d(ji,jk) - ztsb(ji,jk) ) ) 553 611 END DO 554 END DO555 556 DO jk = 1, nlay_i612 END DO 613 614 DO jk = 1, nlay_i 557 615 DO ji = 1, npti 558 616 ztmelt_i = -tmut * sz_i_1d(ji,jk) + rt0 … … 560 618 zdti_max = MAX( zdti_max, ABS( t_i_1d(ji,jk) - ztib(ji,jk) ) ) 561 619 END DO 562 END DO 563 564 ! Compute spatial maximum over all errors 565 ! note that this could be optimized substantially by iterating only the non-converging points 566 IF( lk_mpp ) CALL mpp_max( zdti_max, kcom=ncomm_ice ) 567 620 END DO 621 622 ! Compute spatial maximum over all errors 623 ! note that this could be optimized substantially by iterating only the non-converging points 624 IF( lk_mpp ) CALL mpp_max( zdti_max, kcom=ncomm_ice ) 625 ! 626 !----------------------------------------! 627 ! ! 628 ! JULES IF (RCV MODE) ! 629 ! ! 630 !----------------------------------------! 631 ! 632 633 ELSE IF ( k_jules == np_zdf_jules_RCV ) THEN ! RCV mode 634 635 ! 636 ! In RCV mode, we use a modified BL99 solver 637 ! with conduction flux (qcn_ice) as forcing term 638 ! 639 !---------------------------- 640 ! 7) tridiagonal system terms 641 !---------------------------- 642 !!layer denotes the number of the layer in the snow or in the ice 643 !!jm denotes the reference number of the equation in the tridiagonal 644 !!system, terms of tridiagonal system are indexed as following : 645 !!1 is subdiagonal term, 2 is diagonal and 3 is superdiagonal one 646 647 !!ice interior terms (top equation has the same form as the others) 648 ztrid (1:npti,:,:) = 0._wp 649 zindterm(1:npti,:) = 0._wp 650 zindtbis(1:npti,:) = 0._wp 651 zdiagbis(1:npti,:) = 0._wp 652 653 DO jm = nlay_s + 2, nlay_s + nlay_i 654 DO ji = 1, npti 655 jk = jm - nlay_s - 1 656 ztrid(ji,jm,1) = - zeta_i(ji,jk) * zkappa_i(ji,jk-1) 657 ztrid(ji,jm,2) = 1.0 + zeta_i(ji,jk) * ( zkappa_i(ji,jk-1) + zkappa_i(ji,jk) ) 658 ztrid(ji,jm,3) = - zeta_i(ji,jk) * zkappa_i(ji,jk) 659 zindterm(ji,jm) = ztiold(ji,jk) + zeta_i(ji,jk) * zradab_i(ji,jk) 660 END DO 661 ENDDO 662 663 jm = nlay_s + nlay_i + 1 664 DO ji = 1, npti 665 !!ice bottom term 666 ztrid(ji,jm,1) = - zeta_i(ji,nlay_i)*zkappa_i(ji,nlay_i-1) 667 ztrid(ji,jm,2) = 1.0 + zeta_i(ji,nlay_i) * ( zkappa_i(ji,nlay_i) * zg1 + zkappa_i(ji,nlay_i-1) ) 668 ztrid(ji,jm,3) = 0.0 669 zindterm(ji,jm) = ztiold(ji,nlay_i) + zeta_i(ji,nlay_i) * & 670 & ( zradab_i(ji,nlay_i) + zkappa_i(ji,nlay_i) * zg1 * t_bo_1d(ji) ) 671 ENDDO 672 673 674 DO ji = 1, npti 675 ! !---------------------! 676 IF ( h_s_1d(ji) > 0.0 ) THEN ! snow-covered cells ! 677 ! !---------------------! 678 ! snow interior terms (bottom equation has the same form as the others) 679 DO jm = 3, nlay_s + 1 680 jk = jm - 1 681 ztrid(ji,jm,1) = - zeta_s(ji,jk) * zkappa_s(ji,jk-1) 682 ztrid(ji,jm,2) = 1.0 + zeta_s(ji,jk) * ( zkappa_s(ji,jk-1) + zkappa_s(ji,jk) ) 683 ztrid(ji,jm,3) = - zeta_s(ji,jk)*zkappa_s(ji,jk) 684 zindterm(ji,jm) = ztsold(ji,jk) + zeta_s(ji,jk) * zradab_s(ji,jk) 685 END DO 686 687 ! case of only one layer in the ice (ice equation is altered) 688 IF ( nlay_i == 1 ) THEN 689 ztrid(ji,nlay_s+2,3) = 0.0 690 zindterm(ji,nlay_s+2) = zindterm(ji,nlay_s+2) + zkappa_i(ji,1) * t_bo_1d(ji) 691 ENDIF 692 693 jm_min(ji) = 2 694 jm_max(ji) = nlay_i + nlay_s + 1 695 696 ! first layer of snow equation 697 ztrid(ji,2,1) = 0.0 698 ztrid(ji,2,2) = 1.0 + zeta_s(ji,1) * zkappa_s(ji,1) 699 ztrid(ji,2,3) = - zeta_s(ji,1)*zkappa_s(ji,1) 700 zindterm(ji,2) = ztsold(ji,1) + zeta_s(ji,1) * & 701 & ( zradab_s(ji,1) + qcn_ice_1d(ji) ) 702 703 ! !---------------------! 704 ELSE ! cells without snow ! 705 ! !---------------------! 706 707 jm_min(ji) = nlay_s + 2 708 jm_max(ji) = nlay_i + nlay_s + 1 709 710 ! first layer of ice equation 711 ztrid(ji,jm_min(ji),1) = 0.0 712 ztrid(ji,jm_min(ji),2) = 1.0 + zeta_i(ji,1) * zkappa_i(ji,1) 713 ztrid(ji,jm_min(ji),3) = - zeta_i(ji,1) * zkappa_i(ji,1) 714 zindterm(ji,jm_min(ji)) = ztiold(ji,1) + zeta_i(ji,1) * & 715 & ( zradab_i(ji,1) + qcn_ice_1d(ji) ) 716 717 ! case of only one layer in the ice (surface & ice equations are altered) 718 IF ( nlay_i == 1 ) THEN 719 ztrid(ji,jm_min(ji),1) = 0.0 720 ztrid(ji,jm_min(ji),2) = 1.0 + zeta_i(ji,1) * zkappa_i(ji,1) 721 ztrid(ji,jm_min(ji),3) = 0.0 722 zindterm(ji,jm_min(ji)) = ztiold(ji,1) + zeta_i(ji,1) * ( zradab_i(ji,1) + zkappa_i(ji,1) * t_bo_1d(ji) & 723 & + qcn_ice_1d(ji) ) 724 725 ENDIF 726 727 ENDIF 728 ! 729 zindtbis(ji,jm_min(ji)) = zindterm(ji,jm_min(ji)) 730 zdiagbis(ji,jm_min(ji)) = ztrid(ji,jm_min(ji),2) 731 ! 732 END DO 733 ! 734 !------------------------------ 735 ! 8) tridiagonal system solving 736 !------------------------------ 737 ! Solve the tridiagonal system with Gauss elimination method. 738 ! Thomas algorithm, from Computational fluid Dynamics, J.D. ANDERSON, McGraw-Hill 1984 739 jm_maxt = 0 740 jm_mint = nlay_i+5 741 DO ji = 1, npti 742 jm_mint = MIN(jm_min(ji),jm_mint) 743 jm_maxt = MAX(jm_max(ji),jm_maxt) 744 END DO 745 746 DO jk = jm_mint+1, jm_maxt 747 DO ji = 1, npti 748 jm = min(max(jm_min(ji)+1,jk),jm_max(ji)) 749 zdiagbis(ji,jm) = ztrid(ji,jm,2) - ztrid(ji,jm,1) * ztrid(ji,jm-1,3) / zdiagbis(ji,jm-1) 750 zindtbis(ji,jm) = zindterm(ji,jm) - ztrid(ji,jm,1) * zindtbis(ji,jm-1) / zdiagbis(ji,jm-1) 751 END DO 752 END DO 753 754 DO ji = 1, npti 755 ! ice temperatures 756 t_i_1d(ji,nlay_i) = zindtbis(ji,jm_max(ji)) / zdiagbis(ji,jm_max(ji)) 757 END DO 758 759 DO jm = nlay_i + nlay_s, nlay_s + 2, -1 760 DO ji = 1, npti 761 jk = jm - nlay_s - 1 762 t_i_1d(ji,jk) = ( zindtbis(ji,jm) - ztrid(ji,jm,3) * t_i_1d(ji,jk+1) ) / zdiagbis(ji,jm) 763 END DO 764 END DO 765 766 DO ji = 1, npti 767 ! snow temperatures 768 IF( h_s_1d(ji) > 0._wp ) THEN 769 t_s_1d(ji,nlay_s) = ( zindtbis(ji,nlay_s+1) - ztrid(ji,nlay_s+1,3) * t_i_1d(ji,1) ) & 770 & / zdiagbis(ji,nlay_s+1) 771 ENDIF 772 END DO 773 ! 774 !-------------------------------------------------------------- 775 ! 9) Has the scheme converged ?, end of the iterative procedure 776 !-------------------------------------------------------------- 777 ! check that nowhere it has started to melt 778 ! zdti_max is a measure of error, it has to be under zdti_bnd 779 zdti_max = 0._wp 780 781 DO jk = 1, nlay_s 782 DO ji = 1, npti 783 t_s_1d(ji,jk) = MAX( MIN( t_s_1d(ji,jk), rt0 ), rt0 - 100._wp ) 784 zdti_max = MAX( zdti_max, ABS( t_s_1d(ji,jk) - ztsb(ji,jk) ) ) 785 END DO 786 END DO 787 788 DO jk = 1, nlay_i 789 DO ji = 1, npti 790 ztmelt_i = -tmut * sz_i_1d(ji,jk) + rt0 791 t_i_1d(ji,jk) = MAX( MIN( t_i_1d(ji,jk), ztmelt_i ), rt0 - 100._wp ) 792 zdti_max = MAX( zdti_max, ABS( t_i_1d(ji,jk) - ztib(ji,jk) ) ) 793 END DO 794 END DO 795 796 ! Compute spatial maximum over all errors 797 ! note that this could be optimized substantially by iterating only the non-converging points 798 IF( lk_mpp ) CALL mpp_max( zdti_max, kcom=ncomm_ice ) 799 800 ENDIF ! k_jules 801 568 802 END DO ! End of the do while iterative procedure 569 803 570 804 IF( ln_icectl .AND. lwp ) THEN 571 805 WRITE(numout,*) ' zdti_max : ', zdti_max 572 806 WRITE(numout,*) ' iconv : ', iconv 573 807 ENDIF 808 574 809 ! 575 810 !----------------------------- 576 811 ! 10) Fluxes at the interfaces 577 812 !----------------------------- 813 ! 814 ! --- update conduction fluxes 815 ! 578 816 DO ji = 1, npti 579 817 ! ! surface ice conduction flux 580 818 fc_su(ji) = - isnow(ji) * zkappa_s(ji,0) * zg1s * (t_s_1d(ji,1) - t_su_1d(ji)) & 581 819 & - ( 1._wp - isnow(ji) ) * zkappa_i(ji,0) * zg1 * (t_i_1d(ji,1) - t_su_1d(ji)) 582 820 ! ! bottom ice conduction flux 583 821 fc_bo_i(ji) = - zkappa_i(ji,nlay_i) * ( zg1*(t_bo_1d(ji) - t_i_1d(ji,nlay_i)) ) 584 822 END DO 585 586 ! --- computes sea ice energy of melting compulsory for icethd_dh --- ! 587 CALL ice_thd_enmelt 588 589 ! --- diagnose the change in non-solar flux due to surface temperature change --- ! 590 IF ( ln_dqns_i ) THEN 823 824 ! 825 ! --- Diagnose the heat loss due to changing non-solar / conduction flux --- ! 826 ! 827 IF ( k_jules == np_zdf_jules_OFF .OR. k_jules == np_zdf_jules_SND ) THEN ! OFF or SND mode 591 828 DO ji = 1, npti 592 hfx_err_dif_1d(ji) = hfx_err_dif_1d(ji) - ( qns_ice_1d(ji) - zqns_ice_b(ji) ) * a_i_1d(ji) 593 END DO 594 END IF 595 596 ! --- diag conservation imbalance on heat diffusion - PART 2 --- ! 597 ! hfx_dif = Heat flux used to warm/cool ice in W.m-2 598 ! zhfx_err = correction on the diagnosed heat flux due to non-convergence of the algorithm used to solve heat equation 599 DO ji = 1, npti 600 zdq = - zq_ini(ji) + ( SUM( e_i_1d(ji,1:nlay_i) ) * h_i_1d(ji) * r1_nlay_i + & 601 & SUM( e_s_1d(ji,1:nlay_s) ) * h_s_1d(ji) * r1_nlay_s ) 602 603 IF( t_su_1d(ji) < rt0 ) THEN ! case T_su < 0degC 604 zhfx_err = ( qns_ice_1d(ji) + qsr_ice_1d(ji) - zradtr_i(ji,nlay_i) - fc_bo_i(ji) + zdq * r1_rdtice ) * a_i_1d(ji) 605 ELSE ! case T_su = 0degC 606 zhfx_err = ( fc_su(ji) + i0(ji) * qsr_ice_1d(ji) - zradtr_i(ji,nlay_i) - fc_bo_i(ji) + zdq * r1_rdtice ) * a_i_1d(ji) 607 ENDIF 608 hfx_dif_1d(ji) = hfx_dif_1d(ji) - zdq * r1_rdtice * a_i_1d(ji) 609 610 ! total heat that is sent to the ocean (i.e. not used in the heat diffusion equation) 611 hfx_err_dif_1d(ji) = hfx_err_dif_1d(ji) + zhfx_err 612 613 END DO 614 615 ! --- Diagnostics SIMIP --- ! 616 DO ji = 1, npti 617 !--- Conduction fluxes (positive downwards) 618 diag_fc_bo_1d(ji) = diag_fc_bo_1d(ji) + fc_bo_i(ji) * a_i_1d(ji) / at_i_1d(ji) 619 diag_fc_su_1d(ji) = diag_fc_su_1d(ji) + fc_su(ji) * a_i_1d(ji) / at_i_1d(ji) 620 621 !--- Snow-ice interfacial temperature (diagnostic SIMIP) 622 zfac = rn_cnd_s * zh_i(ji) + ztcond_i(ji,1) * zh_s(ji) 623 IF( zh_s(ji) >= 1.e-3 .AND. zfac > epsi10 ) THEN 624 t_si_1d(ji) = ( rn_cnd_s * zh_i(ji) * t_s_1d(ji,1) + & 625 & ztcond_i(ji,1) * zh_s(ji) * t_i_1d(ji,1) ) / zfac 626 ELSE 627 t_si_1d(ji) = t_su_1d(ji) 628 ENDIF 629 END DO 630 ! 631 END SUBROUTINE ice_thd_zdf 829 hfx_err_dif_1d(ji) = hfx_err_dif_1d(ji) - ( qns_ice_1d(ji) - zqns_ice_b(ji) ) * a_i_1d(ji) 830 END DO 831 ELSE ! RCV mode 832 DO ji = 1, npti 833 hfx_err_dif_1d(ji) = hfx_err_dif_1d(ji) - ( fc_su(ji) - qcn_ice_1d(ji) ) * a_i_1d(ji) 834 END DO 835 ENDIF 836 837 ! 838 ! --- Diagnose the heat loss due to non-fully converged temperature solution (should not be above 10-4 W-m2) --- ! 839 ! 840 841 IF ( ( k_jules == np_zdf_jules_OFF ) .OR. ( k_jules == np_zdf_jules_RCV ) ) THEN ! OFF 842 843 CALL ice_thd_enmelt 844 845 ! zhfx_err = correction on the diagnosed heat flux due to non-convergence of the algorithm used to solve heat equation 846 DO ji = 1, npti 847 zdq = - zq_ini(ji) + ( SUM( e_i_1d(ji,1:nlay_i) ) * h_i_1d(ji) * r1_nlay_i + & 848 & SUM( e_s_1d(ji,1:nlay_s) ) * h_s_1d(ji) * r1_nlay_s ) 849 850 IF ( ( k_jules == np_zdf_jules_OFF ) ) THEN 851 852 IF( t_su_1d(ji) < rt0 ) THEN ! case T_su < 0degC 853 zhfx_err = ( qns_ice_1d(ji) + qsr_ice_1d(ji) - zradtr_i(ji,nlay_i) - fc_bo_i(ji) + zdq * r1_rdtice ) * a_i_1d(ji) 854 ELSE ! case T_su = 0degC 855 zhfx_err = ( fc_su(ji) + qsr_ice_tr_1d(ji) - zradtr_i(ji,nlay_i) - fc_bo_i(ji) + zdq * r1_rdtice ) * a_i_1d(ji) 856 ENDIF 857 858 ELSE ! RCV CASE 859 860 zhfx_err = ( fc_su(ji) + qsr_ice_tr_1d(ji) - zradtr_i(ji,nlay_i) - fc_bo_i(ji) + zdq * r1_rdtice ) * a_i_1d(ji) 861 862 ENDIF 863 ! 864 ! total heat sink to be sent to the ocean 865 hfx_err_dif_1d(ji) = hfx_err_dif_1d(ji) + zhfx_err 866 ! 867 ! hfx_dif = Heat flux diagnostic of sensible heat used to warm/cool ice in W.m-2 868 hfx_dif_1d(ji) = hfx_dif_1d(ji) - zdq * r1_rdtice * a_i_1d(ji) 869 ! 870 END DO 871 ! 872 ! --- SIMIP diagnostics 873 ! 874 DO ji = 1, npti 875 !--- Conduction fluxes (positive downwards) 876 diag_fc_bo_1d(ji) = diag_fc_bo_1d(ji) + fc_bo_i(ji) * a_i_1d(ji) / at_i_1d(ji) 877 diag_fc_su_1d(ji) = diag_fc_su_1d(ji) + fc_su(ji) * a_i_1d(ji) / at_i_1d(ji) 878 879 !--- Snow-ice interfacial temperature (diagnostic SIMIP) 880 zfac = rn_cnd_s * zh_i(ji) + ztcond_i(ji,1) * zh_s(ji) 881 IF( zh_s(ji) >= 1.e-3 .AND. zfac > epsi10 ) THEN 882 t_si_1d(ji) = ( rn_cnd_s * zh_i(ji) * t_s_1d(ji,1) + & 883 & ztcond_i(ji,1) * zh_s(ji) * t_i_1d(ji,1) ) / zfac 884 ELSE 885 t_si_1d(ji) = t_su_1d(ji) 886 ENDIF 887 END DO 888 ! 889 ENDIF 890 ! 891 !--------------------------------------------------------------------------------------- 892 ! 11) Jules coupling: reset inner snow and ice temperatures, update conduction fluxes 893 !--------------------------------------------------------------------------------------- 894 ! 895 IF ( k_jules == np_zdf_jules_SND ) THEN ! --- Jules coupling in "SND" mode 896 ! 897 ! Restore temperatures to their initial values 898 t_s_1d(1:npti,:) = ztsold (1:npti,:) 899 t_i_1d(1:npti,:) = ztiold (1:npti,:) 900 qcn_ice_1d(1:npti) = fc_su(1:npti) 901 ! 902 ENDIF 903 ! 904 END SUBROUTINE ice_thd_zdf_BL99 632 905 633 906 … … 675 948 !! ** input : Namelist namthd_zdf 676 949 !!------------------------------------------------------------------- 677 INTEGER :: ios ! Local integer output status for namelist read950 INTEGER :: ios, ioptio ! Local integer 678 951 !! 679 NAMELIST/namthd_zdf/ ln_zdf_BL99, ln_cndi_U64, ln_cndi_P07, rn_cnd_s, rn_kappa_i , ln_dqns_i952 NAMELIST/namthd_zdf/ ln_zdf_BL99, ln_cndi_U64, ln_cndi_P07, rn_cnd_s, rn_kappa_i 680 953 !!------------------------------------------------------------------- 681 954 ! … … 694 967 WRITE(numout,*) '~~~~~~~~~~~~~~~~' 695 968 WRITE(numout,*) ' Namelist namthd_zdf:' 696 WRITE(numout,*) ' Diffusion follows a Bitz and Lipscomb (1999)ln_zdf_BL99 = ', ln_zdf_BL99969 WRITE(numout,*) ' Bitz and Lipscomb (1999) formulation ln_zdf_BL99 = ', ln_zdf_BL99 697 970 WRITE(numout,*) ' thermal conductivity in the ice (Untersteiner 1964) ln_cndi_U64 = ', ln_cndi_U64 698 971 WRITE(numout,*) ' thermal conductivity in the ice (Pringle et al 2007) ln_cndi_P07 = ', ln_cndi_P07 699 972 WRITE(numout,*) ' thermal conductivity in the snow rn_cnd_s = ', rn_cnd_s 700 973 WRITE(numout,*) ' extinction radiation parameter in sea ice rn_kappa_i = ', rn_kappa_i 701 WRITE(numout,*) ' change the surface non-solar flux with Tsu or not ln_dqns_i = ', ln_dqns_i702 974 ENDIF 975 703 976 ! 704 977 IF ( ( ln_cndi_U64 .AND. ln_cndi_P07 ) .OR. ( .NOT.ln_cndi_U64 .AND. .NOT.ln_cndi_P07 ) ) THEN 705 978 CALL ctl_stop( 'ice_thd_zdf_init: choose one and only one formulation for thermal conduction (ln_cndi_U64 or ln_cndi_P07)' ) 706 979 ENDIF 980 981 ! !== set the choice of ice vertical thermodynamic formulation ==! 982 ioptio = 0 983 ! !--- BL99 thermo dynamics (linear liquidus + constant thermal properties) 984 IF( ln_zdf_BL99 ) THEN ; ioptio = ioptio + 1 ; nice_zdf = np_BL99 ; ENDIF 985 IF( ioptio /= 1 ) CALL ctl_stop( 'ice_thd_init: one and only one ice thermo option has to be defined ' ) 707 986 ! 708 987 END SUBROUTINE ice_thd_zdf_init -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/LIM_SRC_3/icevar.F90
r8637 r8813 44 44 !! ice_var_salprof1d : salinity profile in the ice 1D 45 45 !! ice_var_zapsmall : remove very small area and volume 46 !! ice_var_itd : convert 1-cat to multiple cat 46 !! ice_var_itd : convert 1-cat to jpl-cat 47 !! ice_var_itd2 : convert N-cat to jpl-cat 47 48 !! ice_var_bv : brine volume 48 49 !!---------------------------------------------------------------------- … … 67 68 PUBLIC ice_var_zapsmall 68 69 PUBLIC ice_var_itd 70 PUBLIC ice_var_itd2 69 71 PUBLIC ice_var_bv 70 72 … … 96 98 et_s(:,:) = SUM( SUM( e_s(:,:,:,:), dim=4 ), dim=3 ) 97 99 et_i(:,:) = SUM( SUM( e_i(:,:,:,:), dim=4 ), dim=3 ) 98 100 ! 99 101 at_ip(:,:) = SUM( a_ip(:,:,:), dim=3 ) ! melt ponds 100 102 vt_ip(:,:) = SUM( v_ip(:,:,:), dim=3 ) 101 102 ato_i(:,:) = 1._wp - at_i(:,:) ! open water fraction103 ! 104 ato_i(:,:) = 1._wp - at_i(:,:) ! open water fraction 103 105 104 106 IF( kn > 1 ) THEN … … 238 240 END WHERE 239 241 END DO 240 242 ! 241 243 ! integrated values 242 244 vt_i (:,:) = SUM( v_i, dim=3 ) … … 322 324 END DO 323 325 END DO 324 326 ! 325 327 ! Computation of the profile 326 328 DO jl = 1, jpl … … 362 364 END SUBROUTINE ice_var_salprof 363 365 366 364 367 SUBROUTINE ice_var_salprof1d 365 368 !!------------------------------------------------------------------- … … 457 460 ELSEWHERE ; zswitch(:,:) = 1._wp 458 461 END WHERE 459 462 ! 460 463 DO jk = 1, nlay_i 461 464 DO jj = 1 , jpj … … 468 471 END DO 469 472 END DO 470 473 ! 471 474 DO jj = 1 , jpj 472 475 DO ji = 1 , jpi … … 484 487 t_s(ji,jj,1,jl) = t_s(ji,jj,1,jl) * zswitch(ji,jj) + rt0 * ( 1._wp - zswitch(ji,jj) ) 485 488 e_s(ji,jj,1,jl) = e_s(ji,jj,1,jl) * zswitch(ji,jj) 486 489 ! 487 490 !----------------------------------------------------------------- 488 491 ! zap ice and snow volume, add water and salt to ocean … … 495 498 oa_i (ji,jj,jl) = oa_i(ji,jj,jl) * zswitch(ji,jj) 496 499 sv_i (ji,jj,jl) = sv_i(ji,jj,jl) * zswitch(ji,jj) 497 500 ! 498 501 h_i (ji,jj,jl) = h_i (ji,jj,jl) * zswitch(ji,jj) 499 502 h_s (ji,jj,jl) = h_s (ji,jj,jl) * zswitch(ji,jj) 500 503 ! 501 504 a_ip (ji,jj,jl) = a_ip (ji,jj,jl) * zswitch(ji,jj) 502 505 v_ip (ji,jj,jl) = v_ip (ji,jj,jl) * zswitch(ji,jj) 503 504 END DO 505 END DO 506 506 ! 507 END DO 508 END DO 509 ! 507 510 END DO 508 511 … … 548 551 !!------------------------------------------------------------------- 549 552 INTEGER :: ji, jk, jl ! dummy loop indices 550 INTEGER :: i jpij, i_fill, jl0553 INTEGER :: idim, i_fill, jl0 551 554 REAL(wp) :: zarg, zV, zconv, zdh, zdv 552 555 REAL(wp), DIMENSION(:), INTENT(in) :: zhti, zhts, zati ! input ice/snow variables … … 561 564 ! then we check whether the distribution fullfills 562 565 ! volume and area conservation, positivity and ice categories bounds 563 i jpij= SIZE( zhti , 1 )564 zh_i(1:i jpij,1:jpl) = 0._wp565 zh_s(1:i jpij,1:jpl) = 0._wp566 za_i (1:ijpij,1:jpl) = 0._wp567 568 DO ji = 1, i jpij569 566 idim = SIZE( zhti , 1 ) 567 zh_i(1:idim,1:jpl) = 0._wp 568 zh_s(1:idim,1:jpl) = 0._wp 569 za_i(1:idim,1:jpl) = 0._wp 570 ! 571 DO ji = 1, idim 572 ! 570 573 IF( zhti(ji) > 0._wp ) THEN 571 574 ! 572 575 ! find which category (jl0) the input ice thickness falls into 573 576 jl0 = jpl … … 578 581 ENDIF 579 582 END DO 580 583 ! 581 584 itest(:) = 0 582 585 i_fill = jpl + 1 !------------------------------------ … … 586 589 ! 587 590 zh_i(ji,1:jpl) = 0._wp 588 za_i 589 itest(:) 590 591 za_i(ji,1:jpl) = 0._wp 592 itest(:) = 0 593 ! 591 594 IF ( i_fill == 1 ) THEN !-- case very thin ice: fill only category 1 592 595 zh_i(ji,1) = zhti(ji) … … 597 600 zh_i(ji,jl) = hi_mean(jl) 598 601 END DO 599 602 ! 600 603 ! concentration 601 604 za_i(ji,jl0) = zati(ji) / SQRT(REAL(jpl)) … … 606 609 ENDIF 607 610 END DO 608 611 ! 609 612 ! last category 610 613 za_i(ji,i_fill) = zati(ji) - SUM( za_i(ji,1:i_fill-1) ) 611 614 zV = SUM( za_i(ji,1:i_fill-1) * zh_i(ji,1:i_fill-1) ) 612 615 zh_i(ji,i_fill) = ( zhti(ji) * zati(ji) - zV ) / MAX( za_i(ji,i_fill), epsi10 ) 613 616 ! 614 617 ! clem: correction if concentration of upper cat is greater than lower cat 615 618 ! (it should be a gaussian around jl0 but sometimes it is not) … … 622 625 za_i (ji,1:jl-1) = za_i(ji,1:jl-1) + zdv / MAX( REAL(jl-1) * zhti(ji), epsi10 ) 623 626 END IF 624 END DO627 END DO 625 628 ENDIF 626 629 ! 627 630 ENDIF 628 631 ! 629 632 ! Compatibility tests 630 633 zconv = ABS( zati(ji) - SUM( za_i(ji,1:jpl) ) ) 631 IF ( zconv < epsi06 ) itest(1) = 1 ! Test 1: area conservation632 634 IF ( zconv < epsi06 ) itest(1) = 1 ! Test 1: area conservation 635 ! 633 636 zconv = ABS( zhti(ji)*zati(ji) - SUM( za_i(ji,1:jpl)*zh_i(ji,1:jpl) ) ) 634 IF ( zconv < epsi06 ) itest(2) = 1 ! Test 2: volume conservation635 636 IF ( zh_i(ji,i_fill) >= hi_max(i_fill-1) ) itest(3) = 1 ! Test 3: thickness of the last category is in-bounds ?637 637 IF ( zconv < epsi06 ) itest(2) = 1 ! Test 2: volume conservation 638 ! 639 IF ( zh_i(ji,i_fill) >= hi_max(i_fill-1) ) itest(3) = 1 ! Test 3: thickness of the last category is in-bounds ? 640 ! 638 641 itest(4) = 1 639 642 DO jl = 1, i_fill … … 642 645 ! !---------------------------- 643 646 END DO ! end iteration on categories 644 !!----------------------------647 ! !---------------------------- 645 648 ENDIF 646 649 END DO … … 648 651 ! Add Snow in each category where za_i is not 0 649 652 DO jl = 1, jpl 650 DO ji = 1, i jpij653 DO ji = 1, idim 651 654 IF( za_i(ji,jl) > 0._wp ) THEN 652 655 zh_s(ji,jl) = zh_i(ji,jl) * ( zhts(ji) / zhti(ji) ) … … 661 664 END DO 662 665 ! 663 END SUBROUTINE ice_var_itd 664 665 666 SUBROUTINE ice_var_bv 666 END SUBROUTINE ice_var_itd 667 668 669 SUBROUTINE ice_var_itd2( zhti, zhts, zati, zh_i, zh_s, za_i ) 670 !!------------------------------------------------------------------- 671 !! *** ROUTINE ice_var_itd2 *** 672 !! 673 !! ** Purpose : converting N-cat ice to jpl ice categories 674 !! 675 !! ice thickness distribution follows a gaussian law 676 !! around the concentration of the most likely ice thickness 677 !! (similar as iceistate.F90) 678 !! 679 !! ** Method: Iterative procedure 680 !! 681 !! 1) Fill ice cat that correspond to input thicknesses 682 !! Find the lowest(jlmin) and highest(jlmax) cat that are filled 683 !! 684 !! 2) Expand the filling to the cat jlmin-1 and jlmax+1 685 !! by removing 25% ice area from jlmin and jlmax (resp.) 686 !! 687 !! 3) Expand the filling to the empty cat between jlmin and jlmax 688 !! by a) removing 25% ice area from the lower cat (ascendant loop jlmin=>jlmax) 689 !! b) removing 25% ice area from the higher cat (descendant loop jlmax=>jlmin) 690 !! 691 !! ** Arguments : zhti: N-cat ice thickness 692 !! zhts: N-cat snow depth 693 !! zati: N-cat ice concentration 694 !! 695 !! ** Output : jpl-cat 696 !! 697 !! (Example of application: BDY forcings when inputs have N-cat /= jpl) 698 !!------------------------------------------------------------------- 699 INTEGER :: ji, jl, jl1, jl2 ! dummy loop indices 700 INTEGER :: idim, icat 701 INTEGER, PARAMETER :: ztrans = 0.25_wp 702 REAL(wp), DIMENSION(:,:), INTENT(in) :: zhti, zhts, zati ! input ice/snow variables 703 REAL(wp), DIMENSION(:,:), INTENT(inout) :: zh_i, zh_s, za_i ! output ice/snow variables 704 INTEGER , DIMENSION(:,:), ALLOCATABLE :: jlfil, jlfil2 705 INTEGER , DIMENSION(:) , ALLOCATABLE :: jlmax, jlmin 706 !!------------------------------------------------------------------- 707 ! 708 idim = SIZE( zhti, 1 ) 709 icat = SIZE( zhti, 2 ) 710 ! 711 ALLOCATE( jlfil(idim,jpl), jlfil2(idim,jpl) ) ! allocate arrays 712 ALLOCATE( jlmin(idim), jlmax(idim) ) 713 714 ! --- initialize output fields to 0 --- ! 715 zh_i(1:idim,1:jpl) = 0._wp 716 zh_s(1:idim,1:jpl) = 0._wp 717 za_i(1:idim,1:jpl) = 0._wp 718 ! 719 ! --- fill the categories --- ! 720 ! find where cat-input = cat-output and fill cat-output fields 721 jlmax(:) = 0 722 jlmin(:) = 999 723 jlfil(:,:) = 0 724 DO jl1 = 1, jpl 725 DO jl2 = 1, icat 726 DO ji = 1, idim 727 IF( hi_max(jl1-1) <= zhti(ji,jl2) .AND. hi_max(jl1) > zhti(ji,jl2) ) THEN 728 ! fill the right category 729 zh_i(ji,jl1) = zhti(ji,jl2) 730 zh_s(ji,jl1) = zhts(ji,jl2) 731 za_i(ji,jl1) = zati(ji,jl2) 732 ! record categories that are filled 733 jlmax(ji) = MAX( jlmax(ji), jl1 ) 734 jlmin(ji) = MIN( jlmin(ji), jl1 ) 735 jlfil(ji,jl1) = jl1 736 ENDIF 737 END DO 738 END DO 739 END DO 740 ! 741 ! --- fill the gaps between categories --- ! 742 ! transfer from categories filled at the previous step to the empty ones in between 743 DO ji = 1, idim 744 jl1 = jlmin(ji) 745 jl2 = jlmax(ji) 746 IF( jl1 > 1 ) THEN 747 ! fill the lower cat (jl1-1) 748 za_i(ji,jl1-1) = ztrans * za_i(ji,jl1) 749 zh_i(ji,jl1-1) = hi_mean(jl1-1) 750 ! remove from cat jl1 751 za_i(ji,jl1 ) = ( 1._wp - ztrans ) * za_i(ji,jl1) 752 ENDIF 753 IF( jl2 < jpl ) THEN 754 ! fill the upper cat (jl2+1) 755 za_i(ji,jl2+1) = ztrans * za_i(ji,jl2) 756 zh_i(ji,jl2+1) = hi_mean(jl2+1) 757 ! remove from cat jl2 758 za_i(ji,jl2 ) = ( 1._wp - ztrans ) * za_i(ji,jl2) 759 ENDIF 760 END DO 761 ! 762 jlfil2(:,:) = jlfil(:,:) 763 ! fill categories from low to high 764 DO jl = 2, jpl-1 765 DO ji = 1, idim 766 IF( jlfil(ji,jl-1) /= 0 .AND. jlfil(ji,jl) == 0 ) THEN 767 ! fill high 768 za_i(ji,jl) = ztrans * za_i(ji,jl-1) 769 zh_i(ji,jl) = hi_mean(jl) 770 jlfil(ji,jl) = jl 771 ! remove low 772 za_i(ji,jl-1) = ( 1._wp - ztrans ) * za_i(ji,jl-1) 773 ENDIF 774 END DO 775 END DO 776 ! 777 ! fill categories from high to low 778 DO jl = jpl-1, 2, -1 779 DO ji = 1, idim 780 IF( jlfil2(ji,jl+1) /= 0 .AND. jlfil2(ji,jl) == 0 ) THEN 781 ! fill low 782 za_i(ji,jl) = za_i(ji,jl) + ztrans * za_i(ji,jl+1) 783 zh_i(ji,jl) = hi_mean(jl) 784 jlfil2(ji,jl) = jl 785 ! remove high 786 za_i(ji,jl+1) = ( 1._wp - ztrans ) * za_i(ji,jl+1) 787 ENDIF 788 END DO 789 END DO 790 ! 791 DEALLOCATE( jlfil, jlfil2 ) ! deallocate arrays 792 DEALLOCATE( jlmin, jlmax ) 793 ! 794 END SUBROUTINE ice_var_itd2 795 796 797 SUBROUTINE ice_var_bv 667 798 !!------------------------------------------------------------------- 668 799 !! *** ROUTINE ice_var_bv *** -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90
r8586 r8813 51 51 52 52 #if defined key_lim3 53 LOGICAL :: ll_bdylim3 ! determine whether ice input is 1cat (F) or Xcat (T) type54 INTEGER :: jfld_hti, jfld_hts, jfld_ai! indices of ice thickness, snow thickness and concentration in bf structure53 INTEGER :: nice_cat ! number of categories in the input file 54 INTEGER :: jfld_hti, jfld_hts, jfld_ai ! indices of ice thickness, snow thickness and concentration in bf structure 55 55 #endif 56 56 57 57 !!---------------------------------------------------------------------- 58 !! NEMO/OPA 3.3 , NEMO Consortium (2010)58 !! NEMO/OPA 4.0 , NEMO Consortium (2017) 59 59 !! $Id$ 60 60 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 80 80 ! ! etc. 81 81 ! 82 INTEGER :: ib_bdy, jfld, jstart, jend, ib, ii, ij, ik, igrd, jl ! local indices 82 INTEGER :: jbdy, jfld, jstart, jend, ib, jl ! dummy loop indices 83 INTEGER :: ii, ij, ik, igrd ! local integers 83 84 INTEGER, DIMENSION(jpbgrd) :: ilen1 84 85 INTEGER, POINTER, DIMENSION(:) :: nblen, nblenrim ! short cuts … … 95 96 !----------------------------- 96 97 97 DO ib_bdy = 1, nb_bdy98 DO jbdy = 1, nb_bdy 98 99 ! 99 nblen => idx_bdy(ib_bdy)%nblen100 nblenrim => idx_bdy( ib_bdy)%nblenrim101 dta => dta_bdy(ib_bdy)102 103 IF( nn_dyn2d_dta( ib_bdy) == 0 ) THEN100 nblen => idx_bdy(jbdy)%nblen 101 nblenrim => idx_bdy(jbdy)%nblenrim 102 dta => dta_bdy(jbdy) 103 ! 104 IF( nn_dyn2d_dta(jbdy) == 0 ) THEN 104 105 ilen1(:) = nblen(:) 105 106 IF( dta%ll_ssh ) THEN 106 107 igrd = 1 107 108 DO ib = 1, ilen1(igrd) 108 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)109 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)110 dta_bdy( ib_bdy)%ssh(ib) = sshn(ii,ij) * tmask(ii,ij,1)109 ii = idx_bdy(jbdy)%nbi(ib,igrd) 110 ij = idx_bdy(jbdy)%nbj(ib,igrd) 111 dta_bdy(jbdy)%ssh(ib) = sshn(ii,ij) * tmask(ii,ij,1) 111 112 END DO 112 END 113 ENDIF 113 114 IF( dta%ll_u2d ) THEN 114 115 igrd = 2 115 116 DO ib = 1, ilen1(igrd) 116 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)117 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)118 dta_bdy( ib_bdy)%u2d(ib) = un_b(ii,ij) * umask(ii,ij,1)117 ii = idx_bdy(jbdy)%nbi(ib,igrd) 118 ij = idx_bdy(jbdy)%nbj(ib,igrd) 119 dta_bdy(jbdy)%u2d(ib) = un_b(ii,ij) * umask(ii,ij,1) 119 120 END DO 120 END 121 ENDIF 121 122 IF( dta%ll_v2d ) THEN 122 123 igrd = 3 123 124 DO ib = 1, ilen1(igrd) 124 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)125 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)126 dta_bdy( ib_bdy)%v2d(ib) = vn_b(ii,ij) * vmask(ii,ij,1)125 ii = idx_bdy(jbdy)%nbi(ib,igrd) 126 ij = idx_bdy(jbdy)%nbj(ib,igrd) 127 dta_bdy(jbdy)%v2d(ib) = vn_b(ii,ij) * vmask(ii,ij,1) 127 128 END DO 128 END 129 ENDIF 130 131 IF( nn_dyn3d_dta( ib_bdy) == 0 ) THEN129 ENDIF 130 ENDIF 131 ! 132 IF( nn_dyn3d_dta(jbdy) == 0 ) THEN 132 133 ilen1(:) = nblen(:) 133 134 IF( dta%ll_u3d ) THEN … … 135 136 DO ib = 1, ilen1(igrd) 136 137 DO ik = 1, jpkm1 137 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)138 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)139 dta_bdy( ib_bdy)%u3d(ib,ik) = ( un(ii,ij,ik) - un_b(ii,ij) ) * umask(ii,ij,ik)138 ii = idx_bdy(jbdy)%nbi(ib,igrd) 139 ij = idx_bdy(jbdy)%nbj(ib,igrd) 140 dta_bdy(jbdy)%u3d(ib,ik) = ( un(ii,ij,ik) - un_b(ii,ij) ) * umask(ii,ij,ik) 140 141 END DO 141 142 END DO 142 END 143 ENDIF 143 144 IF( dta%ll_v3d ) THEN 144 145 igrd = 3 145 146 DO ib = 1, ilen1(igrd) 146 147 DO ik = 1, jpkm1 147 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)148 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)149 dta_bdy( ib_bdy)%v3d(ib,ik) = ( vn(ii,ij,ik) - vn_b(ii,ij) ) * vmask(ii,ij,ik)148 ii = idx_bdy(jbdy)%nbi(ib,igrd) 149 ij = idx_bdy(jbdy)%nbj(ib,igrd) 150 dta_bdy(jbdy)%v3d(ib,ik) = ( vn(ii,ij,ik) - vn_b(ii,ij) ) * vmask(ii,ij,ik) 150 151 END DO 151 152 END DO 152 END 153 ENDIF 154 155 IF( nn_tra_dta( ib_bdy) == 0 ) THEN153 ENDIF 154 ENDIF 155 156 IF( nn_tra_dta(jbdy) == 0 ) THEN 156 157 ilen1(:) = nblen(:) 157 158 IF( dta%ll_tem ) THEN … … 159 160 DO ib = 1, ilen1(igrd) 160 161 DO ik = 1, jpkm1 161 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)162 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)163 dta_bdy( ib_bdy)%tem(ib,ik) = tsn(ii,ij,ik,jp_tem) * tmask(ii,ij,ik)162 ii = idx_bdy(jbdy)%nbi(ib,igrd) 163 ij = idx_bdy(jbdy)%nbj(ib,igrd) 164 dta_bdy(jbdy)%tem(ib,ik) = tsn(ii,ij,ik,jp_tem) * tmask(ii,ij,ik) 164 165 END DO 165 166 END DO 166 END 167 ENDIF 167 168 IF( dta%ll_sal ) THEN 168 169 igrd = 1 169 170 DO ib = 1, ilen1(igrd) 170 171 DO ik = 1, jpkm1 171 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)172 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)173 dta_bdy( ib_bdy)%sal(ib,ik) = tsn(ii,ij,ik,jp_sal) * tmask(ii,ij,ik)172 ii = idx_bdy(jbdy)%nbi(ib,igrd) 173 ij = idx_bdy(jbdy)%nbj(ib,igrd) 174 dta_bdy(jbdy)%sal(ib,ik) = tsn(ii,ij,ik,jp_sal) * tmask(ii,ij,ik) 174 175 END DO 175 176 END DO 176 END 177 ENDIF 178 179 #if defined key_lim3 180 IF( nn_ice_lim_dta( ib_bdy) == 0 ) THEN177 ENDIF 178 ENDIF 179 180 #if defined key_lim3 181 IF( nn_ice_lim_dta(jbdy) == 0 ) THEN ! set ice to initial values 181 182 ilen1(:) = nblen(:) 182 183 IF( dta%ll_a_i ) THEN … … 184 185 DO jl = 1, jpl 185 186 DO ib = 1, ilen1(igrd) 186 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)187 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)188 dta_bdy( ib_bdy)%a_i (ib,jl) = a_i(ii,ij,jl) * tmask(ii,ij,1)187 ii = idx_bdy(jbdy)%nbi(ib,igrd) 188 ij = idx_bdy(jbdy)%nbj(ib,igrd) 189 dta_bdy(jbdy)%a_i (ib,jl) = a_i(ii,ij,jl) * tmask(ii,ij,1) 189 190 END DO 190 191 END DO … … 194 195 DO jl = 1, jpl 195 196 DO ib = 1, ilen1(igrd) 196 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)197 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)198 dta_bdy( ib_bdy)%h_i (ib,jl) = h_i(ii,ij,jl) * tmask(ii,ij,1)197 ii = idx_bdy(jbdy)%nbi(ib,igrd) 198 ij = idx_bdy(jbdy)%nbj(ib,igrd) 199 dta_bdy(jbdy)%h_i (ib,jl) = h_i(ii,ij,jl) * tmask(ii,ij,1) 199 200 END DO 200 201 END DO … … 204 205 DO jl = 1, jpl 205 206 DO ib = 1, ilen1(igrd) 206 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)207 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)208 dta_bdy( ib_bdy)%h_s (ib,jl) = h_s(ii,ij,jl) * tmask(ii,ij,1)207 ii = idx_bdy(jbdy)%nbi(ib,igrd) 208 ij = idx_bdy(jbdy)%nbj(ib,igrd) 209 dta_bdy(jbdy)%h_s (ib,jl) = h_s(ii,ij,jl) * tmask(ii,ij,1) 209 210 END DO 210 211 END DO … … 212 213 ENDIF 213 214 #endif 214 END DO ! ib_bdy215 END DO ! jbdy 215 216 ! 216 217 ENDIF ! kt == nit000 … … 220 221 221 222 jstart = 1 222 DO ib_bdy = 1, nb_bdy223 dta => dta_bdy( ib_bdy)224 IF( nn_dta( ib_bdy) == 1 ) THEN ! skip this bit if no external data required223 DO jbdy = 1, nb_bdy 224 dta => dta_bdy(jbdy) 225 IF( nn_dta(jbdy) == 1 ) THEN ! skip this bit if no external data required 225 226 226 227 IF( PRESENT(jit) ) THEN 227 228 ! Update barotropic boundary conditions only 228 229 ! jit is optional argument for fld_read and bdytide_update 229 IF( cn_dyn2d( ib_bdy) /= 'none' ) THEN230 IF( nn_dyn2d_dta( ib_bdy) == 2 ) THEN ! tidal harmonic forcing ONLY: initialise arrays230 IF( cn_dyn2d(jbdy) /= 'none' ) THEN 231 IF( nn_dyn2d_dta(jbdy) == 2 ) THEN ! tidal harmonic forcing ONLY: initialise arrays 231 232 IF( dta%ll_ssh ) dta%ssh(:) = 0._wp 232 233 IF( dta%ll_u2d ) dta%u2d(:) = 0._wp 233 234 IF( dta%ll_u3d ) dta%v2d(:) = 0._wp 234 235 ENDIF 235 IF (cn_tra( ib_bdy) /= 'runoff') THEN236 IF( nn_dyn2d_dta( ib_bdy) == 1 .OR. nn_dyn2d_dta(ib_bdy) == 3 ) THEN236 IF (cn_tra(jbdy) /= 'runoff') THEN 237 IF( nn_dyn2d_dta(jbdy) == 1 .OR. nn_dyn2d_dta(jbdy) == 3 ) THEN 237 238 238 239 jend = jstart + dta%nread(2) - 1 239 IF( ln_full_vel_array( ib_bdy) ) THEN240 IF( ln_full_vel_array(jbdy) ) THEN 240 241 CALL fld_read( kt=kt, kn_fsbc=1, sd=bf(jstart:jend), map=nbmap_ptr(jstart:jend), & 241 & kit=jit, kt_offset=time_offset , jpk_bdy=nb_jpk_bdy, fvl=ln_full_vel_array( ib_bdy) )242 & kit=jit, kt_offset=time_offset , jpk_bdy=nb_jpk_bdy, fvl=ln_full_vel_array(jbdy) ) 242 243 ELSE 243 244 CALL fld_read( kt=kt, kn_fsbc=1, sd=bf(jstart:jend), map=nbmap_ptr(jstart:jend), & … … 246 247 247 248 ! If full velocities in boundary data then extract barotropic velocities from 3D fields 248 IF( ln_full_vel_array( ib_bdy) .AND. &249 & ( nn_dyn2d_dta( ib_bdy) == 1 .OR. nn_dyn2d_dta(ib_bdy) == 3 .OR. &250 & nn_dyn3d_dta( ib_bdy) == 1 ) )THEN249 IF( ln_full_vel_array(jbdy) .AND. & 250 & ( nn_dyn2d_dta(jbdy) == 1 .OR. nn_dyn2d_dta(jbdy) == 3 .OR. & 251 & nn_dyn3d_dta(jbdy) == 1 ) )THEN 251 252 252 253 igrd = 2 ! zonal velocity 253 254 dta%u2d(:) = 0._wp 254 DO ib = 1, idx_bdy( ib_bdy)%nblen(igrd)255 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)256 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)255 DO ib = 1, idx_bdy(jbdy)%nblen(igrd) 256 ii = idx_bdy(jbdy)%nbi(ib,igrd) 257 ij = idx_bdy(jbdy)%nbj(ib,igrd) 257 258 DO ik = 1, jpkm1 258 259 dta%u2d(ib) = dta%u2d(ib) & … … 263 264 igrd = 3 ! meridional velocity 264 265 dta%v2d(:) = 0._wp 265 DO ib = 1, idx_bdy( ib_bdy)%nblen(igrd)266 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)267 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)266 DO ib = 1, idx_bdy(jbdy)%nblen(igrd) 267 ii = idx_bdy(jbdy)%nbi(ib,igrd) 268 ij = idx_bdy(jbdy)%nbj(ib,igrd) 268 269 DO ik = 1, jpkm1 269 270 dta%v2d(ib) = dta%v2d(ib) & … … 274 275 ENDIF 275 276 ENDIF 276 IF( nn_dyn2d_dta( ib_bdy) .ge. 2 ) THEN ! update tidal harmonic forcing277 CALL bdytide_update( kt=kt, idx=idx_bdy( ib_bdy), dta=dta, td=tides(ib_bdy), &277 IF( nn_dyn2d_dta(jbdy) .ge. 2 ) THEN ! update tidal harmonic forcing 278 CALL bdytide_update( kt=kt, idx=idx_bdy(jbdy), dta=dta, td=tides(jbdy), & 278 279 & jit=jit, time_offset=time_offset ) 279 280 ENDIF … … 281 282 ENDIF 282 283 ELSE 283 IF (cn_tra( ib_bdy) == 'runoff') then ! runoff condition284 jend = nb_bdy_fld( ib_bdy)284 IF (cn_tra(jbdy) == 'runoff') then ! runoff condition 285 jend = nb_bdy_fld(jbdy) 285 286 CALL fld_read( kt=kt, kn_fsbc=1, sd=bf(jstart:jend), & 286 287 & map=nbmap_ptr(jstart:jend), kt_offset=time_offset ) 287 288 ! 288 289 igrd = 2 ! zonal velocity 289 DO ib = 1, idx_bdy( ib_bdy)%nblen(igrd)290 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)291 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)290 DO ib = 1, idx_bdy(jbdy)%nblen(igrd) 291 ii = idx_bdy(jbdy)%nbi(ib,igrd) 292 ij = idx_bdy(jbdy)%nbj(ib,igrd) 292 293 dta%u2d(ib) = dta%u2d(ib) / ( e2u(ii,ij) * hu_0(ii,ij) ) 293 294 END DO 294 295 ! 295 296 igrd = 3 ! meridional velocity 296 DO ib = 1, idx_bdy( ib_bdy)%nblen(igrd)297 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)298 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)297 DO ib = 1, idx_bdy(jbdy)%nblen(igrd) 298 ii = idx_bdy(jbdy)%nbi(ib,igrd) 299 ij = idx_bdy(jbdy)%nbj(ib,igrd) 299 300 dta%v2d(ib) = dta%v2d(ib) / ( e1v(ii,ij) * hv_0(ii,ij) ) 300 301 END DO 301 302 ELSE 302 IF( nn_dyn2d_dta( ib_bdy) == 2 ) THEN ! tidal harmonic forcing ONLY: initialise arrays303 IF( nn_dyn2d_dta(jbdy) == 2 ) THEN ! tidal harmonic forcing ONLY: initialise arrays 303 304 IF( dta%ll_ssh ) dta%ssh(:) = 0._wp 304 305 IF( dta%ll_u2d ) dta%u2d(:) = 0._wp … … 308 309 jend = jstart + dta%nread(1) - 1 309 310 CALL fld_read( kt=kt, kn_fsbc=1, sd=bf(jstart:jend), & 310 & map=nbmap_ptr(jstart:jend), kt_offset=time_offset, jpk_bdy=nb_jpk_bdy, fvl=ln_full_vel_array( ib_bdy) )311 & map=nbmap_ptr(jstart:jend), kt_offset=time_offset, jpk_bdy=nb_jpk_bdy, fvl=ln_full_vel_array(jbdy) ) 311 312 ENDIF 312 313 ! If full velocities in boundary data then split into barotropic and baroclinic data 313 IF( ln_full_vel_array( ib_bdy) .and. &314 & ( nn_dyn2d_dta( ib_bdy) == 1 .OR. nn_dyn2d_dta(ib_bdy) == 3 .OR. &315 & nn_dyn3d_dta( ib_bdy) == 1 ) ) THEN314 IF( ln_full_vel_array(jbdy) .and. & 315 & ( nn_dyn2d_dta(jbdy) == 1 .OR. nn_dyn2d_dta(jbdy) == 3 .OR. & 316 & nn_dyn3d_dta(jbdy) == 1 ) ) THEN 316 317 igrd = 2 ! zonal velocity 317 318 dta%u2d(:) = 0._wp 318 DO ib = 1, idx_bdy( ib_bdy)%nblen(igrd)319 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)320 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)319 DO ib = 1, idx_bdy(jbdy)%nblen(igrd) 320 ii = idx_bdy(jbdy)%nbi(ib,igrd) 321 ij = idx_bdy(jbdy)%nbj(ib,igrd) 321 322 DO ik = 1, jpkm1 322 323 dta%u2d(ib) = dta%u2d(ib) & … … 330 331 igrd = 3 ! meridional velocity 331 332 dta%v2d(:) = 0._wp 332 DO ib = 1, idx_bdy( ib_bdy)%nblen(igrd)333 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)334 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)333 DO ib = 1, idx_bdy(jbdy)%nblen(igrd) 334 ii = idx_bdy(jbdy)%nbi(ib,igrd) 335 ij = idx_bdy(jbdy)%nbj(ib,igrd) 335 336 DO ik = 1, jpkm1 336 337 dta%v2d(ib) = dta%v2d(ib) & … … 346 347 ENDIF 347 348 #if defined key_lim3 348 IF( .NOT. ll_bdylim3 .AND. cn_ice_lim(ib_bdy) /= 'none' .AND. nn_ice_lim_dta(ib_bdy) == 1 ) THEN ! bdy ice input (case input is 1cat) 349 CALL ice_var_itd ( bf(jfld_hti)%fnow(:,1,1), bf(jfld_hts)%fnow(:,1,1), bf(jfld_ai)%fnow(:,1,1), & 350 & dta_bdy(ib_bdy)%h_i, dta_bdy(ib_bdy)%h_s, dta_bdy(ib_bdy)%a_i ) 349 IF( cn_ice_lim(jbdy) /= 'none' .AND. nn_ice_lim_dta(jbdy) == 1 ) THEN 350 IF( nice_cat == 1 ) THEN ! case input cat = 1 351 CALL ice_var_itd ( bf(jfld_hti)%fnow(:,1,1), bf(jfld_hts)%fnow(:,1,1), bf(jfld_ai)%fnow(:,1,1), & 352 & dta_bdy(jbdy)%h_i , dta_bdy(jbdy)%h_s , dta_bdy(jbdy)%a_i ) 353 ELSEIF( nice_cat /= 1 .AND. nice_cat /= jpl ) THEN ! case input cat /=1 and /=jpl 354 CALL ice_var_itd2( bf(jfld_hti)%fnow(:,1,:), bf(jfld_hts)%fnow(:,1,:), bf(jfld_ai)%fnow(:,1,:), & 355 & dta_bdy(jbdy)%h_i , dta_bdy(jbdy)%h_s , dta_bdy(jbdy)%a_i ) 356 ENDIF 351 357 ENDIF 352 358 #endif 353 359 ENDIF 354 360 jstart = jstart + dta%nread(1) 355 END IF ! nn_dta(ib_bdy) = 1356 END DO ! ib_bdy361 ENDIF ! nn_dta(jbdy) = 1 362 END DO ! jbdy 357 363 358 364 IF ( ln_tide ) THEN 359 365 IF (ln_dynspg_ts) THEN ! Fill temporary arrays with slow-varying bdy data 360 DO ib_bdy = 1, nb_bdy ! Tidal component added in ts loop361 IF ( nn_dyn2d_dta( ib_bdy) .ge. 2 ) THEN362 nblen => idx_bdy( ib_bdy)%nblen363 nblenrim => idx_bdy( ib_bdy)%nblenrim364 IF( cn_dyn2d( ib_bdy) == 'frs' ) THEN; ilen1(:)=nblen(:) ; ELSE ; ilen1(:)=nblenrim(:) ; ENDIF365 IF ( dta_bdy( ib_bdy)%ll_ssh ) dta_bdy_s(ib_bdy)%ssh(1:ilen1(1)) = dta_bdy(ib_bdy)%ssh(1:ilen1(1))366 IF ( dta_bdy( ib_bdy)%ll_u2d ) dta_bdy_s(ib_bdy)%u2d(1:ilen1(2)) = dta_bdy(ib_bdy)%u2d(1:ilen1(2))367 IF ( dta_bdy( ib_bdy)%ll_v2d ) dta_bdy_s(ib_bdy)%v2d(1:ilen1(3)) = dta_bdy(ib_bdy)%v2d(1:ilen1(3))366 DO jbdy = 1, nb_bdy ! Tidal component added in ts loop 367 IF ( nn_dyn2d_dta(jbdy) .ge. 2 ) THEN 368 nblen => idx_bdy(jbdy)%nblen 369 nblenrim => idx_bdy(jbdy)%nblenrim 370 IF( cn_dyn2d(jbdy) == 'frs' ) THEN; ilen1(:)=nblen(:) ; ELSE ; ilen1(:)=nblenrim(:) ; ENDIF 371 IF ( dta_bdy(jbdy)%ll_ssh ) dta_bdy_s(jbdy)%ssh(1:ilen1(1)) = dta_bdy(jbdy)%ssh(1:ilen1(1)) 372 IF ( dta_bdy(jbdy)%ll_u2d ) dta_bdy_s(jbdy)%u2d(1:ilen1(2)) = dta_bdy(jbdy)%u2d(1:ilen1(2)) 373 IF ( dta_bdy(jbdy)%ll_v2d ) dta_bdy_s(jbdy)%v2d(1:ilen1(3)) = dta_bdy(jbdy)%v2d(1:ilen1(3)) 368 374 ENDIF 369 375 END DO … … 375 381 376 382 IF ( ln_apr_obc ) THEN 377 DO ib_bdy = 1, nb_bdy378 IF (cn_tra( ib_bdy) /= 'runoff')THEN383 DO jbdy = 1, nb_bdy 384 IF (cn_tra(jbdy) /= 'runoff')THEN 379 385 igrd = 1 ! meridional velocity 380 DO ib = 1, idx_bdy( ib_bdy)%nblenrim(igrd)381 ii = idx_bdy( ib_bdy)%nbi(ib,igrd)382 ij = idx_bdy( ib_bdy)%nbj(ib,igrd)383 dta_bdy( ib_bdy)%ssh(ib) = dta_bdy(ib_bdy)%ssh(ib) + ssh_ib(ii,ij)386 DO ib = 1, idx_bdy(jbdy)%nblenrim(igrd) 387 ii = idx_bdy(jbdy)%nbi(ib,igrd) 388 ij = idx_bdy(jbdy)%nbj(ib,igrd) 389 dta_bdy(jbdy)%ssh(ib) = dta_bdy(jbdy)%ssh(ib) + ssh_ib(ii,ij) 384 390 END DO 385 391 ENDIF … … 402 408 !! 403 409 !!---------------------------------------------------------------------- 404 INTEGER :: ib_bdy, jfld, jstart, jend, ierror, ios ! Local integers410 INTEGER :: jbdy, jfld, jstart, jend, ierror, ios ! Local integers 405 411 ! 406 412 CHARACTER(len=100) :: cn_dir ! Root directory for location of data files … … 408 414 CHARACTER(len = 256):: clname ! temporary file name 409 415 LOGICAL :: ln_full_vel ! =T => full velocities in 3D boundary data 410 416 ! ! =F => baroclinic velocities in 3D boundary data 411 417 INTEGER :: ilen_global ! Max length required for global bdy dta arrays 412 418 INTEGER, ALLOCATABLE, DIMENSION(:) :: ilen1, ilen3 ! size of 1st and 3rd dimensions of local arrays … … 416 422 TYPE(OBC_DATA), POINTER :: dta ! short cut 417 423 #if defined key_lim3 418 INTEGER :: zndims ! number of dimensions in an array (i.e. 3 = wo ice cat; 4 = w ice cat) 424 INTEGER :: kndims ! number of dimensions in an array (i.e. 3 = wo ice cat; 4 = w ice cat) 425 INTEGER, DIMENSION(4) :: kdimsz ! size of dimensions 419 426 INTEGER :: inum,id1 ! local integer 420 427 #endif … … 440 447 441 448 ! Set nn_dta 442 DO ib_bdy = 1, nb_bdy443 nn_dta( ib_bdy) = MAX( nn_dyn2d_dta(ib_bdy)&444 ,nn_dyn3d_dta(ib_bdy)&445 ,nn_tra_dta(ib_bdy)&446 #if defined key_lim3 447 ,nn_ice_lim_dta(ib_bdy) &449 DO jbdy = 1, nb_bdy 450 nn_dta(jbdy) = MAX( nn_dyn2d_dta (jbdy) & 451 & , nn_dyn3d_dta (jbdy) & 452 & , nn_tra_dta (jbdy) & 453 #if defined key_lim3 454 & , nn_ice_lim_dta(jbdy) & 448 455 #endif 449 456 ) 450 IF(nn_dta( ib_bdy) > 1) nn_dta(ib_bdy) = 1457 IF(nn_dta(jbdy) > 1) nn_dta(jbdy) = 1 451 458 END DO 452 459 … … 455 462 ALLOCATE( nb_bdy_fld(nb_bdy) ) 456 463 nb_bdy_fld(:) = 0 457 DO ib_bdy = 1, nb_bdy458 IF( cn_dyn2d( ib_bdy) /= 'none' .and. ( nn_dyn2d_dta(ib_bdy) == 1 .or. nn_dyn2d_dta(ib_bdy) == 3 ) ) THEN459 nb_bdy_fld( ib_bdy) = nb_bdy_fld(ib_bdy) + 3460 ENDIF 461 IF( cn_dyn3d( ib_bdy) /= 'none' .and. nn_dyn3d_dta(ib_bdy) == 1 ) THEN462 nb_bdy_fld( ib_bdy) = nb_bdy_fld(ib_bdy) + 2463 ENDIF 464 IF( cn_tra( ib_bdy) /= 'none' .and. nn_tra_dta(ib_bdy) == 1 ) THEN465 nb_bdy_fld( ib_bdy) = nb_bdy_fld(ib_bdy) + 2466 ENDIF 467 #if defined key_lim3 468 IF( cn_ice_lim( ib_bdy) /= 'none' .and. nn_ice_lim_dta(ib_bdy) == 1 ) THEN469 nb_bdy_fld( ib_bdy) = nb_bdy_fld(ib_bdy) + 3464 DO jbdy = 1, nb_bdy 465 IF( cn_dyn2d(jbdy) /= 'none' .AND. ( nn_dyn2d_dta(jbdy) == 1 .or. nn_dyn2d_dta(jbdy) == 3 ) ) THEN 466 nb_bdy_fld(jbdy) = nb_bdy_fld(jbdy) + 3 467 ENDIF 468 IF( cn_dyn3d(jbdy) /= 'none' .AND. nn_dyn3d_dta(jbdy) == 1 ) THEN 469 nb_bdy_fld(jbdy) = nb_bdy_fld(jbdy) + 2 470 ENDIF 471 IF( cn_tra(jbdy) /= 'none' .AND. nn_tra_dta(jbdy) == 1 ) THEN 472 nb_bdy_fld(jbdy) = nb_bdy_fld(jbdy) + 2 473 ENDIF 474 #if defined key_lim3 475 IF( cn_ice_lim(jbdy) /= 'none' .AND. nn_ice_lim_dta(jbdy) == 1 ) THEN 476 nb_bdy_fld(jbdy) = nb_bdy_fld(jbdy) + 3 470 477 ENDIF 471 478 #endif 472 IF(lwp) WRITE(numout,*) 'Maximum number of files to open =', nb_bdy_fld(ib_bdy)479 IF(lwp) WRITE(numout,*) 'Maximum number of files to open =', nb_bdy_fld(jbdy) 473 480 END DO 474 481 … … 496 503 REWIND(numnam_cfg) 497 504 jfld = 0 498 DO ib_bdy = 1, nb_bdy499 IF( nn_dta( ib_bdy) == 1 ) THEN505 DO jbdy = 1, nb_bdy 506 IF( nn_dta(jbdy) == 1 ) THEN 500 507 READ ( numnam_ref, nambdy_dta, IOSTAT = ios, ERR = 901) 501 508 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy_dta in reference namelist', lwp ) … … 505 512 IF(lwm) WRITE( numond, nambdy_dta ) 506 513 507 cn_dir_array( ib_bdy) = cn_dir508 ln_full_vel_array( ib_bdy) = ln_full_vel509 510 nblen => idx_bdy( ib_bdy)%nblen511 nblenrim => idx_bdy( ib_bdy)%nblenrim512 dta => dta_bdy( ib_bdy)514 cn_dir_array(jbdy) = cn_dir 515 ln_full_vel_array(jbdy) = ln_full_vel 516 517 nblen => idx_bdy(jbdy)%nblen 518 nblenrim => idx_bdy(jbdy)%nblenrim 519 dta => dta_bdy(jbdy) 513 520 dta%nread(2) = 0 514 521 515 522 ! Only read in necessary fields for this set. 516 523 ! Important that barotropic variables come first. 517 IF( nn_dyn2d_dta( ib_bdy) == 1 .or. nn_dyn2d_dta(ib_bdy) == 3 ) THEN524 IF( nn_dyn2d_dta(jbdy) == 1 .or. nn_dyn2d_dta(jbdy) == 3 ) THEN 518 525 519 526 IF( dta%ll_ssh ) THEN … … 521 528 jfld = jfld + 1 522 529 blf_i(jfld) = bn_ssh 523 ibdy(jfld) = ib_bdy530 ibdy(jfld) = jbdy 524 531 igrid(jfld) = 1 525 532 ilen1(jfld) = nblen(igrid(jfld)) … … 528 535 ENDIF 529 536 530 IF( dta%ll_u2d .and. .not. ln_full_vel_array( ib_bdy) ) THEN537 IF( dta%ll_u2d .and. .not. ln_full_vel_array(jbdy) ) THEN 531 538 if(lwp) write(numout,*) '++++++ reading in u2d field' 532 539 jfld = jfld + 1 533 540 blf_i(jfld) = bn_u2d 534 ibdy(jfld) = ib_bdy541 ibdy(jfld) = jbdy 535 542 igrid(jfld) = 2 536 543 ilen1(jfld) = nblen(igrid(jfld)) … … 539 546 ENDIF 540 547 541 IF( dta%ll_v2d .and. .not. ln_full_vel_array( ib_bdy) ) THEN548 IF( dta%ll_v2d .and. .not. ln_full_vel_array(jbdy) ) THEN 542 549 if(lwp) write(numout,*) '++++++ reading in v2d field' 543 550 jfld = jfld + 1 544 551 blf_i(jfld) = bn_v2d 545 ibdy(jfld) = ib_bdy552 ibdy(jfld) = jbdy 546 553 igrid(jfld) = 3 547 554 ilen1(jfld) = nblen(igrid(jfld)) … … 554 561 ! read 3D velocities if baroclinic velocities require OR if 555 562 ! barotropic velocities required and ln_full_vel set to .true. 556 IF( nn_dyn3d_dta( ib_bdy) == 1 .OR. &557 & ( ln_full_vel_array( ib_bdy) .AND. ( nn_dyn2d_dta(ib_bdy) == 1 .or. nn_dyn2d_dta(ib_bdy) == 3 ) ) ) THEN558 559 IF( dta%ll_u3d .OR. ( ln_full_vel_array( ib_bdy) .and. dta%ll_u2d ) ) THEN563 IF( nn_dyn3d_dta(jbdy) == 1 .OR. & 564 & ( ln_full_vel_array(jbdy) .AND. ( nn_dyn2d_dta(jbdy) == 1 .OR. nn_dyn2d_dta(jbdy) == 3 ) ) ) THEN 565 566 IF( dta%ll_u3d .OR. ( ln_full_vel_array(jbdy) .and. dta%ll_u2d ) ) THEN 560 567 if(lwp) write(numout,*) '++++++ reading in u3d field' 561 568 jfld = jfld + 1 562 569 blf_i(jfld) = bn_u3d 563 ibdy(jfld) = ib_bdy570 ibdy(jfld) = jbdy 564 571 igrid(jfld) = 2 565 572 ilen1(jfld) = nblen(igrid(jfld)) 566 573 ilen3(jfld) = jpk 567 IF( ln_full_vel_array( ib_bdy) .and. dta%ll_u2d ) dta%nread(2) = dta%nread(2) + 1568 ENDIF 569 570 IF( dta%ll_v3d .OR. ( ln_full_vel_array( ib_bdy) .and. dta%ll_v2d ) ) THEN574 IF( ln_full_vel_array(jbdy) .and. dta%ll_u2d ) dta%nread(2) = dta%nread(2) + 1 575 ENDIF 576 577 IF( dta%ll_v3d .OR. ( ln_full_vel_array(jbdy) .and. dta%ll_v2d ) ) THEN 571 578 if(lwp) write(numout,*) '++++++ reading in v3d field' 572 579 jfld = jfld + 1 573 580 blf_i(jfld) = bn_v3d 574 ibdy(jfld) = ib_bdy581 ibdy(jfld) = jbdy 575 582 igrid(jfld) = 3 576 583 ilen1(jfld) = nblen(igrid(jfld)) 577 584 ilen3(jfld) = jpk 578 IF( ln_full_vel_array( ib_bdy) .and. dta%ll_v2d ) dta%nread(2) = dta%nread(2) + 1585 IF( ln_full_vel_array(jbdy) .and. dta%ll_v2d ) dta%nread(2) = dta%nread(2) + 1 579 586 ENDIF 580 587 … … 582 589 583 590 ! temperature and salinity 584 IF( nn_tra_dta( ib_bdy) == 1 ) THEN591 IF( nn_tra_dta(jbdy) == 1 ) THEN 585 592 586 593 IF( dta%ll_tem ) THEN … … 588 595 jfld = jfld + 1 589 596 blf_i(jfld) = bn_tem 590 ibdy(jfld) = ib_bdy597 ibdy(jfld) = jbdy 591 598 igrid(jfld) = 1 592 599 ilen1(jfld) = nblen(igrid(jfld)) … … 598 605 jfld = jfld + 1 599 606 blf_i(jfld) = bn_sal 600 ibdy(jfld) = ib_bdy607 ibdy(jfld) = jbdy 601 608 igrid(jfld) = 1 602 609 ilen1(jfld) = nblen(igrid(jfld)) … … 608 615 #if defined key_lim3 609 616 ! sea ice 610 IF( nn_ice_lim_dta( ib_bdy) == 1 ) THEN617 IF( nn_ice_lim_dta(jbdy) == 1 ) THEN 611 618 ! Test for types of ice input (1cat or Xcat) 612 619 ! Build file name to find dimensions … … 622 629 ! 623 630 CALL iom_open ( clname, inum ) 624 id1 = iom_varid( inum, bn_a_i%clvar, k ndims=zndims, ldstop = .FALSE. )631 id1 = iom_varid( inum, bn_a_i%clvar, kdimsz=kdimsz, kndims=kndims, ldstop = .FALSE. ) 625 632 CALL iom_close ( inum ) 626 633 627 IF ( zndims == 4 ) THEN628 ll_bdylim3 = .TRUE.! Xcat input634 IF ( kndims == 4 ) THEN 635 nice_cat = kdimsz(4) ! Xcat input 629 636 ELSE 630 ll_bdylim3 = .FALSE.! 1cat input637 nice_cat = 1 ! 1cat input 631 638 ENDIF 632 639 ! End test … … 635 642 jfld = jfld + 1 636 643 blf_i(jfld) = bn_a_i 637 ibdy(jfld) = ib_bdy644 ibdy(jfld) = jbdy 638 645 igrid(jfld) = 1 639 646 ilen1(jfld) = nblen(igrid(jfld)) 640 IF ( ll_bdylim3 ) THEN ; ilen3(jfld)=jpl ; ELSE ; ilen3(jfld)=1 ; ENDIF647 ilen3(jfld) = nice_cat 641 648 ENDIF 642 649 … … 644 651 jfld = jfld + 1 645 652 blf_i(jfld) = bn_h_i 646 ibdy(jfld) = ib_bdy653 ibdy(jfld) = jbdy 647 654 igrid(jfld) = 1 648 655 ilen1(jfld) = nblen(igrid(jfld)) 649 IF ( ll_bdylim3 ) THEN ; ilen3(jfld)=jpl ; ELSE ; ilen3(jfld)=1 ; ENDIF656 ilen3(jfld) = nice_cat 650 657 ENDIF 651 658 652 659 IF( dta%ll_h_s ) THEN 653 660 jfld = jfld + 1 654 655 ibdy(jfld) = ib_bdy661 blf_i(jfld) = bn_h_s 662 ibdy(jfld) = jbdy 656 663 igrid(jfld) = 1 657 664 ilen1(jfld) = nblen(igrid(jfld)) 658 IF ( ll_bdylim3 ) THEN ; ilen3(jfld)=jpl ; ELSE ; ilen3(jfld)=1 ; ENDIF665 ilen3(jfld) = nice_cat 659 666 ENDIF 660 667 … … 663 670 ! Recalculate field counts 664 671 !------------------------- 665 IF( ib_bdy == 1 ) THEN672 IF( jbdy == 1 ) THEN 666 673 nb_bdy_fld_sum = 0 667 nb_bdy_fld( ib_bdy) = jfld674 nb_bdy_fld(jbdy) = jfld 668 675 nb_bdy_fld_sum = jfld 669 676 ELSE 670 nb_bdy_fld( ib_bdy) = jfld - nb_bdy_fld_sum671 nb_bdy_fld_sum = nb_bdy_fld_sum + nb_bdy_fld( ib_bdy)672 ENDIF 673 674 dta%nread(1) = nb_bdy_fld( ib_bdy)677 nb_bdy_fld(jbdy) = jfld - nb_bdy_fld_sum 678 nb_bdy_fld_sum = nb_bdy_fld_sum + nb_bdy_fld(jbdy) 679 ENDIF 680 681 dta%nread(1) = nb_bdy_fld(jbdy) 675 682 676 683 ENDIF ! nn_dta == 1 677 ENDDO ! ib_bdy684 ENDDO ! jbdy 678 685 679 686 DO jfld = 1, nb_bdy_fld_sum … … 687 694 !------------------------------------- 688 695 jstart = 1 689 DO ib_bdy = 1, nb_bdy690 jend = jstart - 1 + nb_bdy_fld( ib_bdy)691 CALL fld_fill( bf(jstart:jend), blf_i(jstart:jend), cn_dir_array( ib_bdy), 'bdy_dta', &696 DO jbdy = 1, nb_bdy 697 jend = jstart - 1 + nb_bdy_fld(jbdy) 698 CALL fld_fill( bf(jstart:jend), blf_i(jstart:jend), cn_dir_array(jbdy), 'bdy_dta', & 692 699 & 'open boundary conditions', 'nambdy_dta' ) 693 700 jstart = jend + 1 … … 700 707 701 708 jfld = 0 702 DO ib_bdy=1, nb_bdy703 704 nblen => idx_bdy( ib_bdy)%nblen705 dta => dta_bdy( ib_bdy)709 DO jbdy=1, nb_bdy 710 711 nblen => idx_bdy(jbdy)%nblen 712 dta => dta_bdy(jbdy) 706 713 707 714 if(lwp) then … … 715 722 endif 716 723 717 IF ( nn_dyn2d_dta( ib_bdy) == 0 .or. nn_dyn2d_dta(ib_bdy) == 2 ) THEN724 IF ( nn_dyn2d_dta(jbdy) == 0 .or. nn_dyn2d_dta(jbdy) == 2 ) THEN 718 725 if(lwp) write(numout,*) '++++++ dta%ssh/u2d/u3d allocated space' 719 726 IF( dta%ll_ssh ) ALLOCATE( dta%ssh(nblen(1)) ) … … 721 728 IF( dta%ll_v2d ) ALLOCATE( dta%v2d(nblen(3)) ) 722 729 ENDIF 723 IF ( nn_dyn2d_dta( ib_bdy) == 1 .or. nn_dyn2d_dta(ib_bdy) == 3 ) THEN730 IF ( nn_dyn2d_dta(jbdy) == 1 .or. nn_dyn2d_dta(jbdy) == 3 ) THEN 724 731 IF( dta%ll_ssh ) THEN 725 732 if(lwp) write(numout,*) '++++++ dta%ssh pointing to fnow' … … 728 735 ENDIF 729 736 IF ( dta%ll_u2d ) THEN 730 IF ( ln_full_vel_array( ib_bdy) ) THEN737 IF ( ln_full_vel_array(jbdy) ) THEN 731 738 if(lwp) write(numout,*) '++++++ dta%u2d allocated space' 732 739 ALLOCATE( dta%u2d(nblen(2)) ) … … 738 745 ENDIF 739 746 IF ( dta%ll_v2d ) THEN 740 IF ( ln_full_vel_array( ib_bdy) ) THEN747 IF ( ln_full_vel_array(jbdy) ) THEN 741 748 if(lwp) write(numout,*) '++++++ dta%v2d allocated space' 742 749 ALLOCATE( dta%v2d(nblen(3)) ) … … 749 756 ENDIF 750 757 751 IF ( nn_dyn3d_dta( ib_bdy) == 0 ) THEN758 IF ( nn_dyn3d_dta(jbdy) == 0 ) THEN 752 759 if(lwp) write(numout,*) '++++++ dta%u3d/v3d allocated space' 753 IF( dta%ll_u3d ) ALLOCATE( dta_bdy( ib_bdy)%u3d(nblen(2),jpk) )754 IF( dta%ll_v3d ) ALLOCATE( dta_bdy( ib_bdy)%v3d(nblen(3),jpk) )755 ENDIF 756 IF ( nn_dyn3d_dta( ib_bdy) == 1 .or. &757 & ( ln_full_vel_array( ib_bdy) .and. ( nn_dyn2d_dta(ib_bdy) == 1 .or. nn_dyn2d_dta(ib_bdy) == 3 ) ) ) THEN758 IF ( dta%ll_u3d .or. ( ln_full_vel_array( ib_bdy) .and. dta%ll_u2d ) ) THEN760 IF( dta%ll_u3d ) ALLOCATE( dta_bdy(jbdy)%u3d(nblen(2),jpk) ) 761 IF( dta%ll_v3d ) ALLOCATE( dta_bdy(jbdy)%v3d(nblen(3),jpk) ) 762 ENDIF 763 IF ( nn_dyn3d_dta(jbdy) == 1 .or. & 764 & ( ln_full_vel_array(jbdy) .and. ( nn_dyn2d_dta(jbdy) == 1 .or. nn_dyn2d_dta(jbdy) == 3 ) ) ) THEN 765 IF ( dta%ll_u3d .or. ( ln_full_vel_array(jbdy) .and. dta%ll_u2d ) ) THEN 759 766 if(lwp) write(numout,*) '++++++ dta%u3d pointing to fnow' 760 767 jfld = jfld + 1 761 dta_bdy( ib_bdy)%u3d => bf(jfld)%fnow(:,1,:)762 ENDIF 763 IF ( dta%ll_v3d .or. ( ln_full_vel_array( ib_bdy) .and. dta%ll_v2d ) ) THEN768 dta_bdy(jbdy)%u3d => bf(jfld)%fnow(:,1,:) 769 ENDIF 770 IF ( dta%ll_v3d .or. ( ln_full_vel_array(jbdy) .and. dta%ll_v2d ) ) THEN 764 771 if(lwp) write(numout,*) '++++++ dta%v3d pointing to fnow' 765 772 jfld = jfld + 1 766 dta_bdy( ib_bdy)%v3d => bf(jfld)%fnow(:,1,:)767 ENDIF 768 ENDIF 769 770 IF( nn_tra_dta( ib_bdy) == 0 ) THEN773 dta_bdy(jbdy)%v3d => bf(jfld)%fnow(:,1,:) 774 ENDIF 775 ENDIF 776 777 IF( nn_tra_dta(jbdy) == 0 ) THEN 771 778 if(lwp) write(numout,*) '++++++ dta%tem/sal allocated space' 772 IF( dta%ll_tem ) ALLOCATE( dta_bdy( ib_bdy)%tem(nblen(1),jpk) )773 IF( dta%ll_sal ) ALLOCATE( dta_bdy( ib_bdy)%sal(nblen(1),jpk) )779 IF( dta%ll_tem ) ALLOCATE( dta_bdy(jbdy)%tem(nblen(1),jpk) ) 780 IF( dta%ll_sal ) ALLOCATE( dta_bdy(jbdy)%sal(nblen(1),jpk) ) 774 781 ELSE 775 782 IF( dta%ll_tem ) THEN 776 783 if(lwp) write(numout,*) '++++++ dta%tem pointing to fnow' 777 784 jfld = jfld + 1 778 dta_bdy( ib_bdy)%tem => bf(jfld)%fnow(:,1,:)785 dta_bdy(jbdy)%tem => bf(jfld)%fnow(:,1,:) 779 786 ENDIF 780 787 IF( dta%ll_sal ) THEN 781 788 if(lwp) write(numout,*) '++++++ dta%sal pointing to fnow' 782 789 jfld = jfld + 1 783 dta_bdy( ib_bdy)%sal => bf(jfld)%fnow(:,1,:)784 ENDIF 785 ENDIF 786 787 #if defined key_lim3 788 IF (cn_ice_lim( ib_bdy) /= 'none') THEN789 IF( nn_ice_lim_dta( ib_bdy) == 0 ) THEN790 ALLOCATE( dta_bdy( ib_bdy)%a_i(nblen(1),jpl) )791 ALLOCATE( dta_bdy( ib_bdy)%h_i(nblen(1),jpl) )792 ALLOCATE( dta_bdy( ib_bdy)%h_s(nblen(1),jpl) )790 dta_bdy(jbdy)%sal => bf(jfld)%fnow(:,1,:) 791 ENDIF 792 ENDIF 793 794 #if defined key_lim3 795 IF (cn_ice_lim(jbdy) /= 'none') THEN 796 IF( nn_ice_lim_dta(jbdy) == 0 ) THEN 797 ALLOCATE( dta_bdy(jbdy)%a_i(nblen(1),jpl) ) 798 ALLOCATE( dta_bdy(jbdy)%h_i(nblen(1),jpl) ) 799 ALLOCATE( dta_bdy(jbdy)%h_s(nblen(1),jpl) ) 793 800 ELSE 794 IF ( ll_bdylim3 ) THEN ! case input is Xcat795 jfld = jfld + 1 796 dta_bdy( ib_bdy)%a_i => bf(jfld)%fnow(:,1,:)797 jfld = jfld + 1 798 dta_bdy( ib_bdy)%h_i => bf(jfld)%fnow(:,1,:)799 jfld = jfld + 1 800 dta_bdy( ib_bdy)%h_s => bf(jfld)%fnow(:,1,:)801 ELSE ! case input is 1cat801 IF ( nice_cat == jpl ) THEN ! case input cat = jpl 802 jfld = jfld + 1 803 dta_bdy(jbdy)%a_i => bf(jfld)%fnow(:,1,:) 804 jfld = jfld + 1 805 dta_bdy(jbdy)%h_i => bf(jfld)%fnow(:,1,:) 806 jfld = jfld + 1 807 dta_bdy(jbdy)%h_s => bf(jfld)%fnow(:,1,:) 808 ELSE ! case input cat = 1 OR (/=1 and /=jpl) 802 809 jfld_ai = jfld + 1 803 810 jfld_hti = jfld + 2 804 811 jfld_hts = jfld + 3 805 812 jfld = jfld + 3 806 ALLOCATE( dta_bdy( ib_bdy)%a_i(nblen(1),jpl) )807 ALLOCATE( dta_bdy( ib_bdy)%h_i(nblen(1),jpl) )808 ALLOCATE( dta_bdy( ib_bdy)%h_s(nblen(1),jpl) )809 dta_bdy( ib_bdy)%a_i(:,:) = 0._wp810 dta_bdy( ib_bdy)%h_i(:,:) = 0._wp811 dta_bdy( ib_bdy)%h_s(:,:) = 0._wp813 ALLOCATE( dta_bdy(jbdy)%a_i(nblen(1),jpl) ) 814 ALLOCATE( dta_bdy(jbdy)%h_i(nblen(1),jpl) ) 815 ALLOCATE( dta_bdy(jbdy)%h_s(nblen(1),jpl) ) 816 dta_bdy(jbdy)%a_i(:,:) = 0._wp 817 dta_bdy(jbdy)%h_i(:,:) = 0._wp 818 dta_bdy(jbdy)%h_s(:,:) = 0._wp 812 819 ENDIF 813 820 … … 816 823 #endif 817 824 ! 818 END DO ! ib_bdy825 END DO ! jbdy 819 826 ! 820 827 IF( nn_timing == 1 ) CALL timing_stop('bdy_dta_init') -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_ice.F90
r8586 r8813 48 48 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: alb_ice !: ice albedo [-] 49 49 50 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: qml_ice !: heat available for snow / ice surface melting [W/m2] 51 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: qcn_ice !: heat conduction flux in the layer below surface [W/m2] 52 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: qsr_ice_tr !: solar flux transmitted below the ice surface [W/m2] 53 50 54 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: utau_ice !: atmos-ice u-stress. VP: I-pt ; EVP: U,V-pts [N/m2] 51 55 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: vtau_ice !: atmos-ice v-stress. VP: I-pt ; EVP: U,V-pts [N/m2] 52 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: fr1_i0 !: Solar surface transmission parameter, thick ice [-]53 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: fr2_i0 !: Solar surface transmission parameter, thin ice [-]54 56 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: emp_ice !: sublimation - precip over sea ice [kg/m2/s] 55 57 … … 123 125 ALLOCATE( qns_ice (jpi,jpj,jpl) , qsr_ice (jpi,jpj,jpl) , & 124 126 & qla_ice (jpi,jpj,jpl) , dqla_ice(jpi,jpj,jpl) , & 125 & dqns_ice(jpi,jpj,jpl) , tn_ice (jpi,jpj,jpl) , alb_ice (jpi,jpj,jpl) , & 127 & dqns_ice(jpi,jpj,jpl) , tn_ice (jpi,jpj,jpl) , alb_ice (jpi,jpj,jpl) , & 128 & qml_ice(jpi,jpj,jpl) , qcn_ice(jpi,jpj,jpl) , qsr_ice_tr(jpi,jpj,jpl), & 126 129 & utau_ice(jpi,jpj) , vtau_ice(jpi,jpj) , wndm_ice(jpi,jpj) , & 127 & fr1_i0 (jpi,jpj) , fr2_i0 (jpi,jpj) , &128 130 & evap_ice(jpi,jpj,jpl) , devap_ice(jpi,jpj,jpl) , qprec_ice(jpi,jpj) , & 129 131 & qemp_ice(jpi,jpj) , qevap_ice(jpi,jpj,jpl) , qemp_oce (jpi,jpj) , & … … 139 141 a_i(jpi,jpj,ncat) , topmelt(jpi,jpj,ncat) , botmelt(jpi,jpj,ncat) , & 140 142 STAT= ierr(2) ) 141 IF( ln_cpl ) ALLOCATE( u_ice(jpi,jpj) , fr1_i0(jpi,jpj) ,tn_ice (jpi,jpj,1) , &142 & v_ice(jpi,jpj) , fr2_i0(jpi,jpj) ,alb_ice(jpi,jpj,1) , &143 IF( ln_cpl ) ALLOCATE( u_ice(jpi,jpj) , tn_ice (jpi,jpj,1) , & 144 & v_ice(jpi,jpj) , alb_ice(jpi,jpj,1) , & 143 145 & emp_ice(jpi,jpj) , qns_ice(jpi,jpj,1) , dqns_ice(jpi,jpj,1) , & 144 146 & STAT= ierr(3) ) … … 161 163 PRIVATE 162 164 163 PUBLIC sbc_ice_alloc165 PUBLIC sbc_ice_alloc ! 164 166 165 167 LOGICAL , PUBLIC, PARAMETER :: lk_lim3 = .FALSE. !: no LIM-3 ice model … … 168 170 REAL(wp) , PUBLIC, PARAMETER :: cldf_ice = 0.81 !: cloud fraction over sea ice, summer CLIO value [-] 169 171 INTEGER , PUBLIC, PARAMETER :: jpl = 1 170 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: u_ice, v_ice ,fr1_i0,fr2_i0! jpi, jpj172 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: u_ice, v_ice ! jpi, jpj 171 173 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: tn_ice, alb_ice, qns_ice, dqns_ice ! (jpi,jpj,jpl) 172 174 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: a_i … … 176 178 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: topmelt, botmelt 177 179 ! 178 !! arrays relat ing to embedding ice in the ocean. These arrays need to be declared179 !! even if no ice model is required. In the no ice model or traditional levitating180 !! ice cases they contain only zeros180 !! arrays related to embedding ice in the ocean. 181 !! These arrays need to be declared even if no ice model is required. 182 !! In the no ice model or traditional levitating ice cases they contain only zeros 181 183 !! --------------------- 182 184 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: snwice_mass !: mass of snow and ice at current ice time step [Kg/m2] -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk.F90
r8637 r8813 15 15 !! 3.7 ! 2014-06 (L. Brodeau) simplification and optimization of CORE bulk 16 16 !! 4.0 ! 2016-06 (L. Brodeau) sbcblk_core becomes sbcblk and is not restricted to the CORE algorithm anymore 17 !! 17 !! ! ==> based on AeroBulk (http://aerobulk.sourceforge.net/) 18 18 !! 4.0 ! 2016-10 (G. Madec) introduce a sbc_blk_init routine 19 !! 4.0 ! 2016-10 (M. Vancoppenolle) Introduce Jules emulator (M. Vancoppenolle) 19 20 !!---------------------------------------------------------------------- 20 21 … … 23 24 !! sbc_blk : bulk formulation as ocean surface boundary condition 24 25 !! blk_oce : computes momentum, heat and freshwater fluxes over ocean 25 !! blk_ice : computes momentum, heat and freshwater fluxes over sea ice26 26 !! rho_air : density of (moist) air (depends on T_air, q_air and SLP 27 27 !! cp_air : specific heat of (moist) air (depends spec. hum. q_air) 28 28 !! q_sat : saturation humidity as a function of SLP and temperature 29 29 !! L_vap : latent heat of vaporization of water as a function of temperature 30 !! sea-ice case only : 31 !! blk_ice_tau : provide the air-ice stress 32 !! blk_ice_flx : provide the heat and mass fluxes at air-ice interface 33 !! blk_ice_qcn : provide ice surface temperature and snow/ice conduction flux (emulating JULES coupler) 34 !! Cdn10_Lupkes2012 : Lupkes et al. (2012) air-ice drag 35 !! Cdn10_Lupkes2015 : Lupkes et al. (2015) air-ice drag 30 36 !!---------------------------------------------------------------------- 31 37 USE oce ! ocean dynamics and tracers … … 42 48 USE ice , ONLY : u_ice, v_ice, jpl, a_i_b, at_i_b, tm_su 43 49 USE icethd_dh ! for CALL ice_thd_snwblow 50 USE icethd_zdf,ONLY: rn_cnd_s ! for blk_ice_qcn 44 51 #endif 45 52 USE sbcblk_algo_ncar ! => turb_ncar : NCAR - CORE (Large & Yeager, 2009) … … 63 70 PUBLIC blk_ice_tau ! routine called in icestp module 64 71 PUBLIC blk_ice_flx ! routine called in icestp module 65 #endif 72 PUBLIC blk_ice_qcn ! routine called in icestp module 73 #endif 66 74 67 75 !!Lolo: should ultimately be moved in the module with all physical constants ? … … 111 119 LOGICAL :: ln_Cd_L15 = .FALSE. ! Modify the drag ice-atm depending on ice concentration (from Lupkes et al. JGR2015) 112 120 ! 113 !!cr REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: Cd_oce ! air-ocean drag (clem)114 121 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: Cd_atm ! transfer coefficient for momentum (tau) 115 122 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: Ch_atm ! transfer coefficient for sensible heat (Q_sens) … … 139 146 !! *** ROUTINE sbc_blk_alloc *** 140 147 !!------------------------------------------------------------------- 141 !!cr ALLOCATE( Cd_oce(jpi,jpj) , STAT=sbc_blk_alloc )142 148 ALLOCATE( Cd_atm (jpi,jpj), Ch_atm (jpi,jpj), Ce_atm (jpi,jpj), t_zu(jpi,jpj), q_zu(jpi,jpj), & 143 149 & cdn_oce(jpi,jpj), chn_oce(jpi,jpj), cen_oce(jpi,jpj), STAT=sbc_blk_alloc ) … … 147 153 END FUNCTION sbc_blk_alloc 148 154 155 149 156 SUBROUTINE sbc_blk_init 150 157 !!--------------------------------------------------------------------- … … 154 161 !! 155 162 !! ** Method : 156 !!157 !! C A U T I O N : never mask the surface stress fields158 !! the stress is assumed to be in the (i,j) mesh referential159 !!160 !! ** Action :161 163 !! 162 164 !!---------------------------------------------------------------------- … … 285 287 !! 286 288 !! ** Purpose : provide at each time step the surface ocean fluxes 287 !! (momentum, heat, freshwater and runoff)289 !! (momentum, heat, freshwater and runoff) 288 290 !! 289 291 !! ** Method : (1) READ each fluxes in NetCDF files: … … 566 568 END SUBROUTINE blk_oce 567 569 570 571 572 FUNCTION rho_air( ptak, pqa, pslp ) 573 !!------------------------------------------------------------------------------- 574 !! *** FUNCTION rho_air *** 575 !! 576 !! ** Purpose : compute density of (moist) air using the eq. of state of the atmosphere 577 !! 578 !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 579 !!------------------------------------------------------------------------------- 580 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: ptak ! air temperature [K] 581 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pqa ! air specific humidity [kg/kg] 582 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pslp ! pressure in [Pa] 583 REAL(wp), DIMENSION(jpi,jpj) :: rho_air ! density of moist air [kg/m^3] 584 !!------------------------------------------------------------------------------- 585 ! 586 rho_air = pslp / ( R_dry*ptak * ( 1._wp + rctv0*pqa ) ) 587 ! 588 END FUNCTION rho_air 589 590 591 FUNCTION cp_air( pqa ) 592 !!------------------------------------------------------------------------------- 593 !! *** FUNCTION cp_air *** 594 !! 595 !! ** Purpose : Compute specific heat (Cp) of moist air 596 !! 597 !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 598 !!------------------------------------------------------------------------------- 599 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pqa ! air specific humidity [kg/kg] 600 REAL(wp), DIMENSION(jpi,jpj) :: cp_air ! specific heat of moist air [J/K/kg] 601 !!------------------------------------------------------------------------------- 602 ! 603 Cp_air = Cp_dry + Cp_vap * pqa 604 ! 605 END FUNCTION cp_air 606 607 608 FUNCTION q_sat( ptak, pslp ) 609 !!---------------------------------------------------------------------------------- 610 !! *** FUNCTION q_sat *** 611 !! 612 !! ** Purpose : Specific humidity at saturation in [kg/kg] 613 !! Based on accurate estimate of "e_sat" 614 !! aka saturation water vapor (Goff, 1957) 615 !! 616 !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 617 !!---------------------------------------------------------------------------------- 618 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: ptak ! air temperature [K] 619 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pslp ! sea level atmospheric pressure [Pa] 620 REAL(wp), DIMENSION(jpi,jpj) :: q_sat ! Specific humidity at saturation [kg/kg] 621 ! 622 INTEGER :: ji, jj ! dummy loop indices 623 REAL(wp) :: ze_sat, ztmp ! local scalar 624 !!---------------------------------------------------------------------------------- 625 ! 626 DO jj = 1, jpj 627 DO ji = 1, jpi 628 ! 629 ztmp = rt0 / ptak(ji,jj) 630 ! 631 ! Vapour pressure at saturation [hPa] : WMO, (Goff, 1957) 632 ze_sat = 10.**( 10.79574*(1. - ztmp) - 5.028*LOG10(ptak(ji,jj)/rt0) & 633 & + 1.50475*10.**(-4)*(1. - 10.**(-8.2969*(ptak(ji,jj)/rt0 - 1.)) ) & 634 & + 0.42873*10.**(-3)*(10.**(4.76955*(1. - ztmp)) - 1.) + 0.78614 ) 635 ! 636 q_sat(ji,jj) = reps0 * ze_sat/( 0.01_wp*pslp(ji,jj) - (1._wp - reps0)*ze_sat ) ! 0.01 because SLP is in [Pa] 637 ! 638 END DO 639 END DO 640 ! 641 END FUNCTION q_sat 642 643 644 FUNCTION gamma_moist( ptak, pqa ) 645 !!---------------------------------------------------------------------------------- 646 !! *** FUNCTION gamma_moist *** 647 !! 648 !! ** Purpose : Compute the moist adiabatic lapse-rate. 649 !! => http://glossary.ametsoc.org/wiki/Moist-adiabatic_lapse_rate 650 !! => http://www.geog.ucsb.edu/~joel/g266_s10/lecture_notes/chapt03/oh10_3_01/oh10_3_01.html 651 !! 652 !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 653 !!---------------------------------------------------------------------------------- 654 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: ptak ! air temperature [K] 655 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pqa ! specific humidity [kg/kg] 656 REAL(wp), DIMENSION(jpi,jpj) :: gamma_moist ! moist adiabatic lapse-rate 657 ! 658 INTEGER :: ji, jj ! dummy loop indices 659 REAL(wp) :: zrv, ziRT ! local scalar 660 !!---------------------------------------------------------------------------------- 661 ! 662 DO jj = 1, jpj 663 DO ji = 1, jpi 664 zrv = pqa(ji,jj) / (1. - pqa(ji,jj)) 665 ziRT = 1. / (R_dry*ptak(ji,jj)) ! 1/RT 666 gamma_moist(ji,jj) = grav * ( 1. + cevap*zrv*ziRT ) / ( Cp_dry + cevap*cevap*zrv*reps0*ziRT/ptak(ji,jj) ) 667 END DO 668 END DO 669 ! 670 END FUNCTION gamma_moist 671 672 673 FUNCTION L_vap( psst ) 674 !!--------------------------------------------------------------------------------- 675 !! *** FUNCTION L_vap *** 676 !! 677 !! ** Purpose : Compute the latent heat of vaporization of water from temperature 678 !! 679 !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 680 !!---------------------------------------------------------------------------------- 681 REAL(wp), DIMENSION(jpi,jpj) :: L_vap ! latent heat of vaporization [J/kg] 682 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: psst ! water temperature [K] 683 !!---------------------------------------------------------------------------------- 684 ! 685 L_vap = ( 2.501 - 0.00237 * ( psst(:,:) - rt0) ) * 1.e6 686 ! 687 END FUNCTION L_vap 688 568 689 #if defined key_lim3 690 !!---------------------------------------------------------------------- 691 !! 'key_lim3' ESIM sea-ice model 692 !!---------------------------------------------------------------------- 693 !! blk_ice_tau : provide the air-ice stress 694 !! blk_ice_flx : provide the heat and mass fluxes at air-ice interface 695 !! blk_ice_qcn : provide ice surface temperature and snow/ice conduction flux (emulating JULES coupler) 696 !! Cdn10_Lupkes2012 : Lupkes et al. (2012) air-ice drag 697 !! Cdn10_Lupkes2015 : Lupkes et al. (2015) air-ice drag 698 !!---------------------------------------------------------------------- 569 699 570 700 SUBROUTINE blk_ice_tau … … 688 818 689 819 690 SUBROUTINE blk_ice_flx( ptsu, p alb )820 SUBROUTINE blk_ice_flx( ptsu, phs, phi, palb ) 691 821 !!--------------------------------------------------------------------- 692 822 !! *** ROUTINE blk_ice_flx *** 693 823 !! 694 !! ** Purpose : provide the surface boundary condition over sea-ice824 !! ** Purpose : provide the heat and mass fluxes at air-ice interface 695 825 !! 696 826 !! ** Method : compute heat and freshwater exchanged … … 701 831 !!--------------------------------------------------------------------- 702 832 REAL(wp), DIMENSION(:,:,:), INTENT(in) :: ptsu ! sea ice surface temperature 833 REAL(wp), DIMENSION(:,:,:), INTENT(in) :: phs ! snow thickness 834 REAL(wp), DIMENSION(:,:,:), INTENT(in) :: phi ! ice thickness 703 835 REAL(wp), DIMENSION(:,:,:), INTENT(in) :: palb ! ice albedo (all skies) 704 836 !! … … 707 839 REAL(wp) :: zcoef_dqlw, zcoef_dqla ! - - 708 840 REAL(wp) :: zztmp, z1_lsub ! - - 841 REAL(wp) :: zfrqsr_tr_i ! sea ice shortwave fraction transmitted below through the ice 842 REAL(wp) :: zfr1, zfr2, zfac ! local variables 709 843 REAL(wp), DIMENSION(jpi,jpj,jpl) :: z_qlw ! long wave heat flux over ice 710 844 REAL(wp), DIMENSION(jpi,jpj,jpl) :: z_qsb ! sensible heat flux over ice … … 717 851 IF( ln_timing ) CALL timing_start('blk_ice_flx') 718 852 ! 719 ! 720 ! local scalars 721 zcoef_dqlw = 4.0 * 0.95 * Stef 722 zcoef_dqla = -Ls * 11637800. * (-5897.8) 853 zcoef_dqlw = 4.0 * 0.95 * Stef ! local scalars 854 zcoef_dqla = -Ls * 11637800. * (-5897.8) 723 855 ! 724 856 zrhoa(:,:) = rho_air( sf(jp_tair)%fnow(:,:,1), sf(jp_humi)%fnow(:,:,1), sf(jp_slp)%fnow(:,:,1) ) … … 815 947 END DO 816 948 817 !-------------------------------------------------------------------- 818 ! FRACTIONs of net shortwave radiation which is not absorbed in the 819 ! thin surface layer and penetrates inside the ice cover 820 ! ( Maykut and Untersteiner, 1971 ; Ebert and Curry, 1993 ) 821 ! 822 fr1_i0(:,:) = ( 0.18 * ( 1.0 - cldf_ice ) + 0.35 * cldf_ice ) 823 fr2_i0(:,:) = ( 0.82 * ( 1.0 - cldf_ice ) + 0.65 * cldf_ice ) 949 ! --- absorbed and transmitted shortwave radiation (W/m2) --- ! 950 ! 951 ! former coding was 952 ! fr1_i0(:,:) = ( 0.18 * ( 1.0 - cldf_ice ) + 0.35 * cldf_ice ) 953 ! fr2_i0(:,:) = ( 0.82 * ( 1.0 - cldf_ice ) + 0.65 * cldf_ice ) 954 955 ! --- surface transmission parameter (i0, Grenfell Maykut 77) --- ! 956 zfr1 = ( 0.18 * ( 1.0 - cldf_ice ) + 0.35 * cldf_ice ) ! standard value 957 zfr2 = ( 0.82 * ( 1.0 - cldf_ice ) + 0.65 * cldf_ice ) ! zfr2 such that zfr1 + zfr2 to equal 1 958 959 qsr_ice_tr(:,:,:) = 0._wp 960 961 DO jl = 1, jpl 962 DO jj = 1, jpj 963 DO ji = 1, jpi 964 ! 965 zfac = MAX( 0._wp , 1._wp - phi(ji,jj,jl) * 10._wp ) ! linear weighting factor: =0 for phi=0, =1 for phi = 0.1 966 zfrqsr_tr_i = zfr1 + zfac * zfr2 ! below 10 cm, linearly increase zfrqsr_tr_i until 1 at zero thickness 967 ! 968 IF ( phs(ji,jj,jl) <= 0._wp ) THEN ; zfrqsr_tr_i = zfr1 + zfac * zfr2 969 ELSE ; zfrqsr_tr_i = 0._wp ! snow fully opaque 970 ENDIF 971 ! 972 qsr_ice_tr(ji,jj,jl) = zfrqsr_tr_i * qsr_ice(ji,jj,jl) ! transmitted solar radiation 973 ! 974 END DO 975 END DO 976 END DO 824 977 ! 825 978 IF(ln_ctl) THEN … … 836 989 END SUBROUTINE blk_ice_flx 837 990 838 #endif 839 840 FUNCTION rho_air( ptak, pqa, pslp ) 841 !!------------------------------------------------------------------------------- 842 !! *** FUNCTION rho_air *** 843 !! 844 !! ** Purpose : compute density of (moist) air using the eq. of state of the atmosphere 845 !! 846 !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 847 !!------------------------------------------------------------------------------- 848 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: ptak ! air temperature [K] 849 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pqa ! air specific humidity [kg/kg] 850 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pslp ! pressure in [Pa] 851 REAL(wp), DIMENSION(jpi,jpj) :: rho_air ! density of moist air [kg/m^3] 852 !!------------------------------------------------------------------------------- 853 ! 854 rho_air = pslp / ( R_dry*ptak * ( 1._wp + rctv0*pqa ) ) 855 ! 856 END FUNCTION rho_air 857 858 859 FUNCTION cp_air( pqa ) 860 !!------------------------------------------------------------------------------- 861 !! *** FUNCTION cp_air *** 862 !! 863 !! ** Purpose : Compute specific heat (Cp) of moist air 864 !! 865 !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 866 !!------------------------------------------------------------------------------- 867 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pqa ! air specific humidity [kg/kg] 868 REAL(wp), DIMENSION(jpi,jpj) :: cp_air ! specific heat of moist air [J/K/kg] 869 !!------------------------------------------------------------------------------- 870 ! 871 Cp_air = Cp_dry + Cp_vap * pqa 872 ! 873 END FUNCTION cp_air 874 875 876 FUNCTION q_sat( ptak, pslp ) 877 !!---------------------------------------------------------------------------------- 878 !! *** FUNCTION q_sat *** 879 !! 880 !! ** Purpose : Specific humidity at saturation in [kg/kg] 881 !! Based on accurate estimate of "e_sat" 882 !! aka saturation water vapor (Goff, 1957) 883 !! 884 !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 885 !!---------------------------------------------------------------------------------- 886 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: ptak ! air temperature [K] 887 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pslp ! sea level atmospheric pressure [Pa] 888 REAL(wp), DIMENSION(jpi,jpj) :: q_sat ! Specific humidity at saturation [kg/kg] 889 ! 890 INTEGER :: ji, jj ! dummy loop indices 891 REAL(wp) :: ze_sat, ztmp ! local scalar 892 !!---------------------------------------------------------------------------------- 893 ! 894 DO jj = 1, jpj 895 DO ji = 1, jpi 896 ! 897 ztmp = rt0 / ptak(ji,jj) 898 ! 899 ! Vapour pressure at saturation [hPa] : WMO, (Goff, 1957) 900 ze_sat = 10.**( 10.79574*(1. - ztmp) - 5.028*LOG10(ptak(ji,jj)/rt0) & 901 & + 1.50475*10.**(-4)*(1. - 10.**(-8.2969*(ptak(ji,jj)/rt0 - 1.)) ) & 902 & + 0.42873*10.**(-3)*(10.**(4.76955*(1. - ztmp)) - 1.) + 0.78614 ) 991 992 SUBROUTINE blk_ice_qcn( k_monocat, ptsu, ptb, phs, phi ) 993 !!--------------------------------------------------------------------- 994 !! *** ROUTINE blk_ice_qcn *** 995 !! 996 !! ** Purpose : Compute surface temperature and snow/ice conduction flux 997 !! to force sea ice / snow thermodynamics 998 !! in the case JULES coupler is emulated 999 !! 1000 !! ** Method : compute surface energy balance assuming neglecting heat storage 1001 !! following the 0-layer Semtner (1976) approach 1002 !! 1003 !! ** Outputs : - ptsu : sea-ice / snow surface temperature (K) 1004 !! - qcn_ice : surface inner conduction flux (W/m2) 1005 !! 1006 !!--------------------------------------------------------------------- 1007 INTEGER , INTENT(in ) :: k_monocat ! single-category option 1008 REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptsu ! sea ice / snow surface temperature 1009 REAL(wp), DIMENSION(:,:) , INTENT(in ) :: ptb ! sea ice base temperature 1010 REAL(wp), DIMENSION(:,:,:), INTENT(in ) :: phs ! snow thickness 1011 REAL(wp), DIMENSION(:,:,:), INTENT(in ) :: phi ! sea ice thickness 1012 ! 1013 INTEGER , PARAMETER :: nit = 10 ! number of iterations 1014 REAL(wp), PARAMETER :: zepsilon = 0.1_wp ! characteristic thickness for enhanced conduction 1015 ! 1016 INTEGER :: ji, jj, jl ! dummy loop indices 1017 INTEGER :: iter ! local integer 1018 REAL(wp) :: zfac, zfac2, zfac3 ! local scalars 1019 REAL(wp) :: zkeff_h, ztsu ! 1020 REAL(wp) :: zqc, zqnet ! 1021 REAL(wp) :: zhe, zqa0 ! 1022 REAL(wp), DIMENSION(jpi,jpj,jpl) :: zgfac ! enhanced conduction factor 1023 !!--------------------------------------------------------------------- 1024 1025 IF( nn_timing == 1 ) CALL timing_start('blk_ice_qcn') 1026 1027 ! -------------------------------------! 1028 ! I Enhanced conduction factor ! 1029 ! -------------------------------------! 1030 ! Emulates the enhancement of conduction by unresolved thin ice (k_monocat = 1/3) 1031 ! Fichefet and Morales Maqueda, JGR 1997 1032 ! 1033 zgfac(:,:,:) = 1._wp 1034 1035 SELECT CASE ( k_monocat ) 1036 ! 1037 CASE ( 1 , 3 ) 1038 ! 1039 zfac = 1._wp / ( rn_cnd_s + rcdic ) 1040 zfac2 = EXP(1._wp) * 0.5_wp * zepsilon 1041 zfac3 = 2._wp / zepsilon 1042 ! 1043 DO jl = 1, jpl 1044 DO jj = 1 , jpj 1045 DO ji = 1, jpi 1046 ! ! Effective thickness 1047 zhe = ( rn_cnd_s * phi(ji,jj,jl) + rcdic * phs(ji,jj,jl) ) * zfac 1048 ! ! Enhanced conduction factor 1049 IF( zhe >= zfac2 ) & 1050 zgfac(ji,jj,jl) = MIN( 2._wp, ( 0.5_wp + 0.5 * LOG( zhe * zfac3 ) ) ) 1051 END DO 1052 END DO 1053 END DO 1054 ! 1055 END SELECT 1056 1057 ! -------------------------------------------------------------! 1058 ! II Surface temperature and conduction flux ! 1059 ! -------------------------------------------------------------! 1060 ! 1061 zfac = rcdic * rn_cnd_s 1062 ! ! ========================== ! 1063 DO jl = 1, jpl ! Loop over ice categories ! 1064 ! ! ========================== ! 1065 DO jj = 1 , jpj 1066 DO ji = 1, jpi 1067 ! ! Effective conductivity of the snow-ice system divided by thickness 1068 zkeff_h = zfac * zgfac(ji,jj,jl) / ( rcdic * phs(ji,jj,jl) + rn_cnd_s * phi(ji,jj,jl) ) 1069 ! ! Store initial surface temperature 1070 ztsu = ptsu(ji,jj,jl) 1071 ! ! Net initial atmospheric heat flux 1072 zqa0 = qsr_ice(ji,jj,jl) - qsr_ice_tr(ji,jj,jl) + qns_ice(ji,jj,jl) 903 1073 ! 904 q_sat(ji,jj) = reps0 * ze_sat/( 0.01_wp*pslp(ji,jj) - (1._wp - reps0)*ze_sat ) ! 0.01 because SLP is in [Pa] 905 ! 906 END DO 907 END DO 908 ! 909 END FUNCTION q_sat 910 911 912 FUNCTION gamma_moist( ptak, pqa ) 913 !!---------------------------------------------------------------------------------- 914 !! *** FUNCTION gamma_moist *** 915 !! 916 !! ** Purpose : Compute the moist adiabatic lapse-rate. 917 !! => http://glossary.ametsoc.org/wiki/Moist-adiabatic_lapse_rate 918 !! => http://www.geog.ucsb.edu/~joel/g266_s10/lecture_notes/chapt03/oh10_3_01/oh10_3_01.html 919 !! 920 !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 921 !!---------------------------------------------------------------------------------- 922 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: ptak ! air temperature [K] 923 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pqa ! specific humidity [kg/kg] 924 REAL(wp), DIMENSION(jpi,jpj) :: gamma_moist ! moist adiabatic lapse-rate 925 ! 926 INTEGER :: ji, jj ! dummy loop indices 927 REAL(wp) :: zrv, ziRT ! local scalar 928 !!---------------------------------------------------------------------------------- 929 ! 930 DO jj = 1, jpj 931 DO ji = 1, jpi 932 zrv = pqa(ji,jj) / (1. - pqa(ji,jj)) 933 ziRT = 1. / (R_dry*ptak(ji,jj)) ! 1/RT 934 gamma_moist(ji,jj) = grav * ( 1. + cevap*zrv*ziRT ) / ( Cp_dry + cevap*cevap*zrv*reps0*ziRT/ptak(ji,jj) ) 935 END DO 936 END DO 937 ! 938 END FUNCTION gamma_moist 939 940 941 FUNCTION L_vap( psst ) 942 !!--------------------------------------------------------------------------------- 943 !! *** FUNCTION L_vap *** 944 !! 945 !! ** Purpose : Compute the latent heat of vaporization of water from temperature 946 !! 947 !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 948 !!---------------------------------------------------------------------------------- 949 REAL(wp), DIMENSION(jpi,jpj) :: L_vap ! latent heat of vaporization [J/kg] 950 REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: psst ! water temperature [K] 951 !!---------------------------------------------------------------------------------- 952 ! 953 L_vap = ( 2.501 - 0.00237 * ( psst(:,:) - rt0) ) * 1.e6 954 ! 955 END FUNCTION L_vap 956 957 #if defined key_lim3 1074 DO iter = 1, nit ! --- Iteration loop 1075 ! ! Conduction heat flux through snow-ice system (>0 downwards) 1076 zqc = zkeff_h * ( ztsu - ptb(ji,jj) ) 1077 ! ! Surface energy budget 1078 zqnet = zqa0 + dqns_ice(ji,jj,jl) * ( ztsu - ptsu(ji,jj,jl) ) - zqc 1079 ! ! Temperature update 1080 ztsu = ztsu - zqnet / ( dqns_ice(ji,jj,jl) - zkeff_h ) 1081 END DO 1082 ! 1083 ptsu (ji,jj,jl) = MIN( rt0, ztsu ) 1084 qcn_ice(ji,jj,jl) = zkeff_h * ( ptsu(ji,jj,jl) - ptb(ji,jj) ) 1085 ! 1086 END DO 1087 END DO 1088 ! 1089 END DO 1090 ! 1091 IF( nn_timing == 1 ) CALL timing_stop('blk_ice_qcn') 1092 ! 1093 END SUBROUTINE blk_ice_qcn 1094 958 1095 959 1096 SUBROUTINE Cdn10_Lupkes2012( Cd ) … … 961 1098 !! *** ROUTINE Cdn10_Lupkes2012 *** 962 1099 !! 963 !! ** Purpose : Recompute the ice-atm drag at 10m height to make964 !! it dependent on edges at leads, melt ponds and flows.1100 !! ** Purpose : Recompute the neutral air-ice drag referenced at 10m 1101 !! to make it dependent on edges at leads, melt ponds and flows. 965 1102 !! After some approximations, this can be resumed to a dependency 966 1103 !! on ice concentration. … … 1012 1149 !! *** ROUTINE Cdn10_Lupkes2015 *** 1013 1150 !! 1014 !! ** pUrpose : 1lternative turbulent transfert coefficients formulation1151 !! ** pUrpose : Alternative turbulent transfert coefficients formulation 1015 1152 !! between sea-ice and atmosphere with distinct momentum 1016 1153 !! and heat coefficients depending on sea-ice concentration -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_algo_coare.F90
r8637 r8813 49 49 PUBLIC :: TURB_COARE ! called by sbcblk.F90 50 50 51 ! !! COARE own values for given constants:52 REAL(wp), PARAMETER :: zi0 = 600. ! scale height of the atmospheric boundary layer...153 REAL(wp), PARAMETER :: Beta0 = 1.25 54 REAL(wp), PARAMETER :: rctv0 = 0.608 ! constant to obtain virtual temperature...51 ! !! COARE own values for given constants: 52 REAL(wp), PARAMETER :: zi0 = 600._wp ! scale height of the atmospheric boundary layer... 53 REAL(wp), PARAMETER :: Beta0 = 1.250_wp ! gustiness parameter 54 REAL(wp), PARAMETER :: rctv0 = 0.608_wp ! constant to obtain virtual temperature... 55 55 56 56 !!---------------------------------------------------------------------- -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90
r8637 r8813 971 971 !! emp upward mass flux [evap. - precip. (- runoffs) (- calving)] (ocean only case) 972 972 !!---------------------------------------------------------------------- 973 USE zdf_oce, ONLY : ln_zdfswm 974 975 IMPLICIT NONE 976 977 INTEGER, INTENT(in) :: kt ! ocean model time step index 978 INTEGER, INTENT(in) :: k_fsbc ! frequency of sbc (-> ice model) computation 979 INTEGER, INTENT(in) :: k_ice ! ice management in the sbc (=0/1/2/3) 973 USE zdf_oce, ONLY : ln_zdfswm 974 ! 975 INTEGER, INTENT(in) :: kt ! ocean model time step index 976 INTEGER, INTENT(in) :: k_fsbc ! frequency of sbc (-> ice model) computation 977 INTEGER, INTENT(in) :: k_ice ! ice management in the sbc (=0/1/2/3) 980 978 !! 981 979 LOGICAL :: llnewtx, llnewtau ! update wind stress components and module?? … … 1170 1168 ! Calculate the 3D Stokes drift both in coupled and not fully uncoupled mode 1171 1169 IF( srcv(jpr_sdrftx)%laction .OR. srcv(jpr_sdrfty)%laction .OR. srcv(jpr_wper)%laction & 1172 1170 & .OR. srcv(jpr_hsig)%laction ) THEN 1173 1171 CALL sbc_stokes() 1174 1172 ENDIF … … 1525 1523 1526 1524 1527 SUBROUTINE sbc_cpl_ice_flx( picefr, palbi, psst, pist )1525 SUBROUTINE sbc_cpl_ice_flx( picefr, palbi, psst, pist, phs, phi ) 1528 1526 !!---------------------------------------------------------------------- 1529 1527 !! *** ROUTINE sbc_cpl_ice_flx *** … … 1576 1574 !!---------------------------------------------------------------------- 1577 1575 REAL(wp), INTENT(in), DIMENSION(:,:) :: picefr ! ice fraction [0 to 1] 1578 ! optional arguments, used only in 'mixed oce-ice' case1576 ! !! ! optional arguments, used only in 'mixed oce-ice' case 1579 1577 REAL(wp), INTENT(in), DIMENSION(:,:,:), OPTIONAL :: palbi ! all skies ice albedo 1580 1578 REAL(wp), INTENT(in), DIMENSION(:,: ), OPTIONAL :: psst ! sea surface temperature [Celsius] 1581 1579 REAL(wp), INTENT(in), DIMENSION(:,:,:), OPTIONAL :: pist ! ice surface temperature [Kelvin] 1582 ! 1583 INTEGER :: jl ! dummy loop index 1584 REAL(wp), POINTER, DIMENSION(:,: ) :: zcptn, zcptrain, zcptsnw, ziceld, zmsk, zsnw 1585 REAL(wp), POINTER, DIMENSION(:,: ) :: zemp_tot, zemp_ice, zemp_oce, ztprecip, zsprecip, zevap_oce, zevap_ice, zdevap_ice 1586 REAL(wp), POINTER, DIMENSION(:,: ) :: zqns_tot, zqns_oce, zqsr_tot, zqsr_oce, zqprec_ice, zqemp_oce, zqemp_ice 1587 REAL(wp), POINTER, DIMENSION(:,:,:) :: zqns_ice, zqsr_ice, zdqns_ice, zqevap_ice 1580 REAL(wp), INTENT(in), DIMENSION(:,:,:), OPTIONAL :: phs ! snow depth [m] 1581 REAL(wp), INTENT(in), DIMENSION(:,:,:), OPTIONAL :: phi ! ice thickness [m] 1582 ! 1583 INTEGER :: ji, jj, jl ! dummy loop index 1584 REAL(wp) :: ztri ! local scalar 1585 REAL(wp), DIMENSION(jpi,jpj) :: zcptn, zcptrain, zcptsnw, ziceld, zmsk, zsnw 1586 REAL(wp), DIMENSION(jpi,jpj) :: zemp_tot, zemp_ice, zemp_oce, ztprecip, zsprecip , zevap_oce, zevap_ice, zdevap_ice 1587 REAL(wp), DIMENSION(jpi,jpj) :: zqns_tot, zqns_oce, zqsr_tot, zqsr_oce, zqprec_ice, zqemp_oce, zqemp_ice 1588 REAL(wp), DIMENSION(jpi,jpj,jpl) :: zqns_ice, zqsr_ice, zdqns_ice, zqevap_ice !!gm , zfrqsr_tr_i 1588 1589 !!---------------------------------------------------------------------- 1589 1590 ! 1590 1591 IF( nn_timing == 1 ) CALL timing_start('sbc_cpl_ice_flx') 1591 1592 ! 1592 CALL wrk_alloc( jpi,jpj, zcptn, zcptrain, zcptsnw, ziceld, zmsk, zsnw )1593 CALL wrk_alloc( jpi,jpj, zemp_tot, zemp_ice, zemp_oce, ztprecip, zsprecip, zevap_oce, zevap_ice, zdevap_ice )1594 CALL wrk_alloc( jpi,jpj, zqns_tot, zqns_oce, zqsr_tot, zqsr_oce, zqprec_ice, zqemp_oce, zqemp_ice )1595 CALL wrk_alloc( jpi,jpj,jpl, zqns_ice, zqsr_ice, zdqns_ice, zqevap_ice )1596 1597 1593 IF( ln_mixcpl ) zmsk(:,:) = 1. - xcplmask(:,:,0) 1598 ziceld(:,:) = 1. - picefr(:,:)1599 zcptn (:,:) = rcp * sst_m(:,:)1594 ziceld(:,:) = 1._wp - picefr(:,:) 1595 zcptn (:,:) = rcp * sst_m(:,:) 1600 1596 ! 1601 1597 ! ! ========================= ! … … 1622 1618 #if defined key_lim3 1623 1619 ! zsnw = snow fraction over ice after wind blowing (=picefr if no blowing) 1624 zsnw(:,:) = 0._wp ;CALL ice_thd_snwblow( ziceld, zsnw )1620 zsnw(:,:) = 0._wp ; CALL ice_thd_snwblow( ziceld, zsnw ) 1625 1621 1626 1622 ! --- evaporation minus precipitation corrected (because of wind blowing on snow) --- ! … … 1659 1655 sprecip(:,:) = sprecip(:,:) * xcplmask(:,:,0) + zsprecip(:,:) * zmsk(:,:) 1660 1656 tprecip(:,:) = tprecip(:,:) * xcplmask(:,:,0) + ztprecip(:,:) * zmsk(:,:) 1661 DO jl =1,jpl1657 DO jl = 1, jpl 1662 1658 evap_ice (:,:,jl) = evap_ice (:,:,jl) * xcplmask(:,:,0) + zevap_ice (:,:) * zmsk(:,:) 1663 1659 devap_ice(:,:,jl) = devap_ice(:,:,jl) * xcplmask(:,:,0) + zdevap_ice(:,:) * zmsk(:,:) 1664 END DO1660 END DO 1665 1661 ELSE 1666 emp_tot(:,:) = 1667 emp_ice(:,:) = 1668 emp_oce(:,:) = 1669 sprecip(:,:) = 1670 tprecip(:,:) = 1671 DO jl =1,jpl1662 emp_tot(:,:) = zemp_tot(:,:) 1663 emp_ice(:,:) = zemp_ice(:,:) 1664 emp_oce(:,:) = zemp_oce(:,:) 1665 sprecip(:,:) = zsprecip(:,:) 1666 tprecip(:,:) = ztprecip(:,:) 1667 DO jl = 1, jpl 1672 1668 evap_ice (:,:,jl) = zevap_ice (:,:) 1673 1669 devap_ice(:,:,jl) = zdevap_ice(:,:) 1674 END DO1670 END DO 1675 1671 ENDIF 1676 1672 … … 1691 1687 fwfisf(:,:) = - frcv(jpr_isf)%z3(:,:,1) 1692 1688 ENDIF 1693 1689 ! 1694 1690 IF( ln_mixcpl ) THEN 1695 1691 emp_tot(:,:) = emp_tot(:,:) * xcplmask(:,:,0) + zemp_tot(:,:) * zmsk(:,:) … … 1703 1699 tprecip(:,:) = ztprecip(:,:) 1704 1700 ENDIF 1705 1701 ! 1706 1702 #endif 1703 1707 1704 ! outputs 1708 1705 !! IF( srcv(jpr_rnf)%laction ) CALL iom_put( 'runoffs' , rnf(:,:) * tmask(:,:,1) ) ! runoff … … 1730 1727 zqns_ice(:,:,1:jpl) = frcv(jpr_qnsice)%z3(:,:,1:jpl) 1731 1728 ELSE 1732 DO jl =1,jpl1729 DO jl = 1, jpl 1733 1730 zqns_ice(:,:,jl) = frcv(jpr_qnsice)%z3(:,:,1) ! Set all category values equal 1734 END DO1731 END DO 1735 1732 ENDIF 1736 1733 CASE( 'oce and ice' ) ! the total flux is computed from ocean and ice fluxes … … 1743 1740 ELSE 1744 1741 qns_tot(:,:) = qns_tot(:,:) + picefr(:,:) * frcv(jpr_qnsice)%z3(:,:,1) 1745 DO jl =1,jpl1742 DO jl = 1, jpl 1746 1743 zqns_tot(:,: ) = zqns_tot(:,:) + picefr(:,:) * frcv(jpr_qnsice)%z3(:,:,1) 1747 1744 zqns_ice(:,:,jl) = frcv(jpr_qnsice)%z3(:,:,1) 1748 END DO1745 END DO 1749 1746 ENDIF 1750 1747 CASE( 'mixed oce-ice' ) ! the ice flux is cumputed from the total flux, the SST and ice informations … … 1766 1763 ! note: ziceld cannot be = 0 since we limit the ice concentration to amax 1767 1764 zqns_oce = 0._wp 1768 WHERE( ziceld /= 0._wp ) zqns_oce(:,:) = ( zqns_tot(:,:) - SUM( a_i * zqns_ice, dim=3 ) ) / ziceld(:,:)1765 WHERE( ziceld /= 0._wp ) zqns_oce(:,:) = ( zqns_tot(:,:) - SUM( a_i * zqns_ice, dim=3 ) ) / ziceld(:,:) 1769 1766 1770 1767 ! Heat content per unit mass of snow (J/kg) … … 1859 1856 ELSE 1860 1857 ! Set all category values equal for the moment 1861 DO jl =1,jpl1858 DO jl = 1, jpl 1862 1859 zqsr_ice(:,:,jl) = frcv(jpr_qsrice)%z3(:,:,1) 1863 END DO1860 END DO 1864 1861 ENDIF 1865 1862 zqsr_tot(:,: ) = frcv(jpr_qsrmix)%z3(:,:,1) … … 1868 1865 zqsr_tot(:,: ) = ziceld(:,:) * frcv(jpr_qsroce)%z3(:,:,1) 1869 1866 IF ( TRIM(sn_rcv_qsr%clcat) == 'yes' ) THEN 1870 DO jl =1,jpl1867 DO jl = 1, jpl 1871 1868 zqsr_tot(:,: ) = zqsr_tot(:,:) + a_i(:,:,jl) * frcv(jpr_qsrice)%z3(:,:,jl) 1872 1869 zqsr_ice(:,:,jl) = frcv(jpr_qsrice)%z3(:,:,jl) 1873 END DO1870 END DO 1874 1871 ELSE 1875 1872 qsr_tot(:,: ) = qsr_tot(:,:) + picefr(:,:) * frcv(jpr_qsrice)%z3(:,:,1) 1876 DO jl =1,jpl1873 DO jl = 1, jpl 1877 1874 zqsr_tot(:,: ) = zqsr_tot(:,:) + picefr(:,:) * frcv(jpr_qsrice)%z3(:,:,1) 1878 1875 zqsr_ice(:,:,jl) = frcv(jpr_qsrice)%z3(:,:,1) 1879 END DO1876 END DO 1880 1877 ENDIF 1881 1878 CASE( 'mixed oce-ice' ) … … 1890 1887 IF( ln_dm2dc .AND. ln_cpl ) THEN ! modify qsr to include the diurnal cycle 1891 1888 zqsr_tot(:,: ) = sbc_dcy( zqsr_tot(:,: ) ) 1892 DO jl =1,jpl1889 DO jl = 1, jpl 1893 1890 zqsr_ice(:,:,jl) = sbc_dcy( zqsr_ice(:,:,jl) ) 1894 END DO1891 END DO 1895 1892 ENDIF 1896 1893 … … 1908 1905 qsr_tot(:,:) = qsr(:,:) * ziceld(:,:) + SUM( qsr_ice(:,:,:) * a_i(:,:,:), dim=3 ) ! total flux from blk 1909 1906 qsr_tot(:,:) = qsr_tot(:,:) * xcplmask(:,:,0) + zqsr_tot(:,:)* zmsk(:,:) 1910 DO jl =1,jpl1907 DO jl = 1, jpl 1911 1908 qsr_ice(:,:,jl) = qsr_ice(:,:,jl) * xcplmask(:,:,0) + zqsr_ice(:,:,jl)* zmsk(:,:) 1912 END DO1909 END DO 1913 1910 ELSE 1914 1911 qsr_tot(:,: ) = zqsr_tot(:,: ) … … 1946 1943 END SELECT 1947 1944 1948 ! Surface transimission parameter io (Maykut Untersteiner , 1971 ; Ebert and Curry, 1993 ) 1949 ! Used for LIM3 1950 ! Coupled case: since cloud cover is not received from atmosphere 1951 ! ===> used prescribed cloud fraction representative for polar oceans in summer (0.81) 1952 fr1_i0(:,:) = ( 0.18 * ( 1.0 - cldf_ice ) + 0.35 * cldf_ice ) 1953 fr2_i0(:,:) = ( 0.82 * ( 1.0 - cldf_ice ) + 0.65 * cldf_ice ) 1954 1955 CALL wrk_dealloc( jpi,jpj, zcptn, zcptrain, zcptsnw, ziceld, zmsk, zsnw ) 1956 CALL wrk_dealloc( jpi,jpj, zemp_tot, zemp_ice, zemp_oce, ztprecip, zsprecip, zevap_oce, zevap_ice, zdevap_ice ) 1957 CALL wrk_dealloc( jpi,jpj, zqns_tot, zqns_oce, zqsr_tot, zqsr_oce, zqprec_ice, zqemp_oce, zqemp_ice ) 1958 CALL wrk_dealloc( jpi,jpj,jpl, zqns_ice, zqsr_ice, zdqns_ice, zqevap_ice ) 1945 ! ! ========================= ! 1946 ! ! Transmitted Qsr ! [W/m2] 1947 ! ! ========================= ! 1948 SELECT CASE( nice_jules ) 1949 CASE( np_jules_OFF ) !== No Jules coupler ==! 1950 ! 1951 !!gm ! former coding was 1952 !!gm ! Coupled case: since cloud cover is not received from atmosphere 1953 !!gm ! ===> used prescribed cloud fraction representative for polar oceans in summer (0.81) 1954 !!gm ! fr1_i0(:,:) = ( 0.18 * ( 1.0 - cldf_ice ) + 0.35 * cldf_ice ) 1955 !!gm ! fr2_i0(:,:) = ( 0.82 * ( 1.0 - cldf_ice ) + 0.65 * cldf_ice ) 1956 !!gm 1957 !!gm ! to retrieve that coding, we needed to access h_i & h_s from here 1958 !!gm ! we could even retrieve cloud fraction from the coupler 1959 !!gm ! 1960 !!gm zfrqsr_tr_i(:,:,:) = 0._wp ! surface transmission parameter 1961 !!gm ! 1962 !!gm DO jl = 1, jpl 1963 !!gm DO jj = 1 , jpj 1964 !!gm DO ji = 1, jpi 1965 !!gm ! !--- surface transmission parameter (Grenfell Maykut 77) --- ! 1966 !!gm zfrqsr_tr_i(ji,jj,jl) = 0.18 * ( 1.0 - cldf_ice ) + 0.35 * cldf_ice 1967 !!gm ! 1968 !!gm ! ! --- influence of snow and thin ice --- ! 1969 !!gm IF ( phs(ji,jj,jl) >= 0.0_wp ) zfrqsr_tr_i(ji,jj,jl) = 0._wp ! snow fully opaque 1970 !!gm IF ( phi(ji,jj,jl) <= 0.1_wp ) zfrqsr_tr_i(ji,jj,jl) = 1._wp ! thin ice transmits all solar radiation 1971 !!gm END DO 1972 !!gm END DO 1973 !!gm END DO 1974 !!gm ! 1975 !!gm qsr_ice_tr(:,:,:) = zfrqsr_tr_i(:,:,:) * qsr_ice(:,:,:) ! transmitted solar radiation 1976 !!gm ! 1977 !!gm better coding of the above calculation: 1978 ! 1979 ! ! ===> used prescribed cloud fraction representative for polar oceans in summer (0.81) 1980 ztri = 0.18 * ( 1.0 - cldf_ice ) + 0.35 * cldf_ice ! surface transmission parameter (Grenfell Maykut 77) 1981 ! 1982 qsr_ice_tr(:,:,:) = ztri * qsr_ice(:,:,:) 1983 WHERE( phs(:,:,:) >= 0.0_wp ) qsr_ice_tr(:,:,:) = 0._wp ! snow fully opaque 1984 WHERE( phi(:,:,:) <= 0.1_wp ) qsr_ice_tr(:,:,:) = qsr_ice(:,:,:) ! thin ice transmits all solar radiation 1985 !!gm end 1986 ! 1987 CASE( np_jules_ACTIVE ) !== Jules coupler is active ==! 1988 ! 1989 ! ! ===> here we must receive the qsr_ice_tr array from the coupler 1990 ! for now just assume zero (fully opaque ice) 1991 qsr_ice_tr(:,:,:) = 0._wp 1992 ! 1993 END SELECT 1959 1994 ! 1960 1995 IF( nn_timing == 1 ) CALL timing_stop('sbc_cpl_ice_flx') … … 2081 2116 IF( ssnd(jps_albmix)%laction ) THEN ! mixed ice-ocean 2082 2117 ztmp1(:,:) = alb_oce_mix(:,:) * zfr_l(:,:) 2083 DO jl =1,jpl2118 DO jl = 1, jpl 2084 2119 ztmp1(:,:) = ztmp1(:,:) + alb_ice(:,:,jl) * a_i(:,:,jl) 2085 2120 END DO -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90
r8586 r8813 710 710 ! ! Prepare Coupling fields ! 711 711 ! ! =========================== ! 712 713 ! x and y comp of ice velocity714 712 ! 713 ! x and y comp of ice velocity 714 ! 715 715 CALL cice2nemo(uvel,u_ice,'F', -1. ) 716 716 CALL cice2nemo(vvel,v_ice,'F', -1. ) 717 718 ! Ice concentration (CO_1) = a_i calculated at end of cice_sbc_out719 720 ! Snow and ice thicknesses (CO_2 and CO_3)721 722 DO jl = 1, ncat717 ! 718 ! Ice concentration (CO_1) = a_i calculated at end of cice_sbc_out 719 ! 720 ! Snow and ice thicknesses (CO_2 and CO_3) 721 ! 722 DO jl = 1, ncat 723 723 CALL cice2nemo( vsnon(:,:,jl,:), h_s(:,:,jl),'T', 1. ) 724 724 CALL cice2nemo( vicen(:,:,jl,:), h_i(:,:,jl),'T', 1. ) 725 END DO725 END DO 726 726 ! 727 727 IF( nn_timing == 1 ) CALL timing_stop('cice_sbc_hadgam') -
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90
r8586 r8813 21 21 ! 22 22 USE in_out_manager ! I/O manager 23 USE iom ! I/O managerlibrary23 USE iom ! I/O library 24 24 USE fldread ! read input field at current time step 25 25 USE lbclnk ! … … 41 41 REAL(wp), PUBLIC :: rn_gammas0 !: salinity exchange coeficient [] 42 42 43 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: risf_tsc_b, risf_tsc !: before and now T & S isf contents [K.m/s & PSU.m/s]44 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: qisf !: net heat flux from ice shelf [W/m2]45 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: rzisf_tbl !:depth of calving front (shallowest point) nn_isf ==2/346 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: rhisf_tbl, rhisf_tbl_0 !:thickness of tbl [m]47 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: r1_hisf_tbl !:1/thickness of tbl48 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: ralpha !:proportion of bottom cell influenced by tbl49 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: risfLeff !:effective length (Leff) BG03 nn_isf==250 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: ttbl, stbl, utbl, vtbl !:top boundary layer variable at T point51 INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: misfkt, misfkb !:Level of ice shelf base52 53 LOGICAL, PUBLIC :: l_isfcpl = .false. ! isf recieved from oasis54 55 REAL(wp), PUBLIC, SAVE :: rcpi = 2000.0_wp ! specific heat of ice shelf [J/kg/K]56 REAL(wp), PUBLIC, SAVE :: rkappa = 1.54e-6_wp ! heat diffusivity through the ice-shelf [m2/s]57 REAL(wp), PUBLIC, SAVE :: rhoisf = 920.0_wp ! volumic mass of ice shelf [kg/m3]58 REAL(wp), PUBLIC, SAVE :: tsurf = -20.0_wp ! air temperature on top of ice shelf [C]59 REAL(wp), PUBLIC, SAVE :: rlfusisf = 0.334e6_wp ! latent heat of fusion of ice shelf [J/kg]43 INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: misfkt , misfkb !: Level of ice shelf base 44 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: rzisf_tbl !: depth of calving front (shallowest point) nn_isf ==2/3 45 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: rhisf_tbl, rhisf_tbl_0 !: thickness of tbl [m] 46 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: r1_hisf_tbl !: 1/thickness of tbl 47 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: ralpha !: proportion of bottom cell influenced by tbl 48 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: risfLeff !: effective length (Leff) BG03 nn_isf==2 49 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: ttbl, stbl, utbl, vtbl !: top boundary layer variable at T point 50 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: qisf !: net heat flux from ice shelf [W/m2] 51 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: risf_tsc_b, risf_tsc !: before and now T & S isf contents [K.m/s & PSU.m/s] 52 53 LOGICAL, PUBLIC :: l_isfcpl = .false. !: isf recieved from oasis 54 55 REAL(wp), PUBLIC, SAVE :: rcpi = 2000.0_wp !: specific heat of ice shelf [J/kg/K] 56 REAL(wp), PUBLIC, SAVE :: rkappa = 1.54e-6_wp !: heat diffusivity through the ice-shelf [m2/s] 57 REAL(wp), PUBLIC, SAVE :: rhoisf = 920.0_wp !: volumic mass of ice shelf [kg/m3] 58 REAL(wp), PUBLIC, SAVE :: tsurf = -20.0_wp !: air temperature on top of ice shelf [C] 59 REAL(wp), PUBLIC, SAVE :: rlfusisf = 0.334e6_wp !: latent heat of fusion of ice shelf [J/kg] 60 60 61 61 !: Variable used in fldread to read the forcing file (nn_isf == 4 .OR. nn_isf == 3) … … 70 70 71 71 !!---------------------------------------------------------------------- 72 !! NEMO/OPA 3.7 , LOCEAN-IPSL (2015)72 !! NEMO/OPA 4.0 , LOCEAN-IPSL (2017) 73 73 !! $Id$ 74 74 !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) … … 91 91 INTEGER, INTENT(in) :: kt ! ocean time step 92 92 ! 93 INTEGER :: ji, jj, jk ! loop index94 INTEGER :: ikt, ikb ! local integers93 INTEGER :: ji, jj, jk ! loop index 94 INTEGER :: ikt, ikb ! local integers 95 95 REAL(wp), DIMENSION(jpi,jpj) :: zt_frz, zdep ! freezing temperature (zt_frz) at depth (zdep) 96 96 REAL(wp), DIMENSION(:,:) , ALLOCATABLE :: zqhcisf2d
Note: See TracChangeset
for help on using the changeset viewer.