Ignore:
Timestamp:
2019-03-20T19:58:40+01:00 (19 months ago)
Author:
clem
Message:

fix tickets #2256 and #2257

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/releases/release-4.0/src/ICE/icethd_dh.F90

    r10534 r10785  
    614614      DO jk = 1, nlay_s 
    615615         DO ji = 1,npti 
    616             ! mask enthalpy 
    617             rswitch       = 1._wp - MAX(  0._wp , SIGN( 1._wp, - h_s_1d(ji) )  ) 
     616            ! where there is no ice or no snow 
     617            rswitch = ( 1._wp - MAX( 0._wp, SIGN( 1._wp, - h_s_1d(ji) ) ) ) * ( 1._wp - MAX( 0._wp, SIGN(1._wp, - h_i_1d(ji) ) ) ) 
     618            ! mass & energy loss to the ocean 
     619            hfx_res_1d(ji) = hfx_res_1d(ji) + ( 1._wp - rswitch ) * & 
     620               &                              ( e_s_1d(ji,jk) * h_s_1d(ji) * r1_nlay_s * a_i_1d(ji) * r1_rdtice )  ! heat flux to the ocean [W.m-2], < 0 
     621            wfx_res_1d(ji) = wfx_res_1d(ji) + ( 1._wp - rswitch ) * & 
     622               &                              ( rhos          * h_s_1d(ji) * r1_nlay_s * a_i_1d(ji) * r1_rdtice )  ! mass flux 
     623            ! update energy (mass is updated in the next loop) 
    618624            e_s_1d(ji,jk) = rswitch * e_s_1d(ji,jk) 
    619625            ! recalculate t_s_1d from e_s_1d 
     
    622628      END DO 
    623629 
    624       ! --- ensure that a_i = 0 where h_i = 0 --- 
    625       WHERE( h_i_1d(1:npti) == 0._wp )   a_i_1d(1:npti) = 0._wp 
     630      ! --- ensure that a_i = 0 & h_s = 0 where h_i = 0 --- 
     631      WHERE( h_i_1d(1:npti) == 0._wp )    
     632         a_i_1d(1:npti) = 0._wp 
     633         h_s_1d(1:npti) = 0._wp 
     634      END WHERE 
    626635      ! 
    627636   END SUBROUTINE ice_thd_dh 
Note: See TracChangeset for help on using the changeset viewer.