Skip to content

Commit

Permalink
verify more often whether model%start has been called, if compiled in…
Browse files Browse the repository at this point in the history
… debug mode
  • Loading branch information
jornbr committed Feb 22, 2024
1 parent 791c8d0 commit bb0108e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/fabm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1653,6 +1653,7 @@ subroutine initialize_interior_state(self _POSTARG_INTERIOR_IN_)
_DECLARE_INTERIOR_INDICES_

#ifndef NDEBUG
_ASSERT_(self%status >= status_start_done, 'initialize_interior_state', 'This routine can only be called after model start.')
call check_interior_location(self%domain%start, self%domain%stop _POSTARG_INTERIOR_IN_, 'initialize_interior_state')
#endif

Expand Down Expand Up @@ -1693,6 +1694,7 @@ subroutine initialize_bottom_state(self _POSTARG_HORIZONTAL_IN_)
_DECLARE_HORIZONTAL_INDICES_

#ifndef NDEBUG
_ASSERT_(self%status >= status_start_done, 'initialize_bottom_state', 'This routine can only be called after model start.')
call check_horizontal_location(self%domain%start, self%domain%stop _POSTARG_HORIZONTAL_IN_, 'initialize_bottom_state')
#endif

Expand Down Expand Up @@ -1733,6 +1735,7 @@ subroutine initialize_surface_state(self _POSTARG_HORIZONTAL_IN_)
_DECLARE_HORIZONTAL_INDICES_

#ifndef NDEBUG
_ASSERT_(self%status >= status_start_done, 'initialize_surface_state', 'This routine can only be called after model start.')
call check_horizontal_location(self%domain%start, self%domain%stop _POSTARG_HORIZONTAL_IN_, 'initialize_surface_state')
#endif

Expand Down Expand Up @@ -1776,6 +1779,7 @@ subroutine get_interior_sources_rhs(self _POSTARG_INTERIOR_IN_, dy)
_DECLARE_INTERIOR_INDICES_

#ifndef NDEBUG
_ASSERT_(self%status >= status_start_done, 'get_interior_sources_rhs', 'This routine can only be called after model start.')
call check_interior_location(self%domain%start, self%domain%stop _POSTARG_INTERIOR_IN_, 'get_interior_sources_rhs')
# ifdef _FABM_VECTORIZED_DIMENSION_INDEX_
call check_extents_2d(dy, _STOP_ - _START_ + 1, size(self%interior_state_variables), 'get_interior_sources_rhs', 'dy', 'stop-start+1, # interior state variables')
Expand All @@ -1802,6 +1806,7 @@ subroutine get_interior_sources_ppdd(self _POSTARG_INTERIOR_IN_, pp, dd)
_DECLARE_INTERIOR_INDICES_

#ifndef NDEBUG
_ASSERT_(self%status >= status_start_done, 'get_interior_sources_ppdd', 'This routine can only be called after model start.')
call check_interior_location(self%domain%start, self%domain%stop _POSTARG_INTERIOR_IN_, 'get_interior_sources_ppdd')
# ifdef _FABM_VECTORIZED_DIMENSION_INDEX_
call check_extents_3d(pp, _STOP_ - _START_ + 1, size(self%interior_state_variables), size(self%interior_state_variables), 'get_interior_sources_ppdd', 'pp', 'stop-start+1, # interior state variables, # interior state variables')
Expand Down Expand Up @@ -1852,6 +1857,7 @@ subroutine check_interior_state(self _POSTARG_INTERIOR_IN_, repair, valid)
_DECLARE_INTERIOR_INDICES_

#ifndef NDEBUG
_ASSERT_(self%status >= status_start_done, 'check_interior_state', 'This routine can only be called after model start.')
call check_interior_location(self%domain%start, self%domain%stop _POSTARG_INTERIOR_IN_, 'check_interior_state')
#endif

Expand Down Expand Up @@ -1938,6 +1944,7 @@ subroutine check_bottom_state(self _POSTARG_HORIZONTAL_IN_, repair, valid)
logical, intent(out) :: valid

#ifndef NDEBUG
_ASSERT_(self%status >= status_start_done, 'check_bottom_state', 'This routine can only be called after model start.')
call check_horizontal_location(self%domain%start, self%domain%stop _POSTARG_HORIZONTAL_IN_, 'check_bottom_state')
#endif

Expand All @@ -1958,6 +1965,7 @@ subroutine check_surface_state(self _POSTARG_HORIZONTAL_IN_, repair, valid)
logical, intent(out) :: valid

#ifndef NDEBUG
_ASSERT_(self%status >= status_start_done, 'check_surface_state', 'This routine can only be called after model start.')
call check_horizontal_location(self%domain%start, self%domain%stop _POSTARG_HORIZONTAL_IN_, 'check_surface_state')
#endif

Expand Down Expand Up @@ -2133,6 +2141,7 @@ subroutine get_surface_sources(self _POSTARG_HORIZONTAL_IN_, flux_pel, flux_sf)
_DECLARE_HORIZONTAL_INDICES_

#ifndef NDEBUG
_ASSERT_(self%status >= status_start_done, 'get_surface_sources', 'This routine can only be called after model start.')
call check_horizontal_location(self%domain%start, self%domain%stop _POSTARG_HORIZONTAL_IN_, 'get_surface_sources')
# ifdef _HORIZONTAL_IS_VECTORIZED_
call check_extents_2d(flux_pel, _STOP_ - _START_ + 1, size(self%interior_state_variables), 'get_surface_sources', 'flux_pel', 'stop-start+1, # interior state variables')
Expand Down Expand Up @@ -2180,6 +2189,7 @@ subroutine get_bottom_sources_rhs(self _POSTARG_HORIZONTAL_IN_, flux_pel, flux_b
_DECLARE_HORIZONTAL_INDICES_

#ifndef NDEBUG
_ASSERT_(self%status >= status_start_done, 'get_bottom_sources_rhs', 'This routine can only be called after model start.')
call check_horizontal_location(self%domain%start, self%domain%stop _POSTARG_HORIZONTAL_IN_, 'get_bottom_sources_rhs')
# ifdef _HORIZONTAL_IS_VECTORIZED_
call check_extents_2d(flux_pel, _STOP_ - _START_ + 1, size(self%interior_state_variables), 'get_bottom_sources_rhs', 'flux_pel', 'stop-start+1, # interior state variables')
Expand Down Expand Up @@ -2215,6 +2225,7 @@ subroutine get_bottom_sources_ppdd(self _POSTARG_HORIZONTAL_IN_, pp, dd, benthos
_DECLARE_HORIZONTAL_INDICES_

#ifndef NDEBUG
_ASSERT_(self%status >= status_start_done, 'get_bottom_sources_ppdd', 'This routine can only be called after model start.')
call check_horizontal_location(self%domain%start, self%domain%stop _POSTARG_HORIZONTAL_IN_, 'get_bottom_sources_ppdd')
#endif

Expand Down Expand Up @@ -2254,6 +2265,7 @@ subroutine get_vertical_movement(self _POSTARG_INTERIOR_IN_, velocity)
_DECLARE_INTERIOR_INDICES_

#ifndef NDEBUG
_ASSERT_(self%status >= status_start_done, 'get_vertical_movement', 'This routine can only be called after model start.')
call check_interior_location(self%domain%start, self%domain%stop _POSTARG_INTERIOR_IN_, 'get_vertical_movement')
# ifdef _FABM_VECTORIZED_DIMENSION_INDEX_
call check_extents_2d(velocity, _STOP_ - _START_ + 1, size(self%interior_state_variables), 'get_vertical_movement', 'velocity', 'stop-start+1, # interior state variables')
Expand Down Expand Up @@ -2283,6 +2295,7 @@ subroutine get_interior_conserved_quantities(self _POSTARG_INTERIOR_IN_, sums)
_DECLARE_INTERIOR_INDICES_

#ifndef NDEBUG
_ASSERT_(self%status >= status_start_done, 'get_interior_conserved_quantities', 'This routine can only be called after model start.')
call check_interior_location(self%domain%start, self%domain%stop _POSTARG_INTERIOR_IN_, 'get_interior_conserved_quantities')
# ifdef _FABM_VECTORIZED_DIMENSION_INDEX_
call check_extents_2d(sums, _STOP_ - _START_ + 1, size(self%conserved_quantities), 'get_interior_conserved_quantities', 'sums', 'stop-start+1, # conserved quantities')
Expand Down Expand Up @@ -2310,6 +2323,7 @@ subroutine get_horizontal_conserved_quantities(self _POSTARG_HORIZONTAL_IN_, sum
_DECLARE_HORIZONTAL_INDICES_

#ifndef NDEBUG
_ASSERT_(self%status >= status_start_done, 'get_horizontal_conserved_quantities', 'This routine can only be called after model start.')
call check_horizontal_location(self%domain%start, self%domain%stop _POSTARG_HORIZONTAL_IN_, 'get_horizontal_conserved_quantities')
# ifdef _HORIZONTAL_IS_VECTORIZED_
call check_extents_2d(sums, _STOP_ - _START_ + 1, size(self%conserved_quantities), 'get_horizontal_conserved_quantities', 'sums', 'stop-start+1, # conserved quantities')
Expand Down

0 comments on commit bb0108e

Please sign in to comment.