34 integer(I4B),
pointer :: iifaceadvscheme => null()
36 integer(I4B),
pointer :: iifacext3d => null()
37 integer(I4B),
pointer :: exgflowsign => null()
38 real(dp),
dimension(:),
pointer,
contiguous :: exgflowjagwe => null()
41 real(dp),
dimension(:),
pointer,
contiguous :: gwfflowja => null()
42 real(dp),
dimension(:),
pointer,
contiguous :: gwfsat => null()
43 real(dp),
dimension(:),
pointer,
contiguous :: gwfhead => null()
44 real(dp),
dimension(:, :),
pointer,
contiguous :: gwfspdis => null()
46 real(dp),
dimension(:),
pointer,
contiguous :: conc => null()
47 integer(I4B),
dimension(:),
pointer,
contiguous :: icbound => null()
49 integer(I4B) :: iout = 0
91 character(len=LINELENGTH) :: fname
92 character(len=LENCOMPONENTNAME) :: name
93 class(*),
pointer :: objPtr
94 logical(LGP) :: write_ifmodel_listfile = .false.
101 if (gweex%v_model1%is_local .and. gweex%v_model2%is_local)
then
102 this%owns_exchange =
associated(model, gweex%model1)
104 this%owns_exchange = .true.
107 if (gweex%v_model1 == model)
then
108 write (name,
'(a,i0)')
'GWECON1_', gweex%id
110 write (name,
'(a,i0)')
'GWECON2_', gweex%id
114 if (write_ifmodel_listfile)
then
115 fname = trim(name)//
'.im.lst'
116 call openfile(this%iout, 0, fname,
'LIST', filstat_opt=
'REPLACE')
117 write (this%iout,
'(4a)')
'Creating GWE-GWE connection for model ', &
118 trim(this%gweModel%name),
'from exchange ', &
123 call this%SpatialModelConnectionType%spatialConnection_ctor(model, &
127 call this%allocate_scalars()
128 this%typename =
'GWE-GWE'
129 this%iIfaceAdvScheme = 0
133 allocate (this%gweInterfaceModel)
134 this%interface_model => this%gweInterfaceModel
144 call mem_allocate(this%iIfaceAdvScheme,
'IADVSCHEME', this%memoryPath)
145 call mem_allocate(this%iIfaceXt3d,
'IXT3D', this%memoryPath)
146 call mem_allocate(this%exgflowSign,
'EXGFLOWSIGN', this%memoryPath)
156 character(len=LENCOMPONENTNAME) :: imName
160 this%iIfaceAdvScheme = this%gweExchange%iAdvScheme
163 this%iIfaceXt3d = this%gweExchange%ixt3d
166 if (this%gweModel%incnd > 0)
then
167 this%iIfaceXt3d = this%gweModel%cnd%ixt3d
171 call this%setGridExtent()
174 call this%spatialcon_df()
178 if (this%prim_exchange%v_model1 == this%owner)
then
179 write (imname,
'(a,i0)')
'GWEIM1_', this%gweExchange%id
181 write (imname,
'(a,i0)')
'GWEIM2_', this%gweExchange%id
183 call this%gweInterfaceModel%gweifmod_cr(imname, &
186 call this%gweInterfaceModel%set_idsoln(this%gweModel%idsoln)
187 this%gweInterfaceModel%iAdvScheme = this%iIfaceAdvScheme
188 this%gweInterfaceModel%ixt3d = this%iIfaceXt3d
189 call this%gweInterfaceModel%model_df()
191 call this%cfg_dist_vars()
193 call this%allocate_arrays()
194 call this%gweInterfaceModel%allocate_fmi()
197 call this%spatialcon_setmodelptrs()
200 this%conc => this%gweInterfaceModel%x
201 this%icbound => this%gweInterfaceModel%ibound
204 call this%spatialcon_connect()
214 call this%cfg_dv(
'X',
'',
sync_nds, &
221 if (this%gweInterfaceModel%cnd%idisp > 0)
then
235 exg_var_name=
'GWFSIMVALS')
237 if (this%gweModel%incnd > 0 .and. this%gweModel%inest > 0)
then
248 call mem_allocate(this%exgflowjaGwe, this%ig_builder%nrOfBoundaryCells, &
249 'EXGFLOWJAGWT', this%memoryPath)
259 logical(LGP) :: hasAdv, hasCnd
261 hasadv = this%gweModel%inadv > 0
262 hascnd = this%gweModel%incnd > 0
265 if (this%iIfaceAdvScheme == 2)
then
266 this%exg_stencil_depth = 2
267 if (this%gweModel%adv%iadvwt == 2)
then
268 this%int_stencil_depth = 2
274 if (this%iIfaceXt3d > 0)
then
275 this%exg_stencil_depth = 2
276 if (this%gweModel%cnd%ixt3d > 0)
then
277 this%int_stencil_depth = 2
292 call this%validateConnection()
295 call this%spatialcon_ar()
298 call this%gweInterfaceModel%model_ar()
301 if (this%gweModel%inest > 0)
then
302 this%gweInterfaceModel%gwecommon%gwecpw = this%gweModel%gwecommon%gwecpw
303 this%gweInterfaceModel%gwecommon%gwerhow = this%gweModel%gwecommon%gwerhow
308 if (this%gweModel%incnd > 0)
then
309 this%gweInterfaceModel%ieqnsclfac = this%gweModel%cnd%eqnsclfac
313 if (this%owns_exchange)
then
318 if (this%gweExchange%inobs > 0)
then
319 call this%gweExchange%obs%obs_ar()
333 call this%SpatialModelConnectionType%validateConnection()
336 if (.not. this%gweExchange%v_model1%is_local)
return
337 if (.not. this%gweExchange%v_model2%is_local)
return
340 if ((this%gweExchange%gwemodel1%inadv > 0 .and. &
341 this%gweExchange%gwemodel2%inadv == 0) .or. &
342 (this%gweExchange%gwemodel2%inadv > 0 .and. &
343 this%gweExchange%gwemodel1%inadv == 0))
then
344 write (
errmsg,
'(1x,a,a,a)')
'Cannot connect GWE models in exchange ', &
345 trim(this%gweExchange%name),
' because one model is configured with ADV &
346 &and the other one is not'
350 if ((this%gweExchange%gwemodel1%incnd > 0 .and. &
351 this%gweExchange%gwemodel2%incnd == 0) .or. &
352 (this%gweExchange%gwemodel2%incnd > 0 .and. &
353 this%gweExchange%gwemodel1%incnd == 0))
then
354 write (
errmsg,
'(1x,a,a,a)')
'Cannot connect GWE models in exchange ', &
355 trim(this%gweExchange%name),
' because one model is configured with CND &
356 &and the other one is not'
362 write (
errmsg,
'(a)')
'Errors occurred while processing exchange(s)'
373 if (this%owns_exchange)
then
374 call this%gweExchange%exg_rp()
386 if (this%gweInterfaceModel%incnd > 0)
call this%gweInterfaceModel%cnd%cnd_ad()
388 if (this%owns_exchange)
then
389 call this%gweExchange%exg_ad()
397 integer(I4B),
intent(in) :: kiter
399 real(DP),
dimension(:),
intent(inout) :: rhs_sln
400 integer(I4B),
optional,
intent(in) :: inwtflag
402 call this%SpatialModelConnectionType%spatialcon_fc( &
403 kiter, matrix_sln, rhs_sln, inwtflag)
406 if (this%owns_exchange)
then
407 if (this%gweExchange%inmvt > 0)
then
408 call this%gweExchange%mvt%mvt_fc(this%gweExchange%gwemodel1%x, &
409 this%gweExchange%gwemodel2%x)
418 integer(I4B),
intent(inout) :: icnvg
419 integer(I4B),
intent(in) :: isuppress_output
420 integer(I4B),
intent(in) :: isolnid
422 call this%gweInterfaceModel%model_cq(icnvg, isuppress_output)
423 call this%setFlowToExchange()
439 if (this%owns_exchange)
then
440 gweex => this%gweExchange
441 map => this%interface_map%exchange_maps(this%interface_map%prim_exg_idx)
444 do i = 1,
size(map%src_idx)
445 if (map%sign(i) < 0) cycle
446 gweex%simvals(map%src_idx(i)) = &
447 this%gweInterfaceModel%flowja(map%tgt_idx(i))
458 integer(I4B),
intent(inout) :: icnvg
459 integer(I4B),
intent(in) :: isuppress_output
460 integer(I4B),
intent(in) :: isolnid
464 if (this%owns_exchange)
then
465 call this%gweExchange%exg_bd(icnvg, isuppress_output, isolnid)
477 if (this%owns_exchange)
then
478 call this%gweExchange%exg_ot()
487 logical(LGP) :: isOpen
498 call this%gweInterfaceModel%model_da()
499 deallocate (this%gweInterfaceModel)
502 call this%spatialcon_da()
504 inquire (this%iout, opened=isopen)
510 if (this%owns_exchange)
then
511 call this%gweExchange%exg_da()
521 class(*),
pointer,
intent(inout) :: obj
526 if (.not.
associated(obj))
return
This module contains the BudgetModule.
subroutine, public rate_accumulator(flow, rin, rout)
@ brief Rate accumulator subroutine
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lencomponentname
maximum length of a component name
real(dp), parameter dzero
real constant zero
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
integer(i4b) function, public getcsrindex(i, j, ia, ja)
Return index for element i,j in CSR storage,.
subroutine allocate_scalars(this)
Allocate scalars and initialize to defaults.
subroutine allocate_arrays(this)
Allocate array data, using the number of connected nodes.
integer(i4b), parameter, public sync_nds
synchronize over nodes
integer(i4b), parameter, public sync_exg
synchronize as exchange variable
integer(i4b), parameter, public sync_con
synchronize over connections
subroutine gwegwecon_fc(this, kiter, matrix_sln, rhs_sln, inwtflag)
subroutine gwegwecon_ot(this)
subroutine gwegwecon_ad(this)
Advance this connection.
subroutine gwegwecon_da(this)
subroutine setgridextent(this)
Set required extent of the interface grid from.
subroutine gwegwecon_rp(this)
subroutine gwegwecon_bd(this, icnvg, isuppress_output, isolnid)
subroutine gwegwecon_df(this)
define the GWE-GWE connection
class(gwegweconnectiontype) function, pointer, public castasgwegweconnection(obj)
Cast to GweGweConnectionType.
subroutine setflowtoexchange(this)
Set the flows (flowja from interface model) to the.
subroutine gwegwecon_ar(this)
allocate and read/set the connection's data structures
subroutine gwegwecon_cq(this, icnvg, isuppress_output, isolnid)
subroutine cfg_dist_vars(this)
Configure distributed variables for this interface model.
subroutine gwegweconnection_ctor(this, model, gweEx)
Basic construction of the connection.
subroutine validateconnection(this)
validate this connection prior to constructing
This module contains the GweGweExchangeModule Module.
class(gweexchangetype) function, pointer, public castasgweexchange(obj)
@ brief Cast polymorphic object as exchange
class(gwemodeltype) function, pointer, public castasgwemodel(model)
Cast to GweModelType.
This module defines variable data types.
This module contains simulation methods.
subroutine, public ustop(stopmess, ioutlocal)
Stop the simulation.
subroutine, public store_error(msg, terminate)
Store an error message.
integer(i4b) function, public count_errors()
Return number of errors.
integer(i4b), parameter, public stg_aft_con_ar
afterr connection allocate read
integer(i4b), parameter, public stg_bfr_exg_ad
before exchange advance (per solution)
integer(i4b), parameter, public stg_bfr_exg_cf
before exchange calculate (per solution)
integer(i4b), parameter, public stg_bfr_con_ar
before connection allocate read
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
Data structure to hold a global cell identifier, using a pointer to the model and its local cell.
Exchange based on connection between discretizations of DisBaseType. The data specifies the connectio...
Connects a GWE model to other GWE models in space. Derives from NumericalExchangeType so the solution...
Derived type for GwtExchangeType.
The GWE Interface Model is a utility to calculate the solution's exchange coefficients from the inter...
Class to manage spatial connection of a model to one or more models of the same type....