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 13463 for NEMO/branches/2019/dev_r11351_fldread_with_XIOS/src/OCE/ASM/asminc.F90 – NEMO

Ignore:
Timestamp:
2020-09-14T17:40:34+02:00 (4 years ago)
Author:
andmirek
Message:

Ticket #2195:update to trunk 13461

Location:
NEMO/branches/2019/dev_r11351_fldread_with_XIOS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11351_fldread_with_XIOS

    • 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_r12970_AGRIF_CMEMS      ext/AGRIF 
        66^/vendors/FCM@HEAD            ext/FCM 
        77^/vendors/IOIPSL@HEAD         ext/IOIPSL 
         8 
         9# SETTE 
         10^/utils/CI/sette@13382        sette 
  • NEMO/branches/2019/dev_r11351_fldread_with_XIOS/src/OCE/ASM/asminc.F90

    r10425 r13463  
    9494 
    9595   !! * Substitutions 
    96 #  include "vectopt_loop_substitute.h90" 
     96#  include "do_loop_substitute.h90" 
     97#  include "domzgr_substitute.h90" 
    9798   !!---------------------------------------------------------------------- 
    9899   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    102103CONTAINS 
    103104 
    104    SUBROUTINE asm_inc_init 
     105   SUBROUTINE asm_inc_init( Kbb, Kmm, Krhs ) 
    105106      !!---------------------------------------------------------------------- 
    106107      !!                    ***  ROUTINE asm_inc_init  *** 
     
    112113      !! ** Action  :  
    113114      !!---------------------------------------------------------------------- 
     115      INTEGER, INTENT(in) ::  Kbb, Kmm, Krhs  ! time level indices 
     116      ! 
    114117      INTEGER :: ji, jj, jk, jt  ! dummy loop indices 
    115118      INTEGER :: imid, inum      ! local integers 
     
    145148      ln_temnofreeze = .FALSE. 
    146149 
    147       REWIND( numnam_ref )              ! Namelist nam_asminc in reference namelist : Assimilation increment 
    148150      READ  ( numnam_ref, nam_asminc, IOSTAT = ios, ERR = 901) 
    149 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_asminc in reference namelist', lwp ) 
    150       REWIND( numnam_cfg )              ! Namelist nam_asminc in configuration namelist : Assimilation increment 
     151901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_asminc in reference namelist' ) 
    151152      READ  ( numnam_cfg, nam_asminc, IOSTAT = ios, ERR = 902 ) 
    152 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nam_asminc in configuration namelist', lwp ) 
     153902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nam_asminc in configuration namelist' ) 
    153154      IF(lwm) WRITE ( numond, nam_asminc ) 
    154155 
     
    359360 
    360361         IF ( ln_trainc ) THEN    
    361             CALL iom_get( inum, jpdom_autoglo, 'bckint', t_bkginc, 1 ) 
    362             CALL iom_get( inum, jpdom_autoglo, 'bckins', s_bkginc, 1 ) 
     362            CALL iom_get( inum, jpdom_auto, 'bckint', t_bkginc, 1 ) 
     363            CALL iom_get( inum, jpdom_auto, 'bckins', s_bkginc, 1 ) 
    363364            ! Apply the masks 
    364365            t_bkginc(:,:,:) = t_bkginc(:,:,:) * tmask(:,:,:) 
     
    371372 
    372373         IF ( ln_dyninc ) THEN    
    373             CALL iom_get( inum, jpdom_autoglo, 'bckinu', u_bkginc, 1 )               
    374             CALL iom_get( inum, jpdom_autoglo, 'bckinv', v_bkginc, 1 )               
     374            CALL iom_get( inum, jpdom_auto, 'bckinu', u_bkginc, 1 )               
     375            CALL iom_get( inum, jpdom_auto, 'bckinv', v_bkginc, 1 )               
    375376            ! Apply the masks 
    376377            u_bkginc(:,:,:) = u_bkginc(:,:,:) * umask(:,:,:) 
     
    383384         
    384385         IF ( ln_sshinc ) THEN 
    385             CALL iom_get( inum, jpdom_autoglo, 'bckineta', ssh_bkginc, 1 ) 
     386            CALL iom_get( inum, jpdom_auto, 'bckineta', ssh_bkginc, 1 ) 
    386387            ! Apply the masks 
    387388            ssh_bkginc(:,:) = ssh_bkginc(:,:) * tmask(:,:,1) 
     
    392393 
    393394         IF ( ln_seaiceinc ) THEN 
    394             CALL iom_get( inum, jpdom_autoglo, 'bckinseaice', seaice_bkginc, 1 ) 
     395            CALL iom_get( inum, jpdom_auto, 'bckinseaice', seaice_bkginc, 1 ) 
    395396            ! Apply the masks 
    396397            seaice_bkginc(:,:) = seaice_bkginc(:,:) * tmask(:,:,1) 
     
    413414            DO jk = 1, jpkm1           ! zhdiv = e1e1 * div 
    414415               zhdiv(:,:) = 0._wp 
    415                DO jj = 2, jpjm1 
    416                   DO ji = fs_2, fs_jpim1   ! vector opt. 
    417                      zhdiv(ji,jj) = (  e2u(ji  ,jj) * e3u_n(ji  ,jj,jk) * u_bkginc(ji  ,jj,jk)    & 
    418                         &            - e2u(ji-1,jj) * e3u_n(ji-1,jj,jk) * u_bkginc(ji-1,jj,jk)    & 
    419                         &            + e1v(ji,jj  ) * e3v_n(ji,jj  ,jk) * v_bkginc(ji,jj  ,jk)    & 
    420                         &            - e1v(ji,jj-1) * e3v_n(ji,jj-1,jk) * v_bkginc(ji,jj-1,jk)  ) / e3t_n(ji,jj,jk) 
    421                   END DO 
    422                END DO 
    423                CALL lbc_lnk( 'asminc', zhdiv, 'T', 1. )   ! lateral boundary cond. (no sign change) 
     416               DO_2D( 0, 0, 0, 0 ) 
     417                  zhdiv(ji,jj) = (  e2u(ji  ,jj) * e3u(ji  ,jj,jk,Kmm) * u_bkginc(ji  ,jj,jk)    & 
     418                     &            - e2u(ji-1,jj) * e3u(ji-1,jj,jk,Kmm) * u_bkginc(ji-1,jj,jk)    & 
     419                     &            + e1v(ji,jj  ) * e3v(ji,jj  ,jk,Kmm) * v_bkginc(ji,jj  ,jk)    & 
     420                     &            - e1v(ji,jj-1) * e3v(ji,jj-1,jk,Kmm) * v_bkginc(ji,jj-1,jk)  ) & 
     421                     &            / e3t(ji,jj,jk,Kmm) 
     422               END_2D 
     423               CALL lbc_lnk( 'asminc', zhdiv, 'T', 1.0_wp )   ! lateral boundary cond. (no sign change) 
    424424               ! 
    425                DO jj = 2, jpjm1 
    426                   DO ji = fs_2, fs_jpim1   ! vector opt. 
    427                      u_bkginc(ji,jj,jk) = u_bkginc(ji,jj,jk)                         & 
    428                         &               + 0.2_wp * ( zhdiv(ji+1,jj) - zhdiv(ji  ,jj) ) * r1_e1u(ji,jj) * umask(ji,jj,jk) 
    429                      v_bkginc(ji,jj,jk) = v_bkginc(ji,jj,jk)                         & 
    430                         &               + 0.2_wp * ( zhdiv(ji,jj+1) - zhdiv(ji,jj  ) ) * r1_e2v(ji,jj) * vmask(ji,jj,jk)  
    431                   END DO 
    432                END DO 
     425               DO_2D( 0, 0, 0, 0 ) 
     426                  u_bkginc(ji,jj,jk) = u_bkginc(ji,jj,jk)                         & 
     427                     &               + 0.2_wp * ( zhdiv(ji+1,jj) - zhdiv(ji  ,jj) ) * r1_e1u(ji,jj) * umask(ji,jj,jk) 
     428                  v_bkginc(ji,jj,jk) = v_bkginc(ji,jj,jk)                         & 
     429                     &               + 0.2_wp * ( zhdiv(ji,jj+1) - zhdiv(ji,jj  ) ) * r1_e2v(ji,jj) * vmask(ji,jj,jk)  
     430               END_2D 
    433431            END DO 
    434432            ! 
     
    469467         ! 
    470468         IF ( ln_trainc ) THEN    
    471             CALL iom_get( inum, jpdom_autoglo, 'tn', t_bkg ) 
    472             CALL iom_get( inum, jpdom_autoglo, 'sn', s_bkg ) 
     469            CALL iom_get( inum, jpdom_auto, 'tn', t_bkg ) 
     470            CALL iom_get( inum, jpdom_auto, 'sn', s_bkg ) 
    473471            t_bkg(:,:,:) = t_bkg(:,:,:) * tmask(:,:,:) 
    474472            s_bkg(:,:,:) = s_bkg(:,:,:) * tmask(:,:,:) 
     
    476474         ! 
    477475         IF ( ln_dyninc ) THEN    
    478             CALL iom_get( inum, jpdom_autoglo, 'un', u_bkg ) 
    479             CALL iom_get( inum, jpdom_autoglo, 'vn', v_bkg ) 
     476            CALL iom_get( inum, jpdom_auto, 'un', u_bkg, cd_type = 'U', psgn = 1._wp ) 
     477            CALL iom_get( inum, jpdom_auto, 'vn', v_bkg, cd_type = 'V', psgn = 1._wp ) 
    480478            u_bkg(:,:,:) = u_bkg(:,:,:) * umask(:,:,:) 
    481479            v_bkg(:,:,:) = v_bkg(:,:,:) * vmask(:,:,:) 
     
    483481         ! 
    484482         IF ( ln_sshinc ) THEN 
    485             CALL iom_get( inum, jpdom_autoglo, 'sshn', ssh_bkg ) 
     483            CALL iom_get( inum, jpdom_auto, 'sshn', ssh_bkg ) 
    486484            ssh_bkg(:,:) = ssh_bkg(:,:) * tmask(:,:,1) 
    487485         ENDIF 
     
    491489      ENDIF 
    492490      ! 
    493       IF(lwp) WRITE(numout,*) '   ==>>>   Euler time step switch is ', neuler 
     491      IF(lwp) WRITE(numout,*) '   ==>>>   Euler time step switch is ', l_1st_euler 
    494492      ! 
    495493      IF( lk_asminc ) THEN                            !==  data assimilation  ==! 
    496          IF( ln_bkgwri )   CALL asm_bkg_wri( nit000 - 1 )      ! Output background fields 
     494         IF( ln_bkgwri )   CALL asm_bkg_wri( nit000 - 1, Kmm )      ! Output background fields 
    497495         IF( ln_asmdin ) THEN                                  ! Direct initialization 
    498             IF( ln_trainc )   CALL tra_asm_inc( nit000 - 1 )      ! Tracers 
    499             IF( ln_dyninc )   CALL dyn_asm_inc( nit000 - 1 )      ! Dynamics 
    500             IF( ln_sshinc )   CALL ssh_asm_inc( nit000 - 1 )      ! SSH 
     496            IF( ln_trainc )   CALL tra_asm_inc( nit000 - 1, Kbb, Kmm, ts    , Krhs )      ! Tracers 
     497            IF( ln_dyninc )   CALL dyn_asm_inc( nit000 - 1, Kbb, Kmm, uu, vv, Krhs )      ! Dynamics 
     498            IF( ln_sshinc )   CALL ssh_asm_inc( nit000 - 1, Kbb, Kmm )                    ! SSH 
    501499         ENDIF 
    502500      ENDIF 
     
    505503    
    506504    
    507    SUBROUTINE tra_asm_inc( kt ) 
     505   SUBROUTINE tra_asm_inc( kt, Kbb, Kmm, pts, Krhs ) 
    508506      !!---------------------------------------------------------------------- 
    509507      !!                    ***  ROUTINE tra_asm_inc  *** 
     
    515513      !! ** Action  :  
    516514      !!---------------------------------------------------------------------- 
    517       INTEGER, INTENT(IN) ::   kt   ! Current time step 
     515      INTEGER                                  , INTENT(in   ) :: kt             ! Current time step 
     516      INTEGER                                  , INTENT(in   ) :: Kbb, Kmm, Krhs ! Time level indices 
     517      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts            ! active tracers and RHS of tracer equation 
    518518      ! 
    519519      INTEGER  :: ji, jj, jk 
     
    526526      ! used to prevent the applied increments taking the temperature below the local freezing point  
    527527      DO jk = 1, jpkm1 
    528         CALL eos_fzp( tsn(:,:,jk,jp_sal), fzptnz(:,:,jk), gdept_n(:,:,jk) ) 
     528        CALL eos_fzp( pts(:,:,jk,jp_sal,Kmm), fzptnz(:,:,jk), gdept(:,:,jk,Kmm) ) 
    529529      END DO 
    530530         ! 
     
    536536            ! 
    537537            it = kt - nit000 + 1 
    538             zincwgt = wgtiau(it) / rdt   ! IAU weight for the current time step 
     538            zincwgt = wgtiau(it) / rn_Dt   ! IAU weight for the current time step 
    539539            ! 
    540540            IF(lwp) THEN 
     
    549549                  ! Do not apply negative increments if the temperature will fall below freezing 
    550550                  WHERE(t_bkginc(:,:,jk) > 0.0_wp .OR. & 
    551                      &   tsn(:,:,jk,jp_tem) + tsa(:,:,jk,jp_tem) + t_bkginc(:,:,jk) * wgtiau(it) > fzptnz(:,:,jk) )  
    552                      tsa(:,:,jk,jp_tem) = tsa(:,:,jk,jp_tem) + t_bkginc(:,:,jk) * zincwgt   
     551                     &   pts(:,:,jk,jp_tem,Kmm) + pts(:,:,jk,jp_tem,Krhs) + t_bkginc(:,:,jk) * wgtiau(it) > fzptnz(:,:,jk) )  
     552                     pts(:,:,jk,jp_tem,Krhs) = pts(:,:,jk,jp_tem,Krhs) + t_bkginc(:,:,jk) * zincwgt   
    553553                  END WHERE 
    554554               ELSE 
    555                   tsa(:,:,jk,jp_tem) = tsa(:,:,jk,jp_tem) + t_bkginc(:,:,jk) * zincwgt   
     555                  pts(:,:,jk,jp_tem,Krhs) = pts(:,:,jk,jp_tem,Krhs) + t_bkginc(:,:,jk) * zincwgt   
    556556               ENDIF 
    557557               IF (ln_salfix) THEN 
     
    559559                  ! minimum value salfixmin 
    560560                  WHERE(s_bkginc(:,:,jk) > 0.0_wp .OR. & 
    561                      &   tsn(:,:,jk,jp_sal) + tsa(:,:,jk,jp_sal) + s_bkginc(:,:,jk) * wgtiau(it) > salfixmin )  
    562                      tsa(:,:,jk,jp_sal) = tsa(:,:,jk,jp_sal) + s_bkginc(:,:,jk) * zincwgt 
     561                     &   pts(:,:,jk,jp_sal,Kmm) + pts(:,:,jk,jp_sal,Krhs) + s_bkginc(:,:,jk) * wgtiau(it) > salfixmin )  
     562                     pts(:,:,jk,jp_sal,Krhs) = pts(:,:,jk,jp_sal,Krhs) + s_bkginc(:,:,jk) * zincwgt 
    563563                  END WHERE 
    564564               ELSE 
    565                   tsa(:,:,jk,jp_sal) = tsa(:,:,jk,jp_sal) + s_bkginc(:,:,jk) * zincwgt 
     565                  pts(:,:,jk,jp_sal,Krhs) = pts(:,:,jk,jp_sal,Krhs) + s_bkginc(:,:,jk) * zincwgt 
    566566               ENDIF 
    567567            END DO 
     
    579579         IF ( kt == nitdin_r ) THEN 
    580580            ! 
    581             neuler = 0  ! Force Euler forward step 
     581            l_1st_euler = .TRUE.  ! Force Euler forward step 
    582582            ! 
    583583            ! Initialize the now fields with the background + increment 
    584584            IF (ln_temnofreeze) THEN 
    585585               ! Do not apply negative increments if the temperature will fall below freezing 
    586                WHERE( t_bkginc(:,:,:) > 0.0_wp .OR. tsn(:,:,:,jp_tem) + t_bkginc(:,:,:) > fzptnz(:,:,:) )  
    587                   tsn(:,:,:,jp_tem) = t_bkg(:,:,:) + t_bkginc(:,:,:)    
     586               WHERE( t_bkginc(:,:,:) > 0.0_wp .OR. pts(:,:,:,jp_tem,Kmm) + t_bkginc(:,:,:) > fzptnz(:,:,:) )  
     587                  pts(:,:,:,jp_tem,Kmm) = t_bkg(:,:,:) + t_bkginc(:,:,:)    
    588588               END WHERE 
    589589            ELSE 
    590                tsn(:,:,:,jp_tem) = t_bkg(:,:,:) + t_bkginc(:,:,:)    
     590               pts(:,:,:,jp_tem,Kmm) = t_bkg(:,:,:) + t_bkginc(:,:,:)    
    591591            ENDIF 
    592592            IF (ln_salfix) THEN 
    593593               ! Do not apply negative increments if the salinity will fall below a specified 
    594594               ! minimum value salfixmin 
    595                WHERE( s_bkginc(:,:,:) > 0.0_wp .OR. tsn(:,:,:,jp_sal) + s_bkginc(:,:,:) > salfixmin )  
    596                   tsn(:,:,:,jp_sal) = s_bkg(:,:,:) + s_bkginc(:,:,:)    
     595               WHERE( s_bkginc(:,:,:) > 0.0_wp .OR. pts(:,:,:,jp_sal,Kmm) + s_bkginc(:,:,:) > salfixmin )  
     596                  pts(:,:,:,jp_sal,Kmm) = s_bkg(:,:,:) + s_bkginc(:,:,:)    
    597597               END WHERE 
    598598            ELSE 
    599                tsn(:,:,:,jp_sal) = s_bkg(:,:,:) + s_bkginc(:,:,:)    
     599               pts(:,:,:,jp_sal,Kmm) = s_bkg(:,:,:) + s_bkginc(:,:,:)    
    600600            ENDIF 
    601601 
    602             tsb(:,:,:,:) = tsn(:,:,:,:)                 ! Update before fields 
    603  
    604             CALL eos( tsb, rhd, rhop, gdept_0(:,:,:) )  ! Before potential and in situ densities 
     602            pts(:,:,:,:,Kbb) = pts(:,:,:,:,Kmm)                 ! Update before fields 
     603 
     604            CALL eos( pts(:,:,:,:,Kbb), rhd, rhop, gdept_0(:,:,:) )  ! Before potential and in situ densities 
    605605!!gm  fabien 
    606 !            CALL eos( tsb, rhd, rhop )                ! Before potential and in situ densities 
     606!            CALL eos( pts(:,:,:,:,Kbb), rhd, rhop )                ! Before potential and in situ densities 
    607607!!gm 
    608608 
    609             IF( ln_zps .AND. .NOT. lk_c1d .AND. .NOT. ln_isfcav)      & 
    610                &  CALL zps_hde    ( kt, jpts, tsb, gtsu, gtsv,        &  ! Partial steps: before horizontal gradient 
    611                &                              rhd, gru , grv          )  ! of t, s, rd at the last ocean level 
    612             IF( ln_zps .AND. .NOT. lk_c1d .AND.       ln_isfcav)      & 
    613                &  CALL zps_hde_isf( nit000, jpts, tsb, gtsu, gtsv, gtui, gtvi,    &    ! Partial steps for top cell (ISF) 
    614                &                                  rhd, gru , grv , grui, grvi       ! of t, s, rd at the last ocean level 
     609            IF( ln_zps .AND. .NOT. lk_c1d .AND. .NOT. ln_isfcav)           & 
     610               &  CALL zps_hde    ( kt, Kmm, jpts, pts(:,:,:,:,Kbb), gtsu, gtsv,        &  ! Partial steps: before horizontal gradient 
     611               &                              rhd, gru , grv               )  ! of t, s, rd at the last ocean level 
     612            IF( ln_zps .AND. .NOT. lk_c1d .AND.       ln_isfcav)                       & 
     613               &  CALL zps_hde_isf( nit000, Kmm, jpts, pts(:,:,:,:,Kbb), gtsu, gtsv, gtui, gtvi,    &  ! Partial steps for top cell (ISF) 
     614               &                                  rhd, gru , grv , grui, grvi          )  ! of t, s, rd at the last ocean level 
    615615 
    616616            DEALLOCATE( t_bkginc ) 
     
    627627 
    628628 
    629    SUBROUTINE dyn_asm_inc( kt ) 
     629   SUBROUTINE dyn_asm_inc( kt, Kbb, Kmm, puu, pvv, Krhs ) 
    630630      !!---------------------------------------------------------------------- 
    631631      !!                    ***  ROUTINE dyn_asm_inc  *** 
     
    637637      !! ** Action  :  
    638638      !!---------------------------------------------------------------------- 
    639       INTEGER, INTENT(IN) :: kt   ! Current time step 
     639      INTEGER                             , INTENT( in )  ::  kt             ! ocean time-step index 
     640      INTEGER                             , INTENT( in )  ::  Kbb, Kmm, Krhs ! ocean time level indices 
     641      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv       ! ocean velocities and RHS of momentum equation 
    640642      ! 
    641643      INTEGER :: jk 
     
    651653            ! 
    652654            it = kt - nit000 + 1 
    653             zincwgt = wgtiau(it) / rdt   ! IAU weight for the current time step 
     655            zincwgt = wgtiau(it) / rn_Dt   ! IAU weight for the current time step 
    654656            ! 
    655657            IF(lwp) THEN 
     
    661663            ! Update the dynamic tendencies 
    662664            DO jk = 1, jpkm1 
    663                ua(:,:,jk) = ua(:,:,jk) + u_bkginc(:,:,jk) * zincwgt 
    664                va(:,:,jk) = va(:,:,jk) + v_bkginc(:,:,jk) * zincwgt 
     665               puu(:,:,jk,Krhs) = puu(:,:,jk,Krhs) + u_bkginc(:,:,jk) * zincwgt 
     666               pvv(:,:,jk,Krhs) = pvv(:,:,jk,Krhs) + v_bkginc(:,:,jk) * zincwgt 
    665667            END DO 
    666668            ! 
     
    677679         IF ( kt == nitdin_r ) THEN 
    678680            ! 
    679             neuler = 0                    ! Force Euler forward step 
     681            l_1st_euler = .TRUE.                    ! Force Euler forward step 
    680682            ! 
    681683            ! Initialize the now fields with the background + increment 
    682             un(:,:,:) = u_bkg(:,:,:) + u_bkginc(:,:,:) 
    683             vn(:,:,:) = v_bkg(:,:,:) + v_bkginc(:,:,:)   
    684             ! 
    685             ub(:,:,:) = un(:,:,:)         ! Update before fields 
    686             vb(:,:,:) = vn(:,:,:) 
     684            puu(:,:,:,Kmm) = u_bkg(:,:,:) + u_bkginc(:,:,:) 
     685            pvv(:,:,:,Kmm) = v_bkg(:,:,:) + v_bkginc(:,:,:)   
     686            ! 
     687            puu(:,:,:,Kbb) = puu(:,:,:,Kmm)         ! Update before fields 
     688            pvv(:,:,:,Kbb) = pvv(:,:,:,Kmm) 
    687689            ! 
    688690            DEALLOCATE( u_bkg    ) 
     
    697699 
    698700 
    699    SUBROUTINE ssh_asm_inc( kt ) 
     701   SUBROUTINE ssh_asm_inc( kt, Kbb, Kmm ) 
    700702      !!---------------------------------------------------------------------- 
    701703      !!                    ***  ROUTINE ssh_asm_inc  *** 
     
    707709      !! ** Action  :  
    708710      !!---------------------------------------------------------------------- 
    709       INTEGER, INTENT(IN) :: kt   ! Current time step 
     711      INTEGER, INTENT(IN) :: kt         ! Current time step 
     712      INTEGER, INTENT(IN) :: Kbb, Kmm   ! Current time step 
    710713      ! 
    711714      INTEGER :: it 
     
    721724            ! 
    722725            it = kt - nit000 + 1 
    723             zincwgt = wgtiau(it) / rdt   ! IAU weight for the current time step 
     726            zincwgt = wgtiau(it) / rn_Dt   ! IAU weight for the current time step 
    724727            ! 
    725728            IF(lwp) THEN 
     
    752755         IF ( kt == nitdin_r ) THEN 
    753756            ! 
    754             neuler = 0                                   ! Force Euler forward step 
    755             ! 
    756             sshn(:,:) = ssh_bkg(:,:) + ssh_bkginc(:,:)   ! Initialize the now fields the background + increment 
    757             ! 
    758             sshb(:,:) = sshn(:,:)                        ! Update before fields 
    759             e3t_b(:,:,:) = e3t_n(:,:,:) 
    760 !!gm why not e3u_b, e3v_b, gdept_b ???? 
     757            l_1st_euler = .TRUE.                            ! Force Euler forward step 
     758            ! 
     759            ssh(:,:,Kmm) = ssh_bkg(:,:) + ssh_bkginc(:,:)   ! Initialize the now fields the background + increment 
     760            ! 
     761            ssh(:,:,Kbb) = ssh(:,:,Kmm)                        ! Update before fields 
     762#if ! defined key_qco 
     763            e3t(:,:,:,Kbb) = e3t(:,:,:,Kmm) 
     764#endif 
     765!!gm why not e3u(:,:,:,Kbb), e3v(:,:,:,Kbb), gdept(:,:,:,Kbb) ???? 
    761766            ! 
    762767            DEALLOCATE( ssh_bkg    ) 
     
    770775 
    771776 
    772    SUBROUTINE ssh_asm_div( kt, phdivn ) 
     777   SUBROUTINE ssh_asm_div( kt, Kbb, Kmm, phdivn ) 
    773778      !!---------------------------------------------------------------------- 
    774779      !!                  ***  ROUTINE ssh_asm_div  *** 
     
    784789      !!---------------------------------------------------------------------- 
    785790      INTEGER, INTENT(IN) :: kt                               ! ocean time-step index 
     791      INTEGER, INTENT(IN) :: Kbb, Kmm                         ! time level indices 
    786792      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   phdivn   ! horizontal divergence 
    787793      !! 
     
    791797      !  
    792798#if defined key_asminc 
    793       CALL ssh_asm_inc( kt ) !==   (calculate increments) 
     799      CALL ssh_asm_inc( kt, Kbb, Kmm ) !==   (calculate increments) 
    794800      ! 
    795801      IF( ln_linssh ) THEN  
    796          phdivn(:,:,1) = phdivn(:,:,1) - ssh_iau(:,:) / e3t_n(:,:,1) * tmask(:,:,1) 
     802         phdivn(:,:,1) = phdivn(:,:,1) - ssh_iau(:,:) / e3t(:,:,1,Kmm) * tmask(:,:,1) 
    797803      ELSE  
    798804         ALLOCATE( ztim(jpi,jpj) ) 
    799          ztim(:,:) = ssh_iau(:,:) / ( ht_n(:,:) + 1.0 - ssmask(:,:) ) 
     805         ztim(:,:) = ssh_iau(:,:) / ( ht(:,:) + 1.0 - ssmask(:,:) ) 
    800806         DO jk = 1, jpkm1                                  
    801807            phdivn(:,:,jk) = phdivn(:,:,jk) - ztim(:,:) * tmask(:,:,jk)  
     
    839845            it = kt - nit000 + 1 
    840846            zincwgt = wgtiau(it)      ! IAU weight for the current time step  
    841             ! note this is not a tendency so should not be divided by rdt (as with the tracer and other increments) 
     847            ! note this is not a tendency so should not be divided by rn_Dt (as with the tracer and other increments) 
    842848            ! 
    843849            IF(lwp) THEN 
     
    874880#if defined key_cice && defined key_asminc 
    875881            ! Sea-ice : CICE case. Pass ice increment tendency into CICE 
    876             ndaice_da(:,:) = seaice_bkginc(:,:) * zincwgt / rdt 
     882            ndaice_da(:,:) = seaice_bkginc(:,:) * zincwgt / rn_Dt 
    877883#endif 
    878884            ! 
     
    894900         IF ( kt == nitdin_r ) THEN 
    895901            ! 
    896             neuler = 0                    ! Force Euler forward step 
     902            l_1st_euler = .TRUE.              ! Force Euler forward step 
    897903            ! 
    898904            ! Sea-ice : SI3 case 
     
    924930#if defined key_cice && defined key_asminc 
    925931            ! Sea-ice : CICE case. Pass ice increment tendency into CICE 
    926            ndaice_da(:,:) = seaice_bkginc(:,:) / rdt 
     932           ndaice_da(:,:) = seaice_bkginc(:,:) / rn_Dt 
    927933#endif 
    928934            IF ( .NOT. PRESENT(kindic) ) THEN 
     
    957963!           ! fwf : ice formation and melting 
    958964! 
    959 !                 zfons = ( -nfresh_da(ji,jj)*soce + nfsalt_da(ji,jj) )*rdt 
     965!                 zfons = ( -nfresh_da(ji,jj)*soce + nfsalt_da(ji,jj) )*rn_Dt 
    960966! 
    961967!           ! change salinity down to mixed layer depth 
     
    968974!           ! set to bottom of a level  
    969975!                 DO jk = jpk-1, 2, -1 
    970 !                   IF ((mld > gdepw(ji,jj,jk)) .and. (mld < gdepw(ji,jj,jk+1))) THEN  
    971 !                     mld=gdepw(ji,jj,jk+1) 
     976!                   IF ((mld > gdepw(ji,jj,jk,Kmm)) .and. (mld < gdepw(ji,jj,jk+1,Kmm))) THEN 
     977!                     mld=gdepw(ji,jj,jk+1,Kmm) 
    972978!                     jkmax=jk 
    973979!                   ENDIF 
     
    9981004! 
    9991005!      !            !  salt exchanges at the ice/ocean interface 
    1000 !      !            zpmess         = zfons / rdt_ice    ! rdt_ice is ice timestep 
     1006!      !            zpmess         = zfons / rDt_ice    ! rDt_ice is ice timestep 
    10011007!      ! 
    10021008!      !! Adjust fsalt. A +ve fsalt means adding salt to ocean 
Note: See TracChangeset for help on using the changeset viewer.