Skip to content

Commit

Permalink
Merge pull request #138 from AndrewWilliams3142/spectral_lw
Browse files Browse the repository at this point in the history
Option to output spectrally-decomposed TOA flux from RRTMG_LW
  • Loading branch information
brian-rose committed May 6, 2021
2 parents 3c441f7 + 8c7f895 commit 9b4ab07
Show file tree
Hide file tree
Showing 8 changed files with 1,129 additions and 15 deletions.
1 change: 1 addition & 0 deletions climlab/domain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
from climlab.domain.domain import single_column, zonal_mean_surface, surface_2D, zonal_mean_column, box_model_domain
from climlab.domain.initial import column_state, surface_state
from climlab.domain.field import Field, global_mean
from climlab.domain.axis import Axis
6 changes: 6 additions & 0 deletions climlab/radiation/radiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
Additional input arguments for LW:
- ``emissivity = 1.``, # surface emissivity
- ``return_spectral_olr = False``, # Whether or not to return spectrally-decomposed Outgoing Longwave Radiation (implemented for RRTMG only)
Shortave processes compute these diagnostics (minimum):
Expand Down Expand Up @@ -69,6 +70,10 @@
- ``LW_flux_net_clr`` (clear-sky flux)
- ``TdotLW`` (K/day, radiative heating rate)
- ``TdotLW_clr`` (clear-sky heating rate)
If ``return_spectral_olr = True`` (RRTMG only), an additional diagnostic is produced:
- ``OLR_spectral`` (W/m2, Outgoing Longwave Radiation at TOA in spectral bands, **positive up**)
'''

from __future__ import division
Expand Down Expand Up @@ -274,6 +279,7 @@ def __init__(self,
self.add_diagnostic('TdotLW_clr', 0.*self.Tatm)
self.add_diagnostic('LW_sfc', 0.*self.Ts)
self.add_diagnostic('LW_sfc_clr', 0.*self.Ts)

# Flux diagnostics at layer interfaces
# These need an extra vertical level
interface_zero = init_interface(self.Tatm)
Expand Down
12 changes: 8 additions & 4 deletions climlab/radiation/rrtm/_rrtmg_lw/Driver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ end subroutine climlab_mcica_subcol_lw


subroutine climlab_rrtmg_lw &
(ncol ,nlay ,icld ,idrv , &
(ncol ,nlay ,icld , ispec , idrv , &
play , plev , tlay , tlev , tsfc , &
h2ovmr , o3vmr , co2vmr , ch4vmr , n2ovmr , o2vmr , &
cfc11vmr, cfc12vmr, cfc22vmr, ccl4vmr , emis , &
inflglw , iceflglw, liqflglw, cldfmcl , &
taucmcl , ciwpmcl , clwpmcl , reicmcl , relqmcl , tauaer , &
uflx , dflx , hr , uflxc , dflxc, hrc, &
olr_sr , uflx , dflx , hr , uflxc , dflxc, hrc, &
duflx_dt,duflxc_dt)

! Modules
Expand All @@ -110,6 +110,8 @@ subroutine climlab_rrtmg_lw &
integer, parameter :: rb = selected_real_kind(12)
integer(kind=im), intent(in) :: ncol ! number of columns
integer(kind=im), intent(in) :: nlay ! number of model layers
integer(kind=im), intent(inout) :: icld ! Cloud overlap method
integer(kind=im), intent(inout) :: ispec ! spectral OLR output flag
integer(kind=im), intent(in) :: idrv ! Flag for calculation of dFdT, the change
! in upward flux as a function of
! surface temperature [0=off, 1=on]
Expand Down Expand Up @@ -145,6 +147,7 @@ subroutine climlab_rrtmg_lw &
real(kind=rb), intent(in) :: taucmcl(ngptlw,ncol,nlay) ! in-cloud optical depth [mcica]

! Output
real(kind=rb), intent(out) :: olr_sr(ncol,nbndlw) ! Spectrally-decomposed OLR (W/m2)
real(kind=rb), intent(out) :: uflx(ncol,nlay+1) ! Total sky longwave upward flux (W/m2)
real(kind=rb), intent(out) :: dflx(ncol,nlay+1) ! Total sky longwave downward flux (W/m2)
real(kind=rb), intent(out) :: hr(ncol,nlay) ! Total sky longwave radiative heating rate (K/d)
Expand All @@ -162,19 +165,20 @@ subroutine climlab_rrtmg_lw &
!f2py depend(ncol,nlay) h2ovmr,o3vmr,co2vmr,ch4vmr,n2ovmr,o2vmr
!f2py depend(ncol,nlay) cfc11vmr,cfc12vmr,cfc22vmr,ccl4vmr
!f2py depend(ncol) tsfc, emis
!f2py depend(ncol) olr_sr
!f2py depend(ncol,nlay) tauaer
!f2py depend(ncol,nlay) cldfmcl,ciwpmcl,clwpmcl,taucmcl
!f2py depend(ncol,nlay) reicmcl,relqmcl
!f2py depend(ncol,nlay) uflx,dflx,hr,uflxc,dflxc,hrc,duflx_dt,duflxc_dt

! Call the RRTMG_LW driver to compute radiative fluxes
call rrtmg_lw(ncol ,nlay ,icld ,idrv , &
call rrtmg_lw(ncol ,nlay ,icld ,ispec ,idrv , &
play , plev , tlay , tlev , tsfc , &
h2ovmr , o3vmr , co2vmr , ch4vmr , n2ovmr , o2vmr , &
cfc11vmr, cfc12vmr, cfc22vmr, ccl4vmr , emis , &
inflglw , iceflglw, liqflglw, cldfmcl , &
taucmcl , ciwpmcl , clwpmcl , reicmcl , relqmcl , tauaer , &
uflx , dflx , hr , uflxc , dflxc, hrc, &
olr_sr , uflx , dflx , hr , uflxc , dflxc, hrc, &
duflx_dt,duflxc_dt )

end subroutine climlab_rrtmg_lw
8 changes: 5 additions & 3 deletions climlab/radiation/rrtm/_rrtmg_lw/_rrtmg_lw.pyf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! -*- f90 -*-
! Note: the context of this file is case sensitive.

python module _rrtmg_lw ! in
python module _rrtmg_lw ! in
interface ! in :_rrtmg_lw
module parrrtm ! in :_rrtmg_lw:rrtmg_lw_v4.85/gcm_model/modules/parrrtm.f90
use parkind, only: im=>kind_im
Expand Down Expand Up @@ -438,13 +438,14 @@ python module _rrtmg_lw ! in
real(kind=8) dimension(ncol,nlay),intent(out),depend(ncol,nlay) :: relqmcl
real(kind=8) dimension(140,ncol,nlay),intent(out),depend(ncol,nlay) :: taucmcl
end subroutine climlab_mcica_subcol_lw
subroutine climlab_rrtmg_lw(ncol,nlay,icld,idrv,play,plev,tlay,tlev,tsfc,h2ovmr,o3vmr,co2vmr,ch4vmr,n2ovmr,o2vmr,cfc11vmr,cfc12vmr,cfc22vmr,ccl4vmr,emis,inflglw,iceflglw,liqflglw,cldfmcl,taucmcl,ciwpmcl,clwpmcl,reicmcl,relqmcl,tauaer,uflx,dflx,hr,uflxc,dflxc,hrc,duflx_dt,duflxc_dt) ! in :_rrtmg_lw:Driver.f90
subroutine climlab_rrtmg_lw(ncol,nlay,icld,ispec,idrv,play,plev,tlay,tlev,tsfc,h2ovmr,o3vmr,co2vmr,ch4vmr,n2ovmr,o2vmr,cfc11vmr,cfc12vmr,cfc22vmr,ccl4vmr,emis,inflglw,iceflglw,liqflglw,cldfmcl,taucmcl,ciwpmcl,clwpmcl,reicmcl,relqmcl,tauaer,olr_sr,uflx,dflx,hr,uflxc,dflxc,hrc,duflx_dt,duflxc_dt) ! in :_rrtmg_lw:Driver.f90
use rrtmg_lw_rad, only: rrtmg_lw
use parkind, only: im=>kind_im
use parrrtm, only: nbndlw,ngptlw
integer(kind=im) intent(in) :: ncol
integer(kind=im) intent(in) :: nlay
integer :: icld
integer :: ispec
integer(kind=im) intent(in) :: idrv
real(kind=8) dimension(ncol,nlay),intent(in),depend(ncol,nlay) :: play
real(kind=8) dimension(ncol,nlay + 1),intent(in),depend(ncol,nlay) :: plev
Expand Down Expand Up @@ -472,6 +473,7 @@ python module _rrtmg_lw ! in
real(kind=8) dimension(ncol,nlay),intent(in),depend(ncol,nlay) :: reicmcl
real(kind=8) dimension(ncol,nlay),intent(in),depend(ncol,nlay) :: relqmcl
real(kind=8) dimension(ncol,nlay,16),intent(in),depend(ncol,nlay) :: tauaer
real(kind=8) dimension(ncol,16),intent(out),depend(ncol) :: olr_sr
real(kind=8) dimension(ncol,nlay + 1),intent(out),depend(ncol,nlay) :: uflx
real(kind=8) dimension(ncol,nlay + 1),intent(out),depend(ncol,nlay) :: dflx
real(kind=8) dimension(ncol,nlay),intent(out),depend(ncol,nlay) :: hr
Expand All @@ -481,7 +483,7 @@ python module _rrtmg_lw ! in
real(kind=8) dimension(ncol,nlay + 1),intent(out),depend(ncol,nlay) :: duflx_dt
real(kind=8) dimension(ncol,nlay + 1),intent(out),depend(ncol,nlay) :: duflxc_dt
end subroutine climlab_rrtmg_lw
end interface
end interface
end python module _rrtmg_lw

! This file was auto-generated with f2py (version:2).
Expand Down
3 changes: 2 additions & 1 deletion climlab/radiation/rrtm/_rrtmg_lw/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
'rrtmg_lw_init.f90',
'rrtmg_lw_rad.f90',]
unoptimized_src = ['rrtmg_lw_k_g.f90']
mod_src = ['rrtmg_lw_setcoef.f90',]
mod_src = ['rrtmg_lw_setcoef.f90',
'rrtmg_lw_rad.f90',]

def configuration(parent_package='', top_path=None):
global config
Expand Down

0 comments on commit 9b4ab07

Please sign in to comment.