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
91 character(len=LINELENGTH) :: fname
92 character(len=LENCOMPONENTNAME) :: name
93 class(*),
pointer :: objPtr
94 logical(LGP) :: write_ifmodel_listfile = .false.
101 if (gwtex%v_model1%is_local .and. gwtex%v_model2%is_local)
then
102 this%owns_exchange =
associated(model, gwtex%model1)
104 this%owns_exchange = .true.
107 if (gwtex%v_model1 == model)
then
108 write (name,
'(a,i0)')
'GWTCON1_', gwtex%id
110 write (name,
'(a,i0)')
'GWTCON2_', gwtex%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 GWT-GWT connection for model ', &
118 trim(this%gwtModel%name),
'from exchange ', &
123 call this%SpatialModelConnectionType%spatialConnection_ctor(model, &
127 call this%allocate_scalars()
128 this%typename =
'GWT-GWT'
129 this%iIfaceAdvScheme = 0
133 allocate (this%gwtInterfaceModel)
134 this%interface_model => this%gwtInterfaceModel
143 call mem_allocate(this%iIfaceAdvScheme,
'IADVSCHEME', this%memoryPath)
144 call mem_allocate(this%iIfaceXt3d,
'IXT3D', this%memoryPath)
145 call mem_allocate(this%exgflowSign,
'EXGFLOWSIGN', this%memoryPath)
154 character(len=LENCOMPONENTNAME) :: imName
158 this%iIfaceAdvScheme = this%gwtExchange%iAdvScheme
161 this%iIfaceXt3d = this%gwtExchange%ixt3d
164 if (this%gwtModel%indsp > 0)
then
165 this%iIfaceXt3d = this%gwtModel%dsp%ixt3d
169 call this%setGridExtent()
172 call this%spatialcon_df()
176 if (this%prim_exchange%v_model1 == this%owner)
then
177 write (imname,
'(a,i0)')
'GWTIM1_', this%gwtExchange%id
179 write (imname,
'(a,i0)')
'GWTIM2_', this%gwtExchange%id
181 call this%gwtInterfaceModel%gwtifmod_cr(imname, &
184 call this%gwtInterfaceModel%set_idsoln(this%gwtModel%idsoln)
185 this%gwtInterfaceModel%iAdvScheme = this%iIfaceAdvScheme
186 this%gwtInterfaceModel%ixt3d = this%iIfaceXt3d
187 call this%gwtInterfaceModel%model_df()
189 call this%cfg_dist_vars()
191 call this%allocate_arrays()
192 call this%gwtInterfaceModel%allocate_fmi()
195 call this%spatialcon_setmodelptrs()
198 this%conc => this%gwtInterfaceModel%x
199 this%icbound => this%gwtInterfaceModel%ibound
202 call this%spatialcon_connect()
211 call this%cfg_dv(
'X',
'',
sync_nds, &
217 if (this%gwtInterfaceModel%dsp%idiffc > 0)
then
220 if (this%gwtInterfaceModel%dsp%idisp > 0)
then
232 exg_var_name=
'GWFSIMVALS')
234 if (this%gwtModel%indsp > 0 .and. this%gwtModel%inmst > 0)
then
245 call mem_allocate(this%exgflowjaGwt, this%ig_builder%nrOfBoundaryCells, &
246 'EXGFLOWJAGWT', this%memoryPath)
255 logical(LGP) :: hasAdv, hasDsp
257 hasadv = this%gwtModel%inadv > 0
258 hasdsp = this%gwtModel%indsp > 0
263 this%exg_stencil_depth = 2
266 this%int_stencil_depth = 2
272 if (this%iIfaceXt3d > 0)
then
273 this%exg_stencil_depth = 2
274 if (this%gwtModel%dsp%ixt3d > 0)
then
275 this%int_stencil_depth = 2
290 call this%validateConnection()
293 call this%spatialcon_ar()
296 call this%gwtInterfaceModel%model_ar()
299 if (this%owns_exchange)
then
304 if (this%gwtExchange%inobs > 0)
then
305 call this%gwtExchange%obs%obs_ar()
319 call this%SpatialModelConnectionType%validateConnection()
322 if (.not. this%gwtExchange%v_model1%is_local)
return
323 if (.not. this%gwtExchange%v_model2%is_local)
return
326 if ((this%gwtExchange%gwtmodel1%inadv > 0 .and. &
327 this%gwtExchange%gwtmodel2%inadv == 0) .or. &
328 (this%gwtExchange%gwtmodel2%inadv > 0 .and. &
329 this%gwtExchange%gwtmodel1%inadv == 0))
then
330 write (
errmsg,
'(a,a,a)')
'Cannot connect GWT models in exchange ', &
331 trim(this%gwtExchange%name),
' because one model is configured with ADV &
332 &and the other one is not'
336 if ((this%gwtExchange%gwtmodel1%indsp > 0 .and. &
337 this%gwtExchange%gwtmodel2%indsp == 0) .or. &
338 (this%gwtExchange%gwtmodel2%indsp > 0 .and. &
339 this%gwtExchange%gwtmodel1%indsp == 0))
then
340 write (
errmsg,
'(a,a,a)')
'Cannot connect GWT models in exchange ', &
341 trim(this%gwtExchange%name),
' because one model is configured with DSP &
342 &and the other one is not'
348 write (
errmsg,
'(a)')
'Errors occurred while processing exchange(s)'
358 if (this%owns_exchange)
then
359 call this%gwtExchange%exg_rp()
370 if (this%gwtInterfaceModel%indsp > 0)
call this%gwtInterfaceModel%dsp%dsp_ad()
372 if (this%owns_exchange)
then
373 call this%gwtExchange%exg_ad()
380 integer(I4B),
intent(in) :: kiter
382 real(DP),
dimension(:),
pointer,
contiguous :: x_m1, x_m2
384 call this%SpatialModelConnectionType%spatialcon_cf(kiter)
387 if (this%owns_exchange)
then
388 if (this%gwtExchange%inmvt > 0)
then
391 if (
associated(this%gwtExchange%gwtmodel1))
then
392 x_m1 => this%gwtExchange%gwtmodel1%x
394 if (
associated(this%gwtExchange%gwtmodel2))
then
395 x_m2 => this%gwtExchange%gwtmodel2%x
397 call this%gwtExchange%mvt%xmvt_cf(x_m1, x_m2)
405 integer(I4B),
intent(in) :: kiter
407 real(DP),
dimension(:),
intent(inout) :: rhs_sln
408 integer(I4B),
optional,
intent(in) :: inwtflag
410 real(DP),
dimension(:),
pointer,
contiguous :: x_m1, x_m2
412 call this%SpatialModelConnectionType%spatialcon_fc( &
413 kiter, matrix_sln, rhs_sln, inwtflag)
416 if (this%owns_exchange)
then
417 if (this%gwtExchange%inmvt > 0)
then
420 if (
associated(this%gwtExchange%gwtmodel1))
then
421 x_m1 => this%gwtExchange%gwtmodel1%x
423 if (
associated(this%gwtExchange%gwtmodel2))
then
424 x_m2 => this%gwtExchange%gwtmodel2%x
426 call this%gwtExchange%mvt%mvt_fc(x_m1, x_m2)
434 integer(I4B),
intent(inout) :: icnvg
435 integer(I4B),
intent(in) :: isuppress_output
436 integer(I4B),
intent(in) :: isolnid
438 call this%gwtInterfaceModel%model_cq(icnvg, isuppress_output)
439 call this%setFlowToExchange()
453 if (this%owns_exchange)
then
454 gwtex => this%gwtExchange
455 map => this%interface_map%exchange_maps(this%interface_map%prim_exg_idx)
458 do i = 1,
size(map%src_idx)
459 if (map%sign(i) < 0) cycle
460 gwtex%simvals(map%src_idx(i)) = &
461 this%gwtInterfaceModel%flowja(map%tgt_idx(i))
470 integer(I4B),
intent(inout) :: icnvg
471 integer(I4B),
intent(in) :: isuppress_output
472 integer(I4B),
intent(in) :: isolnid
476 if (this%owns_exchange)
then
477 call this%gwtExchange%exg_bd(icnvg, isuppress_output, isolnid)
488 if (this%owns_exchange)
then
489 call this%gwtExchange%exg_ot()
497 logical(LGP) :: isOpen
508 call this%gwtInterfaceModel%model_da()
509 deallocate (this%gwtInterfaceModel)
512 call this%spatialcon_da()
514 inquire (this%iout, opened=isopen)
520 if (this%owns_exchange)
then
521 call this%gwtExchange%exg_da()
530 class(*),
pointer,
intent(inout) :: obj
534 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_cf(this, kiter)
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....