MODFLOW 6  version 6.7.0.dev2
USGS Modular Hydrologic Model
gwegweconnectionmodule Module Reference

Data Types

type  gwegweconnectiontype
 Connects a GWE model to other GWE models in space. Derives from NumericalExchangeType so the solution can use it to fetch the coefficients for this connection. More...
 

Functions/Subroutines

subroutine gwegweconnection_ctor (this, model, gweEx)
 Basic construction of the connection. More...
 
subroutine allocate_scalars (this)
 Allocate scalar variables for this connection. More...
 
subroutine gwegwecon_df (this)
 define the GWE-GWE connection More...
 
subroutine cfg_dist_vars (this)
 Configure distributed variables for this interface model. More...
 
subroutine allocate_arrays (this)
 Allocate array variables for this connection. More...
 
subroutine setgridextent (this)
 Set required extent of the interface grid from. More...
 
subroutine gwegwecon_ar (this)
 allocate and read/set the connection's data structures More...
 
subroutine validateconnection (this)
 validate this connection prior to constructing More...
 
subroutine gwegwecon_rp (this)
 
subroutine gwegwecon_ad (this)
 Advance this connection. More...
 
subroutine gwegwecon_fc (this, kiter, matrix_sln, rhs_sln, inwtflag)
 
subroutine gwegwecon_cq (this, icnvg, isuppress_output, isolnid)
 
subroutine setflowtoexchange (this)
 Set the flows (flowja from interface model) to the. More...
 
subroutine gwegwecon_bd (this, icnvg, isuppress_output, isolnid)
 
subroutine gwegwecon_ot (this)
 
subroutine validategweexchange (this)
 Validate the exchange, intercepting those cases where two models have to be connected with an interface model, where the individual configurations don't allow this. More...
 
subroutine gwegwecon_da (this)
 Deallocate all resources. More...
 
class(gwegweconnectiontype) function, pointer, public castasgwegweconnection (obj)
 Cast to GweGweConnectionType. More...
 

Function/Subroutine Documentation

◆ allocate_arrays()

subroutine gwegweconnectionmodule::allocate_arrays ( class(gwegweconnectiontype this)
private
Parameters
thisthe connection

Definition at line 247 of file GweGweConnection.f90.

248  class(GweGweConnectionType) :: this !< the connection
249 
250  call mem_allocate(this%exgflowjaGwe, this%ig_builder%nrOfBoundaryCells, &
251  'EXGFLOWJAGWT', this%memoryPath)
252 

◆ allocate_scalars()

subroutine gwegweconnectionmodule::allocate_scalars ( class(gwegweconnectiontype this)
Parameters
thisthe connection

Definition at line 142 of file GweGweConnection.f90.

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 

◆ castasgwegweconnection()

class(gwegweconnectiontype) function, pointer, public gwegweconnectionmodule::castasgwegweconnection ( class(*), intent(inout), pointer  obj)
Parameters
[in,out]objobject to be cast
Returns
the GweGweConnection

Definition at line 604 of file GweGweConnection.f90.

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 
Here is the caller graph for this function:

◆ cfg_dist_vars()

subroutine gwegweconnectionmodule::cfg_dist_vars ( class(gwegweconnectiontype this)
private
Parameters
thisthe connection

Definition at line 212 of file GweGweConnection.f90.

213  ! dummy
214  class(GweGweConnectionType) :: this !< the connection
215 
216  call this%cfg_dv('X', '', sync_nds, &
217  (/stg_bfr_con_ar, stg_bfr_exg_ad, stg_bfr_exg_cf/))
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 

◆ gwegwecon_ad()

subroutine gwegweconnectionmodule::gwegwecon_ad ( class(gwegweconnectiontype this)
private
Parameters
thisthis connection

Definition at line 388 of file GweGweConnection.f90.

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 

◆ gwegwecon_ar()

subroutine gwegweconnectionmodule::gwegwecon_ar ( class(gwegweconnectiontype this)
private
Parameters
thisthe connection

Definition at line 290 of file GweGweConnection.f90.

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 

◆ gwegwecon_bd()

subroutine gwegweconnectionmodule::gwegwecon_bd ( class(gwegweconnectiontype this,
integer(i4b), intent(inout)  icnvg,
integer(i4b), intent(in)  isuppress_output,
integer(i4b), intent(in)  isolnid 
)
Parameters
thisthe connection
[in,out]icnvgconvergence flag
[in]isuppress_outputsuppress output when =1
[in]isolnidsolution id

Definition at line 460 of file GweGweConnection.f90.

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 
This module contains the BudgetModule.
Definition: Budget.f90:20
subroutine, public rate_accumulator(flow, rin, rout)
@ brief Rate accumulator subroutine
Definition: Budget.f90:632
Here is the call graph for this function:

◆ gwegwecon_cq()

subroutine gwegweconnectionmodule::gwegwecon_cq ( class(gwegweconnectiontype this,
integer(i4b), intent(inout)  icnvg,
integer(i4b), intent(in)  isuppress_output,
integer(i4b), intent(in)  isolnid 
)
private
Parameters
thisthe connection
[in,out]icnvgconvergence flag
[in]isuppress_outputsuppress output when =1
[in]isolnidsolution id

Definition at line 422 of file GweGweConnection.f90.

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 

◆ gwegwecon_da()

subroutine gwegweconnectionmodule::gwegwecon_da ( class(gwegweconnectiontype this)
Parameters
thisthe connection

Definition at line 569 of file GweGweConnection.f90.

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 

◆ gwegwecon_df()

subroutine gwegweconnectionmodule::gwegwecon_df ( class(gwegweconnectiontype this)
private
Parameters
thisthe connection

Definition at line 154 of file GweGweConnection.f90.

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 

◆ gwegwecon_fc()

subroutine gwegweconnectionmodule::gwegwecon_fc ( class(gwegweconnectiontype this,
integer(i4b), intent(in)  kiter,
class(matrixbasetype), pointer  matrix_sln,
real(dp), dimension(:), intent(inout)  rhs_sln,
integer(i4b), intent(in), optional  inwtflag 
)
private
Parameters
thisthe connection
[in]kiterthe iteration counter
matrix_slnthe system matrix
[in,out]rhs_slnglobal right-hand-side
[in]inwtflagnewton-raphson flag

Definition at line 401 of file GweGweConnection.f90.

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 

◆ gwegwecon_ot()

subroutine gwegweconnectionmodule::gwegwecon_ot ( class(gwegweconnectiontype this)
Parameters
thisthe connection

Definition at line 477 of file GweGweConnection.f90.

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 

◆ gwegwecon_rp()

subroutine gwegweconnectionmodule::gwegwecon_rp ( class(gwegweconnectiontype this)
Parameters
thisthe connection

Definition at line 375 of file GweGweConnection.f90.

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 

◆ gwegweconnection_ctor()

subroutine gwegweconnectionmodule::gwegweconnection_ctor ( class(gwegweconnectiontype this,
class(numericalmodeltype), pointer  model,
class(disconnexchangetype), pointer  gweEx 
)
Parameters
thisthe connection
modelthe model owning this connection, this must be a GweModelType
gweexthe GWE-GWE exchange the interface model is created for

Definition at line 84 of file GweGweConnection.f90.

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 
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
Definition: InputOutput.f90:30
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setflowtoexchange()

subroutine gwegweconnectionmodule::setflowtoexchange ( class(gwegweconnectiontype this)
private
Parameters
thisthis connection

Definition at line 436 of file GweGweConnection.f90.

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 

◆ setgridextent()

subroutine gwegweconnectionmodule::setgridextent ( class(gwegweconnectiontype this)
private
Parameters
thisthe connection

Definition at line 257 of file GweGweConnection.f90.

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 

◆ validateconnection()

subroutine gwegweconnectionmodule::validateconnection ( class(gwegweconnectiontype this)
private
Parameters
thisthis connection

Definition at line 331 of file GweGweConnection.f90.

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 
This module contains simulation methods.
Definition: Sim.f90:10
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
This module contains simulation variables.
Definition: SimVariables.f90:9
character(len=maxcharlen) errmsg
error message string
Here is the call graph for this function:

◆ validategweexchange()

subroutine gwegweconnectionmodule::validategweexchange ( class(gwegweconnectiontype this)
private

Stops with error message on config mismatch

Parameters
thisthis connection

Definition at line 496 of file GweGweConnection.f90.

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 
@ brief Energy Storage and Transfer (EST) Module
Definition: gwe-est.f90:13
@ brief Energy storage and transfer
Definition: gwe-est.f90:48
Here is the call graph for this function: