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 13151 for NEMO/branches/2020/dev_r12527_Gurvan_ShallowWater/src/OCE/ASM/asminc.F90 – NEMO

Ignore:
Timestamp:
2020-06-24T14:38:26+02:00 (4 years ago)
Author:
gm
Message:

result from merge with qco r12983

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_r12527_Gurvan_ShallowWater/src/OCE/ASM/asminc.F90

    r12489 r13151  
    99   !!                 ! 2007-04  (A. Weaver)  Merge with OPAVAR/NEMOVAR 
    1010   !!   NEMO     3.3  ! 2010-05  (D. Lea)  Update to work with NEMO v3.2 
    11    !!             -   ! 2010-05  (D. Lea)  add calc_month_len routine based on day_init  
     11   !!             -   ! 2010-05  (D. Lea)  add calc_month_len routine based on day_init 
    1212   !!            3.4  ! 2012-10  (A. Weaver and K. Mogensen) Fix for direct initialization 
    1313   !!                 ! 2014-09  (D. Lea)  Local calc_date removed use routine from OBS 
     
    3131   USE zpshde          ! Partial step : Horizontal Derivative 
    3232   USE asmpar          ! Parameters for the assmilation interface 
    33    USE asmbkg          !  
     33   USE asmbkg          ! 
    3434   USE c1d             ! 1D initialization 
    3535   USE sbc_oce         ! Surface boundary condition variables. 
     
    4545   IMPLICIT NONE 
    4646   PRIVATE 
    47     
     47 
    4848   PUBLIC   asm_inc_init   !: Initialize the increment arrays and IAU weights 
    4949   PUBLIC   tra_asm_inc    !: Apply the tracer (T and S) increments 
     
    7272   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::   u_bkg   , v_bkg      !: Background u- & v- velocity components 
    7373   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::   t_bkginc, s_bkginc   !: Increment to the background T & S 
    74    REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::   u_bkginc, v_bkginc   !: Increment to the u- & v-components  
     74   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::   u_bkginc, v_bkginc   !: Increment to the u- & v-components 
    7575   REAL(wp), PUBLIC, DIMENSION(:)    , ALLOCATABLE ::   wgtiau               !: IAU weights for each time step 
    7676#if defined key_asminc 
     
    8080   INTEGER , PUBLIC ::   nitbkg      !: Time step of the background state used in the Jb term 
    8181   INTEGER , PUBLIC ::   nitdin      !: Time step of the background state for direct initialization 
    82    INTEGER , PUBLIC ::   nitiaustr   !: Time step of the start of the IAU interval  
     82   INTEGER , PUBLIC ::   nitiaustr   !: Time step of the start of the IAU interval 
    8383   INTEGER , PUBLIC ::   nitiaufin   !: Time step of the end of the IAU interval 
    84    !  
     84   ! 
    8585   INTEGER , PUBLIC ::   niaufn      !: Type of IAU weighing function: = 0   Constant weighting 
    86    !                                 !: = 1   Linear hat-like, centred in middle of IAU interval  
     86   !                                 !: = 1   Linear hat-like, centred in middle of IAU interval 
    8787   REAL(wp), PUBLIC ::   salfixmin   !: Ensure that the salinity is larger than this  value if (ln_salfix) 
    8888 
     
    9595   !! * Substitutions 
    9696#  include "do_loop_substitute.h90" 
     97#  include "domzgr_substitute.h90" 
    9798   !!---------------------------------------------------------------------- 
    9899   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    105106      !!---------------------------------------------------------------------- 
    106107      !!                    ***  ROUTINE asm_inc_init  *** 
    107       !!           
     108      !! 
    108109      !! ** Purpose : Initialize the assimilation increment and IAU weights. 
    109110      !! 
    110111      !! ** Method  : Initialize the assimilation increment and IAU weights. 
    111112      !! 
    112       !! ** Action  :  
     113      !! ** Action  : 
    113114      !!---------------------------------------------------------------------- 
    114115      INTEGER, INTENT(in) ::  Kbb, Kmm, Krhs  ! time level indices 
     
    262263         ! 
    263264         !                                !--------------------------------------------------------- 
    264          IF( niaufn == 0 ) THEN           ! Constant IAU forcing  
     265         IF( niaufn == 0 ) THEN           ! Constant IAU forcing 
    265266            !                             !--------------------------------------------------------- 
    266267            DO jt = 1, iiauper 
     
    268269            END DO 
    269270            !                             !--------------------------------------------------------- 
    270          ELSEIF ( niaufn == 1 ) THEN      ! Linear hat-like, centred in middle of IAU interval  
     271         ELSEIF ( niaufn == 1 ) THEN      ! Linear hat-like, centred in middle of IAU interval 
    271272            !                             !--------------------------------------------------------- 
    272273            ! Compute the normalization factor 
    273274            znorm = 0._wp 
    274275            IF( MOD( iiauper, 2 ) == 0 ) THEN   ! Even number of time steps in IAU interval 
    275                imid = iiauper / 2  
     276               imid = iiauper / 2 
    276277               DO jt = 1, imid 
    277278                  znorm = znorm + REAL( jt ) 
     
    279280               znorm = 2.0 * znorm 
    280281            ELSE                                ! Odd number of time steps in IAU interval 
    281                imid = ( iiauper + 1 ) / 2         
     282               imid = ( iiauper + 1 ) / 2 
    282283               DO jt = 1, imid - 1 
    283284                  znorm = znorm + REAL( jt ) 
     
    306307             DO jt = 1, icycper 
    307308                ztotwgt = ztotwgt + wgtiau(jt) 
    308                 WRITE(numout,*) '         ', jt, '       ', wgtiau(jt)  
    309              END DO    
     309                WRITE(numout,*) '         ', jt, '       ', wgtiau(jt) 
     310             END DO 
    310311             WRITE(numout,*) '         ===================================' 
    311312             WRITE(numout,*) '         Time-integrated weight = ', ztotwgt 
    312313             WRITE(numout,*) '         ===================================' 
    313314          ENDIF 
    314           
     315 
    315316      ENDIF 
    316317 
     
    337338         CALL iom_open( c_asminc, inum ) 
    338339         ! 
    339          CALL iom_get( inum, 'time'       , zdate_inc   )  
     340         CALL iom_get( inum, 'time'       , zdate_inc   ) 
    340341         CALL iom_get( inum, 'z_inc_dateb', z_inc_dateb ) 
    341342         CALL iom_get( inum, 'z_inc_datef', z_inc_datef ) 
     
    344345         ! 
    345346         IF(lwp) THEN 
    346             WRITE(numout,*)  
     347            WRITE(numout,*) 
    347348            WRITE(numout,*) 'asm_inc_init : Assimilation increments valid between dates ', z_inc_dateb,' and ', z_inc_datef 
    348349            WRITE(numout,*) '~~~~~~~~~~~~' 
     
    358359            &                ' not agree with Direct Initialization time' ) 
    359360 
    360          IF ( ln_trainc ) THEN    
     361         IF ( ln_trainc ) THEN 
    361362            CALL iom_get( inum, jpdom_autoglo, 'bckint', t_bkginc, 1 ) 
    362363            CALL iom_get( inum, jpdom_autoglo, 'bckins', s_bkginc, 1 ) 
     
    370371         ENDIF 
    371372 
    372          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 )               
     373         IF ( ln_dyninc ) THEN 
     374            CALL iom_get( inum, jpdom_autoglo, 'bckinu', u_bkginc, 1 ) 
     375            CALL iom_get( inum, jpdom_autoglo, 'bckinv', v_bkginc, 1 ) 
    375376            ! Apply the masks 
    376377            u_bkginc(:,:,:) = u_bkginc(:,:,:) * umask(:,:,:) 
     
    381382            WHERE( ABS( v_bkginc(:,:,:) ) > 1.0e+10 ) v_bkginc(:,:,:) = 0.0 
    382383         ENDIF 
    383          
     384 
    384385         IF ( ln_sshinc ) THEN 
    385386            CALL iom_get( inum, jpdom_autoglo, 'bckineta', ssh_bkginc, 1 ) 
     
    407408      IF ( ln_dyninc .AND. nn_divdmp > 0 ) THEN    ! Apply divergence damping filter 
    408409         !                                         !-------------------------------------- 
    409          ALLOCATE( zhdiv(jpi,jpj) )  
     410         ALLOCATE( zhdiv(jpi,jpj) ) 
    410411         ! 
    411412         DO jt = 1, nn_divdmp 
     
    417418                     &            - e2u(ji-1,jj) * e3u(ji-1,jj,jk,Kmm) * u_bkginc(ji-1,jj,jk)    & 
    418419                     &            + e1v(ji,jj  ) * e3v(ji,jj  ,jk,Kmm) * v_bkginc(ji,jj  ,jk)    & 
    419                      &            - e1v(ji,jj-1) * e3v(ji,jj-1,jk,Kmm) * v_bkginc(ji,jj-1,jk)  ) / e3t(ji,jj,jk,Kmm) 
     420                     &            - e1v(ji,jj-1) * e3v(ji,jj-1,jk,Kmm) * v_bkginc(ji,jj-1,jk)  ) & 
     421                     &            / e3t(ji,jj,jk,Kmm) 
    420422               END_2D 
    421423               CALL lbc_lnk( 'asminc', zhdiv, 'T', 1. )   ! lateral boundary cond. (no sign change) 
     
    425427                     &               + 0.2_wp * ( zhdiv(ji+1,jj) - zhdiv(ji  ,jj) ) * r1_e1u(ji,jj) * umask(ji,jj,jk) 
    426428                  v_bkginc(ji,jj,jk) = v_bkginc(ji,jj,jk)                         & 
    427                      &               + 0.2_wp * ( zhdiv(ji,jj+1) - zhdiv(ji,jj  ) ) * r1_e2v(ji,jj) * vmask(ji,jj,jk)  
     429                     &               + 0.2_wp * ( zhdiv(ji,jj+1) - zhdiv(ji,jj  ) ) * r1_e2v(ji,jj) * vmask(ji,jj,jk) 
    428430               END_2D 
    429431            END DO 
     
    431433         END DO 
    432434         ! 
    433          DEALLOCATE( zhdiv )  
     435         DEALLOCATE( zhdiv ) 
    434436         ! 
    435437      ENDIF 
     
    452454         CALL iom_open( c_asmdin, inum ) 
    453455         ! 
    454          CALL iom_get( inum, 'rdastp', zdate_bkg )  
     456         CALL iom_get( inum, 'rdastp', zdate_bkg ) 
    455457         ! 
    456458         IF(lwp) THEN 
    457             WRITE(numout,*)  
     459            WRITE(numout,*) 
    458460            WRITE(numout,*) '   ==>>>  Assimilation background state valid at : ', zdate_bkg 
    459461            WRITE(numout,*) 
     
    464466            &                ' not agree with Direct Initialization time' ) 
    465467         ! 
    466          IF ( ln_trainc ) THEN    
     468         IF ( ln_trainc ) THEN 
    467469            CALL iom_get( inum, jpdom_autoglo, 'tn', t_bkg ) 
    468470            CALL iom_get( inum, jpdom_autoglo, 'sn', s_bkg ) 
     
    471473         ENDIF 
    472474         ! 
    473          IF ( ln_dyninc ) THEN    
     475         IF ( ln_dyninc ) THEN 
    474476            CALL iom_get( inum, jpdom_autoglo, 'un', u_bkg ) 
    475477            CALL iom_get( inum, jpdom_autoglo, 'vn', v_bkg ) 
     
    499501      ! 
    500502   END SUBROUTINE asm_inc_init 
    501     
    502     
     503 
     504 
    503505   SUBROUTINE tra_asm_inc( kt, Kbb, Kmm, pts, Krhs ) 
    504506      !!---------------------------------------------------------------------- 
    505507      !!                    ***  ROUTINE tra_asm_inc  *** 
    506       !!           
     508      !! 
    507509      !! ** Purpose : Apply the tracer (T and S) assimilation increments 
    508510      !! 
    509511      !! ** Method  : Direct initialization or Incremental Analysis Updating 
    510512      !! 
    511       !! ** Action  :  
     513      !! ** Action  : 
    512514      !!---------------------------------------------------------------------- 
    513515      INTEGER                                  , INTENT(in   ) :: kt             ! Current time step 
     
    521523      !!---------------------------------------------------------------------- 
    522524      ! 
    523       ! freezing point calculation taken from oc_fz_pt (but calculated for all depths)  
    524       ! used to prevent the applied increments taking the temperature below the local freezing point  
     525      ! freezing point calculation taken from oc_fz_pt (but calculated for all depths) 
     526      ! used to prevent the applied increments taking the temperature below the local freezing point 
    525527      DO jk = 1, jpkm1 
    526528        CALL eos_fzp( pts(:,:,jk,jp_sal,Kmm), fzptnz(:,:,jk), gdept(:,:,jk,Kmm) ) 
     
    537539            ! 
    538540            IF(lwp) THEN 
    539                WRITE(numout,*)  
     541               WRITE(numout,*) 
    540542               WRITE(numout,*) 'tra_asm_inc : Tracer IAU at time step = ', kt,' with IAU weight = ', wgtiau(it) 
    541543               WRITE(numout,*) '~~~~~~~~~~~~' 
     
    547549                  ! Do not apply negative increments if the temperature will fall below freezing 
    548550                  WHERE(t_bkginc(:,:,jk) > 0.0_wp .OR. & 
    549                      &   pts(:,:,jk,jp_tem,Kmm) + pts(:,:,jk,jp_tem,Krhs) + t_bkginc(:,:,jk) * wgtiau(it) > fzptnz(:,:,jk) )  
    550                      pts(:,:,jk,jp_tem,Krhs) = pts(:,:,jk,jp_tem,Krhs) + 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 
    551553                  END WHERE 
    552554               ELSE 
    553                   pts(:,:,jk,jp_tem,Krhs) = pts(:,:,jk,jp_tem,Krhs) + t_bkginc(:,:,jk) * zincwgt   
     555                  pts(:,:,jk,jp_tem,Krhs) = pts(:,:,jk,jp_tem,Krhs) + t_bkginc(:,:,jk) * zincwgt 
    554556               ENDIF 
    555557               IF (ln_salfix) THEN 
     
    557559                  ! minimum value salfixmin 
    558560                  WHERE(s_bkginc(:,:,jk) > 0.0_wp .OR. & 
    559                      &   pts(:,:,jk,jp_sal,Kmm) + pts(:,:,jk,jp_sal,Krhs) + s_bkginc(:,:,jk) * wgtiau(it) > salfixmin )  
     561                     &   pts(:,:,jk,jp_sal,Kmm) + pts(:,:,jk,jp_sal,Krhs) + s_bkginc(:,:,jk) * wgtiau(it) > salfixmin ) 
    560562                     pts(:,:,jk,jp_sal,Krhs) = pts(:,:,jk,jp_sal,Krhs) + s_bkginc(:,:,jk) * zincwgt 
    561563                  END WHERE 
     
    574576      ELSEIF ( ln_asmdin ) THEN        ! Direct Initialization 
    575577         !                             !-------------------------------------- 
    576          !             
     578         ! 
    577579         IF ( kt == nitdin_r ) THEN 
    578580            ! 
     
    582584            IF (ln_temnofreeze) THEN 
    583585               ! Do not apply negative increments if the temperature will fall below freezing 
    584                WHERE( t_bkginc(:,:,:) > 0.0_wp .OR. pts(:,:,:,jp_tem,Kmm) + t_bkginc(:,:,:) > fzptnz(:,:,:) )  
    585                   pts(:,:,:,jp_tem,Kmm) = 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(:,:,:) 
    586588               END WHERE 
    587589            ELSE 
    588                pts(:,:,:,jp_tem,Kmm) = t_bkg(:,:,:) + t_bkginc(:,:,:)    
     590               pts(:,:,:,jp_tem,Kmm) = t_bkg(:,:,:) + t_bkginc(:,:,:) 
    589591            ENDIF 
    590592            IF (ln_salfix) THEN 
    591593               ! Do not apply negative increments if the salinity will fall below a specified 
    592594               ! minimum value salfixmin 
    593                WHERE( s_bkginc(:,:,:) > 0.0_wp .OR. pts(:,:,:,jp_sal,Kmm) + s_bkginc(:,:,:) > salfixmin )  
    594                   pts(:,:,:,jp_sal,Kmm) = 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(:,:,:) 
    595597               END WHERE 
    596598            ELSE 
    597                pts(:,:,:,jp_sal,Kmm) = s_bkg(:,:,:) + s_bkginc(:,:,:)    
     599               pts(:,:,:,jp_sal,Kmm) = s_bkg(:,:,:) + s_bkginc(:,:,:) 
    598600            ENDIF 
    599601 
     
    617619            DEALLOCATE( s_bkg    ) 
    618620         ENDIF 
    619          !   
     621         ! 
    620622      ENDIF 
    621623      ! Perhaps the following call should be in step 
     
    628630      !!---------------------------------------------------------------------- 
    629631      !!                    ***  ROUTINE dyn_asm_inc  *** 
    630       !!           
     632      !! 
    631633      !! ** Purpose : Apply the dynamics (u and v) assimilation increments. 
    632634      !! 
    633635      !! ** Method  : Direct initialization or Incremental Analysis Updating. 
    634636      !! 
    635       !! ** Action  :  
     637      !! ** Action  : 
    636638      !!---------------------------------------------------------------------- 
    637639      INTEGER                             , INTENT( in )  ::  kt             ! ocean time-step index 
     
    654656            ! 
    655657            IF(lwp) THEN 
    656                WRITE(numout,*)  
     658               WRITE(numout,*) 
    657659               WRITE(numout,*) 'dyn_asm_inc : Dynamics IAU at time step = ', kt,' with IAU weight = ', wgtiau(it) 
    658660               WRITE(numout,*) '~~~~~~~~~~~~' 
     
    674676      ELSEIF ( ln_asmdin ) THEN     ! Direct Initialization 
    675677         !                          !----------------------------------------- 
    676          !          
     678         ! 
    677679         IF ( kt == nitdin_r ) THEN 
    678680            ! 
     
    681683            ! Initialize the now fields with the background + increment 
    682684            puu(:,:,:,Kmm) = u_bkg(:,:,:) + u_bkginc(:,:,:) 
    683             pvv(:,:,:,Kmm) = v_bkg(:,:,:) + v_bkginc(:,:,:)   
     685            pvv(:,:,:,Kmm) = v_bkg(:,:,:) + v_bkginc(:,:,:) 
    684686            ! 
    685687            puu(:,:,:,Kbb) = puu(:,:,:,Kmm)         ! Update before fields 
     
    700702      !!---------------------------------------------------------------------- 
    701703      !!                    ***  ROUTINE ssh_asm_inc  *** 
    702       !!           
     704      !! 
    703705      !! ** Purpose : Apply the sea surface height assimilation increment. 
    704706      !! 
    705707      !! ** Method  : Direct initialization or Incremental Analysis Updating. 
    706708      !! 
    707       !! ** Action  :  
     709      !! ** Action  : 
    708710      !!---------------------------------------------------------------------- 
    709711      INTEGER, INTENT(IN) :: kt         ! Current time step 
     
    725727            ! 
    726728            IF(lwp) THEN 
    727                WRITE(numout,*)  
     729               WRITE(numout,*) 
    728730               WRITE(numout,*) 'ssh_asm_inc : SSH IAU at time step = ', & 
    729731                  &  kt,' with IAU weight = ', wgtiau(it) 
     
    758760            ! 
    759761            ssh(:,:,Kbb) = ssh(:,:,Kmm)                        ! Update before fields 
     762#if ! defined key_qco 
    760763            e3t(:,:,:,Kbb) = e3t(:,:,:,Kmm) 
     764#endif 
    761765!!gm why not e3u(:,:,:,Kbb), e3v(:,:,:,Kbb), gdept(:,:,:,Kbb) ???? 
    762766            ! 
     
    775779      !!                  ***  ROUTINE ssh_asm_div  *** 
    776780      !! 
    777       !! ** Purpose :   ssh increment with z* is incorporated via a correction of the local divergence           
     781      !! ** Purpose :   ssh increment with z* is incorporated via a correction of the local divergence 
    778782      !!                across all the water column 
    779783      !! 
     
    791795      REAL(wp), DIMENSION(:,:)  , POINTER       ::   ztim     ! local array 
    792796      !!---------------------------------------------------------------------- 
    793       !  
     797      ! 
    794798#if defined key_asminc 
    795799      CALL ssh_asm_inc( kt, Kbb, Kmm ) !==   (calculate increments) 
    796800      ! 
    797       IF( ln_linssh ) THEN  
     801      IF( ln_linssh ) THEN 
    798802         phdivn(:,:,1) = phdivn(:,:,1) - ssh_iau(:,:) / e3t(:,:,1,Kmm) * tmask(:,:,1) 
    799       ELSE  
     803      ELSE 
    800804         ALLOCATE( ztim(jpi,jpj) ) 
    801805         ztim(:,:) = ssh_iau(:,:) / ( ht(:,:) + 1.0 - ssmask(:,:) ) 
    802          DO jk = 1, jpkm1                                  
    803             phdivn(:,:,jk) = phdivn(:,:,jk) - ztim(:,:) * tmask(:,:,jk)  
     806         DO jk = 1, jpkm1 
     807            phdivn(:,:,jk) = phdivn(:,:,jk) - ztim(:,:) * tmask(:,:,jk) 
    804808         END DO 
    805809         ! 
     
    814818      !!---------------------------------------------------------------------- 
    815819      !!                    ***  ROUTINE seaice_asm_inc  *** 
    816       !!           
     820      !! 
    817821      !! ** Purpose : Apply the sea ice assimilation increment. 
    818822      !! 
    819823      !! ** Method  : Direct initialization or Incremental Analysis Updating. 
    820824      !! 
    821       !! ** Action  :  
     825      !! ** Action  : 
    822826      !! 
    823827      !!---------------------------------------------------------------------- 
     
    840844            ! 
    841845            it = kt - nit000 + 1 
    842             zincwgt = wgtiau(it)      ! IAU weight for the current time step  
     846            zincwgt = wgtiau(it)      ! IAU weight for the current time step 
    843847            ! note this is not a tendency so should not be divided by rn_Dt (as with the tracer and other increments) 
    844848            ! 
    845849            IF(lwp) THEN 
    846                WRITE(numout,*)  
     850               WRITE(numout,*) 
    847851               WRITE(numout,*) 'seaice_asm_inc : sea ice conc IAU at time step = ', kt,' with IAU weight = ', wgtiau(it) 
    848852               WRITE(numout,*) '~~~~~~~~~~~~' 
     
    862866            ! 
    863867            ! Nudge sea ice depth to bring it up to a required minimum depth 
    864             WHERE( zseaicendg(:,:) > 0.0_wp .AND. hm_i(:,:) < zhicifmin )  
    865                zhicifinc(:,:) = (zhicifmin - hm_i(:,:)) * zincwgt     
     868            WHERE( zseaicendg(:,:) > 0.0_wp .AND. hm_i(:,:) < zhicifmin ) 
     869               zhicifinc(:,:) = (zhicifmin - hm_i(:,:)) * zincwgt 
    866870            ELSEWHERE 
    867871               zhicifinc(:,:) = 0.0_wp 
     
    896900         IF ( kt == nitdin_r ) THEN 
    897901            ! 
     902<<<<<<< .working 
    898903            l_1st_euler = 0              ! Force Euler forward step 
     904======= 
     905            l_1st_euler = .TRUE.              ! Force Euler forward step 
     906>>>>>>> .merge-right.r13092 
    899907            ! 
    900908            ! Sea-ice : SI3 case 
     
    903911            zofrld (:,:) = 1._wp - at_i(:,:) 
    904912            zohicif(:,:) = hm_i(:,:) 
    905             !  
     913            ! 
    906914            ! Initialize the now fields the background + increment 
    907915            at_i(:,:) = 1. - MIN( MAX( 1.-at_i(:,:) - seaice_bkginc(:,:), 0.0_wp), 1.0_wp) 
    908             at_i_b(:,:) = at_i(:,:)  
     916            at_i_b(:,:) = at_i(:,:) 
    909917            fr_i(:,:) = at_i(:,:)        ! adjust ice fraction 
    910918            ! 
     
    912920            ! 
    913921            ! Nudge sea ice depth to bring it up to a required minimum depth 
    914             WHERE( zseaicendg(:,:) > 0.0_wp .AND. hm_i(:,:) < zhicifmin )  
     922            WHERE( zseaicendg(:,:) > 0.0_wp .AND. hm_i(:,:) < zhicifmin ) 
    915923               zhicifinc(:,:) = zhicifmin - hm_i(:,:) 
    916924            ELSEWHERE 
     
    942950!#if defined defined key_si3 || defined key_cice 
    943951! 
    944 !            IF (ln_seaicebal ) THEN        
     952!            IF (ln_seaicebal ) THEN 
    945953!             !! balancing salinity increments 
    946954!             !! simple case from limflx.F90 (doesn't include a mass flux) 
     
    954962! 
    955963!             DO jj = 1, jpj 
    956 !               DO ji = 1, jpi  
     964!               DO ji = 1, jpi 
    957965!           ! calculate change in ice and snow mass per unit area 
    958966!           ! positive values imply adding salt to the ocean (results from ice formation) 
     
    965973! 
    966974!           ! prevent small mld 
    967 !           ! less than 10m can cause salinity instability  
     975!           ! less than 10m can cause salinity instability 
    968976!                 IF (mld < 10) mld=10 
    969977! 
    970 !           ! set to bottom of a level  
     978!           ! set to bottom of a level 
    971979!                 DO jk = jpk-1, 2, -1 
    972 !                   IF ((mld > gdepw(ji,jj,jk)) .and. (mld < gdepw(ji,jj,jk+1))) THEN  
    973 !                     mld=gdepw(ji,jj,jk+1) 
     980!                   IF ((mld > gdepw(ji,jj,jk,Kmm)) .and. (mld < gdepw(ji,jj,jk+1,Kmm))) THEN 
     981!                     mld=gdepw(ji,jj,jk+1,Kmm) 
    974982!                     jkmax=jk 
    975983!                   ENDIF 
     
    977985! 
    978986!            ! avoid applying salinity balancing in shallow water or on land 
    979 !            !  
     987!            ! 
    980988! 
    981989!            ! dsal_ocn (psu kg m^-2) / (kg m^-3 * m) 
     
    988996! 
    989997!           ! put increments in for levels in the mixed layer 
    990 !           ! but prevent salinity below a threshold value  
    991 ! 
    992 !                   DO jk = 1, jkmax               
    993 ! 
    994 !                     IF (dsal_ocn > 0.0_wp .or. sb(ji,jj,jk)+dsal_ocn > sal_thresh) THEN  
     998!           ! but prevent salinity below a threshold value 
     999! 
     1000!                   DO jk = 1, jkmax 
     1001! 
     1002!                     IF (dsal_ocn > 0.0_wp .or. sb(ji,jj,jk)+dsal_ocn > sal_thresh) THEN 
    9951003!                           sb(ji,jj,jk) = sb(ji,jj,jk) + dsal_ocn 
    9961004!                           sn(ji,jj,jk) = sn(ji,jj,jk) + dsal_ocn 
     
    10031011!      ! 
    10041012!      !! Adjust fsalt. A +ve fsalt means adding salt to ocean 
    1005 !      !!           fsalt(ji,jj) =  fsalt(ji,jj) + zpmess     ! adjust fsalt   
    1006 !      !!                
    1007 !      !!           emps(ji,jj) = emps(ji,jj) + zpmess        ! or adjust emps (see icestp1d)  
     1013!      !!           fsalt(ji,jj) =  fsalt(ji,jj) + zpmess     ! adjust fsalt 
     1014!      !! 
     1015!      !!           emps(ji,jj) = emps(ji,jj) + zpmess        ! or adjust emps (see icestp1d) 
    10081016!      !!                                                     ! E-P (kg m-2 s-2) 
    10091017!      !            emp(ji,jj) = emp(ji,jj) + zpmess          ! E-P (kg m-2 s-2) 
     
    10181026      ! 
    10191027   END SUBROUTINE seaice_asm_inc 
    1020     
     1028 
    10211029   !!====================================================================== 
    10221030END MODULE asminc 
Note: See TracChangeset for help on using the changeset viewer.