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 11613 for NEMO – NEMO

Changeset 11613 for NEMO


Ignore:
Timestamp:
2019-09-30T11:07:57+02:00 (4 years ago)
Author:
davestorkey
Message:

UKMO/NEMO_4.0_momentum_trends branch : first set of code changes.

Location:
NEMO/branches/UKMO/NEMO_4.0_momentum_trends
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/UKMO/NEMO_4.0_momentum_trends/cfgs/SHARED/field_def_nemo-oce.xml

    r10823 r11613  
    353353      <field_group id="grid_U"   grid_ref="grid_U_2D"> 
    354354        <field id="e3u"          long_name="U-cell thickness"                                       standard_name="cell_thickness"              unit="m"          grid_ref="grid_U_3D" /> 
     355        <field id="e3u_surf"     long_name="U-cell thickness"   field_ref="e3u"  standard_name="cell_thickness"     unit="m"   grid_ref="grid_U_surface_extract"/> 
    355356        <field id="e3u_0"        long_name="Initial U-cell thickness"                               standard_name="ref_cell_thickness"          unit="m"          grid_ref="grid_U_3D"/> 
    356357        <field id="utau"         long_name="Wind Stress along i-axis"                               standard_name="surface_downward_x_stress"   unit="N/m2"                            /> 
     
    407408      <field_group id="grid_V"   grid_ref="grid_V_2D"> 
    408409        <field id="e3v"          long_name="V-cell thickness"                                       standard_name="cell_thickness"              unit="m"          grid_ref="grid_V_3D" /> 
     410        <field id="e3v_surf"     long_name="V-cell thickness"   field_ref="e3v"  standard_name="cell_thickness"     unit="m"   grid_ref="grid_V_surface_extract"/> 
    409411        <field id="e3v_0"        long_name="Initial V-cell thickness"                               standard_name="ref_cell_thickness"          unit="m"          grid_ref="grid_V_3D" /> 
    410412        <field id="vtau"         long_name="Wind Stress along j-axis"                               standard_name="surface_downward_y_stress"   unit="N/m2"                            /> 
     
    809811     <!-- variables available with ln_dyn_trd --> 
    810812     <field id="utrd_hpg"       long_name="i-trend: hydrostatic pressure gradient"          unit="m/s^2"                        /> 
    811      <field id="utrd_spg"       long_name="i-trend: surface     pressure gradient"          unit="m/s^2"                        /> 
     813     <field id="utrd_hpg_corr"  long_name="i-trend: HPG: correction"       unit="m/s^2"    grid_ref="grid_U_2D" /> 
     814     <field id="utrd_spg2d"     long_name="i-trend: surface pressure gradient: true trend"       unit="m/s^2"    grid_ref="grid_U_2D" /> 
    812815     <field id="utrd_spgexp"    long_name="i-trend: surface pressure gradient (explicit)"   unit="m/s^2"                        /> 
    813      <field id="utrd_spgflt"    long_name="i-trend: surface pressure gradient (filtered)"   unit="m/s^2"                        /> 
    814816     <field id="utrd_keg"       long_name="i-trend: KE gradient         or hor. adv."       unit="m/s^2"                        /> 
    815817     <field id="utrd_rvo"       long_name="i-trend: relative  vorticity or metric term"     unit="m/s^2"                        /> 
    816      <field id="utrd_pvo"       long_name="i-trend: planetary vorticity"                    unit="m/s^2"                        /> 
     818     <field id="utrd_pvo"       long_name="i-trend: planetary vorticity: 3D component"      unit="m/s^2"                        /> 
     819     <field id="utrd_pvo2d"     long_name="i-trend: planetary vorticity: 2D component"      unit="m/s^2"    grid_ref="grid_U_2D" /> 
     820     <field id="utrd_pvo_corr"     long_name="i-trend: planetary vorticity: correction"      unit="m/s^2"    grid_ref="grid_U_2D" /> 
    817821     <field id="utrd_zad"       long_name="i-trend: vertical  advection"                    unit="m/s^2"                        /> 
    818822     <field id="utrd_udx"       long_name="i-trend: U.dx[U]"                                unit="m/s^2"                        /> 
     
    822826     <field id="utrd_bfr"       long_name="i-trend: bottom friction (explicit)"             unit="m/s^2"                        />    
    823827     <field id="utrd_bfri"      long_name="i-trend: bottom friction (implicit)"             unit="m/s^2"                        />    
     828     <field id="utrd_bfr2d"     long_name="i-trend: bottom friction: 2D component"      unit="m/s^2"    grid_ref="grid_U_2D" /> 
    824829     <field id="utrd_tot"       long_name="i-trend: total momentum trend before atf"        unit="m/s^2"                        />    
    825830     <field id="utrd_atf"       long_name="i-trend: asselin time filter trend"              unit="m/s^2"                        />    
     831     <!-- thickness weighted versions --> 
     832     <field id="utrd_hpg_e3u"       unit="m2/s^2" > utrd_hpg * e3u </field> 
     833     <field id="utrd_spg_e3u"       unit="m2/s^2" > utrd_spg * e3u </field> 
     834     <field id="utrd_spgexp_e3u"    unit="m2/s^2" > utrd_spgexp * e3u </field> 
     835     <field id="utrd_keg_e3u"       unit="m2/s^2" > utrd_keg * e3u </field> 
     836     <field id="utrd_rvo_e3u"       unit="m2/s^2" > utrd_rvo * e3u </field> 
     837     <field id="utrd_pvo_e3u"       unit="m2/s^2" > utrd_pvo * e3u </field> 
     838     <field id="utrd_zad_e3u"       unit="m2/s^2" > utrd_zad * e3u </field> 
     839     <field id="utrd_ldf_e3u"       unit="m2/s^2" > utrd_ldf * e3u </field> 
     840     <field id="utrd_zdf_e3u"       unit="m2/s^2" > utrd_zdf * e3u </field> 
     841     <field id="utrd_tot_e3u"       unit="m2/s^2" > utrd_tot * e3u </field> 
     842     <field id="utrd_atf_e3u"       unit="m2/s^2" > utrd_atf * e3u </field> 
     843     <field id="utrd_bta_e3u"       unit="m2/s^2" > utrd_bta * e3u </field>   
     844     <field id="utrd_bfr_e3u"       unit="m2/s^2" > utrd_bfr * e3u </field>   
     845     <field id="utrd_bfri_e3u"      unit="m2/s^2" > utrd_bfri * e3u </field>   
     846     <field id="utrd_tau_e3u"       unit="m2/s^2" > utrd_tau * e3u_surf </field>   
    826847   </field_group> 
    827848 
     
    829850     <!-- variables available with ln_dyn_trd --> 
    830851     <field id="vtrd_hpg"       long_name="j-trend: hydrostatic pressure gradient"          unit="m/s^2"                        /> 
     852     <field id="vtrd_hpg_corr"  long_name="j-trend: HPG: correction"       unit="m/s^2"    grid_ref="grid_V_2D" /> 
    831853     <field id="vtrd_spg"       long_name="j-trend: surface     pressure gradient"          unit="m/s^2"                        /> 
     854     <field id="vtrd_spgbt"     long_name="j-trend: surface pressure gradient: barotropic part"  unit="m/s^2"    grid_ref="grid_V_2D" /> 
     855     <field id="vtrd_spg2d"     long_name="j-trend: surface pressure gradient: true trend"       unit="m/s^2"    grid_ref="grid_V_2D" /> 
    832856     <field id="vtrd_spgexp"    long_name="j-trend: surface pressure gradient (explicit)"   unit="m/s^2"                        /> 
    833      <field id="vtrd_spgflt"    long_name="j-trend: surface pressure gradient (filtered)"   unit="m/s^2"                        /> 
    834857     <field id="vtrd_keg"       long_name="j-trend: KE gradient         or hor. adv."       unit="m/s^2"                        /> 
    835858     <field id="vtrd_rvo"       long_name="j-trend: relative  vorticity or metric term"     unit="m/s^2"                        /> 
    836      <field id="vtrd_pvo"       long_name="j-trend: planetary vorticity"                    unit="m/s^2"                        /> 
     859     <field id="vtrd_pvo"       long_name="j-trend: planetary vorticity: 3D component"      unit="m/s^2"                        /> 
     860     <field id="vtrd_pvo2d"     long_name="j-trend: planetary vorticity: 2D component"      unit="m/s^2"    grid_ref="grid_V_2D" /> 
     861     <field id="vtrd_pvo_corr"     long_name="j-trend: planetary vorticity: correction"      unit="m/s^2"    grid_ref="grid_V_2D" /> 
    837862     <field id="vtrd_zad"       long_name="j-trend: vertical  advection"                    unit="m/s^2"                        /> 
    838      <field id="vtrd_vdy"       long_name="i-trend: V.dx[V]"                                unit="m/s^2"                        /> 
     863     <field id="vtrd_vdy"       long_name="j-trend: V.dx[V]"                                unit="m/s^2"                        /> 
    839864     <field id="vtrd_ldf"       long_name="j-trend: lateral   diffusion"                    unit="m/s^2"                        /> 
    840865     <field id="vtrd_zdf"       long_name="j-trend: vertical  diffusion"                    unit="m/s^2"                        /> 
     
    842867     <field id="vtrd_bfr"       long_name="j-trend: bottom friction (explicit)"             unit="m/s^2"                        />    
    843868     <field id="vtrd_bfri"      long_name="j-trend: bottom friction (implicit)"             unit="m/s^2"                        />    
     869     <field id="vtrd_bfr2d"     long_name="j-trend: bottom friction: 2D component"      unit="m/s^2"    grid_ref="grid_V_2D" /> 
    844870     <field id="vtrd_tot"       long_name="j-trend: total momentum trend before atf"        unit="m/s^2"                        />    
    845871     <field id="vtrd_atf"       long_name="j-trend: asselin time filter trend"              unit="m/s^2"                        />    
     872     <!-- thickness weighted versions --> 
     873     <field id="vtrd_hpg_e3v"       unit="m2/s^2" > vtrd_hpg * e3v </field> 
     874     <field id="vtrd_spg_e3v"       unit="m2/s^2" > vtrd_spg * e3v </field> 
     875     <field id="vtrd_spgexp_e3v"    unit="m2/s^2" > vtrd_spgexp * e3v </field> 
     876     <field id="vtrd_keg_e3v"       unit="m2/s^2" > vtrd_keg * e3v </field> 
     877     <field id="vtrd_rvo_e3v"       unit="m2/s^2" > vtrd_rvo * e3v </field> 
     878     <field id="vtrd_pvo_e3v"       unit="m2/s^2" > vtrd_pvo * e3v </field> 
     879     <field id="vtrd_zad_e3v"       unit="m2/s^2" > vtrd_zad * e3v </field> 
     880     <field id="vtrd_ldf_e3v"       unit="m2/s^2" > vtrd_ldf * e3v </field> 
     881     <field id="vtrd_zdf_e3v"       unit="m2/s^2" > vtrd_zdf * e3v </field> 
     882     <field id="vtrd_tot_e3v"       unit="m2/s^2" > vtrd_tot * e3v </field> 
     883     <field id="vtrd_atf_e3v"       unit="m2/s^2" > vtrd_atf * e3v </field> 
     884     <field id="vtrd_bta_e3v"       unit="m2/s^2" > vtrd_bta * e3v </field>   
     885     <field id="vtrd_bfr_e3v"       unit="m2/s^2" > vtrd_bfr * e3v </field>   
     886     <field id="vtrd_bfri_e3v"      unit="m2/s^2" > vtrd_bfri * e3v </field>   
     887     <field id="vtrd_tau_e3v"       unit="m2/s^2" > vtrd_tau * e3v_surf </field>   
    846888   </field_group> 
    847889 
  • NEMO/branches/UKMO/NEMO_4.0_momentum_trends/src/OCE/DYN/dynhpg.F90

    r10888 r11613  
    115115         ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    116116         ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    117          CALL trd_dyn( ztrdu, ztrdv, jpdyn_hpg, kt ) 
     117         CALL trd_dyn( ztrdu, ztrdv, jpdyn_hpg_save, kt ) 
    118118         DEALLOCATE( ztrdu , ztrdv ) 
    119119      ENDIF 
  • NEMO/branches/UKMO/NEMO_4.0_momentum_trends/src/OCE/DYN/dynspg.F90

    r10888 r11613  
    8181      IF( ln_timing )   CALL timing_start('dyn_spg') 
    8282      ! 
    83       IF( l_trddyn )   THEN                      ! temporary save of ta and sa trends 
     83      IF( l_trddyn .AND. nspg == np_EXP )   THEN                      ! temporary save of ta and sa trends 
    8484         ALLOCATE( ztrdu(jpi,jpj,jpk) , ztrdv(jpi,jpj,jpk) )  
    8585         ztrdu(:,:,:) = ua(:,:,:) 
     
    165165      END SELECT 
    166166      !                     
    167       IF( l_trddyn )   THEN                  ! save the surface pressure gradient trends for further diagnostics 
     167      IF( l_trddyn .AND. nspg == np_EXP )   THEN     ! save the surface pressure gradient trends for further diagnostics 
    168168         ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    169169         ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    170170         CALL trd_dyn( ztrdu, ztrdv, jpdyn_spg, kt ) 
     171         ! In this case we also need to finalise the write-out of the PVO 3D diagnostic with zero correction 
     172         ztrdu(:,:,1) = 0._wp 
     173         ztrdv(:,:,1) = 0._wp 
     174         CALL trd_dyn( ztrdu(:,:,1), ztrdv(:,:,1), jpdyn_pvo, kt ) 
    171175         DEALLOCATE( ztrdu , ztrdv )  
    172176      ENDIF 
  • NEMO/branches/UKMO/NEMO_4.0_momentum_trends/src/OCE/DYN/dynspg_ts.F90

    r10888 r11613  
    6363   USE restart         ! only for lrst_oce 
    6464   USE diatmb          ! Top,middle,bottom output 
     65   USE trd_oce        ! trends: ocean variables 
     66   USE trddyn         ! trend manager: dynamics 
    6567 
    6668   IMPLICIT NONE 
     
    172174      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: ztwdmask, zuwdmask, zvwdmask ! ROMS wetting and drying masks at t,u,v points 
    173175      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zuwdav2, zvwdav2    ! averages over the sub-steps of zuwdmask and zvwdmask 
     176      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zspgtrdu, zspgtrdv, zpvotrdu, zpvotrdv  ! SPG and PVO trends (if l_trddyn) 
     177      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zbfrtrdu, zbfrtrdv                      ! BFR trends (if l_trddyn) 
    174178      !!---------------------------------------------------------------------- 
    175179      ! 
     
    177181      !                                         !* Allocate temporary arrays 
    178182      IF( ln_wd_dl ) ALLOCATE( ztwdmask(jpi,jpj), zuwdmask(jpi,jpj), zvwdmask(jpi,jpj), zuwdav2(jpi,jpj), zvwdav2(jpi,jpj)) 
     183      ! 
     184      IF( l_trddyn ) THEN 
     185          ALLOCATE( zspgtrdu(jpi,jpj), zspgtrdv(jpi,jpj), zpvotrdu(jpi,jpj), zpvotrdv(jpi,jpj), zbfrtrdu(jpi,jpj), zbfrtrdv(jpi,jpj) ) 
     186          zspgtrdu(:,:) = 0._wp 
     187          zspgtrdv(:,:) = 0._wp 
     188          zpvotrdu(:,:) = 0._wp 
     189          zpvotrdv(:,:) = 0._wp 
     190          zbfrtrdu(:,:) = 0._wp 
     191          zbfrtrdv(:,:) = 0._wp 
     192      ENDIF 
    179193      ! 
    180194      zmdi=1.e+20                               !  missing data indicator for masking 
     
    381395!!gm  Is it correct to do so ?   I think so... 
    382396       
    383        
     397 
    384398      !                                   !* barotropic Coriolis trends (vorticity scheme dependent) 
    385399      !                                   ! -------------------------------------------------------- 
     
    387401      zwx(:,:) = un_b(:,:) * hu_n(:,:) * e2u(:,:)        ! now fluxes  
    388402      zwy(:,:) = vn_b(:,:) * hv_n(:,:) * e1v(:,:) 
     403      ! 
     404      zu_trd(:,:) = 0._wp 
     405      zv_trd(:,:) = 0._wp 
    389406      ! 
    390407      SELECT CASE( nvor_scheme ) 
     
    393410            DO ji = 2, jpim1   ! vector opt. 
    394411               zu_trd(ji,jj) = + r1_4 * r1_e1e2u(ji,jj) * r1_hu_n(ji,jj)                    & 
    395                   &               * (  e1e2t(ji+1,jj)*ht_n(ji+1,jj)*ff_t(ji+1,jj) * ( vn_b(ji+1,jj) + vn_b(ji+1,jj-1) )   & 
    396                   &                  + e1e2t(ji  ,jj)*ht_n(ji  ,jj)*ff_t(ji  ,jj) * ( vn_b(ji  ,jj) + vn_b(ji  ,jj-1) )   ) 
    397                   ! 
     412                    &               * (  e1e2t(ji+1,jj)*ht_n(ji+1,jj)*ff_t(ji+1,jj) * ( vn_b(ji+1,jj) + vn_b(ji+1,jj-1) )   & 
     413                    &                  + e1e2t(ji  ,jj)*ht_n(ji  ,jj)*ff_t(ji  ,jj) * ( vn_b(ji  ,jj) + vn_b(ji  ,jj-1) )   ) 
     414               ! 
    398415               zv_trd(ji,jj) = - r1_4 * r1_e1e2v(ji,jj) * r1_hv_n(ji,jj)                    & 
    399                   &               * (  e1e2t(ji,jj+1)*ht_n(ji,jj+1)*ff_t(ji,jj+1) * ( un_b(ji,jj+1) + un_b(ji-1,jj+1) )   &  
    400                   &                  + e1e2t(ji,jj  )*ht_n(ji,jj  )*ff_t(ji,jj  ) * ( un_b(ji,jj  ) + un_b(ji-1,jj  ) )   )  
    401             END DO   
    402          END DO   
     416                    &               * (  e1e2t(ji,jj+1)*ht_n(ji,jj+1)*ff_t(ji,jj+1) * ( un_b(ji,jj+1) + un_b(ji-1,jj+1) )   &  
     417                    &                  + e1e2t(ji,jj  )*ht_n(ji,jj  )*ff_t(ji,jj  ) * ( un_b(ji,jj  ) + un_b(ji-1,jj  ) )   )  
     418            END DO 
     419         END DO 
    403420         !          
    404421      CASE( np_ENE , np_MIX )        ! energy conserving scheme (t-point) ENE or MIX 
     
    443460      END SELECT 
    444461      ! 
     462      IF( l_trddyn ) THEN 
     463         ! send correction to baroclinic planetary vorticity trend to trd_dyn 
     464         CALL trd_dyn( zu_trd, zv_trd, jpdyn_pvo_corr, kt ) 
     465      ENDIF 
    445466      !                                   !* Right-Hand-Side of the barotropic momentum equation 
    446467      !                                   ! ---------------------------------------------------- 
    447468      IF( .NOT.ln_linssh ) THEN                 ! Variable volume : remove surface pressure gradient 
     469         IF( l_trddyn ) THEN 
     470            zspgtrdu(:,:) = zu_trd(:,:) 
     471            zspgtrdv(:,:) = zv_trd(:,:) 
     472         ENDIF 
    448473         IF( ln_wd_il ) THEN                        ! Calculating and applying W/D gravity filters 
    449474            DO jj = 2, jpjm1 
     
    505530               END DO 
    506531            END DO 
     532         ENDIF 
     533         ! 
     534         IF( l_trddyn ) THEN 
     535            zspgtrdu(:,:) = zu_trd(:,:) - zspgtrdu(:,:)  
     536            zspgtrdv(:,:) = zv_trd(:,:) - zspgtrdv(:,:)  
     537            ! send correction to HPG trend to trd_dyn 
     538            CALL trd_dyn( zspgtrdu, zspgtrdv, jpdyn_hpg_corr, kt ) 
     539            ! reset temporary arrays for use later 
     540            zspgtrdu(:,:) = 0._wp 
     541            zspgtrdv(:,:) = 0._wp 
    507542         ENDIF 
    508543         ! 
     
    10561091         END SELECT 
    10571092         ! 
     1093         IF( l_trddyn ) THEN 
     1094            za2 = wgtbtp2(jn) 
     1095            zpvotrdu(:,:) = zpvotrdu(:,:) + za2 * zu_trd(:,:) * ssumask(:,:) 
     1096            zpvotrdv(:,:) = zpvotrdv(:,:) + za2 * zv_trd(:,:) * ssvmask(:,:) 
     1097         ENDIF 
     1098         ! 
    10581099         ! Add tidal astronomical forcing if defined 
    10591100         IF ( ln_tide .AND. ln_tide_pot ) THEN 
     
    10771118               END DO 
    10781119            END DO 
     1120            ! 
     1121            IF( l_trddyn ) THEN 
     1122               za2 = wgtbtp2(jn) 
     1123               zbfrtrdu(:,:) = zbfrtrdu(:,:) + za2 * zCdU_u(:,:) * un_e(:,:) * hur_e(:,:) 
     1124               zbfrtrdv(:,:) = zbfrtrdv(:,:) + za2 * zCdU_v(:,:) * vn_e(:,:) * hvr_e(:,:) 
     1125            ENDIF 
    10791126         ENDIF  
    10801127         ! 
     
    11011148           END DO 
    11021149         END IF 
    1103  
     1150         ! 
     1151         IF( l_trddyn ) THEN 
     1152            za2 = wgtbtp2(jn) 
     1153            zspgtrdu(:,:) = zspgtrdu(:,:) + za2 * zwx(:,:) * ssumask(:,:) 
     1154            zspgtrdv(:,:) = zspgtrdv(:,:) + za2 * zwy(:,:) * ssvmask(:,:) 
     1155         ENDIF 
    11041156         ! 
    11051157         ! Set next velocities: 
     
    13021354      IF( ln_wd_il )   DEALLOCATE( zcpx, zcpy ) 
    13031355      IF( ln_wd_dl )   DEALLOCATE( ztwdmask, zuwdmask, zvwdmask, zuwdav2, zvwdav2 ) 
     1356      IF( l_trddyn ) THEN 
     1357         CALL trd_dyn( zspgtrdu, zspgtrdv, jpdyn_spg, kt ) 
     1358         CALL trd_dyn( zpvotrdu, zpvotrdv, jpdyn_pvo, kt ) 
     1359         CALL trd_dyn( zbfrtrdu, zbfrtrdv, jpdyn_bfr, kt ) 
     1360         DEALLOCATE( zspgtrdu, zspgtrdv, zpvotrdu, zpvotrdv, zbfrtrdu, zbfrtrdv ) 
     1361      ENDIF 
    13041362      ! 
    13051363      IF( ln_diatmb ) THEN 
  • NEMO/branches/UKMO/NEMO_4.0_momentum_trends/src/OCE/DYN/dynvor.F90

    r10888 r11613  
    133133         ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    134134         ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    135          CALL trd_dyn( ztrdu, ztrdv, jpdyn_pvo, kt ) 
     135         CALL trd_dyn( ztrdu, ztrdv, jpdyn_pvo_save, kt ) 
    136136         ! 
    137137         IF( n_dynadv /= np_LIN_dyn ) THEN   !* relative vorticity or metric trend (only in non-linear case) 
  • NEMO/branches/UKMO/NEMO_4.0_momentum_trends/src/OCE/DYN/dynzdf.F90

    r10888 r11613  
    2525   ! 
    2626   USE in_out_manager ! I/O manager 
     27   USE iom             ! IOM library 
    2728   USE lib_mpp        ! MPP library 
    2829   USE prtctl         ! Print control 
     
    6970      INTEGER  ::   ji, jj, jk         ! dummy loop indices 
    7071      INTEGER  ::   iku, ikv           ! local integers 
     72      INTEGER  ::   ikbu, ikbv         ! local integers 
    7173      REAL(wp) ::   zzwi, ze3ua, zdt   ! local scalars 
    7274      REAL(wp) ::   zzws, ze3va        !   -      - 
     
    99101      ! 
    100102      ! 
    101       IF( l_trddyn )   THEN         !* temporary save of ta and sa trends 
    102          ALLOCATE( ztrdu(jpi,jpj,jpk), ztrdv(jpi,jpj,jpk) )  
    103          ztrdu(:,:,:) = ua(:,:,:) 
    104          ztrdv(:,:,:) = va(:,:,:) 
    105       ENDIF 
    106       ! 
    107103      !              !==  RHS: Leap-Frog time stepping on all trends but the vertical mixing  ==!   (put in ua,va) 
    108104      ! 
     
    131127            va(:,:,jk) = ( va(:,:,jk) - va_b(:,:) ) * vmask(:,:,jk) 
    132128         END DO 
     129         IF( l_trddyn )   THEN         !* temporary save of ta and sa trends 
     130            ALLOCATE( ztrdu(jpi,jpj,jpk), ztrdv(jpi,jpj,jpk) )  
     131            ztrdu(:,:,:) = ua(:,:,:) 
     132            ztrdv(:,:,:) = va(:,:,:) 
     133         ENDIF 
    133134         DO jj = 2, jpjm1        ! Add bottom/top stress due to barotropic component only 
    134135            DO ji = fs_2, fs_jpim1   ! vector opt. 
     
    141142            END DO 
    142143         END DO 
     144         IF( l_trddyn )   THEN                      ! save explicit part of bottom friction trends 
     145            ztrdu(:,:,:) = ( ua(:,:,:) - ztrdu(:,:,:) ) / r2dt  
     146            ztrdv(:,:,:) = ( va(:,:,:) - ztrdv(:,:,:) ) / r2dt  
     147            CALL trd_dyn( ztrdu, ztrdv, jpdyn_bfr, kt ) 
     148         ENDIF 
    143149         IF( ln_isfcav ) THEN    ! Ocean cavities (ISF) 
    144150            DO jj = 2, jpjm1         
     
    153159            END DO 
    154160         END IF 
     161      ENDIF 
     162      ! 
     163      IF( l_trddyn )   THEN         !* temporary save of ta and sa trends 
     164         IF( .NOT. ALLOCATED(ztrdu) ) ALLOCATE( ztrdu(jpi,jpj,jpk), ztrdv(jpi,jpj,jpk) )  
     165         ztrdu(:,:,:) = ua(:,:,:) 
     166         ztrdv(:,:,:) = va(:,:,:) 
    155167      ENDIF 
    156168      ! 
     
    486498      ! 
    487499      IF( l_trddyn )   THEN                      ! save the vertical diffusive trends for further diagnostics 
    488          ztrdu(:,:,:) = ( ua(:,:,:) - ub(:,:,:) ) / r2dt - ztrdu(:,:,:) 
    489          ztrdv(:,:,:) = ( va(:,:,:) - vb(:,:,:) ) / r2dt - ztrdv(:,:,:) 
     500 
     501         ztrdu(:,:,:) = ( ua(:,:,:) - ztrdu(:,:,:) ) / r2dt  
     502         ztrdv(:,:,:) = ( va(:,:,:) - ztrdv(:,:,:) ) / r2dt  
    490503         CALL trd_dyn( ztrdu, ztrdv, jpdyn_zdf, kt ) 
     504         ! 
     505         IF( ln_drgimp ) THEN 
     506            ztrdu(:,:,:) = 0._wp    ;   ztrdv(:,:,:) = 0._wp 
     507            DO jk = 1, jpkm1 
     508               DO jj = 2, jpjm1 
     509                  DO ji = 2, jpim1 
     510                     ikbu = mbku(ji,jj)          ! deepest ocean u- & v-levels 
     511                     ikbv = mbkv(ji,jj) 
     512                     ztrdu(ji,jj,jk) = 0.5 * ( rCdU_bot(ji+1,jj) + rCdU_bot(ji,jj) )  &  
     513     &                               * un(ji,jj,ikbu) / e3u_n(ji,jj,ikbu) 
     514                     ztrdv(ji,jj,jk) = 0.5 * ( rCdU_bot(ji,jj+1) + rCdU_bot(ji,jj) )  & 
     515     &                               * vn(ji,jj,ikbv) / e3v_n(ji,jj,ikbv) 
     516                  END DO 
     517               END DO 
     518            END DO 
     519            CALL trd_dyn( ztrdu, ztrdv, jpdyn_bfri, kt ) 
     520         ENDIF 
     521         ! 
    491522         DEALLOCATE( ztrdu, ztrdv )  
    492523      ENDIF 
  • NEMO/branches/UKMO/NEMO_4.0_momentum_trends/src/OCE/TRD/trd_oce.F90

    r10888 r11613  
    5959   ! 
    6060   !                                                  !!!* Momentum trends indices 
    61    INTEGER, PUBLIC, PARAMETER ::   jptot_dyn  = 13     !: Total trend nb: change it when adding/removing one indice below 
     61   INTEGER, PUBLIC, PARAMETER ::   jptot_dyn  = 17     !: Total trend nb: change it when adding/removing one indice below 
    6262   !                               ===============     !   
    63    INTEGER, PUBLIC, PARAMETER ::   jpdyn_hpg  =  1     !: hydrostatic pressure gradient  
    64    INTEGER, PUBLIC, PARAMETER ::   jpdyn_spg  =  2     !: surface     pressure gradient 
    65    INTEGER, PUBLIC, PARAMETER ::   jpdyn_keg  =  3     !: kinetic energy gradient  or horizontal advection 
    66    INTEGER, PUBLIC, PARAMETER ::   jpdyn_rvo  =  4     !: relative  vorticity      or metric term 
    67    INTEGER, PUBLIC, PARAMETER ::   jpdyn_pvo  =  5     !: planetary vorticity 
    68    INTEGER, PUBLIC, PARAMETER ::   jpdyn_zad  =  6     !: vertical advection 
    69    INTEGER, PUBLIC, PARAMETER ::   jpdyn_ldf  =  7     !: horizontal diffusion    
    70    INTEGER, PUBLIC, PARAMETER ::   jpdyn_zdf  =  8     !: vertical   diffusion 
    71    INTEGER, PUBLIC, PARAMETER ::   jpdyn_bfr  =  9     !: bottom  stress  
    72    INTEGER, PUBLIC, PARAMETER ::   jpdyn_atf  = 10     !: Asselin time filter 
    73    INTEGER, PUBLIC, PARAMETER ::   jpdyn_tau  = 11     !: surface stress 
    74    INTEGER, PUBLIC, PARAMETER ::   jpdyn_bfri = 12     !: implicit bottom friction (ln_drgimp=.TRUE.) 
    75    INTEGER, PUBLIC, PARAMETER ::   jpdyn_ken  = 13     !: use for calculation of KE 
     63   INTEGER, PUBLIC, PARAMETER ::   jpdyn_hpg   =  1     !: hydrostatic pressure gradient  
     64   INTEGER, PUBLIC, PARAMETER ::   jpdyn_hpg_save =  2  !: hydrostatic pressure gradient (saved value) 
     65   INTEGER, PUBLIC, PARAMETER ::   jpdyn_hpg_corr =  3  !: hydrostatic pressure gradient (initial correction) 
     66   INTEGER, PUBLIC, PARAMETER ::   jpdyn_spg   =  4     !: surface     pressure gradient 
     67   INTEGER, PUBLIC, PARAMETER ::   jpdyn_keg   =  5     !: kinetic energy gradient  or horizontal advection 
     68   INTEGER, PUBLIC, PARAMETER ::   jpdyn_rvo   =  6     !: relative  vorticity      or metric term 
     69   INTEGER, PUBLIC, PARAMETER ::   jpdyn_pvo   =  7     !: planetary vorticity 
     70   INTEGER, PUBLIC, PARAMETER ::   jpdyn_pvo_save =  8  !: planetary vorticity (saved value) 
     71   INTEGER, PUBLIC, PARAMETER ::   jpdyn_pvo_corr =  9  !: planetary vorticity (initial correction) 
     72   INTEGER, PUBLIC, PARAMETER ::   jpdyn_zad   = 10     !: vertical advection 
     73   INTEGER, PUBLIC, PARAMETER ::   jpdyn_ldf   = 11     !: horizontal diffusion    
     74   INTEGER, PUBLIC, PARAMETER ::   jpdyn_zdf   = 12     !: vertical   diffusion 
     75   INTEGER, PUBLIC, PARAMETER ::   jpdyn_bfr   = 13     !: bottom  stress  
     76   INTEGER, PUBLIC, PARAMETER ::   jpdyn_atf   = 14     !: Asselin time filter 
     77   INTEGER, PUBLIC, PARAMETER ::   jpdyn_tau   = 15     !: surface stress 
     78   INTEGER, PUBLIC, PARAMETER ::   jpdyn_bfri  = 16     !: implicit bottom friction (ln_drgimp=.TRUE.) 
     79   INTEGER, PUBLIC, PARAMETER ::   jpdyn_ken   = 17     !: use for calculation of KE 
    7680   ! 
    7781   !!---------------------------------------------------------------------- 
  • NEMO/branches/UKMO/NEMO_4.0_momentum_trends/src/OCE/TRD/trddyn.F90

    r10888 r11613  
    1818   USE sbc_oce        ! surface boundary condition: ocean 
    1919   USE zdf_oce        ! ocean vertical physics: variables 
    20 !!gm   USE zdfdrg         ! ocean vertical physics: bottom friction 
    2120   USE trd_oce        ! trends: ocean variables 
    2221   USE trdken         ! trends: Kinetic ENergy  
     
    3534   PUBLIC trd_dyn        ! called by all dynXXX modules 
    3635 
     36   INTERFACE trd_dyn 
     37      module procedure trd_dyn_3d, trd_dyn_2d 
     38   END INTERFACE 
     39 
     40   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), SAVE :: zutrd_hpg, zvtrd_hpg 
     41   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), SAVE :: zutrd_pvo, zvtrd_pvo 
     42 
    3743   !! * Substitutions 
    3844#  include "vectopt_loop_substitute.h90" 
     
    4450CONTAINS 
    4551 
    46    SUBROUTINE trd_dyn( putrd, pvtrd, ktrd, kt ) 
     52   SUBROUTINE trd_dyn_3d( putrd, pvtrd, ktrd, kt ) 
    4753      !!--------------------------------------------------------------------- 
    48       !!                  ***  ROUTINE trd_mod  *** 
     54      !!                  ***  ROUTINE trd_dyn_3d  *** 
    4955      !!  
    5056      !! ** Purpose :   Dispatch momentum trend computation, e.g. 3D output,  
     
    6369!!gm NB : here a lbc_lnk should probably be added 
    6470 
    65       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    66       !   3D output of momentum and/or tracers trends using IOM interface 
    67       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    68       IF( ln_dyn_trd )   CALL trd_dyn_iom( putrd, pvtrd, ktrd, kt ) 
     71      SELECT CASE( ktrd ) 
     72      CASE( jpdyn_hpg_save )  
     73         ! 
     74         ! save 3D HPG trends to possibly have barotropic part corrected later before writing out 
     75         ALLOCATE( zutrd_hpg(jpi,jpj,jpk), zvtrd_hpg(jpi,jpj,jpk) ) 
     76         zutrd_hpg(:,:,:) = putrd(:,:,:) 
     77         zvtrd_hpg(:,:,:) = pvtrd(:,:,:) 
     78 
     79      CASE( jpdyn_pvo_save )  
     80         ! 
     81         ! save 3D coriolis trends to possibly have barotropic part corrected later before writing out 
     82         ALLOCATE( zutrd_pvo(jpi,jpj,jpk), zvtrd_pvo(jpi,jpj,jpk) ) 
     83         zutrd_pvo(:,:,:) = putrd(:,:,:) 
     84         zvtrd_pvo(:,:,:) = pvtrd(:,:,:) 
     85 
     86      CASE DEFAULT 
     87 
     88         IF( ktrd == jpdyn_spg ) THEN 
     89            ! For explicit scheme SPG trends come here as 3D fields 
     90            ! Add SPG trend to 3D HPG trend and also output as 2D diagnostic in own right. 
     91            CALL trd_dyn_iom_2d( putrd(:,:,1), pvtrd(:,:,1), jpdyn_spg, kt )  
     92            putrd(:,:,:) = putrd(:,:,:) + zutrd_hpg(:,:,:)  
     93            pvtrd(:,:,:) = pvtrd(:,:,:) + zvtrd_hpg(:,:,:)  
     94            DEALLOCATE( zutrd_hpg, zvtrd_hpg ) 
     95         ENDIF 
     96 
     97         !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     98         !   3D output of momentum and/or tracers trends using IOM interface 
     99         !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     100         IF( ln_dyn_trd )   CALL trd_dyn_iom_3d( putrd, pvtrd, ktrd, kt ) 
     101 
     102         !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     103         !  Integral Constraints Properties for momentum and/or tracers trends 
     104         !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     105         IF( ln_glo_trd )   CALL trd_glo( putrd, pvtrd, ktrd, 'DYN', kt ) 
     106 
     107         !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     108         !  Kinetic Energy trends 
     109         !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     110         IF( ln_KE_trd  )   CALL trd_ken( putrd, pvtrd, ktrd, kt ) 
     111 
     112         !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     113         !  Vorticity trends 
     114         !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     115         IF( ln_vor_trd )   CALL trd_vor( putrd, pvtrd, ktrd, kt ) 
     116 
     117         !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     118         !  Mixed layer trends for active tracers 
     119         !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     120         !!gm      IF( ln_dyn_mxl )   CALL trd_mxl_dyn    
     121         ! 
     122      END SELECT 
     123      ! 
     124   END SUBROUTINE trd_dyn_3d 
     125 
     126 
     127   SUBROUTINE trd_dyn_2d( putrd, pvtrd, ktrd, kt ) 
     128      !!--------------------------------------------------------------------- 
     129      !!                  ***  ROUTINE trd_mod  *** 
     130      !!  
     131      !! ** Purpose :   Dispatch momentum trend computation, e.g. 2D output,  
     132      !!              integral constraints, barotropic vorticity, kinetic enrgy,  
     133      !!              and/or mixed layer budget. 
     134      !!---------------------------------------------------------------------- 
     135      REAL(wp), DIMENSION(:,:), INTENT(inout) ::   putrd, pvtrd   ! U and V trends  
     136      INTEGER                 , INTENT(in   ) ::   ktrd           ! trend index 
     137      INTEGER                 , INTENT(in   ) ::   kt             ! time step 
     138      INTEGER                                 ::   jk 
     139      !!---------------------------------------------------------------------- 
     140      ! 
     141      putrd(:,:) = putrd(:,:) * umask(:,:,1)                       ! mask the trends 
     142      pvtrd(:,:) = pvtrd(:,:) * vmask(:,:,1) 
     143      ! 
     144 
     145!!gm NB : here a lbc_lnk should probably be added 
     146 
     147      SELECT CASE(ktrd) 
     148 
     149      CASE ( jpdyn_hpg_corr ) 
     150         ! 
     151         ! Remove "first-guess" SPG trend from 3D HPG trend.  
     152         DO jk = 1, jpkm1 
     153            zutrd_hpg(:,:,jk) = zutrd_hpg(:,:,jk) - putrd(:,:) 
     154            zvtrd_hpg(:,:,jk) = zvtrd_hpg(:,:,jk) - pvtrd(:,:) 
     155         ENDDO 
     156         CALL trd_dyn_iom_2d( putrd, pvtrd, jpdyn_hpg_corr, kt )  
     157 
     158      CASE( jpdyn_pvo_corr ) 
     159         ! 
     160         ! Remove "first-guess" barotropic coriolis trend from 3D PVO trend.  
     161         DO jk = 1, jpkm1 
     162            zutrd_pvo(:,:,jk) = zutrd_pvo(:,:,jk) - putrd(:,:) 
     163            zvtrd_pvo(:,:,jk) = zvtrd_pvo(:,:,jk) - pvtrd(:,:) 
     164         ENDDO 
     165         CALL trd_dyn_iom_2d( putrd, pvtrd, jpdyn_pvo_corr, kt )  
     166 
     167      CASE( jpdyn_spg ) 
     168          ! 
     169          ! For split-explicit scheme SPG trends come here as 2D fields 
     170          ! Add SPG trend to 3D HPG trend and also output as 2D diagnostic in own right. 
     171          DO jk = 1, jpkm1 
     172             zutrd_hpg(:,:,jk) = zutrd_hpg(:,:,jk) + putrd(:,:) 
     173             zvtrd_hpg(:,:,jk) = zvtrd_hpg(:,:,jk) + pvtrd(:,:) 
     174          ENDDO 
     175          CALL trd_dyn_iom_2d( putrd(:,:), pvtrd(:,:), jpdyn_spg, kt )  
     176          CALL trd_dyn_3d( zutrd_hpg, zvtrd_hpg, jpdyn_hpg, kt ) 
     177          DEALLOCATE( zutrd_hpg, zvtrd_hpg ) 
     178 
     179      CASE( jpdyn_pvo ) 
     180          ! 
     181          ! Add 2D PVO trend to 3D PVO trend and also output as diagnostic in own right. 
     182          DO jk = 1, jpkm1 
     183             zutrd_pvo(:,:,jk) = zutrd_pvo(:,:,jk) + putrd(:,:) 
     184             zvtrd_pvo(:,:,jk) = zvtrd_pvo(:,:,jk) + pvtrd(:,:) 
     185          ENDDO 
     186          CALL trd_dyn_iom_2d( putrd, pvtrd, jpdyn_pvo, kt )  
     187          CALL trd_dyn_3d( zutrd_pvo, zvtrd_pvo, jpdyn_pvo, kt ) 
     188          DEALLOCATE( zutrd_pvo, zvtrd_pvo ) 
     189 
     190      CASE DEFAULT  
     191 
     192         !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     193         !   2D output of momentum and/or tracers trends using IOM interface 
     194         !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     195         IF( ln_dyn_trd )   CALL trd_dyn_iom_2d( putrd, pvtrd, ktrd, kt ) 
    69196          
    70       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    71       !  Integral Constraints Properties for momentum and/or tracers trends 
    72       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    73       IF( ln_glo_trd )   CALL trd_glo( putrd, pvtrd, ktrd, 'DYN', kt ) 
    74  
    75       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    76       !  Kinetic Energy trends 
    77       !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    78       IF( ln_KE_trd  )   CALL trd_ken( putrd, pvtrd, ktrd, kt ) 
    79  
    80       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    81       !  Vorticity trends 
    82       !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    83       IF( ln_vor_trd )   CALL trd_vor( putrd, pvtrd, ktrd, kt ) 
     197      END SELECT 
     198 
     199!!$   CALLS TO THESE ROUTINES FOR 2D DIAGOSTICS NOT CODED YET 
     200!!$      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     201!!$      !  Integral Constraints Properties for momentum and/or tracers trends 
     202!!$      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     203!!$      IF( ln_glo_trd )   CALL trd_glo( putrd, pvtrd, ktrd, 'DYN', kt ) 
     204!!$ 
     205!!$      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     206!!$      !  Kinetic Energy trends 
     207!!$      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     208!!$      IF( ln_KE_trd  )   CALL trd_ken( putrd, pvtrd, ktrd, kt ) 
     209!!$ 
     210!!$      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     211!!$      !  Vorticity trends 
     212!!$      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     213!!$      IF( ln_vor_trd )   CALL trd_vor( putrd, pvtrd, ktrd, kt ) 
    84214 
    85215      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    88218!!gm      IF( ln_dyn_mxl )   CALL trd_mxl_dyn    
    89219      ! 
    90    END SUBROUTINE trd_dyn 
    91  
    92  
    93    SUBROUTINE trd_dyn_iom( putrd, pvtrd, ktrd, kt ) 
     220   END SUBROUTINE trd_dyn_2d 
     221 
     222 
     223   SUBROUTINE trd_dyn_iom_3d( putrd, pvtrd, ktrd, kt ) 
    94224      !!--------------------------------------------------------------------- 
    95225      !!                  ***  ROUTINE trd_dyn_iom  *** 
     
    110240      CASE( jpdyn_hpg )   ;   CALL iom_put( "utrd_hpg", putrd )    ! hydrostatic pressure gradient 
    111241                              CALL iom_put( "vtrd_hpg", pvtrd ) 
    112       CASE( jpdyn_spg )   ;   CALL iom_put( "utrd_spg", putrd )    ! surface pressure gradient 
    113                               CALL iom_put( "vtrd_spg", pvtrd ) 
    114242      CASE( jpdyn_pvo )   ;   CALL iom_put( "utrd_pvo", putrd )    ! planetary vorticity 
    115243                              CALL iom_put( "vtrd_pvo", pvtrd ) 
     
    147275                              CALL iom_put( "vtrd_tau", z2dy ) 
    148276                              DEALLOCATE( z2dx , z2dy ) 
    149 !!gm  to be changed : computation should be done in dynzdf.F90 
    150 !!gm                + missing the top friction  
    151 !                              !                                    ! bottom stress tends (implicit case) 
    152 !                              IF( ln_drgimp ) THEN 
    153 !                                 ALLOCATE( z3dx(jpi,jpj,jpk) , z3dy(jpi,jpj,jpk) ) 
    154 !                             z3dx(:,:,:) = 0._wp   ;   z3dy(:,:,:) = 0._wp  ! after velocity known (now filed at this stage) 
    155 !                            DO jk = 1, jpkm1 
    156 !                                    DO jj = 2, jpjm1 
    157 !                                       DO ji = 2, jpim1 
    158 !                                      ikbu = mbku(ji,jj)          ! deepest ocean u- & v-levels 
    159 !                                          ikbv = mbkv(ji,jj) 
    160 !                                          z3dx(ji,jj,jk) = 0.5 * ( rCdU_bot(ji+1,jj) + rCdU_bot(ji,jj) ) &  
    161 !                                               &         * un(ji,jj,ikbu) / e3u_n(ji,jj,ikbu) 
    162 !                                          z3dy(ji,jj,jk) = 0.5 * ( rCdU_bot(ji,jj+1) + rCdU_bot(ji,jj) ) & 
    163 !                                               &         * vn(ji,jj,ikbv) / e3v_n(ji,jj,ikbv) 
    164 !                                    END DO 
    165 !                                 END DO 
    166 !                              END DO 
    167 !                              CALL lbc_lnk_multi( 'trddyn', z3dx, 'U', -1., z3dy, 'V', -1. ) 
    168 !                              CALL iom_put( "utrd_bfr", z3dx ) 
    169 !                              CALL iom_put( "vtrd_bfr", z3dy ) 
    170 !                                 DEALLOCATE( z3dx , z3dy ) 
    171 !                              ENDIF 
    172 !!gm end 
    173       CASE( jpdyn_bfr )       ! called if ln_drgimp=F 
    174                               CALL iom_put( "utrd_bfr", putrd )    ! bottom friction (explicit case) 
     277      CASE( jpdyn_bfr )   ;   CALL iom_put( "utrd_bfr", putrd )    ! bottom friction (explicit case) 
    175278                              CALL iom_put( "vtrd_bfr", pvtrd ) 
     279      CASE( jpdyn_bfri)   ;   CALL iom_put( "utrd_bfri", putrd )    ! bottom friction (implicit case) 
     280                              CALL iom_put( "vtrd_bfri", pvtrd ) 
    176281      CASE( jpdyn_atf )   ;   CALL iom_put( "utrd_atf", putrd )        ! asselin filter trends  
    177282                              CALL iom_put( "vtrd_atf", pvtrd ) 
    178283      END SELECT 
    179284      ! 
    180    END SUBROUTINE trd_dyn_iom 
     285   END SUBROUTINE trd_dyn_iom_3d 
     286 
     287 
     288   SUBROUTINE trd_dyn_iom_2d( putrd, pvtrd, ktrd, kt ) 
     289      !!--------------------------------------------------------------------- 
     290      !!                  ***  ROUTINE trd_dyn_iom  *** 
     291      !!  
     292      !! ** Purpose :   output 2D trends using IOM 
     293      !!---------------------------------------------------------------------- 
     294      REAL(wp), DIMENSION(:,:), INTENT(inout) ::   putrd, pvtrd   ! U and V trends 
     295      INTEGER                 , INTENT(in   ) ::   ktrd           ! trend index 
     296      INTEGER                 , INTENT(in   ) ::   kt             ! time step 
     297      ! 
     298      INTEGER ::   ji, jj, jk   ! dummy loop indices 
     299      INTEGER ::   ikbu, ikbv   ! local integers 
     300      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   z2dx, z2dy   ! 2D workspace  
     301      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   z3dx, z3dy   ! 3D workspace  
     302      !!---------------------------------------------------------------------- 
     303      ! 
     304      SELECT CASE( ktrd ) 
     305      CASE( jpdyn_spg )      ;   CALL iom_put( "utrd_spg2d", putrd )      ! surface pressure gradient 
     306                                 CALL iom_put( "vtrd_spg2d", pvtrd ) 
     307      CASE( jpdyn_pvo )      ;   CALL iom_put( "utrd_pvo2d", putrd )      ! planetary vorticity (barotropic part) 
     308                                 CALL iom_put( "vtrd_pvo2d", pvtrd ) 
     309      CASE( jpdyn_hpg_corr ) ;   CALL iom_put( "utrd_hpg_corr", putrd )   ! horizontal pressure gradient correction 
     310                                 CALL iom_put( "vtrd_hpg_corr", pvtrd ) 
     311      CASE( jpdyn_pvo_corr ) ;   CALL iom_put( "utrd_pvo_corr", putrd )   ! planetary vorticity correction 
     312                                 CALL iom_put( "vtrd_pvo_corr", pvtrd ) 
     313      CASE( jpdyn_bfr )      ;   CALL iom_put( "utrd_bfr2d", putrd )      ! bottom friction due to barotropic currents 
     314                                 CALL iom_put( "vtrd_bfr2d", pvtrd ) 
     315      END SELECT 
     316      ! 
     317   END SUBROUTINE trd_dyn_iom_2d 
    181318 
    182319   !!====================================================================== 
Note: See TracChangeset for help on using the changeset viewer.