MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
virtualexchangemodule Module Reference

Data Types

type  virtualexchangetype
 The Virtual Exchange is based on two Virtual Models and is therefore not always strictly local or remote. We have to consider three different cases: More...

Functions/Subroutines

subroutine vx_create (this, name, exg_id, m1_id, m2_id)
 Create the virtual exchange base.
subroutine init_virtual_data (this)
subroutine vx_prepare_stage (this, stage)
subroutine vx_get_recv_items (this, stg, rank, vi)
subroutine vx_get_send_items (this, stg, rank, vi)
subroutine add_vdi_for_stage (this, vdata_item, stage, virtual_items)
 Convenience routine to add virtual data item to a list.
logical(lgp) function vx_has_mover (this)
 Checks if there is an active mover in the exchange.
subroutine vx_destroy (this)
subroutine allocate_data (this)
subroutine deallocate_data (this)
class(virtualexchangetype) function, pointer, public get_virtual_exchange (exg_id)
 Returns a virtual exchange with the specified id.
class(virtualexchangetype) function, pointer, public get_virtual_exchange_from_list (list, idx)
class(virtualexchangetype) function, pointer, private cast_as_virtual_exchange (obj_ptr)

Function/Subroutine Documentation

◆ add_vdi_for_stage()

subroutine virtualexchangemodule::add_vdi_for_stage ( class(virtualexchangetype) this,
class(virtualdatatype), pointer vdata_item,
integer(i4b) stage,
type(stlvecint) virtual_items )
private

Definition at line 248 of file VirtualExchange.f90.

249 class(VirtualExchangeType) :: this
250 class(VirtualDataType), pointer :: vdata_item
251 integer(I4B) :: stage
252 type(STLVecInt) :: virtual_items
253 ! local
254 class(*), pointer :: vdi
255 integer(I4B) :: idx
256
257 vdi => vdata_item
258 idx = this%virtual_data_list%GetIndex(vdi)
259 if (vdata_item%check_stage(stage)) then
260 call virtual_items%push_back(idx)
261 end if
262

◆ allocate_data()

subroutine virtualexchangemodule::allocate_data ( class(virtualexchangetype) this)
private

Definition at line 283 of file VirtualExchange.f90.

284 class(VirtualExchangeType) :: this
285
286 allocate (this%nexg)
287 allocate (this%naux)
288 allocate (this%ianglex)
289 allocate (this%nodem1)
290 allocate (this%nodem2)
291 allocate (this%ihc)
292 allocate (this%cl1)
293 allocate (this%cl2)
294 allocate (this%hwva)
295 allocate (this%auxvar)
296

◆ cast_as_virtual_exchange()

class(virtualexchangetype) function, pointer, private virtualexchangemodule::cast_as_virtual_exchange ( class(*), pointer obj_ptr)
private

Definition at line 351 of file VirtualExchange.f90.

352 class(*), pointer :: obj_ptr
353 class(VirtualExchangeType), pointer :: virtual_exg
354
355 virtual_exg => null()
356 select type (obj_ptr)
357 class is (virtualexchangetype)
358 virtual_exg => obj_ptr
359 end select
360
Here is the caller graph for this function:

◆ deallocate_data()

subroutine virtualexchangemodule::deallocate_data ( class(virtualexchangetype) this)
private

Definition at line 299 of file VirtualExchange.f90.

300 class(VirtualExchangeType) :: this
301
302 deallocate (this%nexg)
303 deallocate (this%naux)
304 deallocate (this%ianglex)
305 deallocate (this%nodem1)
306 deallocate (this%nodem2)
307 deallocate (this%ihc)
308 deallocate (this%cl1)
309 deallocate (this%cl2)
310 deallocate (this%hwva)
311 deallocate (this%auxvar)
312

◆ get_virtual_exchange()

class(virtualexchangetype) function, pointer, public virtualexchangemodule::get_virtual_exchange ( integer(i4b) exg_id)

Definition at line 317 of file VirtualExchange.f90.

319 integer(I4B) :: exg_id
320 class(VirtualExchangeType), pointer :: virtual_exg
321 ! local
322 integer(I4B) :: i
323 class(*), pointer :: ve
324
325 virtual_exg => null()
326 do i = 1, virtual_exchange_list%Count()
327 ve => virtual_exchange_list%GetItem(i)
328 select type (ve)
329 class is (virtualexchangetype)
330 if (ve%id == exg_id) then
331 virtual_exg => ve
332 return
333 end if
334 end select
335 end do
336
type(listtype), public virtual_exchange_list
Here is the caller graph for this function:

◆ get_virtual_exchange_from_list()

class(virtualexchangetype) function, pointer, public virtualexchangemodule::get_virtual_exchange_from_list ( type(listtype) list,
integer(i4b) idx )

Definition at line 339 of file VirtualExchange.f90.

340 type(ListType) :: list
341 integer(I4B) :: idx
342 class(VirtualExchangeType), pointer :: virtual_exg
343 ! local
344 class(*), pointer :: obj_ptr
345
346 obj_ptr => list%GetItem(idx)
347 virtual_exg => cast_as_virtual_exchange(obj_ptr)
348
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_virtual_data()

subroutine virtualexchangemodule::init_virtual_data ( class(virtualexchangetype) this)
private

Definition at line 125 of file VirtualExchange.f90.

126 class(VirtualExchangeType) :: this
127 ! local
128
129 call this%set(this%nexg%base(), 'NEXG', '', map_all_type)
130 call this%set(this%naux%base(), 'NAUX', '', map_all_type)
131 call this%set(this%ianglex%base(), 'IANGLEX', '', map_all_type)
132
133 ! exchanges can be hybrid with both local and remote
134 ! fields, nodem1/2 array only local when corresponding
135 ! model sits on the same process, so we pass the
136 ! optional "is_local" argument to the following:
137 call this%set(this%nodem1%base(), 'NODEM1', '', &
138 map_all_type, this%v_model1%is_local)
139 call this%set(this%nodem2%base(), 'NODEM2', '', &
140 map_all_type, this%v_model2%is_local)
141
142 call this%set(this%ihc%base(), 'IHC', '', map_all_type)
143 call this%set(this%cl1%base(), 'CL1', '', map_all_type)
144 call this%set(this%cl2%base(), 'CL2', '', map_all_type)
145 call this%set(this%hwva%base(), 'HWVA', '', map_all_type)
146 call this%set(this%auxvar%base(), 'AUXVAR', '', map_all_type)
147

◆ vx_create()

subroutine virtualexchangemodule::vx_create ( class(virtualexchangetype) this,
character(len=*) name,
integer(i4b) exg_id,
integer(i4b) m1_id,
integer(i4b) m2_id )

Definition at line 102 of file VirtualExchange.f90.

103 class(VirtualExchangeType) :: this
104 character(len=*) :: name
105 integer(I4B) :: exg_id
106 integer(I4B) :: m1_id
107 integer(I4B) :: m2_id
108 ! local
109 logical(LGP) :: is_local
110
111 this%v_model1 => get_virtual_model(m1_id)
112 this%v_model2 => get_virtual_model(m2_id)
113
114 ! 1) both models local: is_local = true
115 ! 2) only one of them: is_local = true
116 ! 3) both models remote: is_local = false
117 is_local = this%v_model1%is_local .or. this%v_model2%is_local
118 call this%VirtualDataContainerType%vdc_create(name, exg_id, is_local)
119
120 call this%allocate_data()
121 call this%init_virtual_data()
122

◆ vx_destroy()

subroutine virtualexchangemodule::vx_destroy ( class(virtualexchangetype) this)
private

Definition at line 275 of file VirtualExchange.f90.

276 class(VirtualExchangeType) :: this
277
278 call this%VirtualDataContainerType%destroy()
279 call this%deallocate_data()
280

◆ vx_get_recv_items()

subroutine virtualexchangemodule::vx_get_recv_items ( class(virtualexchangetype) this,
integer(i4b) stg,
integer(i4b) rank,
type(stlvecint) vi )
private

Definition at line 180 of file VirtualExchange.f90.

181 class(VirtualExchangeType) :: this
182 integer(I4B) :: stg
183 integer(I4B) :: rank
184 type(STLVecInt) :: vi
185
186 if (this%is_local .and. rank == this%orig_rank) then
187 ! treat the primary exchange case independently, we
188 ! have all data available except for nodem1 or nodem2
189 if (stg < stg_bfr_con_df) then
190 if (this%nodem1%is_remote) then
191 call this%add_vdi_for_stage(this%nodem1%base(), stg, vi)
192 end if
193 if (this%nodem2%is_remote) then
194 call this%add_vdi_for_stage(this%nodem2%base(), stg, vi)
195 end if
196 end if
197 else
198 ! send/receive all
199 call this%add_vdi_for_stage(this%nexg%base(), stg, vi)
200 call this%add_vdi_for_stage(this%naux%base(), stg, vi)
201 call this%add_vdi_for_stage(this%ianglex%base(), stg, vi)
202 call this%add_vdi_for_stage(this%nodem1%base(), stg, vi)
203 call this%add_vdi_for_stage(this%nodem2%base(), stg, vi)
204 call this%add_vdi_for_stage(this%ihc%base(), stg, vi)
205 call this%add_vdi_for_stage(this%cl1%base(), stg, vi)
206 call this%add_vdi_for_stage(this%cl2%base(), stg, vi)
207 call this%add_vdi_for_stage(this%hwva%base(), stg, vi)
208 call this%add_vdi_for_stage(this%auxvar%base(), stg, vi)
209 end if
210

◆ vx_get_send_items()

subroutine virtualexchangemodule::vx_get_send_items ( class(virtualexchangetype) this,
integer(i4b) stg,
integer(i4b) rank,
type(stlvecint) vi )
private

Definition at line 213 of file VirtualExchange.f90.

214 class(VirtualExchangeType) :: this
215 integer(I4B) :: stg
216 integer(I4B) :: rank
217 type(STLVecInt) :: vi
218
219 if (this%is_local .and. rank == this%orig_rank) then
220 ! this is a primary exchange, all we need to send are
221 ! the node numbers nodem1 or nodem2
222 if (stg < stg_bfr_con_df) then
223 if (.not. this%nodem1%is_remote) then
224 call this%add_vdi_for_stage(this%nodem1%base(), stg, vi)
225 end if
226 if (.not. this%nodem2%is_remote) then
227 call this%add_vdi_for_stage(this%nodem2%base(), stg, vi)
228 end if
229 end if
230 else
231 ! send/receive all
232 call this%add_vdi_for_stage(this%nexg%base(), stg, vi)
233 call this%add_vdi_for_stage(this%naux%base(), stg, vi)
234 call this%add_vdi_for_stage(this%ianglex%base(), stg, vi)
235 call this%add_vdi_for_stage(this%nodem1%base(), stg, vi)
236 call this%add_vdi_for_stage(this%nodem2%base(), stg, vi)
237 call this%add_vdi_for_stage(this%ihc%base(), stg, vi)
238 call this%add_vdi_for_stage(this%cl1%base(), stg, vi)
239 call this%add_vdi_for_stage(this%cl2%base(), stg, vi)
240 call this%add_vdi_for_stage(this%hwva%base(), stg, vi)
241 call this%add_vdi_for_stage(this%auxvar%base(), stg, vi)
242 end if
243

◆ vx_has_mover()

logical(lgp) function virtualexchangemodule::vx_has_mover ( class(virtualexchangetype) this)
private

Definition at line 267 of file VirtualExchange.f90.

268 class(VirtualExchangeType) :: this
269 logical(LGP) :: has_mover
270
271 has_mover = .false.
272

◆ vx_prepare_stage()

subroutine virtualexchangemodule::vx_prepare_stage ( class(virtualexchangetype) this,
integer(i4b) stage )
private

Definition at line 150 of file VirtualExchange.f90.

151 class(VirtualExchangeType) :: this
152 integer(I4B) :: stage
153 ! local
154 integer(I4B) :: nexg, naux
155
156 if (stage == stg_aft_exg_df) then
157
158 call this%map(this%nexg%base(), (/stg_aft_exg_df/))
159 call this%map(this%naux%base(), (/stg_aft_exg_df/))
160 call this%map(this%ianglex%base(), (/stg_aft_exg_df/))
161
162 else if (stage == stg_aft_con_cr) then
163
164 nexg = this%nexg%get()
165 naux = this%naux%get()
166 call this%map(this%nodem1%base(), nexg, (/stg_aft_con_cr, &
167 stg_bfr_con_df/))
168 call this%map(this%nodem2%base(), nexg, (/stg_aft_con_cr, &
169 stg_bfr_con_df/))
170 call this%map(this%ihc%base(), nexg, (/stg_aft_con_cr/))
171 call this%map(this%cl1%base(), nexg, (/stg_aft_con_cr/))
172 call this%map(this%cl2%base(), nexg, (/stg_aft_con_cr/))
173 call this%map(this%hwva%base(), nexg, (/stg_aft_con_cr/))
174 call this%map(this%auxvar%base(), naux, nexg, (/stg_aft_con_cr/))
175
176 end if
177