Skip to content

Commit 3f6af23

Browse files
feat(swf-pcp): add precipitation package for CHF and OLF models (#2160)
* feat(swf-pcp): add precipitation package for CHF and OLF models * fprettify * update makefile * update io guide * apply precip to maximum top width of the channel ensure cross sections are defined by at least 2 points ensure precip is greater than or equal to zero
1 parent 2fb2872 commit 3f6af23

37 files changed

+2992
-156
lines changed

autotest/test_chf_dfw_swrt2.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
from framework import TestFramework
1818

1919
cases = [
20-
"chf-swr-t2",
20+
"chf-swrt2-01",
21+
"chf-swrt2-02",
2122
]
2223

2324

2425
def build_models(idx, test):
2526
dx = 500.0
27+
width = dx
2628
nreach = 11
2729
nper = 1
2830
perlen = [5040 * 2 * 60.0] # 7 days (in seconds)
@@ -89,7 +91,7 @@ def build_models(idx, test):
8991
export_array_ascii=True,
9092
nodes=nodes,
9193
nvert=nvert,
92-
width=dx,
94+
width=width,
9395
bottom=reach_bottom,
9496
idomain=1,
9597
vertices=vertices,
@@ -131,13 +133,23 @@ def build_models(idx, test):
131133
# flw
132134
inflow_reach = 0
133135
qinflow = 23.570
134-
flw = flopy.mf6.ModflowChfflw(
135-
chf,
136-
maxbound=1,
137-
print_input=True,
138-
print_flows=True,
139-
stress_period_data=[(inflow_reach, qinflow)],
140-
)
136+
if idx == 0:
137+
flw = flopy.mf6.ModflowChfflw(
138+
chf,
139+
maxbound=1,
140+
print_input=True,
141+
print_flows=True,
142+
stress_period_data=[(inflow_reach, qinflow)],
143+
)
144+
145+
if idx == 1:
146+
pcp = flopy.mf6.ModflowOlfpcp(
147+
chf,
148+
maxbound=1,
149+
print_input=True,
150+
print_flows=True,
151+
stress_period_data=[(inflow_reach, qinflow / dx / width)],
152+
)
141153

142154
chd = flopy.mf6.ModflowChfchd(
143155
chf,

autotest/test_olf_dfw_swrt2dis.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
from framework import TestFramework
1616

1717
cases = [
18-
"olf-swr-t2-dis",
18+
"olf-swrt2-dis01",
19+
"olf-swrt2-dis02",
1920
]
2021

2122

@@ -113,16 +114,29 @@ def build_models(idx, test):
113114
],
114115
)
115116

116-
# flw
117117
qinflow = 23.570
118-
spd = [(i, 0, qinflow) for i in range(nrow)]
119-
flw = flopy.mf6.ModflowOlfflw(
120-
olf,
121-
maxbound=len(spd),
122-
print_input=True,
123-
print_flows=True,
124-
stress_period_data=spd,
125-
)
118+
119+
if idx == 0:
120+
# apply inflow with flw package
121+
spd = [(i, 0, qinflow) for i in range(nrow)]
122+
flw = flopy.mf6.ModflowOlfflw(
123+
olf,
124+
maxbound=len(spd),
125+
print_input=True,
126+
print_flows=True,
127+
stress_period_data=spd,
128+
)
129+
130+
if idx == 1:
131+
# apply inflow with pcp package
132+
spd = spd = [(i, 0, qinflow / dx**2) for i in range(nrow)]
133+
pcp = flopy.mf6.ModflowOlfpcp(
134+
olf,
135+
maxbound=len(spd),
136+
print_input=True,
137+
print_flows=True,
138+
stress_period_data=spd,
139+
)
126140

127141
spd = [(i, ncol - 1, 1.05) for i in range(nrow)]
128142
chd = flopy.mf6.ModflowOlfchd(

doc/mf6io/chf/chf.tex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ \subsection{Constant Head (CHD) Package}
4646
\subsection{Inflow (FLW) Package}
4747
\input{chf/flw}
4848

49+
\newpage
50+
\subsection{Precipitation (PCP) Package}
51+
\input{chf/pcp}
52+
4953
\newpage
5054
\subsection{Zero-Depth Gradient (ZDG) Package}
5155
\input{chf/zdg}

doc/mf6io/chf/pcp.tex

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Input to the Precipitation (PCP) Package is read from the file that has type ``PCP6'' in the Name File. Any number of PCP Packages can be specified for a single surface water flow model.
2+
3+
\vspace{5mm}
4+
\subsubsection{Structure of Blocks}
5+
\vspace{5mm}
6+
7+
\noindent \textit{FOR EACH SIMULATION}
8+
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/chf-pcp-options.dat}
9+
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/chf-pcp-dimensions.dat}
10+
\vspace{5mm}
11+
\noindent \textit{FOR ANY STRESS PERIOD}
12+
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/chf-pcp-period.dat}
13+
\packageperioddescription
14+
15+
\vspace{5mm}
16+
\subsubsection{Explanation of Variables}
17+
\begin{description}
18+
\input{./mf6ivar/tex/chf-pcp-desc.tex}
19+
\end{description}
20+
21+
\vspace{5mm}
22+
\subsubsection{Example Input File}
23+
\lstinputlisting[style=inputfile]{./mf6ivar/examples/chf-pcp-example.dat}
24+
25+
%\vspace{5mm}
26+
%\subsubsection{Available observation types}
27+
%Well Package observations include the simulated well rates (\texttt{wel}), the well discharge that is available for the MVR package (\texttt{to-mvr}), and the reduction in the specified \texttt{q} when the \texttt{AUTO\_FLOW\_REDUCE} option is enabled. The data required for each WEL Package observation type is defined in table~\ref{table:gwf-welobstype}. The sum of \texttt{wel} and \texttt{to-mvr} is equal to the simulated well discharge rate, which may be less than the specified \texttt{q} if the \texttt{AUTO\_FLOW\_REDUCE} option is enabled. The \texttt{DNODATA} value is returned if the \texttt{wel-reduction} observation is specified but the \texttt{AUTO\_FLOW\_REDUCE} option is not enabled. Negative and positive values for an observation represent a loss from and gain to the GWF model, respectively.
28+
29+
%\begin{longtable}{p{2cm} p{2.75cm} p{2cm} p{1.25cm} p{7cm}}
30+
%\caption{Available WEL Package observation types} \tabularnewline
31+
32+
%\hline
33+
%\hline
34+
%\textbf{Stress Package} & \textbf{Observation type} & \textbf{ID} & \textbf{ID2} & \textbf{Description} \\
35+
%\hline
36+
%\endhead
37+
38+
%\hline
39+
%\endfoot
40+
41+
%\input{../Common/gwf-welobs.tex}
42+
%\label{table:gwf-welobstype}
43+
%\end{longtable}
44+
45+
%\vspace{5mm}
46+
%\subsubsection{Example Observation Input File}
47+
%\lstinputlisting[style=inputfile]{./mf6ivar/examples/gwf-wel-example-obs.dat}

doc/mf6io/mf6ivar/dfn/chf-cxs.dfn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ tagged false
5656
in_record true
5757
reader urword
5858
longname number of points used to define cross section
59-
description integer value that defines the number of points used to define the define the shape of a section. NXSPOINTS must be greater than zero or the program will terminate with an error. NXSPOINTS defines the number of points that must be entered for the reach in the CROSSSECTIONDATA block. The sum of NXSPOINTS for all sections must equal the NPOINTS dimension.
59+
description integer value that defines the number of points used to define the define the shape of a section. NXSPOINTS must be greater than 1 or the program will terminate with an error. NXSPOINTS defines the number of points that must be entered for the reach in the CROSSSECTIONDATA block. The sum of NXSPOINTS for all sections must equal the NPOINTS dimension.
6060

6161
# --------------------- chf cxs crosssectiondata ---------------------
6262

doc/mf6io/mf6ivar/dfn/chf-pcp.dfn

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
# --------------------- swf pcp options ---------------------
2+
# flopy multi-package
3+
4+
block options
5+
name auxiliary
6+
type string
7+
shape (naux)
8+
reader urword
9+
optional true
10+
longname keyword to specify aux variables
11+
description REPLACE auxnames {'{#1}': 'Surface Water Flow'}
12+
13+
block options
14+
name auxmultname
15+
type string
16+
shape
17+
reader urword
18+
optional true
19+
longname name of auxiliary variable for multiplier
20+
description REPLACE auxmultname {'{#1}': 'precipitation'}
21+
22+
block options
23+
name boundnames
24+
type keyword
25+
shape
26+
reader urword
27+
optional true
28+
longname
29+
description REPLACE boundnames {'{#1}': 'precipitation'}
30+
31+
block options
32+
name print_input
33+
type keyword
34+
reader urword
35+
optional true
36+
longname print input to listing file
37+
description REPLACE print_input {'{#1}': 'precipitation'}
38+
mf6internal iprpak
39+
40+
block options
41+
name print_flows
42+
type keyword
43+
reader urword
44+
optional true
45+
longname print precipitation rates to listing file
46+
description REPLACE print_flows {'{#1}': 'precipitation'}
47+
mf6internal iprflow
48+
49+
block options
50+
name save_flows
51+
type keyword
52+
reader urword
53+
optional true
54+
longname save precipitation to budget file
55+
description REPLACE save_flows {'{#1}': 'precipitation'}
56+
mf6internal ipakcb
57+
58+
block options
59+
name ts_filerecord
60+
type record ts6 filein ts6_filename
61+
shape
62+
reader urword
63+
tagged true
64+
optional true
65+
longname
66+
description
67+
68+
block options
69+
name ts6
70+
type keyword
71+
shape
72+
in_record true
73+
reader urword
74+
tagged true
75+
optional false
76+
longname head keyword
77+
description keyword to specify that record corresponds to a time-series file.
78+
79+
block options
80+
name filein
81+
type keyword
82+
shape
83+
in_record true
84+
reader urword
85+
tagged true
86+
optional false
87+
longname file keyword
88+
description keyword to specify that an input filename is expected next.
89+
90+
block options
91+
name ts6_filename
92+
type string
93+
preserve_case true
94+
in_record true
95+
reader urword
96+
optional false
97+
tagged false
98+
longname file name of time series information
99+
description REPLACE timeseriesfile {}
100+
101+
block options
102+
name obs_filerecord
103+
type record obs6 filein obs6_filename
104+
shape
105+
reader urword
106+
tagged true
107+
optional true
108+
longname
109+
description
110+
111+
block options
112+
name obs6
113+
type keyword
114+
shape
115+
in_record true
116+
reader urword
117+
tagged true
118+
optional false
119+
longname obs keyword
120+
description keyword to specify that record corresponds to an observations file.
121+
122+
block options
123+
name obs6_filename
124+
type string
125+
preserve_case true
126+
in_record true
127+
tagged false
128+
reader urword
129+
optional false
130+
longname obs6 input filename
131+
description REPLACE obs6_filename {'{#1}': 'Precipitation'}
132+
133+
# --------------------- swf pcp dimensions ---------------------
134+
135+
block dimensions
136+
name maxbound
137+
type integer
138+
reader urword
139+
optional false
140+
longname maximum number of precipitation cells
141+
description REPLACE maxbound {'{#1}': 'precipitation cells'}
142+
143+
144+
# --------------------- swf pcp period ---------------------
145+
146+
block period
147+
name iper
148+
type integer
149+
block_variable True
150+
in_record true
151+
tagged false
152+
shape
153+
valid
154+
reader urword
155+
optional false
156+
longname stress period number
157+
description REPLACE iper {}
158+
159+
block period
160+
name stress_period_data
161+
type recarray cellid precipitation aux boundname
162+
shape (maxbound)
163+
reader urword
164+
longname
165+
description
166+
mf6internal spd
167+
168+
block period
169+
name cellid
170+
type integer
171+
shape (ncelldim)
172+
tagged false
173+
in_record true
174+
reader urword
175+
longname cell identifier
176+
description REPLACE cellid {}
177+
178+
block period
179+
name precipitation
180+
type double precision
181+
shape
182+
tagged false
183+
in_record true
184+
reader urword
185+
time_series true
186+
longname precipitation rate
187+
description is the precipitation flux rate ($LT^{-1}$). This rate is multiplied inside the program by the surface area of the cell to calculate the volumetric precipitation rate. If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value.
188+
189+
block period
190+
name aux
191+
type double precision
192+
in_record true
193+
tagged false
194+
shape (naux)
195+
reader urword
196+
optional true
197+
time_series true
198+
longname auxiliary variables
199+
description REPLACE aux {'{#1}': 'precipitation'}
200+
mf6internal auxvar
201+
202+
block period
203+
name boundname
204+
type string
205+
shape
206+
tagged false
207+
in_record true
208+
reader urword
209+
optional true
210+
longname precipitation name
211+
description REPLACE boundname {'{#1}': 'precipitation'}

doc/mf6io/mf6ivar/dfn/olf-flw.dfn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ tagged false
180180
in_record true
181181
reader urword
182182
time_series true
183-
longname well rate
184-
description is the volumetric inflow rate. A positive value indicates inflow to the stream. Negative values are not allows. If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value.
183+
longname flow rate
184+
description is the volumetric inflow rate. A positive value indicates inflow to the stream. Negative values are not allowed. If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value.
185185

186186
block period
187187
name aux

0 commit comments

Comments
 (0)