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
354 areequal = all(gwfconn%prim_exchange%nodem1 == &
355 gweconn%prim_exchange%nodem1)
356 areequal = areequal .and. all(gwfconn%prim_exchange%nodem2 == &
357 gweconn%prim_exchange%nodem2)
360 write (
iout,
'(/6a)')
'Linking exchange ', &
361 trim(gweconn%prim_exchange%name), &
362 ' to ', trim(gwfconn%prim_exchange%name), &
363 ' (using interface model) for GWE model ', &
366 call this%link_connections(gweconn, gwfconn)
374 if (gwfconnidx == -1)
then
380 if (.not.
associated(gwfex)) cycle gwfloopexg
382 if (
associated(gwfex%model1, gwfmodel) .or. &
383 associated(gwfex%model2, gwfmodel))
then
386 areequal =
size(gwfex%nodem1) ==
size(gweconn%prim_exchange%nodem1)
390 areequal = all(gwfex%nodem1 == gweconn%prim_exchange%nodem1)
392 areequal = all(gwfex%nodem2 == gweconn%prim_exchange%nodem2)
395 write (
iout,
'(/6a)')
'Linking exchange ', &
396 trim(gweconn%prim_exchange%name), &
397 ' to ', trim(gwfex%name),
' for GWE model ', &
400 if (gweconn%owns_exchange)
then
401 gweconn%gweExchange%gwfsimvals => gwfex%simvals
403 'GWFSIMVALS', gweconn%gweExchange%memoryPath, &
404 'SIMVALS', gwfex%memoryPath)
408 if (gwfex%inmvr > 0)
then
409 if (gweconn%owns_exchange)
then
411 call gweconn%gweExchange%mvt%set_pointer_mvrbudobj( &
416 if (
associated(gwfex%model2, gwfmodel)) gweconn%exgflowSign = -1
417 gweconn%gweInterfaceModel%fmi%flows_from_file = .false.
426 if (gwfconnidx == -1 .and. gwfexidx == -1)
then
428 write (errmsg,
'(/6a)')
'Missing GWF-GWF exchange when connecting GWE'// &
429 ' model ', trim(gwemodel%name),
' with exchange ', &
430 trim(gweconn%prim_exchange%name),
' to GWF model ', &
449 if (gweconn%owns_exchange)
then
450 gweconn%gweExchange%gwfsimvals => gwfconn%gwfExchange%simvals
452 'GWFSIMVALS', gweconn%gweExchange%memoryPath, &
453 'SIMVALS', gwfconn%gwfExchange%memoryPath)
457 if (gwfconn%gwfExchange%inmvr > 0)
then
458 if (gweconn%owns_exchange)
then
460 call gweconn%gweExchange%mvt%set_pointer_mvrbudobj( &
461 gwfconn%gwfExchange%mvr%budobj)
465 if (
associated(gwfconn%gwfExchange%model2, gwfconn%owner))
then
466 gweconn%exgflowSign = -1
470 gweconn%gweInterfaceModel%fmi%flows_from_file = .false.
512 integer(I4B) :: ngwfpack, ip, iterm, imover
516 class(
bndtype),
pointer :: packobj => null()
534 ngwfpack = gwfmodel%bndlist%Count()
538 call gwemodel%fmi%gwfpackages(iterm)%set_pointers( &
540 packobj%memoryPath, packobj%input_mempath)
545 imover = packobj%imover
546 if (packobj%isadvpak /= 0) imover = 0
547 if (imover /= 0)
then
548 call gwemodel%fmi%gwfpackages(iterm)%set_pointers( &
550 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....