1 ! This module defines and instantiates objects
2 ! for a level pool type reservoir's state.
3 ! State holds and tracks dynamic/changing variables
4 ! that are only relevant to the given level pool
5 ! reservoir object and not other modules or areas
7 module module_levelpool_state
9 use module_reservoir, only: reservoir_state
12 ! Extend/derive level pool state from the abstract base
13 ! type for reservoir state.
14 type, extends(reservoir_state) :: levelpool_state_interface
15 real :: water_elevation ! meters AMSL
19 procedure :: init => levelpool_state_init
20 procedure :: destroy => levelpool_state_destroy
22 end type levelpool_state_interface
26 !Level Pool State Constructor
27 subroutine levelpool_state_init(this, water_elevation)
29 class(levelpool_state_interface), intent(inout) :: this ! the type object being initialized
30 real, intent(inout) :: water_elevation ! meters AMSL
32 ! Assign the water elevation value passed in to a particular level pool reservoir
33 ! state object's variable for water elevation
34 this%water_elevation = water_elevation
36 end subroutine levelpool_state_init
38 !Level Pool State Destructor
39 subroutine levelpool_state_destroy(this)
41 class(levelpool_state_interface), intent(inout) :: this ! the type object being destroyed
43 end subroutine levelpool_state_destroy
45 end module module_levelpool_state