[2874] | 1 | MODULE sbcice_cice |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE sbcice_cice *** |
---|
| 4 | !! To couple with sea ice model CICE (LANL) |
---|
| 5 | !!===================================================================== |
---|
| 6 | #if defined key_cice |
---|
| 7 | !!---------------------------------------------------------------------- |
---|
| 8 | !! 'key_cice' : CICE sea-ice model |
---|
| 9 | !!---------------------------------------------------------------------- |
---|
| 10 | !! sbc_ice_cice : sea-ice model time-stepping and update ocean sbc over ice-covered area |
---|
| 11 | !! |
---|
| 12 | !! |
---|
| 13 | !!---------------------------------------------------------------------- |
---|
| 14 | USE oce ! ocean dynamics and tracers |
---|
| 15 | USE dom_oce ! ocean space and time domain |
---|
[3275] | 16 | USE domvvl |
---|
[3625] | 17 | USE phycst, only : rcp, rau0, r1_rau0, rhosn, rhoic |
---|
[2874] | 18 | USE in_out_manager ! I/O manager |
---|
[4990] | 19 | USE iom, ONLY : iom_put,iom_use ! I/O manager library !!Joakim edit |
---|
[2874] | 20 | USE lib_mpp ! distributed memory computing library |
---|
| 21 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
[3186] | 22 | USE wrk_nemo ! work arrays |
---|
[3193] | 23 | USE timing ! Timing |
---|
[2874] | 24 | USE daymod ! calendar |
---|
| 25 | USE fldread ! read input fields |
---|
| 26 | USE sbc_oce ! Surface boundary condition: ocean fields |
---|
| 27 | USE sbc_ice ! Surface boundary condition: ice fields |
---|
| 28 | USE sbcblk_core ! Surface boundary condition: CORE bulk |
---|
| 29 | USE sbccpl |
---|
| 30 | |
---|
| 31 | USE ice_kinds_mod |
---|
| 32 | USE ice_blocks |
---|
| 33 | USE ice_domain |
---|
| 34 | USE ice_domain_size |
---|
| 35 | USE ice_boundary |
---|
| 36 | USE ice_constants |
---|
| 37 | USE ice_gather_scatter |
---|
| 38 | USE ice_calendar, only: dt |
---|
[5030] | 39 | # if defined key_cice4 |
---|
[3625] | 40 | USE ice_state, only: aice,aicen,uvel,vvel,vsno,vsnon,vice,vicen |
---|
[2874] | 41 | USE ice_flux, only: strax,stray,strocnx,strocny,frain,fsnow, & |
---|
[3189] | 42 | sst,sss,uocn,vocn,ss_tltx,ss_tlty,fsalt_gbm, & |
---|
| 43 | fresh_gbm,fhocn_gbm,fswthru_gbm,frzmlt, & |
---|
[2874] | 44 | flatn_f,fsurfn_f,fcondtopn_f, & |
---|
| 45 | uatm,vatm,wind,fsw,flw,Tair,potT,Qa,rhoa,zlvl, & |
---|
| 46 | swvdr,swvdf,swidr,swidf |
---|
[4990] | 47 | USE ice_therm_vertical, only: calc_Tsfc |
---|
| 48 | #else |
---|
[5030] | 49 | USE ice_state, only: aice,aicen,uvel,nt_hpnd,trcrn,vvel,vsno,& |
---|
| 50 | vsnon,vice,vicen |
---|
[4990] | 51 | USE ice_flux, only: strax,stray,strocnx,strocny,frain,fsnow, & |
---|
| 52 | sst,sss,uocn,vocn,ss_tltx,ss_tlty,fsalt_ai, & |
---|
| 53 | fresh_ai,fhocn_ai,fswthru_ai,frzmlt, & |
---|
| 54 | flatn_f,fsurfn_f,fcondtopn_f, & |
---|
| 55 | uatm,vatm,wind,fsw,flw,Tair,potT,Qa,rhoa,zlvl, & |
---|
| 56 | swvdr,swvdf,swidr,swidf |
---|
| 57 | USE ice_therm_shared, only: calc_Tsfc |
---|
[5030] | 58 | USE ice_shortwave, only: apeffn |
---|
[4990] | 59 | #endif |
---|
[2874] | 60 | USE ice_forcing, only: frcvdr,frcvdf,frcidr,frcidf |
---|
[3176] | 61 | USE ice_atmo, only: calc_strair |
---|
[2874] | 62 | |
---|
| 63 | USE CICE_InitMod |
---|
| 64 | USE CICE_RunMod |
---|
| 65 | USE CICE_FinalMod |
---|
| 66 | |
---|
| 67 | IMPLICIT NONE |
---|
| 68 | PRIVATE |
---|
| 69 | |
---|
| 70 | !! * Routine accessibility |
---|
| 71 | PUBLIC cice_sbc_init ! routine called by sbc_init |
---|
| 72 | PUBLIC cice_sbc_final ! routine called by sbc_final |
---|
| 73 | PUBLIC sbc_ice_cice ! routine called by sbc |
---|
| 74 | |
---|
[4627] | 75 | INTEGER :: ji_off |
---|
| 76 | INTEGER :: jj_off |
---|
[3625] | 77 | |
---|
[2874] | 78 | INTEGER , PARAMETER :: jpfld = 13 ! maximum number of files to read |
---|
| 79 | INTEGER , PARAMETER :: jp_snow = 1 ! index of snow file |
---|
| 80 | INTEGER , PARAMETER :: jp_rain = 2 ! index of rain file |
---|
| 81 | INTEGER , PARAMETER :: jp_sblm = 3 ! index of sublimation file |
---|
| 82 | INTEGER , PARAMETER :: jp_top1 = 4 ! index of category 1 topmelt file |
---|
| 83 | INTEGER , PARAMETER :: jp_top2 = 5 ! index of category 2 topmelt file |
---|
| 84 | INTEGER , PARAMETER :: jp_top3 = 6 ! index of category 3 topmelt file |
---|
| 85 | INTEGER , PARAMETER :: jp_top4 = 7 ! index of category 4 topmelt file |
---|
| 86 | INTEGER , PARAMETER :: jp_top5 = 8 ! index of category 5 topmelt file |
---|
| 87 | INTEGER , PARAMETER :: jp_bot1 = 9 ! index of category 1 botmelt file |
---|
| 88 | INTEGER , PARAMETER :: jp_bot2 = 10 ! index of category 2 botmelt file |
---|
| 89 | INTEGER , PARAMETER :: jp_bot3 = 11 ! index of category 3 botmelt file |
---|
| 90 | INTEGER , PARAMETER :: jp_bot4 = 12 ! index of category 4 botmelt file |
---|
| 91 | INTEGER , PARAMETER :: jp_bot5 = 13 ! index of category 5 botmelt file |
---|
| 92 | TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf ! structure of input fields (file informations, fields read) |
---|
| 93 | |
---|
| 94 | REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:), PRIVATE :: png ! local array used in sbc_cice_ice |
---|
| 95 | |
---|
| 96 | !! * Substitutions |
---|
| 97 | # include "domzgr_substitute.h90" |
---|
| 98 | |
---|
| 99 | CONTAINS |
---|
| 100 | |
---|
| 101 | INTEGER FUNCTION sbc_ice_cice_alloc() |
---|
| 102 | !!---------------------------------------------------------------------- |
---|
| 103 | !! *** FUNCTION sbc_ice_cice_alloc *** |
---|
| 104 | !!---------------------------------------------------------------------- |
---|
| 105 | ALLOCATE( png(jpi,jpj,jpnij), STAT=sbc_ice_cice_alloc ) |
---|
| 106 | IF( lk_mpp ) CALL mpp_sum ( sbc_ice_cice_alloc ) |
---|
| 107 | IF( sbc_ice_cice_alloc > 0 ) CALL ctl_warn('sbc_ice_cice_alloc: allocation of arrays failed.') |
---|
| 108 | END FUNCTION sbc_ice_cice_alloc |
---|
| 109 | |
---|
[4990] | 110 | SUBROUTINE sbc_ice_cice( kt, ksbc ) |
---|
[2874] | 111 | !!--------------------------------------------------------------------- |
---|
| 112 | !! *** ROUTINE sbc_ice_cice *** |
---|
| 113 | !! |
---|
| 114 | !! ** Purpose : update the ocean surface boundary condition via the |
---|
| 115 | !! CICE Sea Ice Model time stepping |
---|
| 116 | !! |
---|
[3040] | 117 | !! ** Method : - Get any extra forcing fields for CICE |
---|
| 118 | !! - Prepare forcing fields |
---|
[2874] | 119 | !! - CICE model time stepping |
---|
| 120 | !! - call the routine that computes mass and |
---|
| 121 | !! heat fluxes at the ice/ocean interface |
---|
| 122 | !! |
---|
| 123 | !! ** Action : - time evolution of the CICE sea-ice model |
---|
| 124 | !! - update all sbc variables below sea-ice: |
---|
[3625] | 125 | !! utau, vtau, qns , qsr, emp , sfx |
---|
[2874] | 126 | !!--------------------------------------------------------------------- |
---|
| 127 | INTEGER, INTENT(in) :: kt ! ocean time step |
---|
[4990] | 128 | INTEGER, INTENT(in) :: ksbc ! surface forcing type |
---|
[2874] | 129 | !!---------------------------------------------------------------------- |
---|
[3193] | 130 | ! |
---|
| 131 | IF( nn_timing == 1 ) CALL timing_start('sbc_ice_cice') |
---|
| 132 | ! |
---|
[2874] | 133 | ! !----------------------! |
---|
| 134 | IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN ! Ice time-step only ! |
---|
| 135 | ! !----------------------! |
---|
| 136 | |
---|
| 137 | ! Make sure any fluxes required for CICE are set |
---|
[4990] | 138 | IF ( ksbc == jp_flx ) THEN |
---|
[2874] | 139 | CALL cice_sbc_force(kt) |
---|
[4990] | 140 | ELSE IF ( ksbc == jp_cpl ) THEN |
---|
[2874] | 141 | CALL sbc_cpl_ice_flx( 1.0-fr_i ) |
---|
| 142 | ENDIF |
---|
| 143 | |
---|
[4990] | 144 | CALL cice_sbc_in ( kt, ksbc ) |
---|
[2874] | 145 | CALL CICE_Run |
---|
[4990] | 146 | CALL cice_sbc_out ( kt, ksbc ) |
---|
[2874] | 147 | |
---|
[4990] | 148 | IF ( ksbc == jp_cpl ) CALL cice_sbc_hadgam(kt+1) |
---|
[2874] | 149 | |
---|
| 150 | ENDIF ! End sea-ice time step only |
---|
[3193] | 151 | ! |
---|
| 152 | IF( nn_timing == 1 ) CALL timing_stop('sbc_ice_cice') |
---|
[2874] | 153 | |
---|
| 154 | END SUBROUTINE sbc_ice_cice |
---|
| 155 | |
---|
[4990] | 156 | SUBROUTINE cice_sbc_init (ksbc) |
---|
[2874] | 157 | !!--------------------------------------------------------------------- |
---|
| 158 | !! *** ROUTINE cice_sbc_init *** |
---|
[3040] | 159 | !! ** Purpose: Initialise ice related fields for NEMO and coupling |
---|
[2874] | 160 | !! |
---|
[4990] | 161 | INTEGER, INTENT( in ) :: ksbc ! surface forcing type |
---|
[3625] | 162 | REAL(wp), DIMENSION(:,:), POINTER :: ztmp1, ztmp2 |
---|
| 163 | REAL(wp) :: zcoefu, zcoefv, zcoeff ! local scalar |
---|
[4990] | 164 | INTEGER :: ji, jj, jl, jk ! dummy loop indices |
---|
[2874] | 165 | !!--------------------------------------------------------------------- |
---|
| 166 | |
---|
[3193] | 167 | IF( nn_timing == 1 ) CALL timing_start('cice_sbc_init') |
---|
| 168 | ! |
---|
[3625] | 169 | CALL wrk_alloc( jpi,jpj, ztmp1, ztmp2 ) |
---|
| 170 | ! |
---|
[2874] | 171 | IF(lwp) WRITE(numout,*)'cice_sbc_init' |
---|
| 172 | |
---|
[4627] | 173 | ji_off = INT ( (jpiglo - nx_global) / 2 ) |
---|
| 174 | jj_off = INT ( (jpjglo - ny_global) / 2 ) |
---|
| 175 | |
---|
[4990] | 176 | #if defined key_nemocice_decomp |
---|
| 177 | ! Pass initial SST from NEMO to CICE so ice is initialised correctly if |
---|
| 178 | ! there is no restart file. |
---|
| 179 | ! Values from a CICE restart file would overwrite this |
---|
| 180 | IF ( .NOT. ln_rstart ) THEN |
---|
| 181 | CALL nemo2cice( tsn(:,:,1,jp_tem) , sst , 'T' , 1.) |
---|
| 182 | ENDIF |
---|
| 183 | #endif |
---|
| 184 | |
---|
[2874] | 185 | ! Initialize CICE |
---|
[3176] | 186 | CALL CICE_Initialize |
---|
[2874] | 187 | |
---|
[3176] | 188 | ! Do some CICE consistency checks |
---|
[4990] | 189 | IF ( (ksbc == jp_flx) .OR. (ksbc == jp_cpl) ) THEN |
---|
[3193] | 190 | IF ( calc_strair .OR. calc_Tsfc ) THEN |
---|
| 191 | CALL ctl_stop( 'STOP', 'cice_sbc_init : Forcing option requires calc_strair=F and calc_Tsfc=F in ice_in' ) |
---|
| 192 | ENDIF |
---|
[4990] | 193 | ELSEIF (ksbc == jp_core) THEN |
---|
[3193] | 194 | IF ( .NOT. (calc_strair .AND. calc_Tsfc) ) THEN |
---|
| 195 | CALL ctl_stop( 'STOP', 'cice_sbc_init : Forcing option requires calc_strair=T and calc_Tsfc=T in ice_in' ) |
---|
| 196 | ENDIF |
---|
| 197 | ENDIF |
---|
[3176] | 198 | |
---|
| 199 | |
---|
[2874] | 200 | ! allocate sbc_ice and sbc_cice arrays |
---|
| 201 | IF( sbc_ice_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'sbc_ice_cice_alloc : unable to allocate arrays' ) |
---|
| 202 | IF( sbc_ice_cice_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'sbc_ice_cice_alloc : unable to allocate cice arrays' ) |
---|
| 203 | |
---|
| 204 | ! Ensure ocean temperatures are nowhere below freezing if not a NEMO restart |
---|
| 205 | IF( .NOT. ln_rstart ) THEN |
---|
| 206 | tsn(:,:,:,jp_tem) = MAX (tsn(:,:,:,jp_tem),Tocnfrz) |
---|
| 207 | tsb(:,:,:,jp_tem) = tsn(:,:,:,jp_tem) |
---|
| 208 | ENDIF |
---|
| 209 | |
---|
[3193] | 210 | fr_iu(:,:)=0.0 |
---|
| 211 | fr_iv(:,:)=0.0 |
---|
[2874] | 212 | |
---|
[3193] | 213 | CALL cice2nemo(aice,fr_i, 'T', 1. ) |
---|
[4990] | 214 | IF ( (ksbc == jp_flx) .OR. (ksbc == jp_cpl) ) THEN |
---|
[3625] | 215 | DO jl=1,ncat |
---|
| 216 | CALL cice2nemo(aicen(:,:,jl,:),a_i(:,:,jl), 'T', 1. ) |
---|
[3193] | 217 | ENDDO |
---|
| 218 | ENDIF |
---|
[2874] | 219 | |
---|
| 220 | ! T point to U point |
---|
| 221 | ! T point to V point |
---|
[3193] | 222 | DO jj=1,jpjm1 |
---|
| 223 | DO ji=1,jpim1 |
---|
| 224 | fr_iu(ji,jj)=0.5*(fr_i(ji,jj)+fr_i(ji+1,jj))*umask(ji,jj,1) |
---|
| 225 | fr_iv(ji,jj)=0.5*(fr_i(ji,jj)+fr_i(ji,jj+1))*vmask(ji,jj,1) |
---|
| 226 | ENDDO |
---|
| 227 | ENDDO |
---|
[2874] | 228 | |
---|
[3193] | 229 | CALL lbc_lnk ( fr_iu , 'U', 1. ) |
---|
| 230 | CALL lbc_lnk ( fr_iv , 'V', 1. ) |
---|
[3625] | 231 | |
---|
| 232 | ! ! embedded sea ice |
---|
| 233 | IF( nn_ice_embd /= 0 ) THEN ! mass exchanges between ice and ocean (case 1 or 2) set the snow+ice mass |
---|
| 234 | CALL cice2nemo(vsno(:,:,:),ztmp1,'T', 1. ) |
---|
| 235 | CALL cice2nemo(vice(:,:,:),ztmp2,'T', 1. ) |
---|
| 236 | snwice_mass (:,:) = ( rhosn * ztmp1(:,:) + rhoic * ztmp2(:,:) ) |
---|
| 237 | snwice_mass_b(:,:) = snwice_mass(:,:) |
---|
| 238 | ELSE |
---|
| 239 | snwice_mass (:,:) = 0.0_wp ! no mass exchanges |
---|
| 240 | snwice_mass_b(:,:) = 0.0_wp ! no mass exchanges |
---|
| 241 | ENDIF |
---|
[4990] | 242 | IF( .NOT. ln_rstart ) THEN |
---|
| 243 | IF( nn_ice_embd == 2 ) THEN ! full embedment (case 2) deplete the initial ssh below sea-ice area |
---|
| 244 | sshn(:,:) = sshn(:,:) - snwice_mass(:,:) * r1_rau0 |
---|
| 245 | sshb(:,:) = sshb(:,:) - snwice_mass(:,:) * r1_rau0 |
---|
| 246 | #if defined key_vvl |
---|
| 247 | ! key_vvl necessary? clem: yes for compilation purpose |
---|
| 248 | DO jk = 1,jpkm1 ! adjust initial vertical scale factors |
---|
| 249 | fse3t_n(:,:,jk) = e3t_0(:,:,jk)*( 1._wp + sshn(:,:)*tmask(:,:,1)/(ht_0(:,:) + 1.0 - tmask(:,:,1)) ) |
---|
| 250 | fse3t_b(:,:,jk) = e3t_0(:,:,jk)*( 1._wp + sshb(:,:)*tmask(:,:,1)/(ht_0(:,:) + 1.0 - tmask(:,:,1)) ) |
---|
| 251 | ENDDO |
---|
| 252 | fse3t_a(:,:,:) = fse3t_b(:,:,:) |
---|
| 253 | ! Reconstruction of all vertical scale factors at now and before time |
---|
| 254 | ! steps |
---|
| 255 | ! ============================================================================= |
---|
| 256 | ! Horizontal scale factor interpolations |
---|
| 257 | ! -------------------------------------- |
---|
| 258 | CALL dom_vvl_interpol( fse3t_b(:,:,:), fse3u_b(:,:,:), 'U' ) |
---|
| 259 | CALL dom_vvl_interpol( fse3t_b(:,:,:), fse3v_b(:,:,:), 'V' ) |
---|
| 260 | CALL dom_vvl_interpol( fse3t_n(:,:,:), fse3u_n(:,:,:), 'U' ) |
---|
| 261 | CALL dom_vvl_interpol( fse3t_n(:,:,:), fse3v_n(:,:,:), 'V' ) |
---|
| 262 | CALL dom_vvl_interpol( fse3u_n(:,:,:), fse3f_n(:,:,:), 'F' ) |
---|
| 263 | ! Vertical scale factor interpolations |
---|
| 264 | ! ------------------------------------ |
---|
| 265 | CALL dom_vvl_interpol( fse3t_n(:,:,:), fse3w_n (:,:,:), 'W' ) |
---|
| 266 | CALL dom_vvl_interpol( fse3u_n(:,:,:), fse3uw_n(:,:,:), 'UW' ) |
---|
| 267 | CALL dom_vvl_interpol( fse3v_n(:,:,:), fse3vw_n(:,:,:), 'VW' ) |
---|
| 268 | CALL dom_vvl_interpol( fse3u_b(:,:,:), fse3uw_b(:,:,:), 'UW' ) |
---|
| 269 | CALL dom_vvl_interpol( fse3v_b(:,:,:), fse3vw_b(:,:,:), 'VW' ) |
---|
| 270 | ! t- and w- points depth |
---|
| 271 | ! ---------------------- |
---|
| 272 | fsdept_n(:,:,1) = 0.5_wp * fse3w_n(:,:,1) |
---|
| 273 | fsdepw_n(:,:,1) = 0.0_wp |
---|
| 274 | fsde3w_n(:,:,1) = fsdept_n(:,:,1) - sshn(:,:) |
---|
| 275 | DO jk = 2, jpk |
---|
| 276 | fsdept_n(:,:,jk) = fsdept_n(:,:,jk-1) + fse3w_n(:,:,jk) |
---|
| 277 | fsdepw_n(:,:,jk) = fsdepw_n(:,:,jk-1) + fse3t_n(:,:,jk-1) |
---|
| 278 | fsde3w_n(:,:,jk) = fsdept_n(:,:,jk ) - sshn (:,:) |
---|
| 279 | END DO |
---|
| 280 | #endif |
---|
| 281 | ENDIF |
---|
[3625] | 282 | ENDIF |
---|
| 283 | |
---|
| 284 | CALL wrk_dealloc( jpi,jpj, ztmp1, ztmp2 ) |
---|
[3193] | 285 | ! |
---|
| 286 | IF( nn_timing == 1 ) CALL timing_stop('cice_sbc_init') |
---|
| 287 | ! |
---|
[2874] | 288 | END SUBROUTINE cice_sbc_init |
---|
| 289 | |
---|
[3152] | 290 | |
---|
[4990] | 291 | SUBROUTINE cice_sbc_in (kt, ksbc) |
---|
[2874] | 292 | !!--------------------------------------------------------------------- |
---|
| 293 | !! *** ROUTINE cice_sbc_in *** |
---|
[3040] | 294 | !! ** Purpose: Set coupling fields and pass to CICE |
---|
[2874] | 295 | !!--------------------------------------------------------------------- |
---|
[3152] | 296 | INTEGER, INTENT(in ) :: kt ! ocean time step |
---|
[4990] | 297 | INTEGER, INTENT(in ) :: ksbc ! surface forcing type |
---|
[2874] | 298 | |
---|
[3625] | 299 | INTEGER :: ji, jj, jl ! dummy loop indices |
---|
| 300 | REAL(wp), DIMENSION(:,:), POINTER :: ztmp, zpice |
---|
[3152] | 301 | REAL(wp), DIMENSION(:,:,:), POINTER :: ztmpn |
---|
[3625] | 302 | REAL(wp) :: zintb, zintn ! dummy argument |
---|
[3152] | 303 | !!--------------------------------------------------------------------- |
---|
[2874] | 304 | |
---|
[3193] | 305 | IF( nn_timing == 1 ) CALL timing_start('cice_sbc_in') |
---|
| 306 | ! |
---|
[3625] | 307 | CALL wrk_alloc( jpi,jpj, ztmp, zpice ) |
---|
[3152] | 308 | CALL wrk_alloc( jpi,jpj,ncat, ztmpn ) |
---|
[2874] | 309 | |
---|
[3193] | 310 | IF( kt == nit000 ) THEN |
---|
[2874] | 311 | IF(lwp) WRITE(numout,*)'cice_sbc_in' |
---|
[3193] | 312 | ENDIF |
---|
[2874] | 313 | |
---|
[3193] | 314 | ztmp(:,:)=0.0 |
---|
[2874] | 315 | |
---|
| 316 | ! Aggregate ice concentration already set in cice_sbc_out (or cice_sbc_init on |
---|
| 317 | ! the first time-step) |
---|
| 318 | |
---|
| 319 | ! forced and coupled case |
---|
| 320 | |
---|
[4990] | 321 | IF ( (ksbc == jp_flx).OR.(ksbc == jp_cpl) ) THEN |
---|
[2874] | 322 | |
---|
[3193] | 323 | ztmpn(:,:,:)=0.0 |
---|
[2874] | 324 | |
---|
| 325 | ! x comp of wind stress (CI_1) |
---|
| 326 | ! U point to F point |
---|
[3193] | 327 | DO jj=1,jpjm1 |
---|
| 328 | DO ji=1,jpi |
---|
| 329 | ztmp(ji,jj) = 0.5 * ( fr_iu(ji,jj) * utau(ji,jj) & |
---|
| 330 | + fr_iu(ji,jj+1) * utau(ji,jj+1) ) * fmask(ji,jj,1) |
---|
| 331 | ENDDO |
---|
| 332 | ENDDO |
---|
| 333 | CALL nemo2cice(ztmp,strax,'F', -1. ) |
---|
[2874] | 334 | |
---|
| 335 | ! y comp of wind stress (CI_2) |
---|
| 336 | ! V point to F point |
---|
[3193] | 337 | DO jj=1,jpj |
---|
| 338 | DO ji=1,jpim1 |
---|
| 339 | ztmp(ji,jj) = 0.5 * ( fr_iv(ji,jj) * vtau(ji,jj) & |
---|
| 340 | + fr_iv(ji+1,jj) * vtau(ji+1,jj) ) * fmask(ji,jj,1) |
---|
| 341 | ENDDO |
---|
| 342 | ENDDO |
---|
| 343 | CALL nemo2cice(ztmp,stray,'F', -1. ) |
---|
[2874] | 344 | |
---|
| 345 | ! Surface downward latent heat flux (CI_5) |
---|
[4990] | 346 | IF (ksbc == jp_flx) THEN |
---|
[3625] | 347 | DO jl=1,ncat |
---|
| 348 | ztmpn(:,:,jl)=qla_ice(:,:,1)*a_i(:,:,jl) |
---|
[3193] | 349 | ENDDO |
---|
| 350 | ELSE |
---|
[5026] | 351 | !In coupled mode - qla_ice calculated in sbc_cpl for each category |
---|
| 352 | ztmpn(:,:,1:ncat)=qla_ice(:,:,1:ncat) |
---|
[3193] | 353 | ENDIF |
---|
[5026] | 354 | |
---|
[3625] | 355 | DO jl=1,ncat |
---|
| 356 | CALL nemo2cice(ztmpn(:,:,jl),flatn_f(:,:,jl,:),'T', 1. ) |
---|
[2874] | 357 | |
---|
| 358 | ! GBM conductive flux through ice (CI_6) |
---|
| 359 | ! Convert to GBM |
---|
[4990] | 360 | IF (ksbc == jp_flx) THEN |
---|
[3625] | 361 | ztmp(:,:) = botmelt(:,:,jl)*a_i(:,:,jl) |
---|
[3193] | 362 | ELSE |
---|
[3625] | 363 | ztmp(:,:) = botmelt(:,:,jl) |
---|
[3193] | 364 | ENDIF |
---|
[3625] | 365 | CALL nemo2cice(ztmp,fcondtopn_f(:,:,jl,:),'T', 1. ) |
---|
[2874] | 366 | |
---|
| 367 | ! GBM surface heat flux (CI_7) |
---|
| 368 | ! Convert to GBM |
---|
[4990] | 369 | IF (ksbc == jp_flx) THEN |
---|
[3625] | 370 | ztmp(:,:) = (topmelt(:,:,jl)+botmelt(:,:,jl))*a_i(:,:,jl) |
---|
[3193] | 371 | ELSE |
---|
[3625] | 372 | ztmp(:,:) = (topmelt(:,:,jl)+botmelt(:,:,jl)) |
---|
[3193] | 373 | ENDIF |
---|
[3625] | 374 | CALL nemo2cice(ztmp,fsurfn_f(:,:,jl,:),'T', 1. ) |
---|
[3193] | 375 | ENDDO |
---|
[2874] | 376 | |
---|
[4990] | 377 | ELSE IF (ksbc == jp_core) THEN |
---|
[2874] | 378 | |
---|
| 379 | ! Pass CORE forcing fields to CICE (which will calculate heat fluxes etc itself) |
---|
| 380 | ! x comp and y comp of atmosphere surface wind (CICE expects on T points) |
---|
[3193] | 381 | ztmp(:,:) = wndi_ice(:,:) |
---|
| 382 | CALL nemo2cice(ztmp,uatm,'T', -1. ) |
---|
| 383 | ztmp(:,:) = wndj_ice(:,:) |
---|
| 384 | CALL nemo2cice(ztmp,vatm,'T', -1. ) |
---|
| 385 | ztmp(:,:) = SQRT ( wndi_ice(:,:)**2 + wndj_ice(:,:)**2 ) |
---|
| 386 | CALL nemo2cice(ztmp,wind,'T', 1. ) ! Wind speed (m/s) |
---|
| 387 | ztmp(:,:) = qsr_ice(:,:,1) |
---|
| 388 | CALL nemo2cice(ztmp,fsw,'T', 1. ) ! Incoming short-wave (W/m^2) |
---|
| 389 | ztmp(:,:) = qlw_ice(:,:,1) |
---|
| 390 | CALL nemo2cice(ztmp,flw,'T', 1. ) ! Incoming long-wave (W/m^2) |
---|
| 391 | ztmp(:,:) = tatm_ice(:,:) |
---|
| 392 | CALL nemo2cice(ztmp,Tair,'T', 1. ) ! Air temperature (K) |
---|
| 393 | CALL nemo2cice(ztmp,potT,'T', 1. ) ! Potential temp (K) |
---|
[2874] | 394 | ! Following line uses MAX(....) to avoid problems if tatm_ice has unset halo rows |
---|
[3193] | 395 | ztmp(:,:) = 101000. / ( 287.04 * MAX(1.0,tatm_ice(:,:)) ) |
---|
| 396 | ! Constant (101000.) atm pressure assumed |
---|
| 397 | CALL nemo2cice(ztmp,rhoa,'T', 1. ) ! Air density (kg/m^3) |
---|
| 398 | ztmp(:,:) = qatm_ice(:,:) |
---|
| 399 | CALL nemo2cice(ztmp,Qa,'T', 1. ) ! Specific humidity (kg/kg) |
---|
| 400 | ztmp(:,:)=10.0 |
---|
| 401 | CALL nemo2cice(ztmp,zlvl,'T', 1. ) ! Atmos level height (m) |
---|
[2874] | 402 | |
---|
| 403 | ! May want to check all values are physically realistic (as in CICE routine |
---|
| 404 | ! prepare_forcing)? |
---|
| 405 | |
---|
| 406 | ! Divide shortwave into spectral bands (as in prepare_forcing) |
---|
[3193] | 407 | ztmp(:,:)=qsr_ice(:,:,1)*frcvdr ! visible direct |
---|
[2874] | 408 | CALL nemo2cice(ztmp,swvdr,'T', 1. ) |
---|
[3193] | 409 | ztmp(:,:)=qsr_ice(:,:,1)*frcvdf ! visible diffuse |
---|
[2874] | 410 | CALL nemo2cice(ztmp,swvdf,'T', 1. ) |
---|
[3193] | 411 | ztmp(:,:)=qsr_ice(:,:,1)*frcidr ! near IR direct |
---|
[2874] | 412 | CALL nemo2cice(ztmp,swidr,'T', 1. ) |
---|
[3193] | 413 | ztmp(:,:)=qsr_ice(:,:,1)*frcidf ! near IR diffuse |
---|
[2874] | 414 | CALL nemo2cice(ztmp,swidf,'T', 1. ) |
---|
| 415 | |
---|
| 416 | ENDIF |
---|
| 417 | |
---|
| 418 | ! Snowfall |
---|
[4990] | 419 | ! Ensure fsnow is positive (as in CICE routine prepare_forcing) |
---|
| 420 | IF( iom_use('snowpre') ) CALL iom_put('snowpre',MAX( (1.0-fr_i(:,:))*sprecip(:,:) ,0.0)) !!Joakim edit |
---|
[3193] | 421 | ztmp(:,:)=MAX(fr_i(:,:)*sprecip(:,:),0.0) |
---|
| 422 | CALL nemo2cice(ztmp,fsnow,'T', 1. ) |
---|
[2874] | 423 | |
---|
| 424 | ! Rainfall |
---|
[4990] | 425 | IF( iom_use('precip') ) CALL iom_put('precip', (1.0-fr_i(:,:))*(tprecip(:,:)-sprecip(:,:)) ) !!Joakim edit |
---|
[3193] | 426 | ztmp(:,:)=fr_i(:,:)*(tprecip(:,:)-sprecip(:,:)) |
---|
| 427 | CALL nemo2cice(ztmp,frain,'T', 1. ) |
---|
[2874] | 428 | |
---|
| 429 | ! Freezing/melting potential |
---|
[3275] | 430 | ! Calculated over NEMO leapfrog timestep (hence 2*dt) |
---|
[4292] | 431 | nfrzmlt(:,:)=rau0*rcp*fse3t_m(:,:)*(Tocnfrz-sst_m(:,:))/(2.0*dt) |
---|
[2874] | 432 | |
---|
[3193] | 433 | ztmp(:,:) = nfrzmlt(:,:) |
---|
| 434 | CALL nemo2cice(ztmp,frzmlt,'T', 1. ) |
---|
[2874] | 435 | |
---|
| 436 | ! SST and SSS |
---|
| 437 | |
---|
[3193] | 438 | CALL nemo2cice(sst_m,sst,'T', 1. ) |
---|
| 439 | CALL nemo2cice(sss_m,sss,'T', 1. ) |
---|
[2874] | 440 | |
---|
| 441 | ! x comp and y comp of surface ocean current |
---|
| 442 | ! U point to F point |
---|
[3193] | 443 | DO jj=1,jpjm1 |
---|
| 444 | DO ji=1,jpi |
---|
| 445 | ztmp(ji,jj)=0.5*(ssu_m(ji,jj)+ssu_m(ji,jj+1))*fmask(ji,jj,1) |
---|
| 446 | ENDDO |
---|
| 447 | ENDDO |
---|
| 448 | CALL nemo2cice(ztmp,uocn,'F', -1. ) |
---|
[2874] | 449 | |
---|
| 450 | ! V point to F point |
---|
[3193] | 451 | DO jj=1,jpj |
---|
| 452 | DO ji=1,jpim1 |
---|
| 453 | ztmp(ji,jj)=0.5*(ssv_m(ji,jj)+ssv_m(ji+1,jj))*fmask(ji,jj,1) |
---|
| 454 | ENDDO |
---|
| 455 | ENDDO |
---|
| 456 | CALL nemo2cice(ztmp,vocn,'F', -1. ) |
---|
[2874] | 457 | |
---|
[3625] | 458 | IF( nn_ice_embd == 2 ) THEN !== embedded sea ice: compute representative ice top surface ==! |
---|
| 459 | ! |
---|
| 460 | ! average interpolation coeff as used in dynspg = (1/nn_fsbc) * {SUM[n/nn_fsbc], n=0,nn_fsbc-1} |
---|
| 461 | ! = (1/nn_fsbc)^2 * {SUM[n], n=0,nn_fsbc-1} |
---|
| 462 | zintn = REAL( nn_fsbc - 1 ) / REAL( nn_fsbc ) * 0.5_wp |
---|
| 463 | ! |
---|
| 464 | ! average interpolation coeff as used in dynspg = (1/nn_fsbc) * {SUM[1-n/nn_fsbc], n=0,nn_fsbc-1} |
---|
| 465 | ! = (1/nn_fsbc)^2 * (nn_fsbc^2 - {SUM[n], n=0,nn_fsbc-1}) |
---|
| 466 | zintb = REAL( nn_fsbc + 1 ) / REAL( nn_fsbc ) * 0.5_wp |
---|
| 467 | ! |
---|
| 468 | zpice(:,:) = ssh_m(:,:) + ( zintn * snwice_mass(:,:) + zintb * snwice_mass_b(:,:) ) * r1_rau0 |
---|
| 469 | ! |
---|
| 470 | ! |
---|
| 471 | ELSE !== non-embedded sea ice: use ocean surface for slope calculation ==! |
---|
| 472 | zpice(:,:) = ssh_m(:,:) |
---|
| 473 | ENDIF |
---|
| 474 | |
---|
[3189] | 475 | ! x comp and y comp of sea surface slope (on F points) |
---|
| 476 | ! T point to F point |
---|
[3193] | 477 | DO jj=1,jpjm1 |
---|
| 478 | DO ji=1,jpim1 |
---|
[3625] | 479 | ztmp(ji,jj)=0.5 * ( (zpice(ji+1,jj )-zpice(ji,jj ))/e1u(ji,jj ) & |
---|
| 480 | + (zpice(ji+1,jj+1)-zpice(ji,jj+1))/e1u(ji,jj+1) ) & |
---|
[3193] | 481 | * fmask(ji,jj,1) |
---|
| 482 | ENDDO |
---|
| 483 | ENDDO |
---|
| 484 | CALL nemo2cice(ztmp,ss_tltx,'F', -1. ) |
---|
[3189] | 485 | |
---|
| 486 | ! T point to F point |
---|
[3193] | 487 | DO jj=1,jpjm1 |
---|
| 488 | DO ji=1,jpim1 |
---|
[3625] | 489 | ztmp(ji,jj)=0.5 * ( (zpice(ji ,jj+1)-zpice(ji ,jj))/e2v(ji ,jj) & |
---|
| 490 | + (zpice(ji+1,jj+1)-zpice(ji+1,jj))/e2v(ji+1,jj) ) & |
---|
[3193] | 491 | * fmask(ji,jj,1) |
---|
| 492 | ENDDO |
---|
| 493 | ENDDO |
---|
| 494 | CALL nemo2cice(ztmp,ss_tlty,'F', -1. ) |
---|
[3189] | 495 | |
---|
[3152] | 496 | CALL wrk_dealloc( jpi,jpj, ztmp ) |
---|
| 497 | CALL wrk_dealloc( jpi,jpj,ncat, ztmpn ) |
---|
[3193] | 498 | ! |
---|
| 499 | IF( nn_timing == 1 ) CALL timing_stop('cice_sbc_in') |
---|
| 500 | ! |
---|
[2874] | 501 | END SUBROUTINE cice_sbc_in |
---|
| 502 | |
---|
[3152] | 503 | |
---|
[4990] | 504 | SUBROUTINE cice_sbc_out (kt,ksbc) |
---|
[2874] | 505 | !!--------------------------------------------------------------------- |
---|
| 506 | !! *** ROUTINE cice_sbc_out *** |
---|
[3040] | 507 | !! ** Purpose: Get fields from CICE and set surface fields for NEMO |
---|
[3152] | 508 | !!--------------------------------------------------------------------- |
---|
[2874] | 509 | INTEGER, INTENT( in ) :: kt ! ocean time step |
---|
[4990] | 510 | INTEGER, INTENT( in ) :: ksbc ! surface forcing type |
---|
[3152] | 511 | |
---|
[3625] | 512 | INTEGER :: ji, jj, jl ! dummy loop indices |
---|
| 513 | REAL(wp), DIMENSION(:,:), POINTER :: ztmp1, ztmp2 |
---|
[2874] | 514 | !!--------------------------------------------------------------------- |
---|
| 515 | |
---|
[3193] | 516 | IF( nn_timing == 1 ) CALL timing_start('cice_sbc_out') |
---|
| 517 | ! |
---|
[3625] | 518 | CALL wrk_alloc( jpi,jpj, ztmp1, ztmp2 ) |
---|
[3152] | 519 | |
---|
| 520 | IF( kt == nit000 ) THEN |
---|
[2874] | 521 | IF(lwp) WRITE(numout,*)'cice_sbc_out' |
---|
[3152] | 522 | ENDIF |
---|
| 523 | |
---|
[2874] | 524 | ! x comp of ocean-ice stress |
---|
[3625] | 525 | CALL cice2nemo(strocnx,ztmp1,'F', -1. ) |
---|
[3193] | 526 | ss_iou(:,:)=0.0 |
---|
[2874] | 527 | ! F point to U point |
---|
[3193] | 528 | DO jj=2,jpjm1 |
---|
| 529 | DO ji=2,jpim1 |
---|
[3625] | 530 | ss_iou(ji,jj) = 0.5 * ( ztmp1(ji,jj-1) + ztmp1(ji,jj) ) * umask(ji,jj,1) |
---|
[3193] | 531 | ENDDO |
---|
| 532 | ENDDO |
---|
| 533 | CALL lbc_lnk( ss_iou , 'U', -1. ) |
---|
[2874] | 534 | |
---|
| 535 | ! y comp of ocean-ice stress |
---|
[3625] | 536 | CALL cice2nemo(strocny,ztmp1,'F', -1. ) |
---|
[3193] | 537 | ss_iov(:,:)=0.0 |
---|
[2874] | 538 | ! F point to V point |
---|
| 539 | |
---|
[3193] | 540 | DO jj=1,jpjm1 |
---|
| 541 | DO ji=2,jpim1 |
---|
[3625] | 542 | ss_iov(ji,jj) = 0.5 * ( ztmp1(ji-1,jj) + ztmp1(ji,jj) ) * vmask(ji,jj,1) |
---|
[3193] | 543 | ENDDO |
---|
| 544 | ENDDO |
---|
| 545 | CALL lbc_lnk( ss_iov , 'V', -1. ) |
---|
[2874] | 546 | |
---|
| 547 | ! x and y comps of surface stress |
---|
| 548 | ! Combine wind stress and ocean-ice stress |
---|
| 549 | ! [Note that fr_iu hasn't yet been updated, so still from start of CICE timestep] |
---|
| 550 | |
---|
[3193] | 551 | utau(:,:)=(1.0-fr_iu(:,:))*utau(:,:)-ss_iou(:,:) |
---|
| 552 | vtau(:,:)=(1.0-fr_iv(:,:))*vtau(:,:)-ss_iov(:,:) |
---|
[2874] | 553 | |
---|
| 554 | ! Freshwater fluxes |
---|
| 555 | |
---|
[4990] | 556 | IF (ksbc == jp_flx) THEN |
---|
[2874] | 557 | ! Note that emp from the forcing files is evap*(1-aice)-(tprecip-aice*sprecip) |
---|
| 558 | ! What we want here is evap*(1-aice)-tprecip*(1-aice) hence manipulation below |
---|
| 559 | ! Not ideal since aice won't be the same as in the atmosphere. |
---|
| 560 | ! Better to use evap and tprecip? (but for now don't read in evap in this case) |
---|
[3193] | 561 | emp(:,:) = emp(:,:)+fr_i(:,:)*(tprecip(:,:)-sprecip(:,:)) |
---|
[4990] | 562 | ELSE IF (ksbc == jp_core) THEN |
---|
[3193] | 563 | emp(:,:) = (1.0-fr_i(:,:))*emp(:,:) |
---|
[4990] | 564 | ELSE IF (ksbc == jp_cpl) THEN |
---|
[3625] | 565 | ! emp_tot is set in sbc_cpl_ice_flx (called from cice_sbc_in above) |
---|
| 566 | ! This is currently as required with the coupling fields from the UM atmosphere |
---|
[3193] | 567 | emp(:,:) = emp_tot(:,:)+tprecip(:,:)*fr_i(:,:) |
---|
| 568 | ENDIF |
---|
[2874] | 569 | |
---|
[4990] | 570 | #if defined key_cice4 |
---|
[3625] | 571 | CALL cice2nemo(fresh_gbm,ztmp1,'T', 1. ) |
---|
| 572 | CALL cice2nemo(fsalt_gbm,ztmp2,'T', 1. ) |
---|
[4990] | 573 | #else |
---|
| 574 | CALL cice2nemo(fresh_ai,ztmp1,'T', 1. ) |
---|
| 575 | CALL cice2nemo(fsalt_ai,ztmp2,'T', 1. ) |
---|
| 576 | #endif |
---|
[2874] | 577 | |
---|
[3625] | 578 | ! Check to avoid unphysical expression when ice is forming (ztmp1 negative) |
---|
| 579 | ! Otherwise we are effectively allowing ice of higher salinity than the ocean to form |
---|
| 580 | ! which has to be compensated for by the ocean salinity potentially going negative |
---|
| 581 | ! This check breaks conservation but seems reasonable until we have prognostic ice salinity |
---|
| 582 | ! Note the 1000.0 below is to convert from kg salt to g salt (needed for PSU) |
---|
| 583 | WHERE (ztmp1(:,:).lt.0.0) ztmp2(:,:)=MAX(ztmp2(:,:),ztmp1(:,:)*sss_m(:,:)/1000.0) |
---|
| 584 | sfx(:,:)=ztmp2(:,:)*1000.0 |
---|
| 585 | emp(:,:)=emp(:,:)-ztmp1(:,:) |
---|
[4990] | 586 | fmmflx(:,:) = ztmp1(:,:) !!Joakim edit |
---|
| 587 | |
---|
[3193] | 588 | CALL lbc_lnk( emp , 'T', 1. ) |
---|
[3625] | 589 | CALL lbc_lnk( sfx , 'T', 1. ) |
---|
[2874] | 590 | |
---|
| 591 | ! Solar penetrative radiation and non solar surface heat flux |
---|
| 592 | |
---|
| 593 | ! Scale qsr and qns according to ice fraction (bulk formulae only) |
---|
| 594 | |
---|
[4990] | 595 | IF (ksbc == jp_core) THEN |
---|
[3193] | 596 | qsr(:,:)=qsr(:,:)*(1.0-fr_i(:,:)) |
---|
| 597 | qns(:,:)=qns(:,:)*(1.0-fr_i(:,:)) |
---|
| 598 | ENDIF |
---|
[2874] | 599 | ! Take into account snow melting except for fully coupled when already in qns_tot |
---|
[4990] | 600 | IF (ksbc == jp_cpl) THEN |
---|
[3193] | 601 | qsr(:,:)= qsr_tot(:,:) |
---|
| 602 | qns(:,:)= qns_tot(:,:) |
---|
| 603 | ELSE |
---|
| 604 | qns(:,:)= qns(:,:)-sprecip(:,:)*Lfresh*(1.0-fr_i(:,:)) |
---|
| 605 | ENDIF |
---|
[2874] | 606 | |
---|
| 607 | ! Now add in ice / snow related terms |
---|
| 608 | ! [fswthru will be zero unless running with calc_Tsfc=T in CICE] |
---|
[4990] | 609 | #if defined key_cice4 |
---|
[3625] | 610 | CALL cice2nemo(fswthru_gbm,ztmp1,'T', 1. ) |
---|
[4990] | 611 | #else |
---|
| 612 | CALL cice2nemo(fswthru_ai,ztmp1,'T', 1. ) |
---|
| 613 | #endif |
---|
[3625] | 614 | qsr(:,:)=qsr(:,:)+ztmp1(:,:) |
---|
[3193] | 615 | CALL lbc_lnk( qsr , 'T', 1. ) |
---|
[2874] | 616 | |
---|
[3193] | 617 | DO jj=1,jpj |
---|
| 618 | DO ji=1,jpi |
---|
[2874] | 619 | nfrzmlt(ji,jj)=MAX(nfrzmlt(ji,jj),0.0) |
---|
[3193] | 620 | ENDDO |
---|
| 621 | ENDDO |
---|
[2874] | 622 | |
---|
[4990] | 623 | #if defined key_cice4 |
---|
[3625] | 624 | CALL cice2nemo(fhocn_gbm,ztmp1,'T', 1. ) |
---|
[4990] | 625 | #else |
---|
| 626 | CALL cice2nemo(fhocn_ai,ztmp1,'T', 1. ) |
---|
| 627 | #endif |
---|
[3625] | 628 | qns(:,:)=qns(:,:)+nfrzmlt(:,:)+ztmp1(:,:) |
---|
[2874] | 629 | |
---|
[3193] | 630 | CALL lbc_lnk( qns , 'T', 1. ) |
---|
[2874] | 631 | |
---|
| 632 | ! Prepare for the following CICE time-step |
---|
| 633 | |
---|
[3193] | 634 | CALL cice2nemo(aice,fr_i,'T', 1. ) |
---|
[4990] | 635 | IF ( (ksbc == jp_flx).OR.(ksbc == jp_cpl) ) THEN |
---|
[3625] | 636 | DO jl=1,ncat |
---|
| 637 | CALL cice2nemo(aicen(:,:,jl,:),a_i(:,:,jl), 'T', 1. ) |
---|
[3193] | 638 | ENDDO |
---|
| 639 | ENDIF |
---|
[2874] | 640 | |
---|
| 641 | ! T point to U point |
---|
| 642 | ! T point to V point |
---|
[3193] | 643 | DO jj=1,jpjm1 |
---|
| 644 | DO ji=1,jpim1 |
---|
| 645 | fr_iu(ji,jj)=0.5*(fr_i(ji,jj)+fr_i(ji+1,jj))*umask(ji,jj,1) |
---|
| 646 | fr_iv(ji,jj)=0.5*(fr_i(ji,jj)+fr_i(ji,jj+1))*vmask(ji,jj,1) |
---|
| 647 | ENDDO |
---|
| 648 | ENDDO |
---|
[2874] | 649 | |
---|
[3193] | 650 | CALL lbc_lnk ( fr_iu , 'U', 1. ) |
---|
| 651 | CALL lbc_lnk ( fr_iv , 'V', 1. ) |
---|
[2874] | 652 | |
---|
[3625] | 653 | ! ! embedded sea ice |
---|
| 654 | IF( nn_ice_embd /= 0 ) THEN ! mass exchanges between ice and ocean (case 1 or 2) set the snow+ice mass |
---|
| 655 | CALL cice2nemo(vsno(:,:,:),ztmp1,'T', 1. ) |
---|
| 656 | CALL cice2nemo(vice(:,:,:),ztmp2,'T', 1. ) |
---|
| 657 | snwice_mass (:,:) = ( rhosn * ztmp1(:,:) + rhoic * ztmp2(:,:) ) |
---|
| 658 | snwice_mass_b(:,:) = snwice_mass(:,:) |
---|
| 659 | snwice_fmass (:,:) = ( snwice_mass(:,:) - snwice_mass_b(:,:) ) / dt |
---|
| 660 | ENDIF |
---|
| 661 | |
---|
[2874] | 662 | ! Release work space |
---|
| 663 | |
---|
[3625] | 664 | CALL wrk_dealloc( jpi,jpj, ztmp1, ztmp2 ) |
---|
[3193] | 665 | ! |
---|
| 666 | IF( nn_timing == 1 ) CALL timing_stop('cice_sbc_out') |
---|
| 667 | ! |
---|
[2874] | 668 | END SUBROUTINE cice_sbc_out |
---|
| 669 | |
---|
[3152] | 670 | |
---|
[2874] | 671 | SUBROUTINE cice_sbc_hadgam( kt ) |
---|
| 672 | !!--------------------------------------------------------------------- |
---|
| 673 | !! *** ROUTINE cice_sbc_hadgam *** |
---|
[3040] | 674 | !! ** Purpose: Prepare fields needed to pass to HadGAM3 atmosphere |
---|
[2874] | 675 | !! |
---|
| 676 | !! |
---|
| 677 | INTEGER, INTENT( in ) :: kt ! ocean time step |
---|
| 678 | !!--------------------------------------------------------------------- |
---|
| 679 | |
---|
[3625] | 680 | INTEGER :: jl ! dummy loop index |
---|
[3193] | 681 | INTEGER :: ierror |
---|
[2874] | 682 | |
---|
[3193] | 683 | IF( nn_timing == 1 ) CALL timing_start('cice_sbc_hadgam') |
---|
| 684 | ! |
---|
| 685 | IF( kt == nit000 ) THEN |
---|
[2874] | 686 | IF(lwp) WRITE(numout,*)'cice_sbc_hadgam' |
---|
| 687 | IF( sbc_cpl_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'sbc_cpl_alloc : unable to allocate arrays' ) |
---|
[3193] | 688 | ENDIF |
---|
[2874] | 689 | |
---|
| 690 | ! ! =========================== ! |
---|
| 691 | ! ! Prepare Coupling fields ! |
---|
| 692 | ! ! =========================== ! |
---|
| 693 | |
---|
| 694 | ! x and y comp of ice velocity |
---|
| 695 | |
---|
[3193] | 696 | CALL cice2nemo(uvel,u_ice,'F', -1. ) |
---|
| 697 | CALL cice2nemo(vvel,v_ice,'F', -1. ) |
---|
[2874] | 698 | |
---|
| 699 | ! Ice concentration (CO_1) = a_i calculated at end of cice_sbc_out |
---|
| 700 | |
---|
| 701 | ! Snow and ice thicknesses (CO_2 and CO_3) |
---|
| 702 | |
---|
[3625] | 703 | DO jl = 1,ncat |
---|
| 704 | CALL cice2nemo(vsnon(:,:,jl,:),ht_s(:,:,jl),'T', 1. ) |
---|
| 705 | CALL cice2nemo(vicen(:,:,jl,:),ht_i(:,:,jl),'T', 1. ) |
---|
[3193] | 706 | ENDDO |
---|
[5030] | 707 | |
---|
| 708 | #if ! defined key_cice4 |
---|
| 709 | ! Meltpond fraction and depth |
---|
| 710 | DO jl = 1,ncat |
---|
| 711 | CALL cice2nemo(apeffn(:,:,jl,:),a_p(:,:,jl),'T', 1. ) |
---|
| 712 | CALL cice2nemo(trcrn(:,:,jl,:),ht_p(:,:,jl),'T', 1. ) |
---|
| 713 | ENDDO |
---|
| 714 | #endif |
---|
| 715 | |
---|
[3193] | 716 | ! |
---|
| 717 | IF( nn_timing == 1 ) CALL timing_stop('cice_sbc_hadgam') |
---|
| 718 | ! |
---|
[2874] | 719 | END SUBROUTINE cice_sbc_hadgam |
---|
| 720 | |
---|
| 721 | |
---|
| 722 | SUBROUTINE cice_sbc_final |
---|
| 723 | !!--------------------------------------------------------------------- |
---|
| 724 | !! *** ROUTINE cice_sbc_final *** |
---|
| 725 | !! ** Purpose: Finalize CICE |
---|
| 726 | !!--------------------------------------------------------------------- |
---|
| 727 | |
---|
| 728 | IF(lwp) WRITE(numout,*)'cice_sbc_final' |
---|
| 729 | |
---|
[3193] | 730 | CALL CICE_Finalize |
---|
[2874] | 731 | |
---|
| 732 | END SUBROUTINE cice_sbc_final |
---|
| 733 | |
---|
| 734 | SUBROUTINE cice_sbc_force (kt) |
---|
| 735 | !!--------------------------------------------------------------------- |
---|
| 736 | !! *** ROUTINE cice_sbc_force *** |
---|
| 737 | !! ** Purpose : Provide CICE forcing from files |
---|
| 738 | !! |
---|
| 739 | !!--------------------------------------------------------------------- |
---|
| 740 | !! ** Method : READ monthly flux file in NetCDF files |
---|
| 741 | !! |
---|
| 742 | !! snowfall |
---|
| 743 | !! rainfall |
---|
| 744 | !! sublimation rate |
---|
| 745 | !! topmelt (category) |
---|
| 746 | !! botmelt (category) |
---|
| 747 | !! |
---|
| 748 | !! History : |
---|
| 749 | !!---------------------------------------------------------------------- |
---|
| 750 | !! * Modules used |
---|
| 751 | USE iom |
---|
| 752 | |
---|
| 753 | !! * arguments |
---|
| 754 | INTEGER, INTENT( in ) :: kt ! ocean time step |
---|
| 755 | |
---|
| 756 | INTEGER :: ierror ! return error code |
---|
| 757 | INTEGER :: ifpr ! dummy loop index |
---|
| 758 | !! |
---|
| 759 | CHARACTER(len=100) :: cn_dir ! Root directory for location of CICE forcing files |
---|
| 760 | TYPE(FLD_N), DIMENSION(jpfld) :: slf_i ! array of namelist informations on the fields to read |
---|
| 761 | TYPE(FLD_N) :: sn_snow, sn_rain, sn_sblm ! informations about the fields to be read |
---|
| 762 | TYPE(FLD_N) :: sn_top1, sn_top2, sn_top3, sn_top4, sn_top5 |
---|
| 763 | TYPE(FLD_N) :: sn_bot1, sn_bot2, sn_bot3, sn_bot4, sn_bot5 |
---|
| 764 | |
---|
| 765 | !! |
---|
| 766 | NAMELIST/namsbc_cice/ cn_dir, sn_snow, sn_rain, sn_sblm, & |
---|
| 767 | & sn_top1, sn_top2, sn_top3, sn_top4, sn_top5, & |
---|
| 768 | & sn_bot1, sn_bot2, sn_bot3, sn_bot4, sn_bot5 |
---|
[4230] | 769 | INTEGER :: ios |
---|
[2874] | 770 | !!--------------------------------------------------------------------- |
---|
| 771 | |
---|
| 772 | ! ! ====================== ! |
---|
| 773 | IF( kt == nit000 ) THEN ! First call kt=nit000 ! |
---|
| 774 | ! ! ====================== ! |
---|
[4990] | 775 | ! namsbc_cice is not yet in the reference namelist |
---|
| 776 | ! set file information (default values) |
---|
| 777 | cn_dir = './' ! directory in which the model is executed |
---|
| 778 | |
---|
| 779 | ! (NB: frequency positive => hours, negative => months) |
---|
| 780 | ! ! file ! frequency ! variable ! time intep ! clim ! 'yearly' or ! weights ! rotation ! landmask |
---|
| 781 | ! ! name ! (hours) ! name ! (T/F) ! (T/F) ! 'monthly' ! filename ! pairs ! file |
---|
| 782 | sn_snow = FLD_N( 'snowfall_1m' , -1. , 'snowfall' , .true. , .true. , ' yearly' , '' , '' , '' ) |
---|
| 783 | sn_rain = FLD_N( 'rainfall_1m' , -1. , 'rainfall' , .true. , .true. , ' yearly' , '' , '' , '' ) |
---|
| 784 | sn_sblm = FLD_N( 'sublim_1m' , -1. , 'sublim' , .true. , .true. , ' yearly' , '' , '' , '' ) |
---|
| 785 | sn_top1 = FLD_N( 'topmeltn1_1m' , -1. , 'topmeltn1' , .true. , .true. , ' yearly' , '' , '' , '' ) |
---|
| 786 | sn_top2 = FLD_N( 'topmeltn2_1m' , -1. , 'topmeltn2' , .true. , .true. , ' yearly' , '' , '' , '' ) |
---|
| 787 | sn_top3 = FLD_N( 'topmeltn3_1m' , -1. , 'topmeltn3' , .true. , .true. , ' yearly' , '' , '' , '' ) |
---|
| 788 | sn_top4 = FLD_N( 'topmeltn4_1m' , -1. , 'topmeltn4' , .true. , .true. , ' yearly' , '' , '' , '' ) |
---|
| 789 | sn_top5 = FLD_N( 'topmeltn5_1m' , -1. , 'topmeltn5' , .true. , .true. , ' yearly' , '' , '' , '' ) |
---|
| 790 | sn_bot1 = FLD_N( 'botmeltn1_1m' , -1. , 'botmeltn1' , .true. , .true. , ' yearly' , '' , '' , '' ) |
---|
| 791 | sn_bot2 = FLD_N( 'botmeltn2_1m' , -1. , 'botmeltn2' , .true. , .true. , ' yearly' , '' , '' , '' ) |
---|
| 792 | sn_bot3 = FLD_N( 'botmeltn3_1m' , -1. , 'botmeltn3' , .true. , .true. , ' yearly' , '' , '' , '' ) |
---|
| 793 | sn_bot4 = FLD_N( 'botmeltn4_1m' , -1. , 'botmeltn4' , .true. , .true. , ' yearly' , '' , '' , '' ) |
---|
| 794 | sn_bot5 = FLD_N( 'botmeltn5_1m' , -1. , 'botmeltn5' , .true. , .true. , ' yearly' , '' , '' , '' ) |
---|
| 795 | |
---|
[4230] | 796 | REWIND( numnam_ref ) ! Namelist namsbc_cice in reference namelist : |
---|
| 797 | READ ( numnam_ref, namsbc_cice, IOSTAT = ios, ERR = 901) |
---|
| 798 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_cice in reference namelist', lwp ) |
---|
[2874] | 799 | |
---|
[4230] | 800 | REWIND( numnam_cfg ) ! Namelist namsbc_cice in configuration namelist : Parameters of the run |
---|
| 801 | READ ( numnam_cfg, namsbc_cice, IOSTAT = ios, ERR = 902 ) |
---|
| 802 | 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_cice in configuration namelist', lwp ) |
---|
[4624] | 803 | IF(lwm) WRITE ( numond, namsbc_cice ) |
---|
[2874] | 804 | |
---|
| 805 | ! store namelist information in an array |
---|
| 806 | slf_i(jp_snow) = sn_snow ; slf_i(jp_rain) = sn_rain ; slf_i(jp_sblm) = sn_sblm |
---|
| 807 | slf_i(jp_top1) = sn_top1 ; slf_i(jp_top2) = sn_top2 ; slf_i(jp_top3) = sn_top3 |
---|
| 808 | slf_i(jp_top4) = sn_top4 ; slf_i(jp_top5) = sn_top5 ; slf_i(jp_bot1) = sn_bot1 |
---|
| 809 | slf_i(jp_bot2) = sn_bot2 ; slf_i(jp_bot3) = sn_bot3 ; slf_i(jp_bot4) = sn_bot4 |
---|
| 810 | slf_i(jp_bot5) = sn_bot5 |
---|
| 811 | |
---|
| 812 | ! set sf structure |
---|
| 813 | ALLOCATE( sf(jpfld), STAT=ierror ) |
---|
| 814 | IF( ierror > 0 ) THEN |
---|
| 815 | CALL ctl_stop( 'cice_sbc_force: unable to allocate sf structure' ) ; RETURN |
---|
| 816 | ENDIF |
---|
| 817 | |
---|
| 818 | DO ifpr= 1, jpfld |
---|
| 819 | ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1) ) |
---|
| 820 | ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) ) |
---|
| 821 | END DO |
---|
| 822 | |
---|
| 823 | ! fill sf with slf_i and control print |
---|
| 824 | CALL fld_fill( sf, slf_i, cn_dir, 'cice_sbc_force', 'flux formulation for CICE', 'namsbc_cice' ) |
---|
| 825 | ! |
---|
| 826 | ENDIF |
---|
| 827 | |
---|
| 828 | CALL fld_read( kt, nn_fsbc, sf ) ! Read input fields and provides the |
---|
| 829 | ! ! input fields at the current time-step |
---|
| 830 | |
---|
| 831 | ! set the fluxes from read fields |
---|
| 832 | sprecip(:,:) = sf(jp_snow)%fnow(:,:,1) |
---|
| 833 | tprecip(:,:) = sf(jp_snow)%fnow(:,:,1)+sf(jp_rain)%fnow(:,:,1) |
---|
[3040] | 834 | ! May be better to do this conversion somewhere else |
---|
[2874] | 835 | qla_ice(:,:,1) = -Lsub*sf(jp_sblm)%fnow(:,:,1) |
---|
| 836 | topmelt(:,:,1) = sf(jp_top1)%fnow(:,:,1) |
---|
| 837 | topmelt(:,:,2) = sf(jp_top2)%fnow(:,:,1) |
---|
| 838 | topmelt(:,:,3) = sf(jp_top3)%fnow(:,:,1) |
---|
| 839 | topmelt(:,:,4) = sf(jp_top4)%fnow(:,:,1) |
---|
| 840 | topmelt(:,:,5) = sf(jp_top5)%fnow(:,:,1) |
---|
| 841 | botmelt(:,:,1) = sf(jp_bot1)%fnow(:,:,1) |
---|
| 842 | botmelt(:,:,2) = sf(jp_bot2)%fnow(:,:,1) |
---|
| 843 | botmelt(:,:,3) = sf(jp_bot3)%fnow(:,:,1) |
---|
| 844 | botmelt(:,:,4) = sf(jp_bot4)%fnow(:,:,1) |
---|
| 845 | botmelt(:,:,5) = sf(jp_bot5)%fnow(:,:,1) |
---|
| 846 | |
---|
| 847 | ! control print (if less than 100 time-step asked) |
---|
| 848 | IF( nitend-nit000 <= 100 .AND. lwp ) THEN |
---|
| 849 | WRITE(numout,*) |
---|
| 850 | WRITE(numout,*) ' read forcing fluxes for CICE OK' |
---|
| 851 | CALL FLUSH(numout) |
---|
| 852 | ENDIF |
---|
| 853 | |
---|
| 854 | END SUBROUTINE cice_sbc_force |
---|
| 855 | |
---|
| 856 | SUBROUTINE nemo2cice( pn, pc, cd_type, psgn) |
---|
| 857 | !!--------------------------------------------------------------------- |
---|
| 858 | !! *** ROUTINE nemo2cice *** |
---|
| 859 | !! ** Purpose : Transfer field in NEMO array to field in CICE array. |
---|
| 860 | #if defined key_nemocice_decomp |
---|
| 861 | !! |
---|
| 862 | !! NEMO and CICE PE sub domains are identical, hence |
---|
| 863 | !! there is no need to gather or scatter data from |
---|
| 864 | !! one PE configuration to another. |
---|
| 865 | #else |
---|
| 866 | !! Automatically gather/scatter between |
---|
| 867 | !! different processors and blocks |
---|
| 868 | !! ** Method : A. Ensure all haloes are filled in NEMO field (pn) |
---|
| 869 | !! B. Gather pn into global array (png) |
---|
| 870 | !! C. Map png into CICE global array (pcg) |
---|
| 871 | !! D. Scatter pcg to CICE blocks (pc) + update haloes |
---|
| 872 | #endif |
---|
| 873 | !!--------------------------------------------------------------------- |
---|
| 874 | |
---|
[3193] | 875 | CHARACTER(len=1), INTENT( in ) :: & |
---|
| 876 | cd_type ! nature of pn grid-point |
---|
| 877 | ! ! = T or F gridpoints |
---|
| 878 | REAL(wp), INTENT( in ) :: & |
---|
| 879 | psgn ! control of the sign change |
---|
| 880 | ! ! =-1 , the sign is modified following the type of b.c. used |
---|
| 881 | ! ! = 1 , no sign change |
---|
| 882 | REAL(wp), DIMENSION(jpi,jpj) :: pn |
---|
[2874] | 883 | #if !defined key_nemocice_decomp |
---|
[3625] | 884 | REAL(wp), DIMENSION(jpiglo,jpjglo) :: png2 |
---|
[3193] | 885 | REAL (kind=dbl_kind), dimension(nx_global,ny_global) :: pcg |
---|
[2874] | 886 | #endif |
---|
[3193] | 887 | REAL (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks) :: pc |
---|
| 888 | INTEGER (int_kind) :: & |
---|
| 889 | field_type, &! id for type of field (scalar, vector, angle) |
---|
| 890 | grid_loc ! id for location on horizontal grid |
---|
[2874] | 891 | ! (center, NEcorner, Nface, Eface) |
---|
| 892 | |
---|
[3193] | 893 | INTEGER :: ji, jj, jn ! dummy loop indices |
---|
[2874] | 894 | |
---|
[3193] | 895 | ! A. Ensure all haloes are filled in NEMO field (pn) |
---|
[2874] | 896 | |
---|
[3193] | 897 | CALL lbc_lnk( pn , cd_type, psgn ) |
---|
[2874] | 898 | |
---|
| 899 | #if defined key_nemocice_decomp |
---|
| 900 | |
---|
[3193] | 901 | ! Copy local domain data from NEMO to CICE field |
---|
| 902 | pc(:,:,1)=0.0 |
---|
[3625] | 903 | DO jj=2,ny_block-1 |
---|
| 904 | DO ji=2,nx_block-1 |
---|
| 905 | pc(ji,jj,1)=pn(ji-1+ji_off,jj-1+jj_off) |
---|
[3193] | 906 | ENDDO |
---|
| 907 | ENDDO |
---|
[2874] | 908 | |
---|
| 909 | #else |
---|
| 910 | |
---|
[3193] | 911 | ! B. Gather pn into global array (png) |
---|
[2874] | 912 | |
---|
[3193] | 913 | IF ( jpnij > 1) THEN |
---|
| 914 | CALL mppsync |
---|
| 915 | CALL mppgather (pn,0,png) |
---|
| 916 | CALL mppsync |
---|
| 917 | ELSE |
---|
| 918 | png(:,:,1)=pn(:,:) |
---|
| 919 | ENDIF |
---|
[2874] | 920 | |
---|
[3193] | 921 | ! C. Map png into CICE global array (pcg) |
---|
[2874] | 922 | |
---|
| 923 | ! Need to make sure this is robust to changes in NEMO halo rows.... |
---|
| 924 | ! (may be OK but not 100% sure) |
---|
| 925 | |
---|
[3193] | 926 | IF (nproc==0) THEN |
---|
[2874] | 927 | ! pcg(:,:)=0.0 |
---|
[3193] | 928 | DO jn=1,jpnij |
---|
[3625] | 929 | DO jj=nldjt(jn),nlejt(jn) |
---|
| 930 | DO ji=nldit(jn),nleit(jn) |
---|
| 931 | png2(ji+nimppt(jn)-1,jj+njmppt(jn)-1)=png(ji,jj,jn) |
---|
[3193] | 932 | ENDDO |
---|
| 933 | ENDDO |
---|
| 934 | ENDDO |
---|
[3625] | 935 | DO jj=1,ny_global |
---|
| 936 | DO ji=1,nx_global |
---|
| 937 | pcg(ji,jj)=png2(ji+ji_off,jj+jj_off) |
---|
| 938 | ENDDO |
---|
| 939 | ENDDO |
---|
[3193] | 940 | ENDIF |
---|
[2874] | 941 | |
---|
| 942 | #endif |
---|
| 943 | |
---|
[3193] | 944 | SELECT CASE ( cd_type ) |
---|
| 945 | CASE ( 'T' ) |
---|
| 946 | grid_loc=field_loc_center |
---|
| 947 | CASE ( 'F' ) |
---|
| 948 | grid_loc=field_loc_NEcorner |
---|
| 949 | END SELECT |
---|
[2874] | 950 | |
---|
[3193] | 951 | SELECT CASE ( NINT(psgn) ) |
---|
| 952 | CASE ( -1 ) |
---|
| 953 | field_type=field_type_vector |
---|
| 954 | CASE ( 1 ) |
---|
| 955 | field_type=field_type_scalar |
---|
| 956 | END SELECT |
---|
[2874] | 957 | |
---|
| 958 | #if defined key_nemocice_decomp |
---|
[3193] | 959 | ! Ensure CICE halos are up to date |
---|
| 960 | CALL ice_HaloUpdate (pc, halo_info, grid_loc, field_type) |
---|
[2874] | 961 | #else |
---|
[3193] | 962 | ! D. Scatter pcg to CICE blocks (pc) + update halos |
---|
| 963 | CALL scatter_global(pc, pcg, 0, distrb_info, grid_loc, field_type) |
---|
[2874] | 964 | #endif |
---|
| 965 | |
---|
| 966 | END SUBROUTINE nemo2cice |
---|
| 967 | |
---|
| 968 | SUBROUTINE cice2nemo ( pc, pn, cd_type, psgn ) |
---|
| 969 | !!--------------------------------------------------------------------- |
---|
| 970 | !! *** ROUTINE cice2nemo *** |
---|
| 971 | !! ** Purpose : Transfer field in CICE array to field in NEMO array. |
---|
| 972 | #if defined key_nemocice_decomp |
---|
| 973 | !! |
---|
| 974 | !! NEMO and CICE PE sub domains are identical, hence |
---|
| 975 | !! there is no need to gather or scatter data from |
---|
| 976 | !! one PE configuration to another. |
---|
| 977 | #else |
---|
| 978 | !! Automatically deal with scatter/gather between |
---|
| 979 | !! different processors and blocks |
---|
| 980 | !! ** Method : A. Gather CICE blocks (pc) into global array (pcg) |
---|
| 981 | !! B. Map pcg into NEMO global array (png) |
---|
| 982 | !! C. Scatter png into NEMO field (pn) for each processor |
---|
| 983 | !! D. Ensure all haloes are filled in pn |
---|
| 984 | #endif |
---|
| 985 | !!--------------------------------------------------------------------- |
---|
| 986 | |
---|
[3193] | 987 | CHARACTER(len=1), INTENT( in ) :: & |
---|
| 988 | cd_type ! nature of pn grid-point |
---|
| 989 | ! ! = T or F gridpoints |
---|
| 990 | REAL(wp), INTENT( in ) :: & |
---|
| 991 | psgn ! control of the sign change |
---|
| 992 | ! ! =-1 , the sign is modified following the type of b.c. used |
---|
| 993 | ! ! = 1 , no sign change |
---|
| 994 | REAL(wp), DIMENSION(jpi,jpj) :: pn |
---|
[2874] | 995 | |
---|
| 996 | #if defined key_nemocice_decomp |
---|
[3193] | 997 | INTEGER (int_kind) :: & |
---|
| 998 | field_type, & ! id for type of field (scalar, vector, angle) |
---|
| 999 | grid_loc ! id for location on horizontal grid |
---|
| 1000 | ! (center, NEcorner, Nface, Eface) |
---|
[2874] | 1001 | #else |
---|
[3193] | 1002 | REAL (kind=dbl_kind), dimension(nx_global,ny_global) :: pcg |
---|
[2874] | 1003 | #endif |
---|
| 1004 | |
---|
[3193] | 1005 | REAL (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks) :: pc |
---|
[2874] | 1006 | |
---|
[3193] | 1007 | INTEGER :: ji, jj, jn ! dummy loop indices |
---|
[2874] | 1008 | |
---|
| 1009 | |
---|
| 1010 | #if defined key_nemocice_decomp |
---|
| 1011 | |
---|
[3193] | 1012 | SELECT CASE ( cd_type ) |
---|
| 1013 | CASE ( 'T' ) |
---|
| 1014 | grid_loc=field_loc_center |
---|
| 1015 | CASE ( 'F' ) |
---|
| 1016 | grid_loc=field_loc_NEcorner |
---|
| 1017 | END SELECT |
---|
[2874] | 1018 | |
---|
[3193] | 1019 | SELECT CASE ( NINT(psgn) ) |
---|
| 1020 | CASE ( -1 ) |
---|
| 1021 | field_type=field_type_vector |
---|
| 1022 | CASE ( 1 ) |
---|
| 1023 | field_type=field_type_scalar |
---|
| 1024 | END SELECT |
---|
[2874] | 1025 | |
---|
[3193] | 1026 | CALL ice_HaloUpdate (pc, halo_info, grid_loc, field_type) |
---|
[2874] | 1027 | |
---|
| 1028 | |
---|
[3193] | 1029 | pn(:,:)=0.0 |
---|
| 1030 | DO jj=1,jpjm1 |
---|
| 1031 | DO ji=1,jpim1 |
---|
[3625] | 1032 | pn(ji,jj)=pc(ji+1-ji_off,jj+1-jj_off,1) |
---|
[3193] | 1033 | ENDDO |
---|
| 1034 | ENDDO |
---|
[2874] | 1035 | |
---|
| 1036 | #else |
---|
| 1037 | |
---|
[3193] | 1038 | ! A. Gather CICE blocks (pc) into global array (pcg) |
---|
[2874] | 1039 | |
---|
[3193] | 1040 | CALL gather_global(pcg, pc, 0, distrb_info) |
---|
[2874] | 1041 | |
---|
| 1042 | ! B. Map pcg into NEMO global array (png) |
---|
| 1043 | |
---|
| 1044 | ! Need to make sure this is robust to changes in NEMO halo rows.... |
---|
| 1045 | ! (may be OK but not spent much time thinking about it) |
---|
[3625] | 1046 | ! Note that non-existent pcg elements may be used below, but |
---|
| 1047 | ! the lbclnk call on pn will replace these with sensible values |
---|
[2874] | 1048 | |
---|
[3193] | 1049 | IF (nproc==0) THEN |
---|
| 1050 | png(:,:,:)=0.0 |
---|
| 1051 | DO jn=1,jpnij |
---|
[3625] | 1052 | DO jj=nldjt(jn),nlejt(jn) |
---|
| 1053 | DO ji=nldit(jn),nleit(jn) |
---|
| 1054 | png(ji,jj,jn)=pcg(ji+nimppt(jn)-1-ji_off,jj+njmppt(jn)-1-jj_off) |
---|
[3193] | 1055 | ENDDO |
---|
| 1056 | ENDDO |
---|
| 1057 | ENDDO |
---|
| 1058 | ENDIF |
---|
[2874] | 1059 | |
---|
[3193] | 1060 | ! C. Scatter png into NEMO field (pn) for each processor |
---|
[2874] | 1061 | |
---|
[3193] | 1062 | IF ( jpnij > 1) THEN |
---|
| 1063 | CALL mppsync |
---|
| 1064 | CALL mppscatter (png,0,pn) |
---|
| 1065 | CALL mppsync |
---|
| 1066 | ELSE |
---|
| 1067 | pn(:,:)=png(:,:,1) |
---|
| 1068 | ENDIF |
---|
[2874] | 1069 | |
---|
| 1070 | #endif |
---|
| 1071 | |
---|
[3193] | 1072 | ! D. Ensure all haloes are filled in pn |
---|
[2874] | 1073 | |
---|
[3193] | 1074 | CALL lbc_lnk( pn , cd_type, psgn ) |
---|
[2874] | 1075 | |
---|
| 1076 | END SUBROUTINE cice2nemo |
---|
| 1077 | |
---|
| 1078 | #else |
---|
| 1079 | !!---------------------------------------------------------------------- |
---|
| 1080 | !! Default option Dummy module NO CICE sea-ice model |
---|
| 1081 | !!---------------------------------------------------------------------- |
---|
| 1082 | CONTAINS |
---|
| 1083 | |
---|
[4990] | 1084 | SUBROUTINE sbc_ice_cice ( kt, ksbc ) ! Dummy routine |
---|
[2874] | 1085 | WRITE(*,*) 'sbc_ice_cice: You should not have seen this print! error?', kt |
---|
| 1086 | END SUBROUTINE sbc_ice_cice |
---|
| 1087 | |
---|
[4990] | 1088 | SUBROUTINE cice_sbc_init (ksbc) ! Dummy routine |
---|
[2874] | 1089 | WRITE(*,*) 'cice_sbc_init: You should not have seen this print! error?' |
---|
| 1090 | END SUBROUTINE cice_sbc_init |
---|
| 1091 | |
---|
| 1092 | SUBROUTINE cice_sbc_final ! Dummy routine |
---|
| 1093 | WRITE(*,*) 'cice_sbc_final: You should not have seen this print! error?' |
---|
| 1094 | END SUBROUTINE cice_sbc_final |
---|
| 1095 | |
---|
| 1096 | #endif |
---|
| 1097 | |
---|
| 1098 | !!====================================================================== |
---|
| 1099 | END MODULE sbcice_cice |
---|