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

Data Types

type  basemodeltype
 Highest level model type. All models extend this parent type. More...
 

Functions/Subroutines

subroutine model_df (this)
 Define the model. More...
 
subroutine model_ar (this)
 Allocate and read. More...
 
subroutine model_rp (this)
 Read and prepare. More...
 
subroutine model_dt (this)
 Calculate time step length. More...
 
subroutine model_ot (this)
 Output results. More...
 
subroutine model_message (this, line, fmt)
 Write line to model iout. More...
 
subroutine model_fp (this)
 Final processing. More...
 
subroutine allocate_scalars (this, modelname)
 Allocate scalar variables. More...
 
subroutine model_da (this)
 Deallocate. More...
 
class(basemodeltype) function, pointer, public castasbasemodelclass (obj)
 
subroutine, public addbasemodeltolist (list, model)
 
class(basemodeltype) function, pointer, public getbasemodelfromlist (list, idx)
 
subroutine create_lstfile (this, lst_fname, model_fname, defined, headertxt)
 

Function/Subroutine Documentation

◆ addbasemodeltolist()

subroutine, public basemodelmodule::addbasemodeltolist ( type(listtype), intent(inout)  list,
class(basemodeltype), intent(inout), pointer  model 
)

Definition at line 159 of file BaseModel.f90.

160  ! dummy
161  type(ListType), intent(inout) :: list
162  class(BaseModelType), pointer, intent(inout) :: model
163  ! local
164  class(*), pointer :: obj
165 
166  obj => model
167  call list%Add(obj)
Here is the caller graph for this function:

◆ allocate_scalars()

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

Definition at line 97 of file BaseModel.f90.

98  ! modules
100  ! dummy
101  class(BaseModelType) :: this
102  character(len=*), intent(in) :: modelname
103 
104  call mem_allocate(this%name, lenmodelname, 'NAME', this%memoryPath)
105  call mem_allocate(this%macronym, 3, 'MACRONYM', this%memoryPath)
106  call mem_allocate(this%id, 'ID', this%memoryPath)
107  call mem_allocate(this%iout, 'IOUT', this%memoryPath)
108  call mem_allocate(this%inewton, 'INEWTON', this%memoryPath)
109  call mem_allocate(this%iprpak, 'IPRPAK', this%memoryPath)
110  call mem_allocate(this%iprflow, 'IPRFLOW', this%memoryPath)
111  call mem_allocate(this%ipakcb, 'IPAKCB', this%memoryPath)
112  call mem_allocate(this%idsoln, 'IDSOLN', this%memoryPath)
113 
114  this%name = modelname
115  this%macronym = ''
116  this%idsoln = 0
117  this%id = 0
118  this%iout = 0
119  this%iprpak = 0
120  this%iprflow = 0
121  this%ipakcb = 0
122  this%inewton = 0 !default is standard formulation

◆ castasbasemodelclass()

class(basemodeltype) function, pointer, public basemodelmodule::castasbasemodelclass ( class(*), intent(inout), pointer  obj)

Definition at line 146 of file BaseModel.f90.

147  class(*), pointer, intent(inout) :: obj
148  class(BaseModelType), pointer :: res
149 
150  res => null()
151  if (.not. associated(obj)) return
152 
153  select type (obj)
154  class is (basemodeltype)
155  res => obj
156  end select
Here is the caller graph for this function:

◆ create_lstfile()

subroutine basemodelmodule::create_lstfile ( class(basemodeltype 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 182 of file BaseModel.f90.

183  ! dummy
184  class(BaseModelType) :: this
185  character(len=*), intent(inout) :: lst_fname
186  character(len=*), intent(in) :: model_fname
187  logical(LGP), intent(in) :: defined
188  character(len=*), intent(in) :: headertxt
189  ! local
190  integer(I4B) :: i, istart, istop
191 
192  ! set list file name if not provided
193  if (.not. defined) then
194 
195  ! initialize
196  lst_fname = ' '
197  istart = 0
198  istop = len_trim(model_fname)
199 
200  ! identify '.' character position from back of string
201  do i = istop, 1, -1
202  if (model_fname(i:i) == '.') then
203  istart = i
204  exit
205  end if
206  end do
207 
208  ! if not found start from string end
209  if (istart == 0) istart = istop + 1
210 
211  ! set list file name
212  lst_fname = model_fname(1:istart)
213  istop = istart + 3
214  lst_fname(istart:istop) = '.lst'
215  end if
216 
217  ! create the list file
218  this%iout = getunit()
219  call openfile(this%iout, 0, lst_fname, 'LIST', filstat_opt='REPLACE')
220 
221  ! write list file header
222  call write_listfile_header(this%iout, headertxt)
Here is the call graph for this function:

◆ getbasemodelfromlist()

class(basemodeltype) function, pointer, public basemodelmodule::getbasemodelfromlist ( type(listtype), intent(inout)  list,
integer(i4b), intent(in)  idx 
)

Definition at line 170 of file BaseModel.f90.

171  ! dummy
172  type(ListType), intent(inout) :: list
173  integer(I4B), intent(in) :: idx
174  class(BaseModelType), pointer :: res
175  ! local
176  class(*), pointer :: obj
177 
178  obj => list%GetItem(idx)
179  res => castasbasemodelclass(obj)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ model_ar()

subroutine basemodelmodule::model_ar ( class(basemodeltype this)
private

Definition at line 54 of file BaseModel.f90.

55  class(BaseModelType) :: this

◆ model_da()

subroutine basemodelmodule::model_da ( class(basemodeltype this)

Definition at line 126 of file BaseModel.f90.

127  ! modules
129  ! dummy
130  class(BaseModelType) :: this
131 
132  ! deallocate strings
133  call mem_deallocate(this%name, 'NAME', this%memoryPath)
134  call mem_deallocate(this%macronym, 'MACRONYM', this%memoryPath)
135  !
136  ! deallocate scalars
137  call mem_deallocate(this%id)
138  call mem_deallocate(this%iout)
139  call mem_deallocate(this%inewton)
140  call mem_deallocate(this%iprpak)
141  call mem_deallocate(this%iprflow)
142  call mem_deallocate(this%ipakcb)
143  call mem_deallocate(this%idsoln)

◆ model_df()

subroutine basemodelmodule::model_df ( class(basemodeltype this)
private

Definition at line 49 of file BaseModel.f90.

50  class(BaseModelType) :: this

◆ model_dt()

subroutine basemodelmodule::model_dt ( class(basemodeltype this)
private

Definition at line 64 of file BaseModel.f90.

65  class(BaseModelType) :: this

◆ model_fp()

subroutine basemodelmodule::model_fp ( class(basemodeltype this)
private

Definition at line 92 of file BaseModel.f90.

93  class(BaseModelType) :: this

◆ model_message()

subroutine basemodelmodule::model_message ( class(basemodeltype this,
character(len=*), intent(in)  line,
character(len=*), intent(in), optional  fmt 
)
private

Definition at line 74 of file BaseModel.f90.

75  ! dummy
76  class(BaseModelType) :: this
77  character(len=*), intent(in) :: line
78  character(len=*), intent(in), optional :: fmt
79  ! local
80  character(len=LINELENGTH) :: cfmt
81 
82  if (present(fmt)) then
83  cfmt = fmt
84  else
85  cfmt = '(1x,a)'
86  end if
87 
88  write (this%iout, trim(cfmt)) trim(line)

◆ model_ot()

subroutine basemodelmodule::model_ot ( class(basemodeltype this)
private

Definition at line 69 of file BaseModel.f90.

70  class(BaseModelType) :: this

◆ model_rp()

subroutine basemodelmodule::model_rp ( class(basemodeltype this)
private

Definition at line 59 of file BaseModel.f90.

60  class(BaseModelType) :: this