Commit 2ad8a78f authored by Jorn Bruggeman's avatar Jorn Bruggeman
Browse files

deprecated set_bottom_index/set_surface_index except when _FABM_BOTTOM_INDEX_==-1

parent 369f1e34
......@@ -56,7 +56,7 @@ module fabm
integer, parameter :: status_none = 0
integer, parameter :: status_initialize_done = 1
integer, parameter :: status_set_domain_done = 2
integer, parameter, public :: status_set_domain_done = 2
integer, parameter, public :: status_start_done = 3
integer, parameter, public :: data_source_none = 0
......@@ -203,9 +203,8 @@ module fabm
procedure :: set_domain_start
procedure :: set_domain_stop
#endif
#ifdef _FABM_DEPTH_DIMENSION_INDEX_
#if defined(_FABM_DEPTH_DIMENSION_INDEX_)&&_FABM_BOTTOM_INDEX_==-1
procedure :: set_bottom_index
procedure :: set_surface_index
#endif
#ifdef _HAS_MASK_
procedure :: set_mask
......@@ -605,32 +604,7 @@ contains
end subroutine set_mask
#endif
#ifdef _FABM_DEPTH_DIMENSION_INDEX_
# if _FABM_BOTTOM_INDEX_==0
! --------------------------------------------------------------------------
! set_bottom_index: set vertical index of bottom layer
! --------------------------------------------------------------------------
subroutine set_bottom_index(self, index)
class (type_fabm_model), intent(inout) :: self
integer, intent(in) :: index
if (self%status < status_set_domain_done) &
call fatal_error('set_bottom_index', 'set_domain has not yet been called on this model object.')
if (index < 1) &
call fatal_error('set_bottom_index', 'provided index must equal or exceed 1.')
if (index > self%domain%stop(_FABM_DEPTH_DIMENSION_INDEX_)) &
call fatal_error('set_bottom_index', 'provided index exceeds size of the depth dimension.')
# ifdef _FABM_VERTICAL_BOTTOM_TO_SURFACE_
self%domain%start(_FABM_DEPTH_DIMENSION_INDEX_) = index
# else
self%domain%stop(_FABM_DEPTH_DIMENSION_INDEX_) = index
# endif
end subroutine set_bottom_index
# elif _FABM_BOTTOM_INDEX_==-1
#if defined(_FABM_DEPTH_DIMENSION_INDEX_)&&_FABM_BOTTOM_INDEX_==-1
! --------------------------------------------------------------------------
! set_bottom_index: provide bottom indices for every horizontal point
! --------------------------------------------------------------------------
......@@ -654,30 +628,6 @@ contains
self%domain%bottom_indices => indices
end subroutine set_bottom_index
# endif
! --------------------------------------------------------------------------
! set_surface_index: set vertical index of surface layer
! --------------------------------------------------------------------------
subroutine set_surface_index(self, index)
class (type_fabm_model), intent(inout) :: self
integer, intent(in) :: index
if (self%status < status_set_domain_done) &
call fatal_error('set_surface_index', 'set_domain has not yet been called on this model object.')
if (index < 1) &
call fatal_error('set_surface_index', 'provided index must equal or exceed 1.')
if (index > self%domain%shape(_FABM_DEPTH_DIMENSION_INDEX_)) &
call fatal_error('set_surface_index', 'provided index exceeds size of the depth dimension.')
# ifdef _FABM_VERTICAL_BOTTOM_TO_SURFACE_
self%domain%stop(_FABM_DEPTH_DIMENSION_INDEX_) = index
# else
self%domain%start(_FABM_DEPTH_DIMENSION_INDEX_) = index
# endif
end subroutine set_surface_index
#endif
! --------------------------------------------------------------------------
......
......@@ -49,6 +49,12 @@ module fabm_v0_compatibility
type (type_horizontal_variable_id) :: surface_drag_id
contains
procedure :: initialize => fabm_initialize
#ifdef _FABM_DEPTH_DIMENSION_INDEX_
procedure :: set_surface_index
# if _FABM_BOTTOM_INDEX_==0
procedure :: set_bottom_index
# endif
#endif
procedure :: get_bulk_variable_id_by_name => fabm_get_bulk_variable_id_by_name
procedure :: get_bulk_variable_id_sn => fabm_get_bulk_variable_id_sn
generic :: get_bulk_variable_id => get_bulk_variable_id_by_name, get_bulk_variable_id_sn
......@@ -126,6 +132,55 @@ contains
call self%set_domain(_PREARG_LOCATION_ seconds_per_time_unit)
end subroutine
#ifdef _FABM_DEPTH_DIMENSION_INDEX_
! --------------------------------------------------------------------------
! set_surface_index: set vertical index of surface layer
! --------------------------------------------------------------------------
subroutine set_surface_index(self, index)
class (type_model), intent(inout) :: self
integer, intent(in) :: index
if (self%status < status_set_domain_done) &
call driver%fatal_error('set_surface_index', 'set_domain has not yet been called on this model object.')
if (index < 1) &
call driver%fatal_error('set_surface_index', 'provided index must equal or exceed 1.')
if (index > self%domain%shape(_FABM_DEPTH_DIMENSION_INDEX_)) &
call driver%fatal_error('set_surface_index', 'provided index exceeds size of the depth dimension.')
# ifdef _FABM_VERTICAL_BOTTOM_TO_SURFACE_
self%domain%stop(_FABM_DEPTH_DIMENSION_INDEX_) = index
# else
self%domain%start(_FABM_DEPTH_DIMENSION_INDEX_) = index
# endif
end subroutine set_surface_index
# if _FABM_BOTTOM_INDEX_==0
! --------------------------------------------------------------------------
! set_bottom_index: set vertical index of bottom layer
! --------------------------------------------------------------------------
subroutine set_bottom_index(self, index)
class (type_model), intent(inout) :: self
integer, intent(in) :: index
if (self%status < status_set_domain_done) &
call driver%fatal_error('set_bottom_index', 'set_domain has not yet been called on this model object.')
if (index < 1) &
call driver%fatal_error('set_bottom_index', 'provided index must equal or exceed 1.')
if (index > self%domain%stop(_FABM_DEPTH_DIMENSION_INDEX_)) &
call driver%fatal_error('set_bottom_index', 'provided index exceeds size of the depth dimension.')
# ifdef _FABM_VERTICAL_BOTTOM_TO_SURFACE_
self%domain%start(_FABM_DEPTH_DIMENSION_INDEX_) = index
# else
self%domain%stop(_FABM_DEPTH_DIMENSION_INDEX_) = index
# endif
end subroutine set_bottom_index
# endif
#endif
#ifdef _HAS_MASK_
# ifdef _FABM_HORIZONTAL_MASK_
subroutine fabm_set_mask(self, mask_hz)
......@@ -367,4 +422,5 @@ contains
type (type_bulk_variable_id) :: id
id = self%get_interior_variable_id(standard_variable)
end function
end module
\ No newline at end of file
......@@ -345,24 +345,10 @@ program test_host
! Specify vertical indices of surface and bottom.
! ======================================================================
#ifdef _FABM_DEPTH_DIMENSION_INDEX_
call start_test('set_surface_index')
# ifdef _FABM_VERTICAL_BOTTOM_TO_SURFACE_
call model%set_surface_index(domain_extent(_FABM_DEPTH_DIMENSION_INDEX_))
# else
call model%set_surface_index(1)
# endif
call report_test_result()
#if defined(_FABM_DEPTH_DIMENSION_INDEX_)&&_FABM_BOTTOM_INDEX_==-1
call start_test('set_bottom_index')
# if _FABM_BOTTOM_INDEX_==-1
allocate(bottom_index _INDEX_HORIZONTAL_LOCATION_)
call model%set_bottom_index(bottom_index)
# elif defined(_FABM_VERTICAL_BOTTOM_TO_SURFACE_)
call model%set_bottom_index(1)
# else
call model%set_bottom_index(domain_extent(_FABM_DEPTH_DIMENSION_INDEX_))
# endif
call report_test_result()
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment