MODFLOW 6  version 6.7.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 235 of file GwfExchangeMover.f90.

236  class(GwfExgMoverType) :: this
237  ! local
238  integer(I4B) :: i
239 
240  call this%GwfMvrType%allocate_arrays()
241 
242  allocate (this%prov_is_m1(this%maxmvr))
243  call mem_allocate(this%qpactual_m1, this%maxmvr, 'QPACTUAL_M1', &
244  this%memoryPath)
245  call mem_allocate(this%qpactual_m2, this%maxmvr, 'QPACTUAL_M2', &
246  this%memoryPath)
247  call mem_allocate(this%qavailable_m1, this%maxmvr, 'QAVAILABLE_M1', &
248  this%memoryPath)
249  call mem_allocate(this%qavailable_m2, this%maxmvr, 'QAVAILABLE_M2', &
250  this%memoryPath)
251  call mem_allocate(this%id_mapped_m1, this%maxmvr, 'ID_MAPPED_M1', &
252  this%memoryPath)
253  call mem_allocate(this%id_mapped_m2, this%maxmvr, 'ID_MAPPED_M2', &
254  this%memoryPath)
255 
256  do i = 1, this%maxmvr
257  this%id_mapped_m1(i) = 0
258  this%id_mapped_m2(i) = 0
259  this%qpactual_m1(i) = dnodata
260  this%qpactual_m2(i) = dnodata
261  this%qavailable_m1(i) = dnodata
262  this%qavailable_m2(i) = dnodata
263  end do
264 

◆ xmvr_assign_packagemovers()

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

Definition at line 93 of file GwfExchangeMover.f90.

94  class(GwfExgMoverType), intent(inout) :: this !< this exchange mover
95  ! local
96  integer(I4B) :: i
97  character(len=LENMODELNAME) :: mname
98  character(len=LENPACKAGENAME) :: pname
99  class(VirtualModelType), pointer :: vm
100 
101  do i = 1, size(this%pckMemPaths)
102  if (this%pakmovers(i)%memoryPath == '') then
103  ! is it local?
104  call split_mem_path(this%pckMemPaths(i), mname, pname)
105  vm => get_virtual_model(mname)
106  if (vm%is_local) then
107  ! yes, we need the pointers
108  call set_packagemover_pointer(this%pakmovers(i), &
109  trim(this%pckMemPaths(i)))
110  end if
111  end if
112  end do
Here is the call graph for this function:

◆ xmvr_bd()

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

Definition at line 217 of file GwfExchangeMover.f90.

218  class(GwfExgMoverType) :: this
219  ! local
220  integer(I4B) :: i
221 
222  ! copy from synchronization arrays back into movers:
223  do i = 1, this%nmvr
224  if (this%prov_is_m1(i)) then
225  this%mvr(i)%iRchNrSrcMapped = this%id_mapped_m1(i)
226  else
227  this%mvr(i)%iRchNrSrcMapped = this%id_mapped_m2(i)
228  end if
229  end do
230 
231  call this%fill_budobj()
232 

◆ xmvr_cf()

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

Definition at line 165 of file GwfExchangeMover.f90.

166  class(GwfExgMoverType) :: this
167  ! local
168  integer(I4B) :: i
169 
170  do i = 1, this%nmvr
171  if (this%mvr(i)%is_provider_active) then
172 
173  call this%mvr(i)%update_provider()
174 
175  ! copy calculated rate to arrays for synchronization:
176  if (this%prov_is_m1(i)) then
177  this%qpactual_m1(i) = this%mvr(i)%qpactual
178  this%qavailable_m1(i) = this%mvr(i)%qavailable
179  this%qpactual_m2(i) = dnodata
180  this%qavailable_m2(i) = dnodata
181  else
182  this%qpactual_m1(i) = dnodata
183  this%qavailable_m1(i) = dnodata
184  this%qpactual_m2(i) = this%mvr(i)%qpactual
185  this%qavailable_m2(i) = this%mvr(i)%qavailable
186  end if
187  end if
188  end do
189 

◆ 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  end do
84 
85  if (count_errors() > 0) then
86  call this%parser%StoreErrorUnit()
87  end if
88 
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 267 of file GwfExchangeMover.f90.

268  class(GwfExgMoverType) :: this
269 
270  call this%GwfMvrType%mvr_da()
271 
272  deallocate (this%prov_is_m1)
273  call mem_deallocate(this%qpactual_m1)
274  call mem_deallocate(this%qpactual_m2)
275  call mem_deallocate(this%qavailable_m1)
276  call mem_deallocate(this%qavailable_m2)
277  call mem_deallocate(this%id_mapped_m1)
278  call mem_deallocate(this%id_mapped_m2)
279 

◆ xmvr_fc()

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

Definition at line 194 of file GwfExchangeMover.f90.

195  class(GwfExgMoverType) :: this
196  ! local
197  integer(I4B) :: i
198 
199  do i = 1, this%nmvr
200  if (this%mvr(i)%is_receiver_active) then
201  ! copy from synchronization arrays back into movers:
202  if (this%prov_is_m1(i)) then
203  this%mvr(i)%qpactual = this%qpactual_m1(i)
204  this%mvr(i)%qavailable = this%qavailable_m1(i)
205  else
206  this%mvr(i)%qpactual = this%qpactual_m2(i)
207  this%mvr(i)%qavailable = this%qavailable_m2(i)
208  end if
209  call this%mvr(i)%update_receiver()
210  end if
211  end do
212 

◆ xmvr_initialize_movers()

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

Definition at line 118 of file GwfExchangeMover.f90.

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