Skip to content
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 @@ -31,4 +31,7 @@ hist_fincl1 = 'FATES_NCOHORTS', 'FATES_TRIMMING', 'FATES_AREA_PLANTS',
'FATES_SEED_ALLOC', 'FATES_STEM_ALLOC', 'FATES_FROOT_ALLOC',
'FATES_CROOT_ALLOC', 'FATES_STORE_ALLOC',
'FATES_PATCHAREA_LU', 'FATES_DISTURBANCE_RATE_MATRIX_LULU',
'FATES_TRANSITION_MATRIX_LULU'
'FATES_TRANSITION_MATRIX_LULU',
'FATES_VEGC_LUPF','FATES_NOCOMP_PATCHAREA_LUPF',
'FATES_TVEG_LU','FATES_TSA_LU','FATES_SWABS_LU','FATES_NETLW_LU',
'FATES_SHFLUX_LU','FATES_LHFLUX_LU','FATES_GPP_LU'
3 changes: 2 additions & 1 deletion src/main/clm_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,8 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro

call clm_fates%wrap_update_hifrq_hist(bounds_clump, &
soilbiogeochem_carbonflux_inst, &
soilbiogeochem_carbonstate_inst)
soilbiogeochem_carbonstate_inst, &
solarabs_inst, energyflux_inst, temperature_inst)


if( is_beg_curr_day() ) then
Expand Down
3 changes: 3 additions & 0 deletions src/main/histFileMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2583,6 +2583,7 @@ subroutine htape_create (t, f, histrest)
call ncd_defdim(lnfid, 'fates_levclscpf', nclmax*nlevsclass*numpft_fates, dimid)
call ncd_defdim(lnfid, 'fates_levlanduse', n_landuse_cats, dimid)
call ncd_defdim(lnfid, 'fates_levlulu', n_landuse_cats * n_landuse_cats, dimid)
call ncd_defdim(lnfid, 'fates_levlupft', n_landuse_cats * numpft_fates, dimid)
end if

if ( .not. lhistrest )then
Expand Down Expand Up @@ -5811,6 +5812,8 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out,
num2d = n_landuse_cats
case ('fates_levlulu')
num2d = n_landuse_cats * n_landuse_cats
case ('fates_levlupft')
num2d = n_landuse_cats * numpft_fates
case('cft')
if (cft_size > 0) then
num2d = cft_size
Expand Down
38 changes: 33 additions & 5 deletions src/utils/clmfates_interfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3067,24 +3067,34 @@ end subroutine WrapUpdateFatesSeedInOut

subroutine wrap_update_hifrq_hist(this, bounds_clump, &
soilbiogeochem_carbonflux_inst, &
soilbiogeochem_carbonstate_inst)
soilbiogeochem_carbonstate_inst, &
solarabs_inst, energyflux_inst, &
temperature_inst)

! Arguments
class(hlm_fates_interface_type), intent(inout) :: this
type(bounds_type), intent(in) :: bounds_clump
type(soilbiogeochem_carbonflux_type), intent(in) :: soilbiogeochem_carbonflux_inst
type(soilbiogeochem_carbonstate_type), intent(in) :: soilbiogeochem_carbonstate_inst
type(solarabs_type), intent(in) :: solarabs_inst
type(energyflux_type), intent(in) :: energyflux_inst
type(temperature_type), intent(in) :: temperature_inst

! locals
real(r8) :: dtime
integer :: s, c, nc
integer :: s, c, nc, ifp, p

call t_startf('fates_wrap_update_hifrq_hist')

associate(&
hr => soilbiogeochem_carbonflux_inst%hr_col, & ! (gC/m2/s) total heterotrophic respiration
totsomc => soilbiogeochem_carbonstate_inst%totsomc_col, & ! (gC/m2) total soil organic matter carbon
totlitc => soilbiogeochem_carbonstate_inst%totlitc_col) ! (gC/m2) total litter carbon in BGC pools
totlitc => soilbiogeochem_carbonstate_inst%totlitc_col, & ! (gC/m2) total litter carbon in BGC pools
eflx_lh_tot => energyflux_inst%eflx_lh_tot_patch, & ! (W/m2) latent heat flux
eflx_sh_tot => energyflux_inst%eflx_sh_tot_patch, & ! (W/m2) sensible heat flux
fsa_patch => solarabs_inst%fsa_patch, & ! (W/m2) absorbed solar flux
eflx_lwrad_net=> energyflux_inst%eflx_lwrad_net_patch, & ! (W/m2) net longwave radiative flux
t_ref2m => temperature_inst%t_ref2m_patch) ! (K) 2-m air temperature

nc = bounds_clump%clump_index

Expand All @@ -3105,6 +3115,21 @@ subroutine wrap_update_hifrq_hist(this, bounds_clump, &
end do
end if


! Summarize biophysical variables that we want to output on FATES dimensions
! Note that we pass in the bareground patch values here by starting the ifp
! do loop from zero
do s = 1, this%fates(nc)%nsites
c = this%f2hmap(nc)%fcolumn(s)
do ifp = 0, this%fates(nc)%sites(s)%youngest_patch%patchno
p = ifp + col%patchi(c)
this%fates(nc)%bc_in(s)%lhflux_pa(ifp) = eflx_lh_tot(p)
this%fates(nc)%bc_in(s)%shflux_pa(ifp) = eflx_sh_tot(p)
this%fates(nc)%bc_in(s)%swabs_pa(ifp) = fsa_patch(p)
this%fates(nc)%bc_in(s)%t2m_pa(ifp) = t_ref2m(p)
end do
end do

dtime = get_step_size_real()

! Update history variables that track these variables
Expand Down Expand Up @@ -3348,7 +3373,7 @@ subroutine init_history_io(this,bounds_proc)
use FatesIOVariableKindMod, only : site_height_r8, site_elem_r8, site_elpft_r8
use FatesIOVariableKindMod, only : site_elcwd_r8, site_elage_r8, site_agefuel_r8
use FatesIOVariableKindMod, only : site_cdpf_r8, site_cdsc_r8, site_clscpf_r8
use FatesIOVariableKindMod, only : site_landuse_r8, site_lulu_r8
use FatesIOVariableKindMod, only : site_landuse_r8, site_lulu_r8, site_lupft_r8
use FatesIODimensionsMod, only : fates_bounds_type


Expand Down Expand Up @@ -3454,7 +3479,7 @@ subroutine init_history_io(this,bounds_proc)
site_scagpft_r8, site_agepft_r8, site_elem_r8, site_elpft_r8, &
site_elcwd_r8, site_elage_r8, site_agefuel_r8, &
site_cdsc_r8, site_cdpf_r8, &
site_landuse_r8, site_lulu_r8)
site_landuse_r8, site_lulu_r8, site_lupft_r8)


d_index = fates_hist%dim_kinds(dk_index)%dim2_index
Expand Down Expand Up @@ -3808,6 +3833,9 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates)

fates%lulu_begin = 1
fates%lulu_end = n_landuse_cats * n_landuse_cats

fates%lupft_begin = 1
fates%lupft_end = n_landuse_cats * numpft_fates

call t_stopf('fates_hlm2fatesbnds')

Expand Down