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
191 character(len=*),
parameter :: fmtdiserr = &
192 "('GWF and GWE Models do not have the same discretization for exchange&
194 & GWF Model has ', i0, ' user nodes and ', i0, ' reduced nodes.&
195 & GWE Model has ', i0, ' user nodes and ', i0, ' reduced nodes.&
196 & Ensure discretization packages, including IDOMAIN, are identical.')"
213 if (gwemodel%dis%nodes /= gwfmodel%dis%nodes .or. &
214 gwemodel%dis%nodesuser /= gwfmodel%dis%nodesuser)
then
215 write (
errmsg, fmtdiserr) trim(this%name), &
216 gwfmodel%dis%nodesuser, &
217 gwfmodel%dis%nodes, &
218 gwemodel%dis%nodesuser, &
224 gwemodel%fmi%gwfhead => gwfmodel%x
226 'GWFHEAD', gwemodel%fmi%memoryPath, &
227 'X', gwfmodel%memoryPath)
228 gwemodel%fmi%gwfsat => gwfmodel%npf%sat
230 'GWFSAT', gwemodel%fmi%memoryPath, &
231 'SAT', gwfmodel%npf%memoryPath)
232 gwemodel%fmi%gwfspdis => gwfmodel%npf%spdis
234 'GWFSPDIS', gwemodel%fmi%memoryPath, &
235 'SPDIS', gwfmodel%npf%memoryPath)
239 if (gwemodel%inest > 0)
then
240 if (gwfmodel%insto > 0)
then
241 gwemodel%fmi%gwfstrgss => gwfmodel%sto%strgss
242 gwemodel%fmi%igwfstrgss = 1
243 if (gwfmodel%sto%iusesy == 1)
then
244 gwemodel%fmi%gwfstrgsy => gwfmodel%sto%strgsy
245 gwemodel%fmi%igwfstrgsy = 1
251 if (gwfmodel%inbuy > 0)
then
252 call gwfmodel%buy%set_concentration_pointer(gwemodel%name, gwemodel%x, &
257 if (gwfmodel%invsc > 0)
then
258 call gwfmodel%vsc%set_concentration_pointer(gwemodel%name, gwemodel%x, &
263 call this%gwfbnd2gwefmi()
266 if (gwfmodel%inmvr /= 0)
then
267 gwemodel%fmi%mvrbudobj => gwfmodel%mvr%budobj
271 call this%gwfconn2gweconn(gwfmodel, gwemodel)
287 class(*),
pointer :: objPtr => null()
291 integer(I4B) :: ic1, ic2, iex
292 integer(I4B) :: gwfConnIdx, gwfExIdx
293 logical(LGP) :: areEqual
299 if (.not.
associated(conn%owner, gwemodel)) cycle gweloop
311 if (
associated(conn%owner, gwfmodel))
then
317 areequal = all(gwfconn%prim_exchange%nodem1 == &
318 gweconn%prim_exchange%nodem1)
319 areequal = areequal .and. all(gwfconn%prim_exchange%nodem2 == &
320 gweconn%prim_exchange%nodem2)
323 write (
iout,
'(/6a)')
'Linking exchange ', &
324 trim(gweconn%prim_exchange%name), &
325 ' to ', trim(gwfconn%prim_exchange%name), &
326 ' (using interface model) for GWE model ', &
329 call this%link_connections(gweconn, gwfconn)
337 if (gwfconnidx == -1)
then
343 if (.not.
associated(gwfex)) cycle gwfloopexg
345 if (
associated(gwfex%model1, gwfmodel) .or. &
346 associated(gwfex%model2, gwfmodel))
then
349 areequal =
size(gwfex%nodem1) ==
size(gweconn%prim_exchange%nodem1)
353 areequal = all(gwfex%nodem1 == gweconn%prim_exchange%nodem1)
355 areequal = all(gwfex%nodem2 == gweconn%prim_exchange%nodem2)
358 write (
iout,
'(/6a)')
'Linking exchange ', &
359 trim(gweconn%prim_exchange%name), &
360 ' to ', trim(gwfex%name),
' for GWE model ', &
363 if (gweconn%owns_exchange)
then
364 gweconn%gweExchange%gwfsimvals => gwfex%simvals
366 'GWFSIMVALS', gweconn%gweExchange%memoryPath, &
367 'SIMVALS', gwfex%memoryPath)
371 if (gwfex%inmvr > 0)
then
372 if (gweconn%owns_exchange)
then
374 call gweconn%gweExchange%mvt%set_pointer_mvrbudobj( &
379 if (
associated(gwfex%model2, gwfmodel)) gweconn%exgflowSign = -1
380 gweconn%gweInterfaceModel%fmi%flows_from_file = .false.
389 if (gwfconnidx == -1 .and. gwfexidx == -1)
then
391 write (errmsg,
'(/6a)')
'Missing GWF-GWF exchange when connecting GWE'// &
392 ' model ', trim(gwemodel%name),
' with exchange ', &
393 trim(gweconn%prim_exchange%name),
' to GWF model ', &
412 if (gweconn%owns_exchange)
then
413 gweconn%gweExchange%gwfsimvals => gwfconn%gwfExchange%simvals
415 'GWFSIMVALS', gweconn%gweExchange%memoryPath, &
416 'SIMVALS', gwfconn%gwfExchange%memoryPath)
420 if (gwfconn%gwfExchange%inmvr > 0)
then
421 if (gweconn%owns_exchange)
then
423 call gweconn%gweExchange%mvt%set_pointer_mvrbudobj( &
424 gwfconn%gwfExchange%mvr%budobj)
428 if (
associated(gwfconn%gwfExchange%model2, gwfconn%owner))
then
429 gweconn%exgflowSign = -1
433 gweconn%gweInterfaceModel%fmi%flows_from_file = .false.
475 integer(I4B) :: ngwfpack, ip, iterm, imover
479 class(
bndtype),
pointer :: packobj => null()
497 ngwfpack = gwfmodel%bndlist%Count()
501 call gwemodel%fmi%gwfpackages(iterm)%set_pointers( &
503 packobj%memoryPath, packobj%input_mempath)
508 imover = packobj%imover
509 if (packobj%isadvpak /= 0) imover = 0
510 if (imover /= 0)
then
511 call gwemodel%fmi%gwfpackages(iterm)%set_pointers( &
513 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....