Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion autotest/test_gwf_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import numpy as np
import pytest
from flopy.utils.gridutil import get_disu_kwargs
from framework import DNODATA


def run_mf6(argv, ws):
Expand Down Expand Up @@ -101,7 +102,10 @@ def get_minimal_gwf_simulation(
disu = flopy.mf6.ModflowGwfdisu(gwf, **disukwargs)
ic = flopy.mf6.ModflowGwfic(gwf, **ickwargs)
npf = flopy.mf6.ModflowGwfnpf(gwf, **npfkwargs)
chd = flopy.mf6.modflow.mfgwfchd.ModflowGwfchd(gwf, **chdkwargs)
if "readarraygrid" in chdkwargs:
chd = flopy.mf6.modflow.mfgwfchdg.ModflowGwfchdg(gwf, **chdkwargs)
else:
chd = flopy.mf6.modflow.mfgwfchd.ModflowGwfchd(gwf, **chdkwargs)
return sim


Expand Down Expand Up @@ -142,6 +146,27 @@ def test_sim_errors(function_tmpdir, targets):
run_mf6_error(str(function_tmpdir), mf6, err_str)


def test_sim_errors_grid(function_tmpdir, targets):
mf6 = targets["mf6"]

with pytest.raises(RuntimeError):
# verify that the correct number of errors are reported
chdkwargs = {}
head = np.full((5, 5, 5), DNODATA, dtype=float)
for i in range(5):
head[0, i, 0] = 2.0
chdkwargs["readarraygrid"] = True
chdkwargs["head"] = head
sim = get_minimal_gwf_simulation(
str(function_tmpdir), exe=mf6, chdkwargs=chdkwargs
)
test_model = sim.get_model("test")
chd2 = flopy.mf6.modflow.mfgwfchdg.ModflowGwfchdg(test_model, **chdkwargs)
sim.write_simulation()
err_str = ["1. Cell is already a constant head ((1,1,1))."]
run_mf6_error(str(function_tmpdir), mf6, err_str)


def test_sim_maxerrors(function_tmpdir, targets):
mf6 = targets["mf6"]

Expand Down
2 changes: 2 additions & 0 deletions doc/mf6io/gwf/chd.tex
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

Input to the Constant-Head (CHD) Package is read from the file that has type ``CHD6'' in the Name File. Any number of CHD Packages can be specified for a single groundwater flow model; however, an error will occur if a CHD Package attempts to make a GWF cell a constant-head cell when that cell has already been designated as a constant-head cell either within the present CHD Package or within another CHD Package.

Constant-Head input can be specified using lists or arrays. List-based input for the CHD package is the default, and is described here. Instructions for specifying array-based CHD input are described in the next section.

In previous MODFLOW versions, it was not possible to convert a constant-head cell to an active cell. Once a cell was designated as a constant-head cell, it remained a constant-head cell until the end of the end of the simulation. In \mf a constant-head cell will become active again if it is not included as a constant-head cell in subsequent stress periods.

Previous MODFLOW versions allowed specification of SHEAD and EHEAD, which were the starting and ending prescribed heads for a stress period. Linear interpolation was used to calculate a value for each time step. In \mf only a single head value can be specified for any constant-head cell in any stress period. The time-series functionality must be used in order to interpolate values to individual time steps.
Expand Down
57 changes: 57 additions & 0 deletions doc/mf6io/gwf/chdg.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

Input to the Constant-Head (CHD) Package is read from the file that has type ``CHD6'' in the Name File. Any number of CHD Packages can be specified for a single groundwater flow model; however, an error will occur if a CHD Package attempts to make a GWF cell a constant-head cell when that cell has already been designated as a constant-head cell either within the present CHD Package or within another CHD Package.

Constant-Head Boundary input can be specified using lists or grid arrays. Grid array-based input for the CHD package is activated by providing READARRAYGRID within the OPTIONS block. Instructions for specifying list-based constant-head boundaries is described in the previous section.

When grid array-based input is used for constant-head boundaries, the DIMENSIONS block is optional. The input array size is determined from the model grid. Cells that define no data should contain the DNODATA (3.0E+30) value. When defined, the MAXBOUND dimension represents the maximum number of defined constant-head boundary (non-DNODATA) cells found in any stress period. Defining MAXBOUND can reduce the memory footprint of the grid array-based CHD package, especially when the input grid arrays are sparse and the model grid is large.

In previous MODFLOW versions, it was not possible to convert a constant-head cell to an active cell. Once a cell was designated as a constant-head cell, it remained a constant-head cell until the end of the end of the simulation. In \mf a constant-head cell will become active again if it is not included as a constant-head cell in subsequent stress periods.

Previous MODFLOW versions allowed specification of SHEAD and EHEAD, which were the starting and ending prescribed heads for a stress period. Linear interpolation was used to calculate a value for each time step. In \mf only a single head value can be specified for any constant-head cell in any stress period.

\vspace{5mm}
\subsubsection{Structure of Blocks}
\vspace{5mm}

\noindent \textit{FOR EACH SIMULATION}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/gwf-chdg-options.dat}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/gwf-chdg-dimensions.dat}
\vspace{5mm}
\noindent \textit{FOR ANY STRESS PERIOD}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/gwf-chdg-period.dat}
\packageperioddescription

\vspace{5mm}
\subsubsection{Explanation of Variables}
\begin{description}
\input{./mf6ivar/tex/gwf-chdg-desc.tex}
\end{description}

\vspace{5mm}
\subsubsection{Example Input File}
\lstinputlisting[style=inputfile]{./mf6ivar/examples/gwf-chdg-example.dat}

\vspace{5mm}
\subsubsection{Available observation types}
CHD Package observations are limited to the simulated constant head flow rate (\texttt{chd}). The data required for the CHD Package observation type is defined in table~\ref{table:gwf-chdobstype}. Negative and positive values for an observation represent a loss from and gain to the GWF model, respectively.

\begin{longtable}{p{2cm} p{2.75cm} p{2cm} p{1.25cm} p{7cm}}
\caption{Available CHD Package observation types} \tabularnewline

\hline
\hline
\textbf{Model} & \textbf{Observation type} & \textbf{ID} & \textbf{ID2} & \textbf{Description} \\
\hline
\endhead

\hline
\endfoot

\input{../Common/gwf-chdobs.tex}
\label{table:gwf-chdobstype}
\end{longtable}

\vspace{5mm}
\subsubsection{Example Observation Input File}
\lstinputlisting[style=inputfile]{./mf6ivar/examples/gwf-chdg-example-obs.dat}

2 changes: 2 additions & 0 deletions doc/mf6io/gwf/drn.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Input to the Drain (DRN) Package is read from the file that has type ``DRN6'' in the Name File. Any number of DRN Packages can be specified for a single groundwater flow model.

Drain input can be specified using lists or arrays. List-based input for the DRN package is the default, and is described here. Instructions for specifying array-based DRN input are described in the next section.

\vspace{5mm}
\subsubsection{Structure of Blocks}
\vspace{5mm}
Expand Down
52 changes: 52 additions & 0 deletions doc/mf6io/gwf/drng.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Input to the Drain (DRN) Package is read from the file that has type ``DRN6'' in the Name File. Any number of DRN Packages can be specified for a single groundwater flow model.

Drain input can be specified using lists or grid arrays. Grid array-based input for the DRN package is activated by providing READARRAYGRID within the OPTIONS block. Instructions for specifying list-based drain input is described in the previous section.

When grid array-based input is used for the drain package, the DIMENSIONS block is optional. The input array size is determined from the model grid. Cells that define no data should contain the DNODATA (3.0E+30) value. When defined, the MAXBOUND dimension represents the maximum number of defined drain (non-DNODATA) cells found in any stress period. Defining MAXBOUND can reduce the memory footprint of the grid array-based DRN package, especially when the input grid arrays are sparse and the model grid is large.

\vspace{5mm}
\subsubsection{Structure of Blocks}
\vspace{5mm}

\noindent \textit{FOR EACH SIMULATION}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/gwf-drng-options.dat}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/gwf-drng-dimensions.dat}
\vspace{5mm}
\noindent \textit{FOR ANY STRESS PERIOD}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/gwf-drng-period.dat}
\packageperioddescription

\vspace{5mm}
\subsubsection{Explanation of Variables}
\begin{description}
\input{./mf6ivar/tex/gwf-drng-desc.tex}
\end{description}

\vspace{5mm}
\subsubsection{Example Input File}
\lstinputlisting[style=inputfile]{./mf6ivar/examples/gwf-drng-example.dat}

\vspace{5mm}
\subsubsection{Available observation types}
Drain Package observations include the simulated drain rates (\texttt{drn}) and the drain discharge that is available for the MVR package (\texttt{to-mvr}). The data required for each DRN Package observation type is defined in table~\ref{table:gwf-drnobstype}. The sum of \texttt{drn} and \texttt{to-mvr} is equal to the simulated drain discharge rate for a drain boundary or group of drain boundaries.

\begin{longtable}{p{2cm} p{2.75cm} p{2cm} p{1.25cm} p{7cm}}
\caption{Available DRN Package observation types} \tabularnewline

\hline
\hline
\textbf{Model} & \textbf{Observation type} & \textbf{ID} & \textbf{ID2} & \textbf{Description} \\
\hline
\endhead

\hline
\endfoot

DRN & drn & cellid or boundname & -- & Flow between the groundwater system and a drain boundary or group of drain boundaries. \\
DRN & to-mvr & cellid or boundname & -- & Drain boundary discharge that is available for the MVR package for a drain boundary or a group of drain boundaries.
\label{table:gwf-drnobstype}
\end{longtable}

\vspace{5mm}
\subsubsection{Example Observation Input File}
\lstinputlisting[style=inputfile]{./mf6ivar/examples/gwf-drng-example-obs.dat}
2 changes: 1 addition & 1 deletion doc/mf6io/gwf/evt.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Evapotranspiration input can be specified using lists or arrays, unless the DISU Package is used. List-based input must be used if discretization is specified using the DISU Package. List-based input for evapotranspiration is the default, and is described here. Instructions for specifying array-based evapotranspiration are described in the next section.

List-based input offers several advantages over the array-based input for specifying evapotranspiration. First, multiple list entries can be specified for a single cell. This makes it possible to divide a cell into multiple areas, and assign a different evapotranspiration rate or extinction depth for each area (perhaps based on vegetation type or some other criteria). In this case, the user would likely specify an auxiliary variable to serve as a multiplier. This multiplier would be calculated by the user and provided in the input file as the fractional cell are for the individual evapotranspiration entries. Another advantage to using list-based input for specifying evapotranspiration is that boundnames can be specified. Boundnames work with the Observations capability and can be used to sum evapotranspiration rates for entries with the same boundname. A disadvantage of the list-based input is that one cannot easily assign evapotranspiration to the entire model without specifying a list of model cells. For this reason \mf also supports array-based input for evapotranspiration.
List-based input offers several advantages over the array-based input for specifying evapotranspiration. First, multiple list entries can be specified for a single cell. This makes it possible to divide a cell into multiple areas, and assign a different evapotranspiration rate or extinction depth for each area (perhaps based on vegetation type or some other criteria). In this case, the user would likely specify an auxiliary variable to serve as a multiplier. This multiplier would be calculated by the user and provided in the input file as the fractional cell area for the individual evapotranspiration entries. Another advantage to using list-based input for specifying evapotranspiration is that boundnames can be specified. Boundnames work with the Observations capability and can be used to sum evapotranspiration rates for entries with the same boundname. A disadvantage of the list-based input is that one cannot easily assign evapotranspiration to the entire model without specifying a list of model cells. For this reason \mf also supports array-based input for evapotranspiration.

ET input is read in list form, as shown in the PERIOD block below. Each line in the PERIOD block defines all input for one cell. Entries following \texttt{cellid}, in order, define the ET surface (\texttt{etss}), maximum ET flux rate (\texttt{etsr}), extinction depth (\texttt{etsx}), all (\texttt{netseg} -- 1) \texttt{pxdp} values, all (\texttt{netseg} -- 1) \texttt{petm} values, all auxiliary variables (if AUXILIARY option is specified), and boundary name (if BOUNDNAMES option is specified).

Expand Down
4 changes: 2 additions & 2 deletions doc/mf6io/gwf/evta.tex
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Input to the Evapotranspiration (EVT) Package is read from the file that has type ``EVT6'' in the Name File. Any number of EVT Packages can be specified for a single groundwater flow model. All single-valued variables are free format.

Evapotranspiration input can be specified using lists or arrays. Array-based input for evapotranspiration is activated by providing READASARRAYS within the OPTIONS block. Instructions for specifying list-based evapotranspiration is described in the previous section. Array-based input for evapotranspiration provides a similar approach for providing evapotranspiration rates as previous MODFLOW versions. Array-based input for evapotranspiration can be used only with the DIS and DISV Packages. Array-based input for evapotranspiration cannot be used with the DISU Package.
Evapotranspiration input can be specified using lists or layer arrays. Layer array-based input for evapotranspiration is activated by providing READASARRAYS within the OPTIONS block. Instructions for specifying list-based evapotranspiration is described in the previous section. Layer array-based input for evapotranspiration provides a similar approach for providing evapotranspiration rates as previous MODFLOW versions. Layer array-based input for evapotranspiration can be used only with the DIS and DISV Packages. Layer array-based input for evapotranspiration cannot be used with the DISU Package.

When array-based input is used for evapotranspiration, the DIMENSIONS block should not be specified. The array size is determined from the model grid. Segmented evapotranspiration cannot be used with the READASARRAYS option.
When layer array-based input is used for evapotranspiration, the DIMENSIONS block should not be specified. The array size is determined from the model grid. Segmented evapotranspiration cannot be used with the READASARRAYS option.

\vspace{5mm}
\subsubsection{Structure of Blocks}
Expand Down
2 changes: 2 additions & 0 deletions doc/mf6io/gwf/ghb.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Input to the General-Head Boundary (GHB) Package is read from the file that has type ``GHB6'' in the Name File. Any number of GHB Packages can be specified for a single groundwater flow model.

General-Head Boundary input can be specified using lists or arrays. List-based input for the GHB package is the default, and is described here. Instructions for specifying array-based GHB input are described in the next section.

\vspace{5mm}
\subsubsection{Structure of Blocks}
\vspace{5mm}
Expand Down
51 changes: 51 additions & 0 deletions doc/mf6io/gwf/ghbg.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Input to the General-Head Boundary (GHB) Package is read from the file that has type ``GHB6'' in the Name File. Any number of GHB Packages can be specified for a single groundwater flow model.

General-Head Boundary input can be specified using lists or grid arrays. Grid array-based input for the GHB package is activated by providing READARRAYGRID within the OPTIONS block. Instructions for specifying list-based general-head boundaries is described in the previous section.

When grid array-based input is used for general-head boundaries, the DIMENSIONS block is optional. The input array size is determined from the model grid. Cells that define no data should contain the DNODATA (3.0E+30) value. When defined, the MAXBOUND dimension represents the maximum number of defined general-head boundary (non-DNODATA) cells found in any stress period. Defining MAXBOUND can reduce the memory footprint of the grid array-based GHB package, especially when the input grid arrays are sparse and the model grid is large.

\vspace{5mm}
\subsubsection{Structure of Blocks}
\vspace{5mm}

\noindent \textit{FOR EACH SIMULATION}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/gwf-ghbg-options.dat}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/gwf-ghbg-dimensions.dat}
\vspace{5mm}
\noindent \textit{FOR ANY STRESS PERIOD}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/gwf-ghbg-period.dat}
\packageperioddescription

\vspace{5mm}
\subsubsection{Explanation of Variables}
\begin{description}
\input{./mf6ivar/tex/gwf-ghbg-desc.tex}
\end{description}

\vspace{5mm}
\subsubsection{Example Input File}
\lstinputlisting[style=inputfile]{./mf6ivar/examples/gwf-ghbg-example.dat}

\vspace{5mm}
\subsubsection{Available observation types}
General-Head Boundary Package observations include the simulated general-head boundary flow rates (\texttt{ghb}) and the general-head boundary discharge that is available for the MVR package (\texttt{to-mvr}). The data required for each GHB Package observation type is defined in table~\ref{table:gwf-ghbobstype}. The sum of \texttt{ghb} and \texttt{to-mvr} is equal to the simulated general-head boundary flow rate. Negative and positive values for an observation represent a loss from and gain to the GWF model, respectively.

\begin{longtable}{p{2cm} p{2.75cm} p{2cm} p{1.25cm} p{7cm}}
\caption{Available GHB Package observation types} \tabularnewline

\hline
\hline
\textbf{Stress Package} & \textbf{Observation type} & \textbf{ID} & \textbf{ID2} & \textbf{Description} \\
\hline
\endhead

\hline
\endfoot

\input{../Common/gwf-ghbobs.tex}
\label{table:gwf-ghbobstype}
\end{longtable}

\vspace{5mm}
\subsubsection{Example Observation Input File}
\lstinputlisting[style=inputfile]{./mf6ivar/examples/gwf-ghbg-example-obs.dat}
34 changes: 27 additions & 7 deletions doc/mf6io/gwf/gwf.tex
Original file line number Diff line number Diff line change
Expand Up @@ -112,39 +112,59 @@ \subsection{Viscosity (VSC) Package}
\input{gwf/vsc}

\newpage
\subsection{Constant-Head (CHD) Package}
\subsection{Constant-Head (CHD) Package -- List-Based Input}
\input{gwf/chd}

\newpage
\subsection{Well (WEL) Package}
\subsection{Constant-Head (CHD) Package -- Grid Array-Based Input}
\input{gwf/chdg}

\newpage
\subsection{Well (WEL) Package -- List-Based Input}
\input{gwf/wel}

\newpage
\subsection{Drain (DRN) Package}
\subsection{Well (WEL) Package -- Grid Array-Based Input}
\input{gwf/welg}

\newpage
\subsection{Drain (DRN) Package -- List-Based Input}
\input{gwf/drn}

\newpage
\subsection{River (RIV) Package}
\subsection{Drain (DRN) Package -- Grid Array-Based Input}
\input{gwf/drng}

\newpage
\subsection{River (RIV) Package -- List-Based Input}
\input{gwf/riv}

\newpage
\subsection{General-Head Boundary (GHB) Package}
\subsection{River (RIV) Package -- Grid Array-Based Input}
\input{gwf/rivg}

\newpage
\subsection{General-Head Boundary (GHB) Package -- List-Based Input}
\input{gwf/ghb}

\newpage
\subsection{General-Head Boundary (GHB) Package -- Grid Array-Based Input}
\input{gwf/ghbg}

\newpage
\subsection{Recharge (RCH) Package -- List-Based Input}
\input{gwf/rch}

\newpage
\subsection{Recharge (RCH) Package -- Array-Based Input}
\subsection{Recharge (RCH) Package -- Layer Array-Based Input}
\input{gwf/rcha}

\newpage
\subsection{Evapotranspiration (EVT) Package -- List-Based Input}
\input{gwf/evt}

\newpage
\subsection{Evapotranspiration (EVT) Package -- Array-Based Input}
\subsection{Evapotranspiration (EVT) Package -- Layer Array-Based Input}
\input{gwf/evta}

\newpage
Expand Down
Loading
Loading