Skip to content

Commit

Permalink
work around stack overflow (time filters+ifort)
Browse files Browse the repository at this point in the history
  • Loading branch information
jornbr committed Mar 25, 2024
1 parent aadb4ea commit e14eeb2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/fabm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ subroutine set_domain(self _POSTARG_LOCATION_, seconds_per_time_unit)
real(rke), optional, intent(in) :: seconds_per_time_unit

class (type_expression), pointer :: expression
real(rke) :: missing_value

if (self%status < status_initialize_done) call fatal_error('set_domain', 'initialize has not yet been called on this model object.')
if (self%status >= status_set_domain_done) call fatal_error('set_domain', 'set_domain has already been called on this model object.')
Expand Down Expand Up @@ -686,7 +687,8 @@ subroutine set_domain(self _POSTARG_LOCATION_, seconds_per_time_unit)
allocate(expression%previous_value _INDEX_LOCATION_, expression%last_exact_mean _INDEX_LOCATION_, expression%mean _INDEX_LOCATION_)
#endif
expression%last_exact_mean = 0.0_rke
expression%mean = expression%missing_value
missing_value = expression%missing_value ! To avoid a stack overflow for the next line with ifort 2021.3
expression%mean = missing_value
call self%link_interior_data(expression%output_name, expression%mean)
class is (type_horizontal_temporal_mean)
! Moving average of horizontal variable
Expand All @@ -699,7 +701,8 @@ subroutine set_domain(self _POSTARG_LOCATION_, seconds_per_time_unit)
allocate(expression%previous_value _INDEX_HORIZONTAL_LOCATION_, expression%last_exact_mean _INDEX_HORIZONTAL_LOCATION_, expression%mean _INDEX_HORIZONTAL_LOCATION_)
#endif
expression%last_exact_mean = 0.0_rke
expression%mean = expression%missing_value
missing_value = expression%missing_value ! To avoid a stack overflow for the next line with ifort 2021.3
expression%mean = missing_value
call self%link_horizontal_data(expression%output_name, expression%mean)
class is (type_horizontal_temporal_maximum)
! Moving maximum of horizontal variable
Expand All @@ -711,7 +714,8 @@ subroutine set_domain(self _POSTARG_LOCATION_, seconds_per_time_unit)
#if _HORIZONTAL_DIMENSION_COUNT_>0
allocate(expression%previous_value _INDEX_HORIZONTAL_LOCATION_, expression%maximum _INDEX_HORIZONTAL_LOCATION_)
#endif
expression%maximum = expression%missing_value
missing_value = expression%missing_value ! To avoid a stack overflow for the next line with ifort 2021.3
expression%maximum = missing_value
call self%link_horizontal_data(expression%output_name, expression%maximum)
end select
expression => expression%next
Expand Down

0 comments on commit e14eeb2

Please sign in to comment.