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 1390 – NEMO

Changeset 1390


Ignore:
Timestamp:
2009-04-08T16:44:58+02:00 (15 years ago)
Author:
rblod
Message:

Cleaning of VVL, ticket #402:

  • dynnxt : correct indice bug
  • wzmod : add obc case
  • dynspg_flt : cosmetic change + computation speed-up
  • dynspg_exp : just update velocity with surface pressure trend
Location:
branches/dev_004_VVL/NEMO/OPA_SRC/DYN
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/dev_004_VVL/NEMO/OPA_SRC/DYN/dynnxt.F90

    r1382 r1390  
    110110      IF( lk_vvl ) THEN                                  ! Varying levels 
    111111         DO jk = 1, jpkm1 
    112             ua(ji,jj,jk) = (        ub(:,:,jk) * fse3u_b(:,:,jk)     & 
     112            ua(:,:,jk) = (        ub(:,:,jk) * fse3u_b(:,:,jk)     & 
    113113               &           + z2dt * ua(:,:,jk) * fse3u_n(:,:,jk) )   & 
    114114               &         / fse3u_a(:,:,jk) * umask(:,:,jk) 
    115             va(ji,jj,jk) = (        vb(:,:,jk) * fse3v_b(:,:,jk)     & 
     115            va(:,:,jk) = (        vb(:,:,jk) * fse3v_b(:,:,jk)     & 
    116116               &           + z2dt * va(:,:,jk) * fse3v_n(:,:,jk) )   & 
    117117               &         / fse3v_a(:,:,jk) * vmask(:,:,jk) 
  • branches/dev_004_VVL/NEMO/OPA_SRC/DYN/dynspg_exp.F90

    r1146 r1390  
    1111   !!                      pressure gradient in the free surface constant   
    1212   !!                      volume case with vector optimization 
    13    !!   exp_rst      : read/write the explicit restart fields in the ocean restart file 
    1413   !!---------------------------------------------------------------------- 
    1514   !! * Modules used 
     
    3332   !! * Accessibility 
    3433   PUBLIC dyn_spg_exp  ! routine called by step.F90 
    35    PUBLIC exp_rst      ! routine called by istate.F90 
    3634 
    3735   !! * Substitutions 
     
    6260      !!      -1- Compute the now surface pressure gradient 
    6361      !!      -2- Add it to the general trend 
    64       !!      -3- Compute the horizontal divergence of velocities 
    65       !!      - the now divergence is given by : 
    66       !!         zhdivn = 1/(e1t*e2t*e3t) ( di[e2u*e3u un] + dj[e1v*e3v vn] ) 
    67       !!      - integrate the horizontal divergence from the bottom  
    68       !!         to the surface 
    69       !!      - apply lateral boundary conditions on zhdivn 
    70       !!      -4- Estimate the after sea surface elevation from the kinematic 
    71       !!         surface boundary condition: 
    72       !!         zssha = sshb - 2 rdt ( zhdiv + emp ) 
    73       !!      - Time filter applied on now sea surface elevation to avoid 
    74       !!         the divergence of two consecutive time-steps and swap of free 
    75       !!         surface arrays to start the next time step: 
    76       !!         sshb = sshn + atfp * [ sshb + zssha - 2 sshn ] 
    77       !!         sshn = zssha 
    78       !!      - apply lateral boundary conditions on sshn 
    7962      !! 
    8063      !! ** Action : - Update (ua,va) with the surf. pressure gradient trend 
     
    9174      !! * Local declarations 
    9275      INTEGER  ::   ji, jj, jk               ! dummy loop indices 
    93       REAL(wp) ::   z2dt, zraur, zssha       ! temporary scalars  
    94       REAL(wp), DIMENSION(jpi,jpj)    ::  &  ! temporary arrays 
    95          &         zhdiv 
    9676      !!---------------------------------------------------------------------- 
    9777 
     
    10484         spgu(:,:) = 0.e0                     ! surface pressure gradient (i-direction) 
    10585         spgv(:,:) = 0.e0                     ! surface pressure gradient (j-direction) 
    106  
    107          CALL exp_rst( nit000, 'READ' )       ! read or initialize the following fields: 
    108          !                                    ! sshb, sshn 
    109  
    11086      ENDIF 
    11187 
    112       IF( .NOT. lk_vvl ) THEN 
     88      ! 0. Initialization 
     89      ! ----------------- 
     90      ! read or estimate sea surface height and vertically integrated velocities 
     91      IF( lk_obc )   CALL obc_dta_bt( kt, 0 ) 
    11392 
    114          ! 0. Initialization 
    115          ! ----------------- 
    116          ! read or estimate sea surface height and vertically integrated velocities 
    117          IF( lk_obc )   CALL obc_dta_bt( kt, 0 ) 
    118          z2dt = 2. * rdt                                       ! time step: leap-frog 
    119          IF( neuler == 0 .AND. kt == nit000 ) z2dt = rdt       ! time step: Euler if restart from rest 
    120          zraur = 1.e0 / rauw 
     93      ! 1. Surface pressure gradient (now) 
     94      ! ---------------------------- 
     95      DO jj = 2, jpjm1 
     96         DO ji = fs_2, fs_jpim1   ! vector opt. 
     97            spgu(ji,jj) = - grav * ( sshn(ji+1,jj) - sshn(ji,jj) ) / e1u(ji,jj) 
     98            spgv(ji,jj) = - grav * ( sshn(ji,jj+1) - sshn(ji,jj) ) / e2v(ji,jj) 
     99         END DO 
     100      END DO 
    121101 
    122          ! 1. Surface pressure gradient (now) 
    123          ! ---------------------------- 
     102      ! 2. Add the surface pressure trend to the general trend 
     103      ! ------------------------------------------------------ 
     104      DO jk = 1, jpkm1 
    124105         DO jj = 2, jpjm1 
    125106            DO ji = fs_2, fs_jpim1   ! vector opt. 
    126                spgu(ji,jj) = - grav * ( sshn(ji+1,jj) - sshn(ji,jj) ) / e1u(ji,jj) 
    127                spgv(ji,jj) = - grav * ( sshn(ji,jj+1) - sshn(ji,jj) ) / e2v(ji,jj) 
     107               ua(ji,jj,jk) = ua(ji,jj,jk) + spgu(ji,jj) 
     108               va(ji,jj,jk) = va(ji,jj,jk) + spgv(ji,jj) 
    128109            END DO 
    129110         END DO 
     111      END DO 
    130112 
    131          ! 2. Add the surface pressure trend to the general trend 
    132          ! ------------------------------------------------------ 
    133          DO jk = 1, jpkm1 
    134             DO jj = 2, jpjm1 
    135                DO ji = fs_2, fs_jpim1   ! vector opt. 
    136                   ua(ji,jj,jk) = ua(ji,jj,jk) + spgu(ji,jj) 
    137                   va(ji,jj,jk) = va(ji,jj,jk) + spgv(ji,jj) 
    138                END DO 
    139             END DO 
    140          END DO 
    141       
    142          ! 3. Vertical integration of horizontal divergence of velocities 
    143          ! -------------------------------- 
    144          zhdiv(:,:) = 0.e0 
    145          DO jk = jpkm1, 1, -1 
    146             DO jj = 2, jpjm1 
    147                DO ji = fs_2, fs_jpim1   ! vector opt. 
    148                   zhdiv(ji,jj) = zhdiv(ji,jj) + (  e2u(ji  ,jj  ) * fse3u(ji  ,jj  ,jk) * un(ji  ,jj  ,jk)      & 
    149                      &                           - e2u(ji-1,jj  ) * fse3u(ji-1,jj  ,jk) * un(ji-1,jj  ,jk)      & 
    150                      &                           + e1v(ji  ,jj  ) * fse3v(ji  ,jj  ,jk) * vn(ji  ,jj  ,jk)      & 
    151                      &                           - e1v(ji  ,jj-1) * fse3v(ji  ,jj-1,jk) * vn(ji  ,jj-1,jk)  )   & 
    152                      &                        / ( e1t(ji,jj) * e2t(ji,jj) ) 
    153                END DO 
    154             END DO 
    155          END DO 
    156  
    157 #if defined key_obc 
    158          ! open boundaries (div must be zero behind the open boundary) 
    159          !  mpp remark: The zeroing of zhdiv can probably be extended to 1->jpi/jpj for the correct row/column 
    160          IF( lp_obc_east  )   zhdiv(nie0p1:nie1p1,nje0  :nje1  ) = 0.e0      ! east 
    161          IF( lp_obc_west  )   zhdiv(niw0  :niw1  ,njw0  :njw1  ) = 0.e0      ! west 
    162          IF( lp_obc_north )   zhdiv(nin0  :nin1  ,njn0p1:njn1p1) = 0.e0      ! north 
    163          IF( lp_obc_south )   zhdiv(nis0  :nis1  ,njs0  :njs1  ) = 0.e0      ! south 
    164 #endif 
    165  
    166          ! 4. Sea surface elevation time stepping 
    167          ! -------------------------------------- 
    168          ! Euler (forward) time stepping, no time filter 
    169          IF( neuler == 0 .AND. kt == nit000 ) THEN 
    170             DO jj = 1, jpj 
    171                DO ji = 1, jpi 
    172                   ! after free surface elevation 
    173                   zssha = sshb(ji,jj) - rdt * ( zraur * emp(ji,jj) + zhdiv(ji,jj) ) * tmask(ji,jj,1) 
    174                   ! swap of arrays 
    175                   sshb(ji,jj) = sshn(ji,jj) 
    176                   sshn(ji,jj) = zssha 
    177                END DO 
    178             END DO 
    179          ELSE 
    180             ! Leap-frog time stepping and time filter 
    181             DO jj = 1, jpj 
    182                DO ji = 1, jpi 
    183                   ! after free surface elevation 
    184                   zssha = sshb(ji,jj) - z2dt * ( zraur * emp(ji,jj) + zhdiv(ji,jj) ) * tmask(ji,jj,1) 
    185                   ! time filter and array swap 
    186                   sshb(ji,jj) = atfp * ( sshb(ji,jj) + zssha ) + atfp1 * sshn(ji,jj) 
    187                   sshn(ji,jj) = zssha 
    188                END DO 
    189             END DO 
    190          ENDIF 
    191  
    192       ELSE !! Variable volume, ssh time-stepping already done 
    193  
    194          ! read or estimate sea surface height and vertically integrated velocities 
    195          IF( lk_obc )   CALL obc_dta_bt( kt, 0 ) 
    196  
    197          ! Sea surface elevation swap 
    198          ! ----------------------------- 
    199          ! 
    200          sshbb(:,:) = sshb(:,:) ! Needed for the dynamics time-stepping 
    201          ! 
    202          IF( neuler == 0 .AND. kt == nit000 ) THEN 
    203             ! No time filter 
    204             sshb(:,:) = sshn(:,:) 
    205             sshn(:,:) = ssha(:,:) 
    206          ELSE 
    207             ! Time filter 
    208             sshb(:,:) = atfp * ( sshb(:,:) + ssha(:,:) ) + atfp1 * sshn(:,:) 
    209             sshn(:,:) = ssha(:,:) 
    210          ENDIF 
    211  
    212       ENDIF 
    213  
    214       ! Boundary conditions on sshn 
    215       IF( .NOT. lk_obc ) CALL lbc_lnk( sshn, 'T', 1. ) 
    216  
    217       ! write filtered free surface arrays in restart file 
    218       ! -------------------------------------------------- 
    219       IF( lrst_oce )   CALL exp_rst( kt, 'WRITE' ) 
    220   
    221       IF(ln_ctl) THEN         ! print sum trends (used for debugging) 
    222          CALL prt_ctl(tab2d_1=sshn, clinfo1=' ssh      : ', mask1=tmask) 
    223       ENDIF 
    224        
    225113   END SUBROUTINE dyn_spg_exp 
    226114 
    227    SUBROUTINE exp_rst( kt, cdrw ) 
    228       !!--------------------------------------------------------------------- 
    229       !!                   ***  ROUTINE exp_rst  *** 
    230       !! 
    231       !! ** Purpose : Read or write explicit arrays in restart file 
    232       !!---------------------------------------------------------------------- 
    233       INTEGER         , INTENT(in) ::   kt         ! ocean time-step 
    234       CHARACTER(len=*), INTENT(in) ::   cdrw       ! "READ"/"WRITE" flag 
    235       ! 
    236       !!---------------------------------------------------------------------- 
    237       ! 
    238       IF( TRIM(cdrw) == 'READ' ) THEN 
    239          IF( iom_varid( numror, 'sshn', ldstop = .FALSE. ) > 0 ) THEN 
    240             CALL iom_get( numror, jpdom_autoglo, 'sshb'  , sshb(:,:)   ) 
    241             CALL iom_get( numror, jpdom_autoglo, 'sshn'  , sshn(:,:)   ) 
    242             IF( neuler == 0 ) sshb(:,:) = sshn(:,:) 
    243          ELSE 
    244             IF( nn_rstssh == 1 ) THEN   
    245                sshb(:,:) = 0.e0 
    246                sshn(:,:) = 0.e0 
    247             ENDIF 
    248          ENDIF 
    249       ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN 
    250          CALL iom_rstput( kt, nitrst, numrow, 'sshb'  , sshb  (:,:) ) 
    251          CALL iom_rstput( kt, nitrst, numrow, 'sshn'  , sshn  (:,:) ) 
    252       ENDIF 
    253       ! 
    254    END SUBROUTINE exp_rst 
    255115#else 
    256116   !!---------------------------------------------------------------------- 
     
    261121      WRITE(*,*) 'dyn_spg_exp: You should not have seen this print! error?', kt 
    262122   END SUBROUTINE dyn_spg_exp 
    263    SUBROUTINE exp_rst( kt, cdrw )     ! Empty routine 
    264       INTEGER         , INTENT(in) ::   kt         ! ocean time-step 
    265       CHARACTER(len=*), INTENT(in) ::   cdrw       ! "READ"/"WRITE" flag 
    266       WRITE(*,*) 'exp_rst: You should not have seen this print! error?', kt, cdrw 
    267    END SUBROUTINE exp_rst 
    268123#endif 
    269     
     124 
    270125   !!====================================================================== 
    271126END MODULE dynspg_exp 
  • branches/dev_004_VVL/NEMO/OPA_SRC/DYN/dynspg_flt.F90

    r1389 r1390  
    8181      !!      where sshn is the free surface elevation and btda is the after 
    8282      !!      of the free surface elevation 
    83       !!       -1- compute the after sea surface elevation from the kinematic 
    84       !!      surface boundary condition: 
    85       !!              zssha = sshb + 2 rdt ( wn - emp ) 
    86       !!           Time filter applied on now sea surface elevation to avoid  
    87       !!      the divergence of two consecutive time-steps and swap of free 
    88       !!      surface arrays to start the next time step: 
    89       !!              sshb = sshn + atfp * [ sshb + zssha - 2 sshn ] 
    90       !!              sshn = zssha 
    91       !!       -2- evaluate the surface presure trend (including the addi- 
     83      !!       -1- evaluate the surface presure trend (including the addi- 
    9284      !!      tional force) in three steps: 
    9385      !!        a- compute the right hand side of the elliptic equation: 
     
    10597      !!         iterative solver 
    10698      !!        c- apply the solver by a call to sol... routine 
    107       !!       -3- compute and add the free surface pressure gradient inclu- 
     99      !!       -2- compute and add the free surface pressure gradient inclu- 
    108100      !!      ding the additional force used to stabilize the equation. 
    109101      !! 
     
    123115         &          znurau, zgcb, zbtd,              &  !   "          " 
    124116         &          ztdgu, ztdgv                        !   "          " 
    125       !! Variable volume 
    126       REAL(wp), DIMENSION(jpi,jpj)     ::  & 
    127          zsshub, zsshua, zsshvb, zsshva, zssha          ! 2D workspace 
    128       REAL(wp), DIMENSION(jpi,jpj,jpk) ::  &            ! 3D workspace 
    129          zfse3ub, zfse3ua, zfse3vb, zfse3va             ! 3D workspace 
    130117      !!---------------------------------------------------------------------- 
    131118      ! 
     
    182169            END DO  
    183170         END DO  
    184  
    185          ! Add the surface pressure trend to the general trend 
     171         ! 
     172         ! add the surface pressure trend to the general trend and 
     173         ! evaluate the masked next velocity (effect of the additional force not included) 
    186174         DO jk = 1, jpkm1 
    187175            DO jj = 2, jpjm1 
    188176               DO ji = fs_2, fs_jpim1   ! vector opt. 
    189                   ua(ji,jj,jk) = ua(ji,jj,jk) + spgu(ji,jj) 
    190                   va(ji,jj,jk) = va(ji,jj,jk) + spgv(ji,jj) 
     177                  ua(ji,jj,jk) = (  ub(ji,jj,jk) + z2dt * ( ua(ji,jj,jk) + spgu(ji,jj) )  ) * umask(ji,jj,jk) 
     178                  va(ji,jj,jk) = (  vb(ji,jj,jk) + z2dt * ( va(ji,jj,jk) + spgv(ji,jj) )  ) * vmask(ji,jj,jk) 
    191179               END DO 
    192180            END DO 
    193181         END DO 
    194  
    195          ! Evaluate the masked next velocity (effect of the additional force not included) 
    196          DO jk = 1, jpkm1 
    197             DO jj = 2, jpjm1 
    198                DO ji = fs_2, fs_jpim1   ! vector opt. 
    199                   ua(ji,jj,jk) = ( ub(ji,jj,jk) + z2dt * ua(ji,jj,jk) ) * umask(ji,jj,jk) 
    200                   va(ji,jj,jk) = ( vb(ji,jj,jk) + z2dt * va(ji,jj,jk) ) * vmask(ji,jj,jk) 
    201                END DO 
    202             END DO 
    203          END DO 
    204  
     182         ! 
    205183      ENDIF 
    206184 
     
    266244      CALL lbc_lnk( spgv, 'V', -1. ) 
    267245 
    268       IF( lk_vvl ) CALL sol_mat( kt ) 
     246      IF( lk_vvl ) CALL sol_mat( kt )      ! build the matrix at kt (vvl case only) 
    269247 
    270248      ! Right hand side of the elliptic equation and first guess 
     
    302280      ! Relative precision (computation on one processor) 
    303281      ! ------------------ 
    304       rnorme =0. 
     282      rnorme =0.e0 
    305283      rnorme = SUM( gcb(1:jpi,1:jpj) * gcdmat(1:jpi,1:jpj) * gcb(1:jpi,1:jpj) * bmask(:,:) ) 
    306284      IF( lk_mpp )   CALL mpp_sum( rnorme )   ! sum over the global domain 
     
    368346      ENDIF 
    369347#endif       
    370       ! 7.  Add the trends multiplied by z2dt to the after velocity 
    371       ! ----------------------------------------------------------- 
     348      ! Add the trends multiplied by z2dt to the after velocity 
     349      ! ------------------------------------------------------- 
    372350      !     ( c a u t i o n : (ua,va) here are the after velocity not the 
    373351      !                       trend, the leap-frog time stepping will not 
  • branches/dev_004_VVL/NEMO/OPA_SRC/DYN/wzvmod.F90

    r1389 r1390  
    154154      ssha(:,:) = (  sshb(:,:) - z2dt * ( zraur * emp(:,:)                       + zhdiv(:,:) )  ) * tmask(:,:,1) 
    155155 
     156#if defined key_obc 
     157# if defined key_agrif 
     158      IF ( Agrif_Root() ) THEN  
     159# endif 
     160         ssha(:,:) = ssha(:,:)*obctmsk(:,:) 
     161         CALL lbc_lnk(ssha,'T',1.)  ! absolutly compulsory !! (jmm) 
     162# if defined key_agrif 
     163      ENDIF 
     164# endif 
     165#endif 
     166 
    156167      !                                                ! Sea Surface Height at u-,v- and f-points (vvl case only) 
    157168      IF( lk_vvl ) THEN                                ! (required only in key_vvl case) 
Note: See TracChangeset for help on using the changeset viewer.