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()
111 if (.not.
associated(gwfmodel))
then
112 write (
errmsg,
'(3a)')
'Problem with GWF-GWE exchange ', trim(this%name), &
113 '. Specified GWF Model does not appear to be of the correct type.'
118 if (.not.
associated(gwemodel))
then
119 write (
errmsg,
'(3a)')
'Problem with GWF-GWE exchange ', trim(this%name), &
120 '. Specified GWF Model does not appear to be of the correct type.'
125 gwemodel%fmi%flows_from_file = .false.
129 gwemodel%fmi%gwfbndlist => gwfmodel%bndlist
163 if (gwfmodel%idsoln >= gwemodel%idsoln)
then
164 write (
errmsg,
'(3a)')
'Problem with GWF-GWE exchange ', trim(this%name), &
165 '. The GWF model must be solved by a different IMS than the GWE model. &
166 &Furthermore, the IMS specified for GWF must be listed in mfsim.nam &
167 &before the IMS for GWE.'
172 gwemodel%fmi%gwfflowja => gwfmodel%flowja
174 'GWFFLOWJA', gwemodel%fmi%memoryPath, &
175 'FLOWJA', gwfmodel%memoryPath)
180 if (gwemodel%incnd > 0)
then
181 gwfmodel%npf%icalcspdis = 1
200 character(len=*),
parameter :: fmtdiserr = &
201 "('GWF and GWE Models do not have the same discretization for exchange&
203 & GWF Model has ', i0, ' user nodes and ', i0, ' reduced nodes.&
204 & GWE Model has ', i0, ' user nodes and ', i0, ' reduced nodes.&
205 & Ensure discretization packages, including IDOMAIN, are identical.')"
222 if (gwemodel%dis%nodes /= gwfmodel%dis%nodes .or. &
223 gwemodel%dis%nodesuser /= gwfmodel%dis%nodesuser)
then
224 write (
errmsg, fmtdiserr) trim(this%name), &
225 gwfmodel%dis%nodesuser, &
226 gwfmodel%dis%nodes, &
227 gwemodel%dis%nodesuser, &
233 gwemodel%fmi%gwfhead => gwfmodel%x
235 'GWFHEAD', gwemodel%fmi%memoryPath, &
236 'X', gwfmodel%memoryPath)
237 gwemodel%fmi%gwfsat => gwfmodel%npf%sat
239 'GWFSAT', gwemodel%fmi%memoryPath, &
240 'SAT', gwfmodel%npf%memoryPath)
241 gwemodel%fmi%gwfspdis => gwfmodel%npf%spdis
243 'GWFSPDIS', gwemodel%fmi%memoryPath, &
244 'SPDIS', gwfmodel%npf%memoryPath)
248 if (gwemodel%inest > 0)
then
249 if (gwfmodel%insto > 0)
then
250 gwemodel%fmi%gwfstrgss => gwfmodel%sto%strgss
251 gwemodel%fmi%igwfstrgss = 1
252 if (gwfmodel%sto%iusesy == 1)
then
253 gwemodel%fmi%gwfstrgsy => gwfmodel%sto%strgsy
254 gwemodel%fmi%igwfstrgsy = 1
260 if (gwfmodel%inbuy > 0)
then
261 call gwfmodel%buy%set_concentration_pointer(gwemodel%name, gwemodel%x, &
266 if (gwfmodel%invsc > 0)
then
267 call gwfmodel%vsc%set_concentration_pointer(gwemodel%name, gwemodel%x, &
272 call this%gwfbnd2gwefmi()
275 if (gwfmodel%inmvr /= 0)
then
276 gwemodel%fmi%mvrbudobj => gwfmodel%mvr%budobj
280 call this%gwfconn2gweconn(gwfmodel, gwemodel)
299 class(*),
pointer :: objPtr => null()
303 integer(I4B) :: ic1, ic2, iex
304 integer(I4B) :: gwfConnIdx, gwfExIdx
305 logical(LGP) :: areEqual
311 if (.not.
associated(conn%owner, gwemodel)) cycle gweloop
323 if (
associated(conn%owner, gwfmodel))
then
329 areequal = all(gwfconn%prim_exchange%nodem1 == &
330 gweconn%prim_exchange%nodem1)
331 areequal = areequal .and. all(gwfconn%prim_exchange%nodem2 == &
332 gweconn%prim_exchange%nodem2)
335 write (
iout,
'(/6a)')
'Linking exchange ', &
336 trim(gweconn%prim_exchange%name), &
337 ' to ', trim(gwfconn%prim_exchange%name), &
338 ' (using interface model) for GWE model ', &
341 call this%link_connections(gweconn, gwfconn)
349 if (gwfconnidx == -1)
then
355 if (.not.
associated(gwfex)) cycle gwfloopexg
357 if (
associated(gwfex%model1, gwfmodel) .or. &
358 associated(gwfex%model2, gwfmodel))
then
361 areequal =
size(gwfex%nodem1) ==
size(gweconn%prim_exchange%nodem1)
365 areequal = all(gwfex%nodem1 == gweconn%prim_exchange%nodem1)
367 areequal = all(gwfex%nodem2 == gweconn%prim_exchange%nodem2)
370 write (
iout,
'(/6a)')
'Linking exchange ', &
371 trim(gweconn%prim_exchange%name), &
372 ' to ', trim(gwfex%name),
' for GWE model ', &
375 if (gweconn%owns_exchange)
then
376 gweconn%gweExchange%gwfsimvals => gwfex%simvals
378 'GWFSIMVALS', gweconn%gweExchange%memoryPath, &
379 'SIMVALS', gwfex%memoryPath)
383 if (gwfex%inmvr > 0)
then
384 if (gweconn%owns_exchange)
then
386 call gweconn%gweExchange%mvt%set_pointer_mvrbudobj( &
391 if (
associated(gwfex%model2, gwfmodel)) gweconn%exgflowSign = -1
392 gweconn%gweInterfaceModel%fmi%flows_from_file = .false.
401 if (gwfconnidx == -1 .and. gwfexidx == -1)
then
403 write (errmsg,
'(/6a)')
'Missing GWF-GWF exchange when connecting GWE'// &
404 ' model ', trim(gwemodel%name),
' with exchange ', &
405 trim(gweconn%prim_exchange%name),
' to GWF model ', &
427 if (gweconn%owns_exchange)
then
428 gweconn%gweExchange%gwfsimvals => gwfconn%gwfExchange%simvals
430 'GWFSIMVALS', gweconn%gweExchange%memoryPath, &
431 'SIMVALS', gwfconn%gwfExchange%memoryPath)
435 if (gwfconn%gwfExchange%inmvr > 0)
then
436 if (gweconn%owns_exchange)
then
438 call gweconn%gweExchange%mvt%set_pointer_mvrbudobj( &
439 gwfconn%gwfExchange%mvr%budobj)
443 if (
associated(gwfconn%gwfExchange%model2, gwfconn%owner))
then
444 gweconn%exgflowSign = -1
448 gweconn%gweInterfaceModel%fmi%flows_from_file = .false.
499 integer(I4B) :: ngwfpack, ip, iterm, imover
503 class(
bndtype),
pointer :: packobj => null()
521 ngwfpack = gwfmodel%bndlist%Count()
525 call gwemodel%fmi%gwfpackages(iterm)%set_pointers( &
527 packobj%memoryPath, packobj%input_mempath)
532 imover = packobj%imover
533 if (packobj%isadvpak /= 0) imover = 0
534 if (imover /= 0)
then
535 call gwemodel%fmi%gwfpackages(iterm)%set_pointers( &
537 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.
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....