MODFLOW 6  version 6.7.0.dev0
USGS Modular Hydrologic Model
olf.f90
Go to the documentation of this file.
1 !> @brief Channel Flow (OLF) Module
2 !<
3 module olfmodule
4 
5  use kindmodule, only: i4b
7  use simmodule, only: store_error
9  use listsmodule, only: basemodellist
11  use swfmodule, only: swfmodeltype
12  use budgetmodule, only: budget_cr
13 
14  implicit none
15 
16  private
17  public :: olf_cr
18  public :: olfmodeltype
19  public :: olf_nbasepkg, olf_nmultipkg
20  public :: olf_basepkg, olf_multipkg
21 
22  type, extends(swfmodeltype) :: olfmodeltype
23  contains
24  procedure :: set_namfile_options
25  procedure :: log_namfile_options
26  end type olfmodeltype
27 
28  !> @brief OLF base package array descriptors
29  !!
30  !! OLF model base package types. Only listed packages are candidates
31  !< for input and these will be loaded in the order specified.
32  integer(I4B), parameter :: olf_nbasepkg = 7
33  character(len=LENPACKAGETYPE), dimension(OLF_NBASEPKG) :: &
34  olf_basepkg = ['DIS2D6 ', 'DISV2D6', 'DFW6 ', &
35  'OC6 ', 'IC6 ', 'OBS6 ', &
36  'STO6 ']
37 
38  !> @brief OLF multi package array descriptors
39  !!
40  !! OLF model multi-instance package types. Only listed packages are
41  !< candidates for input and these will be loaded in the order specified.
42  integer(I4B), parameter :: olf_nmultipkg = 50
43  character(len=LENPACKAGETYPE), dimension(OLF_NMULTIPKG) :: olf_multipkg
44  data olf_multipkg/'FLW6 ', 'CHD6 ', 'CDB6 ', 'ZDG6 ', ' ', & ! 5
45  &45*' '/ ! 50
46 
47  ! size of supported model package arrays
48  integer(I4B), parameter :: niunit_olf = olf_nbasepkg + olf_nmultipkg
49 
50 contains
51 
52  !> @brief Create a new overland flow model object
53  !<
54  subroutine olf_cr(filename, id, modelname)
55  ! modules
56  ! dummy
57  character(len=*), intent(in) :: filename !< input file
58  integer(I4B), intent(in) :: id !< consecutive model number listed in mfsim.nam
59  character(len=*), intent(in) :: modelname !< name of the model
60  ! local
61  class(olfmodeltype), pointer :: this
62  class(basemodeltype), pointer :: model
63 
64  ! Allocate a new model
65  allocate (this)
66  model => this
68 
69  ! call parent initialize routine
70  call this%initialize('OLF', filename, id, modelname)
71 
72  ! set and log namefile options
73  call this%set_namfile_options()
74 
75  ! Create utility objects
76  call budget_cr(this%budget, this%name)
77 
78  ! create model packages
79  call this%create_packages()
80 
81  end subroutine olf_cr
82 
83  !> @brief Handle namefile options
84  !!
85  !! Set pointers to IDM namefile options, then
86  !! create the list file and log options.
87  !<
88  subroutine set_namfile_options(this)
93  class(olfmodeltype) :: this
94  type(olfnamparamfoundtype) :: found
95  character(len=LENMEMPATH) :: input_mempath
96  character(len=LINELENGTH) :: lst_fname
97 
98  ! set input model namfile memory path
99  input_mempath = create_mem_path(this%name, 'NAM', idm_context)
100 
101  ! copy option params from input context
102  call mem_set_value(lst_fname, 'LIST', input_mempath, found%list)
103  call mem_set_value(this%inewton, 'NEWTON', input_mempath, found%newton)
104  call mem_set_value(this%inewtonur, 'UNDER_RELAXATION', input_mempath, &
105  found%under_relaxation)
106  call mem_set_value(this%iprpak, 'PRINT_INPUT', input_mempath, &
107  found%print_input)
108  call mem_set_value(this%iprflow, 'PRINT_FLOWS', input_mempath, &
109  found%print_flows)
110  call mem_set_value(this%ipakcb, 'SAVE_FLOWS', input_mempath, found%save_flows)
111 
112  ! create the list file
113  call this%create_lstfile(lst_fname, this%filename, found%list, &
114  'CHANNEL FLOW MODEL (OLF)')
115 
116  ! activate save_flows if found
117  if (found%save_flows) then
118  this%ipakcb = -1
119  end if
120 
121  ! log set options
122  if (this%iout > 0) then
123  call this%log_namfile_options(found)
124  end if
125 
126  end subroutine set_namfile_options
127 
128  !> @brief Write model namfile options to list file
129  !<
130  subroutine log_namfile_options(this, found)
132  class(olfmodeltype) :: this
133  type(olfnamparamfoundtype), intent(in) :: found
134 
135  write (this%iout, '(1x,a)') 'BEGIN NAMEFILE OPTIONS'
136 
137  if (found%print_input) then
138  write (this%iout, '(4x,a)') 'STRESS PACKAGE INPUT WILL BE PRINTED '// &
139  'FOR ALL MODEL STRESS PACKAGES'
140  end if
141 
142  if (found%print_flows) then
143  write (this%iout, '(4x,a)') 'PACKAGE FLOWS WILL BE PRINTED '// &
144  'FOR ALL MODEL PACKAGES'
145  end if
146 
147  if (found%save_flows) then
148  write (this%iout, '(4x,a)') &
149  'FLOWS WILL BE SAVED TO BUDGET FILE SPECIFIED IN OUTPUT CONTROL'
150  end if
151 
152  write (this%iout, '(1x,a)') 'END NAMEFILE OPTIONS'
153 
154  end subroutine log_namfile_options
155 
156 end module olfmodule
subroutine, public addbasemodeltolist(list, model)
Definition: BaseModel.f90:161
This module contains the BudgetModule.
Definition: Budget.f90:20
subroutine, public budget_cr(this, name_model)
@ brief Create a new budget object
Definition: Budget.f90:84
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
integer(i4b), parameter lenpackagetype
maximum length of a package type (DIS6, SFR6, CSUB6, etc.)
Definition: Constants.f90:38
integer(i4b), parameter lenmempath
maximum length of the memory path
Definition: Constants.f90:27
This module defines variable data types.
Definition: kind.f90:8
type(listtype), public basemodellist
Definition: mf6lists.f90:16
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
Channel Flow (OLF) Module.
Definition: olf.f90:3
integer(i4b), parameter, public olf_nmultipkg
OLF multi package array descriptors.
Definition: olf.f90:42
subroutine set_namfile_options(this)
Handle namefile options.
Definition: olf.f90:89
character(len=lenpackagetype), dimension(olf_nbasepkg), public olf_basepkg
candidates for input and these will be loaded in the order specified.
Definition: olf.f90:33
character(len=lenpackagetype), dimension(olf_nmultipkg), public olf_multipkg
Definition: olf.f90:43
subroutine, public olf_cr(filename, id, modelname)
Create a new overland flow model object.
Definition: olf.f90:55
subroutine log_namfile_options(this, found)
Write model namfile options to list file.
Definition: olf.f90:131
integer(i4b), parameter, public olf_nbasepkg
OLF base package array descriptors.
Definition: olf.f90:32
integer(i4b), parameter niunit_olf
Definition: olf.f90:48
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
This module contains simulation variables.
Definition: SimVariables.f90:9
character(len=linelength) idm_context
Surface Water Flow (SWF) Module.
Definition: swf.f90:3
Highest level model type. All models extend this parent type.
Definition: BaseModel.f90:13