Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to output spectrally-decomposed TOA flux from RRTMG_LW #138

Merged
merged 36 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
753c443
new sourcemod files
AndrewILWilliams Jan 7, 2021
36cc9dc
Adding modified source files to setup.py in setup.py
AndrewILWilliams Jan 7, 2021
35af8d9
Adding olr_sr to Driver.f90
AndrewILWilliams Jan 7, 2021
5f279bf
fixed typo in Driver.f90
AndrewILWilliams Jan 7, 2021
19e8161
adding olr_sr to _rrtmg_lw.pyf
AndrewILWilliams Jan 7, 2021
5bf480b
Adding changes to sourcemod
AndrewILWilliams Jan 7, 2021
f3f5e52
Adding toaflux_sr output in loop over bands
AndrewILWilliams Jan 7, 2021
4a9d544
fixed typo
AndrewILWilliams Jan 7, 2021
35ce703
adding changes to RRTMG python interface and Radiation_LW class
AndrewILWilliams Jan 7, 2021
3b20952
fixed typo in mod_src list
AndrewILWilliams Jan 7, 2021
9dbdc65
editing so current tests pass
AndrewILWilliams Jan 7, 2021
26d320b
Add RRTMG_LW band wavenumbers to diagnostics
AndrewILWilliams Jan 7, 2021
2d83590
remove 'delwave' in spectral olr calc
AndrewILWilliams Jan 7, 2021
3399e0b
rrmtg_lw bands shouldnt be a diangostic
AndrewILWilliams Jan 7, 2021
c2ec3ec
add test for spectral olr
AndrewILWilliams Jan 7, 2021
fbd3acf
fix typo
AndrewILWilliams Jan 7, 2021
893d174
working on tessts
AndrewILWilliams Jan 7, 2021
7408400
removing extraneous comments
AndrewILWilliams Jan 7, 2021
f9088ed
Merge branch 'master' of https://github.com/brian-rose/climlab into s…
AndrewILWilliams Jan 14, 2021
3202e05
Merge branch 'master' of https://github.com/brian-rose/climlab into s…
AndrewILWilliams Jan 15, 2021
4fecc24
Fixed typo in toaflux_sr declaration which had indexing start at 0
AndrewILWilliams Jan 15, 2021
408b7ed
Make band loop more explicit in rrtmg
AndrewILWilliams Jan 15, 2021
7a46c63
tidying
AndrewILWilliams Jan 15, 2021
9bc08d9
tidying
AndrewILWilliams Jan 15, 2021
f16ea9a
implementing new approach from Mike Iacono. Use an 'ispec' output flag
AndrewILWilliams Jan 20, 2021
06af6fe
Fixing tests
AndrewILWilliams Jan 20, 2021
d46b9d0
Merge branch 'master' into spectral_lw
AndrewILWilliams Apr 30, 2021
79e0fe2
adding !CLIMLAB to sourcemods
AndrewILWilliams May 5, 2021
a71ea97
more CLIMLAB declarations
AndrewILWilliams May 5, 2021
2d69426
single time-step spectral_olr test
AndrewILWilliams May 5, 2021
73aa639
Remove ispec from RRTMG process input arguments (redundant)
brian-rose May 5, 2021
1780996
Wrap spectral output in a Field object with wavenumber axis
brian-rose May 6, 2021
274140e
Add xarray interface test (currently failing?)
brian-rose May 6, 2021
23c3954
Fix the axes reordering hack so to_xarray() works
brian-rose May 6, 2021
81e2b5a
Merge branch 'main' into spectral_lw
brian-rose May 6, 2021
8c7f895
Change OLR_sr to OLR_spectral, slight docstring improvement
brian-rose May 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading