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 4486 for branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90 – NEMO

Ignore:
Timestamp:
2014-02-05T12:23:56+01:00 (10 years ago)
Author:
jchanut
Message:

Finalize Time split and AGRIF (tickets #106 and #107) + ticket #1240

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90

    r4374 r4486  
    143143      REAL(wp) ::   zx1, zy1, zx2, zy2         !   -      - 
    144144      REAL(wp) ::   z1_12, z1_8, z1_4, z1_2    !   -      - 
    145       REAL(wp) ::   zu_spg, zv_spg                !   -      - 
     145      REAL(wp) ::   zu_spg, zv_spg             !   -      - 
    146146      REAL(wp) ::   zhura, zhvra               !   -      - 
    147147      REAL(wp) ::   za0, za1, za2, za3           !   -      - 
     
    204204         CALL ts_wgt(ln_bt_av, ll_fw_start, icycle, wgtbtp1, wgtbtp2) 
    205205         ! 
    206          IF ((neuler/=0).AND.(ln_bt_fw)) CALL ts_rst( nit000, 'READ' )  
    207206         ! 
    208207      ENDIF 
     
    449448         zssh_frc(:,:) = zssh_frc(:,:) + ssh_iau(:,:) 
    450449      ENDIF 
     450#endif 
     451      !                                   !* Fill boundary data arrays with AGRIF 
     452      !                                   ! ------------------------------------- 
     453#if defined key_agrif 
     454         IF( .NOT.Agrif_Root() ) CALL agrif_dta_ts( kt ) 
    451455#endif 
    452456      ! 
     
    543547         zwx(:,:) = e2u(:,:) * ua_e(:,:) * zhup2_e(:,:)         ! fluxes at jn+0.5 
    544548         zwy(:,:) = e1v(:,:) * va_e(:,:) * zhvp2_e(:,:) 
     549         ! 
     550#if defined key_agrif 
     551         ! Set fluxes during predictor step to ensure  
     552         ! volume conservation 
     553         IF( (.NOT.Agrif_Root()).AND.ln_bt_fw ) THEN 
     554            IF((nbondi == -1).OR.(nbondi == 2)) THEN 
     555               DO jj=1,jpj 
     556                  zwx(2,jj) = ubdy_w(jj) * e2u(2,jj) 
     557               END DO 
     558            ENDIF 
     559            IF((nbondi ==  1).OR.(nbondi == 2)) THEN 
     560               DO jj=1,jpj 
     561                  zwx(nlci-2,jj) = ubdy_e(jj) * e2u(nlci-2,jj) 
     562               END DO 
     563            ENDIF 
     564            IF((nbondj == -1).OR.(nbondj == 2)) THEN 
     565               DO ji=1,jpi 
     566                  zwy(ji,2) = vbdy_s(ji) * e1v(ji,2) 
     567               END DO 
     568            ENDIF 
     569            IF((nbondj ==  1).OR.(nbondj == 2)) THEN 
     570               DO ji=1,jpi 
     571                  zwy(ji,nlcj-2) = vbdy_n(ji) * e1v(ji,nlcj-2) 
     572               END DO 
     573            ENDIF 
     574         ENDIF 
     575#endif 
     576         ! 
     577         ! Sum over sub-time-steps to compute advective velocities 
     578         za2 = wgtbtp2(jn) 
     579         zu_sum  (:,:) = zu_sum  (:,:) + za2 * zwx  (:,:) / e2u  (:,:) 
     580         zv_sum  (:,:) = zv_sum  (:,:) + za2 * zwy  (:,:) / e1v  (:,:) 
     581         ! 
     582         ! Set next sea level: 
    545583         DO jj = 2, jpjm1                                  
    546584            DO ji = fs_2, fs_jpim1   ! vector opt. 
     
    549587            END DO 
    550588         END DO 
    551          ! 
    552          ! Sum over sub-time-steps to compute advective velocities 
    553          za2 = wgtbtp2(jn) 
    554          zu_sum  (:,:) = zu_sum  (:,:) + za2 * ua_e  (:,:) * zhup2_e  (:,:) 
    555          zv_sum  (:,:) = zv_sum  (:,:) + za2 * va_e  (:,:) * zhvp2_e  (:,:) 
    556          ! 
    557          ! Set next sea level: 
    558589         ssha_e(:,:) = (  sshn_e(:,:) - rdtbt * ( zssh_frc(:,:) + zhdiv(:,:) )  ) * tmask(:,:,1) 
    559590         CALL lbc_lnk( ssha_e, 'T',  1._wp ) 
     
    754785         IF( lk_bdy ) CALL bdy_dyn2d( jn, ua_e, va_e, zun_e, zvn_e, hur_e, hvr_e, ssha_e ) 
    755786#endif 
    756 #if defined key_agrif 
    757          IF( .NOT.Agrif_Root() ) CALL agrif_dyn_ts( kt, jn ) ! Agrif 
     787#if defined key_agrif                                                            
     788         IF( .NOT.Agrif_Root() )  CALL agrif_dyn_ts( jn ) ! Agrif 
    758789#endif 
    759790         !                                             !* Swap 
     
    842873         ! 
    843874      END DO 
     875      ! 
     876#if defined key_agrif 
     877      ! Save time integrated fluxes during child grid integration 
     878      ! (used to update coarse grid transports) 
     879      ! Useless with 2nd order momentum schemes 
     880      ! 
     881      IF ( (.NOT.Agrif_Root()).AND.(ln_bt_fw) ) THEN 
     882         IF ( Agrif_NbStepint().EQ.0 ) THEN 
     883            ub2_i_b(:,:) = 0.e0 
     884            vb2_i_b(:,:) = 0.e0 
     885         END IF 
     886         ! 
     887         za1 = 1._wp / REAL(Agrif_rhot(), wp) 
     888         ub2_i_b(:,:) = ub2_i_b(:,:) + za1 * ub2_b(:,:) 
     889         vb2_i_b(:,:) = vb2_i_b(:,:) + za1 * vb2_b(:,:) 
     890      ENDIF 
     891      ! 
     892      ! 
     893#endif       
    844894      ! 
    845895      !                                   !* write time-spliting arrays in the restart 
     
    9561006            CALL iom_get( numror, jpdom_autoglo, 'vb_e'     ,    vb_e(:,:) ) 
    9571007         ENDIF 
     1008#if defined key_agrif 
     1009         ! Read time integrated fluxes 
     1010         IF ( .NOT.Agrif_Root() ) THEN 
     1011            CALL iom_get( numror, jpdom_autoglo, 'ub2_i_b'  , ub2_i_b(:,:) )    
     1012            CALL iom_get( numror, jpdom_autoglo, 'vb2_i_b'  , vb2_i_b(:,:) ) 
     1013         ENDIF 
     1014#endif 
    9581015      ! 
    9591016      ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN 
     
    9691026            CALL iom_rstput( kt, nitrst, numrow, 'vb_e'     ,    vb_e(:,:) ) 
    9701027         ENDIF 
     1028#if defined key_agrif 
     1029         ! Save time integrated fluxes 
     1030         IF ( .NOT.Agrif_Root() ) THEN 
     1031            CALL iom_rstput( kt, nitrst, numrow, 'ub2_i_b'  , ub2_i_b(:,:) ) 
     1032            CALL iom_rstput( kt, nitrst, numrow, 'vb2_i_b'  , vb2_i_b(:,:) ) 
     1033         ENDIF 
     1034#endif 
    9711035      ENDIF 
    9721036      ! 
     
    10531117      ENDIF 
    10541118      ! 
     1119#if defined key_agrif 
     1120      ! Restrict the use of Agrif to the forward case only 
     1121      IF ((.NOT.ln_bt_fw ).AND.(.NOT.Agrif_Root())) CALL ctl_stop( 'AGRIF not implemented if ln_bt_fw=.FALSE.' ) 
     1122#endif 
     1123      ! 
    10551124      IF(lwp) WRITE(numout,*)    '     Time filter choice, nn_bt_flt: ', nn_bt_flt 
    10561125      SELECT CASE ( nn_bt_flt ) 
     
    10721141         CALL ctl_stop( 'dynspg_ts ERROR: Maximum Courant number is greater than 0.9: Inc. nn_baro !' )           
    10731142      ENDIF 
     1143      ! 
     1144      IF ((neuler/=0).AND.(ln_bt_fw)) CALL ts_rst( nit000, 'READ' )  
    10741145      ! 
    10751146      CALL wrk_dealloc( jpi, jpj, zcu ) 
     
    11041175 
    11051176 
     1177 
Note: See TracChangeset for help on using the changeset viewer.