diff --git a/src/Model/ModelUtilities/ReleaseSchedule.f90 b/src/Model/ModelUtilities/ReleaseSchedule.f90 index 4db8ce68d5b..af1c78ecc46 100644 --- a/src/Model/ModelUtilities/ReleaseSchedule.f90 +++ b/src/Model/ModelUtilities/ReleaseSchedule.f90 @@ -11,6 +11,7 @@ module ReleaseScheduleModule implicit none private public :: ReleaseScheduleType + public :: create_release_schedule !> @brief Particle release scheduling utility. !! @@ -25,8 +26,9 @@ module ReleaseScheduleModule !! an infinite supply: an arbitrary number can be released, only !! one at a time. !! - !! The release schedule must be reinitialized for each time step. - !! This is achieved by calling advance(). + !! The release schedule must be refreshed each time step. This is + !! necessary to advance the time selection and can be achieved by + !! calling advance(). !< type :: ReleaseScheduleType real(DP), allocatable :: schedule(:) !< release schedule @@ -37,15 +39,26 @@ module ReleaseScheduleModule procedure :: any procedure :: count procedure :: deallocate - procedure :: init procedure :: log end type ReleaseScheduleType contains + !> @brief Create a new release schedule object. + function create_release_schedule() result(sched) + type(ReleaseScheduleType), pointer :: sched !< schedule pointer + allocate (sched) + allocate (sched%schedule(0)) + allocate (sched%time_select) + allocate (sched%step_select) + call sched%time_select%init() + call sched%step_select%init() + end function create_release_schedule + !> @brief Deallocate the release schedule. subroutine deallocate (this) class(ReleaseScheduleType) :: this !< this instance + deallocate (this%schedule) call this%time_select%deallocate() call this%step_select%deallocate() @@ -53,18 +66,6 @@ subroutine deallocate (this) deallocate (this%step_select) end subroutine deallocate - !> @brief Initialize the release schedule. - subroutine init(this) - class(ReleaseScheduleType) :: this !< this instance - - if (allocated(this%schedule)) deallocate (this%schedule) - allocate (this%schedule(0)) - allocate (this%time_select) - allocate (this%step_select) - call this%time_select%init() - call this%step_select%init() - end subroutine init - !> @brief Write the release schedule to the given output unit. subroutine log(this, iout) ! dummy diff --git a/src/Model/ModelUtilities/TimeStepSelect.f90 b/src/Model/ModelUtilities/TimeStepSelect.f90 index cd2f3d4fe27..aa7ab0fc344 100644 --- a/src/Model/ModelUtilities/TimeStepSelect.f90 +++ b/src/Model/ModelUtilities/TimeStepSelect.f90 @@ -102,10 +102,8 @@ end subroutine log !> @brief Read a line of input and prepare the selection object. subroutine read (this, line) - ! dummy class(TimeStepSelectType) :: this !< this instance character(len=*), intent(in) :: line !< input line - ! local character(len=len(line)) :: l integer(I4B) :: n, lloc, istart, istop, ival diff --git a/src/Model/ParticleTracking/prt-prp.f90 b/src/Model/ParticleTracking/prt-prp.f90 index ca37677bdd9..57c180d55ce 100644 --- a/src/Model/ParticleTracking/prt-prp.f90 +++ b/src/Model/ParticleTracking/prt-prp.f90 @@ -21,7 +21,7 @@ module PrtPrpModule use GeomUtilModule, only: point_in_polygon, get_ijk, get_jk use MemoryManagerModule, only: mem_allocate, mem_deallocate, & mem_reallocate - use ReleaseScheduleModule, only: ReleaseScheduleType + use ReleaseScheduleModule, only: ReleaseScheduleType, create_release_schedule use DisModule, only: DisType use DisvModule, only: DisvType use ErrorUtilModule, only: pstop @@ -225,11 +225,10 @@ end subroutine prp_allocate_arrays subroutine prp_allocate_scalars(this) class(PrtPrpType) :: this - ! Allocate release time selection - allocate (this%releases) - call this%releases%init() + ! Create release schedule + this%releases => create_release_schedule() - ! call standard BndType allocate scalars + ! Allocate parent's scalars call this%BndType%allocate_scalars() ! Allocate scalars for this type