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 13063 for branches/UKMO – NEMO

Changeset 13063 for branches/UKMO


Ignore:
Timestamp:
2020-06-08T15:32:56+02:00 (4 years ago)
Author:
pdavis
Message:

Ported across calculation of salinity and temp over the first 300m

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/AddC3SDiags/NEMOGCM/NEMO/OPA_SRC/DIA/diahth.F90

    r11101 r13063  
    3737   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hd28   !: depth of 28 C isotherm                         [m] 
    3838   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   htc3   !: heat content of first 300 m                    [W] 
     39   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   tav3   !: Average temp of first 300 m                    [degC] 
     40   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sav3   !: Average salinity of first 300 m                [PSU] 
    3941 
    4042   !! * Substitutions 
     
    5355      ! 
    5456      ALLOCATE(hth(jpi,jpj), hd20(jpi,jpj), hd28(jpi,jpj), htc3(jpi,jpj), STAT=dia_hth_alloc) 
     57      ! 
     58      ALLOCATE(tav3(jpi,jpj), sav3(jpi,jpj), STAT=dia_hth_alloc) 
    5559      ! 
    5660      IF( lk_mpp           )   CALL mpp_sum ( dia_hth_alloc ) 
     
    9296      REAL(wp)                         ::   zztmp, zzdep          ! temporary scalars inside do loop 
    9397      REAL(wp)                         ::   zu, zv, zw, zut, zvt  ! temporary workspace 
     98      REAL(wp)                         ::   depth_remain          ! temporary float 
    9499      REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   zabs2      ! MLD: abs( tn - tn(10m) ) = ztem2  
    95100      REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ztm2       ! Top of thermocline: tn = tn(10m) - ztem2      
     
    300305      CALL iom_put( "28d", hd28 )   ! depth of the 28 isotherm 
    301306 
     307      ! ---------------------------------------- ! 
     308      !  Average temp & salinity of first 300 m  ! 
     309      !  Copied from the hc300 section below     ! 
     310      ! ---------------------------------------- ! 
     311      ! find ilevel with (ilevel+1) the deepest W-level above 300m (we assume we can use e3t_0 to do this search...) 
     312      ilevel   = 0 
     313      zthick_0 = 0._wp 
     314      DO jk = 1, jpkm1                       
     315         zthick_0 = zthick_0 + e3t_1d(jk) 
     316         IF( zthick_0 < 300. )   ilevel = jk 
     317      END DO 
     318      ! surface boundary condition 
     319      IF( lk_vvl ) THEN   ;   zthick(:,:) = 0._wp       ;   tav3(:,:) = 0._wp  ; sav3(:,:) = 0._wp  
     320      ELSE 
     321        ! For the surface layer calculate the integrated temp and salinity 
     322        ! The SSH "layer" is considered to be at the same temp/salinity as the 
     323        ! first ocean level. 
     324        zthick(:,:) = sshn(:,:) * tmask(:,:,1) 
     325        tav3(:,:) = tsn(:,:,1,jp_tem) * tmask(:,:,1) * zthick(:,:)   
     326        sav3(:,:) = tsn(:,:,1,jp_sal) * tmask(:,:,1) * zthick(:,:)  
     327      ENDIF 
     328 
     329      ! integration down to ilevel 
     330      ! For each level above 300m (1 to ilevel) calculate the integrated 
     331      ! temp and salinty (T|S * layer thickness), and sum the thickness 
     332      DO jk = 1, ilevel 
     333         zthick(:,:) = zthick(:,:) + fse3t(:,:,jk) * tmask(:,:,jk) 
     334         tav3  (:,:) = tav3  (:,:) + tsn(:,:,jk,jp_tem) * tmask(:,:,jk) * fse3t(:,:,jk) 
     335         sav3  (:,:) = sav3  (:,:) + tsn(:,:,jk,jp_sal) * tmask(:,:,jk) * fse3t(:,:,jk) 
     336      END DO 
     337 
     338      DO jj = 1, jpj 
     339         DO ji = 1, jpi 
     340            ! What distance is there remaining to get to 300m 
     341            depth_remain = 300.0 - zthick(ji,jj) 
     342             
     343            ! add the value of reamining thickness * T|S of the level beyond 
     344            ! 300m.  
     345            tav3(ji,jj) = tav3(ji,jj) + tsn(ji,jj,ilevel+1,jp_tem) * MIN( fse3t(ji,jj,ilevel+1), depth_remain )  & 
     346                                                                   * tmask(ji,jj,ilevel+1) 
     347            sav3(ji,jj) = sav3(ji,jj) + tsn(ji,jj,ilevel+1,jp_sal) * MIN( fse3t(ji,jj,ilevel+1), depth_remain )  & 
     348                                                                   * tmask(ji,jj,ilevel+1) 
     349            ! Add the remaining depth, this should take us to 300m (in most 
     350            ! places) 
     351            zthick(ji,jj) = zthick(ji,jj) + MIN( fse3t(ji,jj,ilevel+1), depth_remain ) * tmask(ji,jj,ilevel+1) 
     352            ! Divide by the depth to get the integrated temp|salinity 
     353            tav3(ji,jj) = tav3(ji,jj) / zthick(ji,jj) 
     354            sav3(ji,jj) = sav3(ji,jj) / zthick(ji,jj) 
     355 
     356         END DO 
     357      END DO 
     358 
     359      CALL iom_put( "tav300", tav3 )      ! first 300m average temperature 
     360      CALL iom_put( "sav300", sav3 )      ! first 300m average salinity 
     361 
    302362      ! ----------------------------- ! 
    303363      !  Heat content of first 300 m  ! 
Note: See TracChangeset for help on using the changeset viewer.