Skip to content
Merged
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
@@ -0,0 +1 @@
force_send_to_atm = .true.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flds_co2b = .true.
16 changes: 15 additions & 1 deletion src/main/clm_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,21 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro
! don't have explicit bounds on the left-hand-side of this assignment: excluding these
! explicit bounds seemed to be needed to get around other compiler bugs.
allocate(net_carbon_exchange_grc(bounds_proc%begg:bounds_proc%endg))
net_carbon_exchange_grc = bgc_vegetation_inst%get_net_carbon_exchange_grc(bounds_proc)
if (.not. use_fates) then
net_carbon_exchange_grc = bgc_vegetation_inst%get_net_carbon_exchange_grc(bounds_proc)
else
net_carbon_exchange_grc(bounds_proc%begg:bounds_proc%endg) = 0.0_r8
if (use_fates_bgc) then
!$OMP PARALLEL DO PRIVATE (nc, bounds_clump)
do nc = 1,nclumps
call get_clump_bounds(nc, bounds_clump)
call clm_fates%wrap_co2_to_atm(bounds_clump, &
filter_inactive_and_active(nc)%num_bgc_soilc, filter_inactive_and_active(nc)%bgc_soilc, &
soilbiogeochem_carbonflux_inst, net_carbon_exchange_grc(bounds_clump%begg:bounds_clump%endg))
end do
!$OMP END PARALLEL DO
endif
endif

call lnd2atm(bounds_proc, &
atm2lnd_inst, surfalb_inst, temperature_inst, frictionvel_inst, &
Expand Down
48 changes: 48 additions & 0 deletions src/utils/clmfates_interfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ module CLMFatesInterfaceMod
procedure, public :: wrap_hydraulics_drive
procedure, public :: WrapUpdateFatesRmean
procedure, public :: wrap_WoodProducts
procedure, public :: wrap_co2_to_atm
procedure, public :: WrapGlobalSeedDispersal
procedure, public :: WrapUpdateFatesSeedInOut
procedure, public :: UpdateCLitterFluxes
Expand Down Expand Up @@ -2904,6 +2905,53 @@ subroutine wrap_WoodProducts(this, bounds_clump, num_soilc, filter_soilc, &

return
end subroutine wrap_WoodProducts

! ==============================================================================

subroutine wrap_co2_to_atm(this, bounds_clump, num_soilc, filter_soilc, &
soilbiogeochem_carbonflux_inst, net_carbon_exchange_grc)

! USES
use subgridAveMod, only : c2g
use FatesConstantsMod, only: g_per_kg
! !ARGUMENTS:
class(hlm_fates_interface_type) , intent(inout) :: this
type(bounds_type) , intent(in) :: bounds_clump
integer , intent(in) :: num_soilc ! size of column filter
integer , intent(in) :: filter_soilc(:) ! column filter
type(soilbiogeochem_carbonflux_type), intent(in) :: soilbiogeochem_carbonflux_inst
real(r8) , intent(inout) :: net_carbon_exchange_grc(bounds_clump%begg:bounds_clump%endg)

! Locals
integer :: s,c,g,fc
integer :: ci ! Clump index
real(r8) :: net_carbon_exchange_col(bounds_clump%begc:bounds_clump%endc)

net_carbon_exchange_col(bounds_clump%begc:bounds_clump%endc) = 0.0_r8
net_carbon_exchange_grc(bounds_clump%begg:bounds_clump%endg) = 0.0_r8
ci = bounds_clump%clump_index

! Loop over columns
do fc = 1, num_soilc

c = filter_soilc(fc)
s = this%f2hmap(ci)%hsites(c)
! nbp = npp -fire - graz - soil respiratation
! hr_col is updated above this call in CNDriver summaries
net_carbon_exchange_col(c) = this%fates(ci)%bc_out(s)%npp_site - &
(this%fates(ci)%bc_out(s)%grazing_closs_to_atm_si + &
this%fates(ci)%bc_out(s)%fire_closs_to_atm_si) * g_per_kg - &
soilbiogeochem_carbonflux_inst%hr_col(c)
end do
call c2g( bounds = bounds_clump, &
carr = net_carbon_exchange_col(bounds_clump%begc:bounds_clump%endc), &
garr = net_carbon_exchange_grc(bounds_clump%begg:bounds_clump%endg), &
c2l_scale_type = 'unity', &
l2g_scale_type = 'unity')
! change sign, same way it is done in get_net_carbon_exchange
net_carbon_exchange_grc(bounds_clump%begg:bounds_clump%endg) = - net_carbon_exchange_grc(bounds_clump%begg:bounds_clump%endg)

end subroutine wrap_co2_to_atm

! ======================================================================================

Expand Down