New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 9987 for branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90 – NEMO

Ignore:
Timestamp:
2018-07-23T11:33:03+02:00 (6 years ago)
Author:
emmafiedler
Message:

Merge with GO6 FOAMv14 package branch r9288

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90

    r7960 r9987  
    1515   USE dom_oce         ! ocean space and time domain 
    1616   USE domvvl 
    17    USE phycst, only : rcp, rau0, r1_rau0, rhosn, rhoic 
     17   USE eosbn2, only : eos_fzp ! Function to calculate freezing point of seawater 
     18   USE phycst, only : rcp, rau0, r1_rau0, rhosn, rhoic, rt0 
    1819   USE in_out_manager  ! I/O manager 
    1920   USE iom, ONLY : iom_put,iom_use              ! I/O manager library !!Joakim edit 
     
    3738   USE ice_gather_scatter 
    3839   USE ice_calendar, only: dt 
     40# if defined key_cice4 
    3941   USE ice_state, only: aice,aicen,uvel,vvel,vsno,vsnon,vice,vicen 
    40 # if defined key_cice4 
    4142   USE ice_flux, only: strax,stray,strocnx,strocny,frain,fsnow,  & 
    4243                strocnxT,strocnyT,                               &  
     
    4546                flatn_f,fsurfn_f,fcondtopn_f,                    & 
    4647                uatm,vatm,wind,fsw,flw,Tair,potT,Qa,rhoa,zlvl,   & 
    47                 swvdr,swvdf,swidr,swidf 
     48                swvdr,swvdf,swidr,swidf,Tf 
    4849   USE ice_therm_vertical, only: calc_Tsfc 
    4950#else 
     51   USE ice_state, only: aice,aicen,uvel,nt_hpnd,trcrn,vvel,vsno,& 
     52                vsnon,vice,vicen,nt_Tsfc 
    5053   USE ice_flux, only: strax,stray,strocnx,strocny,frain,fsnow,  & 
    5154                strocnxT,strocnyT,                               &  
    52                 sst,sss,uocn,vocn,ss_tltx,ss_tlty,fsalt_ai,     & 
    53                 fresh_ai,fhocn_ai,fswthru_ai,frzmlt,          & 
     55                sst,sss,uocn,vocn,ss_tltx,ss_tlty,fsalt_ai,      & 
     56                fresh_ai,fhocn_ai,fswthru_ai,frzmlt,             & 
    5457                flatn_f,fsurfn_f,fcondtopn_f,                    & 
     58#ifdef key_asminc 
     59                daice_da,fresh_da,fsalt_da,                    & 
     60#endif 
    5561                uatm,vatm,wind,fsw,flw,Tair,potT,Qa,rhoa,zlvl,   & 
    56                 swvdr,swvdf,swidr,swidf 
    57    USE ice_therm_shared, only: calc_Tsfc 
     62                swvdr,swvdf,swidr,swidf,Tf,                      & 
     63      !! When using NEMO with CICE, this change requires use of  
     64      !! one of the following two CICE branches: 
     65      !! - at CICE5.0,   hadax/r1015_GSI8_with_GSI7 
     66      !! - at CICE5.1.2, hadax/vn5.1.2_GSI8 
     67                keffn_top,Tn_top 
     68 
     69   USE ice_therm_shared, only: calc_Tsfc, heat_capacity 
     70   USE ice_shortwave, only: apeffn 
    5871#endif 
    5972   USE ice_forcing, only: frcvdr,frcvdf,frcidr,frcidf 
     
    161174      INTEGER, INTENT( in  ) ::   ksbc                ! surface forcing type 
    162175      REAL(wp), DIMENSION(:,:), POINTER :: ztmp1, ztmp2 
    163       REAL(wp) ::   zcoefu, zcoefv, zcoeff            ! local scalar 
     176      REAL(wp), DIMENSION(:,:,:), POINTER :: ztfrz3d 
    164177      INTEGER  ::   ji, jj, jl, jk                    ! dummy loop indices 
    165178      !!--------------------------------------------------------------------- 
     
    174187      jj_off = INT ( (jpjglo - ny_global) / 2 ) 
    175188 
    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  
    185 ! Initialize CICE 
     189      ! Initialize CICE 
    186190      CALL CICE_Initialize 
    187191 
    188 ! Do some CICE consistency checks 
     192      ! Do some CICE consistency checks 
    189193      IF ( (ksbc == jp_flx) .OR. (ksbc == jp_purecpl) ) THEN 
    190194         IF ( calc_strair .OR. calc_Tsfc ) THEN 
     
    198202 
    199203 
    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' ) 
     204      ! allocate sbc_ice and sbc_cice arrays 
     205      IF( sbc_ice_alloc()      /= 0 )   CALL ctl_stop( 'STOP', 'sbc_ice_alloc : unable to allocate arrays' ) 
    202206      IF( sbc_ice_cice_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_ice_cice_alloc : unable to allocate cice arrays' ) 
    203207 
    204 ! Ensure ocean temperatures are nowhere below freezing if not a NEMO restart 
     208      ! Ensure that no temperature points are below freezing if not a NEMO restart 
    205209      IF( .NOT. ln_rstart ) THEN 
    206          tsn(:,:,:,jp_tem) = MAX (tsn(:,:,:,jp_tem),Tocnfrz) 
     210 
     211         CALL wrk_alloc( jpi,jpj,jpk, ztfrz3d )  
     212         DO jk=1,jpk 
     213             CALL eos_fzp( tsn(:,:,jk,jp_sal), ztfrz3d(:,:,jk), fsdept_n(:,:,jk) ) 
     214         ENDDO 
     215         tsn(:,:,:,jp_tem) = MAX( tsn(:,:,:,jp_tem), ztfrz3d ) 
    207216         tsb(:,:,:,jp_tem) = tsn(:,:,:,jp_tem) 
    208       ENDIF 
    209  
    210       fr_iu(:,:)=0.0 
    211       fr_iv(:,:)=0.0 
     217         CALL wrk_dealloc( jpi,jpj,jpk, ztfrz3d )  
     218 
     219#if defined key_nemocice_decomp 
     220         ! Pass initial SST from NEMO to CICE so ice is initialised correctly if 
     221         ! there is no restart file. 
     222         ! Values from a CICE restart file would overwrite this 
     223         CALL nemo2cice( tsn(:,:,1,jp_tem) , sst , 'T' , 1.)  
     224#endif 
     225 
     226      ENDIF   
     227 
     228      ! calculate surface freezing temperature and send to CICE 
     229      CALL  eos_fzp(sss_m(:,:), sstfrz(:,:), fsdept_n(:,:,1))  
     230      CALL nemo2cice(sstfrz,Tf, 'T', 1. ) 
    212231 
    213232      CALL cice2nemo(aice,fr_i, 'T', 1. ) 
     
    220239! T point to U point 
    221240! T point to V point 
     241      fr_iu(:,:)=0.0 
     242      fr_iv(:,:)=0.0 
    222243      DO jj=1,jpjm1 
    223244         DO ji=1,jpim1 
     
    283304  
    284305      CALL wrk_dealloc( jpi,jpj, ztmp1, ztmp2 ) 
    285       ! 
     306 
     307#if defined key_asminc 
     308      ! Initialize fresh water and salt fluxes from data assim    
     309      !  and data assimilation index to cice  
     310      nfresh_da(:,:) = 0.0    
     311      nfsalt_da(:,:) = 0.0    
     312      ndaice_da(:,:) = 0.0          
     313#endif 
     314      ! 
     315      ! In coupled mode get extra fields from CICE for passing back to atmosphere 
     316  
     317      IF ( ksbc == jp_purecpl ) CALL cice_sbc_hadgam(nit000) 
     318      !  
    286319      IF( nn_timing == 1 )  CALL timing_stop('cice_sbc_init') 
    287320      ! 
     
    343376         CALL nemo2cice(ztmp,stray,'F', -1. ) 
    344377 
     378 
     379! Alex West: From configuration GSI8 onwards, when NEMO is used with CICE in 
     380! HadGEM3 the 'time-travelling ice' coupling approach is used, whereby  
     381! atmosphere-ice fluxes are passed as pseudo-local values, formed by dividing 
     382! gridbox mean fluxes in the UM by future ice concentration obtained through   
     383! OASIS.  This allows for a much more realistic apportionment of energy through 
     384! the ice - and conserves energy. 
     385! Therefore the fluxes are now divided by ice concentration in the coupled 
     386! formulation (jp_purecpl) as well as for jp_flx.  This NEMO branch should only 
     387! be used at UM10.2 onwards (unless an explicit GSI8 UM branch is included), at 
     388! which point the GSI8 UM changes were committed. 
     389 
    345390! Surface downward latent heat flux (CI_5) 
    346391         IF (ksbc == jp_flx) THEN 
     
    348393               ztmpn(:,:,jl)=qla_ice(:,:,1)*a_i(:,:,jl) 
    349394            ENDDO 
    350          ELSE 
    351 ! emp_ice is set in sbc_cpl_ice_flx as sublimation-snow 
    352             qla_ice(:,:,1)= - ( emp_ice(:,:)+sprecip(:,:) ) * Lsub 
    353 ! End of temporary code 
    354             DO jj=1,jpj 
    355                DO ji=1,jpi 
    356                   IF (fr_i(ji,jj).eq.0.0) THEN 
    357                      DO jl=1,ncat 
    358                         ztmpn(ji,jj,jl)=0.0 
    359                      ENDDO 
    360                      ! This will then be conserved in CICE 
    361                      ztmpn(ji,jj,1)=qla_ice(ji,jj,1) 
    362                   ELSE 
    363                      DO jl=1,ncat 
    364                         ztmpn(ji,jj,jl)=qla_ice(ji,jj,1)*a_i(ji,jj,jl)/fr_i(ji,jj) 
    365                      ENDDO 
    366                   ENDIF 
    367                ENDDO 
     395         ELSE IF (ksbc == jp_purecpl) THEN 
     396            DO jl=1,ncat 
     397               ztmpn(:,:,jl)=qla_ice(:,:,jl)*a_i(:,:,jl) 
    368398            ENDDO 
     399    ELSE 
     400           !In coupled mode - qla_ice calculated in sbc_cpl for each category 
     401           ztmpn(:,:,1:ncat)=qla_ice(:,:,1:ncat) 
    369402         ENDIF 
     403 
    370404         DO jl=1,ncat 
    371405            CALL nemo2cice(ztmpn(:,:,jl),flatn_f(:,:,jl,:),'T', 1. ) 
     
    373407! GBM conductive flux through ice (CI_6) 
    374408!  Convert to GBM 
    375             IF (ksbc == jp_flx) THEN 
     409            IF (ksbc == jp_flx .OR. ksbc == jp_purecpl) THEN 
    376410               ztmp(:,:) = botmelt(:,:,jl)*a_i(:,:,jl) 
    377411            ELSE 
     
    382416! GBM surface heat flux (CI_7) 
    383417!  Convert to GBM 
    384             IF (ksbc == jp_flx) THEN 
     418            IF (ksbc == jp_flx .OR. ksbc == jp_purecpl) THEN 
    385419               ztmp(:,:) = (topmelt(:,:,jl)+botmelt(:,:,jl))*a_i(:,:,jl)  
    386420            ELSE 
     
    431465      ENDIF 
    432466 
     467#if defined key_asminc 
     468!Ice concentration change (from assimilation) 
     469      ztmp(:,:)=ndaice_da(:,:)*tmask(:,:,1) 
     470      Call nemo2cice(ztmp,daice_da,'T', 1. ) 
     471#endif  
     472 
    433473! Snowfall 
    434474! Ensure fsnow is positive (as in CICE routine prepare_forcing) 
    435475      IF( iom_use('snowpre') )   CALL iom_put('snowpre',MAX( (1.0-fr_i(:,:))*sprecip(:,:) ,0.0)) !!Joakim edit   
    436       ztmp(:,:)=MAX(fr_i(:,:)*sprecip(:,:),0.0)   
     476      IF( kt == nit000 .AND. lwp )  THEN 
     477         WRITE(numout,*) 'sprecip weight, rn_sfac=', rn_sfac 
     478      ENDIF 
     479      ztmp(:,:)=MAX(fr_i(:,:)*rn_sfac*sprecip(:,:),0.0)   
    437480      CALL nemo2cice(ztmp,fsnow,'T', 1. )  
    438481 
     
    442485      CALL nemo2cice(ztmp,frain,'T', 1. )  
    443486 
     487! Recalculate freezing temperature and send to CICE  
     488      CALL eos_fzp(sss_m(:,:), sstfrz(:,:), fsdept_n(:,:,1))  
     489      CALL nemo2cice(sstfrz,Tf,'T', 1. ) 
     490 
    444491! Freezing/melting potential 
    445492! Calculated over NEMO leapfrog timestep (hence 2*dt) 
    446       nfrzmlt(:,:)=rau0*rcp*fse3t_m(:,:)*(Tocnfrz-sst_m(:,:))/(2.0*dt) 
    447  
    448       ztmp(:,:) = nfrzmlt(:,:) 
    449       CALL nemo2cice(ztmp,frzmlt,'T', 1. ) 
     493      nfrzmlt(:,:)=rau0*rcp*fse3t_m(:,:)*(sstfrz(:,:)-sst_m(:,:))/(2.0*dt)  
     494      CALL nemo2cice(nfrzmlt,frzmlt,'T', 1. ) 
    450495 
    451496! SST  and SSS 
     
    453498      CALL nemo2cice(sst_m,sst,'T', 1. ) 
    454499      CALL nemo2cice(sss_m,sss,'T', 1. ) 
     500 
     501      IF( ksbc == jp_purecpl ) THEN 
     502! Sea ice surface skin temperature 
     503         DO jl=1,ncat 
     504           CALL nemo2cice(tsfc_ice(:,:,jl), trcrn(:,:,nt_tsfc,jl,:),'T',1.) 
     505         ENDDO  
     506      ENDIF 
    455507 
    456508! x comp and y comp of surface ocean current 
     
    685737      ENDIF 
    686738 
     739#if defined key_asminc 
     740! Import fresh water and salt flux due to seaice da 
     741      CALL cice2nemo(fresh_da, nfresh_da,'T',1.0) 
     742      CALL cice2nemo(fsalt_da, nfsalt_da,'T',1.0) 
     743#endif 
     744 
    687745! Release work space 
    688746 
     
    708766      IF( nn_timing == 1 )  CALL timing_start('cice_sbc_hadgam') 
    709767      ! 
    710       IF( kt == nit000 )  THEN 
    711          IF(lwp) WRITE(numout,*)'cice_sbc_hadgam' 
    712          IF( sbc_cpl_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_cpl_alloc : unable to allocate arrays' ) 
    713       ENDIF 
    714  
    715768      !                                         ! =========================== ! 
    716769      !                                         !   Prepare Coupling fields   ! 
     
    730783         CALL cice2nemo(vicen(:,:,jl,:),ht_i(:,:,jl),'T', 1. ) 
    731784      ENDDO 
     785 
     786#if ! defined key_cice4 
     787! Meltpond fraction and depth 
     788      DO jl = 1,ncat 
     789         CALL cice2nemo(apeffn(:,:,jl,:),a_p(:,:,jl),'T', 1. ) 
     790         CALL cice2nemo(trcrn(:,:,nt_hpnd,jl,:),ht_p(:,:,jl),'T', 1. ) 
     791      ENDDO 
     792#endif 
     793 
     794 
     795! If using multilayers thermodynamics in CICE then get top layer temperature 
     796! and effective conductivity        
     797!! When using NEMO with CICE, this change requires use of  
     798!! one of the following two CICE branches: 
     799!! - at CICE5.0,   hadax/r1015_GSI8_with_GSI7 
     800!! - at CICE5.1.2, hadax/vn5.1.2_GSI8 
     801      IF (heat_capacity) THEN 
     802         DO jl = 1,ncat 
     803            CALL cice2nemo(Tn_top(:,:,jl,:),tn_ice(:,:,jl),'T', 1. ) 
     804            CALL cice2nemo(keffn_top(:,:,jl,:),kn_ice(:,:,jl),'T', 1. ) 
     805         ENDDO 
     806! Convert surface temperature to Kelvin 
     807         tn_ice(:,:,:)=tn_ice(:,:,:)+rt0 
     808      ELSE 
     809         tn_ice(:,:,:) = 0.0 
     810         kn_ice(:,:,:) = 0.0 
     811      ENDIF        
     812 
    732813      ! 
    733814      IF( nn_timing == 1 )  CALL timing_stop('cice_sbc_hadgam') 
Note: See TracChangeset for help on using the changeset viewer.