diff --git a/src/core_atmosphere/physics/mpas_atmphys_driver_radiation_lw.F b/src/core_atmosphere/physics/mpas_atmphys_driver_radiation_lw.F index 60dbebb3e5..62aa96739c 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_driver_radiation_lw.F +++ b/src/core_atmosphere/physics/mpas_atmphys_driver_radiation_lw.F @@ -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 @@ -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: ') @@ -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( & @@ -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 & diff --git a/src/core_atmosphere/physics/mpas_atmphys_driver_radiation_sw.F b/src/core_atmosphere/physics/mpas_atmphys_driver_radiation_sw.F index f4b76d8fe8..d9ba45e71c 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_driver_radiation_sw.F +++ b/src/core_atmosphere/physics/mpas_atmphys_driver_radiation_sw.F @@ -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 @@ -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/)) @@ -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( & @@ -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 & diff --git a/src/core_atmosphere/physics/mpas_atmphys_functions.F b/src/core_atmosphere/physics/mpas_atmphys_functions.F index bbc5922667..142dc53dca 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_functions.F +++ b/src/core_atmosphere/physics/mpas_atmphys_functions.F @@ -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 @@ -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 !================================================================================================================= diff --git a/src/core_atmosphere/physics/physics_wrf/module_ra_rrtmg_lw.F b/src/core_atmosphere/physics/physics_wrf/module_ra_rrtmg_lw.F index 6d59bcb82e..10a3f6180d 100644 --- a/src/core_atmosphere/physics/physics_wrf/module_ra_rrtmg_lw.F +++ b/src/core_atmosphere/physics/physics_wrf/module_ra_rrtmg_lw.F @@ -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 & @@ -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 / diff --git a/src/core_atmosphere/physics/physics_wrf/module_ra_rrtmg_sw.F b/src/core_atmosphere/physics/physics_wrf/module_ra_rrtmg_sw.F index be36c4afb1..044042c355 100644 --- a/src/core_atmosphere/physics/physics_wrf/module_ra_rrtmg_sw.F +++ b/src/core_atmosphere/physics/physics_wrf/module_ra_rrtmg_sw.F @@ -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 & @@ -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 /