MODFLOW 6  version 6.8.0.dev0
USGS Modular Hydrologic Model
gwfexgmovermodule Module Reference

Data Types

type  gwfexgmovertype
 Extends model mover for exchanges to also handle the. More...
 

Functions/Subroutines

subroutine, public exg_mvr_cr (exg_mvr, name_parent, inunit, iout, dis)
 
subroutine xmvr_check_packages (this)
 
subroutine xmvr_assign_packagemovers (this)
 Overrides GWF MVR routine to skip assigning. More...
 
subroutine xmvr_initialize_movers (this, nr_active_movers)
 Overrides mover initialization in GWF MVR to deactivate remote parts and build up sync. arrays. More...
 
subroutine xmvr_cf (this)
 Calculates qpactual and stores it for synchronization. More...
 
subroutine xmvr_fc (this)
 Assign synced qpactual to mover and update receiver. More...
 
subroutine xmvr_bd (this)
 Overrides budget routine to first assign the. More...
 
subroutine xmvr_allocate_arrays (this)
 
subroutine xmvr_da (this)
 

Function/Subroutine Documentation

◆ exg_mvr_cr()

subroutine, public gwfexgmovermodule::exg_mvr_cr ( class(gwfexgmovertype), pointer  exg_mvr,
character(len=*), intent(in)  name_parent,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout,
class(disbasetype), pointer  dis 
)

Definition at line 40 of file GwfExchangeMover.f90.

41  class(GwfExgMoverType), pointer :: exg_mvr
42  character(len=*), intent(in) :: name_parent
43  integer(I4B), intent(in) :: inunit
44  integer(I4B), intent(in) :: iout
45  class(DisBaseType), pointer :: dis
46 
47  allocate (exg_mvr)
48 
49  ! Init through base
50  call exg_mvr%mvr_init(name_parent, inunit, iout, dis, 1)
51 
Here is the caller graph for this function:

◆ xmvr_allocate_arrays()

subroutine gwfexgmovermodule::xmvr_allocate_arrays ( class(gwfexgmovertype this)
private

Definition at line 247 of file GwfExchangeMover.f90.

248  class(GwfExgMoverType) :: this
249  ! local
250  integer(I4B) :: i
251 
252  call this%GwfMvrType%allocate_arrays()
253 
254  allocate (this%prov_is_m1(this%maxmvr))
255  call mem_allocate(this%qpactual_m1, this%maxmvr, 'QPACTUAL_M1', &
256  this%memoryPath)
257  call mem_allocate(this%qpactual_m2, this%maxmvr, 'QPACTUAL_M2', &
258  this%memoryPath)
259  call mem_allocate(this%qavailable_m1, this%maxmvr, 'QAVAILABLE_M1', &
260  this%memoryPath)
261  call mem_allocate(this%qavailable_m2, this%maxmvr, 'QAVAILABLE_M2', &
262  this%memoryPath)
263  call mem_allocate(this%id_mapped_m1, this%maxmvr, 'ID_MAPPED_M1', &
264  this%memoryPath)
265  call mem_allocate(this%id_mapped_m2, this%maxmvr, 'ID_MAPPED_M2', &
266  this%memoryPath)
267 
268  do i = 1, this%maxmvr
269  this%id_mapped_m1(i) = 0
270  this%id_mapped_m2(i) = 0
271  this%qpactual_m1(i) = dnodata
272  this%qpactual_m2(i) = dnodata
273  this%qavailable_m1(i) = dnodata
274  this%qavailable_m2(i) = dnodata
275  end do
276 

◆ xmvr_assign_packagemovers()

subroutine gwfexgmovermodule::xmvr_assign_packagemovers ( class(gwfexgmovertype), intent(inout)  this)
Parameters
[in,out]thisthis exchange mover

Definition at line 105 of file GwfExchangeMover.f90.

106  class(GwfExgMoverType), intent(inout) :: this !< this exchange mover
107  ! local
108  integer(I4B) :: i
109  character(len=LENMODELNAME) :: mname
110  character(len=LENPACKAGENAME) :: pname
111  class(VirtualModelType), pointer :: vm
112 
113  do i = 1, size(this%pckMemPaths)
114  if (this%pakmovers(i)%memoryPath == '') then
115  ! is it local?
116  call split_mem_path(this%pckMemPaths(i), mname, pname)
117  vm => get_virtual_model(mname)
118  if (vm%is_local) then
119  ! yes, we need the pointers
120  call set_packagemover_pointer(this%pakmovers(i), &
121  trim(this%pckMemPaths(i)))
122  end if
123  end if
124  end do
Here is the call graph for this function:

◆ xmvr_bd()

subroutine gwfexgmovermodule::xmvr_bd ( class(gwfexgmovertype this)
private

Definition at line 229 of file GwfExchangeMover.f90.

230  class(GwfExgMoverType) :: this
231  ! local
232  integer(I4B) :: i
233 
234  ! copy from synchronization arrays back into movers:
235  do i = 1, this%nmvr
236  if (this%prov_is_m1(i)) then
237  this%mvr(i)%iRchNrSrcMapped = this%id_mapped_m1(i)
238  else
239  this%mvr(i)%iRchNrSrcMapped = this%id_mapped_m2(i)
240  end if
241  end do
242 
243  call this%fill_budobj()
244 

◆ xmvr_cf()

subroutine gwfexgmovermodule::xmvr_cf ( class(gwfexgmovertype this)
private

Definition at line 177 of file GwfExchangeMover.f90.

178  class(GwfExgMoverType) :: this
179  ! local
180  integer(I4B) :: i
181 
182  do i = 1, this%nmvr
183  if (this%mvr(i)%is_provider_active) then
184 
185  call this%mvr(i)%update_provider()
186 
187  ! copy calculated rate to arrays for synchronization:
188  if (this%prov_is_m1(i)) then
189  this%qpactual_m1(i) = this%mvr(i)%qpactual
190  this%qavailable_m1(i) = this%mvr(i)%qavailable
191  this%qpactual_m2(i) = dnodata
192  this%qavailable_m2(i) = dnodata
193  else
194  this%qpactual_m1(i) = dnodata
195  this%qavailable_m1(i) = dnodata
196  this%qpactual_m2(i) = this%mvr(i)%qpactual
197  this%qavailable_m2(i) = this%mvr(i)%qavailable
198  end if
199  end if
200  end do
201 

◆ xmvr_check_packages()

subroutine gwfexgmovermodule::xmvr_check_packages ( class(gwfexgmovertype), intent(inout)  this)
private

Definition at line 54 of file GwfExchangeMover.f90.

55  use constantsmodule, only: linelength
58  class(GwfExgMoverType), intent(inout) :: this
59  ! local
60  character(len=LENMODELNAME) :: mname
61  character(len=LENPACKAGENAME) :: pname
62  class(VirtualModelType), pointer :: vm
63  character(len=LINELENGTH) :: errmsg
64  integer(I4B) :: i
65  integer(I4B), pointer :: imover_ptr
66 
67  do i = 1, size(this%pckMemPaths)
68  ! check only when local
69  call split_mem_path(this%pckMemPaths(i), mname, pname)
70  vm => get_virtual_model(mname)
71  if (vm%is_local) then
72  ! check if PackageMover is active in package:
73  imover_ptr => null()
74  call mem_setptr(imover_ptr, 'IMOVER', trim(this%pckMemPaths(i)))
75  if (imover_ptr == 0) then
76  write (errmsg, '(a, a, a)') &
77  'ERROR. MODEL AND PACKAGE "', &
78  trim(this%pckMemPaths(i)), &
79  '" DOES NOT HAVE MOVER SPECIFIED IN OPTIONS BLOCK.'
80  call store_error(errmsg)
81  end if
82  end if
83  !
84  ! ensure that the current model name, which is listed in the PACKAGES
85  ! block of the exchange MVR input, is one of the two models connected
86  ! by the exchange. If not, then the model should not be listed.
87  if (mname == this%model1%name .or. mname == this%model2%name) then
88  continue
89  else
90  write (errmsg, '(a, a, a)') 'The input for an exchange mover &
91  &lists a model name ("', trim(mname), '") in the PACKAGES &
92  &input block that is not a member of the exchange.'
93  call store_error(errmsg)
94  end if
95  end do
96 
97  if (count_errors() > 0) then
98  call this%parser%StoreErrorUnit()
99  end if
100 
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
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
subroutine, public store_error_unit(iunit, terminate)
Store the file unit number.
Definition: Sim.f90:168
Here is the call graph for this function:

◆ xmvr_da()

subroutine gwfexgmovermodule::xmvr_da ( class(gwfexgmovertype this)
private

Definition at line 279 of file GwfExchangeMover.f90.

280  class(GwfExgMoverType) :: this
281 
282  call this%GwfMvrType%mvr_da()
283 
284  deallocate (this%prov_is_m1)
285  call mem_deallocate(this%qpactual_m1)
286  call mem_deallocate(this%qpactual_m2)
287  call mem_deallocate(this%qavailable_m1)
288  call mem_deallocate(this%qavailable_m2)
289  call mem_deallocate(this%id_mapped_m1)
290  call mem_deallocate(this%id_mapped_m2)
291 

◆ xmvr_fc()

subroutine gwfexgmovermodule::xmvr_fc ( class(gwfexgmovertype this)
private

Definition at line 206 of file GwfExchangeMover.f90.

207  class(GwfExgMoverType) :: this
208  ! local
209  integer(I4B) :: i
210 
211  do i = 1, this%nmvr
212  if (this%mvr(i)%is_receiver_active) then
213  ! copy from synchronization arrays back into movers:
214  if (this%prov_is_m1(i)) then
215  this%mvr(i)%qpactual = this%qpactual_m1(i)
216  this%mvr(i)%qavailable = this%qavailable_m1(i)
217  else
218  this%mvr(i)%qpactual = this%qpactual_m2(i)
219  this%mvr(i)%qavailable = this%qavailable_m2(i)
220  end if
221  call this%mvr(i)%update_receiver()
222  end if
223  end do
224 

◆ xmvr_initialize_movers()

subroutine gwfexgmovermodule::xmvr_initialize_movers ( class(gwfexgmovertype this,
integer(i4b)  nr_active_movers 
)
private

Definition at line 130 of file GwfExchangeMover.f90.

131  class(GwfExgMoverType) :: this
132  integer(I4B) :: nr_active_movers
133  ! local
134  integer(I4B) :: i
135  character(len=LENMODELNAME) :: mname
136  character(len=LENPACKAGENAME) :: pname
137  class(VirtualModelType), pointer :: vm
138  class(PackageMoverType), allocatable :: pkg_mvr
139 
140  call this%GwfMvrType%initialize_movers(nr_active_movers)
141 
142  this%prov_is_m1 = .false.
143 
144  ! deactivate remote parts
145  do i = 1, nr_active_movers
146  call split_mem_path(this%mvr(i)%mem_path_src, mname, pname)
147  vm => get_virtual_model(mname)
148  this%mvr(i)%is_provider_active = vm%is_local
149  this%prov_is_m1(i) = associated(vm, this%model1)
150  call split_mem_path(this%mvr(i)%mem_path_tgt, mname, pname)
151  vm => get_virtual_model(mname)
152  this%mvr(i)%is_receiver_active = vm%is_local
153  end do
154 
155  ! loop over mvr's, if provider is active,
156  ! store mapped feature index in array for sync
157  allocate (pkg_mvr)
158 
159  do i = 1, nr_active_movers
160  if (this%mvr(i)%is_provider_active) then
161  ! store mapped feature id in array (for synchronization when parallel)
162  call set_packagemover_pointer(pkg_mvr, this%mvr(i)%mem_path_src)
163  if (this%prov_is_m1(i)) then
164  this%id_mapped_m1(i) = pkg_mvr%iprmap(this%mvr(i)%iRchNrSrc)
165  this%id_mapped_m2(i) = -1
166  else
167  this%id_mapped_m1(i) = -1
168  this%id_mapped_m2(i) = pkg_mvr%iprmap(this%mvr(i)%iRchNrSrc)
169  end if
170  end if
171  end do
172 
Here is the call graph for this function: