LCOV - code coverage report
Current view: | top level - chemistry/mozart - chem_prod_loss_diags.F90 (source / functions) |  |  | Hit | Total | Coverage
Test: | coverage.info |  | Lines: | 0 | 13 | 0.0 %
Date: | 2025-01-13 21:54:50 |  | Functions: | 0 | 2 | 0.0 %

              Line data    Source code
           1             : module chem_prod_loss_diags
           2             :   use shr_kind_mod, only : r8 => shr_kind_r8
           3             :   use chem_mods, only : clscnt1, clscnt4, gas_pcnst, clsmap, permute
           4             :   use ppgrid, only : pver
           5             :   use chem_mods, only : rxntot
           6             :   use cam_history, only : addfld, outfld, add_default
           7             :   use mo_tracname, only : solsym
           8             :
           9             :   implicit none
          10             :
          11             :   private
          12             :   public :: chem_prod_loss_diags_init
          13             :   public :: chem_prod_loss_diags_out
          14             :
          15             : contains
          16             :
          17             :   !-----------------------------------------------------------------------------
          18             :   !-----------------------------------------------------------------------------
          19           0 :   subroutine chem_prod_loss_diags_init
          20             :     use phys_control, only : phys_getopts
          21             :
          22             :
          23             :     integer :: i,j
          24             :     logical :: history_scwaccm_forcing
          25           0 :     call phys_getopts( history_scwaccm_forcing_out = history_scwaccm_forcing )
          26             :
          27             :     do i = 1,clscnt4
          28             :        j = clsmap(i,4)
          29             :        call addfld( trim(solsym(j))//'_CHMP', (/ 'lev' /), 'I', '/cm3/s', 'chemical production rate' )
          30             :        call addfld( trim(solsym(j))//'_CHML', (/ 'lev' /), 'I', '/cm3/s', 'chemical loss rate' )
          31             :        if (history_scwaccm_forcing ) then
          32             :           if ( trim(solsym(j))=='CH4' .or. &
          33             :                trim(solsym(j))=='CFC11' .or. &
          34             :                trim(solsym(j))=='CFC12' .or. &
          35             :                trim(solsym(j))=='N2O' ) then
          36             :              call add_default( trim(solsym(j))//'_CHML', 1, ' ')
          37             :           endif
          38             :        endif
          39             :     enddo
          40             :     do i = 1,clscnt1
          41             :        j = clsmap(i,1)
          42             :        if (history_scwaccm_forcing ) then
          43             :           if ( trim(solsym(j))=='CH4' .or. &
          44             :                trim(solsym(j))=='CFC11' .or. &
          45             :                trim(solsym(j))=='CFC12' .or. &
          46             :                trim(solsym(j))=='N2O' ) then
          47             :              call add_default( trim(solsym(j))//'_CHML', 1, ' ')
          48             :           endif
          49             :        endif
          50             :     enddo
          51             :
          52           0 :     call addfld('H_PEROX_CHMP', (/ 'lev' /), 'I', '/cm3/s', 'total ROOH production rate' ) !PJY changed "RO2" to "ROOH"
          53             :
          54           0 :   end subroutine chem_prod_loss_diags_init
          55             :
          56             :   !-----------------------------------------------------------------------------
          57             :   !-----------------------------------------------------------------------------
          58           0 :   subroutine chem_prod_loss_diags_out( ncol, lchnk, base_sol, reaction_rates, prod_in, loss_in, xhnm )
          59             :
          60             :     integer,  intent(in) :: ncol, lchnk
          61             :     real(r8), intent(in) :: base_sol(ncol,pver,gas_pcnst)
          62             :     real(r8), intent(in) :: reaction_rates(ncol,pver,max(1,rxntot))
          63             :     real(r8), intent(in) :: prod_in(ncol,pver,max(1,clscnt4))
          64             :     real(r8), intent(in) :: loss_in(ncol,pver,max(1,clscnt4))
          65             :     real(r8), intent(in) :: xhnm(ncol,pver)
          66             :
          67           0 :     real(r8), dimension(ncol,pver,max(1,clscnt4)) :: prod_out, loss_out
          68           0 :     real(r8), dimension(ncol,pver) :: prod_hydrogen_peroxides_out
          69             :     integer :: lev, i, k, j, m
          70             :
          71           0 :     level_loop : do lev = 1,pver
          72           0 :        column_loop : do i = 1,ncol
          73             :
          74             :           !-----------------------------------------------------------------------
          75             :           ! ... Prod/Loss history buffers...
          76             :           !-----------------------------------------------------------------------
          77           0 :           cls_loop2: do k = 1,clscnt4
          78             :              j = clsmap(k,4)
          79             :              m = permute(k,4)
          80             :              prod_out(i,lev,k) = prod_in(i,lev,m)
          81             :              loss_out(i,lev,k) = loss_in(i,lev,m)
          82             :           end do cls_loop2
          83             :        end do column_loop
          84             :     end do level_loop
          85             :
          86           0 :     prod_hydrogen_peroxides_out(:,:) = 0._r8
          87             :
          88             :     do i = 1,clscnt4
          89             :        j = clsmap(i,4)
          90             :        prod_out(:,:,i) = prod_out(:,:,i)*xhnm(:,:)
          91             :        loss_out(:,:,i) = loss_out(:,:,i)*xhnm(:,:)
          92             :        call outfld( trim(solsym(j))//'_CHMP', prod_out(:,:,i), ncol, lchnk )
          93             :        call outfld( trim(solsym(j))//'_CHML', loss_out(:,:,i), ncol, lchnk )
          94             :        !
          95             :        ! added code for ROOH production !PJY not "RO2 production"
          96             :        !
          97             :        if ( trim(solsym(j)) == 'ALKOOH' &
          98             :             .or.trim(solsym(j)) == 'C2H5OOH' &
          99             :             .or.trim(solsym(j)) == 'CH3OOH' & !PJY added this
         100             :             .or.trim(solsym(j)) == 'CH3COOH' &
         101             :             .or.trim(solsym(j)) == 'CH3COOOH' &
         102             :             .or.trim(solsym(j)) == 'C3H7OOH' & !PJY corrected this (from CH3H7OOH)
         103             :             .or.trim(solsym(j)) == 'EOOH' &
         104             :             .or.trim(solsym(j)) == 'ISOPOOH' &
         105             :             .or.trim(solsym(j)) == 'MACROOH' &
         106             :             .or.trim(solsym(j)) == 'MEKOOH' &
         107             :             .or.trim(solsym(j)) == 'POOH' &
         108             :             .or.trim(solsym(j)) == 'ROOH' &
         109             :             .or.trim(solsym(j)) == 'TERPOOH' &
         110             :             .or.trim(solsym(j)) == 'TOLOOH' &
         111             :             .or.trim(solsym(j)) == 'XOOH' ) then
         112             :           prod_hydrogen_peroxides_out(:,:) = prod_hydrogen_peroxides_out(:,:) + prod_out(:,:,i)
         113             :        end if
         114             :     enddo
         115             :
         116           0 :     call outfld( 'H_PEROX_CHMP', prod_hydrogen_peroxides_out(:,:), ncol, lchnk )
         117             :
         118           0 :   end subroutine chem_prod_loss_diags_out
         119             :
         120             : end module chem_prod_loss_diags
         121             :

Generated by: LCOV version 1.14