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

Data Types

type  disconnexchangetype
 Exchange based on connection between discretizations of DisBaseType. The data specifies the connections, similar to the information stored in the connections object: DisBaseTypecon. More...
type  disconnexchangefoundtype
 DisConnExchangeFoundType. More...

Functions/Subroutines

subroutine source_options (this, iout)
 Source options from input context.
subroutine source_dimensions (this, iout)
 Source dimension from input context.
integer(i4b) function noder (this, model, cellid, iout)
 Returns reduced node number from user.
character(len=20) function cellstr (this, ndim, cellid, iout)
subroutine source_data (this, iout)
 Source exchange data from input context.
subroutine allocate_scalars (this)
 Allocate scalars and initialize to defaults.
subroutine allocate_arrays (this)
 Allocate array data, using the number of connected nodes nexg.
logical(lgp) function use_interface_model (this)
 Should interface model be used to handle these exchanges, to be overridden for inheriting types.
subroutine disconnex_da (this)
 Clean up all scalars and arrays.
class(disconnexchangetype) function, pointer, public castasdisconnexchangeclass (obj)
subroutine, public adddisconnexchangetolist (list, exchange)
class(disconnexchangetype) function, pointer, public getdisconnexchangefromlist (list, idx)

Function/Subroutine Documentation

◆ adddisconnexchangetolist()

subroutine, public disconnexchangemodule::adddisconnexchangetolist ( type(listtype), intent(inout) list,
class(disconnexchangetype), intent(in), pointer exchange )

Definition at line 534 of file DisConnExchange.f90.

535 implicit none
536 ! -- dummy
537 type(ListType), intent(inout) :: list
538 class(DisConnExchangeType), pointer, intent(in) :: exchange
539 ! -- local
540 class(*), pointer :: obj
541 !
542 obj => exchange
543 call list%Add(obj)

◆ allocate_arrays()

subroutine disconnexchangemodule::allocate_arrays ( class(disconnexchangetype) this)
private
Parameters
thisinstance of exchange object

Definition at line 447 of file DisConnExchange.f90.

448 ! -- dummy
449 class(DisConnExchangeType) :: this !< instance of exchange object
450 !
451 call mem_allocate(this%nodem1, this%nexg, 'NODEM1', this%memoryPath)
452 call mem_allocate(this%nodem2, this%nexg, 'NODEM2', this%memoryPath)
453 call mem_allocate(this%ihc, this%nexg, 'IHC', this%memoryPath)
454 call mem_allocate(this%cl1, this%nexg, 'CL1', this%memoryPath)
455 call mem_allocate(this%cl2, this%nexg, 'CL2', this%memoryPath)
456 call mem_allocate(this%hwva, this%nexg, 'HWVA', this%memoryPath)
457 ! NB: auxname array is allocated while parsing
458 call mem_allocate(this%auxvar, this%naux, this%nexg, &
459 'AUXVAR', this%memoryPath)
460 !
461 ! allocate boundname
462 if (this%inamedbound == 1) then
463 allocate (this%boundname(this%nexg))
464 else
465 allocate (this%boundname(1))
466 end if
467 this%boundname(:) = ''

◆ allocate_scalars()

subroutine disconnexchangemodule::allocate_scalars ( class(disconnexchangetype) this)
private
Parameters
thisinstance of exchange object

Definition at line 406 of file DisConnExchange.f90.

407 ! -- modules
409 ! -- dummy
410 class(DisConnExchangeType) :: this !< instance of exchange object
411 !
412 allocate (this%filename)
413 this%filename = ''
414 !
415 call mem_allocate(this%nexg, 'NEXG', this%memoryPath)
416 call mem_allocate(this%naux, 'NAUX', this%memoryPath)
417 call mem_allocate(this%ianglex, 'IANGLEX', this%memoryPath)
418 call mem_allocate(this%icdist, 'ICDIST', this%memoryPath)
419 call mem_allocate(this%ixt3d, 'IXT3D', this%memoryPath)
420 call mem_allocate(this%iprpak, 'IPRPAK', this%memoryPath)
421 call mem_allocate(this%iprflow, 'IPRFLOW', this%memoryPath)
422 call mem_allocate(this%ipakcb, 'IPAKCB', this%memoryPath)
423 call mem_allocate(this%inamedbound, 'INAMEDBOUND', this%memoryPath)
424 call mem_allocate(this%dev_ifmod_on, 'DEV_IFMOD_ON', this%memoryPath)
425
426 call mem_allocate(this%auxname, lenauxname, 0, &
427 'AUXNAME', this%memoryPath)
428 call mem_allocate(this%auxname_cst, lenauxname, 0, &
429 'AUXNAME_CST', this%memoryPath)
430 !
431 this%nexg = 0
432 this%naux = 0
433 this%ianglex = 0
434 this%icdist = 0
435 this%ixt3d = 0
436 this%iprpak = 0
437 this%iprflow = 0
438 this%ipakcb = 0
439 this%inamedbound = 0
440 !
441 this%dev_ifmod_on = .false.

◆ castasdisconnexchangeclass()

class(disconnexchangetype) function, pointer, public disconnexchangemodule::castasdisconnexchangeclass ( class(*), intent(inout), pointer obj)

Definition at line 518 of file DisConnExchange.f90.

519 implicit none
520 ! -- dummy
521 class(*), pointer, intent(inout) :: obj
522 ! -- return
523 class(DisConnExchangeType), pointer :: res
524 !
525 res => null()
526 if (.not. associated(obj)) return
527 !
528 select type (obj)
529 class is (disconnexchangetype)
530 res => obj
531 end select
Here is the caller graph for this function:

◆ cellstr()

character(len=20) function disconnexchangemodule::cellstr ( class(disconnexchangetype) this,
integer(i4b) ndim,
integer(i4b), dimension(:), intent(in) cellid,
integer(i4b), intent(in) iout )
private
Parameters
thisinstance of exchange object
ndimmodel DIS dimension
[in]ioutthe output file unit

Definition at line 221 of file DisConnExchange.f90.

222 ! -- modules
223 ! -- dummy
224 class(DisConnExchangeType) :: this !< instance of exchange object
225 integer(I4B) :: ndim !< model DIS dimension
226 integer(I4B), dimension(:), intent(in) :: cellid
227 integer(I4B), intent(in) :: iout !< the output file unit
228 character(len=20) :: cellstr
229 character(len=*), parameter :: fmtndim1 = &
230 "('(',i0,')')"
231 character(len=*), parameter :: fmtndim2 = &
232 "('(',i0,',',i0,')')"
233 character(len=*), parameter :: fmtndim3 = &
234 "('(',i0,',',i0,',',i0,')')"
235 !
236 cellstr = ''
237 !
238 select case (ndim)
239 case (1)
240 write (cellstr, fmtndim1) cellid(1)
241 case (2)
242 write (cellstr, fmtndim2) cellid(1), cellid(2)
243 case (3)
244 write (cellstr, fmtndim3) cellid(1), cellid(2), cellid(3)
245 case default
246 end select
Here is the call graph for this function:
Here is the caller graph for this function:

◆ disconnex_da()

subroutine disconnexchangemodule::disconnex_da ( class(disconnexchangetype) this)
private
Parameters
thisinstance of exchange object

Definition at line 486 of file DisConnExchange.f90.

487 ! -- modules
489 ! -- dummy
490 class(DisConnExchangeType) :: this !< instance of exchange object
491 !
492 ! arrays
493 call mem_deallocate(this%nodem1)
494 call mem_deallocate(this%nodem2)
495 call mem_deallocate(this%ihc)
496 call mem_deallocate(this%cl1)
497 call mem_deallocate(this%cl2)
498 call mem_deallocate(this%hwva)
499 call mem_deallocate(this%auxvar)
500 !
501 deallocate (this%boundname)
502 !
503 ! scalars
504 call mem_deallocate(this%nexg)
505 call mem_deallocate(this%naux)
506 call mem_deallocate(this%auxname, 'AUXNAME', this%memoryPath)
507 call mem_deallocate(this%auxname_cst, 'AUXNAME_CST', this%memoryPath)
508 call mem_deallocate(this%ianglex)
509 call mem_deallocate(this%icdist)
510 call mem_deallocate(this%ixt3d)
511 call mem_deallocate(this%iprpak)
512 call mem_deallocate(this%iprflow)
513 call mem_deallocate(this%ipakcb)
514 call mem_deallocate(this%inamedbound)
515 call mem_deallocate(this%dev_ifmod_on)

◆ getdisconnexchangefromlist()

class(disconnexchangetype) function, pointer, public disconnexchangemodule::getdisconnexchangefromlist ( type(listtype), intent(inout) list,
integer(i4b), intent(in) idx )

Definition at line 546 of file DisConnExchange.f90.

547 implicit none
548 ! -- dummy
549 type(ListType), intent(inout) :: list
550 integer(I4B), intent(in) :: idx
551 ! -- return
552 class(DisConnExchangeType), pointer :: res
553 ! -- local
554 class(*), pointer :: obj
555 !
556 obj => list%GetItem(idx)
557 res => castasdisconnexchangeclass(obj)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ noder()

integer(i4b) function disconnexchangemodule::noder ( class(disconnexchangetype) this,
class(numericalmodeltype), intent(in), pointer model,
integer(i4b), dimension(:), intent(in) cellid,
integer(i4b), intent(in) iout )
private
Parameters
thisinstance of exchange object
[in]ioutthe output file unit

Definition at line 194 of file DisConnExchange.f90.

195 ! -- modules
196 use geomutilmodule, only: get_node
197 ! -- dummy
198 class(DisConnExchangeType) :: this !< instance of exchange object
199 class(NumericalModelType), pointer, intent(in) :: model
200 integer(I4B), dimension(:), intent(in) :: cellid
201 integer(I4B), intent(in) :: iout !< the output file unit
202 integer(I4B) :: noder, node
203 !
204 if (model%dis%ndim == 1) then
205 node = cellid(1)
206 elseif (model%dis%ndim == 2) then
207 node = get_node(cellid(1), 1, cellid(2), &
208 model%dis%mshape(1), 1, &
209 model%dis%mshape(2))
210 else
211 node = get_node(cellid(1), cellid(2), cellid(3), &
212 model%dis%mshape(1), &
213 model%dis%mshape(2), &
214 model%dis%mshape(3))
215 end if
216 noder = model%dis%get_nodenumber(node, 0)
integer(i4b) function, public get_node(ilay, irow, icol, nlay, nrow, ncol)
Get node number, given layer, row, and column indices for a structured grid. If any argument is inval...
Definition GeomUtil.f90:92
Here is the call graph for this function:
Here is the caller graph for this function:

◆ source_data()

subroutine disconnexchangemodule::source_data ( class(disconnexchangetype) this,
integer(i4b), intent(in) iout )
private
Parameters
thisinstance of exchange object
[in]ioutthe output file unit

Definition at line 251 of file DisConnExchange.f90.

252 ! -- modules
255 ! -- dummy
256 class(DisConnExchangeType) :: this !< instance of exchange object
257 integer(I4B), intent(in) :: iout !< the output file unit
258 ! -- local
259 integer(I4B), dimension(:, :), contiguous, pointer :: cellidm1
260 integer(I4B), dimension(:, :), contiguous, pointer :: cellidm2
261 integer(I4B), dimension(:), contiguous, pointer :: ihc
262 real(DP), dimension(:), contiguous, pointer :: cl1
263 real(DP), dimension(:), contiguous, pointer :: cl2
264 real(DP), dimension(:), contiguous, pointer :: hwva
265 real(DP), dimension(:, :), contiguous, pointer :: auxvar
266 type(CharacterStringType), dimension(:), contiguous, pointer :: boundname
267 integer(I4B) :: ndim1, ndim2
268 character(len=20) :: cellstr1, cellstr2
269 character(len=2) :: cnfloat
270 integer(I4B) :: nerr, iaux
271 integer(I4B) :: iexg, nodem1, nodem2
272 ! -- format
273 character(len=*), parameter :: fmtexglabel = "(1x, 3a10, 50(a16))"
274 character(len=*), parameter :: fmtexgdata = &
275 "(5x, a, 1x, a ,I10, 50(1pg16.6))"
276 character(len=40) :: fmtexgdata2
277 !
278 call mem_setptr(cellidm1, 'CELLIDM1', this%input_mempath)
279 call mem_setptr(cellidm2, 'CELLIDM2', this%input_mempath)
280 call mem_setptr(ihc, 'IHC', this%input_mempath)
281 call mem_setptr(cl1, 'CL1', this%input_mempath)
282 call mem_setptr(cl2, 'CL2', this%input_mempath)
283 call mem_setptr(hwva, 'HWVA', this%input_mempath)
284 call mem_setptr(auxvar, 'AUXVAR', this%input_mempath)
285 call mem_setptr(boundname, 'BOUNDNAME', this%input_mempath)
286 ndim1 = size(cellidm1, dim=1)
287 ndim2 = size(cellidm2, dim=1)
288 !
289 write (iout, '(1x,a)') 'PROCESSING EXCHANGEDATA'
290 !
291 if (this%iprpak /= 0) then
292 if (this%inamedbound == 0) then
293 write (iout, fmtexglabel) 'NODEM1', 'NODEM2', 'IHC', &
294 'CL1', 'CL2', 'HWVA', (adjustr(this%auxname(iaux)), &
295 iaux=1, this%naux)
296 else
297 write (iout, fmtexglabel) 'NODEM1', 'NODEM2', 'IHC', 'CL1', 'CL2', &
298 'HWVA', (adjustr(this%auxname(iaux)), iaux=1, this%naux), &
299 ' BOUNDNAME '
300 ! Define format suitable for writing input data,
301 ! any auxiliary variables, and boundname.
302 write (cnfloat, '(i0)') 3 + this%naux
303 fmtexgdata2 = '(5x, a, 1x, a, i10, '//trim(cnfloat)// &
304 '(1pg16.6), 1x, a)'
305 end if
306 end if
307 !
308 do iexg = 1, this%nexg
309 !
310 if (associated(this%model1)) then
311 !
312 ! -- Determine reduced node number
313 nodem1 = this%noder(this%model1, cellidm1(:, iexg), iout)
314 this%nodem1(iexg) = nodem1
315 !
316 else
317 this%nodem1(iexg) = -1
318 end if
319 !
320 if (associated(this%model2)) then
321 !
322 ! -- Determine reduced node number
323 nodem2 = this%noder(this%model2, cellidm2(:, iexg), iout)
324 this%nodem2(iexg) = nodem2
325 !
326 else
327 this%nodem2(iexg) = -1
328 end if
329 !
330 ! -- Read rest of input line
331 this%ihc(iexg) = ihc(iexg)
332 this%cl1(iexg) = cl1(iexg)
333 this%cl2(iexg) = cl2(iexg)
334 this%hwva(iexg) = hwva(iexg)
335 do iaux = 1, this%naux
336 this%auxvar(iaux, iexg) = auxvar(iaux, iexg)
337 end do
338 if (this%inamedbound == 1) then
339 this%boundname(iexg) = boundname(iexg)
340 end if
341 !
342 ! -- Write the data to listing file if requested
343 if (this%iprpak /= 0) then
344 cellstr1 = this%cellstr(ndim1, cellidm1(:, iexg), iout)
345 cellstr2 = this%cellstr(ndim2, cellidm2(:, iexg), iout)
346 if (this%inamedbound == 0) then
347 write (iout, fmtexgdata) trim(cellstr1), trim(cellstr2), &
348 this%ihc(iexg), this%cl1(iexg), this%cl2(iexg), &
349 this%hwva(iexg), &
350 (this%auxvar(iaux, iexg), iaux=1, this%naux)
351 else
352 write (iout, fmtexgdata2) trim(cellstr1), trim(cellstr2), &
353 this%ihc(iexg), this%cl1(iexg), this%cl2(iexg), &
354 this%hwva(iexg), &
355 (this%auxvar(iaux, iexg), iaux=1, this%naux), &
356 trim(this%boundname(iexg))
357 end if
358 end if
359 !
360 ! -- Check to see if nodem1 is outside of active domain
361 if (associated(this%model1)) then
362 if (nodem1 <= 0) then
363 cellstr1 = this%cellstr(ndim1, cellidm1(:, iexg), iout)
364 write (errmsg, *) &
365 trim(adjustl(this%model1%name))// &
366 ' Cell is outside active grid domain ('// &
367 trim(adjustl(cellstr1))//').'
368 call store_error(errmsg)
369 end if
370 end if
371 !
372 ! -- Check to see if nodem2 is outside of active domain
373 if (associated(this%model2)) then
374 if (nodem2 <= 0) then
375 cellstr2 = this%cellstr(ndim2, cellidm2(:, iexg), iout)
376 write (errmsg, *) &
377 trim(adjustl(this%model2%name))// &
378 ' Cell is outside active grid domain ('// &
379 trim(adjustl(cellstr2))//').'
380 call store_error(errmsg)
381 end if
382 end if
383 end do
384 !
385 write (iout, '(1x,a)') 'END OF EXCHANGEDATA'
386 !
387 ! -- Stop if errors
388 nerr = count_errors()
389 if (nerr > 0) then
390 call store_error('Errors encountered in exchange input file.')
391 call store_error_filename(this%filename)
392 end if
393 !
394 call memorystore_release('CELLIDM1', this%input_mempath)
395 call memorystore_release('CELLIDM2', this%input_mempath)
396 call memorystore_release('IHC', this%input_mempath)
397 call memorystore_release('CL1', this%input_mempath)
398 call memorystore_release('CL2', this%input_mempath)
399 Call memorystore_release('HWVA', this%input_mempath)
400 call memorystore_release('AUXVAR', this%input_mempath)
401 call memorystore_release('BOUNDNAME', this%input_mempath)
subroutine, public memorystore_release(varname, memory_path)
Release a single variable from the memory store.
Here is the call graph for this function:

◆ source_dimensions()

subroutine disconnexchangemodule::source_dimensions ( class(disconnexchangetype) this,
integer(i4b), intent(in) iout )
private
Parameters
thisinstance of exchange object
[in]ioutfor logging

Definition at line 171 of file DisConnExchange.f90.

172 ! -- modules
174 ! -- dummy
175 class(DisConnExchangeType) :: this !< instance of exchange object
176 integer(I4B), intent(in) :: iout !< for logging
177 ! -- local
178 type(DisConnExchangeFoundType) :: found
179 !
180 ! -- update defaults with idm sourced values
181 call mem_set_value(this%nexg, 'NEXG', this%input_mempath, found%nexg)
182 !
183 write (iout, '(1x,a)') 'PROCESSING EXCHANGE DIMENSIONS'
184 !
185 if (found%nexg) then
186 write (iout, '(4x,a,i0)') 'NEXG = ', this%nexg
187 end if
188 !
189 write (iout, '(1x,a)') 'END OF EXCHANGE DIMENSIONS'

◆ source_options()

subroutine disconnexchangemodule::source_options ( class(disconnexchangetype) this,
integer(i4b), intent(in) iout )
Parameters
thisinstance of exchange object
[in]ioutfor logging

Definition at line 95 of file DisConnExchange.f90.

96 ! -- modules
98 use arrayhandlersmodule, only: ifind
99 ! -- dummy
100 class(DisConnExchangeType) :: this !< instance of exchange object
101 integer(I4B), intent(in) :: iout !< for logging
102 ! -- local
103 type(DisConnExchangeFoundType) :: found
104 integer(I4B) :: ival, n
105 !
106 ! -- update defaults with idm sourced values
107 call mem_set_value(this%naux, 'NAUX', this%input_mempath, found%naux, &
108 release=.false.)
109 call mem_set_value(this%ipakcb, 'IPAKCB', this%input_mempath, found%ipakcb)
110 call mem_set_value(this%iprpak, 'IPRPAK', this%input_mempath, found%iprpak)
111 call mem_set_value(this%iprflow, 'IPRFLOW', this%input_mempath, found%iprflow)
112 call mem_set_value(this%inamedbound, 'BOUNDNAMES', this%input_mempath, &
113 found%boundnames, release=.false.)
114 call mem_set_value(this%dev_ifmod_on, 'DEV_IFMOD_ON', this%input_mempath, &
115 found%dev_ifmod_on)
116 !
117 ! -- reallocate aux arrays if aux variables provided
118 if (found%naux .and. this%naux > 0) then
119 call mem_reallocate(this%auxname, lenauxname, this%naux, &
120 'AUXNAME', this%memoryPath)
121 call mem_reallocate(this%auxname_cst, lenauxname, this%naux, &
122 'AUXNAME_CST', this%memoryPath)
123 call mem_set_value(this%auxname_cst, 'AUXILIARY', this%input_mempath, &
124 found%auxiliary, release=.false.)
125 !
126 do n = 1, this%naux
127 this%auxname(n) = this%auxname_cst(n)
128 end do
129 !
130 ! -- If ANGLDEGX is an auxiliary variable, then anisotropy can be
131 ! used in either model. Store ANGLDEGX position in this%ianglex
132 ival = ifind(this%auxname, 'ANGLDEGX')
133 if (ival > 0) then
134 this%ianglex = ival
135 end if
136 !
137 ival = ifind(this%auxname, 'CDIST')
138 if (ival > 0) then
139 this%icdist = ival
140 end if
141 end if
142 !
143 if (found%ipakcb) then
144 this%ipakcb = -1
145 write (iout, '(4x,a)') &
146 'EXCHANGE FLOWS WILL BE SAVED TO BINARY BUDGET FILES.'
147 end if
148 !
149 if (found%iprpak) then
150 write (iout, '(4x,a)') &
151 'THE LIST OF EXCHANGES WILL BE PRINTED.'
152 end if
153 !
154 if (found%iprflow) then
155 write (iout, '(4x,a)') &
156 'EXCHANGE FLOWS WILL BE PRINTED TO LIST FILES.'
157 end if
158 !
159 if (found%boundnames) then
160 write (iout, '(4x,a)') 'EXCHANGE BOUNDARIES HAVE NAMES IN LAST COLUMN'
161 end if
162 !
163 if (found%dev_ifmod_on) then
164 write (iout, '(4x,2a)') 'Interface model coupling approach manually &
165 &activated for ', trim(this%name)
166 end if

◆ use_interface_model()

logical(lgp) function disconnexchangemodule::use_interface_model ( class(disconnexchangetype) this)
private
Parameters
thisinstance of exchange object
Returns
flag whether interface model should be used for this exchange instead

Definition at line 473 of file DisConnExchange.f90.

474 ! -- dummy
475 class(DisConnExchangeType) :: this !< instance of exchange object
476 ! -- return
477 logical(LGP) :: use_im !< flag whether interface model should be used
478 !! for this exchange instead
479 !
480 ! use im when one of the models is not local
481 use_im = .not. (this%v_model1%is_local .and. this%v_model2%is_local)