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

Data Types

type  gwfprtexchangetype

Functions/Subroutines

subroutine, public gwfprt_cr (filename, id, m1id, m2id)
 Create a new GWF to PRT exchange object.
subroutine set_model_pointers (this)
subroutine exg_df (this)
subroutine exg_ar (this)
subroutine exg_da (this)
subroutine allocate_scalars (this)
subroutine gwfbnd2prtfmi (this)

Function/Subroutine Documentation

◆ allocate_scalars()

subroutine gwfprtexchangemodule::allocate_scalars ( class(gwfprtexchangetype) this)

Definition at line 310 of file exg-gwfprt.f90.

311 ! -- modules
313 ! -- dummy
314 class(GwfPrtExchangeType) :: this
315 ! -- local
316 !
317 call mem_allocate(this%m1id, 'M1ID', this%memoryPath)
318 call mem_allocate(this%m2id, 'M2ID', this%memoryPath)
319 this%m1id = 0
320 this%m2id = 0

◆ exg_ar()

subroutine gwfprtexchangemodule::exg_ar ( class(gwfprtexchangetype) this)

Definition at line 177 of file exg-gwfprt.f90.

178 ! -- modules
180 use dismodule, only: distype
181 use disvmodule, only: disvtype
182 use disumodule, only: disutype
183 ! -- dummy
184 class(GwfPrtExchangeType) :: this
185 ! -- local
186 class(BaseModelType), pointer :: mb => null()
187 type(GwfModelType), pointer :: gwfmodel => null()
188 type(PrtModelType), pointer :: prtmodel => null()
189 ! -- formats
190 character(len=*), parameter :: fmtdiserr = &
191 "('GWF and PRT Models do not have the same discretization for exchange&
192 & ',a,'.&
193 & GWF Model has ', i0, ' user nodes and ', i0, ' reduced nodes.&
194 & PRT Model has ', i0, ' user nodes and ', i0, ' reduced nodes.&
195 & Ensure discretization packages, including IDOMAIN, are identical.')"
196 character(len=*), parameter :: fmtidomerr = &
197 "('GWF and PRT Models do not have the same discretization for exchange&
198 & ',a,'.&
199 & GWF Model and PRT Model have different IDOMAIN arrays.&
200 & Ensure discretization packages, including IDOMAIN, are identical.')"
201 !
202 ! -- set gwfmodel
203 mb => getbasemodelfromlist(basemodellist, this%m1id)
204 select type (mb)
205 type is (gwfmodeltype)
206 gwfmodel => mb
207 end select
208 !
209 ! -- set prtmodel
210 mb => getbasemodelfromlist(basemodellist, this%m2id)
211 select type (mb)
212 type is (prtmodeltype)
213 prtmodel => mb
214 end select
215 !
216 ! -- Check to make sure sizes are identical
217 if (prtmodel%dis%nodes /= gwfmodel%dis%nodes .or. &
218 prtmodel%dis%nodesuser /= gwfmodel%dis%nodesuser) then
219 write (errmsg, fmtdiserr) trim(this%name), &
220 gwfmodel%dis%nodesuser, &
221 gwfmodel%dis%nodes, &
222 prtmodel%dis%nodesuser, &
223 prtmodel%dis%nodes
224 call store_error(errmsg, terminate=.true.)
225 end if
226 !
227 ! -- Make sure idomains are identical
228 select type (gwfdis => gwfmodel%dis)
229 type is (distype)
230 select type (prtdis => prtmodel%dis)
231 type is (distype)
232 if (.not. all(gwfdis%idomain == prtdis%idomain)) then
233 write (errmsg, fmtidomerr) trim(this%name)
234 call store_error(errmsg, terminate=.true.)
235 end if
236 end select
237 type is (disvtype)
238 select type (prtdis => prtmodel%dis)
239 type is (disvtype)
240 if (.not. all(gwfdis%idomain == prtdis%idomain)) then
241 write (errmsg, fmtidomerr) trim(this%name)
242 call store_error(errmsg, terminate=.true.)
243 end if
244 end select
245 type is (disutype)
246 select type (prtdis => prtmodel%dis)
247 type is (disutype)
248 if (.not. all(gwfdis%idomain == prtdis%idomain)) then
249 write (errmsg, fmtidomerr) trim(this%name)
250 call store_error(errmsg, terminate=.true.)
251 end if
252 end select
253 end select
254 !
255 ! -- setup pointers to gwf variables allocated in gwf_ar
256 prtmodel%fmi%gwfhead => gwfmodel%x
257 call mem_checkin(prtmodel%fmi%gwfhead, &
258 'GWFHEAD', prtmodel%fmi%memoryPath, &
259 'X', gwfmodel%memoryPath)
260 prtmodel%fmi%gwfsat => gwfmodel%npf%sat
261 call mem_checkin(prtmodel%fmi%gwfsat, &
262 'GWFSAT', prtmodel%fmi%memoryPath, &
263 'SAT', gwfmodel%npf%memoryPath)
264 prtmodel%fmi%gwfspdis => gwfmodel%npf%spdis
265 call mem_checkin(prtmodel%fmi%gwfspdis, &
266 'GWFSPDIS', prtmodel%fmi%memoryPath, &
267 'SPDIS', gwfmodel%npf%memoryPath)
268 prtmodel%fmi%igwfceltyp = 1
269 prtmodel%fmi%gwfceltyp => gwfmodel%npf%icelltype
270 call mem_checkin(prtmodel%fmi%gwfceltyp, &
271 'GWFCELTYP', prtmodel%fmi%memoryPath, &
272 'ICELLTYPE', gwfmodel%npf%memoryPath)
273 !
274 ! -- setup pointers to the flow storage rates. GWF strg arrays are
275 ! available after the gwf_ar routine is called.
276 if (prtmodel%inmst > 0) then
277 if (gwfmodel%insto > 0) then
278 prtmodel%fmi%gwfstrgss => gwfmodel%sto%strgss
279 prtmodel%fmi%igwfstrgss = 1
280 if (gwfmodel%sto%iusesy == 1) then
281 prtmodel%fmi%gwfstrgsy => gwfmodel%sto%strgsy
282 prtmodel%fmi%igwfstrgsy = 1
283 end if
284 end if
285 end if
286
287 ! -- transfer the boundary package information from gwf to prt
288 call this%gwfbnd2prtfmi()
289
290 ! -- if mover package is active, then set a pointer to it's budget object
291 if (gwfmodel%inmvr /= 0) &
292 prtmodel%fmi%mvrbudobj => gwfmodel%mvr%budobj
293
294 ! -- todo connections
Structured grid discretization.
Definition Dis.f90:23
Unstructured grid discretization.
Definition Disu.f90:30
Vertex grid discretization.
Definition Disv.f90:25
Here is the call graph for this function:

◆ exg_da()

subroutine gwfprtexchangemodule::exg_da ( class(gwfprtexchangetype) this)

Definition at line 299 of file exg-gwfprt.f90.

300 ! -- modules
302 ! -- dummy
303 class(GwfPrtExchangeType) :: this
304 ! -- local
305 !
306 call mem_deallocate(this%m1id)
307 call mem_deallocate(this%m2id)

◆ exg_df()

subroutine gwfprtexchangemodule::exg_df ( class(gwfprtexchangetype) this)

Definition at line 119 of file exg-gwfprt.f90.

120 ! -- modules
122 ! -- dummy
123 class(GwfPrtExchangeType) :: this
124 ! -- local
125 class(BaseModelType), pointer :: mb => null()
126 type(GwfModelType), pointer :: gwfmodel => null()
127 type(PrtModelType), pointer :: prtmodel => null()
128 integer(I4B) :: ngwfpack, ip
129 class(BndType), pointer :: packobj => null()
130 !
131 !
132 ! -- set gwfmodel
133 mb => getbasemodelfromlist(basemodellist, this%m1id)
134 select type (mb)
135 type is (gwfmodeltype)
136 gwfmodel => mb
137 end select
138 !
139 ! -- set prtmodel
140 mb => getbasemodelfromlist(basemodellist, this%m2id)
141 select type (mb)
142 type is (prtmodeltype)
143 prtmodel => mb
144 end select
145 !
146 ! -- Check to make sure that flow is solved before particle tracking and in a
147 ! different solution
148 if (gwfmodel%idsoln >= prtmodel%idsoln) then
149 write (errmsg, '(3a)') 'Problem with GWF-PRT exchange ', trim(this%name), &
150 '. The GWF model must be solved by a different solution than the PRT model. &
151 &The IMS specified for GWF must be listed in mfsim.nam &
152 &before the EMS for PRT.'
153 call store_error(errmsg, terminate=.true.)
154 end if
155 !
156 ! -- Set pointer to flowja
157 prtmodel%fmi%gwfflowja => gwfmodel%flowja
158 call mem_checkin(prtmodel%fmi%gwfflowja, &
159 'GWFFLOWJA', prtmodel%fmi%memoryPath, &
160 'FLOWJA', gwfmodel%memoryPath)
161 !
162 ! -- Set the npf flag so that specific discharge is available for
163 ! transport calculations if dispersion is active
164 if (prtmodel%indsp > 0) then
165 gwfmodel%npf%icalcspdis = 1
166 end if
167 !
168 ! -- Set the auxiliary names for gwf flow packages in prt%fmi
169 ngwfpack = gwfmodel%bndlist%Count()
170 do ip = 1, ngwfpack
171 packobj => getbndfromlist(gwfmodel%bndlist, ip)
172 call prtmodel%fmi%gwfpackages(ip)%set_auxname(packobj%naux, &
173 packobj%auxname)
174 end do
Here is the call graph for this function:

◆ gwfbnd2prtfmi()

subroutine gwfprtexchangemodule::gwfbnd2prtfmi ( class(gwfprtexchangetype) this)

Definition at line 323 of file exg-gwfprt.f90.

324 ! -- modules
325 ! -- dummy
326 class(GwfPrtExchangeType) :: this
327 ! -- local
328 integer(I4B) :: ngwfpack, ip, iterm, imover
329 class(BaseModelType), pointer :: mb => null()
330 type(GwfModelType), pointer :: gwfmodel => null()
331 type(PrtModelType), pointer :: prtmodel => null()
332 class(BndType), pointer :: packobj => null()
333 !
334 ! -- set gwfmodel
335 mb => getbasemodelfromlist(basemodellist, this%m1id)
336 select type (mb)
337 type is (gwfmodeltype)
338 gwfmodel => mb
339 end select
340 !
341 ! -- set prtmodel
342 mb => getbasemodelfromlist(basemodellist, this%m2id)
343 select type (mb)
344 type is (prtmodeltype)
345 prtmodel => mb
346 end select
347 !
348 ! -- Call routines in FMI that will set pointers to the necessary flow
349 ! data (SIMVALS and SIMTOMVR) stored within each GWF flow package
350 ngwfpack = gwfmodel%bndlist%Count()
351 iterm = 1
352 do ip = 1, ngwfpack
353 packobj => getbndfromlist(gwfmodel%bndlist, ip)
354 call prtmodel%fmi%gwfpackages(iterm)%set_pointers( &
355 'SIMVALS', &
356 packobj%memoryPath, &
357 packobj%input_mempath)
358 iterm = iterm + 1
359 !
360 ! -- If a mover is active for this package, then establish a separate
361 ! pointer link for the mover flows stored in SIMTOMVR
362 imover = packobj%imover
363 if (packobj%isadvpak /= 0) imover = 0
364 if (imover /= 0) then
365 call prtmodel%fmi%gwfpackages(iterm)%set_pointers( &
366 'SIMTOMVR', &
367 packobj%memoryPath, &
368 packobj%input_mempath)
369 iterm = iterm + 1
370 end if
371 end do
Here is the call graph for this function:

◆ gwfprt_cr()

subroutine, public gwfprtexchangemodule::gwfprt_cr ( character(len=*), intent(in) filename,
integer(i4b), intent(in) id,
integer(i4b), intent(in) m1id,
integer(i4b), intent(in) m2id )

Definition at line 39 of file exg-gwfprt.f90.

40 ! -- modules
42 ! -- dummy
43 character(len=*), intent(in) :: filename
44 integer(I4B), intent(in) :: id
45 integer(I4B), intent(in) :: m1id
46 integer(I4B), intent(in) :: m2id
47 ! -- local
48 class(BaseExchangeType), pointer :: baseexchange => null()
49 type(GwfPrtExchangeType), pointer :: exchange => null()
50 character(len=20) :: cint
51 !
52 ! -- Create a new exchange and add it to the baseexchangelist container
53 allocate (exchange)
54 baseexchange => exchange
55 call addbaseexchangetolist(baseexchangelist, baseexchange)
56 !
57 ! -- Assign id and name
58 exchange%id = id
59 write (cint, '(i0)') id
60 exchange%name = 'GWF-PRT_'//trim(adjustl(cint))
61 exchange%memoryPath = exchange%name
62 !
63 ! -- allocate scalars
64 call exchange%allocate_scalars()
65 !
66 ! -- NB: convert from id to local model index in base model list
67 exchange%m1id = model_loc_idx(m1id)
68 exchange%m2id = model_loc_idx(m2id)
69 !
70 ! -- set model pointers
71 call exchange%set_model_pointers()
This module contains simulation variables.
integer(i4b), dimension(:), allocatable model_loc_idx
equals the local index into the basemodel list (-1 when not available)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_model_pointers()

subroutine gwfprtexchangemodule::set_model_pointers ( class(gwfprtexchangetype) this)

Definition at line 74 of file exg-gwfprt.f90.

75 ! -- modules
76 ! -- dummy
77 class(GwfPrtExchangeType) :: this
78 ! -- local
79 class(BaseModelType), pointer :: mb => null()
80 type(GwfModelType), pointer :: gwfmodel => null()
81 type(PrtModelType), pointer :: prtmodel => null()
82 !
83 ! -- set gwfmodel
84 mb => getbasemodelfromlist(basemodellist, this%m1id)
85 select type (mb)
86 type is (gwfmodeltype)
87 gwfmodel => mb
88 end select
89 !
90 ! -- set prtmodel
91 mb => getbasemodelfromlist(basemodellist, this%m2id)
92 select type (mb)
93 type is (prtmodeltype)
94 prtmodel => mb
95 end select
96 !
97 ! -- Verify that GWF model is of the correct type
98 if (.not. associated(gwfmodel)) then
99 write (errmsg, '(3a)') 'Problem with GWF-PRT exchange ', trim(this%name), &
100 '. Specified GWF Model does not appear to be of the correct type.'
101 call store_error(errmsg, terminate=.true.)
102 end if
103 !
104 ! -- Verify that PRT model is of the correct type
105 if (.not. associated(prtmodel)) then
106 write (errmsg, '(3a)') 'Problem with GWF-PRT exchange ', trim(this%name), &
107 '. Specified PRT Model does not appear to be of the correct type.'
108 call store_error(errmsg, terminate=.true.)
109 end if
110 !
111 ! -- Tell particle tracking model fmi flows are not read from file
112 prtmodel%fmi%flows_from_file = .false.
113 !
114 ! -- Set a pointer to the GWF bndlist. This will allow the transport model
115 ! to look through the flow packages and establish a link to GWF flows
116 prtmodel%fmi%gwfbndlist => gwfmodel%bndlist
Here is the call graph for this function: