MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
chf.f90
Go to the documentation of this file.
1!> @brief Channel Flow (CHF) Module
2!<
4
5 use kindmodule, only: i4b
7 use simmodule, only: store_error
11 use swfmodule, only: swfmodeltype
12 use budgetmodule, only: budget_cr
13
14 implicit none
15
16 private
17 public :: chf_cr
18 public :: chfmodeltype
20 public :: chf_basepkg, chf_multipkg
21
22 type, extends(swfmodeltype) :: chfmodeltype
23 contains
26 end type chfmodeltype
27
28 !> @brief CHF base package array descriptors
29 !!
30 !! CHF 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 :: chf_nbasepkg = 7
33 character(len=LENPACKAGETYPE), dimension(CHF_NBASEPKG) :: &
34 chf_basepkg = ['DISV1D6', 'DFW6 ', 'CXS6 ', &
35 'OC6 ', 'IC6 ', 'OBS6 ', &
36 'STO6 ']
37
38 !> @brief CHF multi package array descriptors
39 !!
40 !! CHF 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 :: chf_nmultipkg = 50
43 character(len=LENPACKAGETYPE), dimension(CHF_NMULTIPKG) :: chf_multipkg
44 data chf_multipkg/'FLW6 ', 'CHD6 ', 'CDB6 ', 'ZDG6 ', 'PCP6 ', & ! 5
45 'EVP6 ', ' ', ' ', ' ', ' ', & ! 10
46 &40*' '/ ! 50
47
48 ! size of supported model package arrays
49 integer(I4B), parameter :: niunit_chf = chf_nbasepkg + chf_nmultipkg
50
51contains
52
53 !> @brief Create a new surface water flow model object
54 !<
55 subroutine chf_cr(filename, id, modelname)
56 ! modules
57 ! dummy
58 character(len=*), intent(in) :: filename !< input file
59 integer(I4B), intent(in) :: id !< consecutive model number listed in mfsim.nam
60 character(len=*), intent(in) :: modelname !< name of the model
61 ! local
62 class(chfmodeltype), pointer :: this
63 class(basemodeltype), pointer :: model
64
65 ! Allocate a new model
66 allocate (this)
67 model => this
69
70 ! call parent initialize routine
71 call this%initialize('CHF', filename, id, modelname)
72
73 ! set and log namefile options
74 call this%set_namfile_options()
75
76 ! Create utility objects
77 call budget_cr(this%budget, this%name)
78
79 ! create model packages
80 call this%create_packages()
81
82 end subroutine chf_cr
83
84 !> @brief Handle namefile options
85 !!
86 !! Set pointers to IDM namefile options, then
87 !! create the list file and log options.
88 !<
89 subroutine set_namfile_options(this)
94 class(chfmodeltype) :: this
95 type(chfnamparamfoundtype) :: found
96 character(len=LENMEMPATH) :: input_mempath
97 character(len=LINELENGTH) :: lst_fname
98
99 ! set input model namfile memory path
100 input_mempath = create_mem_path(this%name, 'NAM', idm_context)
101
102 ! copy option params from input context
103 call mem_set_value(lst_fname, 'LIST', input_mempath, found%list)
104 call mem_set_value(this%inewton, 'NEWTON', input_mempath, found%newton)
105 call mem_set_value(this%inewtonur, 'UNDER_RELAXATION', input_mempath, &
106 found%under_relaxation)
107 call mem_set_value(this%iprpak, 'PRINT_INPUT', input_mempath, &
108 found%print_input)
109 call mem_set_value(this%iprflow, 'PRINT_FLOWS', input_mempath, &
110 found%print_flows)
111 call mem_set_value(this%ipakcb, 'SAVE_FLOWS', input_mempath, found%save_flows)
112
113 ! create the list file
114 call this%create_lstfile(lst_fname, this%filename, found%list, &
115 'CHANNEL FLOW MODEL (CHF)')
116
117 ! activate save_flows if found
118 if (found%save_flows) then
119 this%ipakcb = -1
120 end if
121
122 ! log set options
123 if (this%iout > 0) then
124 call this%log_namfile_options(found)
125 end if
126
127 end subroutine set_namfile_options
128
129 !> @brief Write model namfile options to list file
130 !<
131 subroutine log_namfile_options(this, found)
133 class(chfmodeltype) :: this
134 type(chfnamparamfoundtype), intent(in) :: found
135
136 write (this%iout, '(1x,a)') 'BEGIN NAMEFILE OPTIONS'
137
138 if (found%print_input) then
139 write (this%iout, '(4x,a)') 'STRESS PACKAGE INPUT WILL BE PRINTED '// &
140 'FOR ALL MODEL STRESS PACKAGES'
141 end if
142
143 if (found%print_flows) then
144 write (this%iout, '(4x,a)') 'PACKAGE FLOWS WILL BE PRINTED '// &
145 'FOR ALL MODEL PACKAGES'
146 end if
147
148 if (found%save_flows) then
149 write (this%iout, '(4x,a)') &
150 'FLOWS WILL BE SAVED TO BUDGET FILE SPECIFIED IN OUTPUT CONTROL'
151 end if
152
153 write (this%iout, '(1x,a)') 'END NAMEFILE OPTIONS'
154
155 end subroutine log_namfile_options
156
157end module chfmodule
subroutine, public addbasemodeltolist(list, model)
This module contains the BudgetModule.
Definition Budget.f90:20
subroutine, public budget_cr(this, name_model)
Create a new budget object.
Definition Budget.f90:85
Channel Flow (CHF) Module.
Definition chf.f90:3
integer(i4b), parameter, public chf_nbasepkg
CHF base package array descriptors.
Definition chf.f90:32
character(len=lenpackagetype), dimension(chf_nmultipkg), public chf_multipkg
Definition chf.f90:43
character(len=lenpackagetype), dimension(chf_nbasepkg), public chf_basepkg
candidates for input and these will be loaded in the order specified.
Definition chf.f90:33
subroutine, public chf_cr(filename, id, modelname)
Create a new surface water flow model object.
Definition chf.f90:56
integer(i4b), parameter, public chf_nmultipkg
CHF multi package array descriptors.
Definition chf.f90:42
integer(i4b), parameter niunit_chf
Definition chf.f90:49
subroutine log_namfile_options(this, found)
Write model namfile options to list file.
Definition chf.f90:132
subroutine set_namfile_options(this)
Handle namefile options.
Definition chf.f90:90
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
This module contains simulation methods.
Definition Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition Sim.f90:94
This module contains simulation variables.
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:16