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 12377 for NEMO/trunk/src/OCE/DIA/diahsb.F90 – NEMO

Ignore:
Timestamp:
2020-02-12T15:39:06+01:00 (4 years ago)
Author:
acc
Message:

The big one. Merging all 2019 developments from the option 1 branch back onto the trunk.

This changeset reproduces 2019/dev_r11943_MERGE_2019 on the trunk using a 2-URL merge
onto a working copy of the trunk. I.e.:

svn merge --ignore-ancestry \

svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/trunk \
svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/branches/2019/dev_r11943_MERGE_2019 ./

The --ignore-ancestry flag avoids problems that may otherwise arise from the fact that
the merge history been trunk and branch may have been applied in a different order but
care has been taken before this step to ensure that all applicable fixes and updates
are present in the merge branch.

The trunk state just before this step has been branched to releases/release-4.0-HEAD
and that branch has been immediately tagged as releases/release-4.0.2. Any fixes
or additions in response to tickets on 4.0, 4.0.1 or 4.0.2 should be done on
releases/release-4.0-HEAD. From now on future 'point' releases (e.g. 4.0.2) will
remain unchanged with periodic releases as needs demand. Note release-4.0-HEAD is a
transitional naming convention. Future full releases, say 4.2, will have a release-4.2
branch which fulfills this role and the first point release (e.g. 4.2.0) will be made
immediately following the release branch creation.

2020 developments can be started from any trunk revision later than this one.

Location:
NEMO/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk

    • Property svn:externals
      •  

        old new  
        33^/utils/build/mk@HEAD         mk 
        44^/utils/tools@HEAD            tools 
        5 ^/vendors/AGRIF/dev@HEAD      ext/AGRIF 
         5^/vendors/AGRIF/dev_r11615_ENHANCE-04_namelists_as_internalfiles_agrif@HEAD      ext/AGRIF 
        66^/vendors/FCM@HEAD            ext/FCM 
        77^/vendors/IOIPSL@HEAD         ext/IOIPSL 
  • NEMO/trunk/src/OCE/DIA/diahsb.F90

    r11536 r12377  
    1717   USE phycst         ! physical constants 
    1818   USE sbc_oce        ! surface thermohaline fluxes 
     19   USE isf_oce        ! ice shelf fluxes 
    1920   USE sbcrnf         ! river runoff 
    20    USE sbcisf         ! ice shelves 
    2121   USE domvvl         ! vertical scale factors 
    2222   USE traqsr         ! penetrative solar radiation 
     
    4848   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   ssh_hc_loc_ini, ssh_sc_loc_ini   ! 
    4949   REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   hc_loc_ini, sc_loc_ini, e3t_ini  ! 
    50  
    51    !! * Substitutions 
    52 #  include "vectopt_loop_substitute.h90" 
     50   REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   tmask_ini 
     51 
    5352   !!---------------------------------------------------------------------- 
    5453   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    5857CONTAINS 
    5958 
    60    SUBROUTINE dia_hsb( kt ) 
     59   SUBROUTINE dia_hsb( kt, Kbb, Kmm ) 
    6160      !!--------------------------------------------------------------------------- 
    6261      !!                  ***  ROUTINE dia_hsb  *** 
     
    6968      !! 
    7069      !!--------------------------------------------------------------------------- 
    71       INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
     70      INTEGER, INTENT(in) ::   kt         ! ocean time-step index 
     71      INTEGER, INTENT(in) ::   Kbb, Kmm   ! ocean time level indices 
    7272      ! 
    7373      INTEGER    ::   ji, jj, jk                  ! dummy loop indice 
     
    8686      IF( ln_timing )   CALL timing_start('dia_hsb')       
    8787      ! 
    88       tsn(:,:,:,1) = tsn(:,:,:,1) * tmask(:,:,:) ; tsb(:,:,:,1) = tsb(:,:,:,1) * tmask(:,:,:) ; 
    89       tsn(:,:,:,2) = tsn(:,:,:,2) * tmask(:,:,:) ; tsb(:,:,:,2) = tsb(:,:,:,2) * tmask(:,:,:) ; 
     88      ts(:,:,:,1,Kmm) = ts(:,:,:,1,Kmm) * tmask(:,:,:) ; ts(:,:,:,1,Kbb) = ts(:,:,:,1,Kbb) * tmask(:,:,:) ; 
     89      ts(:,:,:,2,Kmm) = ts(:,:,:,2,Kmm) * tmask(:,:,:) ; ts(:,:,:,2,Kbb) = ts(:,:,:,2,Kbb) * tmask(:,:,:) ; 
    9090      ! ------------------------- ! 
    9191      ! 1 - Trends due to forcing ! 
    9292      ! ------------------------- ! 
    93       z_frc_trd_v = r1_rau0 * glob_sum( 'diahsb', - ( emp(:,:) - rnf(:,:) + fwfisf(:,:) ) * surf(:,:) )   ! volume fluxes 
     93      z_frc_trd_v = r1_rau0 * glob_sum( 'diahsb', - ( emp(:,:) - rnf(:,:) + fwfisf_cav(:,:) + fwfisf_par(:,:) ) * surf(:,:) )   ! volume fluxes 
    9494      z_frc_trd_t =           glob_sum( 'diahsb', sbc_tsc(:,:,jp_tem) * surf(:,:) )                       ! heat fluxes 
    9595      z_frc_trd_s =           glob_sum( 'diahsb', sbc_tsc(:,:,jp_sal) * surf(:,:) )                       ! salt fluxes 
     
    9898      IF( ln_rnf_sal)   z_frc_trd_s = z_frc_trd_s + glob_sum( 'diahsb', rnf_tsc(:,:,jp_sal) * surf(:,:) ) 
    9999      !                    ! Add ice shelf heat & salt input 
    100       IF( ln_isf    )   z_frc_trd_t = z_frc_trd_t + glob_sum( 'diahsb', risf_tsc(:,:,jp_tem) * surf(:,:) ) 
     100      IF( ln_isf    )   z_frc_trd_t = z_frc_trd_t & 
     101         &                          + glob_sum( 'diahsb', ( risf_cav_tsc(:,:,jp_tem) + risf_par_tsc(:,:,jp_tem) ) * surf(:,:) ) 
    101102      !                    ! Add penetrative solar radiation 
    102103      IF( ln_traqsr )   z_frc_trd_t = z_frc_trd_t + r1_rau0_rcp * glob_sum( 'diahsb', qsr     (:,:) * surf(:,:) ) 
     
    108109            DO ji=1,jpi 
    109110               DO jj=1,jpj 
    110                   z2d0(ji,jj) = surf(ji,jj) * wn(ji,jj,mikt(ji,jj)) * tsb(ji,jj,mikt(ji,jj),jp_tem) 
    111                   z2d1(ji,jj) = surf(ji,jj) * wn(ji,jj,mikt(ji,jj)) * tsb(ji,jj,mikt(ji,jj),jp_sal) 
     111                  z2d0(ji,jj) = surf(ji,jj) * ww(ji,jj,mikt(ji,jj)) * ts(ji,jj,mikt(ji,jj),jp_tem,Kbb) 
     112                  z2d1(ji,jj) = surf(ji,jj) * ww(ji,jj,mikt(ji,jj)) * ts(ji,jj,mikt(ji,jj),jp_sal,Kbb) 
    112113               END DO 
    113114            END DO 
    114115         ELSE 
    115             z2d0(:,:) = surf(:,:) * wn(:,:,1) * tsb(:,:,1,jp_tem) 
    116             z2d1(:,:) = surf(:,:) * wn(:,:,1) * tsb(:,:,1,jp_sal) 
     116            z2d0(:,:) = surf(:,:) * ww(:,:,1) * ts(:,:,1,jp_tem,Kbb) 
     117            z2d1(:,:) = surf(:,:) * ww(:,:,1) * ts(:,:,1,jp_sal,Kbb) 
    117118         END IF 
    118119         z_wn_trd_t = - glob_sum( 'diahsb', z2d0 )  
     
    135136 
    136137      !                    ! volume variation (calculated with ssh) 
    137       zdiff_v1 = glob_sum_full( 'diahsb', surf(:,:)*sshn(:,:) - surf_ini(:,:)*ssh_ini(:,:) ) 
     138      zdiff_v1 = glob_sum_full( 'diahsb', surf(:,:)*ssh(:,:,Kmm) - surf_ini(:,:)*ssh_ini(:,:) ) 
    138139 
    139140      !                    ! heat & salt content variation (associated with ssh) 
     
    142143            DO ji = 1, jpi 
    143144               DO jj = 1, jpj 
    144                   z2d0(ji,jj) = surf(ji,jj) * ( tsn(ji,jj,mikt(ji,jj),jp_tem) * sshn(ji,jj) - ssh_hc_loc_ini(ji,jj) )  
    145                   z2d1(ji,jj) = surf(ji,jj) * ( tsn(ji,jj,mikt(ji,jj),jp_sal) * sshn(ji,jj) - ssh_sc_loc_ini(ji,jj) )  
     145                  z2d0(ji,jj) = surf(ji,jj) * ( ts(ji,jj,mikt(ji,jj),jp_tem,Kmm) * ssh(ji,jj,Kmm) - ssh_hc_loc_ini(ji,jj) )  
     146                  z2d1(ji,jj) = surf(ji,jj) * ( ts(ji,jj,mikt(ji,jj),jp_sal,Kmm) * ssh(ji,jj,Kmm) - ssh_sc_loc_ini(ji,jj) )  
    146147               END DO 
    147148            END DO 
    148149         ELSE                          ! no under ice-shelf seas 
    149             z2d0(:,:) = surf(:,:) * ( tsn(:,:,1,jp_tem) * sshn(:,:) - ssh_hc_loc_ini(:,:) )  
    150             z2d1(:,:) = surf(:,:) * ( tsn(:,:,1,jp_sal) * sshn(:,:) - ssh_sc_loc_ini(:,:) )  
     150            z2d0(:,:) = surf(:,:) * ( ts(:,:,1,jp_tem,Kmm) * ssh(:,:,Kmm) - ssh_hc_loc_ini(:,:) )  
     151            z2d1(:,:) = surf(:,:) * ( ts(:,:,1,jp_sal,Kmm) * ssh(:,:,Kmm) - ssh_sc_loc_ini(:,:) )  
    151152         END IF 
    152153         z_ssh_hc = glob_sum_full( 'diahsb', z2d0 )  
     
    155156      ! 
    156157      DO jk = 1, jpkm1           ! volume variation (calculated with scale factors) 
    157          zwrk(:,:,jk) = ( surf(:,:)*e3t_n(:,:,jk) - surf_ini(:,:)*e3t_ini(:,:,jk) ) * tmask(:,:,jk) 
     158         zwrk(:,:,jk) = surf(:,:)*e3t(:,:,jk,Kmm)*tmask(:,:,jk) - surf_ini(:,:)*e3t_ini(:,:,jk)*tmask_ini(:,:,jk) 
    158159      END DO 
    159       zdiff_v2 = glob_sum_full( 'diahsb', zwrk(:,:,:) ) 
     160      zdiff_v2 = glob_sum_full( 'diahsb', zwrk(:,:,:) )     ! glob_sum_full needed as tmask and tmask_ini could be different 
    160161      DO jk = 1, jpkm1           ! heat content variation 
    161          zwrk(:,:,jk) = ( surf(:,:)*e3t_n(:,:,jk)*tsn(:,:,jk,jp_tem) - surf_ini(:,:)*hc_loc_ini(:,:,jk) ) * tmask(:,:,jk) 
     162         zwrk(:,:,jk) = ( surf(:,:)*e3t(:,:,jk,Kmm)*ts(:,:,jk,jp_tem,Kmm) - surf_ini(:,:)*hc_loc_ini(:,:,jk) ) 
    162163      END DO 
    163164      zdiff_hc = glob_sum_full( 'diahsb', zwrk(:,:,:) ) 
    164165      DO jk = 1, jpkm1           ! salt content variation 
    165          zwrk(:,:,jk) = ( surf(:,:)*e3t_n(:,:,jk)*tsn(:,:,jk,jp_sal) - surf_ini(:,:)*sc_loc_ini(:,:,jk) ) * tmask(:,:,jk) 
     166         zwrk(:,:,jk) = ( surf(:,:)*e3t(:,:,jk,Kmm)*ts(:,:,jk,jp_sal,Kmm) - surf_ini(:,:)*sc_loc_ini(:,:,jk) ) 
    166167      END DO 
    167168      zdiff_sc = glob_sum_full( 'diahsb', zwrk(:,:,:) ) 
     
    185186      ! ----------------------- ! 
    186187      DO jk = 1, jpkm1           ! total ocean volume (calculated with scale factors) 
    187          zwrk(:,:,jk) = surf(:,:) * e3t_n(:,:,jk) * tmask(:,:,jk) 
     188         zwrk(:,:,jk) = surf(:,:) * e3t(:,:,jk,Kmm) * tmask(:,:,jk) 
    188189      END DO 
    189       zvol_tot = glob_sum_full( 'diahsb', zwrk(:,:,:) ) 
     190      zvol_tot = glob_sum( 'diahsb', zwrk(:,:,:) ) 
    190191 
    191192!!gm to be added ? 
    192193!      IF( ln_linssh ) THEN            ! fixed volume, add the ssh contribution 
    193 !        zvol_tot = zvol_tot + glob_sum( 'diahsb', surf(:,:) * sshn(:,:) ) 
     194!        zvol_tot = zvol_tot + glob_sum( 'diahsb', surf(:,:) * ssh(:,:,Kmm) ) 
    194195!      ENDIF 
    195196!!gm end 
     
    233234      ENDIF 
    234235      ! 
    235       IF( lrst_oce )   CALL dia_hsb_rst( kt, 'WRITE' ) 
     236      IF( lrst_oce )   CALL dia_hsb_rst( kt, Kmm, 'WRITE' ) 
    236237      ! 
    237238      IF( ln_timing )   CALL timing_stop('dia_hsb') 
     
    240241 
    241242 
    242    SUBROUTINE dia_hsb_rst( kt, cdrw ) 
     243   SUBROUTINE dia_hsb_rst( kt, Kmm, cdrw ) 
    243244      !!--------------------------------------------------------------------- 
    244245      !!                   ***  ROUTINE dia_hsb_rst  *** 
     
    249250      !!---------------------------------------------------------------------- 
    250251      INTEGER         , INTENT(in) ::   kt     ! ocean time-step 
     252      INTEGER         , INTENT(in) ::   Kmm    ! ocean time level index 
    251253      CHARACTER(len=*), INTENT(in) ::   cdrw   ! "READ"/"WRITE" flag 
    252254      ! 
     
    270272            CALL iom_get( numror, jpdom_autoglo, 'ssh_ini'   , ssh_ini   , ldxios = lrxios ) 
    271273            CALL iom_get( numror, jpdom_autoglo, 'e3t_ini'   , e3t_ini   , ldxios = lrxios ) 
     274            CALL iom_get( numror, jpdom_autoglo, 'tmask_ini' , tmask_ini , ldxios = lrxios ) 
    272275            CALL iom_get( numror, jpdom_autoglo, 'hc_loc_ini', hc_loc_ini, ldxios = lrxios ) 
    273276            CALL iom_get( numror, jpdom_autoglo, 'sc_loc_ini', sc_loc_ini, ldxios = lrxios ) 
     
    281284            IF(lwp) WRITE(numout,*) 
    282285            surf_ini(:,:) = e1e2t(:,:) * tmask_i(:,:)         ! initial ocean surface 
    283             ssh_ini(:,:) = sshn(:,:)                          ! initial ssh 
     286            ssh_ini(:,:) = ssh(:,:,Kmm)                          ! initial ssh 
    284287            DO jk = 1, jpk 
    285288              ! if ice sheet/oceqn coupling, need to mask ini variables here (mask could change at the next NEMO instance). 
    286                e3t_ini   (:,:,jk) = e3t_n(:,:,jk)                      * tmask(:,:,jk)  ! initial vertical scale factors 
    287                hc_loc_ini(:,:,jk) = tsn(:,:,jk,jp_tem) * e3t_n(:,:,jk) * tmask(:,:,jk)  ! initial heat content 
    288                sc_loc_ini(:,:,jk) = tsn(:,:,jk,jp_sal) * e3t_n(:,:,jk) * tmask(:,:,jk)  ! initial salt content 
     289               e3t_ini   (:,:,jk) = e3t(:,:,jk,Kmm)                      * tmask(:,:,jk)  ! initial vertical scale factors 
     290               tmask_ini (:,:,jk) = tmask(:,:,jk)                                       ! initial mask 
     291               hc_loc_ini(:,:,jk) = ts(:,:,jk,jp_tem,Kmm) * e3t(:,:,jk,Kmm) * tmask(:,:,jk)  ! initial heat content 
     292               sc_loc_ini(:,:,jk) = ts(:,:,jk,jp_sal,Kmm) * e3t(:,:,jk,Kmm) * tmask(:,:,jk)  ! initial salt content 
    289293            END DO 
    290294            frc_v = 0._wp                                           ! volume       trend due to forcing 
     
    295299                  DO ji = 1, jpi 
    296300                     DO jj = 1, jpj 
    297                         ssh_hc_loc_ini(ji,jj) = tsn(ji,jj,mikt(ji,jj),jp_tem) * sshn(ji,jj)   ! initial heat content in ssh 
    298                         ssh_sc_loc_ini(ji,jj) = tsn(ji,jj,mikt(ji,jj),jp_sal) * sshn(ji,jj)   ! initial salt content in ssh 
     301                        ssh_hc_loc_ini(ji,jj) = ts(ji,jj,mikt(ji,jj),jp_tem,Kmm) * ssh(ji,jj,Kmm)   ! initial heat content in ssh 
     302                        ssh_sc_loc_ini(ji,jj) = ts(ji,jj,mikt(ji,jj),jp_sal,Kmm) * ssh(ji,jj,Kmm)   ! initial salt content in ssh 
    299303                     END DO 
    300304                   END DO 
    301305                ELSE 
    302                   ssh_hc_loc_ini(:,:) = tsn(:,:,1,jp_tem) * sshn(:,:)   ! initial heat content in ssh 
    303                   ssh_sc_loc_ini(:,:) = tsn(:,:,1,jp_sal) * sshn(:,:)   ! initial salt content in ssh 
     306                  ssh_hc_loc_ini(:,:) = ts(:,:,1,jp_tem,Kmm) * ssh(:,:,Kmm)   ! initial heat content in ssh 
     307                  ssh_sc_loc_ini(:,:) = ts(:,:,1,jp_sal,Kmm) * ssh(:,:,Kmm)   ! initial salt content in ssh 
    304308               END IF 
    305309               frc_wn_t = 0._wp                                       ! initial heat content misfit due to free surface 
     
    325329         CALL iom_rstput( kt, nitrst, numrow, 'ssh_ini'   , ssh_ini   , ldxios = lwxios ) 
    326330         CALL iom_rstput( kt, nitrst, numrow, 'e3t_ini'   , e3t_ini   , ldxios = lwxios ) 
     331         CALL iom_rstput( kt, nitrst, numrow, 'tmask_ini' , tmask_ini , ldxios = lwxios ) 
    327332         CALL iom_rstput( kt, nitrst, numrow, 'hc_loc_ini', hc_loc_ini, ldxios = lwxios ) 
    328333         CALL iom_rstput( kt, nitrst, numrow, 'sc_loc_ini', sc_loc_ini, ldxios = lwxios ) 
     
    338343 
    339344 
    340    SUBROUTINE dia_hsb_init 
     345   SUBROUTINE dia_hsb_init( Kmm ) 
    341346      !!--------------------------------------------------------------------------- 
    342347      !!                  ***  ROUTINE dia_hsb  *** 
     
    350355      !!             - Compute coefficients for conversion 
    351356      !!--------------------------------------------------------------------------- 
     357      INTEGER, INTENT(in) :: Kmm ! time level index 
     358      ! 
    352359      INTEGER ::   ierror, ios   ! local integer 
    353360      !! 
     
    360367         WRITE(numout,*) '~~~~~~~~~~~~ ' 
    361368      ENDIF 
    362       REWIND( numnam_ref )              ! Namelist namhsb in reference namelist 
    363369      READ  ( numnam_ref, namhsb, IOSTAT = ios, ERR = 901) 
    364370901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namhsb in reference namelist' ) 
    365       REWIND( numnam_cfg )              ! Namelist namhsb in configuration namelist 
    366371      READ  ( numnam_cfg, namhsb, IOSTAT = ios, ERR = 902 ) 
    367372902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namhsb in configuration namelist' ) 
     
    396401      ! ------------------- ! 
    397402      ALLOCATE( hc_loc_ini(jpi,jpj,jpk), sc_loc_ini(jpi,jpj,jpk), surf_ini(jpi,jpj), & 
    398          &      e3t_ini(jpi,jpj,jpk), surf(jpi,jpj),  ssh_ini(jpi,jpj), STAT=ierror  ) 
     403         &      e3t_ini(jpi,jpj,jpk), surf(jpi,jpj),  ssh_ini(jpi,jpj), tmask_ini(jpi,jpj,jpk),STAT=ierror  ) 
    399404      IF( ierror > 0 ) THEN 
    400405         CALL ctl_stop( 'dia_hsb_init: unable to allocate hc_loc_ini' )   ;   RETURN 
     
    417422      ! 4 - initial conservation variables ! 
    418423      ! ---------------------------------- ! 
    419       CALL dia_hsb_rst( nit000, 'READ' )  !* read or initialize all required files 
     424      CALL dia_hsb_rst( nit000, Kmm, 'READ' )  !* read or initialize all required files 
    420425      ! 
    421426   END SUBROUTINE dia_hsb_init 
Note: See TracChangeset for help on using the changeset viewer.