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 12377 for NEMO/trunk/src/OCE/BDY/bdydta.F90 – NEMO

Ignore:
Timestamp:
2020-02-12T15:39:06+01:00 (4 years ago)
Author:
acc
Message:

The big one. Merging all 2019 developments from the option 1 branch back onto the trunk.

This changeset reproduces 2019/dev_r11943_MERGE_2019 on the trunk using a 2-URL merge
onto a working copy of the trunk. I.e.:

svn merge --ignore-ancestry \

svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/trunk \
svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/branches/2019/dev_r11943_MERGE_2019 ./

The --ignore-ancestry flag avoids problems that may otherwise arise from the fact that
the merge history been trunk and branch may have been applied in a different order but
care has been taken before this step to ensure that all applicable fixes and updates
are present in the merge branch.

The trunk state just before this step has been branched to releases/release-4.0-HEAD
and that branch has been immediately tagged as releases/release-4.0.2. Any fixes
or additions in response to tickets on 4.0, 4.0.1 or 4.0.2 should be done on
releases/release-4.0-HEAD. From now on future 'point' releases (e.g. 4.0.2) will
remain unchanged with periodic releases as needs demand. Note release-4.0-HEAD is a
transitional naming convention. Future full releases, say 4.2, will have a release-4.2
branch which fulfills this role and the first point release (e.g. 4.2.0) will be made
immediately following the release branch creation.

2020 developments can be started from any trunk revision later than this one.

Location:
NEMO/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk

    • 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_r11615_ENHANCE-04_namelists_as_internalfiles_agrif@HEAD      ext/AGRIF 
        66^/vendors/FCM@HEAD            ext/FCM 
        77^/vendors/IOIPSL@HEAD         ext/IOIPSL 
  • NEMO/trunk/src/OCE/BDY/bdydta.F90

    r12049 r12377  
    2323   USE phycst         ! physical constants 
    2424   USE sbcapr         ! atmospheric pressure forcing 
    25    USE sbctide        ! Tidal forcing or not 
     25   USE tide_mod, ONLY: ln_tide ! tidal forcing 
    2626   USE bdy_oce        ! ocean open boundary conditions   
    2727   USE bdytides       ! tidal forcing at boundaries 
     
    6868!$AGRIF_END_DO_NOT_TREAT 
    6969 
     70   !! * Substitutions 
     71#  include "do_loop_substitute.h90" 
    7072   !!---------------------------------------------------------------------- 
    7173   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    7577CONTAINS 
    7678 
    77    SUBROUTINE bdy_dta( kt, kit, kt_offset ) 
     79   SUBROUTINE bdy_dta( kt, Kmm ) 
    7880      !!---------------------------------------------------------------------- 
    7981      !!                   ***  SUBROUTINE bdy_dta  *** 
     
    8587      !!---------------------------------------------------------------------- 
    8688      INTEGER, INTENT(in)           ::   kt           ! ocean time-step index  
    87       INTEGER, INTENT(in), OPTIONAL ::   kit          ! subcycle time-step index (for timesplitting option) 
    88       INTEGER, INTENT(in), OPTIONAL ::   kt_offset    ! time offset in units of timesteps. NB. if kit 
    89       !                                               ! is present then units = subcycle timesteps. 
    90       !                                               ! kt_offset = 0 => get data at "now" time level 
    91       !                                               ! kt_offset = -1 => get data at "before" time level 
    92       !                                               ! kt_offset = +1 => get data at "after" time level 
    93       !                                               ! etc. 
     89      INTEGER, INTENT(in)           ::   Kmm          ! ocean time level index 
    9490      ! 
    9591      INTEGER ::  jbdy, jfld, jstart, jend, ib, jl    ! dummy loop indices 
     
    105101      ! Initialise data arrays once for all from initial conditions where required 
    106102      !--------------------------------------------------------------------------- 
    107       IF( kt == nit000 .AND. .NOT.PRESENT(kit) ) THEN 
     103      IF( kt == nit000 ) THEN 
    108104 
    109105         ! Calculate depth-mean currents 
     
    122118                     ii = idx_bdy(jbdy)%nbi(ib,igrd) 
    123119                     ij = idx_bdy(jbdy)%nbj(ib,igrd) 
    124                      dta_bdy(jbdy)%ssh(ib) = sshn(ii,ij) * tmask(ii,ij,1)          
     120                     dta_bdy(jbdy)%ssh(ib) = ssh(ii,ij,Kmm) * tmask(ii,ij,1)          
    125121                  END DO 
    126122               ENDIF 
     
    130126                     ii = idx_bdy(jbdy)%nbi(ib,igrd) 
    131127                     ij = idx_bdy(jbdy)%nbj(ib,igrd) 
    132                      dta_bdy(jbdy)%u2d(ib) = un_b(ii,ij) * umask(ii,ij,1)          
     128                     dta_bdy(jbdy)%u2d(ib) = uu_b(ii,ij,Kmm) * umask(ii,ij,1)          
    133129                  END DO 
    134130                  igrd = 3 
     
    136132                     ii = idx_bdy(jbdy)%nbi(ib,igrd) 
    137133                     ij = idx_bdy(jbdy)%nbj(ib,igrd) 
    138                      dta_bdy(jbdy)%v2d(ib) = vn_b(ii,ij) * vmask(ii,ij,1)          
     134                     dta_bdy(jbdy)%v2d(ib) = vv_b(ii,ij,Kmm) * vmask(ii,ij,1)          
    139135                  END DO 
    140136               ENDIF 
     
    149145                        ii = idx_bdy(jbdy)%nbi(ib,igrd) 
    150146                        ij = idx_bdy(jbdy)%nbj(ib,igrd) 
    151                         dta_bdy(jbdy)%u3d(ib,ik) =  ( un(ii,ij,ik) - un_b(ii,ij) ) * umask(ii,ij,ik)          
     147                        dta_bdy(jbdy)%u3d(ib,ik) =  ( uu(ii,ij,ik,Kmm) - uu_b(ii,ij,Kmm) ) * umask(ii,ij,ik)          
    152148                     END DO 
    153149                  END DO 
     
    157153                        ii = idx_bdy(jbdy)%nbi(ib,igrd) 
    158154                        ij = idx_bdy(jbdy)%nbj(ib,igrd) 
    159                         dta_bdy(jbdy)%v3d(ib,ik) =  ( vn(ii,ij,ik) - vn_b(ii,ij) ) * vmask(ii,ij,ik)          
     155                        dta_bdy(jbdy)%v3d(ib,ik) =  ( vv(ii,ij,ik,Kmm) - vv_b(ii,ij,Kmm) ) * vmask(ii,ij,ik)          
    160156                     END DO 
    161157                  END DO 
     
    171167                        ii = idx_bdy(jbdy)%nbi(ib,igrd) 
    172168                        ij = idx_bdy(jbdy)%nbj(ib,igrd) 
    173                         dta_bdy(jbdy)%tem(ib,ik) = tsn(ii,ij,ik,jp_tem) * tmask(ii,ij,ik)          
    174                         dta_bdy(jbdy)%sal(ib,ik) = tsn(ii,ij,ik,jp_sal) * tmask(ii,ij,ik)          
     169                        dta_bdy(jbdy)%tem(ib,ik) = ts(ii,ij,ik,jp_tem,Kmm) * tmask(ii,ij,ik)          
     170                        dta_bdy(jbdy)%sal(ib,ik) = ts(ii,ij,ik,jp_sal,Kmm) * tmask(ii,ij,ik)          
    175171                     END DO 
    176172                  END DO 
     
    216212         ! read/update all bdy data 
    217213         ! ------------------------ 
    218          CALL fld_read( kt, 1, bf_alias, kit = kit, kt_offset = kt_offset ) 
    219  
     214         ! BDY: use pt_offset=0.5 as applied at the end of the step and fldread is referenced at the middle of the step 
     215         CALL fld_read( kt, 1, bf_alias, pt_offset = 0.5_wp, Kmm = Kmm ) 
    220216         ! apply some corrections in some specific cases... 
    221217         ! -------------------------------------------------- 
     
    254250               ij   = idx_bdy(jbdy)%nbj(ib,igrd) 
    255251               DO ik = 1, jpkm1 
    256                   dta_alias%u2d(ib) = dta_alias%u2d(ib) + e3u_n(ii,ij,ik) * umask(ii,ij,ik) * dta_alias%u3d(ib,ik) 
     252                  dta_alias%u2d(ib) = dta_alias%u2d(ib) + e3u(ii,ij,ik,Kmm) * umask(ii,ij,ik) * dta_alias%u3d(ib,ik) 
    257253               END DO 
    258                dta_alias%u2d(ib) =  dta_alias%u2d(ib) * r1_hu_n(ii,ij) 
     254               dta_alias%u2d(ib) =  dta_alias%u2d(ib) * r1_hu(ii,ij,Kmm) 
    259255               DO ik = 1, jpkm1            ! compute barocline zonal velocity and put it in u3d 
    260256                  dta_alias%u3d(ib,ik) = dta_alias%u3d(ib,ik) - dta_alias%u2d(ib) 
     
    267263               ij   = idx_bdy(jbdy)%nbj(ib,igrd) 
    268264               DO ik = 1, jpkm1 
    269                   dta_alias%v2d(ib) = dta_alias%v2d(ib) + e3v_n(ii,ij,ik) * vmask(ii,ij,ik) * dta_alias%v3d(ib,ik) 
     265                  dta_alias%v2d(ib) = dta_alias%v2d(ib) + e3v(ii,ij,ik,Kmm) * vmask(ii,ij,ik) * dta_alias%v3d(ib,ik) 
    270266               END DO 
    271                dta_alias%v2d(ib) =  dta_alias%v2d(ib) * r1_hv_n(ii,ij) 
     267               dta_alias%v2d(ib) =  dta_alias%v2d(ib) * r1_hv(ii,ij,Kmm) 
    272268               DO ik = 1, jpkm1            ! compute barocline meridional velocity and put it in v3d 
    273269                  dta_alias%v3d(ib,ik) = dta_alias%v3d(ib,ik) - dta_alias%v2d(ib) 
     
    275271            END DO 
    276272         ENDIF   ! ltotvel 
    277  
    278          ! update tidal harmonic forcing 
    279          IF( PRESENT(kit) .AND. nn_dyn2d_dta(jbdy) .GE. 2 ) THEN 
    280             CALL bdytide_update( kt = kt, idx = idx_bdy(jbdy), dta = dta_alias, td = tides(jbdy),   &  
    281                &                 kit = kit, kt_offset = kt_offset ) 
    282          ENDIF 
    283273 
    284274         !  atm surface pressure : add inverted barometer effect to ssh if it was read 
     
    343333                  nblen => idx_bdy(jbdy)%nblen 
    344334                  nblenrim => idx_bdy(jbdy)%nblenrim 
    345                   IF( cn_dyn2d(jbdy) == 'frs' ) THEN ; ilen1(:)=nblen(:) ; ELSE ; ilen1(:)=nblenrim(:) ; ENDIF  
    346                      IF ( dta_bdy(jbdy)%lneed_ssh   ) dta_bdy_s(jbdy)%ssh(1:ilen1(1)) = dta_bdy(jbdy)%ssh(1:ilen1(1)) 
    347                      IF ( dta_bdy(jbdy)%lneed_dyn2d ) dta_bdy_s(jbdy)%u2d(1:ilen1(2)) = dta_bdy(jbdy)%u2d(1:ilen1(2)) 
    348                      IF ( dta_bdy(jbdy)%lneed_dyn2d ) dta_bdy_s(jbdy)%v2d(1:ilen1(3)) = dta_bdy(jbdy)%v2d(1:ilen1(3)) 
    349                   ENDIF 
    350                END DO 
    351             ELSE ! Add tides if not split-explicit free surface else this is done in ts loop 
    352                ! 
    353                CALL bdy_dta_tides( kt=kt, kt_offset=kt_offset ) 
    354             ENDIF 
     335                  IF( cn_dyn2d(jbdy) == 'frs' ) THEN   ;   ilen1(:)=nblen(:) 
     336                  ELSE                                 ;   ilen1(:)=nblenrim(:) 
     337                  ENDIF 
     338                  IF ( dta_bdy(jbdy)%lneed_ssh   ) dta_bdy_s(jbdy)%ssh(1:ilen1(1)) = dta_bdy(jbdy)%ssh(1:ilen1(1)) 
     339                  IF ( dta_bdy(jbdy)%lneed_dyn2d ) dta_bdy_s(jbdy)%u2d(1:ilen1(2)) = dta_bdy(jbdy)%u2d(1:ilen1(2)) 
     340                  IF ( dta_bdy(jbdy)%lneed_dyn2d ) dta_bdy_s(jbdy)%v2d(1:ilen1(3)) = dta_bdy(jbdy)%v2d(1:ilen1(3)) 
     341               ENDIF 
     342            END DO 
     343         ELSE ! Add tides if not split-explicit free surface else this is done in ts loop 
     344            ! 
     345            ! BDY: use pt_offset=1.0 as applied at the end of the step and bdy_dta_tides is referenced at the middle of the step 
     346            CALL bdy_dta_tides( kt=kt, pt_offset = 1._wp ) 
    355347         ENDIF 
    356          ! 
    357          IF( ln_timing )   CALL timing_stop('bdy_dta') 
    358          ! 
    359       END SUBROUTINE bdy_dta 
     348      ENDIF 
     349      ! 
     350      IF( ln_timing )   CALL timing_stop('bdy_dta') 
     351      ! 
     352   END SUBROUTINE bdy_dta 
    360353 
    361354 
     
    373366      INTEGER ::   ierror, ios     !  
    374367      ! 
     368      INTEGER ::   nbdy_rdstart, nbdy_loc 
     369      CHARACTER(LEN=50)                      ::   cerrmsg       ! error string 
    375370      CHARACTER(len=3)                       ::   cl3           !  
    376371      CHARACTER(len=100)                     ::   cn_dir        ! Root directory for location of data files 
     
    415410      ! Read namelists 
    416411      ! -------------- 
    417       REWIND(numnam_cfg) 
     412      nbdy_rdstart = 1 
    418413      DO jbdy = 1, nb_bdy 
    419414 
     
    421416         WRITE(ctmp2, '(a,i2)') 'block nambdy_dta number ', jbdy 
    422417 
    423          ! There is only one nambdy_dta block in namelist_ref -> use it for each bdy so we do a rewind  
    424          REWIND(numnam_ref) 
     418         ! There is only one nambdy_dta block in namelist_ref -> use it for each bdy so we read from the beginning 
    425419         READ  ( numnam_ref, nambdy_dta, IOSTAT = ios, ERR = 901) 
    426420901      IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy_dta in reference namelist' ) 
     
    431425            & .OR. ( dta_bdy(jbdy)%lneed_tra   .AND.       nn_tra_dta(jbdy)    == 1 )   & 
    432426            & .OR. ( dta_bdy(jbdy)%lneed_ice   .AND.       nn_ice_dta(jbdy)    == 1 )   )   THEN 
    433             ! WARNING: we don't do a rewind here, each bdy reads its own nambdy_dta block one after another 
    434             READ  ( numnam_cfg, nambdy_dta, IOSTAT = ios, ERR = 902 ) 
     427            ! 
     428            ! Need to support possibility of reading more than one 
     429            ! nambdy_dta from the namelist_cfg internal file. 
     430            ! Do this by finding the jbdy'th occurence of nambdy_dta in the 
     431            ! character buffer as the starting point. 
     432            ! 
     433            nbdy_loc = INDEX( numnam_cfg( nbdy_rdstart: ), 'nambdy_dta' ) 
     434            IF( nbdy_loc .GT. 0 ) THEN 
     435               nbdy_rdstart = nbdy_rdstart + nbdy_loc 
     436            ELSE 
     437               WRITE(cerrmsg,'(A,I4,A)') 'Error: entry number ',jbdy,' of nambdy_dta not found' 
     438               ios = -1 
     439               CALL ctl_nam ( ios , cerrmsg ) 
     440            ENDIF 
     441            READ  ( numnam_cfg( MAX( 1, nbdy_rdstart - 2 ): ), nambdy_dta, IOSTAT = ios, ERR = 902) 
    435442902         IF( ios >  0 )   CALL ctl_nam ( ios , 'nambdy_dta in configuration namelist' ) 
    436443            IF(lwm) WRITE( numond, nambdy_dta )            
     
    442449            IF( nn_ice_dta(jbdy) == 1 ) THEN   ! if we get ice bdy data from netcdf file 
    443450               CALL fld_fill(  bf(jp_bdya_i,jbdy:jbdy), bn_a_i, cn_dir, 'bdy_dta', 'a_i'//' '//ctmp1, ctmp2 )   ! use namelist info 
    444                CALL fld_clopn( bf(jp_bdya_i,jbdy), nyear, nmonth, nday )   ! not a problem when we call it again after 
     451               CALL fld_def( bf(jp_bdya_i,jbdy) ) 
     452               CALL iom_open( bf(jp_bdya_i,jbdy)%clname, bf(jp_bdya_i,jbdy)%num ) 
    445453               idvar = iom_varid( bf(jp_bdya_i,jbdy)%num, bf(jp_bdya_i,jbdy)%clvar, kndims=indims, kdimsz=i4dimsz, lduld=lluld ) 
    446454               IF( indims == 4 .OR. ( indims == 3 .AND. .NOT. lluld ) ) THEN   ;   ipl = i4dimsz(3)   ! xylt or xyl 
    447455               ELSE                                                            ;   ipl = 1            ! xy or xyt 
    448456               ENDIF 
     457               CALL iom_close( bf(jp_bdya_i,jbdy)%num ) 
    449458               bf(jp_bdya_i,jbdy)%clrootname = 'NOT USED'   ! reset to default value as this subdomain may not need to read this bdy 
    450459            ENDIF 
Note: See TracChangeset for help on using the changeset viewer.