MODFLOW 6  version 6.7.0.dev3
USGS Modular Hydrologic Model
virtualmodelmodule Module Reference

Data Types

interface  get_virtual_model
 
type  virtualmodeltype
 

Functions/Subroutines

subroutine vm_create (this, name, id, model)
 
subroutine init_virtual_data (this)
 
subroutine vm_prepare_stage (this, stage)
 
integer(i4b) function dis_get_nodeuser (this, node_reduced)
 Get user node number from reduced number. More...
 
subroutine dis_noder_to_string (this, node_reduced, node_str)
 
subroutine vm_destroy (this)
 
subroutine allocate_data (this)
 
subroutine deallocate_data (this)
 
class(virtualmodeltype) function, pointer, public get_virtual_model_from_list (model_list, idx)
 
class(virtualmodeltype) function, pointer, public cast_as_virtual_model (obj_ptr)
 
logical(lgp) function eq_virtual_model (this, v_model)
 
logical(lgp) function eq_numerical_model (this, num_model)
 
class(virtualmodeltype) function, pointer get_virtual_model_by_id (model_id)
 Returns a virtual model with the specified id. More...
 
class(virtualmodeltype) function, pointer get_virtual_model_by_name (model_name)
 Returns a virtual model with the specified name. More...
 

Function/Subroutine Documentation

◆ allocate_data()

subroutine virtualmodelmodule::allocate_data ( class(virtualmodeltype this)
private

Definition at line 242 of file VirtualModel.f90.

243  class(VirtualModelType) :: this
244 
245  allocate (this%con_ianglex)
246  allocate (this%con_ia)
247  allocate (this%con_ja)
248  allocate (this%con_jas)
249  allocate (this%con_ihc)
250  allocate (this%con_hwva)
251  allocate (this%con_cl1)
252  allocate (this%con_cl2)
253  allocate (this%con_anglex)
254  allocate (this%dis_ndim)
255  allocate (this%dis_nodes)
256  allocate (this%dis_nodesuser)
257  allocate (this%dis_nodeuser)
258  allocate (this%dis_nja)
259  allocate (this%dis_njas)
260  allocate (this%dis_xorigin)
261  allocate (this%dis_yorigin)
262  allocate (this%dis_angrot)
263  allocate (this%dis_icondir)
264  allocate (this%dis_xc)
265  allocate (this%dis_yc)
266  allocate (this%dis_top)
267  allocate (this%dis_bot)
268  allocate (this%dis_area)
269  allocate (this%moffset)
270  allocate (this%x)
271  allocate (this%x_old)
272  allocate (this%ibound)
273  allocate (this%idsoln)
274 

◆ cast_as_virtual_model()

class(virtualmodeltype) function, pointer, public virtualmodelmodule::cast_as_virtual_model ( class(*), pointer  obj_ptr)

Definition at line 327 of file VirtualModel.f90.

328  class(*), pointer :: obj_ptr
329  class(VirtualModelType), pointer :: v_model
330 
331  v_model => null()
332  select type (obj_ptr)
333  class is (virtualmodeltype)
334  v_model => obj_ptr
335  end select
336 
Here is the caller graph for this function:

◆ deallocate_data()

subroutine virtualmodelmodule::deallocate_data ( class(virtualmodeltype this)
private

Definition at line 277 of file VirtualModel.f90.

278  class(VirtualModelType) :: this
279 
280  ! CON
281  deallocate (this%con_ianglex)
282  deallocate (this%con_ia)
283  deallocate (this%con_ja)
284  deallocate (this%con_jas)
285  deallocate (this%con_ihc)
286  deallocate (this%con_hwva)
287  deallocate (this%con_cl1)
288  deallocate (this%con_cl2)
289  deallocate (this%con_anglex)
290  ! DIS
291  deallocate (this%dis_ndim)
292  deallocate (this%dis_nodes)
293  deallocate (this%dis_nodesuser)
294  deallocate (this%dis_nodeuser)
295  deallocate (this%dis_nja)
296  deallocate (this%dis_njas)
297  deallocate (this%dis_xorigin)
298  deallocate (this%dis_yorigin)
299  deallocate (this%dis_angrot)
300  deallocate (this%dis_icondir)
301  deallocate (this%dis_xc)
302  deallocate (this%dis_yc)
303  deallocate (this%dis_top)
304  deallocate (this%dis_bot)
305  deallocate (this%dis_area)
306  ! Numerical model
307  deallocate (this%moffset)
308  deallocate (this%x)
309  deallocate (this%x_old)
310  deallocate (this%ibound)
311  ! Base model
312  deallocate (this%idsoln)
313 

◆ dis_get_nodeuser()

integer(i4b) function virtualmodelmodule::dis_get_nodeuser ( class(virtualmodeltype this,
integer(i4b), intent(in)  node_reduced 
)
private
Parameters
thisthis virtual model
[in]node_reducedthe reduced node number
Returns
the returned user node number

Definition at line 204 of file VirtualModel.f90.

205  class(VirtualModelType) :: this !< this virtual model
206  integer(I4B), intent(in) :: node_reduced !< the reduced node number
207  integer(I4B) :: node_user !< the returned user node number
208 
209  if (this%dis_nodes%get() < this%dis_nodesuser%get()) then
210  node_user = this%dis_nodeuser%get(node_reduced)
211  else
212  node_user = node_reduced
213  end if
214 

◆ dis_noder_to_string()

subroutine virtualmodelmodule::dis_noder_to_string ( class(virtualmodeltype this,
integer(i4b), intent(in)  node_reduced,
character(len=*), intent(inout)  node_str 
)
private
Parameters
thisthis virtual model
[in]node_reducedreduced node number
[in,out]node_strthe string representative of the user node number

Definition at line 217 of file VirtualModel.f90.

218  class(VirtualModelType) :: this !< this virtual model
219  integer(I4B), intent(in) :: node_reduced !< reduced node number
220  character(len=*), intent(inout) :: node_str !< the string representative of the user node number
221  ! local
222  character(len=11) :: nr_str
223 
224  if (this%is_local) then
225  call this%local_model%dis%noder_to_string(node_reduced, node_str)
226  else
227  ! for now this will look like: (102r)
228  write (nr_str, '(i0)') node_reduced
229  node_str = '('//trim(adjustl(nr_str))//'r)'
230  end if
231 

◆ eq_numerical_model()

logical(lgp) function virtualmodelmodule::eq_numerical_model ( class(virtualmodeltype), intent(in)  this,
class(numericalmodeltype), intent(in)  num_model 
)
private

Definition at line 348 of file VirtualModel.f90.

349  class(VirtualModelType), intent(in) :: this
350  class(NumericalModelType), intent(in) :: num_model
351  logical(LGP) :: is_equal
352 
353  is_equal = (this%id == num_model%id)
354 
Here is the caller graph for this function:

◆ eq_virtual_model()

logical(lgp) function virtualmodelmodule::eq_virtual_model ( class(virtualmodeltype), intent(in)  this,
class(virtualmodeltype), intent(in)  v_model 
)
private

Definition at line 339 of file VirtualModel.f90.

340  class(VirtualModelType), intent(in) :: this
341  class(VirtualModelType), intent(in) :: v_model
342  logical(LGP) :: is_equal
343 
344  is_equal = (this%id == v_model%id)
345 
Here is the caller graph for this function:

◆ get_virtual_model_by_id()

class(virtualmodeltype) function, pointer virtualmodelmodule::get_virtual_model_by_id ( integer(i4b)  model_id)
private

Definition at line 359 of file VirtualModel.f90.

361  integer(I4B) :: model_id
362  class(VirtualModelType), pointer :: virtual_model
363  ! local
364  integer(I4B) :: i
365  class(*), pointer :: vm
366 
367  virtual_model => null()
368  do i = 1, virtual_model_list%Count()
369  vm => virtual_model_list%GetItem(i)
370  select type (vm)
371  class is (virtualmodeltype)
372  if (vm%id == model_id) then
373  virtual_model => vm
374  return
375  end if
376  end select
377  end do
378 
type(listtype), public virtual_model_list

◆ get_virtual_model_by_name()

class(virtualmodeltype) function, pointer virtualmodelmodule::get_virtual_model_by_name ( character(len=*)  model_name)

Definition at line 383 of file VirtualModel.f90.

385  character(len=*) :: model_name
386  class(VirtualModelType), pointer :: virtual_model
387  ! local
388  integer(I4B) :: i
389  class(*), pointer :: vm
390 
391  virtual_model => null()
392  do i = 1, virtual_model_list%Count()
393  vm => virtual_model_list%GetItem(i)
394  select type (vm)
395  class is (virtualmodeltype)
396  if (vm%name == model_name) then
397  virtual_model => vm
398  return
399  end if
400  end select
401  end do
402 

◆ get_virtual_model_from_list()

class(virtualmodeltype) function, pointer, public virtualmodelmodule::get_virtual_model_from_list ( type(listtype model_list,
integer(i4b)  idx 
)

Definition at line 316 of file VirtualModel.f90.

317  type(ListType) :: model_list
318  integer(I4B) :: idx
319  class(VirtualModelType), pointer :: v_model
320  ! local
321  class(*), pointer :: obj_ptr
322 
323  obj_ptr => model_list%GetItem(idx)
324  v_model => cast_as_virtual_model(obj_ptr)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_virtual_data()

subroutine virtualmodelmodule::init_virtual_data ( class(virtualmodeltype this)
private

Definition at line 94 of file VirtualModel.f90.

95  class(VirtualModelType) :: this
96 
97  ! CON
98  call this%set(this%con_ianglex%base(), 'IANGLEX', 'CON', map_all_type)
99  call this%set(this%con_ia%base(), 'IA', 'CON', map_all_type)
100  call this%set(this%con_ja%base(), 'JA', 'CON', map_all_type)
101  call this%set(this%con_jas%base(), 'JAS', 'CON', map_all_type)
102  call this%set(this%con_ihc%base(), 'IHC', 'CON', map_all_type)
103  call this%set(this%con_hwva%base(), 'HWVA', 'CON', map_all_type)
104  call this%set(this%con_cl1%base(), 'CL1', 'CON', map_all_type)
105  call this%set(this%con_cl2%base(), 'CL2', 'CON', map_all_type)
106  call this%set(this%con_anglex%base(), 'ANGLEX', 'CON', map_all_type)
107  ! DIS
108  call this%set(this%dis_ndim%base(), 'NDIM', 'DIS', map_all_type)
109  call this%set(this%dis_nodes%base(), 'NODES', 'DIS', map_all_type)
110  call this%set(this%dis_nodesuser%base(), 'NODESUSER', 'DIS', map_all_type)
111  call this%set(this%dis_nodeuser%base(), 'NODEUSER', 'DIS', map_all_type)
112  call this%set(this%dis_nja%base(), 'NJA', 'DIS', map_all_type)
113  call this%set(this%dis_njas%base(), 'NJAS', 'DIS', map_all_type)
114  call this%set(this%dis_icondir%base(), 'ICONDIR', 'DIS', map_all_type)
115  call this%set(this%dis_xorigin%base(), 'XORIGIN', 'DIS', map_all_type)
116  call this%set(this%dis_yorigin%base(), 'YORIGIN', 'DIS', map_all_type)
117  call this%set(this%dis_angrot%base(), 'ANGROT', 'DIS', map_all_type)
118  call this%set(this%dis_xc%base(), 'XC', 'DIS', map_all_type)
119  call this%set(this%dis_yc%base(), 'YC', 'DIS', map_all_type)
120  call this%set(this%dis_top%base(), 'TOP', 'DIS', map_all_type)
121  call this%set(this%dis_bot%base(), 'BOT', 'DIS', map_all_type)
122  call this%set(this%dis_area%base(), 'AREA', 'DIS', map_all_type)
123  ! Numerical model
124  call this%set(this%moffset%base(), 'MOFFSET', '', map_all_type)
125  call this%set(this%x%base(), 'X', '', map_node_type)
126  call this%set(this%x_old%base(), 'XOLD', '', map_node_type)
127  call this%set(this%ibound%base(), 'IBOUND', '', map_node_type)
128  ! Base model
129  call this%set(this%idsoln%base(), 'IDSOLN', '', map_all_type)
130 

◆ vm_create()

subroutine virtualmodelmodule::vm_create ( class(virtualmodeltype this,
character(len=*)  name,
integer(i4b)  id,
class(numericalmodeltype), pointer  model 
)

Definition at line 76 of file VirtualModel.f90.

77  class(VirtualModelType) :: this
78  character(len=*) :: name
79  integer(I4B) :: id
80  class(NumericalModelType), pointer :: model
81  ! local
82  logical(LGP) :: is_local
83 
84  is_local = associated(model)
85  call this%VirtualDataContainerType%vdc_create(name, id, is_local)
86 
87  this%local_model => model
88 
89  call this%allocate_data()
90  call this%init_virtual_data()
91 

◆ vm_destroy()

subroutine virtualmodelmodule::vm_destroy ( class(virtualmodeltype this)
private

Definition at line 234 of file VirtualModel.f90.

235  class(VirtualModelType) :: this
236 
237  call this%VirtualDataContainerType%destroy()
238  call this%deallocate_data()
239 

◆ vm_prepare_stage()

subroutine virtualmodelmodule::vm_prepare_stage ( class(virtualmodeltype this,
integer(i4b)  stage 
)
private

Definition at line 133 of file VirtualModel.f90.

134  class(VirtualModelType) :: this
135  integer(I4B) :: stage
136  ! local
137  integer(I4B) :: nodes, nodesuser, nja, njas, icondir
138  logical(LGP) :: is_reduced
139 
140  if (stage == stg_aft_mdl_df) then
141 
142  call this%map(this%idsoln%base(), (/stg_aft_mdl_df/))
143  call this%map(this%con_ianglex%base(), (/stg_aft_mdl_df/))
144  call this%map(this%dis_icondir%base(), (/stg_aft_mdl_df/))
145  call this%map(this%dis_ndim%base(), (/stg_aft_mdl_df/))
146  call this%map(this%dis_nodes%base(), (/stg_aft_mdl_df/))
147  call this%map(this%dis_nodesuser%base(), (/stg_aft_mdl_df/))
148  call this%map(this%dis_nja%base(), (/stg_aft_mdl_df/))
149  call this%map(this%dis_njas%base(), (/stg_aft_mdl_df/))
150 
151  else if (stage == stg_bfr_exg_ac) then
152 
153  nodes = this%dis_nodes%get()
154  nodesuser = this%dis_nodesuser%get()
155  is_reduced = (nodes /= nodesuser)
156  call this%map(this%moffset%base(), (/stg_bfr_exg_ac/))
157  if (is_reduced) then
158  call this%map(this%dis_nodeuser%base(), nodes, (/stg_bfr_exg_ac/))
159  else
160  ! no reduction, zero sized array, never synchronize
161  call this%map(this%dis_nodeuser%base(), 0, (/stg_never/))
162  end if
163 
164  else if (stage == stg_bfr_con_df) then
165 
166  nodes = this%dis_nodes%get()
167  nja = this%dis_nja%get()
168  njas = this%dis_njas%get()
169  icondir = this%dis_icondir%get()
170  ! DIS
171  call this%map(this%dis_xorigin%base(), (/stg_bfr_con_df/))
172  call this%map(this%dis_yorigin%base(), (/stg_bfr_con_df/))
173  call this%map(this%dis_angrot%base(), (/stg_bfr_con_df/))
174  if (icondir > 0) then
175  call this%map(this%dis_xc%base(), nodes, (/stg_bfr_con_df/))
176  call this%map(this%dis_yc%base(), nodes, (/stg_bfr_con_df/))
177  else
178  call this%map(this%dis_xc%base(), 0, (/stg_never/))
179  call this%map(this%dis_yc%base(), 0, (/stg_never/))
180  end if
181  call this%map(this%dis_top%base(), nodes, (/stg_bfr_con_df/))
182  call this%map(this%dis_bot%base(), nodes, (/stg_bfr_con_df/))
183  call this%map(this%dis_area%base(), nodes, (/stg_bfr_con_df/))
184  ! CON
185  call this%map(this%con_ia%base(), nodes + 1, (/stg_bfr_con_df/))
186  call this%map(this%con_ja%base(), nja, (/stg_bfr_con_df/))
187  call this%map(this%con_jas%base(), nja, (/stg_bfr_con_df/))
188  call this%map(this%con_ihc%base(), njas, (/stg_bfr_con_df/))
189  call this%map(this%con_hwva%base(), njas, (/stg_bfr_con_df/))
190  call this%map(this%con_cl1%base(), njas, (/stg_bfr_con_df/))
191  call this%map(this%con_cl2%base(), njas, (/stg_bfr_con_df/))
192  if (this%con_ianglex%get() > 0) then
193  call this%map(this%con_anglex%base(), njas, (/stg_bfr_con_df/))
194  else
195  call this%map(this%con_anglex%base(), 0, (/stg_never/))
196  end if
197 
198  end if
199