Skip to content

Commit

Permalink
feat(lnf): update n-point geometry package data
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhughes-usgs committed Feb 26, 2020
1 parent 6872df8 commit 3460cfb
Show file tree
Hide file tree
Showing 77 changed files with 2,170 additions and 23 deletions.
218 changes: 218 additions & 0 deletions autotest/test_lnf_disl01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
import os
import numpy as np

try:
import pymake
except:
msg = 'Error. Pymake package is not available.\n'
msg += 'Try installing using the following command:\n'
msg += ' pip install https://github.com/modflowpy/pymake/zipball/master'
raise Exception(msg)

try:
import flopy
except:
msg = 'Error. FloPy package is not available.\n'
msg += 'Try installing using the following command:\n'
msg += ' pip install flopy'
raise Exception(msg)

from framework import testing_framework
from simulation import Simulation

ex = ['lnf_disl01']
exdirs = []
for s in ex:
exdirs.append(os.path.join('temp', s))

## run all examples on Travis
travis = [True for idx in range(len(exdirs))]

# set replace_exe to None to use default executable
replace_exe = None

# static model data
# spatial discretization
nodes, nvert = 8, 29

# all cells are active
ib = 1

# vertices and cell1d
vertices = [(0, 0., 6000., 100.),
(1, 1000., 5000., 99.),
(2, 2000., 4000., 98.),
(3, 2000., 3000., 98.),
(4, 2000., 3000., 98.),
(5, 3000., 1000., 97.),
(6, 4000., 1000., 96.),
(7, 5000., 1000., 95.),
(8, 6000., 1000., 94.),
(9, 7000., 1000., 93.),
(10, 8000., 2000., 92.),
(11, 3000., 4000., 97.),
(12, 4000., 4000., 97.),
(13, 5000., 4000., 95.),
(14, 6000., 5000., 94.),
(15, 7000., 5000., 93.),
(16, 8000., 5000., 92.),
(17, 9000., 5000., 91.),
(18, 10000., 5000., 90.),
(19, 11000., 5000., 89.),
(20, 12000., 5000., 88.),
(21, 6000., 3000., 94.),
(22, 7000., 2000., 93.),
(23, 9000., 2000., 91.),
(24, 10000., 2000., 90.),
(25, 11000., 2000., 89.),
(26, 12000., 2000., 88.),
(27, 13000., 5000., 87.),
(28, 13000., 2000., 87.)]

cell1d = [(0, 0.5, 3, 0, 1, 2),
(1, 0.5, 9, 2, 3, 4, 5, 6, 7, 8, 9, 10),
(2, 0.5, 4, 2, 11, 12, 13),
(3, 0.5, 8, 13, 14, 15, 16, 17, 18, 19, 20),
(4, 0.5, 4, 13, 21, 22, 10),
(5, 0.5, 5, 26, 25, 24, 23, 10),
(6, 1.0, 2, 20, 27),
(7, 0.0, 2, 28, 26)]

# geometry data
gdc = [((0,), 0.5),
((1,), 0.6),
((2,), 0.7),
((3,), 1.5)]
gdr = [((3,), 1.5, 1.4),
((6,), 1.5, 1.5),
((5,), 1.4, 1.3)]
gdn = [(7, 5, 1., 1., 2.5, 2.5, 1., 1.5, 0., 0., 1.5, 1.5)]

# temporal discretization
nper = 1
perlen, nstp, tsmult = 1., 1, 1.
tdis_rc = (perlen, nstp, tsmult)

# solver parameters
nouter, ninner = 500, 300
hclose, rclose, relax = 1e-9, 1e-6, 1.

# starting heads
strt = 101.

# chd data
chd_dict = {0: [((6,), 88., 'coastal'),
((7,), 88.25, 'coastal')]}


# SUB package problem 3
def get_model(idx, dir):
name = ex[idx]

# build MODFLOW 6 files
ws = dir
sim = flopy.mf6.MFSimulation(sim_name=name, version='mf6',
exe_name='mf6',
sim_ws=ws)
# create tdis package
tdis = flopy.mf6.ModflowTdis(sim, time_units='DAYS',
nper=nper, perioddata=tdis_rc)

# create iterative model solution
ims = flopy.mf6.ModflowIms(sim, print_option='SUMMARY',
outer_hclose=hclose,
outer_maximum=nouter,
inner_maximum=ninner,
inner_hclose=hclose, rcloserecord=rclose,
linear_acceleration='CG',
relaxation_factor=relax)

# create gwf model
lnf = flopy.mf6.ModflowLnf(sim, modelname=name, save_flows=True)

dis = flopy.mf6.ModflowLnfdisl(lnf, length_units='METERS',
nodes=nodes, nvert=nvert,
# idomain=1, # for scott to fix
vertices=vertices,
cell1d=cell1d)

# create geometry packages # for scott to fix
cgeo = flopy.mf6.ModflowLnfcgeo(lnf, geometry_data=gdc)
rgeo = flopy.mf6.ModflowLnfrgeo(lnf, geometry_data=gdr)
ngeo = flopy.mf6.ModflowLnfngeo(lnf, geometry_data=gdn)

# initial conditions
ic = flopy.mf6.ModflowLnfic(lnf, strt=strt)

# # chd files
# chd = flopy.mf6.ModflowLnfchd(lnf, stress_period_data=chd_dict,
# boundnames=True)

# output control
oc = flopy.mf6.ModflowLnfoc(lnf,
budget_filerecord='{}.cbc'.format(name),
head_filerecord='{}.hds'.format(name),
headprintrecord=[
('COLUMNS', 10, 'WIDTH', 15,
'DIGITS', 6, 'GENERAL')],
saverecord=[('HEAD', 'ALL'),
('BUDGET', 'ALL')],
printrecord=[('HEAD', 'LAST'),
('BUDGET', 'ALL')])

return sim, None


# - No need to change any code below
def build_models():
for idx, dir in enumerate(exdirs):
sim, mc = get_model(idx, dir)
sim.write_simulation()
if mc is not None:
mc.write_input()
return


def test_mf6model():
# determine if running on Travis
is_travis = 'TRAVIS' in os.environ

# initialize testing framework
test = testing_framework()

# build the models
build_models()

# run the test models
# for idx, dir in enumerate(exdirs):
# if is_travis and not travis[idx]:
# continue
# yield test.run_mf6, Simulation(dir, exfunc=None,
# exe_dict=None,
# idxsim=idx)

return


def main():
# initialize testing framework
test = testing_framework()

# build the models
build_models()

# # run the test models
# for idx, dir in enumerate(exdirs):
# sim = Simulation(dir, exfunc=None,
# exe_dict=None, idxsim=idx)
# test.run_mf6(sim)

return


if __name__ == "__main__":
# print message
print('standalone run of {}'.format(os.path.basename(__file__)))

# run main routine
main()
Binary file added doc/mf6io/Figures/DISL_example.pdf
Binary file not shown.
5 changes: 5 additions & 0 deletions doc/mf6io/body.tex
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
\SECTION{Groundwater Flow (GWF) Model Input}
\input{gwf/gwf.tex}

%LNF Model Input Instructions
\newpage
\SECTION{Linear Network Flow (LNF) Model Input}
\input{lnf/lnf.tex}

%Sparse Matrix Solution (IMS)
\newpage
\SECTION{Iterative Model Solution}
Expand Down
17 changes: 17 additions & 0 deletions doc/mf6io/lnf/cgeo.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Circular geometry information for DISL grids is read from the file that is specified by ``CGEO6'' as the file type.

\vspace{5mm}
\subsubsection{Structure of Blocks}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/lnf-cgeo-options.dat}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/lnf-cgeo-dimensions.dat}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/lnf-cgeo-packagedata.dat}

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

\vspace{5mm}
\subsubsection{Example Input File}
\lstinputlisting[style=inputfile]{./mf6ivar/examples/lnf-cgeo-example.dat}
49 changes: 49 additions & 0 deletions doc/mf6io/lnf/chd.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

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. In \mf a constant-head cell will become active again if it is not included as a constant-head cell in subsequent stress periods. 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.

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

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

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

\vspace{5mm}
\subsubsection{Example Input File}
\lstinputlisting[style=inputfile]{./mf6ivar/examples/lnf-chd-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 LNF 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/lnf-chd-example-obs.dat}

27 changes: 27 additions & 0 deletions doc/mf6io/lnf/disl.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Discretization information for DISL grids is read from the file that is specified by ``DISL6'' as the file type. The approach for numbering cell and cell vertices for the DISL Package is shown in figure~\ref{fig:disl_example}. The list of vertices for a cell must be listed in the order that defines the line representing the cell.

\begin{figure}[ht]
\centering
\includegraphics[scale=1.0]{Figures/DISL_example}
\caption{Schematic diagram showing the vertices and cells defined using the Linear Discretization Package. The list of vertices used to define each cell ordered in either an upstream or downstream direction. From \cite{modflow6gwf}}
\label{fig:disl_example}
\end{figure}


\vspace{5mm}
\subsubsection{Structure of Blocks}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/lnf-disl-options.dat}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/lnf-disl-dimensions.dat}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/lnf-disl-griddata.dat}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/lnf-disl-vertices.dat}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/lnf-disl-cell1d.dat}

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

\vspace{5mm}
\subsubsection{Example Input File}
\lstinputlisting[style=inputfile]{./mf6ivar/examples/lnf-disl-example.dat}
17 changes: 17 additions & 0 deletions doc/mf6io/lnf/ic.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Initial Conditions (IC) Package information is read from the file that is specified by ``IC6'' as the file type. Only one IC Package can be specified for a LNF model.

\vspace{5mm}
\subsubsection{Structure of Blocks}
%\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/gwf-ic-options.dat}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/lnf-ic-griddata.dat}

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

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

54 changes: 54 additions & 0 deletions doc/mf6io/lnf/lnf.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
This section describes the data files for a \mf Groundwater Transport (GWT) Model. A GWT Model is added to the simulation by including a GWT entry in the MODELS block of the simulation name file.

There a single type of spatial discretization approaches that can be used with the LNF Model: DISL.

The LNF Model is designed to permit input to be gathered, as it is needed, from many different files. Likewise, results from the model calculations can be written to a number of output files. The LNF Model Listing File is a key file to which the LNF model output is written. As \mf runs, information about the LNF Model is written to the LNF Model Listing File, including much of the input data (as a record of the simulation) and calculated results. Details about the files used by each package are provided in this section on the LNF Model Instructions.

The LNF Model reads a file called the Name File, which specifies most of the files that will be used in a simulation. Several files are always required whereas other files are optional depending on the simulation. The Output Control Package receives instructions from the user to control the amount and frequency of output. Details about the Name File and the Output Control Package are described in this section.


\subsection{Units of Length and Time}
The GWF Model formulates the groundwater flow equation without using prescribed length and time units. Any consistent units of length and time can be used when specifying the input data for a simulation. This capability gives a certain amount of freedom to the user, but care must be exercised to avoid mixing units. The program cannot detect the use of inconsistent units.

\subsection{Steady-State Simulations}
A steady-state transport simulation is represented by a single stress period having a single time step with the storage term set to zero. Setting the number and length of stress periods and time steps is the responsibility of the Timing Module of the \mf framework.

\subsection{Volumetric Budget}
A summary of all inflow (sources) and outflow (sinks) of solute mass is called a mass budget. \mf calculates a mass budget for the overall model as a check on the acceptability of the solution, and to provide a summary of the sources and sinks of mass to the flow system. The solute mass budget is printed to the LNF Model Listing File for selected time steps.

\subsection{Time Stepping}


\newpage
\subsection{LNF Model Name File}
\input{lnf/namefile.tex}

\newpage
\subsection{Linear Discretization with Vertices (DISL) Input File}
\input{lnf/disl}

\newpage
\subsection{Circular Geometry (CGEO) Input File}
\input{lnf/cgeo}

\newpage
\subsection{Rectangular Geometry (RGEO) Input File}
\input{lnf/rgeo}

\newpage
\subsection{N-Point Cross-Section Geometry (NGEO) Input File}
\input{lnf/ngeo}

\newpage
\subsection{Initial Conditions (IC) Package}
\input{lnf/ic}

\newpage
\subsection{Output Control (OC) Option}
\input{lnf/oc}

\newpage
\subsection{Constant-Head (CHD) Package}
\input{lnf/chd}


Loading

0 comments on commit 3460cfb

Please sign in to comment.