LCOV - code coverage report
Current view: top level - icepack/columnphysics - icepack_ocean.F90 (source / functions) Hit Total Coverage
Test: 210705-232000:85531cf8f8:8:first,base,travis,decomp,reprosum,io,quick,unittest Lines: 15 15 100.00 %
Date: 2021-07-06 02:48:38 Functions: 1 1 100.00 %

          Line data    Source code
       1             : !=======================================================================
       2             : 
       3             : ! Ocean boundary interface
       4             : 
       5             :       module icepack_ocean
       6             : 
       7             :       use icepack_kinds
       8             :       use icepack_parameters, only: c0, c1, c1000
       9             :       use icepack_parameters, only: Tffresh, stefan_boltzmann, Lvap, cprho
      10             :       use icepack_warnings, only: warnstr, icepack_warnings_add
      11             :       use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted
      12             : 
      13             :       implicit none
      14             : 
      15             :       private
      16             :       public :: icepack_ocn_mixed_layer
      17             : 
      18             : !=======================================================================
      19             : 
      20             :       contains
      21             : 
      22             : !=======================================================================
      23             : !=======================================================================
      24             : !autodocument_start icepack_ocn_mixed_layer
      25             : ! Compute the mixed layer heat balance and update the SST.
      26             : ! Compute the energy available to freeze or melt ice.
      27             : ! NOTE: SST changes due to fluxes through the ice are computed in
      28             : !       icepack_therm_vertical.
      29             : 
      30  1321822440 :       subroutine icepack_ocn_mixed_layer (alvdr_ocn, swvdr,      &
      31             :                                          alidr_ocn, swidr,      &   ! LCOV_EXCL_LINE
      32             :                                          alvdf_ocn, swvdf,      &   ! LCOV_EXCL_LINE
      33             :                                          alidf_ocn, swidf,      &   ! LCOV_EXCL_LINE
      34             :                                          sst,       flwout_ocn, &   ! LCOV_EXCL_LINE
      35             :                                          fsens_ocn, shcoef,     &   ! LCOV_EXCL_LINE
      36             :                                          flat_ocn,  lhcoef,     &   ! LCOV_EXCL_LINE
      37             :                                          evap_ocn,  flw,        &   ! LCOV_EXCL_LINE
      38             :                                          delt,      delq,       &   ! LCOV_EXCL_LINE
      39             :                                          aice,      fhocn,      &   ! LCOV_EXCL_LINE
      40             :                                          fswthru,   hmix,       &   ! LCOV_EXCL_LINE
      41             :                                          Tf,        qdp,        &   ! LCOV_EXCL_LINE
      42             :                                          frzmlt,    dt)
      43             : 
      44             :       real (kind=dbl_kind), intent(in) :: &
      45             :          alvdr_ocn , & ! visible, direct   (fraction)   ! LCOV_EXCL_LINE
      46             :          alidr_ocn , & ! near-ir, direct   (fraction)   ! LCOV_EXCL_LINE
      47             :          alvdf_ocn , & ! visible, diffuse  (fraction)   ! LCOV_EXCL_LINE
      48             :          alidf_ocn , & ! near-ir, diffuse  (fraction)   ! LCOV_EXCL_LINE
      49             :          swvdr     , & ! sw down, visible, direct  (W/m^2)   ! LCOV_EXCL_LINE
      50             :          swvdf     , & ! sw down, visible, diffuse (W/m^2)   ! LCOV_EXCL_LINE
      51             :          swidr     , & ! sw down, near IR, direct  (W/m^2)   ! LCOV_EXCL_LINE
      52             :          swidf     , & ! sw down, near IR, diffuse (W/m^2)   ! LCOV_EXCL_LINE
      53             :          flw       , & ! incoming longwave radiation (W/m^2)   ! LCOV_EXCL_LINE
      54             :          Tf        , & ! freezing temperature (C)   ! LCOV_EXCL_LINE
      55             :          hmix      , & ! mixed layer depth (m)   ! LCOV_EXCL_LINE
      56             :          delt      , & ! potential temperature difference   (K)   ! LCOV_EXCL_LINE
      57             :          delq      , & ! specific humidity difference   (kg/kg)   ! LCOV_EXCL_LINE
      58             :          shcoef    , & ! transfer coefficient for sensible heat   ! LCOV_EXCL_LINE
      59             :          lhcoef    , & ! transfer coefficient for latent heat   ! LCOV_EXCL_LINE
      60             :          fhocn     , & ! net heat flux to ocean (W/m^2)   ! LCOV_EXCL_LINE
      61             :          fswthru   , & ! shortwave penetrating to ocean (W/m^2)   ! LCOV_EXCL_LINE
      62             :          aice      , & ! ice area fraction   ! LCOV_EXCL_LINE
      63             :          dt            ! time step (s)
      64             : 
      65             :       real (kind=dbl_kind), intent(inout) :: &
      66             :          flwout_ocn, & ! outgoing longwave radiation (W/m^2)   ! LCOV_EXCL_LINE
      67             :          fsens_ocn , & ! sensible heat flux (W/m^2)   ! LCOV_EXCL_LINE
      68             :          flat_ocn  , & ! latent heat flux   (W/m^2)   ! LCOV_EXCL_LINE
      69             :          evap_ocn  , & ! evaporative water flux (kg/m^2/s)   ! LCOV_EXCL_LINE
      70             :          qdp       , & ! deep ocean heat flux (W/m^2), negative upward   ! LCOV_EXCL_LINE
      71             :          sst       , & ! sea surface temperature (C)   ! LCOV_EXCL_LINE
      72             :          frzmlt        ! freezing/melting potential (W/m^2)
      73             : 
      74             : !autodocument_end
      75             : 
      76             :       ! local variables
      77             : 
      78             :       real (kind=dbl_kind), parameter :: &
      79             :          frzmlt_max = c1000   ! max magnitude of frzmlt (W/m^2)
      80             : 
      81             :       real (kind=dbl_kind) :: &
      82             :          TsfK , & ! surface temperature (K)   ! LCOV_EXCL_LINE
      83   133258416 :          swabs    ! surface absorbed shortwave heat flux (W/m^2)
      84             : 
      85             :       character(len=*),parameter :: subname='(icepack_ocn_mixed_layer)'
      86             : 
      87             :       ! shortwave radiative flux
      88             :       swabs = (c1-alvdr_ocn) * swvdr + (c1-alidr_ocn) * swidr &
      89  1321822440 :             + (c1-alvdf_ocn) * swvdf + (c1-alidf_ocn) * swidf 
      90             : 
      91             :       ! ocean surface temperature in Kelvin
      92  1321822440 :       TsfK = sst + Tffresh
      93             : 
      94             :       ! longwave radiative flux
      95  1321822440 :       flwout_ocn = -stefan_boltzmann * TsfK**4
      96             : 
      97             :       ! downward latent and sensible heat fluxes
      98  1321822440 :       fsens_ocn =  shcoef * delt
      99  1321822440 :       flat_ocn  =  lhcoef * delq
     100  1321822440 :       evap_ocn  = -flat_ocn / Lvap
     101             : 
     102             :       ! Compute sst change due to exchange with atm/ice above
     103             :       sst = sst + dt * ( &
     104             :             (fsens_ocn + flat_ocn + flwout_ocn + flw + swabs) * (c1-aice) &   ! LCOV_EXCL_LINE
     105             :           + fhocn + fswthru)         &  ! these are *aice   ! LCOV_EXCL_LINE
     106  1321822440 :           / (cprho*hmix)
     107             : 
     108             :       ! adjust qdp if cooling of mixed layer would occur when sst <= Tf
     109  1321822440 :       if (sst <= Tf .and. qdp > c0) qdp = c0
     110             : 
     111             :       ! computed T change due to exchange with deep layers:
     112  1321822440 :       sst = sst - qdp*dt/(cprho*hmix)
     113             : 
     114             :       ! compute potential to freeze or melt ice
     115  1321822440 :       frzmlt = (Tf-sst)*cprho*hmix/dt
     116  1321822440 :       frzmlt = min(max(frzmlt,-frzmlt_max),frzmlt_max)
     117             : 
     118             :       ! if sst is below freezing, reset sst to Tf
     119  1321822440 :       if (sst <= Tf) sst = Tf
     120             : 
     121  1321822440 :       end subroutine icepack_ocn_mixed_layer
     122             : 
     123             : !=======================================================================
     124             : 
     125             :       end module icepack_ocean
     126             : 
     127             : !=======================================================================

Generated by: LCOV version 1.14-6-g40580cd