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
140 changes: 105 additions & 35 deletions main/FatesHistoryInterfaceMod.F90

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion main/FatesHistoryVariableType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module FatesHistoryVariableType
use FatesIOVariableKindMod, only : site_coage_r8, site_coage_pft_r8
use FatesIOVariableKindMod, only : site_height_r8
use FatesIOVariableKindMod, only : site_fuel_r8, site_cwdsc_r8, site_scag_r8
use FatesIOVariableKindMod, only : site_scagpft_r8, site_agepft_r8
use FatesIOVariableKindMod, only : site_scagpft_r8, site_agepft_r8, site_canagepft_r8
use FatesIOVariableKindMod, only : site_can_r8, site_cnlf_r8, site_cnlfpft_r8
use FatesIOVariableKindMod, only : site_cdsc_r8, site_cdpf_r8
use FatesIOVariableKindMod, only : site_elem_r8, site_elpft_r8
Expand Down Expand Up @@ -197,6 +197,10 @@ subroutine Init(this, vname, units, long, use_default, &
allocate(this%r82d(lb1:ub1, lb2:ub2))
this%r82d(:,:) = flushval

case(site_canagepft_r8)
allocate(this%r82d(lb1:ub1, lb2:ub2))
this%r82d(:,:) = flushval

case(site_elem_r8)
allocate(this%r82d(lb1:ub1, lb2:ub2))
this%r82d(:,:) = flushval
Expand Down Expand Up @@ -347,6 +351,8 @@ subroutine HFlush(this, thread, dim_bounds, dim_kinds)
this%r82d(lb1:ub1, lb2:ub2) = this%flushval
case(site_agepft_r8)
this%r82d(lb1:ub1, lb2:ub2) = this%flushval
case(site_canagepft_r8)
this%r82d(lb1:ub1, lb2:ub2) = this%flushval
case(site_elem_r8)
this%r82d(lb1:ub1, lb2:ub2) = this%flushval
case(site_elpft_r8)
Expand Down
6 changes: 6 additions & 0 deletions main/FatesIODimensionsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module FatesIODimensionsMod
character(*), parameter, public :: levscag = 'fates_levscag' ! matches histFileMod
character(*), parameter, public :: levscagpft = 'fates_levscagpf' ! matches histFileMod
character(*), parameter, public :: levagepft = 'fates_levagepft' ! matches histFileMod
character(*), parameter, public :: levcanagepft = 'fates_levcnagpf' ! matches histFileMod
character(*), parameter, public :: levscpf = 'fates_levscpf' ! matches histFileMod
character(*), parameter, public :: levscls = 'fates_levscls' ! matches histFileMod
character(*), parameter, public :: levpft = 'fates_levpft' ! matches histFileMod
Expand Down Expand Up @@ -100,6 +101,9 @@ module FatesIODimensionsMod
! levagepft = This is a strcture that records the boundaries for the
! number of patch age x pft

! levcanagepft = This is a strcture that records the boundaries for the
! number of canopy layers x patch age x pft

! levagefuel = This is a strcture that records the boundaries for the
! number of patch age x fuel size class

Expand Down Expand Up @@ -141,6 +145,8 @@ module FatesIODimensionsMod
integer :: sizeagepft_class_end
integer :: agepft_class_begin
integer :: agepft_class_end
integer :: layeragepft_class_begin
integer :: layeragepft_class_end
integer :: sizepft_class_begin
integer :: sizepft_class_end
integer :: coagepf_class_begin
Expand Down
1 change: 1 addition & 0 deletions main/FatesIOVariableKindMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module FatesIOVariableKindMod
character(*), parameter, public :: site_scag_r8 = 'SI_SCAG_R8'
character(*), parameter, public :: site_scagpft_r8 = 'SI_SCAGPFT_R8'
character(*), parameter, public :: site_agepft_r8 = 'SI_AGEPFT_R8'
character(*), parameter, public :: site_canagepft_r8 = 'SI_CANAGEPFT_R8'
character(*), parameter, public :: site_agefuel_r8 = 'SI_AGEFUEL_R8'
character(*), parameter, public :: site_clscpf_r8 = 'SI_CLSCPF_R8'
character(*), parameter, public :: site_landuse_r8 = 'SI_LANDUSE_R8'
Expand Down
15 changes: 15 additions & 0 deletions main/FatesInterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,9 @@ subroutine fates_history_maps
allocate( fates_hdim_pftmap_levscagpft(nlevsclass * nlevage * numpft))
allocate( fates_hdim_agmap_levagepft(nlevage * numpft))
allocate( fates_hdim_pftmap_levagepft(nlevage * numpft))
allocate( fates_hdim_agmap_levcanagepft(nclmax * nlevage * numpft))
allocate( fates_hdim_pftmap_levcanagepft(nclmax * nlevage * numpft))
allocate( fates_hdim_canmap_levcanagepft(nclmax * nlevage * numpft))
allocate( fates_hdim_agmap_levagefuel(nlevage * num_fuel_classes))
allocate( fates_hdim_fscmap_levagefuel(nlevage * num_fuel_classes))

Expand Down Expand Up @@ -1439,6 +1442,18 @@ subroutine fates_history_maps
end do
end do

i=0
do ipft=1,numpft
do iage=1,nlevage
do ican=1,nclmax
i=i+1
fates_hdim_pftmap_levcanagepft(i) = ipft
fates_hdim_agmap_levcanagepft(i) = iage
fates_hdim_canmap_levcanagepft(i) = ican
end do
end do
end do

i=0
do iage=1,nlevage
do ifuel=1,num_fuel_classes
Expand Down
3 changes: 3 additions & 0 deletions main/FatesInterfaceTypesMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ module FatesInterfaceTypesMod
integer , public, allocatable :: fates_hdim_pftmap_levscagpft(:) ! map of pft into size-class x patch age x pft dimension
integer , public, allocatable :: fates_hdim_agmap_levagepft(:) ! map of patch-age into patch age x pft dimension
integer , public, allocatable :: fates_hdim_pftmap_levagepft(:) ! map of pft into patch age x pft dimension
integer , public, allocatable :: fates_hdim_agmap_levcanagepft(:) ! map of patch-age into canopy-layer x patch age x pft dimension
integer , public, allocatable :: fates_hdim_pftmap_levcanagepft(:) ! map of pft into canopy-layer x patch age x pft dimension
integer , public, allocatable :: fates_hdim_canmap_levcanagepft(:) ! map of canopy-layer into canopy-layer x patch age x pft dimension
integer , public, allocatable :: fates_hdim_agmap_levagefuel(:) ! map of patch-age into patch age x fsc dimension
integer , public, allocatable :: fates_hdim_fscmap_levagefuel(:) ! map of fuel size-class into patch age x fsc dimension

Expand Down
22 changes: 22 additions & 0 deletions main/FatesSizeAgeTypeIndicesMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module FatesSizeAgeTypeIndicesMod
public :: get_height_index
public :: get_sizeagepft_class_index
public :: get_agepft_class_index
public :: get_layeragepft_class_index
public :: get_cdamagesize_class_index
public :: get_cdamagesizepft_class_index
public :: coagetype_class_index
Expand Down Expand Up @@ -229,6 +230,27 @@ end function get_cdamagesizepft_class_index

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

function get_layeragepft_class_index(layer,age,pft) result(layer_by_age_by_pft_class)

! Get the 1D index for a canopy layer x patch age x pft triplet

! Arguments
integer,intent(in) :: layer
real(r8),intent(in) :: age
integer,intent(in) :: pft

integer :: age_class
integer :: layer_by_age_by_pft_class

age_class = get_age_class_index(age)

layer_by_age_by_pft_class = (pft-1)*nclmax*nlevage + &
(age_class-1)*nclmax + layer

end function get_layeragepft_class_index

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

function get_agepft_class_index(age,pft) result(age_by_pft_class)

! Arguments
Expand Down