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

Make CO2 a function of year instead of a single constant #1173

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module mpas_atmphys_driver_radiation_lw
use mpas_atmphys_camrad_init
use mpas_atmphys_rrtmg_lwinit
use mpas_atmphys_vars
use mpas_atmphys_functions, only: co2_estimate

!wrf physics:
use module_ra_cam
Expand Down Expand Up @@ -835,6 +836,7 @@ subroutine driver_radiation_lw(xtime_s,configs,mesh,state,time_lev,diag_physics,
!local variables:
integer:: o3input
real(kind=RKIND):: radt,xtime_m
real(kind=RKIND):: co2

!-----------------------------------------------------------------------------------------------------------------
!call mpas_log_write(' --- enter subroutine driver_radiation_lw: ')
Expand All @@ -851,6 +853,7 @@ subroutine driver_radiation_lw(xtime_s,configs,mesh,state,time_lev,diag_physics,
case ("rrtmg_lw")
o3input = 0
if(config_o3climatology) o3input = 2
co2 = co2_estimate(year,curr_julday)

call mpas_timer_start('RRTMG_lw')
call rrtmg_lwrad( &
Expand All @@ -870,6 +873,7 @@ subroutine driver_radiation_lw(xtime_s,configs,mesh,state,time_lev,diag_physics,
rre_snow = rresnow_p , lwupt = lwupt_p , lwuptc = lwuptc_p , &
lwdnt = lwdnt_p , lwdntc = lwdntc_p , lwupb = lwupb_p , &
lwupbc = lwupbc_p , lwdnb = lwdnb_p , lwdnbc = lwdnbc_p , &
co2 = co2 , &
ids = ids , ide = ide , jds = jds , jde = jde , kds = kds , kde = kde , &
ims = ims , ime = ime , jms = jms , jme = jme , kms = kms , kme = kme , &
its = its , ite = ite , jts = jts , jte = jte , kts = kts , kte = kte &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module mpas_atmphys_driver_radiation_sw
use mpas_atmphys_camrad_init
use mpas_atmphys_rrtmg_swinit
use mpas_atmphys_vars
use mpas_atmphys_functions, only: co2_estimate

!wrf physics:
use module_ra_cam
Expand Down Expand Up @@ -733,6 +734,7 @@ subroutine driver_radiation_sw(itimestep,configs,mesh,state,time_lev,diag_physic
!local variables:
integer:: o3input
real(kind=RKIND):: radt,xtime_m
real(kind=RKIND):: co2

!-----------------------------------------------------------------------------------------------------------------
!call mpas_log_write(' --- enter subroutine driver_radiation_sw: $i',intArgs=(/itimestep/))
Expand Down Expand Up @@ -770,6 +772,7 @@ subroutine driver_radiation_sw(itimestep,configs,mesh,state,time_lev,diag_physic
case ("rrtmg_sw")
o3input = 0
if(config_o3climatology) o3input = 2
co2 = co2_estimate(year,curr_julday)

call mpas_timer_start('RRTMG_sw')
call rrtmg_swrad( &
Expand All @@ -792,6 +795,7 @@ subroutine driver_radiation_sw(itimestep,configs,mesh,state,time_lev,diag_physic
swdnt = swdnt_p , swdntc = swdntc_p , swupb = swupb_p , &
swupbc = swupbc_p , swdnb = swdnb_p , swdnbc = swdnbc_p , &
swddir = swddir_p , swddni = swddni_p , swddif = swddif_p , &
co2 = co2 , &
ids = ids , ide = ide , jds = jds , jde = jde , kds = kds , kde = kde , &
ims = ims , ime = ime , jms = jms , jme = jme , kms = kms , kme = kme , &
its = its , ite = ite , jts = jts , jte = jte , kts = kts , kte = kte &
Expand Down
25 changes: 24 additions & 1 deletion src/core_atmosphere/physics/mpas_atmphys_functions.F
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module mpas_atmphys_functions

implicit none
private
public:: gammln,gammp,wgamma,rslf,rsif
public:: gammln,gammp,wgamma,rslf,rsif,co2_estimate


contains
Expand Down Expand Up @@ -216,6 +216,29 @@ REAL(KIND=RKIND) FUNCTION RSIF(P,T)

END FUNCTION RSIF

!+---+-----------------------------------------------------------------+
! This function calculates CO2 from an equation in WRF by J. Dudhia
!
real(kind=rkind) function co2_estimate(year,curr_julday)

implicit none
integer, intent(in) :: year
real, intent(in) :: curr_julday
real(kind=rkind) :: rdays,ryear
integer :: ny1, ny2, ny3

rdays = 365.
ny1 = mod(year,4)
ny2 = mod(year,100)
ny3 = mod(year,400)
if(ny1.eq.0.and.ny2.ne.0.or.ny3.eq.0) rdays = 366.
ryear = float(year)+curr_julday/rdays

! Annual function for co2 from WRF v4.2
co2_estimate = (280. + 90.*exp(0.02*(ryear-2000.)))*1.e-6

end function co2_estimate

!=================================================================================================================
end module mpas_atmphys_functions
!=================================================================================================================
3 changes: 2 additions & 1 deletion src/core_atmosphere/physics/physics_wrf/module_ra_rrtmg_lw.F
Original file line number Diff line number Diff line change
Expand Up @@ -11482,6 +11482,7 @@ subroutine rrtmg_lwrad( &
lwupt,lwuptc,lwdnt,lwdntc, &
lwupb,lwupbc,lwdnb,lwdnbc, &
lwupflx, lwupflxc, lwdnflx, lwdnflxc, &
co2, &
ids,ide, jds,jde, kds,kde, &
ims,ime, jms,jme, kms,kme, &
its,ite, jts,jte, kts,kte &
Expand Down Expand Up @@ -11565,7 +11566,7 @@ subroutine rrtmg_lwrad( &
!--- set trace gas volume mixing ratios, 2005 values, IPCC (2007):
!carbon dioxide (379 ppmv)
real :: co2
data co2 / 379.e-6 /
!data co2 / 379.e-6 /
!methane (1774 ppbv)
real :: ch4
data ch4 / 1774.e-9 /
Expand Down
3 changes: 2 additions & 1 deletion src/core_atmosphere/physics/physics_wrf/module_ra_rrtmg_sw.F
Original file line number Diff line number Diff line change
Expand Up @@ -9877,6 +9877,7 @@ subroutine rrtmg_swrad( &
swupb,swupbc,swdnb,swdnbc, &
swupflx, swupflxc, swdnflx, swdnflxc, &
swddir,swddni,swddif, &
co2, &
ids,ide, jds,jde, kds,kde, &
ims,ime, jms,jme, kms,kme, &
its,ite, jts,jte, kts,kte &
Expand Down Expand Up @@ -9973,7 +9974,7 @@ subroutine rrtmg_swrad( &
!--- set trace gas volume mixing ratios, 2005 values, IPCC (2007):
!carbon dioxide (379 ppmv)
real :: co2
data co2 / 379.e-6 /
!data co2 / 379.e-6 /
!methane (1774 ppbv)
real :: ch4
data ch4 / 1774.e-9 /
Expand Down