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 13518 for NEMO/branches/2020/dev_r13383_HPC-02_Daley_Tiling/src/OCE/ASM/asminc.F90 – NEMO

Ignore:
Timestamp:
2020-09-24T20:49:07+02:00 (4 years ago)
Author:
hadcv
Message:

Tiling for modules before tra_adv

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_r13383_HPC-02_Daley_Tiling/src/OCE/ASM/asminc.F90

    r13295 r13518  
    520520      INTEGER  :: it 
    521521      REAL(wp) :: zincwgt  ! IAU weight for current time step 
    522       REAL (wp), DIMENSION(jpi,jpj,jpk) :: fzptnz ! 3d freezing point values 
     522      REAL(wp), DIMENSION(ST_2D(nn_hls),jpk) :: fzptnz ! 3d freezing point values 
    523523      !!---------------------------------------------------------------------- 
    524524      ! 
    525525      ! freezing point calculation taken from oc_fz_pt (but calculated for all depths)  
    526526      ! used to prevent the applied increments taking the temperature below the local freezing point  
    527       DO jk = 1, jpkm1 
    528         CALL eos_fzp( pts(:,:,jk,jp_sal,Kmm), fzptnz(:,:,jk), gdept(:,:,jk,Kmm) ) 
    529       END DO 
     527      ! TODO: NOT TESTED- logical is forced to False 
     528      IF( ln_temnofreeze ) THEN 
     529         DO jk = 1, jpkm1 
     530           CALL eos_fzp( pts(:,:,jk,jp_sal,Kmm), fzptnz(:,:,jk), gdept(:,:,jk,Kmm) ) 
     531         END DO 
     532      ENDIF 
    530533         ! 
    531534         !                             !-------------------------------------- 
     
    538541            zincwgt = wgtiau(it) / rn_Dt   ! IAU weight for the current time step 
    539542            ! 
    540             IF(lwp) THEN 
    541                WRITE(numout,*)  
    542                WRITE(numout,*) 'tra_asm_inc : Tracer IAU at time step = ', kt,' with IAU weight = ', wgtiau(it) 
    543                WRITE(numout,*) '~~~~~~~~~~~~' 
     543            IF( ntile == 0 .OR. ntile == 1 )  THEN                       ! Do only on the first tile 
     544               IF(lwp) THEN 
     545                  WRITE(numout,*) 
     546                  WRITE(numout,*) 'tra_asm_inc : Tracer IAU at time step = ', kt,' with IAU weight = ', wgtiau(it) 
     547                  WRITE(numout,*) '~~~~~~~~~~~~' 
     548               ENDIF 
    544549            ENDIF 
    545550            ! 
    546551            ! Update the tracer tendencies 
     552            ! TODO: NOT TESTED- logical is forced to False 
    547553            DO jk = 1, jpkm1 
    548554               IF (ln_temnofreeze) THEN 
    549555                  ! Do not apply negative increments if the temperature will fall below freezing 
    550                   WHERE(t_bkginc(:,:,jk) > 0.0_wp .OR. & 
    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   
     556                  WHERE(t_bkginc(ST_2D(0),jk) > 0.0_wp .OR. & 
     557                     &   pts(ST_2D(0),jk,jp_tem,Kmm) + pts(ST_2D(0),jk,jp_tem,Krhs) + t_bkginc(ST_2D(0),jk) * wgtiau(it) > fzptnz(:,:,jk) ) 
     558                     pts(ST_2D(0),jk,jp_tem,Krhs) = pts(ST_2D(0),jk,jp_tem,Krhs) + t_bkginc(ST_2D(0),jk) * zincwgt 
    553559                  END WHERE 
    554560               ELSE 
    555                   pts(:,:,jk,jp_tem,Krhs) = pts(:,:,jk,jp_tem,Krhs) + t_bkginc(:,:,jk) * zincwgt   
     561                  DO_2D( 0, 0, 0, 0 ) 
     562                     pts(ji,jj,jk,jp_tem,Krhs) = pts(ji,jj,jk,jp_tem,Krhs) + t_bkginc(ji,jj,jk) * zincwgt 
     563                  END_2D 
    556564               ENDIF 
    557565               IF (ln_salfix) THEN 
    558566                  ! Do not apply negative increments if the salinity will fall below a specified 
    559567                  ! minimum value salfixmin 
    560                   WHERE(s_bkginc(:,:,jk) > 0.0_wp .OR. & 
    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 
     568                  WHERE(s_bkginc(ST_2D(0),jk) > 0.0_wp .OR. & 
     569                     &   pts(ST_2D(0),jk,jp_sal,Kmm) + pts(ST_2D(0),jk,jp_sal,Krhs) + s_bkginc(ST_2D(0),jk) * wgtiau(it) > salfixmin ) 
     570                     pts(ST_2D(0),jk,jp_sal,Krhs) = pts(ST_2D(0),jk,jp_sal,Krhs) + s_bkginc(ST_2D(0),jk) * zincwgt 
    563571                  END WHERE 
    564572               ELSE 
    565                   pts(:,:,jk,jp_sal,Krhs) = pts(:,:,jk,jp_sal,Krhs) + s_bkginc(:,:,jk) * zincwgt 
     573                  DO_2D( 0, 0, 0, 0 ) 
     574                     pts(ji,jj,jk,jp_sal,Krhs) = pts(ji,jj,jk,jp_sal,Krhs) + s_bkginc(ji,jj,jk) * zincwgt 
     575                  END_2D 
    566576               ENDIF 
    567577            END DO 
     
    569579         ENDIF 
    570580         ! 
    571          IF ( kt == nitiaufin_r + 1  ) THEN   ! For bias crcn to work 
    572             DEALLOCATE( t_bkginc ) 
    573             DEALLOCATE( s_bkginc ) 
     581         IF( ntile == 0 .OR. ntile == nijtile )  THEN                ! Do only on the last tile 
     582            IF ( kt == nitiaufin_r + 1  ) THEN   ! For bias crcn to work 
     583               DEALLOCATE( t_bkginc ) 
     584               DEALLOCATE( s_bkginc ) 
     585            ENDIF 
    574586         ENDIF 
    575587         !                             !-------------------------------------- 
     
    582594            ! 
    583595            ! Initialize the now fields with the background + increment 
     596            ! TODO: NOT TESTED- logical is forced to False 
    584597            IF (ln_temnofreeze) THEN 
    585598               ! Do not apply negative increments if the temperature will fall below freezing 
    586                WHERE( t_bkginc(:,:,:) > 0.0_wp .OR. pts(:,:,:,jp_tem,Kmm) + t_bkginc(:,:,:) > fzptnz(:,:,:) )  
    587                   pts(:,:,:,jp_tem,Kmm) = t_bkg(:,:,:) + t_bkginc(:,:,:)    
     599               WHERE( t_bkginc(ST_2D(0),:) > 0.0_wp .OR. pts(ST_2D(0),:,jp_tem,Kmm) + t_bkginc(ST_2D(0),:) > fzptnz(:,:,:) ) 
     600                  pts(ST_2D(0),:,jp_tem,Kmm) = t_bkg(ST_2D(0),:) + t_bkginc(ST_2D(0),:) 
    588601               END WHERE 
    589602            ELSE 
    590                pts(:,:,:,jp_tem,Kmm) = t_bkg(:,:,:) + t_bkginc(:,:,:)    
     603               DO_3D( 0, 0, 0, 0, 1, jpk ) 
     604                  pts(ji,jj,jk,jp_tem,Kmm) = t_bkg(ji,jj,jk) + t_bkginc(ji,jj,jk) 
     605               END_3D 
    591606            ENDIF 
    592607            IF (ln_salfix) THEN 
    593608               ! Do not apply negative increments if the salinity will fall below a specified 
    594609               ! minimum value salfixmin 
    595                WHERE( s_bkginc(:,:,:) > 0.0_wp .OR. pts(:,:,:,jp_sal,Kmm) + s_bkginc(:,:,:) > salfixmin )  
    596                   pts(:,:,:,jp_sal,Kmm) = s_bkg(:,:,:) + s_bkginc(:,:,:)    
     610               WHERE( s_bkginc(ST_2D(0),:) > 0.0_wp .OR. pts(ST_2D(0),:,jp_sal,Kmm) + s_bkginc(ST_2D(0),:) > salfixmin ) 
     611                  pts(ST_2D(0),:,jp_sal,Kmm) = s_bkg(ST_2D(0),:) + s_bkginc(ST_2D(0),:) 
    597612               END WHERE 
    598613            ELSE 
    599                pts(:,:,:,jp_sal,Kmm) = s_bkg(:,:,:) + s_bkginc(:,:,:)    
    600             ENDIF 
    601  
    602             pts(:,:,:,:,Kbb) = pts(:,:,:,:,Kmm)                 ! Update before fields 
     614               DO_3D( 0, 0, 0, 0, 1, jpk ) 
     615                  pts(ji,jj,jk,jp_sal,Kmm) = s_bkg(ji,jj,jk) + s_bkginc(ji,jj,jk) 
     616               END_3D 
     617            ENDIF 
     618 
     619            DO_3D( 0, 0, 0, 0, 1, jpk ) 
     620               pts(ji,jj,jk,:,Kbb) = pts(ji,jj,jk,:,Kmm)             ! Update before fields 
     621            END_3D 
    603622 
    604623            CALL eos( pts(:,:,:,:,Kbb), rhd, rhop, gdept_0(:,:,:) )  ! Before potential and in situ densities 
     
    607626!!gm 
    608627 
    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 
    615  
    616             DEALLOCATE( t_bkginc ) 
    617             DEALLOCATE( s_bkginc ) 
    618             DEALLOCATE( t_bkg    ) 
    619             DEALLOCATE( s_bkg    ) 
     628            ! TEMP: This change not necessary after extra haloes development (lbc_lnk removed from zps_hde*) 
     629            IF( ntile == 0 .OR. ntile == nijtile )  THEN                ! Do only for the full domain 
     630               IF( ln_zps .AND. .NOT. lk_c1d .AND. .NOT. ln_isfcav)           & 
     631                  &  CALL zps_hde    ( kt, Kmm, jpts, pts(:,:,:,:,Kbb), gtsu, gtsv,        &  ! Partial steps: before horizontal gradient 
     632                  &                              rhd, gru , grv               )  ! of t, s, rd at the last ocean level 
     633               IF( ln_zps .AND. .NOT. lk_c1d .AND.       ln_isfcav)                       & 
     634                  &  CALL zps_hde_isf( nit000, Kmm, jpts, pts(:,:,:,:,Kbb), gtsu, gtsv, gtui, gtvi,    &  ! Partial steps for top cell (ISF) 
     635                  &                                  rhd, gru , grv , grui, grvi          )  ! of t, s, rd at the last ocean level 
     636            ENDIF 
     637 
     638            IF( ntile == 0 .OR. ntile == nijtile )  THEN                ! Do only on the last tile 
     639               DEALLOCATE( t_bkginc ) 
     640               DEALLOCATE( s_bkginc ) 
     641               DEALLOCATE( t_bkg    ) 
     642               DEALLOCATE( s_bkg    ) 
     643            ENDIF 
     644         ! 
    620645         ENDIF 
    621646         !   
    622647      ENDIF 
     648      ! TODO: NOT TESTED- logical is forced to False 
    623649      ! Perhaps the following call should be in step 
    624650      IF ( ln_seaiceinc  )   CALL seaice_asm_inc ( kt )   ! apply sea ice concentration increment 
     
    829855      INTEGER, INTENT(in), OPTIONAL ::   kindic   ! flag for disabling the deallocation 
    830856      ! 
     857      INTEGER  ::   ji, jj 
    831858      INTEGER  ::   it 
    832859      REAL(wp) ::   zincwgt   ! IAU weight for current time step 
    833860#if defined key_si3 
    834       REAL(wp), DIMENSION(jpi,jpj) ::   zofrld, zohicif, zseaicendg, zhicifinc 
     861      REAL(wp), DIMENSION(ST_2D(nn_hls)) ::   zofrld, zohicif, zseaicendg, zhicifinc 
    835862      REAL(wp) ::   zhicifmin = 0.5_wp      ! ice minimum depth in metres 
    836863#endif 
     
    847874            ! note this is not a tendency so should not be divided by rn_Dt (as with the tracer and other increments) 
    848875            ! 
    849             IF(lwp) THEN 
    850                WRITE(numout,*)  
    851                WRITE(numout,*) 'seaice_asm_inc : sea ice conc IAU at time step = ', kt,' with IAU weight = ', wgtiau(it) 
    852                WRITE(numout,*) '~~~~~~~~~~~~' 
     876            IF( ntile == 0 .OR. ntile == 1 )  THEN                       ! Do only on the first tile 
     877               IF(lwp) THEN 
     878                  WRITE(numout,*) 
     879                  WRITE(numout,*) 'seaice_asm_inc : sea ice conc IAU at time step = ', kt,' with IAU weight = ', wgtiau(it) 
     880                  WRITE(numout,*) '~~~~~~~~~~~~' 
     881               ENDIF 
    853882            ENDIF 
    854883            ! 
     
    856885            ! 
    857886#if defined key_si3 
    858             zofrld (:,:) = 1._wp - at_i(:,:) 
    859             zohicif(:,:) = hm_i(:,:) 
    860             ! 
    861             at_i  (:,:) = 1. - MIN( MAX( 1.-at_i  (:,:) - seaice_bkginc(:,:) * zincwgt, 0.0_wp), 1.0_wp) 
    862             at_i_b(:,:) = 1. - MIN( MAX( 1.-at_i_b(:,:) - seaice_bkginc(:,:) * zincwgt, 0.0_wp), 1.0_wp) 
    863             fr_i(:,:) = at_i(:,:)        ! adjust ice fraction 
    864             ! 
    865             zseaicendg(:,:) = zofrld(:,:) - (1. - at_i(:,:))   ! find out actual sea ice nudge applied 
     887            DO_2D( 0, 0, 0, 0 ) 
     888               zofrld (ji,jj) = 1._wp - at_i(ji,jj) 
     889               zohicif(ji,jj) = hm_i(ji,jj) 
     890               ! 
     891               at_i  (ji,jj) = 1. - MIN( MAX( 1.-at_i  (ji,jj) - seaice_bkginc(ji,jj) * zincwgt, 0.0_wp), 1.0_wp) 
     892               at_i_b(ji,jj) = 1. - MIN( MAX( 1.-at_i_b(ji,jj) - seaice_bkginc(ji,jj) * zincwgt, 0.0_wp), 1.0_wp) 
     893               fr_i(ji,jj) = at_i(ji,jj)        ! adjust ice fraction 
     894               ! 
     895               zseaicendg(ji,jj) = zofrld(ji,jj) - (1. - at_i(ji,jj))   ! find out actual sea ice nudge applied 
     896            END_2D 
    866897            ! 
    867898            ! Nudge sea ice depth to bring it up to a required minimum depth 
    868             WHERE( zseaicendg(:,:) > 0.0_wp .AND. hm_i(:,:) < zhicifmin )  
    869                zhicifinc(:,:) = (zhicifmin - hm_i(:,:)) * zincwgt     
     899            WHERE( zseaicendg(:,:) > 0.0_wp .AND. hm_i(ST_2D(0)) < zhicifmin ) 
     900               zhicifinc(:,:) = (zhicifmin - hm_i(ST_2D(0))) * zincwgt 
    870901            ELSEWHERE 
    871902               zhicifinc(:,:) = 0.0_wp 
     
    873904            ! 
    874905            ! nudge ice depth 
    875             hm_i (:,:) = hm_i (:,:) + zhicifinc(:,:) 
     906            DO_2D( 0, 0, 0, 0 ) 
     907               hm_i (ji,jj) = hm_i (ji,jj) + zhicifinc(ji,jj) 
     908            END_2D 
    876909            ! 
    877910            ! seaice salinity balancing (to add) 
     
    880913#if defined key_cice && defined key_asminc 
    881914            ! Sea-ice : CICE case. Pass ice increment tendency into CICE 
    882             ndaice_da(:,:) = seaice_bkginc(:,:) * zincwgt / rn_Dt 
    883 #endif 
    884             ! 
    885             IF ( kt == nitiaufin_r ) THEN 
    886                DEALLOCATE( seaice_bkginc ) 
     915            DO_2D( 0, 0, 0, 0 ) 
     916               ndaice_da(ji,jj) = seaice_bkginc(ji,jj) * zincwgt / rn_Dt 
     917            END_2D 
     918#endif 
     919            ! 
     920            IF( ntile == 0 .OR. ntile == nijtile )  THEN                ! Do only on the last tile 
     921               IF ( kt == nitiaufin_r ) THEN 
     922                  DEALLOCATE( seaice_bkginc ) 
     923               ENDIF 
    887924            ENDIF 
    888925            ! 
     
    890927            ! 
    891928#if defined key_cice && defined key_asminc 
    892             ndaice_da(:,:) = 0._wp        ! Sea-ice : CICE case. Zero ice increment tendency into CICE 
     929            DO_2D( 0, 0, 0, 0 ) 
     930               ndaice_da(ji,jj) = 0._wp        ! Sea-ice : CICE case. Zero ice increment tendency into CICE 
     931            END_2D 
    893932#endif 
    894933            ! 
     
    905944            ! 
    906945#if defined key_si3 
    907             zofrld (:,:) = 1._wp - at_i(:,:) 
    908             zohicif(:,:) = hm_i(:,:) 
    909             !  
    910             ! Initialize the now fields the background + increment 
    911             at_i(:,:) = 1. - MIN( MAX( 1.-at_i(:,:) - seaice_bkginc(:,:), 0.0_wp), 1.0_wp) 
    912             at_i_b(:,:) = at_i(:,:)  
    913             fr_i(:,:) = at_i(:,:)        ! adjust ice fraction 
    914             ! 
    915             zseaicendg(:,:) = zofrld(:,:) - (1. - at_i(:,:))   ! find out actual sea ice nudge applied 
     946            DO_2D( 0, 0, 0, 0 ) 
     947               zofrld (ji,jj) = 1._wp - at_i(ji,jj) 
     948               zohicif(ji,jj) = hm_i(ji,jj) 
     949               ! 
     950               ! Initialize the now fields the background + increment 
     951               at_i(ji,jj) = 1. - MIN( MAX( 1.-at_i(ji,jj) - seaice_bkginc(ji,jj), 0.0_wp), 1.0_wp) 
     952               at_i_b(ji,jj) = at_i(ji,jj) 
     953               fr_i(ji,jj) = at_i(ji,jj)        ! adjust ice fraction 
     954               ! 
     955               zseaicendg(ji,jj) = zofrld(ji,jj) - (1. - at_i(ji,jj))   ! find out actual sea ice nudge applied 
     956            END_2D 
    916957            ! 
    917958            ! Nudge sea ice depth to bring it up to a required minimum depth 
    918             WHERE( zseaicendg(:,:) > 0.0_wp .AND. hm_i(:,:) < zhicifmin )  
    919                zhicifinc(:,:) = zhicifmin - hm_i(:,:) 
     959            WHERE( zseaicendg(:,:) > 0.0_wp .AND. hm_i(ST_2D(0)) < zhicifmin ) 
     960               zhicifinc(:,:) = zhicifmin - hm_i(ST_2D(0)) 
    920961            ELSEWHERE 
    921962               zhicifinc(:,:) = 0.0_wp 
     
    923964            ! 
    924965            ! nudge ice depth 
    925             hm_i (:,:) = hm_i (:,:) + zhicifinc(:,:) 
     966            DO_2D( 0, 0, 0, 0 ) 
     967               hm_i(ji,jj) = hm_i (ji,jj) + zhicifinc(ji,jj) 
     968            END_2D 
    926969            ! 
    927970            ! seaice salinity balancing (to add) 
     
    930973#if defined key_cice && defined key_asminc 
    931974            ! Sea-ice : CICE case. Pass ice increment tendency into CICE 
    932            ndaice_da(:,:) = seaice_bkginc(:,:) / rn_Dt 
    933 #endif 
    934             IF ( .NOT. PRESENT(kindic) ) THEN 
    935                DEALLOCATE( seaice_bkginc ) 
    936             END IF 
     975            DO_2D( 0, 0, 0, 0 ) 
     976               ndaice_da(ji,jj) = seaice_bkginc(ji,jj) / rn_Dt 
     977            END_2D 
     978#endif 
     979            IF( ntile == 0 .OR. ntile == nijtile )  THEN                ! Do only on the last tile 
     980               IF ( .NOT. PRESENT(kindic) ) THEN 
     981                  DEALLOCATE( seaice_bkginc ) 
     982               END IF 
     983            ENDIF 
    937984            ! 
    938985         ELSE 
    939986            ! 
    940987#if defined key_cice && defined key_asminc 
    941             ndaice_da(:,:) = 0._wp     ! Sea-ice : CICE case. Zero ice increment tendency into CICE 
     988            DO_2D( 0, 0, 0, 0 ) 
     989               ndaice_da(ji,jj) = 0._wp     ! Sea-ice : CICE case. Zero ice increment tendency into CICE 
     990            END_2D 
    942991#endif 
    943992            ! 
Note: See TracChangeset for help on using the changeset viewer.