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 15169 for NEMO/branches/UKMO/NEMO_4.0.4_momentum_trends/src – NEMO

Ignore:
Timestamp:
2021-08-04T11:50:47+02:00 (3 years ago)
Author:
davestorkey
Message:

UKMO/NEMO_4.0.4_momentum_trends: Bug fix. Remove double counting of trends
due to top and bottom stress from barotropic currents in ZDF trend.

Location:
NEMO/branches/UKMO/NEMO_4.0.4_momentum_trends/src/OCE
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/UKMO/NEMO_4.0.4_momentum_trends/src/OCE/DYN/dynzdf.F90

    r15168 r15169  
    509509      IF( l_trddyn )   THEN       
    510510         ! Save the vertical diffusive trends for further diagnostics 
    511          ! and calculate implicit drag trends 
     511         ! then calculate implicit drag trends 
    512512         ! (The order of operation is important here).  
    513513         ! 
  • NEMO/branches/UKMO/NEMO_4.0.4_momentum_trends/src/OCE/TRD/trddyn.F90

    r15168 r15169  
    4040   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), SAVE :: zutrd_hpg, zvtrd_hpg 
    4141   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), SAVE :: zutrd_pvo, zvtrd_pvo 
     42   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), SAVE :: zutrd_tfre, zvtrd_tfre 
     43   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), SAVE :: zutrd_bfre, zvtrd_bfre 
    4244   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), SAVE :: zutrd_tfr, zvtrd_tfr 
    4345   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), SAVE :: zutrd_bfr, zvtrd_bfr 
     
    100102         DEALLOCATE( zutrd_hpg, zvtrd_hpg ) 
    101103 
    102       CASE( jpdyn_tfre, jpdyn_tfre_bt, jpdyn_tfri ) 
     104      CASE( jpdyn_tfre ) 
     105         ! 
     106         ! Explicit top drag trend calculated in zdf_drg. Save to add to  
     107         ! ZDF trend later and add to 3D TFR trend.  
     108         IF( .NOT. ALLOCATED(zutrd_tfre) ) THEN  
     109            ALLOCATE( zutrd_tfr(jpi,jpj,jpk), zvtrd_tfr(jpi,jpj,jpk) ) 
     110            zutrd_tfre(:,:,:) = putrd(:,:,:) 
     111            zvtrd_tfre(:,:,:) = pvtrd(:,:,:) 
     112         ENDIF 
     113         IF( .NOT. ALLOCATED(zutrd_tfr) ) THEN  
     114            ALLOCATE( zutrd_tfr(jpi,jpj,jpk), zvtrd_tfr(jpi,jpj,jpk) ) 
     115            zutrd_tfr(:,:,:) = 0.0 
     116            zvtrd_tfr(:,:,:) = 0.0 
     117         ENDIF 
     118         zutrd_tfr(:,:,:) = zutrd_tfr(:,:,:) + putrd(:,:,:)  
     119         zvtrd_tfr(:,:,:) = zvtrd_tfr(:,:,:) + pvtrd(:,:,:) 
     120 
     121      CASE( jpdyn_tfre_bt, jpdyn_tfri ) 
    103122         ! 
    104123         ! Add various top friction terms for baroclinic trend to saved quantity. 
     
    112131         zvtrd_tfr(:,:,:) = zvtrd_tfr(:,:,:) + pvtrd(:,:,:) 
    113132 
    114       CASE( jpdyn_bfre, jpdyn_bfre_bt, jpdyn_bfri ) 
     133      CASE( jpdyn_bfre ) 
     134         ! 
     135         ! Explicit bottom drag trend calculated in zdf_drg. Save to add to  
     136         ! ZDF trend later and add to 3D BFR trend.  
     137         IF( .NOT. ALLOCATED(zutrd_bfre) ) THEN  
     138            ALLOCATE( zutrd_bfr(jpi,jpj,jpk), zvtrd_bfr(jpi,jpj,jpk) ) 
     139            zutrd_bfre(:,:,:) = putrd(:,:,:) 
     140            zvtrd_bfre(:,:,:) = pvtrd(:,:,:) 
     141         ENDIF 
     142         IF( .NOT. ALLOCATED(zutrd_bfr) ) THEN  
     143            ALLOCATE( zutrd_bfr(jpi,jpj,jpk), zvtrd_bfr(jpi,jpj,jpk) ) 
     144            zutrd_bfr(:,:,:) = 0.0 
     145            zvtrd_bfr(:,:,:) = 0.0 
     146         ENDIF 
     147         zutrd_bfr(:,:,:) = zutrd_bfr(:,:,:) + putrd(:,:,:)  
     148         zvtrd_bfr(:,:,:) = zvtrd_bfr(:,:,:) + pvtrd(:,:,:) 
     149 
     150      CASE( jpdyn_bfre_bt, jpdyn_bfri ) 
    115151         ! 
    116152         ! Add various bottom friction terms for baroclinic trend to saved quantity. 
     
    129165         !            and add wind stress, and top and bottom friction trends from dynspg_ts. 
    130166         ! 
    131          ! If TFR or BFR arrays allocated at this stage then they will contain trends due 
     167         ! If TFRE or BFRE arrays allocated at this stage then they will contain trends due 
    132168         ! to explicit top or bottom drag components which need to be added to the ZDF trend.  
    133          IF( ALLOCATED( zutrd_tfr ) )THEN 
     169         IF( ALLOCATED( zutrd_tfre ) )THEN 
    134170            DO jk = 1, jpkm1 
    135                putrd(:,:,jk) = ( putrd(:,:,jk) + zutrd_tfr(:,:,jk) ) * umask(:,:,jk) 
    136                pvtrd(:,:,jk) = ( pvtrd(:,:,jk) + zvtrd_tfr(:,:,jk) ) * vmask(:,:,jk) 
    137             END DO 
    138          ENDIF 
    139          IF( ALLOCATED( zutrd_bfr ) )THEN 
     171               putrd(:,:,jk) = ( putrd(:,:,jk) + zutrd_tfre(:,:,jk) ) * umask(:,:,jk) 
     172               pvtrd(:,:,jk) = ( pvtrd(:,:,jk) + zvtrd_tfre(:,:,jk) ) * vmask(:,:,jk) 
     173            END DO 
     174            DEALLOCATE( zutrd_tfre, zvtrd_tfre ) 
     175         ENDIF 
     176         IF( ALLOCATED( zutrd_bfre ) )THEN 
    140177            DO jk = 1, jpkm1 
    141                putrd(:,:,jk) = ( putrd(:,:,jk) + zutrd_bfr(:,:,jk) ) * umask(:,:,jk) 
    142                pvtrd(:,:,jk) = ( pvtrd(:,:,jk) + zvtrd_bfr(:,:,jk) ) * vmask(:,:,jk) 
    143             END DO 
     178               putrd(:,:,jk) = ( putrd(:,:,jk) + zutrd_bfre(:,:,jk) ) * umask(:,:,jk) 
     179               pvtrd(:,:,jk) = ( pvtrd(:,:,jk) + zvtrd_bfre(:,:,jk) ) * vmask(:,:,jk) 
     180            END DO 
     181            DEALLOCATE( zutrd_bfre, zvtrd_bfre ) 
    144182         ENDIF 
    145183         IF( ln_dynspg_ts ) THEN 
Note: See TracChangeset for help on using the changeset viewer.