26 integer(I4B),
pointer :: m1_idx => null()
27 integer(I4B),
pointer :: m2_idx => null()
50 character(len=*),
intent(in) :: filename
51 integer(I4B),
intent(in) :: id
52 integer(I4B),
intent(in) :: m1_id
53 integer(I4B),
intent(in) :: m2_id
57 character(len=20) :: cint
61 baseexchange => exchange
66 write (cint,
'(i0)') id
67 exchange%name =
'GWF-GWE_'//trim(adjustl(cint))
68 exchange%memoryPath = exchange%name
71 call exchange%allocate_scalars()
78 call exchange%set_model_pointers()
108 if (.not.
associated(gwfmodel))
then
109 write (
errmsg,
'(3a)')
'Problem with GWF-GWE exchange ', trim(this%name), &
110 '. Specified GWF Model does not appear to be of the correct type.'
115 if (.not.
associated(gwemodel))
then
116 write (
errmsg,
'(3a)')
'Problem with GWF-GWE exchange ', trim(this%name), &
117 '. Specified GWF Model does not appear to be of the correct type.'
122 gwemodel%fmi%flows_from_file = .false.
126 gwemodel%fmi%gwfbndlist => gwfmodel%bndlist
157 if (gwfmodel%idsoln >= gwemodel%idsoln)
then
158 write (
errmsg,
'(3a)')
'Problem with GWF-GWE exchange ', trim(this%name), &
159 '. The GWF model must be solved by a different IMS than the GWE model. &
160 &Furthermore, the IMS specified for GWF must be listed in mfsim.nam &
161 &before the IMS for GWE.'
166 gwemodel%fmi%gwfflowja => gwfmodel%flowja
168 'GWFFLOWJA', gwemodel%fmi%memoryPath, &
169 'FLOWJA', gwfmodel%memoryPath)
174 if (gwemodel%incnd > 0)
then
175 gwfmodel%npf%icalcspdis = 1
194 character(len=*),
parameter :: fmtdiserr = &
195 "('GWF and GWE Models do not have the same discretization for exchange&
197 & GWF Model has ', i0, ' user nodes and ', i0, ' reduced nodes.&
198 & GWE Model has ', i0, ' user nodes and ', i0, ' reduced nodes.&
199 & Ensure discretization packages, including IDOMAIN, are identical.')"
200 character(len=*),
parameter :: fmtidomerr = &
201 "('GWF and GWE Models do not have the same discretization for exchange&
203 & GWF Model and GWE Model have different IDOMAIN arrays.&
204 & Ensure discretization packages, including IDOMAIN, are identical.')"
221 if (gwemodel%dis%nodes /= gwfmodel%dis%nodes .or. &
222 gwemodel%dis%nodesuser /= gwfmodel%dis%nodesuser)
then
223 write (
errmsg, fmtdiserr) trim(this%name), &
224 gwfmodel%dis%nodesuser, &
225 gwfmodel%dis%nodes, &
226 gwemodel%dis%nodesuser, &
232 select type (gwfdis => gwfmodel%dis)
234 select type (gwedis => gwemodel%dis)
236 if (.not. all(gwfdis%idomain == gwedis%idomain))
then
237 write (
errmsg, fmtidomerr) trim(this%name)
242 select type (gwedis => gwemodel%dis)
244 if (.not. all(gwfdis%idomain == gwedis%idomain))
then
245 write (
errmsg, fmtidomerr) trim(this%name)
250 select type (gwedis => gwemodel%dis)
252 if (.not. all(gwfdis%idomain == gwedis%idomain))
then
253 write (
errmsg, fmtidomerr) trim(this%name)
260 gwemodel%fmi%gwfhead => gwfmodel%x
262 'GWFHEAD', gwemodel%fmi%memoryPath, &
263 'X', gwfmodel%memoryPath)
264 gwemodel%fmi%gwfsat => gwfmodel%npf%sat
266 'GWFSAT', gwemodel%fmi%memoryPath, &
267 'SAT', gwfmodel%npf%memoryPath)
268 gwemodel%fmi%gwfspdis => gwfmodel%npf%spdis
270 'GWFSPDIS', gwemodel%fmi%memoryPath, &
271 'SPDIS', gwfmodel%npf%memoryPath)
275 if (gwemodel%inest > 0)
then
276 if (gwfmodel%insto > 0)
then
277 gwemodel%fmi%gwfstrgss => gwfmodel%sto%strgss
278 gwemodel%fmi%igwfstrgss = 1
279 if (gwfmodel%sto%iusesy == 1)
then
280 gwemodel%fmi%gwfstrgsy => gwfmodel%sto%strgsy
281 gwemodel%fmi%igwfstrgsy = 1
287 if (gwfmodel%inbuy > 0)
then
288 call gwfmodel%buy%set_concentration_pointer(gwemodel%name, gwemodel%x, &
293 if (gwfmodel%invsc > 0)
then
294 call gwfmodel%vsc%set_concentration_pointer(gwemodel%name, gwemodel%x, &
299 call this%gwfbnd2gwefmi()
302 if (gwfmodel%inmvr /= 0)
then
303 gwemodel%fmi%mvrbudobj => gwfmodel%mvr%budobj
307 call this%gwfconn2gweconn(gwfmodel, gwemodel)
323 class(*),
pointer :: objPtr => null()
327 integer(I4B) :: ic1, ic2, iex
328 integer(I4B) :: gwfConnIdx, gwfExIdx
329 logical(LGP) :: areEqual
335 if (.not.
associated(conn%owner, gwemodel)) cycle gweloop
347 if (
associated(conn%owner, gwfmodel))
then
353 areequal = all(gwfconn%prim_exchange%nodem1 == &
354 gweconn%prim_exchange%nodem1)
355 areequal = areequal .and. all(gwfconn%prim_exchange%nodem2 == &
356 gweconn%prim_exchange%nodem2)
359 write (
iout,
'(/6a)')
'Linking exchange ', &
360 trim(gweconn%prim_exchange%name), &
361 ' to ', trim(gwfconn%prim_exchange%name), &
362 ' (using interface model) for GWE model ', &
365 call this%link_connections(gweconn, gwfconn)
373 if (gwfconnidx == -1)
then
379 if (.not.
associated(gwfex)) cycle gwfloopexg
381 if (
associated(gwfex%model1, gwfmodel) .or. &
382 associated(gwfex%model2, gwfmodel))
then
385 areequal =
size(gwfex%nodem1) ==
size(gweconn%prim_exchange%nodem1)
389 areequal = all(gwfex%nodem1 == gweconn%prim_exchange%nodem1)
391 areequal = all(gwfex%nodem2 == gweconn%prim_exchange%nodem2)
394 write (
iout,
'(/6a)')
'Linking exchange ', &
395 trim(gweconn%prim_exchange%name), &
396 ' to ', trim(gwfex%name),
' for GWE model ', &
399 if (gweconn%owns_exchange)
then
400 gweconn%gweExchange%gwfsimvals => gwfex%simvals
402 'GWFSIMVALS', gweconn%gweExchange%memoryPath, &
403 'SIMVALS', gwfex%memoryPath)
407 if (gwfex%inmvr > 0)
then
408 if (gweconn%owns_exchange)
then
410 call gweconn%gweExchange%mvt%set_pointer_mvrbudobj( &
415 if (
associated(gwfex%model2, gwfmodel)) gweconn%exgflowSign = -1
416 gweconn%gweInterfaceModel%fmi%flows_from_file = .false.
425 if (gwfconnidx == -1 .and. gwfexidx == -1)
then
427 write (errmsg,
'(/6a)')
'Missing GWF-GWF exchange when connecting GWE'// &
428 ' model ', trim(gwemodel%name),
' with exchange ', &
429 trim(gweconn%prim_exchange%name),
' to GWF model ', &
448 if (gweconn%owns_exchange)
then
449 gweconn%gweExchange%gwfsimvals => gwfconn%gwfExchange%simvals
451 'GWFSIMVALS', gweconn%gweExchange%memoryPath, &
452 'SIMVALS', gwfconn%gwfExchange%memoryPath)
456 if (gwfconn%gwfExchange%inmvr > 0)
then
457 if (gweconn%owns_exchange)
then
459 call gweconn%gweExchange%mvt%set_pointer_mvrbudobj( &
460 gwfconn%gwfExchange%mvr%budobj)
464 if (
associated(gwfconn%gwfExchange%model2, gwfconn%owner))
then
465 gweconn%exgflowSign = -1
469 gweconn%gweInterfaceModel%fmi%flows_from_file = .false.
511 integer(I4B) :: ngwfpack, ip, iterm, imover
515 class(
bndtype),
pointer :: packobj => null()
533 ngwfpack = gwfmodel%bndlist%Count()
537 call gwemodel%fmi%gwfpackages(iterm)%set_pointers( &
539 packobj%memoryPath, packobj%input_mempath)
544 imover = packobj%imover
545 if (packobj%isadvpak /= 0) imover = 0
546 if (imover /= 0)
then
547 call gwemodel%fmi%gwfpackages(iterm)%set_pointers( &
549 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 lenpackagename
maximum length of the package name
class(gwegweconnectiontype) function, pointer, public castasgwegweconnection(obj)
Cast to GweGweConnectionType.
subroutine gwfbnd2gwefmi(this)
Call routines in FMI that will set pointers to the necessary flow data (SIMVALS and SIMTOMVR) stored ...
subroutine gwfconn2gweconn(this, gwfModel, gweModel)
Link GWE connections to GWF connections or exchanges.
subroutine set_model_pointers(this)
Allocate and read.
subroutine allocate_scalars(this)
Allocate GwfGwe exchange scalars.
subroutine exg_da(this)
Deallocate memory.
subroutine, public gwfgwe_cr(filename, id, m1_id, m2_id)
Create a new GWF to GWE exchange object.
subroutine link_connections(this, gweConn, gwfConn)
Links a GWE connection to its GWF counterpart.
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
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.
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.
Structured grid discretization.
Unstructured grid discretization.
Vertex grid discretization.
Connects a GWE model to other GWE models in space. Derives from NumericalExchangeType so the solution...
Connecting a GWF model to other models in space, implements NumericalExchangeType so the solution can...
Derived type for GwfExchangeType.
Class to manage spatial connection of a model to one or more models of the same type....