LCOV - code coverage report
Current view: top level - chemistry/mozart - mo_chem_utls.F90 (source / functions) Hit Total Coverage
Test: coverage.info Lines: 4 22 18.2 %
Date: 2025-01-13 21:54:50 Functions: 1 5 20.0 %

          Line data    Source code
       1             : 
       2             : module mo_chem_utls
       3             : 
       4             :   private
       5             :   public :: get_spc_ndx, get_het_ndx, get_extfrc_ndx, get_rxt_ndx, get_inv_ndx
       6             : 
       7             :   save
       8             : 
       9             : contains
      10             : 
      11     1565976 :   integer function get_spc_ndx( spc_name, ignore_case )
      12             :     !-----------------------------------------------------------------------
      13             :     !     ... return overall species index associated with spc_name
      14             :     !-----------------------------------------------------------------------
      15             : 
      16             :     use chem_mods,     only : gas_pcnst
      17             :     use mo_tracname,   only : tracnam => solsym
      18             :     use string_utils,  only : to_upper
      19             : 
      20             :     implicit none
      21             : 
      22             :     !-----------------------------------------------------------------------
      23             :     !     ... dummy arguments
      24             :     !-----------------------------------------------------------------------
      25             :     character(len=*), intent(in)           :: spc_name
      26             :     logical,          intent(in), optional :: ignore_case
      27             : 
      28             :     !-----------------------------------------------------------------------
      29             :     !     ... local variables
      30             :     !-----------------------------------------------------------------------
      31             :     integer :: m
      32             :     logical :: convert_to_upper
      33             :     logical :: match
      34             : 
      35     1565976 :     convert_to_upper = .false.
      36             :     if ( present( ignore_case ) ) then
      37     1565976 :        convert_to_upper = ignore_case
      38             :     endif
      39             : 
      40             :     get_spc_ndx = -1
      41             :     do m = 1,gas_pcnst
      42             :        if ( .not. convert_to_upper ) then
      43             :           match = trim( spc_name ) == trim( tracnam(m) )
      44             :        else
      45             :           match = trim( to_upper( spc_name ) ) == trim( to_upper( tracnam(m) ) )
      46             :        endif
      47             :        if( match ) then
      48             :           get_spc_ndx = m
      49             :           exit
      50             :        end if
      51             :     end do
      52             : 
      53     1565976 :   end function get_spc_ndx
      54             : 
      55           0 :   integer function get_inv_ndx( invariant )
      56             :     !-----------------------------------------------------------------------
      57             :     !     ... return overall external frcing index associated with spc_name
      58             :     !-----------------------------------------------------------------------
      59             : 
      60             :     use chem_mods,  only : nfs, inv_lst
      61             : 
      62             :     implicit none
      63             : 
      64             :     !-----------------------------------------------------------------------
      65             :     !     ... dummy arguments
      66             :     !-----------------------------------------------------------------------
      67             :     character(len=*), intent(in) :: invariant
      68             : 
      69             :     !-----------------------------------------------------------------------
      70             :     !     ... local variables
      71             :     !-----------------------------------------------------------------------
      72             :     integer :: m
      73             : 
      74           0 :     get_inv_ndx = -1
      75           0 :     do m = 1,nfs
      76           0 :        if( trim( invariant ) == trim( inv_lst(m) ) ) then
      77           0 :           get_inv_ndx = m
      78           0 :           exit
      79             :        end if
      80             :     end do
      81             : 
      82           0 :   end function get_inv_ndx
      83             : 
      84           0 :   integer function get_het_ndx( het_name )
      85             :     !-----------------------------------------------------------------------
      86             :     !     ... return overall het process index associated with spc_name
      87             :     !-----------------------------------------------------------------------
      88             : 
      89             :     use gas_wetdep_opts,only : gas_wetdep_method, gas_wetdep_list, gas_wetdep_cnt
      90             : 
      91             :     implicit none
      92             : 
      93             :     !-----------------------------------------------------------------------
      94             :     !     ... dummy arguments
      95             :     !-----------------------------------------------------------------------
      96             :     character(len=*), intent(in) :: het_name
      97             : 
      98             :     !-----------------------------------------------------------------------
      99             :     !     ... local variables
     100             :     !-----------------------------------------------------------------------
     101             :     integer :: m
     102             : 
     103           0 :     get_het_ndx=-1
     104             : 
     105           0 :     do m=1,gas_wetdep_cnt
     106             : 
     107           0 :        if( trim( het_name ) == trim( gas_wetdep_list(m) ) ) then
     108           0 :           get_het_ndx = get_spc_ndx( gas_wetdep_list(m) )
     109           0 :           return
     110             :        endif
     111             :   
     112             :     enddo
     113             : 
     114             :   end function get_het_ndx
     115             : 
     116           0 :   integer function get_extfrc_ndx( frc_name )
     117             :     !-----------------------------------------------------------------------
     118             :     !     ... return overall external frcing index associated with spc_name
     119             :     !-----------------------------------------------------------------------
     120             : 
     121             :     use chem_mods,  only : extcnt, extfrc_lst
     122             : 
     123             :     implicit none
     124             : 
     125             :     !-----------------------------------------------------------------------
     126             :     !     ... dummy arguments
     127             :     !-----------------------------------------------------------------------
     128             :     character(len=*), intent(in) :: frc_name
     129             : 
     130             :     !-----------------------------------------------------------------------
     131             :     !     ... local variables
     132             :     !-----------------------------------------------------------------------
     133             :     integer :: m
     134             : 
     135           0 :     get_extfrc_ndx = -1
     136             :     if( extcnt > 0 ) then
     137             :        do m = 1,max(1,extcnt)
     138             :           if( trim( frc_name ) == trim( extfrc_lst(m) ) ) then
     139             :              get_extfrc_ndx = m
     140             :              exit
     141             :           end if
     142             :        end do
     143             :     end if
     144             : 
     145           0 :   end function get_extfrc_ndx
     146             : 
     147           0 :   integer function get_rxt_ndx( rxt_tag )
     148             :     !-----------------------------------------------------------------------
     149             :     !     ... return overall external frcing index associated with spc_name
     150             :     !-----------------------------------------------------------------------
     151             : 
     152             :     use chem_mods,  only : rxt_tag_cnt, rxt_tag_lst, rxt_tag_map
     153             : 
     154             :     implicit none
     155             : 
     156             :     !-----------------------------------------------------------------------
     157             :     !     ... dummy arguments
     158             :     !-----------------------------------------------------------------------
     159             :     character(len=*), intent(in) :: rxt_tag
     160             : 
     161             :     !-----------------------------------------------------------------------
     162             :     !     ... local variables
     163             :     !-----------------------------------------------------------------------
     164             :     integer :: m
     165             : 
     166             :     get_rxt_ndx = -1
     167             :     do m = 1,rxt_tag_cnt
     168             :        if( trim( rxt_tag ) == trim( rxt_tag_lst(m) ) ) then
     169             :           get_rxt_ndx = rxt_tag_map(m)
     170             :           exit
     171             :        end if
     172             :     end do
     173             : 
     174           0 :   end function get_rxt_ndx
     175             : 
     176             : end module mo_chem_utls

Generated by: LCOV version 1.14