MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
SpdisWorkArray.f90
Go to the documentation of this file.
2 use constantsmodule, only: dzero
3 use kindmodule, only: i4b, dp, lgp
4 implicit none
5 private
6
7 !> Helper class with work arrays for the SPDIS calculation in NPF
8 !<
9 type, public :: spdisworkarraytype
10 real(dp), allocatable, dimension(:) :: vi
11 real(dp), allocatable, dimension(:) :: di
12 real(dp), allocatable, dimension(:) :: viz
13 real(dp), allocatable, dimension(:) :: diz
14 real(dp), allocatable, dimension(:) :: nix
15 real(dp), allocatable, dimension(:) :: niy
16 real(dp), allocatable, dimension(:) :: wix
17 real(dp), allocatable, dimension(:) :: wiy
18 real(dp), allocatable, dimension(:) :: wiz
19 real(dp), allocatable, dimension(:) :: bix
20 real(dp), allocatable, dimension(:) :: biy
21 contains
22 procedure :: create
23 procedure :: is_created
24 procedure :: reset
25 procedure :: destroy
26 end type spdisworkarraytype
27
28contains
29
30 !< @brief Create the worker arrays
31 !<
32 subroutine create(this, nr_conns)
33 class(spdisworkarraytype) :: this
34 integer(I4B) :: nr_conns
35
36 allocate (this%vi(nr_conns))
37 allocate (this%di(nr_conns))
38 allocate (this%viz(nr_conns))
39 allocate (this%diz(nr_conns))
40 allocate (this%nix(nr_conns))
41 allocate (this%niy(nr_conns))
42 allocate (this%wix(nr_conns))
43 allocate (this%wiy(nr_conns))
44 allocate (this%wiz(nr_conns))
45 allocate (this%bix(nr_conns))
46 allocate (this%biy(nr_conns))
47
48 end subroutine create
49
50 !< @brief True when created (= allocated)
51 !<
52 function is_created(this) result(created)
53 class(spdisworkarraytype) :: this
54 logical(LGP) :: created
55
56 created = allocated(this%vi)
57
58 end function is_created
59
60 !< @brief Sets all arrays to zero
61 !<
62 subroutine reset(this)
63 class(spdisworkarraytype) :: this
64
65 this%vi(:) = dzero
66 this%di(:) = dzero
67 this%viz(:) = dzero
68 this%diz(:) = dzero
69 this%nix(:) = dzero
70 this%niy(:) = dzero
71 this%wix(:) = dzero
72 this%wiy(:) = dzero
73 this%wiz(:) = dzero
74 this%bix(:) = dzero
75 this%biy(:) = dzero
76
77 end subroutine reset
78
79 !< @brief Clean up memory (only when create has been called)
80 !<
81 subroutine destroy(this)
82 class(spdisworkarraytype) :: this
83
84 deallocate (this%vi)
85 deallocate (this%di)
86 deallocate (this%viz)
87 deallocate (this%diz)
88 deallocate (this%nix)
89 deallocate (this%niy)
90 deallocate (this%wix)
91 deallocate (this%wiy)
92 deallocate (this%wiz)
93 deallocate (this%bix)
94 deallocate (this%biy)
95
96 end subroutine destroy
97
98end module spdisworkarraymodule
This module contains simulation constants.
Definition Constants.f90:9
real(dp), parameter dzero
real constant zero
Definition Constants.f90:65
This module defines variable data types.
Definition kind.f90:8
logical(lgp) function is_created(this)
subroutine create(this, nr_conns)
subroutine destroy(this)
subroutine reset(this)
Helper class with work arrays for the SPDIS calculation in NPF.