34 integer(I4B),
pointer :: iifaceadvscheme => null()
36 integer(I4B),
pointer :: iifacext3d => null()
37 integer(I4B),
pointer :: exgflowsign => null()
38 real(dp),
dimension(:),
pointer,
contiguous :: exgflowjagwt => 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
89 character(len=LINELENGTH) :: fname
90 character(len=LENCOMPONENTNAME) :: name
91 class(*),
pointer :: objPtr
92 logical(LGP) :: write_ifmodel_listfile = .false.
99 if (gwtex%v_model1%is_local .and. gwtex%v_model2%is_local)
then
100 this%owns_exchange =
associated(model, gwtex%model1)
102 this%owns_exchange = .true.
105 if (gwtex%v_model1 == model)
then
106 write (name,
'(a,i0)')
'GWTCON1_', gwtex%id
108 write (name,
'(a,i0)')
'GWTCON2_', gwtex%id
112 if (write_ifmodel_listfile)
then
113 fname = trim(name)//
'.im.lst'
114 call openfile(this%iout, 0, fname,
'LIST', filstat_opt=
'REPLACE')
115 write (this%iout,
'(4a)')
'Creating GWT-GWT connection for model ', &
116 trim(this%gwtModel%name),
'from exchange ', &
121 call this%SpatialModelConnectionType%spatialConnection_ctor(model, &
125 call this%allocate_scalars()
126 this%typename =
'GWT-GWT'
127 this%iIfaceAdvScheme = 0
131 allocate (this%gwtInterfaceModel)
132 this%interface_model => this%gwtInterfaceModel
141 call mem_allocate(this%iIfaceAdvScheme,
'IADVSCHEME', this%memoryPath)
142 call mem_allocate(this%iIfaceXt3d,
'IXT3D', this%memoryPath)
143 call mem_allocate(this%exgflowSign,
'EXGFLOWSIGN', this%memoryPath)
152 character(len=LENCOMPONENTNAME) :: imName
156 this%iIfaceAdvScheme = this%gwtExchange%iAdvScheme
159 this%iIfaceXt3d = this%gwtExchange%ixt3d
162 if (this%gwtModel%indsp > 0)
then
163 this%iIfaceXt3d = this%gwtModel%dsp%ixt3d
167 call this%setGridExtent()
170 call this%spatialcon_df()
174 if (this%prim_exchange%v_model1 == this%owner)
then
175 write (imname,
'(a,i0)')
'GWTIM1_', this%gwtExchange%id
177 write (imname,
'(a,i0)')
'GWTIM2_', this%gwtExchange%id
179 call this%gwtInterfaceModel%gwtifmod_cr(imname, &
182 call this%gwtInterfaceModel%set_idsoln(this%gwtModel%idsoln)
183 this%gwtInterfaceModel%iAdvScheme = this%iIfaceAdvScheme
184 this%gwtInterfaceModel%ixt3d = this%iIfaceXt3d
185 call this%gwtInterfaceModel%model_df()
187 call this%cfg_dist_vars()
189 call this%allocate_arrays()
190 call this%gwtInterfaceModel%allocate_fmi()
193 call this%spatialcon_setmodelptrs()
196 this%conc => this%gwtInterfaceModel%x
197 this%icbound => this%gwtInterfaceModel%ibound
200 call this%spatialcon_connect()
209 call this%cfg_dv(
'X',
'',
sync_nds, &
215 if (this%gwtInterfaceModel%dsp%idiffc > 0)
then
218 if (this%gwtInterfaceModel%dsp%idisp > 0)
then
230 exg_var_name=
'GWFSIMVALS')
232 if (this%gwtModel%indsp > 0 .and. this%gwtModel%inmst > 0)
then
243 call mem_allocate(this%exgflowjaGwt, this%ig_builder%nrOfBoundaryCells, &
244 'EXGFLOWJAGWT', this%memoryPath)
253 logical(LGP) :: hasAdv, hasDsp
255 hasadv = this%gwtModel%inadv > 0
256 hasdsp = this%gwtModel%indsp > 0
259 if (this%iIfaceAdvScheme == 2)
then
260 this%exg_stencil_depth = 2
261 if (this%gwtModel%adv%iadvwt == 2)
then
262 this%int_stencil_depth = 2
268 if (this%iIfaceXt3d > 0)
then
269 this%exg_stencil_depth = 2
270 if (this%gwtModel%dsp%ixt3d > 0)
then
271 this%int_stencil_depth = 2
286 call this%validateConnection()
289 call this%spatialcon_ar()
292 call this%gwtInterfaceModel%model_ar()
295 if (this%owns_exchange)
then
300 if (this%gwtExchange%inobs > 0)
then
301 call this%gwtExchange%obs%obs_ar()
315 call this%SpatialModelConnectionType%validateConnection()
318 if (.not. this%gwtExchange%v_model1%is_local)
return
319 if (.not. this%gwtExchange%v_model2%is_local)
return
322 if ((this%gwtExchange%gwtmodel1%inadv > 0 .and. &
323 this%gwtExchange%gwtmodel2%inadv == 0) .or. &
324 (this%gwtExchange%gwtmodel2%inadv > 0 .and. &
325 this%gwtExchange%gwtmodel1%inadv == 0))
then
326 write (
errmsg,
'(a,a,a)')
'Cannot connect GWT models in exchange ', &
327 trim(this%gwtExchange%name),
' because one model is configured with ADV &
328 &and the other one is not'
332 if ((this%gwtExchange%gwtmodel1%indsp > 0 .and. &
333 this%gwtExchange%gwtmodel2%indsp == 0) .or. &
334 (this%gwtExchange%gwtmodel2%indsp > 0 .and. &
335 this%gwtExchange%gwtmodel1%indsp == 0))
then
336 write (
errmsg,
'(a,a,a)')
'Cannot connect GWT models in exchange ', &
337 trim(this%gwtExchange%name),
' because one model is configured with DSP &
338 &and the other one is not'
344 write (
errmsg,
'(a)')
'Errors occurred while processing exchange(s)'
354 if (this%owns_exchange)
then
355 call this%gwtExchange%exg_rp()
366 if (this%gwtInterfaceModel%indsp > 0)
call this%gwtInterfaceModel%dsp%dsp_ad()
368 if (this%owns_exchange)
then
369 call this%gwtExchange%exg_ad()
376 integer(I4B),
intent(in) :: kiter
378 real(DP),
dimension(:),
intent(inout) :: rhs_sln
379 integer(I4B),
optional,
intent(in) :: inwtflag
382 call this%SpatialModelConnectionType%spatialcon_fc( &
383 kiter, matrix_sln, rhs_sln, inwtflag)
386 if (this%owns_exchange)
then
387 if (this%gwtExchange%inmvt > 0)
then
388 call this%gwtExchange%mvt%mvt_fc(this%gwtExchange%gwtmodel1%x, &
389 this%gwtExchange%gwtmodel2%x)
397 integer(I4B),
intent(inout) :: icnvg
398 integer(I4B),
intent(in) :: isuppress_output
399 integer(I4B),
intent(in) :: isolnid
401 call this%gwtInterfaceModel%model_cq(icnvg, isuppress_output)
402 call this%setFlowToExchange()
416 if (this%owns_exchange)
then
417 gwtex => this%gwtExchange
418 map => this%interface_map%exchange_maps(this%interface_map%prim_exg_idx)
421 do i = 1,
size(map%src_idx)
422 if (map%sign(i) < 0) cycle
423 gwtex%simvals(map%src_idx(i)) = &
424 this%gwtInterfaceModel%flowja(map%tgt_idx(i))
433 integer(I4B),
intent(inout) :: icnvg
434 integer(I4B),
intent(in) :: isuppress_output
435 integer(I4B),
intent(in) :: isolnid
439 if (this%owns_exchange)
then
440 call this%gwtExchange%exg_bd(icnvg, isuppress_output, isolnid)
451 if (this%owns_exchange)
then
452 call this%gwtExchange%exg_ot()
460 logical(LGP) :: isOpen
471 call this%gwtInterfaceModel%model_da()
472 deallocate (this%gwtInterfaceModel)
475 call this%spatialcon_da()
477 inquire (this%iout, opened=isopen)
483 if (this%owns_exchange)
then
484 call this%gwtExchange%exg_da()
493 class(*),
pointer,
intent(inout) :: obj
497 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 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....