LCOV - code coverage report
Current view: top level - atmos_phys/schemes/cloud_fraction - cloud_fraction_fice.F90 (source / functions) Hit Total Coverage
Test: coverage.info Lines: 22 22 100.0 %
Date: 2025-03-13 19:21:45 Functions: 1 1 100.0 %

          Line data    Source code
       1             : module cloud_fraction_fice
       2             : 
       3             :   use ccpp_kinds, only:  kind_phys
       4             :   implicit none
       5             : 
       6             : contains
       7             : 
       8             : !================================================================================================
       9             : 
      10             : !===============================================================================
      11             : !> \section arg_table_cloud_fraction_fice_run Argument Table
      12             : !! \htmlinclude cloud_fraction_fice_run.html
      13             : !!
      14       65016 :   subroutine cloud_fraction_fice_run(ncol, t, tmelt, top_lev, pver, fice, fsnow, errmsg, errflg)
      15             : !
      16             : ! Compute the fraction of the total cloud water which is in ice phase.
      17             : ! The fraction depends on temperature only.
      18             : ! This is the form that was used for radiation, the code came from cldefr originally
      19             : !
      20             : ! Author: B. A. Boville Sept 10, 2002
      21             : !  modified: PJR 3/13/03 (added fsnow to ascribe snow production for convection )
      22             : !-----------------------------------------------------------------------
      23             : 
      24             : ! Arguments
      25             :     integer,            intent(in)  :: ncol          ! number of active columns (count)
      26             :     real(kind_phys),    intent(in)  :: t(:,:)        ! temperature (K)
      27             :     real(kind_phys),    intent(in)  :: tmelt         ! freezing point of water (K)
      28             :     integer,            intent(in)  :: top_lev       ! Vertical layer index for highest layer with tropopheric clouds (index)
      29             :     integer,            intent(in)  :: pver          ! Number of vertical layers (count)
      30             : 
      31             :     real(kind_phys),    intent(out) :: fice(:,:)     ! Fractional ice content within cloud
      32             :     real(kind_phys),    intent(out) :: fsnow(:,:)    ! Fractional snow content for convection
      33             : 
      34             :     character(len=512), intent(out) :: errmsg
      35             :     integer,            intent(out) :: errflg
      36             : 
      37             : ! Local variables
      38             :     real(kind_phys) :: tmax_fice                         ! max temperature for cloud ice formation
      39             :     real(kind_phys) :: tmin_fice                         ! min temperature for cloud ice formation
      40             :     real(kind_phys) :: tmax_fsnow                        ! max temperature for transition to convective snow
      41             :     real(kind_phys) :: tmin_fsnow                        ! min temperature for transition to convective snow
      42             : 
      43             :     integer :: i,k                                ! loop indexes
      44             : 
      45             : !-----------------------------------------------------------------------
      46             : 
      47       65016 :     errmsg = ''
      48       65016 :     errflg = 0
      49             : 
      50       65016 :     tmax_fice = tmelt - 10._kind_phys        ! max temperature for cloud ice formation
      51       65016 :     tmin_fice = tmax_fice - 30._kind_phys    ! min temperature for cloud ice formation
      52       65016 :     tmax_fsnow = tmelt                ! max temperature for transition to convective snow
      53       65016 :     tmin_fsnow = tmelt - 5._kind_phys        ! min temperature for transition to convective snow
      54             : 
      55     9900576 :     fice(:,:top_lev-1) = 0._kind_phys
      56     9900576 :     fsnow(:,:top_lev-1) = 0._kind_phys
      57             : 
      58             : ! Define fractional amount of cloud that is ice
      59     5526360 :     do k=top_lev,pver
      60    91256760 :        do i=1,ncol
      61             : 
      62             : ! If warmer than tmax then water phase
      63    85730400 :           if (t(i,k) > tmax_fice) then
      64    22038741 :              fice(i,k) = 0.0_kind_phys
      65             : 
      66             : ! If colder than tmin then ice phase
      67    63691659 :           else if (t(i,k) < tmin_fice) then
      68    46557651 :              fice(i,k) = 1.0_kind_phys
      69             : 
      70             : ! Otherwise mixed phase, with ice fraction decreasing linearly from tmin to tmax
      71             :           else
      72    17134008 :              fice(i,k) =(tmax_fice - t(i,k)) / (tmax_fice - tmin_fice)
      73             :           end if
      74             : 
      75             : ! snow fraction partitioning
      76             : 
      77             : ! If warmer than tmax then water phase
      78    91191744 :           if (t(i,k) > tmax_fsnow) then
      79    16463434 :              fsnow(i,k) = 0.0_kind_phys
      80             : 
      81             : ! If colder than tmin then ice phase
      82    69266966 :           else if (t(i,k) < tmin_fsnow) then
      83    66504696 :              fsnow(i,k) = 1.0_kind_phys
      84             : 
      85             : ! Otherwise mixed phase, with ice fraction decreasing linearly from tmin to tmax
      86             :           else
      87     2762270 :              fsnow(i,k) =(tmax_fsnow - t(i,k)) / (tmax_fsnow - tmin_fsnow)
      88             :           end if
      89             : 
      90             :        end do
      91             :     end do
      92             : 
      93       65016 :   end subroutine cloud_fraction_fice_run
      94             : 
      95             : end module cloud_fraction_fice

Generated by: LCOV version 1.14