MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
gwfmvrperioddatamodule Module Reference

This module contains the GwfMvrPeriodDataModule Module. More...

Data Types

type  gwfmvrperioddatatype
 Derived type for GwfMvrPeriodDataType. More...

Functions/Subroutines

subroutine construct (this, maxsize, memorypath)
 Construct arrays.
subroutine read_from_parser (this, parser, nmvr, modelname)
 Fill the arrays from parser.
subroutine destroy (this)
 Destroy memory.

Detailed Description

This module contains the code for storing and reading stress period data for the GwfMvr Package.

Function/Subroutine Documentation

◆ construct()

subroutine gwfmvrperioddatamodule::construct ( class(gwfmvrperioddatatype) this,
integer(i4b), intent(in) maxsize,
character(len=lenmempath), intent(in) memorypath )

Allocate maximum space for mover input.

Parameters
thisGwfMvrPeriodDataType
[in]maxsizesize of arrays
[in]memorypathmemory manager path

Definition at line 51 of file GwfMvrPeriodData.f90.

52 ! -- modules
54 ! -- dummy
55 class(GwfMvrPeriodDataType) :: this !< GwfMvrPeriodDataType
56 integer(I4B), intent(in) :: maxsize !< size of arrays
57 character(len=LENMEMPATH), intent(in) :: memoryPath !< memory manager path
58
59 ! -- character arrays
60 allocate (this%mname1(maxsize))
61 allocate (this%pname1(maxsize))
62 allocate (this%mname2(maxsize))
63 allocate (this%pname2(maxsize))
64
65 ! -- integer and real
66 call mem_allocate(this%id1, maxsize, 'ID1', memorypath)
67 call mem_allocate(this%id2, maxsize, 'ID2', memorypath)
68 call mem_allocate(this%imvrtype, maxsize, 'IMVRTYPE', memorypath)
69 call mem_allocate(this%value, maxsize, 'VALUE', memorypath)

◆ destroy()

subroutine gwfmvrperioddatamodule::destroy ( class(gwfmvrperioddatatype) this)
private

Deallocate memory from the memory manager.

Parameters
thisGwfMvrPeriodDataType

Definition at line 152 of file GwfMvrPeriodData.f90.

153 ! -- modules
155 ! -- dummy
156 class(GwfMvrPeriodDataType) :: this !< GwfMvrPeriodDataType
157
158 ! -- character arrays
159 deallocate (this%mname1)
160 deallocate (this%pname1)
161 deallocate (this%mname2)
162 deallocate (this%pname2)
163
164 ! -- integer and real
165 call mem_deallocate(this%id1)
166 call mem_deallocate(this%id2)
167 call mem_deallocate(this%imvrtype)
168 call mem_deallocate(this%value)

◆ read_from_parser()

subroutine gwfmvrperioddatamodule::read_from_parser ( class(gwfmvrperioddatatype) this,
type(blockparsertype), intent(inout) parser,
integer(i4b), intent(out) nmvr,
character(len=lenmodelname), intent(in) modelname )
private

Use the provided block parser to fill the input arrays.

Parameters
thisGwfMvrPeriodDataType
[in,out]parserblock parser
[out]nmvrnumber of mover entries read
[in]modelnamename of model or empty string

Definition at line 77 of file GwfMvrPeriodData.f90.

78 ! -- dummy
79 class(GwfMvrPeriodDataType) :: this !< GwfMvrPeriodDataType
80 type(BlockParserType), intent(inout) :: parser !< block parser
81 integer(I4B), intent(out) :: nmvr !< number of mover entries read
82 character(len=LENMODELNAME), intent(in) :: modelname !< name of model or empty string
83 ! -- local
84 integer(I4B) :: i
85 integer(I4B) :: maxmvr
86 logical :: endOfBlock
87 character(len=LINELENGTH) :: line
88 character(len=12) :: mvrtype_char
89 !
90 ! -- Initialize
91 i = 1
92 maxmvr = size(this%id1)
93 !
94 ! -- Read each mover entry
95 do
96 call parser%GetNextLine(endofblock)
97 if (endofblock) exit
98 !
99 ! -- Raise error if movers exceeds maxmvr
100 if (i > maxmvr) then
101 call parser%GetCurrentLine(line)
102 write (errmsg, '(a,a)') 'Movers exceed MAXMVR on line: ', &
103 trim(adjustl(line))
104 call store_error(errmsg)
105 call parser%StoreErrorUnit()
106 end if
107 !
108 ! -- modelname, package name, id for provider
109 if (modelname == '') then
110 call parser%GetStringCaps(this%mname1(i))
111 else
112 this%mname1(i) = modelname
113 end if
114 call parser%GetStringCaps(this%pname1(i))
115 this%id1(i) = parser%GetInteger()
116 !
117 ! -- modelname, package name, id for receiver
118 if (modelname == '') then
119 call parser%GetStringCaps(this%mname2(i))
120 else
121 this%mname2(i) = modelname
122 end if
123 call parser%GetStringCaps(this%pname2(i))
124 this%id2(i) = parser%GetInteger()
125 !
126 ! -- Mover type and value
127 call parser%GetStringCaps(mvrtype_char)
128 select case (mvrtype_char)
129 case ('FACTOR')
130 this%imvrtype(i) = 1
131 case ('EXCESS')
132 this%imvrtype(i) = 2
133 case ('THRESHOLD')
134 this%imvrtype(i) = 3
135 case ('UPTO')
136 this%imvrtype(i) = 4
137 case default
138 call store_error('Invalid mover type: '//trim(mvrtype_char))
139 call parser%StoreErrorUnit()
140 end select
141 this%value(i) = parser%GetDouble()
142 i = i + 1
143 end do
144 nmvr = i - 1
Here is the call graph for this function: