35 integer(I4B),
pointer :: iifaceadvscheme => null()
37 integer(I4B),
pointer :: iifacext3d => null()
38 integer(I4B),
pointer :: exgflowsign => null()
39 real(dp),
dimension(:),
pointer,
contiguous :: exgflowjagwt => null()
42 real(dp),
dimension(:),
pointer,
contiguous :: gwfflowja => null()
43 real(dp),
dimension(:),
pointer,
contiguous :: gwfsat => null()
44 real(dp),
dimension(:),
pointer,
contiguous :: gwfhead => null()
45 real(dp),
dimension(:, :),
pointer,
contiguous :: gwfspdis => null()
47 real(dp),
dimension(:),
pointer,
contiguous :: conc => null()
48 integer(I4B),
dimension(:),
pointer,
contiguous :: icbound => null()
50 integer(I4B) :: iout = 0
90 character(len=LINELENGTH) :: fname
91 character(len=LENCOMPONENTNAME) :: name
92 class(*),
pointer :: objPtr
93 logical(LGP) :: write_ifmodel_listfile = .false.
100 if (gwtex%v_model1%is_local .and. gwtex%v_model2%is_local)
then
101 this%owns_exchange =
associated(model, gwtex%model1)
103 this%owns_exchange = .true.
106 if (gwtex%v_model1 == model)
then
107 write (name,
'(a,i0)')
'GWTCON1_', gwtex%id
109 write (name,
'(a,i0)')
'GWTCON2_', gwtex%id
113 if (write_ifmodel_listfile)
then
114 fname = trim(name)//
'.im.lst'
115 call openfile(this%iout, 0, fname,
'LIST', filstat_opt=
'REPLACE')
116 write (this%iout,
'(4a)')
'Creating GWT-GWT connection for model ', &
117 trim(this%gwtModel%name),
'from exchange ', &
122 call this%SpatialModelConnectionType%spatialConnection_ctor(model, &
126 call this%allocate_scalars()
127 this%typename =
'GWT-GWT'
128 this%iIfaceAdvScheme = 0
132 allocate (this%gwtInterfaceModel)
133 this%interface_model => this%gwtInterfaceModel
142 call mem_allocate(this%iIfaceAdvScheme,
'IADVSCHEME', this%memoryPath)
143 call mem_allocate(this%iIfaceXt3d,
'IXT3D', this%memoryPath)
144 call mem_allocate(this%exgflowSign,
'EXGFLOWSIGN', this%memoryPath)
153 character(len=LENCOMPONENTNAME) :: imName
157 this%iIfaceAdvScheme = this%gwtExchange%iAdvScheme
160 this%iIfaceXt3d = this%gwtExchange%ixt3d
163 if (this%gwtModel%indsp > 0)
then
164 this%iIfaceXt3d = this%gwtModel%dsp%ixt3d
168 call this%setGridExtent()
171 call this%spatialcon_df()
175 if (this%prim_exchange%v_model1 == this%owner)
then
176 write (imname,
'(a,i0)')
'GWTIM1_', this%gwtExchange%id
178 write (imname,
'(a,i0)')
'GWTIM2_', this%gwtExchange%id
180 call this%gwtInterfaceModel%gwtifmod_cr(imname, &
183 call this%gwtInterfaceModel%set_idsoln(this%gwtModel%idsoln)
184 this%gwtInterfaceModel%iAdvScheme = this%iIfaceAdvScheme
185 this%gwtInterfaceModel%ixt3d = this%iIfaceXt3d
186 call this%gwtInterfaceModel%model_df()
188 call this%cfg_dist_vars()
190 call this%allocate_arrays()
191 call this%gwtInterfaceModel%allocate_fmi()
194 call this%spatialcon_setmodelptrs()
197 this%conc => this%gwtInterfaceModel%x
198 this%icbound => this%gwtInterfaceModel%ibound
201 call this%spatialcon_connect()
210 call this%cfg_dv(
'X',
'',
sync_nds, &
216 if (this%gwtInterfaceModel%dsp%idiffc > 0)
then
219 if (this%gwtInterfaceModel%dsp%idisp > 0)
then
231 exg_var_name=
'GWFSIMVALS')
233 if (this%gwtModel%indsp > 0 .and. this%gwtModel%inmst > 0)
then
244 call mem_allocate(this%exgflowjaGwt, this%ig_builder%nrOfBoundaryCells, &
245 'EXGFLOWJAGWT', this%memoryPath)
254 logical(LGP) :: hasAdv, hasDsp
256 hasadv = this%gwtModel%inadv > 0
257 hasdsp = this%gwtModel%indsp > 0
262 this%exg_stencil_depth = 2
265 this%int_stencil_depth = 2
271 if (this%iIfaceXt3d > 0)
then
272 this%exg_stencil_depth = 2
273 if (this%gwtModel%dsp%ixt3d > 0)
then
274 this%int_stencil_depth = 2
289 call this%validateConnection()
292 call this%spatialcon_ar()
295 call this%gwtInterfaceModel%model_ar()
298 if (this%owns_exchange)
then
303 if (this%gwtExchange%inobs > 0)
then
304 call this%gwtExchange%obs%obs_ar()
318 call this%SpatialModelConnectionType%validateConnection()
321 if (.not. this%gwtExchange%v_model1%is_local)
return
322 if (.not. this%gwtExchange%v_model2%is_local)
return
325 if ((this%gwtExchange%gwtmodel1%inadv > 0 .and. &
326 this%gwtExchange%gwtmodel2%inadv == 0) .or. &
327 (this%gwtExchange%gwtmodel2%inadv > 0 .and. &
328 this%gwtExchange%gwtmodel1%inadv == 0))
then
329 write (
errmsg,
'(a,a,a)')
'Cannot connect GWT models in exchange ', &
330 trim(this%gwtExchange%name),
' because one model is configured with ADV &
331 &and the other one is not'
335 if ((this%gwtExchange%gwtmodel1%indsp > 0 .and. &
336 this%gwtExchange%gwtmodel2%indsp == 0) .or. &
337 (this%gwtExchange%gwtmodel2%indsp > 0 .and. &
338 this%gwtExchange%gwtmodel1%indsp == 0))
then
339 write (
errmsg,
'(a,a,a)')
'Cannot connect GWT models in exchange ', &
340 trim(this%gwtExchange%name),
' because one model is configured with DSP &
341 &and the other one is not'
347 write (
errmsg,
'(a)')
'Errors occurred while processing exchange(s)'
357 if (this%owns_exchange)
then
358 call this%gwtExchange%exg_rp()
369 if (this%gwtInterfaceModel%indsp > 0)
call this%gwtInterfaceModel%dsp%dsp_ad()
371 if (this%owns_exchange)
then
372 call this%gwtExchange%exg_ad()
379 integer(I4B),
intent(in) :: kiter
381 real(DP),
dimension(:),
intent(inout) :: rhs_sln
382 integer(I4B),
optional,
intent(in) :: inwtflag
385 call this%SpatialModelConnectionType%spatialcon_fc( &
386 kiter, matrix_sln, rhs_sln, inwtflag)
389 if (this%owns_exchange)
then
390 if (this%gwtExchange%inmvt > 0)
then
391 call this%gwtExchange%mvt%mvt_fc(this%gwtExchange%gwtmodel1%x, &
392 this%gwtExchange%gwtmodel2%x)
400 integer(I4B),
intent(inout) :: icnvg
401 integer(I4B),
intent(in) :: isuppress_output
402 integer(I4B),
intent(in) :: isolnid
404 call this%gwtInterfaceModel%model_cq(icnvg, isuppress_output)
405 call this%setFlowToExchange()
419 if (this%owns_exchange)
then
420 gwtex => this%gwtExchange
421 map => this%interface_map%exchange_maps(this%interface_map%prim_exg_idx)
424 do i = 1,
size(map%src_idx)
425 if (map%sign(i) < 0) cycle
426 gwtex%simvals(map%src_idx(i)) = &
427 this%gwtInterfaceModel%flowja(map%tgt_idx(i))
436 integer(I4B),
intent(inout) :: icnvg
437 integer(I4B),
intent(in) :: isuppress_output
438 integer(I4B),
intent(in) :: isolnid
442 if (this%owns_exchange)
then
443 call this%gwtExchange%exg_bd(icnvg, isuppress_output, isolnid)
454 if (this%owns_exchange)
then
455 call this%gwtExchange%exg_ot()
463 logical(LGP) :: isOpen
474 call this%gwtInterfaceModel%model_da()
475 deallocate (this%gwtInterfaceModel)
478 call this%spatialcon_da()
480 inquire (this%iout, opened=isopen)
486 if (this%owns_exchange)
then
487 call this%gwtExchange%exg_da()
496 class(*),
pointer,
intent(inout) :: obj
500 if (.not.
associated(obj))
return
integer(i4b), parameter adv_scheme_tvd
integer(i4b), parameter adv_scheme_utvd
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 gwtgwtconnection_ctor(this, model, gwtEx)
Basic construction of the connection.
subroutine gwtgwtcon_rp(this)
class(gwtgwtconnectiontype) function, pointer, public castasgwtgwtconnection(obj)
Cast to GwtGwtConnectionType.
subroutine setgridextent(this)
Set required extent of the interface grid from.
subroutine gwtgwtcon_ad(this)
Advance this connection.
subroutine setflowtoexchange(this)
Set the flows (flowja from interface model) to the.
subroutine gwtgwtcon_bd(this, icnvg, isuppress_output, isolnid)
subroutine gwtgwtcon_fc(this, kiter, matrix_sln, rhs_sln, inwtflag)
subroutine validateconnection(this)
validate this connection prior to constructing
subroutine cfg_dist_vars(this)
Configure distributed variables for this interface model.
subroutine gwtgwtcon_cq(this, icnvg, isuppress_output, isolnid)
subroutine gwtgwtcon_da(this)
subroutine gwtgwtcon_ar(this)
allocate and read/set the connection's data structures
subroutine gwtgwtcon_ot(this)
subroutine gwtgwtcon_df(this)
define the GWT-GWT connection
This module contains the GwtGwtExchangeModule Module.
class(gwtexchangetype) function, pointer, public castasgwtexchange(obj)
@ brief Cast polymorphic object as exchange
class(gwtmodeltype) function, pointer, public castasgwtmodel(model)
Cast to GwtModelType.
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 GWT model to other GWT models in space. Derives from NumericalExchangeType so the solution...
Derived type for GwtExchangeType.
The GWT 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....