Skip to content

Commit

Permalink
Merge pull request #143 from bandre-ucar/andre-hist-io-refactor
Browse files Browse the repository at this point in the history
Refactor fates history output
  • Loading branch information
rgknox authored Nov 3, 2016
2 parents 53bbb9d + 8c9fc5a commit 2ac7960
Show file tree
Hide file tree
Showing 8 changed files with 1,154 additions and 796 deletions.
5 changes: 5 additions & 0 deletions components/clm/cime_config/testdefs/testlist_clm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@
<grid name="1x1_brazil">
<test name="ERS_D_Mmpi-serial_Ld5">
<machine compiler="ed" testtype="ed" testmods="clm/edTest">ed</machine>
<machine compiler="ed" testtype="ed" testmods="clm/edTest">hobart</machine>
<machine compiler="nag" testtype="aux_clm45" testmods="clm/edTest">hobart</machine>
<machine compiler="gnu" testtype="aux_clm45" testmods="clm/edTest">yellowstone</machine>
<machine compiler="intel" testtype="aux_clm45" testmods="clm/edTest">yellowstone</machine>
Expand All @@ -703,10 +704,12 @@
<grid name="5x5_amazon">
<test name="ERS_D_Ld5">
<machine compiler="ed" testtype="ed" testmods="clm/edTest">ed</machine>
<machine compiler="ed" testtype="ed" testmods="clm/edTest">hobart</machine>
<machine compiler="intel" testtype="aux_clm45" testmods="clm/edTest">yellowstone</machine>
</test>
<test name="SMS_D_Mmpi-serial_Ld5">
<machine compiler="ed" testtype="ed" testmods="clm/edTest">ed</machine>
<machine compiler="ed" testtype="ed" testmods="clm/edTest">hobart</machine>
<machine compiler="nag" testtype="aux_clm45" testmods="clm/edTest">hobart</machine>
<machine compiler="intel" testtype="aux_clm45" testmods="clm/edTest">yellowstone</machine>
<machine compiler="pgi" testtype="aux_clm45" testmods="clm/edTest">yellowstone</machine>
Expand All @@ -721,12 +724,14 @@
<grid name="f10_f10">
<test name="ERS_D_Ld5">
<machine compiler="ed" testtype="ed" testmods="clm/edTest">ed</machine>
<machine compiler="ed" testtype="ed" testmods="clm/edTest">hobart</machine>
<machine compiler="ed" testtype="ed" testmods="clm/edNoFire">ed</machine>
<machine compiler="nag" testtype="aux_clm45" testmods="clm/edTest">hobart</machine>
<machine compiler="intel" testtype="aux_clm45" testmods="clm/edTest">yellowstone</machine>
</test>
<test name="SMS_D_Ld5">
<machine compiler="ed" testtype="ed" testmods="clm/edTest">ed</machine>
<machine compiler="ed" testtype="ed" testmods="clm/edTest">hobart</machine>
<machine compiler="nag" testtype="aux_clm45" testmods="clm/edTest">hobart</machine>
<machine compiler="gnu" testtype="aux_clm45" testmods="clm/edTest">yellowstone</machine>
<machine compiler="intel" testtype="aux_clm45" testmods="clm/edTest">yellowstone</machine>
Expand Down
3 changes: 2 additions & 1 deletion components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,8 @@ subroutine canopy_structure( currentSite )
enddo

if(((checkarea-currentPatch%area)) > 0.0001)then
write(fates_log(),*) 'problem with canopy area', checkarea,currentPatch%area,checkarea-currentPatch%area,i,z,missing_area
write(fates_log(),*) 'problem with canopy area', checkarea, currentPatch%area, checkarea - currentPatch%area, &
i, z, missing_area
currentCohort => currentPatch%tallest
do while (associated(currentCohort))
if(currentCohort%canopy_layer == i)then
Expand Down
4 changes: 1 addition & 3 deletions components/clm/src/ED/main/FatesConstantsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ module FatesConstantsMod
integer, parameter :: fates_short_string_length = 32
integer, parameter :: fates_long_string_length = 199


! Unset and various other 'special' values
integer, parameter :: fates_unset_int = -9999



! Unit conversion constants:

! Conversion factor umols of Carbon -> kg of Carbon (1 mol = 12g)
Expand Down
92 changes: 92 additions & 0 deletions components/clm/src/ED/main/FatesHistoryDimensionMod.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
module FatesHistoryDimensionMod

use FatesConstantsMod, only : fates_short_string_length

implicit none

! FIXME(bja, 2016-10) do these need to be strings, or can they be integer enumerations?
character(*), parameter :: patch_r8 = 'PA_R8'
character(*), parameter :: patch_ground_r8 = 'PA_GRND_R8'
character(*), parameter :: patch_size_pft_r8 = 'PA_SCPF_R8'
character(*), parameter :: site_r8 = 'SI_R8'
character(*), parameter :: site_ground_r8 = 'SI_GRND_R8'
character(*), parameter :: site_size_pft_r8 = 'SI_SCPF_R8'
character(*), parameter :: patch_int = 'PA_INT'

integer, parameter :: fates_num_dimension_types = 4
character(*), parameter :: patch = 'patch'
character(*), parameter :: column = 'column'
character(*), parameter :: levgrnd = 'levgrnd'
character(*), parameter :: levscpf = 'levscpf'

! patch = This is a structure that records where FATES patch boundaries
! on each thread point to in the host IO array, this structure
! is allocated by number of threads

! column = This is a structure that records where FATES column boundaries
! on each thread point to in the host IO array, this structure
! is allocated by number of threads

! ground = This is a structure that records the boundaries for the
! ground level (includes rock) dimension

! levscpf = This is a structure that records the boundaries for the
! number of size-class x pft dimension


! This structure is not allocated by thread, but the upper and lower boundaries
! of the dimension for each thread is saved in the clump_ entry
type fates_history_dimension_type
character(len=fates_short_string_length) :: name
integer :: lower_bound
integer :: upper_bound
integer, allocatable :: clump_lower_bound(:) ! lower bound of thread's portion of HIO array
integer, allocatable :: clump_upper_bound(:) ! upper bound of thread's portion of HIO array
contains
procedure, public :: Init
procedure, public :: SetThreadBounds
end type fates_history_dimension_type

contains

! =====================================================================================
subroutine Init(this, name, num_threads, lower_bound, upper_bound)

implicit none

! arguments
class(fates_history_dimension_type), intent(inout) :: this
character(len=*), intent(in) :: name
integer, intent(in) :: num_threads
integer, intent(in) :: lower_bound
integer, intent(in) :: upper_bound

this%name = trim(name)
this%lower_bound = lower_bound
this%upper_bound = upper_bound

allocate(this%clump_lower_bound(num_threads))
this%clump_lower_bound(:) = -1

allocate(this%clump_upper_bound(num_threads))
this%clump_upper_bound(:) = -1

end subroutine Init

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

subroutine SetThreadBounds(this, thread_index, lower_bound, upper_bound)

implicit none

class(fates_history_dimension_type), intent(inout) :: this
integer, intent(in) :: thread_index
integer, intent(in) :: lower_bound
integer, intent(in) :: upper_bound

this%clump_lower_bound(thread_index) = lower_bound
this%clump_upper_bound(thread_index) = upper_bound

end subroutine SetThreadBounds

end module FatesHistoryDimensionMod
Loading

0 comments on commit 2ac7960

Please sign in to comment.