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)
272 gwemodel%fmi%igwfspdis = gwfmodel%npf%icalcspdis
276 if (gwemodel%inest > 0)
then
277 if (gwfmodel%insto > 0)
then
278 gwemodel%fmi%gwfstrgss => gwfmodel%sto%strgss
279 gwemodel%fmi%igwfstrgss = 1
280 if (gwfmodel%sto%iusesy == 1)
then
281 gwemodel%fmi%gwfstrgsy => gwfmodel%sto%strgsy
282 gwemodel%fmi%igwfstrgsy = 1
288 if (gwfmodel%inbuy > 0)
then
289 call gwfmodel%buy%set_concentration_pointer(gwemodel%name, gwemodel%x, &
294 if (gwfmodel%invsc > 0)
then
295 call gwfmodel%vsc%set_concentration_pointer(gwemodel%name, gwemodel%x, &
300 call this%gwfbnd2gwefmi()
303 if (gwfmodel%inmvr /= 0)
then
304 gwemodel%fmi%mvrbudobj => gwfmodel%mvr%budobj
308 call this%gwfconn2gweconn(gwfmodel, gwemodel)
324 class(*),
pointer :: objPtr => null()
328 integer(I4B) :: ic1, ic2, iex
329 integer(I4B) :: gwfConnIdx, gwfExIdx
330 logical(LGP) :: areEqual
336 if (.not.
associated(conn%owner, gwemodel)) cycle gweloop
348 if (
associated(conn%owner, gwfmodel))
then
356 if (gwfconn%gwfExchange%v_model1%name /= &
357 gweconn%gweExchange%gwfmodelname1) cycle
358 if (gwfconn%gwfExchange%v_model2%name /= &
359 gweconn%gweExchange%gwfmodelname2) cycle
363 areequal = (gwfconn%gwfExchange%nexg == gweconn%gweExchange%nexg)
365 areequal = all(gwfconn%prim_exchange%nodem1 == &
366 gweconn%prim_exchange%nodem1)
367 areequal = areequal .and. all(gwfconn%prim_exchange%nodem2 == &
368 gweconn%prim_exchange%nodem2)
372 write (
iout,
'(/6a)')
'Linking exchange ', &
373 trim(gweconn%prim_exchange%name), &
374 ' to ', trim(gwfconn%prim_exchange%name), &
375 ' (using interface model) for GWE model ', &
378 call this%link_connections(gweconn, gwfconn)
386 if (gwfconnidx == -1)
then
392 if (.not.
associated(gwfex)) cycle gwfloopexg
394 if (
associated(gwfex%model1, gwfmodel) .or. &
395 associated(gwfex%model2, gwfmodel))
then
400 if (gwfex%v_model1%name /= gweconn%gweExchange%gwfmodelname1) cycle
401 if (gwfex%v_model2%name /= gweconn%gweExchange%gwfmodelname2) cycle
404 areequal =
size(gwfex%nodem1) ==
size(gweconn%prim_exchange%nodem1)
408 areequal = all(gwfex%nodem1 == gweconn%prim_exchange%nodem1)
410 areequal = all(gwfex%nodem2 == gweconn%prim_exchange%nodem2)
413 write (
iout,
'(/6a)')
'Linking exchange ', &
414 trim(gweconn%prim_exchange%name), &
415 ' to ', trim(gwfex%name),
' for GWE model ', &
418 if (gweconn%owns_exchange)
then
419 gweconn%gweExchange%gwfsimvals => gwfex%simvals
421 'GWFSIMVALS', gweconn%gweExchange%memoryPath, &
422 'SIMVALS', gwfex%memoryPath)
426 if (gwfex%inmvr > 0)
then
427 if (gweconn%owns_exchange)
then
429 call gweconn%gweExchange%mvt%set_pointer_mvrbudobj( &
434 if (
associated(gwfex%model2, gwfmodel)) gweconn%exgflowSign = -1
435 gweconn%gweInterfaceModel%fmi%flows_from_file = .false.
444 if (gwfconnidx == -1 .and. gwfexidx == -1)
then
446 write (errmsg,
'(/6a)')
'Missing GWF-GWF exchange when connecting GWE'// &
447 ' model ', trim(gwemodel%name),
' with exchange ', &
448 trim(gweconn%prim_exchange%name),
' to GWF model ', &
467 if (gweconn%owns_exchange)
then
468 gweconn%gweExchange%gwfsimvals => gwfconn%gwfExchange%simvals
470 'GWFSIMVALS', gweconn%gweExchange%memoryPath, &
471 'SIMVALS', gwfconn%gwfExchange%memoryPath)
475 if (gwfconn%gwfExchange%inmvr > 0)
then
476 if (gweconn%owns_exchange)
then
478 call gweconn%gweExchange%mvt%set_pointer_mvrbudobj( &
479 gwfconn%gwfExchange%mvr%budobj)
483 if (
associated(gwfconn%gwfExchange%model2, gwfconn%owner))
then
484 gweconn%exgflowSign = -1
488 gweconn%gweInterfaceModel%fmi%flows_from_file = .false.
530 integer(I4B) :: ngwfpack, ip, iterm, imover
534 class(
bndtype),
pointer :: packobj => null()
552 ngwfpack = gwfmodel%bndlist%Count()
556 call gwemodel%fmi%gwfpackages(iterm)%set_pointers( &
558 packobj%memoryPath, packobj%input_mempath)
563 imover = packobj%imover
564 if (packobj%isadvpak /= 0) imover = 0
565 if (imover /= 0)
then
566 call gwemodel%fmi%gwfpackages(iterm)%set_pointers( &
568 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....