LCOV - code coverage report
Current view: top level - physics/cam - carma_intr.F90 (source / functions) Hit Total Coverage
Test: coverage.info Lines: 18 34 52.9 %
Date: 2024-12-17 17:57:11 Functions: 6 11 54.5 %

          Line data    Source code
       1             : !! This module is stub for a coupler between the CAM model and the Community Aerosol
       2             : !! and Radiation Model for Atmospheres (CARMA) microphysics model. It is used when
       3             : !! CARMA is not being used, so that the CAM code that calls CARMA does not need to
       4             : !! be changed. The real version of this routine exists in the directory
       5             : !! physics/carma/cam. A CARMA model can be activated by using configure with the
       6             : !! option:
       7             : !!
       8             : !!  -carma <carma_pkg>
       9             : !!
      10             : !! where carma_pkg is the name for a particular microphysical model.
      11             : !!
      12             : !! @author  Chuck Bardeen
      13             : !! @version May 2009
      14             : module carma_intr
      15             : 
      16             :   use shr_kind_mod,   only: r8 => shr_kind_r8
      17             :   use pmgrid,         only: plat, plev, plevp, plon
      18             :   use ppgrid,         only: pcols, pver, pverp
      19             :   use constituents,   only: pcnst
      20             :   use physics_types,  only: physics_state, physics_ptend, physics_ptend_init
      21             :   use physics_buffer, only: physics_buffer_desc
      22             : 
      23             : 
      24             :   implicit none
      25             :   
      26             :   private
      27             :   save
      28             : 
      29             :   ! Public interfaces
      30             :   
      31             :   ! CAM Physics Interface
      32             :   public carma_register                 ! register consituents
      33             :   public carma_is_active                ! retrns true if this package is active (microphysics = .true.)
      34             :   public carma_implements_cnst          ! returns true if consituent is implemented by this package
      35             :   public carma_init_cnst                ! initialize constituent mixing ratios, if not read from initial file
      36             :   public carma_init                     ! initialize timestep independent variables
      37             :   public carma_final                    ! finalize the CARMA module
      38             :   public carma_timestep_init            ! initialize timestep dependent variables
      39             :   public carma_timestep_tend            ! interface to tendency computation
      40             :   public carma_accumulate_stats         ! collect stats from all MPI tasks
      41             :   
      42             :   ! Other Microphysics
      43             :   public carma_emission_tend            ! calculate tendency from emission source function
      44             :   public carma_wetdep_tend              ! calculate tendency from wet deposition
      45             :   
      46             : contains
      47             : 
      48             : 
      49        1536 :   subroutine carma_register
      50             :     implicit none
      51             : 
      52        1536 :     return
      53             :   end subroutine carma_register
      54             : 
      55             : 
      56           0 :   function carma_is_active()
      57             :     implicit none
      58             :   
      59             :     logical :: carma_is_active
      60             :   
      61           0 :     carma_is_active = .false.
      62             :     
      63             :     return
      64             :   end function carma_is_active
      65             : 
      66             : 
      67           0 :   function carma_implements_cnst(name)
      68             :     implicit none
      69             :     
      70             :     character(len=*), intent(in) :: name   !! constituent name
      71             :     logical :: carma_implements_cnst       ! return value
      72             : 
      73           0 :     carma_implements_cnst = .false.
      74             :     
      75             :     return
      76             :   end function carma_implements_cnst
      77             :   
      78             : 
      79        1536 :   subroutine carma_init
      80             :     implicit none
      81             :     
      82        1536 :     return
      83             :   end subroutine carma_init
      84             : 
      85             : 
      86        1536 :   subroutine carma_final
      87             :     implicit none
      88             :         
      89        1536 :     return
      90             :   end subroutine carma_final
      91             :   
      92             : 
      93      370944 :   subroutine carma_timestep_init
      94             :     implicit none
      95             : 
      96      370944 :     return
      97             :   end subroutine carma_timestep_init
      98             : 
      99             : 
     100    17870112 :   subroutine carma_timestep_tend(state, cam_in, cam_out, ptend, dt, pbuf, dlf, rliq, prec_str, snow_str, &
     101             :     prec_sed, snow_sed, ustar, obklen)
     102             :     use hycoef,           only: hyai, hybi, hyam, hybm
     103             :     use time_manager,     only: get_nstep, get_step_size, is_first_step
     104             :     use camsrfexch,       only: cam_in_t, cam_out_t
     105             :     use scamMod,          only: single_column
     106             :  
     107             :     implicit none
     108             : 
     109             :     type(physics_state), intent(inout) :: state                 !! physics state variables
     110             :     type(cam_in_t), intent(in)         :: cam_in                !! surface inputs
     111             :     type(cam_out_t), intent(inout)     :: cam_out               !! cam output to surface models
     112             :     type(physics_ptend), intent(out)   :: ptend                 !! constituent tendencies
     113             :     real(r8), intent(in)               :: dt                    !! time step (s)
     114             :     type(physics_buffer_desc), pointer :: pbuf(:)               !! physics buffer
     115             :     real(r8), intent(in), optional     :: dlf(pcols,pver)       !! Detraining cld H20 from convection (kg/kg/s)
     116             :     real(r8), intent(inout), optional  :: rliq(pcols)           !! vertical integral of liquid not yet in q(ixcldliq)
     117             :     real(r8), intent(out), optional    :: prec_str(pcols)       !! [Total] sfc flux of precip from stratiform (m/s) 
     118             :     real(r8), intent(out), optional    :: snow_str(pcols)       !! [Total] sfc flux of snow from stratiform   (m/s)
     119             :     real(r8), intent(out), optional    :: prec_sed(pcols)       !! total precip from cloud sedimentation (m/s)
     120             :     real(r8), intent(out), optional    :: snow_sed(pcols)       !! snow from cloud ice sedimentation (m/s)
     121             :     real(r8), intent(in), optional     :: ustar(pcols)          !! friction velocity (m/s)
     122             :     real(r8), intent(in), optional     :: obklen(pcols)         !! Obukhov length [ m ]
     123             :     
     124     1489176 :     call physics_ptend_init(ptend,state%psetcols,'none') !Initialize an empty ptend for use with physics_update
     125             : 
     126     1489176 :     if (present(prec_str))  prec_str(:)    = 0._r8
     127     1489176 :     if (present(snow_str))  snow_str(:)    = 0._r8
     128     1489176 :     if (present(prec_sed))  prec_sed(:)    = 0._r8
     129     1489176 :     if (present(snow_sed))  snow_sed(:)    = 0._r8
     130             : 
     131     1489176 :     return
     132     1489176 :   end subroutine carma_timestep_tend
     133             : 
     134             : 
     135           0 :   subroutine carma_init_cnst(name, latvals, lonvals, mask, q)
     136             :     implicit none
     137             : 
     138             :     character(len=*), intent(in)  :: name       !! constituent name
     139             :     real(r8),         intent(in)  :: latvals(:) !! lat in degrees (ncol)
     140             :     real(r8),         intent(in)  :: lonvals(:) !! lon in degrees (ncol)
     141             :     logical,          intent(in)  :: mask(:)    !! Only initialize where .true.
     142             :     real(r8),         intent(out) :: q(:,:)     !! mass mixing ratio
     143             :     
     144           0 :     if (name == "carma") then
     145           0 :       q = 0._r8
     146             :     end if 
     147             :     
     148           0 :     return
     149     1489176 :   end subroutine carma_init_cnst
     150             : 
     151             : 
     152           0 :   subroutine carma_emission_tend(state, ptend, cam_in, dt)
     153             :     use camsrfexch,       only: cam_in_t
     154             : 
     155             :     implicit none
     156             :     
     157             :     type(physics_state), intent(in )    :: state                !! physics state
     158             :     type(physics_ptend), intent(inout)  :: ptend                !! physics state tendencies
     159             :     type(cam_in_t),      intent(inout)  :: cam_in               !! surface inputs
     160             :     real(r8),            intent(in)     :: dt                   !! time step (s)
     161             : 
     162           0 :     return
     163           0 :   end subroutine carma_emission_tend 
     164             : 
     165             : 
     166           0 :   subroutine carma_wetdep_tend(state, ptend, dt,  pbuf, dlf, cam_out)
     167           0 :     use camsrfexch,       only: cam_out_t
     168             : 
     169             :     implicit none
     170             : 
     171             :     real(r8),             intent(in)    :: dt             !! time step (s)
     172             :     type(physics_state),  intent(in )   :: state          !! physics state
     173             :     type(physics_ptend),  intent(inout) :: ptend          !! physics state tendencies
     174             :     type(physics_buffer_desc), pointer  :: pbuf(:)        !! physics buffer
     175             :     real(r8), intent(in)                :: dlf(pcols,pver)       !! Detraining cld H20 from convection (kg/kg/s)
     176             :     type(cam_out_t),      intent(inout) :: cam_out        !! cam output to surface models
     177             : 
     178           0 :     return
     179           0 :   end subroutine carma_wetdep_tend
     180             : 
     181             : 
     182      369408 :   subroutine carma_accumulate_stats()
     183             :     implicit none
     184             : 
     185           0 :   end subroutine carma_accumulate_stats
     186             : end module carma_intr

Generated by: LCOV version 1.14