MODFLOW 6  version 6.7.0.dev2
USGS Modular Hydrologic Model
GweGweConnection.f90
Go to the documentation of this file.
2  use kindmodule, only: i4b, dp, lgp
4  use csrutilsmodule, only: getcsrindex
5  use simmodule, only: ustop
9  use gwemodule
13  use sparsemodule, only: sparsematrix
17  use simstagesmodule
20 
21  implicit none
22  private
23 
24  public :: castasgwegweconnection
25 
26  !> Connects a GWE model to other GWE models in space. Derives
27  !! from NumericalExchangeType so the solution can use it to
28  !! fetch the coefficients for this connection.
29  !<
31 
32  class(gwemodeltype), pointer :: gwemodel => null() !< the model for which this connection exists
33  class(gweexchangetype), pointer :: gweexchange => null() !< the primary exchange, cast to GWE-GWE
34  class(gweinterfacemodeltype), pointer :: gweinterfacemodel => null() !< the interface model
35  integer(I4B), pointer :: iifaceadvscheme => null() !< the advection scheme at the interface:
36  !! 0 = upstream, 1 = central, 2 = TVD
37  integer(I4B), pointer :: iifacext3d => null() !< XT3D in the interface CND package: 0 = no, 1 = lhs, 2 = rhs
38  integer(I4B), pointer :: exgflowsign => null() !< indicates the flow direction of exgflowja
39  real(dp), dimension(:), pointer, contiguous :: exgflowjagwe => null() !< gwe-flowja at the interface (this is a subset of the GWT
40  !! interface model flowja's)
41 
42  real(dp), dimension(:), pointer, contiguous :: gwfflowja => null() !< gwfflowja for the interface model
43  real(dp), dimension(:), pointer, contiguous :: gwfsat => null() !< gwfsat for the interface model
44  real(dp), dimension(:), pointer, contiguous :: gwfhead => null() !< gwfhead for the interface model
45  real(dp), dimension(:, :), pointer, contiguous :: gwfspdis => null() !< gwfspdis for the interface model
46 
47  real(dp), dimension(:), pointer, contiguous :: conc => null() !< pointer to concentration array
48  integer(I4B), dimension(:), pointer, contiguous :: icbound => null() !< store pointer to gwe ibound array
49 
50  integer(I4B) :: iout = 0 !< the list file for the interface model
51 
52  contains
53 
54  procedure, pass(this) :: gwegweconnection_ctor
55  generic, public :: construct => gwegweconnection_ctor
56 
57  procedure :: exg_ar => gwegwecon_ar
58  procedure :: exg_df => gwegwecon_df
59  procedure :: exg_rp => gwegwecon_rp
60  procedure :: exg_ad => gwegwecon_ad
61  procedure :: exg_fc => gwegwecon_fc
62  procedure :: exg_da => gwegwecon_da
63  procedure :: exg_cq => gwegwecon_cq
64  procedure :: exg_bd => gwegwecon_bd
65  procedure :: exg_ot => gwegwecon_ot
66 
67  ! overriding 'protected'
68  procedure :: validateconnection
69 
70  ! local stuff
71  procedure, private :: allocate_scalars
72  procedure, private :: allocate_arrays
73  procedure, private :: cfg_dist_vars
74  procedure, private :: setgridextent
75  procedure, private :: validategweexchange
76  procedure, private :: setflowtoexchange
77 
78  end type gwegweconnectiontype
79 
80 contains
81 
82  !> @brief Basic construction of the connection
83  !<
84  subroutine gwegweconnection_ctor(this, model, gweEx)
85  ! modules
86  use inputoutputmodule, only: openfile
87  ! dummy
88  class(gwegweconnectiontype) :: this !< the connection
89  class(numericalmodeltype), pointer :: model !< the model owning this connection,
90  !! this must be a GweModelType
91  class(disconnexchangetype), pointer :: gweEx !< the GWE-GWE exchange the interface model is created for
92  ! local
93  character(len=LINELENGTH) :: fname
94  character(len=LENCOMPONENTNAME) :: name
95  class(*), pointer :: objPtr
96  logical(LGP) :: write_ifmodel_listfile = .false.
97 
98  objptr => model
99  this%gweModel => castasgwemodel(objptr)
100  objptr => gweex
101  this%gweExchange => castasgweexchange(objptr)
102 
103  if (gweex%v_model1%is_local .and. gweex%v_model2%is_local) then
104  this%owns_exchange = associated(model, gweex%model1)
105  else
106  this%owns_exchange = .true.
107  end if
108 
109  if (gweex%v_model1 == model) then
110  write (name, '(a,i0)') 'GWECON1_', gweex%id
111  else
112  write (name, '(a,i0)') 'GWECON2_', gweex%id
113  end if
114 
115  ! .lst file for interface model
116  if (write_ifmodel_listfile) then
117  fname = trim(name)//'.im.lst'
118  call openfile(this%iout, 0, fname, 'LIST', filstat_opt='REPLACE')
119  write (this%iout, '(4a)') 'Creating GWE-GWE connection for model ', &
120  trim(this%gweModel%name), 'from exchange ', &
121  trim(gweex%name)
122  end if
123 
124  ! first call base constructor
125  call this%SpatialModelConnectionType%spatialConnection_ctor(model, &
126  gweex, &
127  name)
128 
129  call this%allocate_scalars()
130  this%typename = 'GWE-GWE'
131  this%iIfaceAdvScheme = 0
132  this%iIfaceXt3d = 0
133  this%exgflowSign = 1
134 
135  allocate (this%gweInterfaceModel)
136  this%interface_model => this%gweInterfaceModel
137 
138  end subroutine gwegweconnection_ctor
139 
140  !> @brief Allocate scalar variables for this connection
141  !<
142  subroutine allocate_scalars(this)
143  ! dummy
144  class(gwegweconnectiontype) :: this !< the connection
145 
146  call mem_allocate(this%iIfaceAdvScheme, 'IADVSCHEME', this%memoryPath)
147  call mem_allocate(this%iIfaceXt3d, 'IXT3D', this%memoryPath)
148  call mem_allocate(this%exgflowSign, 'EXGFLOWSIGN', this%memoryPath)
149 
150  end subroutine allocate_scalars
151 
152  !> @brief define the GWE-GWE connection
153  !<
154  subroutine gwegwecon_df(this)
155  ! dummy
156  class(gwegweconnectiontype) :: this !< the connection
157  ! local
158  character(len=LENCOMPONENTNAME) :: imName
159 
160  ! determine advection scheme (the GWE-GWE exchange
161  ! has been read at this point)
162  this%iIfaceAdvScheme = this%gweExchange%iAdvScheme
163 
164  ! determine xt3d setting on interface
165  this%iIfaceXt3d = this%gweExchange%ixt3d
166 
167  ! turn off when off in the owning model
168  if (this%gweModel%incnd > 0) then
169  this%iIfaceXt3d = this%gweModel%cnd%ixt3d
170  end if
171 
172  ! determine the required size of the interface model grid
173  call this%setGridExtent()
174 
175  ! now set up the GridConnection
176  call this%spatialcon_df()
177 
178  ! we have to 'catch up' and create the interface model
179  ! here, then the remainder of this routine will be define
180  if (this%prim_exchange%v_model1 == this%owner) then
181  write (imname, '(a,i0)') 'GWEIM1_', this%gweExchange%id
182  else
183  write (imname, '(a,i0)') 'GWEIM2_', this%gweExchange%id
184  end if
185  call this%gweInterfaceModel%gweifmod_cr(imname, &
186  this%iout, &
187  this%ig_builder)
188  call this%gweInterfaceModel%set_idsoln(this%gweModel%idsoln)
189  this%gweInterfaceModel%iAdvScheme = this%iIfaceAdvScheme
190  this%gweInterfaceModel%ixt3d = this%iIfaceXt3d
191  call this%gweInterfaceModel%model_df()
192 
193  call this%cfg_dist_vars()
194 
195  call this%allocate_arrays()
196  call this%gweInterfaceModel%allocate_fmi()
197 
198  ! connect X, RHS, IBOUND, and flowja
199  call this%spatialcon_setmodelptrs()
200 
201  ! connect pointers (used by BUY)
202  this%conc => this%gweInterfaceModel%x
203  this%icbound => this%gweInterfaceModel%ibound
204 
205  ! add connections from the interface model to solution matrix
206  call this%spatialcon_connect()
207 
208  end subroutine gwegwecon_df
209 
210  !> @brief Configure distributed variables for this interface model
211  !<
212  subroutine cfg_dist_vars(this)
213  ! dummy
214  class(gwegweconnectiontype) :: this !< the connection
215 
216  call this%cfg_dv('X', '', sync_nds, &
218  call this%cfg_dv('IBOUND', '', sync_nds, (/stg_bfr_con_ar/))
219  call this%cfg_dv('TOP', 'DIS', sync_nds, (/stg_bfr_con_ar/))
220  call this%cfg_dv('BOT', 'DIS', sync_nds, (/stg_bfr_con_ar/))
221  call this%cfg_dv('AREA', 'DIS', sync_nds, (/stg_bfr_con_ar/))
222 
223  if (this%gweInterfaceModel%cnd%idisp > 0) then
224  call this%cfg_dv('ALH', 'CND', sync_nds, (/stg_bfr_con_ar/))
225  call this%cfg_dv('ALV', 'CND', sync_nds, (/stg_bfr_con_ar/))
226  call this%cfg_dv('ATH1', 'CND', sync_nds, (/stg_bfr_con_ar/))
227  call this%cfg_dv('ATH2', 'CND', sync_nds, (/stg_bfr_con_ar/))
228  call this%cfg_dv('ATV', 'CND', sync_nds, (/stg_bfr_con_ar/))
229  call this%cfg_dv('KTW', 'CND', sync_nds, (/stg_bfr_con_ar/))
230  call this%cfg_dv('KTS', 'CND', sync_nds, (/stg_bfr_con_ar/))
231  end if
232  call this%cfg_dv('GWFHEAD', 'FMI', sync_nds, (/stg_bfr_exg_ad/))
233  call this%cfg_dv('GWFSAT', 'FMI', sync_nds, (/stg_bfr_exg_ad/))
234  call this%cfg_dv('GWFSPDIS', 'FMI', sync_nds, (/stg_bfr_exg_ad/))
235  call this%cfg_dv('GWFFLOWJA', 'FMI', sync_con, (/stg_bfr_exg_ad/))
236  call this%cfg_dv('GWFFLOWJA', 'FMI', sync_exg, (/stg_bfr_exg_ad/), &
237  exg_var_name='GWFSIMVALS')
238  ! fill porosity from est packages, needed for cnd
239  if (this%gweModel%incnd > 0 .and. this%gweModel%inest > 0) then
240  call this%cfg_dv('POROSITY', 'EST', sync_nds, (/stg_aft_con_ar/))
241  end if
242 
243  end subroutine cfg_dist_vars
244 
245  !> @brief Allocate array variables for this connection
246  !<
247  subroutine allocate_arrays(this)
248  class(gwegweconnectiontype) :: this !< the connection
249 
250  call mem_allocate(this%exgflowjaGwe, this%ig_builder%nrOfBoundaryCells, &
251  'EXGFLOWJAGWT', this%memoryPath)
252 
253  end subroutine allocate_arrays
254 
255  !> @brief Set required extent of the interface grid from
256  !< the configuration
257  subroutine setgridextent(this)
258  ! dummy
259  class(gwegweconnectiontype) :: this !< the connection
260  ! local
261  logical(LGP) :: hasAdv, hasCnd
262 
263  hasadv = this%gweModel%inadv > 0
264  hascnd = this%gweModel%incnd > 0
265 
266  if (hasadv) then
267  if (this%iIfaceAdvScheme == adv_scheme_tvd .or. &
268  this%iIfaceAdvScheme == adv_scheme_utvd) then
269  this%exg_stencil_depth = 2
270  if (this%gweModel%adv%iadvwt == adv_scheme_tvd .or. &
271  this%gweModel%adv%iadvwt == adv_scheme_utvd) then
272  this%int_stencil_depth = 2
273  end if
274  end if
275  end if
276 
277  if (hascnd) then
278  if (this%iIfaceXt3d > 0) then
279  this%exg_stencil_depth = 2
280  if (this%gweModel%cnd%ixt3d > 0) then
281  this%int_stencil_depth = 2
282  end if
283  end if
284  end if
285 
286  end subroutine setgridextent
287 
288  !> @brief allocate and read/set the connection's data structures
289  !<
290  subroutine gwegwecon_ar(this)
291  class(gwegweconnectiontype) :: this !< the connection
292 
293  ! check if we can construct an interface model
294  ! NB: only makes sense after the models' allocate&read have been
295  ! called, which is why we do it here
296  call this%validateConnection()
297 
298  ! allocate and read base
299  call this%spatialcon_ar()
300 
301  ! ... and now the interface model
302  call this%gweInterfaceModel%model_ar()
303 
304  ! set a pointer in the interface model to the gwecommon data
305  if (this%gweModel%inest > 0) then
306  this%gweInterfaceModel%gwecommon%gwecpw => this%gweModel%gwecommon%gwecpw
307  this%gweInterfaceModel%gwecommon%gwerhow => this%gweModel%gwecommon%gwerhow
308  end if
309 
310  ! set the equation scaling factor in the interface model to that of
311  ! underlying GWE model
312  if (this%gweModel%incnd > 0) then
313  this%gweInterfaceModel%ieqnsclfac = this%gweModel%cnd%eqnsclfac
314  end if
315 
316  ! AR the movers and obs through the exchange
317  if (this%owns_exchange) then
318  !cdl implement this when MVT is ready
319  !cdl if (this%gweExchange%inmvt > 0) then
320  !cdl call this%gweExchange%mvt%mvt_ar()
321  !cdl end if
322  if (this%gweExchange%inobs > 0) then
323  call this%gweExchange%obs%obs_ar()
324  end if
325  end if
326 
327  end subroutine gwegwecon_ar
328 
329  !> @brief validate this connection prior to constructing
330  !< the interface model
331  subroutine validateconnection(this)
332  use simvariablesmodule, only: errmsg
334  class(gwegweconnectiontype) :: this !< this connection
335 
336  ! base validation, the spatial/geometry part
337  call this%SpatialModelConnectionType%validateConnection()
338 
339  ! we cannot validate this (yet) in parallel mode
340  if (.not. this%gweExchange%v_model1%is_local) return
341  if (.not. this%gweExchange%v_model2%is_local) return
342 
343  ! check specific cross-interface options/values that should be the same
344  call this%validateGweExchange()
345 
346  ! GWE related matters
347  if ((this%gweExchange%gwemodel1%inadv > 0 .and. &
348  this%gweExchange%gwemodel2%inadv == 0) .or. &
349  (this%gweExchange%gwemodel2%inadv > 0 .and. &
350  this%gweExchange%gwemodel1%inadv == 0)) then
351  write (errmsg, '(1x,a,a,a)') 'Cannot connect GWE models in exchange ', &
352  trim(this%gweExchange%name), ' because one model is configured with ADV &
353  &and the other one is not'
354  call store_error(errmsg)
355  end if
356 
357  if ((this%gweExchange%gwemodel1%incnd > 0 .and. &
358  this%gweExchange%gwemodel2%incnd == 0) .or. &
359  (this%gweExchange%gwemodel2%incnd > 0 .and. &
360  this%gweExchange%gwemodel1%incnd == 0)) then
361  write (errmsg, '(1x,a,a,a)') 'Cannot connect GWE models in exchange ', &
362  trim(this%gweExchange%name), ' because one model is configured with CND &
363  &and the other one is not'
364  call store_error(errmsg)
365  end if
366 
367  ! abort on errors
368  if (count_errors() > 0) then
369  write (errmsg, '(a)') 'Errors occurred while processing exchange(s)'
370  call ustop()
371  end if
372 
373  end subroutine validateconnection
374 
375  subroutine gwegwecon_rp(this)
376  ! dummy
377  class(gwegweconnectiontype) :: this !< the connection
378 
379  ! call exchange rp routines
380  if (this%owns_exchange) then
381  call this%gweExchange%exg_rp()
382  end if
383 
384  end subroutine gwegwecon_rp
385 
386  !> @brief Advance this connection
387  !<
388  subroutine gwegwecon_ad(this)
389 
390  class(gwegweconnectiontype) :: this !< this connection
391 
392  ! recalculate conduction ellipse
393  if (this%gweInterfaceModel%incnd > 0) call this%gweInterfaceModel%cnd%cnd_ad()
394 
395  if (this%owns_exchange) then
396  call this%gweExchange%exg_ad()
397  end if
398 
399  end subroutine gwegwecon_ad
400 
401  subroutine gwegwecon_fc(this, kiter, matrix_sln, rhs_sln, inwtflag)
402  ! dummy
403  class(gwegweconnectiontype) :: this !< the connection
404  integer(I4B), intent(in) :: kiter !< the iteration counter
405  class(matrixbasetype), pointer :: matrix_sln !< the system matrix
406  real(DP), dimension(:), intent(inout) :: rhs_sln !< global right-hand-side
407  integer(I4B), optional, intent(in) :: inwtflag !< newton-raphson flag
408 
409  call this%SpatialModelConnectionType%spatialcon_fc( &
410  kiter, matrix_sln, rhs_sln, inwtflag)
411 
412  ! _fc the movers through the exchange
413  if (this%owns_exchange) then
414  if (this%gweExchange%inmvt > 0) then
415  call this%gweExchange%mvt%mvt_fc(this%gweExchange%gwemodel1%x, &
416  this%gweExchange%gwemodel2%x)
417  end if
418  end if
419 
420  end subroutine gwegwecon_fc
421 
422  subroutine gwegwecon_cq(this, icnvg, isuppress_output, isolnid)
423  ! dummy
424  class(gwegweconnectiontype) :: this !< the connection
425  integer(I4B), intent(inout) :: icnvg !< convergence flag
426  integer(I4B), intent(in) :: isuppress_output !< suppress output when =1
427  integer(I4B), intent(in) :: isolnid !< solution id
428 
429  call this%gweInterfaceModel%model_cq(icnvg, isuppress_output)
430  call this%setFlowToExchange()
431 
432  end subroutine gwegwecon_cq
433 
434  !> @brief Set the flows (flowja from interface model) to the
435  !< simvals in the exchange, leaving the budget calcution in there
436  subroutine setflowtoexchange(this)
437  ! modules
438  use indexmapmodule
439  ! dummy
440  class(gwegweconnectiontype) :: this !< this connection
441  ! local
442  integer(I4B) :: i
443  class(gweexchangetype), pointer :: gweEx
444  type(indexmapsgntype), pointer :: map
445 
446  if (this%owns_exchange) then
447  gweex => this%gweExchange
448  map => this%interface_map%exchange_maps(this%interface_map%prim_exg_idx)
449 
450  ! use (half of) the exchange map in reverse:
451  do i = 1, size(map%src_idx)
452  if (map%sign(i) < 0) cycle ! simvals is defined from exg%m1 => exg%m2
453  gweex%simvals(map%src_idx(i)) = &
454  this%gweInterfaceModel%flowja(map%tgt_idx(i))
455  end do
456  end if
457 
458  end subroutine setflowtoexchange
459 
460  subroutine gwegwecon_bd(this, icnvg, isuppress_output, isolnid)
461  ! modules
462  use budgetmodule, only: rate_accumulator
463  ! dummy
464  class(gwegweconnectiontype) :: this !< the connection
465  integer(I4B), intent(inout) :: icnvg !< convergence flag
466  integer(I4B), intent(in) :: isuppress_output !< suppress output when =1
467  integer(I4B), intent(in) :: isolnid !< solution id
468 
469  ! call exchange budget routine, also calls _bd
470  ! for movers.
471  if (this%owns_exchange) then
472  call this%gweExchange%exg_bd(icnvg, isuppress_output, isolnid)
473  end if
474 
475  end subroutine gwegwecon_bd
476 
477  subroutine gwegwecon_ot(this)
478  ! dummy
479  class(gwegweconnectiontype) :: this !< the connection
480 
481  ! call exg_ot() here as it handles all output processing
482  ! based on gweExchange%simvals(:), which was correctly
483  ! filled from gwegwecon
484  if (this%owns_exchange) then
485  call this%gweExchange%exg_ot()
486  end if
487 
488  end subroutine gwegwecon_ot
489 
490  !> @brief Validate the exchange, intercepting those
491  !! cases where two models have to be connected with an interface
492  !! model, where the individual configurations don't allow this
493  !!
494  !! Stops with error message on config mismatch
495  !<
496  subroutine validategweexchange(this)
497  ! modules
498  use simvariablesmodule, only: errmsg
499  use simmodule, only: store_error
500  use gweestmodule, only: gweesttype
501 
502  ! dummy
503  class(gwegweconnectiontype) :: this !< this connection
504 
505  ! local
506  class(gweexchangetype), pointer :: gweEx
507  class(*), pointer :: modelPtr
508  class(gwemodeltype), pointer :: gweModel1
509  class(gwemodeltype), pointer :: gweModel2
510  type(gweesttype), pointer :: est1, est2
511  logical(LGP) :: compatible
512 
513  gweex => this%gweExchange
514 
515  ! we cannot validate the remainder (yet) in parallel mode
516  if (.not. gweex%v_model1%is_local) return
517  if (.not. gweex%v_model2%is_local) return
518 
519  modelptr => this%gweExchange%model1
520  gwemodel1 => castasgwemodel(modelptr)
521  modelptr => this%gweExchange%model2
522  gwemodel2 => castasgwemodel(modelptr)
523 
524  ! check that EST package usage is the same on both side of the interface
525  if ((gwemodel1%inest > 0 .and. gwemodel2%inest == 0) .or. &
526  (gwemodel1%inest == 0 .and. gwemodel2%inest > 0)) then
527  write (errmsg, '(2a)') 'Energy Storage and Transfer package should '// &
528  'be enabled/disabled simultaneously in models connected with the '// &
529  'interface model for exchange ', &
530  trim(gweex%name)
531  call store_error(errmsg)
532  end if
533 
534  ! conduction options need to be the same in both model
535  if ((gwemodel1%cnd%ixt3d > 0 .and. gwemodel2%cnd%ixt3d == 0) .or. &
536  (gwemodel1%cnd%ixt3d == 0 .and. gwemodel2%cnd%ixt3d > 0)) then
537  write (errmsg, '(2a)') 'Use of XT3D to calculate conduction should '// &
538  'be the same in both models, either both use XT3D or neither for '// &
539  ' exchange '//trim(gweex%name)
540  call store_error(errmsg)
541  end if
542 
543  ! check compatibility of Energy Storage and Transfer (EST) package
544  compatible = .true.
545  est1 => gwemodel1%est
546  est2 => gwemodel2%est
547  if (est1%rhow /= est2%rhow) compatible = .false.
548  if (est1%cpw /= est2%cpw) compatible = .false.
549  ! if (est1%nrhospecies /= est2%nrhospecies) compatible = .false.
550  ! if (.not. all(buy1%drhodc == buy2%drhodc)) compatible = .false.
551  ! if (.not. all(buy1%crhoref == buy2%crhoref)) compatible = .false.
552  !if (.not. all(buy1%cauxspeciesname == buy2%cauxspeciesname)) then
553  ! compatible = .false.
554  !end if
555  if (.not. compatible) then
556  write (errmsg, '(6a)') 'Energy storage and transfer (EST) packages ', &
557  'in model '//trim(gweex%model1%name), ' and ', &
558  trim(gweex%model2%name), &
559  ' should be equivalent to construct an '// &
560  ' interface model for exchange ', &
561  trim(gweex%name)
562  call store_error(errmsg)
563  end if
564 
565  end subroutine validategweexchange
566 
567  !> @brief Deallocate all resources
568  !<
569  subroutine gwegwecon_da(this)
570  ! dummy
571  class(gwegweconnectiontype) :: this !< the connection
572  ! local
573  logical(LGP) :: isOpen
574 
575  ! scalars
576  call mem_deallocate(this%iIfaceAdvScheme)
577  call mem_deallocate(this%iIfaceXt3d)
578  call mem_deallocate(this%exgflowSign)
579 
580  ! arrays
581  call mem_deallocate(this%exgflowjaGwe)
582 
583  ! interface model
584  call this%gweInterfaceModel%model_da()
585  deallocate (this%gweInterfaceModel)
586 
587  ! dealloc base
588  call this%spatialcon_da()
589 
590  inquire (this%iout, opened=isopen)
591  if (isopen) then
592  close (this%iout)
593  end if
594 
595  ! we need to deallocate the exchange we own:
596  if (this%owns_exchange) then
597  call this%gweExchange%exg_da()
598  end if
599 
600  end subroutine gwegwecon_da
601 
602  !> @brief Cast to GweGweConnectionType
603  !<
604  function castasgwegweconnection(obj) result(res)
605  implicit none
606  ! dummy
607  class(*), pointer, intent(inout) :: obj !< object to be cast
608  ! return
609  class(gwegweconnectiontype), pointer :: res !< the GweGweConnection
610 
611  res => null()
612  if (.not. associated(obj)) return
613 
614  select type (obj)
615  class is (gwegweconnectiontype)
616  res => obj
617  end select
618 
619  end function castasgwegweconnection
620 
621 end module
integer(i4b), parameter adv_scheme_tvd
integer(i4b), parameter adv_scheme_utvd
This module contains the BudgetModule.
Definition: Budget.f90:20
subroutine, public rate_accumulator(flow, rin, rout)
@ brief Rate accumulator subroutine
Definition: Budget.f90:632
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
integer(i4b), parameter lencomponentname
maximum length of a component name
Definition: Constants.f90:18
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:65
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
Definition: Constants.f90:37
integer(i4b) function, public getcsrindex(i, j, ia, ja)
Return index for element i,j in CSR storage,.
Definition: CsrUtils.f90:13
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
@ brief Energy Storage and Transfer (EST) Module
Definition: gwe-est.f90:13
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)
Deallocate all resources.
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 validategweexchange(this)
Validate the exchange, intercepting those cases where two models have to be connected with an interfa...
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.
Definition: exg-gwegwe.f90:10
class(gweexchangetype) function, pointer, public castasgweexchange(obj)
@ brief Cast polymorphic object as exchange
Definition: gwe.f90:3
class(gwemodeltype) function, pointer, public castasgwemodel(model)
Cast to GweModelType.
Definition: gwe.f90:794
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
Definition: InputOutput.f90:30
This module defines variable data types.
Definition: kind.f90:8
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public ustop(stopmess, ioutlocal)
Stop the simulation.
Definition: Sim.f90:312
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
integer(i4b) function, public count_errors()
Return number of errors.
Definition: Sim.f90:59
integer(i4b), parameter, public stg_aft_con_ar
afterr connection allocate read
Definition: SimStages.f90:18
integer(i4b), parameter, public stg_bfr_exg_ad
before exchange advance (per solution)
Definition: SimStages.f90:21
integer(i4b), parameter, public stg_bfr_exg_cf
before exchange calculate (per solution)
Definition: SimStages.f90:22
integer(i4b), parameter, public stg_bfr_con_ar
before connection allocate read
Definition: SimStages.f90:17
This module contains simulation variables.
Definition: SimVariables.f90:9
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...
@ brief Energy storage and transfer
Definition: gwe-est.f90:48
Connects a GWE model to other GWE models in space. Derives from NumericalExchangeType so the solution...
Derived type for GwtExchangeType.
Definition: exg-gwegwe.f90:48
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....