LCOV - code coverage report
Current view: | top level - utils/cam_ccpp - ccpp_constituent_prop_mod.F90 (source / functions) |  |  | Hit | Total | Coverage
Test: | coverage.info |  | Lines: | 30 | 46 | 65.2 %
Date: | 2024-12-17 22:39:59 |  | Functions: | 5 | 7 | 71.4 %

              Line data    Source code
           1             : ! This module is the CAM version of the CCPP generated module of the same name
           2             : module ccpp_constituent_prop_mod
           3             :
           4             :    implicit none
           5             :    private
           6             :
           7             :    ! Define CAM version of constituent properties mod
           8             :    type, public :: ccpp_constituent_prop_ptr_t
           9             :       logical, private :: thermo_active = .false.
          10             :       logical, private :: water_species = .false.
          11             :    contains
          12             :       procedure :: standard_name     => ccp_get_standard_name
          13             :       procedure :: is_thermo_active  => ccp_is_thermo_active
          14             :       procedure :: is_water_species  => ccp_is_water_species
          15             :       procedure :: set_thermo_active => ccp_set_thermo_active
          16             :       procedure :: set_water_species => ccp_set_water_species
          17             :    end type ccpp_constituent_prop_ptr_t
          18             :
          19             :    ! CCPP properties init routine
          20             :    public :: ccpp_const_props_init
          21             :
          22             :    ! Public properties DDT variable:
          23             :    type(ccpp_constituent_prop_ptr_t), allocatable, public :: ccpp_const_props(:)
          24             :
          25             : contains
          26             :
          27             : !+++++++++++++++++++++++++++++++++++++++
          28             : !CCPP constituent properties DDT methods
          29             : !+++++++++++++++++++++++++++++++++++++++
          30             :
          31           0 :    subroutine ccp_get_standard_name(this, std_name, errcode, errmsg)
          32             :       ! Return this constituent's standard name
          33             :
          34             :       ! Dummy arguments
          35             :       class(ccpp_constituent_prop_ptr_t),   intent(in)  :: this
          36             :       character(len=*),                     intent(out) :: std_name
          37             :       integer,          optional,           intent(out) :: errcode
          38             :       character(len=*), optional,           intent(out) :: errmsg
          39             :
          40           0 :       std_name = 'Not Used!'
          41             :
          42             :       ! Provide err values if requested:
          43           0 :       if(present(errcode)) then
          44           0 :          errcode = 0
          45             :       end if
          46           0 :       if(present(errmsg)) then
          47           0 :          errmsg = 'Still Not Used!'
          48             :       end if
          49             :
          50           0 :    end subroutine ccp_get_standard_name
          51             :
          52             :    !------
          53             :
          54  3422702304 :    subroutine ccp_is_thermo_active(this, val_out, errcode, errmsg)
          55             :
          56             :       ! Dummy arguments
          57             :       class(ccpp_constituent_prop_ptr_t),   intent(in)  :: this
          58             :       logical,                              intent(out) :: val_out
          59             :       integer,          optional,           intent(out) :: errcode
          60             :       character(len=*), optional,           intent(out) :: errmsg
          61             :
          62             :       ! Pass back thermo active property:
          63  3422702304 :       val_out = this%thermo_active
          64             :
          65             :       ! Provide err values if requested:
          66  3422702304 :       if(present(errcode)) then
          67           0 :          errcode = 0
          68             :       end if
          69  3422702304 :       if(present(errmsg)) then
          70           0 :          errmsg = ''
          71             :       end if
          72             :
          73  3422702304 :    end subroutine ccp_is_thermo_active
          74             :
          75             :    !------
          76             :
          77   500883264 :    subroutine ccp_is_water_species(this, val_out, errcode, errmsg)
          78             :
          79             :       ! Dummy arguments
          80             :       class(ccpp_constituent_prop_ptr_t),   intent(in)  :: this
          81             :       logical,                              intent(out) :: val_out
          82             :       integer,          optional,           intent(out) :: errcode
          83             :       character(len=*), optional,           intent(out) :: errmsg
          84             :
          85             :       ! Pass back water species property:
          86   500883264 :       val_out = this%water_species
          87             :
          88             :       ! Provide err values if requested:
          89   500883264 :       if(present(errcode)) then
          90           0 :          errcode = 0
          91             :       end if
          92   500883264 :       if(present(errmsg)) then
          93           0 :          errmsg = ''
          94             :       end if
          95             :
          96   500883264 :    end subroutine ccp_is_water_species
          97             :
          98             :    !------
          99             :
         100        9216 :    subroutine ccp_set_thermo_active(this, thermo_flag, errcode, errmsg)
         101             :       ! Set whether this constituent is thermodynamically active, which
         102             :       ! means that certain physics schemes will use this constitutent
         103             :       ! when calculating thermodynamic quantities (e.g. enthalpy).
         104             :
         105             :       ! Dummy arguments
         106             :       class(ccpp_constituent_prop_ptr_t),   intent(inout) :: this
         107             :       logical,                              intent(in)    :: thermo_flag
         108             :       integer,          optional,           intent(out)   :: errcode
         109             :       character(len=*), optional,           intent(out)   :: errmsg
         110             :
         111             :       ! Set thermodynamically active flag for this constituent:
         112        9216 :       this%thermo_active = thermo_flag
         113             :
         114             :       ! Provide err values if requested:
         115        9216 :       if(present(errcode)) then
         116           0 :          errcode = 0
         117             :       end if
         118        9216 :       if(present(errmsg)) then
         119           0 :          errmsg = ''
         120             :       end if
         121             :
         122        9216 :    end subroutine ccp_set_thermo_active
         123             :
         124             :    !------
         125             :
         126        9216 :    subroutine ccp_set_water_species(this, water_flag, errcode, errmsg)
         127             :       ! Set whether this constituent is a water species, which means
         128             :       ! that this constituent represents a particular phase or type
         129             :       ! of water in the atmosphere.
         130             :
         131             :       ! Dummy arguments
         132             :       class(ccpp_constituent_prop_ptr_t),   intent(inout) :: this
         133             :       logical,                              intent(in)    :: water_flag
         134             :       integer,          optional,           intent(out)   :: errcode
         135             :       character(len=*), optional,           intent(out)   :: errmsg
         136             :
         137             :       ! Set thermodynamically active flag for this constituent:
         138        9216 :       this%water_species = water_flag
         139             :
         140             :       ! Provide err values if requested:
         141        9216 :       if(present(errcode)) then
         142           0 :          errcode = 0
         143             :       end if
         144        9216 :       if(present(errmsg)) then
         145           0 :          errmsg = ''
         146             :       end if
         147             :
         148        9216 :    end subroutine ccp_set_water_species
         149             :
         150             : !+++++++++++++++++++++++++++++++++++++++++++++++++++++++
         151             : !CAM-equivalent CCPP constituents initialization routine
         152             : !+++++++++++++++++++++++++++++++++++++++++++++++++++++++
         153             :
         154        1536 : subroutine ccpp_const_props_init()
         155             :
         156             :     ! Use statements:
         157             :     use constituents,    only: pcnst
         158             :     use cam_abortutils,  only: handle_allocate_error
         159             :     use air_composition, only: dry_air_species_num
         160             :     use air_composition, only: thermodynamic_active_species_idx
         161             :
         162             :     ! Local variables:
         163             :     integer :: ierr
         164             :     integer :: m
         165             :
         166             :     character(len=*), parameter :: subname = 'ccpp_const_prop_init:'
         167             :
         168             :     ! Allocate constituents object:
         169       64512 :     allocate(ccpp_const_props(pcnst), stat=ierr)
         170             :
         171             :     ! Check if allocation succeeded:
         172        1536 :     call handle_allocate_error(ierr, subname, 'ccpp_const_props(pcnst)')
         173             :
         174             :     ! Set "thermo_active" property:
         175       64512 :     do m = 1,pcnst
         176      410112 :        if(any(thermodynamic_active_species_idx == m)) then
         177        9216 :           call ccpp_const_props(m)%set_thermo_active(.true.)
         178             :        end if
         179             :     end do
         180             :
         181             :     ! Set "water_species" property:
         182       64512 :     do m=1,pcnst
         183      473088 :        if(any(thermodynamic_active_species_idx(dry_air_species_num+1:) == m)) then
         184        9216 :           call ccpp_const_props(m)%set_water_species(.true.)
         185             :        end if
         186             :     end do
         187             :
         188        1536 : end subroutine ccpp_const_props_init
         189             :
         190           0 : end module ccpp_constituent_prop_mod

Generated by: LCOV version 1.14