27 integer(I4B),
pointer :: m1_idx => null()
28 integer(I4B),
pointer :: m2_idx => null()
29 character(len=LINELENGTH) :: filename
52 character(len=*),
intent(in) :: filename
53 integer(I4B),
intent(in) :: id
54 integer(I4B),
intent(in) :: m1_id
55 integer(I4B),
intent(in) :: m2_id
59 character(len=20) :: cint
63 baseexchange => exchange
68 write (cint,
'(i0)') id
69 exchange%name =
'GWF-GWT_'//trim(adjustl(cint))
70 exchange%memoryPath = exchange%name
71 exchange%filename = filename
74 call exchange%allocate_scalars()
81 call exchange%set_model_pointers()
111 if (.not.
associated(gwfmodel))
then
112 write (
errmsg,
'(3a)')
'Problem with GWF-GWT exchange ', trim(this%name), &
113 '. Specified GWF Model does not appear to be of the correct type.'
118 if (.not.
associated(gwtmodel))
then
119 write (
errmsg,
'(3a)')
'Problem with GWF-GWT exchange ', trim(this%name), &
120 '. Specified GWT Model does not appear to be of the correct type.'
125 gwtmodel%fmi%flows_from_file = .false.
129 gwtmodel%fmi%gwfbndlist => gwfmodel%bndlist
160 if (gwfmodel%idsoln >= gwtmodel%idsoln)
then
161 write (
errmsg,
'(3a)')
'Problem with GWF-GWT exchange ', trim(this%name), &
162 '. The GWF model must be solved by a different IMS than the GWT model. &
163 &Furthermore, the IMS specified for GWF must be listed in mfsim.nam &
164 &before the IMS for GWT.'
169 gwtmodel%fmi%gwfflowja => gwfmodel%flowja
171 'GWFFLOWJA', gwtmodel%fmi%memoryPath, &
172 'FLOWJA', gwfmodel%memoryPath)
177 if (gwtmodel%indsp > 0)
then
178 gwfmodel%npf%icalcspdis = 1
194 character(len=*),
parameter :: fmtdiserr = &
195 "('GWF and GWT Models do not have the same discretization for exchange&
197 & GWF Model has ', i0, ' user nodes and ', i0, ' reduced nodes.&
198 & GWT Model has ', i0, ' user nodes and ', i0, ' reduced nodes.&
199 & Ensure discretization packages, including IDOMAIN, are identical.')"
216 if (gwtmodel%dis%nodes /= gwfmodel%dis%nodes .or. &
217 gwtmodel%dis%nodesuser /= gwfmodel%dis%nodesuser)
then
218 write (
errmsg, fmtdiserr) trim(this%name), &
219 gwfmodel%dis%nodesuser, &
220 gwfmodel%dis%nodes, &
221 gwtmodel%dis%nodesuser, &
227 gwtmodel%fmi%gwfhead => gwfmodel%x
229 'GWFHEAD', gwtmodel%fmi%memoryPath, &
230 'X', gwfmodel%memoryPath)
231 gwtmodel%fmi%gwfsat => gwfmodel%npf%sat
233 'GWFSAT', gwtmodel%fmi%memoryPath, &
234 'SAT', gwfmodel%npf%memoryPath)
235 gwtmodel%fmi%gwfspdis => gwfmodel%npf%spdis
237 'GWFSPDIS', gwtmodel%fmi%memoryPath, &
238 'SPDIS', gwfmodel%npf%memoryPath)
242 if (gwtmodel%inmst > 0)
then
243 if (gwfmodel%insto > 0)
then
244 gwtmodel%fmi%gwfstrgss => gwfmodel%sto%strgss
245 gwtmodel%fmi%igwfstrgss = 1
246 if (gwfmodel%sto%iusesy == 1)
then
247 gwtmodel%fmi%gwfstrgsy => gwfmodel%sto%strgsy
248 gwtmodel%fmi%igwfstrgsy = 1
254 if (gwfmodel%inbuy > 0)
then
255 call gwfmodel%buy%set_concentration_pointer(gwtmodel%name, gwtmodel%x, &
260 if (gwfmodel%invsc > 0)
then
261 call gwfmodel%vsc%set_concentration_pointer(gwtmodel%name, gwtmodel%x, &
266 call this%gwfbnd2gwtfmi()
269 if (gwfmodel%inmvr /= 0)
then
270 gwtmodel%fmi%mvrbudobj => gwfmodel%mvr%budobj
274 call this%gwfconn2gwtconn(gwfmodel, gwtmodel)
290 class(*),
pointer :: objPtr => null()
295 integer(I4B) :: ic1, ic2, iex
296 integer(I4B) :: gwfConnIdx, gwfExIdx
297 logical(LGP) :: areEqual
303 if (.not.
associated(conn%owner, gwtmodel)) cycle gwtloop
308 gwtexg => gwtconn%gwtExchange
316 if (
associated(conn%owner, gwfmodel))
then
320 gwfexg => gwfconn%gwfExchange
330 if (gwfexg%v_model1%name /= gwtexg%gwfmodelname1) cycle
331 if (gwfexg%v_model2%name /= gwtexg%gwfmodelname2) cycle
333 areequal = (gwfexg%nexg == gwtexg%nexg)
335 areequal = all(gwfexg%nodem1 == gwtexg%nodem1)
336 areequal = areequal .and. all(gwfexg%nodem2 == gwtexg%nodem2)
340 write (
iout,
'(/6a)')
'Linking exchange ', &
341 trim(gwtexg%name),
' to ', trim(gwfexg%name), &
342 ' (using interface model) for GWT model ', &
345 call this%link_connections(gwtconn, gwfconn)
354 if (gwfconnidx == -1)
then
358 if (.not.
associated(gwfexg)) cycle gwfloopexg
360 if (
associated(gwfexg%model1, gwfmodel) .or. &
361 associated(gwfexg%model2, gwfmodel))
then
363 if (gwfexg%v_model1%name /= gwtexg%gwfmodelname1) cycle
364 if (gwfexg%v_model2%name /= gwtexg%gwfmodelname2) cycle
366 areequal = (gwfexg%nexg == gwtexg%nexg)
369 areequal = all(gwfexg%nodem1 == gwtexg%nodem1)
370 areequal = areequal .and. all(gwfexg%nodem2 == gwtexg%nodem2)
374 write (
iout,
'(/6a)')
'Linking exchange ', &
375 trim(gwtexg%name),
' to ', trim(gwfexg%name),
' for GWT model ', &
378 if (gwtconn%owns_exchange)
then
379 gwtexg%gwfsimvals => gwfexg%simvals
381 'GWFSIMVALS', gwtexg%memoryPath, &
382 'SIMVALS', gwfexg%memoryPath)
386 if (gwfexg%inmvr > 0)
then
387 if (gwtconn%owns_exchange)
then
389 call gwtexg%mvt%set_pointer_mvrbudobj(gwfexg%mvr%budobj)
393 if (
associated(gwfexg%model2, gwfmodel)) gwtconn%exgflowSign = -1
394 gwtconn%gwtInterfaceModel%fmi%flows_from_file = .false.
403 if (gwfconnidx == -1 .and. gwfexidx == -1)
then
405 write (errmsg, *)
'Cannot find GWF-GWF exchange when connecting'// &
406 ' GWT model ', trim(gwtmodel%name),
' with exchange ', &
407 trim(gwtexg%name),
' to GWF model ', trim(gwfmodel%name), &
408 '. Note: GWF-GWF and GWT-GWT need identical exchange data '// &
409 '(both in value and order) for the match to succeed.'
432 if (gwtconn%owns_exchange)
then
433 gwtconn%gwtExchange%gwfsimvals => gwfconn%gwfExchange%simvals
435 'GWFSIMVALS', gwtconn%gwtExchange%memoryPath, &
436 'SIMVALS', gwfconn%gwfExchange%memoryPath)
440 if (gwfconn%gwfExchange%inmvr > 0)
then
441 if (gwtconn%owns_exchange)
then
443 call gwtconn%gwtExchange%mvt%set_pointer_mvrbudobj( &
444 gwfconn%gwfExchange%mvr%budobj)
448 if (
associated(gwfconn%gwfExchange%model2, gwfconn%owner))
then
449 gwtconn%exgflowSign = -1
453 gwtconn%gwtInterfaceModel%fmi%flows_from_file = .false.
495 integer(I4B) :: ngwfpack, ip, iterm, imover
499 class(
bndtype),
pointer :: packobj => null()
517 ngwfpack = gwfmodel%bndlist%Count()
521 call gwtmodel%fmi%gwfpackages(iterm)%set_pointers( &
523 packobj%memoryPath, packobj%input_mempath)
528 imover = packobj%imover
529 if (packobj%isadvpak /= 0) imover = 0
530 if (imover /= 0)
then
531 call gwtmodel%fmi%gwfpackages(iterm)%set_pointers( &
533 packobj%memoryPath, packobj%input_mempath)
subroutine, public addbaseexchangetolist(list, exchange)
Add the exchange object (BaseExchangeType) to a list.
class(basemodeltype) function, pointer, public getbasemodelfromlist(list, idx)
This module contains the base boundary package.
class(bndtype) function, pointer, public getbndfromlist(list, idx)
Get boundary from package list.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lenpackagename
maximum length of the package name
class(gwfgwfconnectiontype) function, pointer, public castasgwfgwfconnection(obj)
Cast to GwfGwfConnectionType.
This module contains the GwfGwfExchangeModule Module.
class(gwfexchangetype) function, pointer, public getgwfexchangefromlist(list, idx)
@ brief Get exchange from list
subroutine exg_da(this)
Deallocate memory.
subroutine gwfconn2gwtconn(this, gwfModel, gwtModel)
Link GWT connections to GWF connections or exchanges.
subroutine, public gwfgwt_cr(filename, id, m1_id, m2_id)
Create a new GWF to GWT exchange object.
subroutine link_connections(this, gwtConn, gwfConn)
Links a GWT connection to its GWF counterpart.
subroutine gwfbnd2gwtfmi(this)
Call routines in FMI that will set pointers to the necessary flow data.
subroutine allocate_scalars(this)
Allocate package scalars.
subroutine set_model_pointers(this)
Allocate and read.
class(gwtgwtconnectiontype) function, pointer, public castasgwtgwtconnection(obj)
Cast to GwtGwtConnectionType.
This module contains the GwtGwtExchangeModule Module.
This module defines variable data types.
type(listtype), public basemodellist
type(listtype), public baseexchangelist
type(listtype), public baseconnectionlist
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
integer(i4b) function, public count_errors()
Return number of errors.
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
integer(i4b), dimension(:), allocatable model_loc_idx
equals the local index into the basemodel list (-1 when not available)
integer(i4b) iout
file unit number for simulation output
class(spatialmodelconnectiontype) function, pointer, public get_smc_from_list(list, idx)
Get the connection from a list.
Highest level model type. All models extend this parent type.
Connecting a GWF model to other models in space, implements NumericalExchangeType so the solution can...
Derived type for GwfExchangeType.
Connects a GWT model to other GWT models in space. Derives from NumericalExchangeType so the solution...
Derived type for GwtExchangeType.
Class to manage spatial connection of a model to one or more models of the same type....