MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
gwfprtexchangemodule Module Reference

Data Types

type  gwfprtexchangetype
 

Functions/Subroutines

subroutine, public gwfprt_cr (filename, id, m1id, m2id)
 Create a new GWF to PRT exchange object. More...
 
subroutine set_model_pointers (this)
 
subroutine exg_df (this)
 
subroutine exg_ar (this)
 
subroutine exg_da (this)
 
subroutine allocate_scalars (this)
 
subroutine gwfbnd2prtfmi (this)
 

Function/Subroutine Documentation

◆ allocate_scalars()

subroutine gwfprtexchangemodule::allocate_scalars ( class(gwfprtexchangetype this)

Definition at line 269 of file exg-gwfprt.f90.

270  ! -- modules
272  ! -- dummy
273  class(GwfPrtExchangeType) :: this
274  ! -- local
275  !
276  call mem_allocate(this%m1id, 'M1ID', this%memoryPath)
277  call mem_allocate(this%m2id, 'M2ID', this%memoryPath)
278  this%m1id = 0
279  this%m2id = 0

◆ exg_ar()

subroutine gwfprtexchangemodule::exg_ar ( class(gwfprtexchangetype this)

Definition at line 177 of file exg-gwfprt.f90.

178  ! -- modules
180  ! -- dummy
181  class(GwfPrtExchangeType) :: this
182  ! -- local
183  class(BaseModelType), pointer :: mb => null()
184  type(GwfModelType), pointer :: gwfmodel => null()
185  type(PrtModelType), pointer :: prtmodel => null()
186  ! -- formats
187  character(len=*), parameter :: fmtdiserr = &
188  "('GWF and PRT Models do not have the same discretization for exchange&
189  & ',a,'.&
190  & GWF Model has ', i0, ' user nodes and ', i0, ' reduced nodes.&
191  & PRT Model has ', i0, ' user nodes and ', i0, ' reduced nodes.&
192  & Ensure discretization packages, including IDOMAIN, are identical.')"
193  !
194  ! -- set gwfmodel
195  mb => getbasemodelfromlist(basemodellist, this%m1id)
196  select type (mb)
197  type is (gwfmodeltype)
198  gwfmodel => mb
199  end select
200  !
201  ! -- set prtmodel
202  mb => getbasemodelfromlist(basemodellist, this%m2id)
203  select type (mb)
204  type is (prtmodeltype)
205  prtmodel => mb
206  end select
207  !
208  ! -- Check to make sure sizes are identical
209  if (prtmodel%dis%nodes /= gwfmodel%dis%nodes .or. &
210  prtmodel%dis%nodesuser /= gwfmodel%dis%nodesuser) then
211  write (errmsg, fmtdiserr) trim(this%name), &
212  gwfmodel%dis%nodesuser, &
213  gwfmodel%dis%nodes, &
214  prtmodel%dis%nodesuser, &
215  prtmodel%dis%nodes
216  call store_error(errmsg, terminate=.true.)
217  end if
218  !
219  ! -- setup pointers to gwf variables allocated in gwf_ar
220  prtmodel%fmi%gwfhead => gwfmodel%x
221  call mem_checkin(prtmodel%fmi%gwfhead, &
222  'GWFHEAD', prtmodel%fmi%memoryPath, &
223  'X', gwfmodel%memoryPath)
224  prtmodel%fmi%gwfsat => gwfmodel%npf%sat
225  call mem_checkin(prtmodel%fmi%gwfsat, &
226  'GWFSAT', prtmodel%fmi%memoryPath, &
227  'SAT', gwfmodel%npf%memoryPath)
228  prtmodel%fmi%gwfspdis => gwfmodel%npf%spdis
229  call mem_checkin(prtmodel%fmi%gwfspdis, &
230  'GWFSPDIS', prtmodel%fmi%memoryPath, &
231  'SPDIS', gwfmodel%npf%memoryPath)
232  !
233  ! -- setup pointers to the flow storage rates. GWF strg arrays are
234  ! available after the gwf_ar routine is called.
235  if (prtmodel%inmst > 0) then
236  if (gwfmodel%insto > 0) then
237  prtmodel%fmi%gwfstrgss => gwfmodel%sto%strgss
238  prtmodel%fmi%igwfstrgss = 1
239  if (gwfmodel%sto%iusesy == 1) then
240  prtmodel%fmi%gwfstrgsy => gwfmodel%sto%strgsy
241  prtmodel%fmi%igwfstrgsy = 1
242  end if
243  end if
244  end if
245 
246  ! -- transfer the boundary package information from gwf to prt
247  call this%gwfbnd2prtfmi()
248 
249  ! -- if mover package is active, then set a pointer to it's budget object
250  if (gwfmodel%inmvr /= 0) &
251  prtmodel%fmi%mvrbudobj => gwfmodel%mvr%budobj
252 
253  ! -- todo connections
Here is the call graph for this function:

◆ exg_da()

subroutine gwfprtexchangemodule::exg_da ( class(gwfprtexchangetype this)

Definition at line 258 of file exg-gwfprt.f90.

259  ! -- modules
261  ! -- dummy
262  class(GwfPrtExchangeType) :: this
263  ! -- local
264  !
265  call mem_deallocate(this%m1id)
266  call mem_deallocate(this%m2id)

◆ exg_df()

subroutine gwfprtexchangemodule::exg_df ( class(gwfprtexchangetype this)

Definition at line 119 of file exg-gwfprt.f90.

120  ! -- modules
122  ! -- dummy
123  class(GwfPrtExchangeType) :: this
124  ! -- local
125  class(BaseModelType), pointer :: mb => null()
126  type(GwfModelType), pointer :: gwfmodel => null()
127  type(PrtModelType), pointer :: prtmodel => null()
128  integer(I4B) :: ngwfpack, ip
129  class(BndType), pointer :: packobj => null()
130  !
131  !
132  ! -- set gwfmodel
133  mb => getbasemodelfromlist(basemodellist, this%m1id)
134  select type (mb)
135  type is (gwfmodeltype)
136  gwfmodel => mb
137  end select
138  !
139  ! -- set prtmodel
140  mb => getbasemodelfromlist(basemodellist, this%m2id)
141  select type (mb)
142  type is (prtmodeltype)
143  prtmodel => mb
144  end select
145  !
146  ! -- Check to make sure that flow is solved before particle tracking and in a
147  ! different solution
148  if (gwfmodel%idsoln >= prtmodel%idsoln) then
149  write (errmsg, '(3a)') 'Problem with GWF-PRT exchange ', trim(this%name), &
150  '. The GWF model must be solved by a different solution than the PRT model. &
151  &The IMS specified for GWF must be listed in mfsim.nam &
152  &before the EMS for PRT.'
153  call store_error(errmsg, terminate=.true.)
154  end if
155  !
156  ! -- Set pointer to flowja
157  prtmodel%fmi%gwfflowja => gwfmodel%flowja
158  call mem_checkin(prtmodel%fmi%gwfflowja, &
159  'GWFFLOWJA', prtmodel%fmi%memoryPath, &
160  'FLOWJA', gwfmodel%memoryPath)
161  !
162  ! -- Set the npf flag so that specific discharge is available for
163  ! transport calculations if dispersion is active
164  if (prtmodel%indsp > 0) then
165  gwfmodel%npf%icalcspdis = 1
166  end if
167  !
168  ! -- Set the auxiliary names for gwf flow packages in prt%fmi
169  ngwfpack = gwfmodel%bndlist%Count()
170  do ip = 1, ngwfpack
171  packobj => getbndfromlist(gwfmodel%bndlist, ip)
172  call prtmodel%fmi%gwfpackages(ip)%set_auxname(packobj%naux, &
173  packobj%auxname)
174  end do
Here is the call graph for this function:

◆ gwfbnd2prtfmi()

subroutine gwfprtexchangemodule::gwfbnd2prtfmi ( class(gwfprtexchangetype this)

Definition at line 282 of file exg-gwfprt.f90.

283  ! -- modules
284  ! -- dummy
285  class(GwfPrtExchangeType) :: this
286  ! -- local
287  integer(I4B) :: ngwfpack, ip, iterm, imover
288  class(BaseModelType), pointer :: mb => null()
289  type(GwfModelType), pointer :: gwfmodel => null()
290  type(PrtModelType), pointer :: prtmodel => null()
291  class(BndType), pointer :: packobj => null()
292  !
293  ! -- set gwfmodel
294  mb => getbasemodelfromlist(basemodellist, this%m1id)
295  select type (mb)
296  type is (gwfmodeltype)
297  gwfmodel => mb
298  end select
299  !
300  ! -- set prtmodel
301  mb => getbasemodelfromlist(basemodellist, this%m2id)
302  select type (mb)
303  type is (prtmodeltype)
304  prtmodel => mb
305  end select
306  !
307  ! -- Call routines in FMI that will set pointers to the necessary flow
308  ! data (SIMVALS and SIMTOMVR) stored within each GWF flow package
309  ngwfpack = gwfmodel%bndlist%Count()
310  iterm = 1
311  do ip = 1, ngwfpack
312  packobj => getbndfromlist(gwfmodel%bndlist, ip)
313  call prtmodel%fmi%gwfpackages(iterm)%set_pointers( &
314  'SIMVALS', &
315  packobj%memoryPath, &
316  packobj%input_mempath)
317  iterm = iterm + 1
318  !
319  ! -- If a mover is active for this package, then establish a separate
320  ! pointer link for the mover flows stored in SIMTOMVR
321  imover = packobj%imover
322  if (packobj%isadvpak /= 0) imover = 0
323  if (imover /= 0) then
324  call prtmodel%fmi%gwfpackages(iterm)%set_pointers( &
325  'SIMTOMVR', &
326  packobj%memoryPath, &
327  packobj%input_mempath)
328  iterm = iterm + 1
329  end if
330  end do
Here is the call graph for this function:

◆ gwfprt_cr()

subroutine, public gwfprtexchangemodule::gwfprt_cr ( character(len=*), intent(in)  filename,
integer(i4b), intent(in)  id,
integer(i4b), intent(in)  m1id,
integer(i4b), intent(in)  m2id 
)

Definition at line 39 of file exg-gwfprt.f90.

40  ! -- modules
42  ! -- dummy
43  character(len=*), intent(in) :: filename
44  integer(I4B), intent(in) :: id
45  integer(I4B), intent(in) :: m1id
46  integer(I4B), intent(in) :: m2id
47  ! -- local
48  class(BaseExchangeType), pointer :: baseexchange => null()
49  type(GwfPrtExchangeType), pointer :: exchange => null()
50  character(len=20) :: cint
51  !
52  ! -- Create a new exchange and add it to the baseexchangelist container
53  allocate (exchange)
54  baseexchange => exchange
55  call addbaseexchangetolist(baseexchangelist, baseexchange)
56  !
57  ! -- Assign id and name
58  exchange%id = id
59  write (cint, '(i0)') id
60  exchange%name = 'GWF-PRT_'//trim(adjustl(cint))
61  exchange%memoryPath = exchange%name
62  !
63  ! -- allocate scalars
64  call exchange%allocate_scalars()
65  !
66  ! -- NB: convert from id to local model index in base model list
67  exchange%m1id = model_loc_idx(m1id)
68  exchange%m2id = model_loc_idx(m2id)
69  !
70  ! -- set model pointers
71  call exchange%set_model_pointers()
This module contains simulation variables.
Definition: SimVariables.f90:9
integer(i4b), dimension(:), allocatable model_loc_idx
equals the local index into the basemodel list (-1 when not available)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_model_pointers()

subroutine gwfprtexchangemodule::set_model_pointers ( class(gwfprtexchangetype this)

Definition at line 74 of file exg-gwfprt.f90.

75  ! -- modules
76  ! -- dummy
77  class(GwfPrtExchangeType) :: this
78  ! -- local
79  class(BaseModelType), pointer :: mb => null()
80  type(GwfModelType), pointer :: gwfmodel => null()
81  type(PrtModelType), pointer :: prtmodel => null()
82  !
83  ! -- set gwfmodel
84  mb => getbasemodelfromlist(basemodellist, this%m1id)
85  select type (mb)
86  type is (gwfmodeltype)
87  gwfmodel => mb
88  end select
89  !
90  ! -- set prtmodel
91  mb => getbasemodelfromlist(basemodellist, this%m2id)
92  select type (mb)
93  type is (prtmodeltype)
94  prtmodel => mb
95  end select
96  !
97  ! -- Verify that GWF model is of the correct type
98  if (.not. associated(gwfmodel)) then
99  write (errmsg, '(3a)') 'Problem with GWF-PRT exchange ', trim(this%name), &
100  '. Specified GWF Model does not appear to be of the correct type.'
101  call store_error(errmsg, terminate=.true.)
102  end if
103  !
104  ! -- Verify that PRT model is of the correct type
105  if (.not. associated(prtmodel)) then
106  write (errmsg, '(3a)') 'Problem with GWF-PRT exchange ', trim(this%name), &
107  '. Specified PRT Model does not appear to be of the correct type.'
108  call store_error(errmsg, terminate=.true.)
109  end if
110  !
111  ! -- Tell particle tracking model fmi flows are not read from file
112  prtmodel%fmi%flows_from_file = .false.
113  !
114  ! -- Set a pointer to the GWF bndlist. This will allow the transport model
115  ! to look through the flow packages and establish a link to GWF flows
116  prtmodel%fmi%gwfbndlist => gwfmodel%bndlist
Here is the call graph for this function: