1 module module_subsurface_grid_transform
4 type subsurface_grid_transform_interface
6 ! temp array? field capacity disaggregated to routing grid, for each soil layer
7 real, allocatable, dimension(:,:,:) :: smcrefrt
9 ! Soil Moisture Content -- ???
10 real, allocatable, dimension(:,:,:) :: smcrt
12 ! Soil Moisture Content -- ??? Porosity
13 real, allocatable, dimension(:,:,:) :: smcmaxrt
15 ! Soil Moisture Content -- ??? Wilting Point
16 real, allocatable, dimension(:,:,:) :: smcwltrt
18 procedure :: init => subsurface_grid_transform_init
19 procedure :: destroy => subsurface_grid_transfrom_destroy
24 subroutine subsurface_grid_transform_init(this,ix,jx,nsoil)
26 class(subsurface_grid_transform_interface), intent(inout) :: this ! the type object being initialized
27 integer, intent(in) :: ix ! x grid size
28 integer, intent(in) :: jx ! y grid size
29 integer, intent(in) :: nsoil ! number of soil layers
31 logical :: allocation_error = .false.
33 ! check allocation status of smcrefrt
34 if ( .not. allocated(this%smcrefrt) ) then
35 allocate( this%smcrefrt(ix,jx,nsoil) )
36 !no initialization on this variable?
39 allocation_error = .true.
42 ! check to see if smcrt is allocated
43 if ( .not. allocated(this%smcrt) ) then
44 allocate( this%smcrt(ix,jx,nsoil) )
47 allocation_error = .true.
50 ! check to see if smcmaxrt is allocated
51 if ( .not. allocated(this%smcmaxrt) ) then
52 allocate( this%smcmaxrt(ix,jx,nsoil) )
56 ! check to see if smcwltrt is allocated
57 if ( .not. allocated(this%smcwltrt) ) then
58 allocate( this%smcwltrt(ix,jx,nsoil) )
61 allocation_error = .true.
64 if ( allocation_error ) &
65 write(0,*) "attempt to allocate data in members of subsurface grid transform structure&
66 &that where already allocated. The allocated members where not changed"
68 end subroutine subsurface_grid_transform_init
70 subroutine subsurface_grid_transfrom_destroy(this)
72 class(subsurface_grid_transform_interface), intent(inout) :: this ! the type object being initialized
74 logical :: allocation_error = .false.
76 ! check allocation status of smcrefrt
77 if ( allocated(this%smcrefrt) ) then
78 deallocate( this%smcrefrt )
80 allocation_error = .true.
83 ! check to see if smcrt is allocated
84 if ( allocated(this%smcrt) ) then
85 deallocate( this%smcrt )
87 allocation_error = .true.
90 ! check to see if smcmaxrt is allocated
91 if ( allocated(this%smcmaxrt) ) then
92 deallocate( this%smcmaxrt )
94 allocation_error = .true.
97 ! check to see if smcwltrt is allocated
98 if ( allocated(this%smcwltrt) ) then
99 deallocate( this%smcwltrt )
101 allocation_error = .true.
104 if ( allocation_error ) &
105 write(0,*) "attempt to deallocate data in members of subsurface grid transform structure&
106 &that where not allocated. The unallocated members where not changed"
110 end module module_subsurface_grid_transform