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 9208 for branches/NERC/dev_r5518_GO6_conserv_check_up/NEMOGCM/NEMO/TOP_SRC/trcrst.F90 – NEMO

Ignore:
Timestamp:
2018-01-10T17:06:13+01:00 (6 years ago)
Author:
jpalmier
Message:

JPALM -- GMED 364 -- clean/correct branch from GO6 Head

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/NERC/dev_r5518_GO6_conserv_check_up/NEMOGCM/NEMO/TOP_SRC/trcrst.F90

    r9163 r9208  
    3030   USE daymod 
    3131   !! AXY (05/11/13): need these for MEDUSA to input/output benthic reservoirs 
     32   USE par_medusa 
    3233   USE sms_medusa 
    3334   USE trcsms_medusa 
     
    5354   PUBLIC   trc_rst_cal 
    5455   PUBLIC   trc_rst_stat 
     56#if defined key_medusa && defined key_roam 
     57   PUBLIC   trc_rst_conserve 
     58#endif 
    5559 
    5660   !! * Substitutions 
     
    539543      IF( kt == nitrst ) THEN 
    540544          CALL trc_rst_stat            ! statistics 
     545#if defined key_medusa && defined key_roam 
     546          CALL trc_rst_conserve        ! conservation check 
     547#endif 
    541548          CALL iom_close( numrtw )     ! close the restart file (only at last time step) 
    542549#if ! defined key_trdmxl_trc 
     
    705712 
    706713 
     714# if defined key_medusa && defined key_roam 
     715   SUBROUTINE trc_rst_conserve 
     716      !!---------------------------------------------------------------------- 
     717      !!                    ***  trc_rst_conserve  *** 
     718      !! 
     719      !! ** purpose  :   Compute tracers conservation statistics 
     720      !! 
     721      !! AXY (17/11/2017) 
     722      !! This routine calculates the "now" inventories of the elemental  
     723      !! cycles of MEDUSA and compares them to those calculate when the 
     724      !! model was initialised / restarted; the cycles calculated are: 
     725      !!    nitrogen, silicon, iron, carbon, alkalinity and oxygen 
     726      !!---------------------------------------------------------------------- 
     727      INTEGER  :: ji, jj, jk, jn 
     728      REAL(wp) :: zsum3d, zsum2d, zinvt, zdelta, zratio, loc_vol, loc_are 
     729      REAL(wp) :: zq1, zq2, loc_vol, loc_area 
     730      REAL(wp), DIMENSION(jpi,jpj,jpk) :: z3d, zvol 
     731      REAL(wp), DIMENSION(jpi,jpj)     :: z2d, zarea 
     732      REAL(wp), DIMENSION(6)           :: loc_cycletot3, loc_cycletot2 
     733      !!---------------------------------------------------------------------- 
     734      ! 
     735      IF( lwp ) THEN 
     736         WRITE(numout,*)  
     737         WRITE(numout,*) '           ----TRACER CONSERVATION----             ' 
     738         WRITE(numout,*)  
     739      ENDIF 
     740      ! 
     741      ! ocean volume 
     742      DO jk = 1, jpk 
     743         zvol(:,:,jk) = e1e2t(:,:) * fse3t_a(:,:,jk) * tmask(:,:,jk) 
     744      END DO 
     745      ! 
     746      ! ocean area (for sediments) 
     747      zarea(:,:)      = e1e2t(:,:) * tmask(:,:,1) 
     748      ! 
     749      !---------------------------------------------------------------------- 
     750      ! nitrogen 
     751      z3d(:,:,:) = trn(:,:,:,jpphn) + trn(:,:,:,jpphd) + trn(:,:,:,jpzmi) + & 
     752                   trn(:,:,:,jpzme) + trn(:,:,:,jpdet) + trn(:,:,:,jpdin) 
     753      z2d(:,:)   = zn_sed_n(:,:) 
     754      zsum3d     = glob_sum( z3d(:,:,:) * zvol(:,:,:) ) 
     755      zsum2d     = glob_sum( z2d(:,:) * zarea(:,:) ) 
     756      ! total tracer, and delta 
     757      zinvt      = zsum3d + zsum2d 
     758      zdelta     = zinvt - cycletot(1) 
     759      zratio     = 1.0e2 * zdelta / cycletot(1) 
     760      ! 
     761      IF ( lwp ) WRITE(numout,9010) 'nitrogen', zsum3d, zsum2d, zinvt,   & 
     762         cycletot(1), zdelta, zratio 
     763      IF ( lwp ) WRITE(numout,*)  
     764      ! 
     765      !---------------------------------------------------------------------- 
     766      ! silicon 
     767      z3d(:,:,:) = trn(:,:,:,jppds) + trn(:,:,:,jpsil) 
     768      z2d(:,:)   = zn_sed_si(:,:) 
     769      zsum3d     = glob_sum( z3d(:,:,:) * zvol(:,:,:) ) 
     770      zsum2d     = glob_sum( z2d(:,:) * zarea(:,:) ) 
     771      ! total tracer, and delta 
     772      zinvt      = zsum3d + zsum2d 
     773      zdelta     = zinvt - cycletot(2) 
     774      zratio     = 1.0e2 * zdelta / cycletot(2) 
     775      ! 
     776      IF ( lwp ) WRITE(numout,9010) 'silicon', zsum3d, zsum2d, zinvt,    & 
     777         cycletot(2), zdelta, zratio 
     778      IF ( lwp ) WRITE(numout,*)  
     779      ! 
     780      !---------------------------------------------------------------------- 
     781      ! iron 
     782      z3d(:,:,:) = ((trn(:,:,:,jpphn) + trn(:,:,:,jpphd) + trn(:,:,:,jpzmi) + & 
     783            trn(:,:,:,jpzme) + trn(:,:,:,jpdet)) * xrfn) + trn(:,:,:,jpfer) 
     784      z2d(:,:)   = zn_sed_fe(:,:) 
     785      zsum3d     = glob_sum( z3d(:,:,:) * zvol(:,:,:) ) 
     786      zsum2d     = glob_sum( z2d(:,:) * zarea(:,:) ) 
     787      ! total tracer, and delta 
     788      zinvt      = zsum3d + zsum2d 
     789      zdelta     = zinvt - cycletot(3) 
     790      zratio     = 1.0e2 * zdelta / cycletot(3) 
     791      ! 
     792      IF ( lwp ) WRITE(numout,9010) 'iron', zsum3d, zsum2d, zinvt,       & 
     793         cycletot(3), zdelta, zratio 
     794      IF ( lwp ) WRITE(numout,*)  
     795      ! 
     796      !---------------------------------------------------------------------- 
     797      ! carbon 
     798      z3d(:,:,:) = (trn(:,:,:,jpphn) * xthetapn)  + (trn(:,:,:,jpphd) * xthetapd)  + & 
     799                   (trn(:,:,:,jpzmi) * xthetazmi) + (trn(:,:,:,jpzme) * xthetazme) + & 
     800                   trn(:,:,:,jpdtc) + trn(:,:,:,jpdic) 
     801      z2d(:,:)   = zn_sed_c(:,:) + zn_sed_ca(:,:) 
     802      zsum3d     = glob_sum( z3d(:,:,:) * zvol(:,:,:) ) 
     803      zsum2d     = glob_sum( z2d(:,:) * zarea(:,:) ) 
     804      ! total tracer, and delta 
     805      zinvt      = zsum3d + zsum2d 
     806      zdelta     = zinvt - cycletot(4) 
     807      zratio     = 1.0e2 * zdelta / cycletot(4) 
     808      ! 
     809      IF ( lwp ) WRITE(numout,9010) 'carbon', zsum3d, zsum2d, zinvt,     & 
     810         cycletot(4), zdelta, zratio 
     811      IF ( lwp ) WRITE(numout,*)  
     812      ! 
     813      !---------------------------------------------------------------------- 
     814      ! alkalinity 
     815      z3d(:,:,:) = trn(:,:,:,jpalk) 
     816      z2d(:,:)   = zn_sed_ca(:,:) * 2.0 
     817      zsum3d     = glob_sum( z3d(:,:,:) * zvol(:,:,:) ) 
     818      zsum2d     = glob_sum( z2d(:,:) * zarea(:,:) ) 
     819      ! total tracer, and delta 
     820      zinvt      = zsum3d + zsum2d 
     821      zdelta     = zinvt - cycletot(5) 
     822      zratio     = 1.0e2 * zdelta / cycletot(5) 
     823      ! 
     824      IF ( lwp ) WRITE(numout,9010) 'alkalinity', zsum3d, zsum2d, zinvt, & 
     825         cycletot(5), zdelta, zratio 
     826      IF ( lwp ) WRITE(numout,*)  
     827      ! 
     828      !---------------------------------------------------------------------- 
     829      ! oxygen 
     830      z3d(:,:,:) = trn(:,:,:,jpoxy) 
     831      z2d(:,:)   = 0.0 
     832      zsum3d     = glob_sum( z3d(:,:,:) * zvol(:,:,:) ) 
     833      zsum2d     = glob_sum( z2d(:,:) * zarea(:,:) ) 
     834      ! total tracer, and delta 
     835      zinvt      = zsum3d + zsum2d 
     836      zdelta     = zinvt - cycletot(6) 
     837      zratio     = 1.0e2 * zdelta / cycletot(6) 
     838      ! 
     839      IF ( lwp ) WRITE(numout,9010) 'oxygen', zsum3d, zsum2d, zinvt,     & 
     840         cycletot(6), zdelta, zratio 
     841      ! 
     842      !---------------------------------------------------------------------- 
     843      ! Check  
     844      zsum3d        = glob_sum( zvol(:,:,:) ) 
     845      zsum2d        = glob_sum( zarea(:,:) ) 
     846      IF ( lwp ) WRITE(numout,*) 
     847      IF ( lwp ) WRITE(numout,*) ' check : cvol    : ', zsum3d 
     848      IF ( lwp ) WRITE(numout,*) ' check : carea   : ', zsum2d 
     849      IF ( lwp ) WRITE(numout,*) 
     850      IF ( lwp ) CALL flush(numout) 
     851      ! 
     8529010  FORMAT(' element:',a10,                     & 
     853             ' 3d sum:',e18.10,' 2d sum:',e18.10, & 
     854             ' total:',e18.10,' initial:',e18.10, & 
     855             ' delta:',e18.10,' %:',e18.10) 
     856      ! 
     857   END SUBROUTINE trc_rst_conserve  
     858# endif 
     859 
     860 
    707861#else 
    708862   !!---------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.