MODFLOW 6  version 6.7.0.dev2
USGS Modular Hydrologic Model
numericalmodelmodule Module Reference

Data Types

type  numericalmodeltype
 

Functions/Subroutines

subroutine model_df (this)
 
subroutine model_ac (this, sparse)
 
subroutine model_mc (this, matrix_sln)
 
subroutine model_ar (this)
 
subroutine model_rp (this)
 
subroutine model_ad (this)
 
subroutine model_reset (this)
 
subroutine model_solve (this)
 
subroutine model_cf (this, kiter)
 
subroutine model_fc (this, kiter, matrix_sln, inwtflag)
 
subroutine model_ptcchk (this, iptc)
 
subroutine model_ptc (this, vec_residual, iptc, ptcf)
 
subroutine model_nr (this, kiter, matrix, inwtflag)
 
subroutine model_cc (this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
 
subroutine model_nur (this, neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
 
subroutine model_cq (this, icnvg, isuppress_output)
 
subroutine model_bd (this, icnvg, isuppress_output)
 
subroutine model_bdcalc (this, icnvg)
 
subroutine model_bdsave (this, icnvg)
 
subroutine model_ot (this)
 
subroutine model_bdentry (this, budterm, budtxt, rowlabel)
 
subroutine model_fp (this)
 
subroutine model_da (this)
 
subroutine set_moffset (this, moffset)
 
subroutine get_mrange (this, mstart, mend)
 
subroutine set_idsoln (this, id)
 
subroutine allocate_scalars (this, modelname)
 
subroutine allocate_arrays (this)
 
subroutine set_xptr (this, xsln, sln_offset, varNameTgt, memPathTgt)
 
subroutine set_rhsptr (this, rhssln, sln_offset, varNameTgt, memPathTgt)
 
subroutine set_iboundptr (this, iboundsln, sln_offset, varNameTgt, memPathTgt)
 
subroutine get_mcellid (this, node, mcellid)
 
subroutine get_mnodeu (this, node, nodeu)
 
integer(i4b) function get_iasym (this)
 
integer(i4b) function get_idv_scale (this)
 
class(numericalmodeltype) function, pointer castasnumericalmodelclass (obj)
 
subroutine, public addnumericalmodeltolist (list, model)
 
class(numericalmodeltype) function, pointer, public getnumericalmodelfromlist (list, idx)
 
subroutine create_lstfile (this, lst_fname, model_fname, defined, headertxt)
 

Function/Subroutine Documentation

◆ addnumericalmodeltolist()

subroutine, public numericalmodelmodule::addnumericalmodeltolist ( type(listtype), intent(inout)  list,
class(numericalmodeltype), intent(inout), pointer  model 
)

Definition at line 436 of file NumericalModel.f90.

437  implicit none
438  ! -- dummy
439  type(ListType), intent(inout) :: list
440  class(NumericalModelType), pointer, intent(inout) :: model
441  ! -- local
442  class(*), pointer :: obj
443  !
444  obj => model
445  call list%Add(obj)
Here is the caller graph for this function:

◆ allocate_arrays()

subroutine numericalmodelmodule::allocate_arrays ( class(numericalmodeltype this)

Definition at line 297 of file NumericalModel.f90.

298  use constantsmodule, only: dzero
300  class(NumericalModelType) :: this
301  integer(I4B) :: i
302  !
303  call mem_allocate(this%xold, this%neq, 'XOLD', this%memoryPath)
304  call mem_allocate(this%flowja, this%nja, 'FLOWJA', this%memoryPath)
305  call mem_allocate(this%idxglo, this%nja, 'IDXGLO', this%memoryPath)
306  !
307  ! -- initialize
308  do i = 1, size(this%flowja)
309  this%flowja(i) = dzero
310  end do
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:65

◆ allocate_scalars()

subroutine numericalmodelmodule::allocate_scalars ( class(numericalmodeltype this,
character(len=*), intent(in)  modelname 
)
private

Definition at line 274 of file NumericalModel.f90.

276  class(NumericalModelType) :: this
277  character(len=*), intent(in) :: modelname
278  !
279  ! -- allocate basetype members
280  call this%BaseModelType%allocate_scalars(modelname)
281  !
282  ! -- allocate members from this type
283  call mem_allocate(this%neq, 'NEQ', this%memoryPath)
284  call mem_allocate(this%nja, 'NJA', this%memoryPath)
285  call mem_allocate(this%icnvg, 'ICNVG', this%memoryPath)
286  call mem_allocate(this%moffset, 'MOFFSET', this%memoryPath)
287  allocate (this%filename)
288  allocate (this%bndlist)
289  !
290  this%filename = ''
291  this%neq = 0
292  this%nja = 0
293  this%icnvg = 0
294  this%moffset = 0

◆ castasnumericalmodelclass()

class(numericalmodeltype) function, pointer numericalmodelmodule::castasnumericalmodelclass ( class(*), intent(inout), pointer  obj)
private

Definition at line 422 of file NumericalModel.f90.

423  implicit none
424  class(*), pointer, intent(inout) :: obj
425  class(NumericalModelType), pointer :: res
426  !
427  res => null()
428  if (.not. associated(obj)) return
429  !
430  select type (obj)
431  class is (numericalmodeltype)
432  res => obj
433  end select
Here is the caller graph for this function:

◆ create_lstfile()

subroutine numericalmodelmodule::create_lstfile ( class(numericalmodeltype this,
character(len=*), intent(inout)  lst_fname,
character(len=*), intent(in)  model_fname,
logical(lgp), intent(in)  defined,
character(len=*), intent(in)  headertxt 
)
private

Definition at line 461 of file NumericalModel.f90.

462  ! -- modules
463  use kindmodule, only: lgp
465  ! -- dummy
466  class(NumericalModelType) :: this
467  character(len=*), intent(inout) :: lst_fname
468  character(len=*), intent(in) :: model_fname
469  logical(LGP), intent(in) :: defined
470  character(len=*), intent(in) :: headertxt
471  ! -- local
472  integer(I4B) :: i, istart, istop
473  !
474  ! -- set list file name if not provided
475  if (.not. defined) then
476  !
477  ! -- initialize
478  lst_fname = ' '
479  istart = 0
480  istop = len_trim(model_fname)
481  !
482  ! -- identify '.' character position from back of string
483  do i = istop, 1, -1
484  if (model_fname(i:i) == '.') then
485  istart = i
486  exit
487  end if
488  end do
489  !
490  ! -- if not found start from string end
491  if (istart == 0) istart = istop + 1
492  !
493  ! -- set list file name
494  lst_fname = model_fname(1:istart)
495  istop = istart + 3
496  lst_fname(istart:istop) = '.lst'
497  end if
498  !
499  ! -- create the list file
500  this%iout = getunit()
501  call openfile(this%iout, 0, lst_fname, 'LIST', filstat_opt='REPLACE')
502  !
503  ! -- write list file header
504  call write_listfile_header(this%iout, headertxt)
integer(i4b) function, public getunit()
Get a free unit number.
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
Definition: InputOutput.f90:30
This module defines variable data types.
Definition: kind.f90:8
Here is the call graph for this function:

◆ get_iasym()

integer(i4b) function numericalmodelmodule::get_iasym ( class(numericalmodeltype this)

Definition at line 410 of file NumericalModel.f90.

411  class(NumericalModelType) :: this
412  integer(I4B) :: iasym
413  iasym = 0

◆ get_idv_scale()

integer(i4b) function numericalmodelmodule::get_idv_scale ( class(numericalmodeltype this)
private

Definition at line 416 of file NumericalModel.f90.

417  class(NumericalModelType) :: this
418  integer(I4B) :: idv_scale
419  idv_scale = 0

◆ get_mcellid()

subroutine numericalmodelmodule::get_mcellid ( class(numericalmodeltype this,
integer(i4b), intent(in)  node,
character(len=*), intent(inout)  mcellid 
)

Definition at line 362 of file NumericalModel.f90.

363  use bndmodule, only: bndtype, getbndfromlist
364  class(NumericalModelType) :: this
365  integer(I4B), intent(in) :: node
366  character(len=*), intent(inout) :: mcellid
367  ! -- local
368  character(len=20) :: cellid
369  integer(I4B) :: ip, ipaknode, istart, istop
370  class(BndType), pointer :: packobj
371 
372  if (node < 1) then
373  cellid = ''
374  else if (node <= this%dis%nodes) then
375  call this%dis%noder_to_string(node, cellid)
376  else
377  cellid = '***ERROR***'
378  ipaknode = node - this%dis%nodes
379  istart = 1
380  do ip = 1, this%bndlist%Count()
381  packobj => getbndfromlist(this%bndlist, ip)
382  if (packobj%npakeq == 0) cycle
383  istop = istart + packobj%npakeq - 1
384  if (istart <= ipaknode .and. ipaknode <= istop) then
385  write (cellid, '(a, a, a, i0, a, i0, a)') '(', &
386  trim(packobj%filtyp), '_', &
387  packobj%ibcnum, '-', ipaknode - packobj%ioffset, ')'
388  exit
389  end if
390  istart = istop + 1
391  end do
392  end if
393  write (mcellid, '(i0, a, a, a, a)') this%id, '_', this%macronym, '-', &
394  trim(adjustl(cellid))
This module contains the base boundary package.
class(bndtype) function, pointer, public getbndfromlist(list, idx)
Get boundary from package list.
@ brief BndType
Here is the call graph for this function:

◆ get_mnodeu()

subroutine numericalmodelmodule::get_mnodeu ( class(numericalmodeltype this,
integer(i4b), intent(in)  node,
integer(i4b), intent(inout)  nodeu 
)

Definition at line 397 of file NumericalModel.f90.

398  use bndmodule, only: bndtype, getbndfromlist
399  class(NumericalModelType) :: this
400  integer(I4B), intent(in) :: node
401  integer(I4B), intent(inout) :: nodeu
402  ! -- local
403  if (node <= this%dis%nodes) then
404  nodeu = this%dis%get_nodeuser(node)
405  else
406  nodeu = -(node - this%dis%nodes)
407  end if
Here is the call graph for this function:

◆ get_mrange()

subroutine numericalmodelmodule::get_mrange ( class(numericalmodeltype this,
integer(i4b), intent(inout)  mstart,
integer(i4b), intent(inout)  mend 
)
private

Definition at line 260 of file NumericalModel.f90.

261  class(NumericalModelType) :: this
262  integer(I4B), intent(inout) :: mstart
263  integer(I4B), intent(inout) :: mend
264  mstart = this%moffset + 1
265  mend = mstart + this%neq - 1

◆ getnumericalmodelfromlist()

class(numericalmodeltype) function, pointer, public numericalmodelmodule::getnumericalmodelfromlist ( type(listtype), intent(inout)  list,
integer(i4b), intent(in)  idx 
)

Definition at line 448 of file NumericalModel.f90.

449  implicit none
450  ! -- dummy
451  type(ListType), intent(inout) :: list
452  integer(I4B), intent(in) :: idx
453  class(NumericalModelType), pointer :: res
454  ! -- local
455  class(*), pointer :: obj
456  !
457  obj => list%GetItem(idx)
458  res => castasnumericalmodelclass(obj)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ model_ac()

subroutine numericalmodelmodule::model_ac ( class(numericalmodeltype this,
type(sparsematrix), intent(inout)  sparse 
)
private

Definition at line 92 of file NumericalModel.f90.

93  class(NumericalModelType) :: this
94  type(sparsematrix), intent(inout) :: sparse

◆ model_ad()

subroutine numericalmodelmodule::model_ad ( class(numericalmodeltype this)
private

Definition at line 110 of file NumericalModel.f90.

111  class(NumericalModelType) :: this

◆ model_ar()

subroutine numericalmodelmodule::model_ar ( class(numericalmodeltype this)
private

Definition at line 102 of file NumericalModel.f90.

103  class(NumericalModelType) :: this

◆ model_bd()

subroutine numericalmodelmodule::model_bd ( class(numericalmodeltype this,
integer(i4b), intent(in)  icnvg,
integer(i4b), intent(in)  isuppress_output 
)
private

Definition at line 192 of file NumericalModel.f90.

193  class(NumericalModelType) :: this
194  integer(I4B), intent(in) :: icnvg
195  integer(I4B), intent(in) :: isuppress_output

◆ model_bdcalc()

subroutine numericalmodelmodule::model_bdcalc ( class(numericalmodeltype this,
integer(i4b), intent(in)  icnvg 
)
private

Definition at line 198 of file NumericalModel.f90.

199  class(NumericalModelType) :: this
200  integer(I4B), intent(in) :: icnvg

◆ model_bdentry()

subroutine numericalmodelmodule::model_bdentry ( class(numericalmodeltype this,
real(dp), dimension(:, :), intent(in)  budterm,
character(len=lenbudtxt), dimension(:), intent(in)  budtxt,
character(len=*), intent(in)  rowlabel 
)
private

Definition at line 212 of file NumericalModel.f90.

213  class(NumericalModelType) :: this
214  real(DP), dimension(:, :), intent(in) :: budterm
215  character(len=LENBUDTXT), dimension(:), intent(in) :: budtxt
216  character(len=*), intent(in) :: rowlabel

◆ model_bdsave()

subroutine numericalmodelmodule::model_bdsave ( class(numericalmodeltype this,
integer(i4b), intent(in)  icnvg 
)
private

Definition at line 203 of file NumericalModel.f90.

204  class(NumericalModelType) :: this
205  integer(I4B), intent(in) :: icnvg

◆ model_cc()

subroutine numericalmodelmodule::model_cc ( class(numericalmodeltype this,
integer(i4b), intent(in)  innertot,
integer(i4b), intent(in)  kiter,
integer(i4b), intent(in)  iend,
integer(i4b), intent(in)  icnvgmod,
character(len=lenpakloc), intent(inout)  cpak,
integer(i4b), intent(inout)  ipak,
real(dp), intent(inout)  dpak 
)
private

Definition at line 164 of file NumericalModel.f90.

165  class(NumericalModelType) :: this
166  integer(I4B), intent(in) :: innertot
167  integer(I4B), intent(in) :: kiter
168  integer(I4B), intent(in) :: iend
169  integer(I4B), intent(in) :: icnvgmod
170  character(len=LENPAKLOC), intent(inout) :: cpak
171  integer(I4B), intent(inout) :: ipak
172  real(DP), intent(inout) :: dpak

◆ model_cf()

subroutine numericalmodelmodule::model_cf ( class(numericalmodeltype this,
integer(i4b), intent(in)  kiter 
)
private

Definition at line 132 of file NumericalModel.f90.

133  class(NumericalModelType) :: this
134  integer(I4B), intent(in) :: kiter

◆ model_cq()

subroutine numericalmodelmodule::model_cq ( class(numericalmodeltype this,
integer(i4b), intent(in)  icnvg,
integer(i4b), intent(in)  isuppress_output 
)
private

Definition at line 186 of file NumericalModel.f90.

187  class(NumericalModelType) :: this
188  integer(I4B), intent(in) :: icnvg
189  integer(I4B), intent(in) :: isuppress_output

◆ model_da()

subroutine numericalmodelmodule::model_da ( class(numericalmodeltype this)
private

Definition at line 223 of file NumericalModel.f90.

224  ! -- modules
226  class(NumericalModelType) :: this
227 
228  ! -- Scalars
229  call mem_deallocate(this%neq)
230  call mem_deallocate(this%nja)
231  call mem_deallocate(this%icnvg)
232  call mem_deallocate(this%moffset)
233  deallocate (this%filename)
234  !
235  ! -- Arrays
236  call mem_deallocate(this%xold)
237  call mem_deallocate(this%flowja, 'FLOWJA', this%memoryPath)
238  call mem_deallocate(this%idxglo)
239  !
240  ! -- derived types
241  call this%bndlist%Clear()
242  deallocate (this%bndlist)
243  !
244  ! -- nullify pointers
245  call mem_deallocate(this%x, 'X', this%memoryPath)
246  call mem_deallocate(this%rhs, 'RHS', this%memoryPath)
247  call mem_deallocate(this%ibound, 'IBOUND', this%memoryPath)
248  !
249  ! -- BaseModelType
250  call this%BaseModelType%model_da()
251  !

◆ model_df()

subroutine numericalmodelmodule::model_df ( class(numericalmodeltype this)
private

Definition at line 88 of file NumericalModel.f90.

89  class(NumericalModelType) :: this

◆ model_fc()

subroutine numericalmodelmodule::model_fc ( class(numericalmodeltype this,
integer(i4b), intent(in)  kiter,
class(matrixbasetype), pointer  matrix_sln,
integer(i4b), intent(in)  inwtflag 
)
private

Definition at line 137 of file NumericalModel.f90.

138  class(NumericalModelType) :: this
139  integer(I4B), intent(in) :: kiter
140  class(MatrixBaseType), pointer :: matrix_sln
141  integer(I4B), intent(in) :: inwtflag

◆ model_fp()

subroutine numericalmodelmodule::model_fp ( class(numericalmodeltype this)
private

Definition at line 219 of file NumericalModel.f90.

220  class(NumericalModelType) :: this

◆ model_mc()

subroutine numericalmodelmodule::model_mc ( class(numericalmodeltype this,
class(matrixbasetype), pointer  matrix_sln 
)
private

Definition at line 97 of file NumericalModel.f90.

98  class(NumericalModelType) :: this
99  class(MatrixBaseType), pointer :: matrix_sln

◆ model_nr()

subroutine numericalmodelmodule::model_nr ( class(numericalmodeltype this,
integer(i4b), intent(in)  kiter,
class(matrixbasetype), pointer  matrix,
integer(i4b), intent(in)  inwtflag 
)
private

Definition at line 157 of file NumericalModel.f90.

158  class(NumericalModelType) :: this
159  integer(I4B), intent(in) :: kiter
160  class(MatrixBaseType), pointer :: matrix
161  integer(I4B), intent(in) :: inwtflag

◆ model_nur()

subroutine numericalmodelmodule::model_nur ( class(numericalmodeltype this,
integer(i4b), intent(in)  neqmod,
real(dp), dimension(neqmod), intent(inout)  x,
real(dp), dimension(neqmod), intent(in)  xtemp,
real(dp), dimension(neqmod), intent(inout)  dx,
integer(i4b), intent(inout)  inewtonur,
real(dp), intent(inout)  dxmax,
integer(i4b), intent(inout)  locmax 
)
private

Definition at line 175 of file NumericalModel.f90.

176  class(NumericalModelType) :: this
177  integer(I4B), intent(in) :: neqmod
178  real(DP), dimension(neqmod), intent(inout) :: x
179  real(DP), dimension(neqmod), intent(in) :: xtemp
180  real(DP), dimension(neqmod), intent(inout) :: dx
181  integer(I4B), intent(inout) :: inewtonur
182  real(DP), intent(inout) :: dxmax
183  integer(I4B), intent(inout) :: locmax

◆ model_ot()

subroutine numericalmodelmodule::model_ot ( class(numericalmodeltype this)
private

Definition at line 208 of file NumericalModel.f90.

209  class(NumericalModelType) :: this

◆ model_ptc()

subroutine numericalmodelmodule::model_ptc ( class(numericalmodeltype this,
class(vectorbasetype), pointer  vec_residual,
integer(i4b), intent(inout)  iptc,
real(dp), intent(inout)  ptcf 
)
private

Definition at line 150 of file NumericalModel.f90.

151  class(NumericalModelType) :: this
152  class(VectorBaseType), pointer :: vec_residual
153  integer(I4B), intent(inout) :: iptc
154  real(DP), intent(inout) :: ptcf

◆ model_ptcchk()

subroutine numericalmodelmodule::model_ptcchk ( class(numericalmodeltype this,
integer(i4b), intent(inout)  iptc 
)
private

Definition at line 144 of file NumericalModel.f90.

145  class(NumericalModelType) :: this
146  integer(I4B), intent(inout) :: iptc
147  iptc = 0

◆ model_reset()

subroutine numericalmodelmodule::model_reset ( class(numericalmodeltype this)
private

Definition at line 114 of file NumericalModel.f90.

115  use bndmodule, only: bndtype, getbndfromlist
116  class(NumericalModelType) :: this
117  ! local
118  class(BndType), pointer :: packobj
119  integer(I4B) :: ip
120 
121  do ip = 1, this%bndlist%Count()
122  packobj => getbndfromlist(this%bndlist, ip)
123  call packobj%bnd_reset()
124  end do
125 
Here is the call graph for this function:

◆ model_rp()

subroutine numericalmodelmodule::model_rp ( class(numericalmodeltype this)
private

Definition at line 106 of file NumericalModel.f90.

107  class(NumericalModelType) :: this

◆ model_solve()

subroutine numericalmodelmodule::model_solve ( class(numericalmodeltype this)

Definition at line 128 of file NumericalModel.f90.

129  class(NumericalModelType) :: this

◆ set_iboundptr()

subroutine numericalmodelmodule::set_iboundptr ( class(numericalmodeltype this,
integer(i4b), dimension(:), intent(in), pointer, contiguous  iboundsln,
integer(i4b)  sln_offset,
character(len=*), intent(in)  varNameTgt,
character(len=*), intent(in)  memPathTgt 
)

Definition at line 345 of file NumericalModel.f90.

347  ! -- dummy
348  class(NumericalModelType) :: this
349  integer(I4B), dimension(:), pointer, contiguous, intent(in) :: iboundsln
350  integer(I4B) :: sln_offset
351  character(len=*), intent(in) :: varNameTgt
352  character(len=*), intent(in) :: memPathTgt
353  ! -- local
354  integer(I4B) :: offset
355  ! -- code
356  offset = this%moffset - sln_offset
357  this%ibound => iboundsln(offset + 1:offset + this%neq)
358  call mem_checkin(this%ibound, 'IBOUND', this%memoryPath, varnametgt, &
359  mempathtgt)

◆ set_idsoln()

subroutine numericalmodelmodule::set_idsoln ( class(numericalmodeltype this,
integer(i4b), intent(in)  id 
)
private

Definition at line 268 of file NumericalModel.f90.

269  class(NumericalModelType) :: this
270  integer(I4B), intent(in) :: id
271  this%idsoln = id

◆ set_moffset()

subroutine numericalmodelmodule::set_moffset ( class(numericalmodeltype this,
integer(i4b), intent(in)  moffset 
)

Definition at line 254 of file NumericalModel.f90.

255  class(NumericalModelType) :: this
256  integer(I4B), intent(in) :: moffset
257  this%moffset = moffset

◆ set_rhsptr()

subroutine numericalmodelmodule::set_rhsptr ( class(numericalmodeltype this,
real(dp), dimension(:), intent(in), pointer, contiguous  rhssln,
integer(i4b)  sln_offset,
character(len=*), intent(in)  varNameTgt,
character(len=*), intent(in)  memPathTgt 
)

Definition at line 329 of file NumericalModel.f90.

331  ! -- dummy
332  class(NumericalModelType) :: this
333  real(DP), dimension(:), pointer, contiguous, intent(in) :: rhssln
334  integer(I4B) :: sln_offset
335  character(len=*), intent(in) :: varNameTgt
336  character(len=*), intent(in) :: memPathTgt
337  ! -- local
338  integer(I4B) :: offset
339  ! -- code
340  offset = this%moffset - sln_offset
341  this%rhs => rhssln(offset + 1:offset + this%neq)
342  call mem_checkin(this%rhs, 'RHS', this%memoryPath, varnametgt, mempathtgt)

◆ set_xptr()

subroutine numericalmodelmodule::set_xptr ( class(numericalmodeltype this,
real(dp), dimension(:), intent(in), pointer, contiguous  xsln,
integer(i4b)  sln_offset,
character(len=*), intent(in)  varNameTgt,
character(len=*), intent(in)  memPathTgt 
)

Definition at line 313 of file NumericalModel.f90.

315  ! -- dummy
316  class(NumericalModelType) :: this
317  real(DP), dimension(:), pointer, contiguous, intent(in) :: xsln
318  integer(I4B) :: sln_offset
319  character(len=*), intent(in) :: varNameTgt
320  character(len=*), intent(in) :: memPathTgt
321  ! -- local
322  integer(I4B) :: offset
323  ! -- code
324  offset = this%moffset - sln_offset
325  this%x => xsln(offset + 1:offset + this%neq)
326  call mem_checkin(this%x, 'X', this%memoryPath, varnametgt, mempathtgt)