Skip to content

Commit 4f6a342

Browse files
committed
bug fixes: dimension structure incorrectly defined as a class instead of type, unused hvar pointers and weird association statement.
1 parent d5581b0 commit 4f6a342

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

main/FatesHistoryInterfaceMod.F90

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -869,20 +869,17 @@ subroutine flush_hvars(this,nc,upfreq_in)
869869
class(fates_history_interface_type) :: this
870870
integer,intent(in) :: nc
871871
integer,intent(in) :: upfreq_in
872-
873872
integer :: ivar
874-
type(fates_history_variable_type),pointer :: hvar
875873
integer :: lb1,ub1,lb2,ub2
876874

877875
do ivar=1,ubound(this%hvars,1)
878-
associate( hvar => this%hvars(ivar) )
879-
if (hvar%upfreq == upfreq_in) then ! Only flush variables with update on dynamics step
880-
call hvar%Flush(nc, this%dim_bounds, this%dim_kinds)
881-
end if
882-
end associate
876+
if (this%hvars(ivar)%upfreq == upfreq_in) then ! Only flush variables with update on dynamics step
877+
call this%hvars(ivar)%flush(nc, this%dim_bounds, this%dim_kinds)
878+
879+
end if
883880
end do
884881

885-
end subroutine flush_hvars
882+
end subroutine flush_hvars
886883

887884

888885
! =====================================================================================
@@ -915,7 +912,6 @@ subroutine set_history_var(this, vname, units, long, use_default, avgflag, vtype
915912
! not used
916913

917914
! locals
918-
type(fates_history_variable_type), pointer :: hvar
919915
integer :: ub1, lb1, ub2, lb2 ! Bounds for allocating the var
920916
integer :: ityp
921917

@@ -1110,7 +1106,7 @@ subroutine update_history_dyn(this,nc,nsites,sites)
11101106
use EDTypesMod , only : nlevleaf
11111107

11121108
! Arguments
1113-
class(fates_history_interface_type) :: this
1109+
class(fates_history_interface_type) :: this
11141110
integer , intent(in) :: nc ! clump index
11151111
integer , intent(in) :: nsites
11161112
type(ed_site_type) , intent(inout), target :: sites(nsites)
@@ -1135,7 +1131,6 @@ subroutine update_history_dyn(this,nc,nsites,sites)
11351131
real(r8) :: patch_scaling_scalar ! ratio of canopy to patch area for counteracting patch scaling
11361132
real(r8) :: dbh ! diameter ("at breast height")
11371133

1138-
type(fates_history_variable_type),pointer :: hvar
11391134
type(ed_patch_type),pointer :: cpatch
11401135
type(ed_cohort_type),pointer :: ccohort
11411136

@@ -1888,7 +1883,6 @@ subroutine update_history_prod(this,nc,nsites,sites,dt_tstep)
18881883
real(r8), parameter :: tiny = 1.e-5_r8 ! some small number
18891884
integer :: ipa2 ! patch incrementer
18901885
integer :: cnlfpft_indx, cnlf_indx, ipft, ican, ileaf ! more iterators and indices
1891-
type(fates_history_variable_type),pointer :: hvar
18921886
type(ed_patch_type),pointer :: cpatch
18931887
type(ed_cohort_type),pointer :: ccohort
18941888
real(r8) :: per_dt_tstep ! Time step in frequency units (/s)
@@ -2246,7 +2240,6 @@ subroutine update_history_hydraulics(this,nc,nsites,sites,dt_tstep)
22462240
integer :: ipa2 ! patch incrementer
22472241
integer :: iscpf ! index of the scpf group
22482242

2249-
type(fates_history_variable_type),pointer :: hvar
22502243
type(ed_patch_type),pointer :: cpatch
22512244
type(ed_cohort_type),pointer :: ccohort
22522245
type(ed_cohort_hydr_type), pointer :: ccohort_hydr

main/FatesHistoryVariableType.F90

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ subroutine Init(this, vname, units, long, use_default, &
8989
call dim_kinds(dk_index)%set_active()
9090

9191
call this%GetBounds(0, dim_bounds, dim_kinds, lb1, ub1, lb2, ub2)
92-
92+
9393
! NOTE(rgk, 2016-09) currently, all array spaces are flushed each
9494
! time the update is called. The flush here on the initialization
9595
! may be redundant, but will prevent issues in the future if we
@@ -167,7 +167,7 @@ subroutine Init(this, vname, units, long, use_default, &
167167
end subroutine Init
168168

169169
! =====================================================================================
170-
170+
171171
subroutine GetBounds(this, thread, dim_bounds, dim_kinds, lb1, ub1, lb2, ub2)
172172

173173
use FatesIODimensionsMod, only : fates_io_dimension_type
@@ -176,7 +176,7 @@ subroutine GetBounds(this, thread, dim_bounds, dim_kinds, lb1, ub1, lb2, ub2)
176176

177177
class(fates_history_variable_type), intent(inout) :: this
178178
integer, intent(in) :: thread
179-
class(fates_io_dimension_type), intent(in) :: dim_bounds(:)
179+
type(fates_io_dimension_type), intent(in) :: dim_bounds(:)
180180
type(fates_io_variable_kind_type), intent(in) :: dim_kinds(:)
181181
integer, intent(out) :: lb1
182182
integer, intent(out) :: ub1
@@ -205,14 +205,17 @@ subroutine GetBounds(this, thread, dim_bounds, dim_kinds, lb1, ub1, lb2, ub2)
205205
ub2 = dim_bounds(d_index)%upper_bound
206206
end if
207207
else
208+
208209
d_index = dim_kinds(this%dim_kinds_index)%dim1_index
209210
lb1 = dim_bounds(d_index)%clump_lower_bound(thread)
210211
ub1 = dim_bounds(d_index)%clump_upper_bound(thread)
212+
211213
if(ndims>1)then
212214
d_index = dim_kinds(this%dim_kinds_index)%dim2_index
213215
lb2 = dim_bounds(d_index)%clump_lower_bound(thread)
214216
ub2 = dim_bounds(d_index)%clump_upper_bound(thread)
215217
end if
218+
216219
end if
217220

218221
end subroutine GetBounds

main/FatesRestartVariableType.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ subroutine GetBounds(this, thread, dim_bounds, dim_kinds, lb1, ub1, lb2, ub2)
118118

119119
class(fates_restart_variable_type), intent(inout) :: this
120120
integer, intent(in) :: thread
121-
class(fates_io_dimension_type), intent(in) :: dim_bounds(:)
121+
type(fates_io_dimension_type), intent(in) :: dim_bounds(:)
122122
type(fates_io_variable_kind_type), intent(in) :: dim_kinds(:)
123123
integer, intent(out) :: lb1
124124
integer, intent(out) :: ub1

0 commit comments

Comments
 (0)