# autogenerated file, do not modify
from os import PathLike, curdir
from typing import Union
from flopy.mf6.data.mfdatautil import ArrayTemplateGenerator, ListTemplateGenerator
from flopy.mf6.mfmodel import MFModel
[docs]class ModflowGwf(MFModel):
"""
ModflowGwf defines a GWF model.
Parameters
----------
simulation : MFSimulation
Simulation object that this model is a part of.
modelname : str, default "model"
Name of the model.
model_nam_file : str, optional
Relative path to the model name file from model working folder.
version : str, default "mf6"
Version of modflow.
exe_name : str, default "mf6"
Model executable name.
model_rel_path : str or PathLike, default "." (curdir)
Relative path of model folder to simulation folder.
list : string
is name of the listing file to create for this gwf model. if not specified,
then the name of the list file will be the basename of the gwf model name file
and the '.lst' extension. for example, if the gwf name file is called
'my.model.nam' then the list file will be called 'my.model.lst'.
print_input : keyword
keyword to indicate that the list of all model stress package information will
be written to the listing file immediately after it is read.
print_flows : keyword
keyword to indicate that the list of all model package flow rates will be
printed to the listing file for every stress period time step in which 'budget
print' is specified in output control. if there is no output control option
and 'print_flows' is specified, then flow rates are printed for the last time
step of each stress period.
save_flows : keyword
keyword to indicate that all model package flow terms will be written to the
file specified with 'budget fileout' in output control.
newtonoptions : (newton, under_relaxation)
none
* newton : keyword
keyword that activates the Newton-Raphson formulation for groundwater flow
between connected, convertible groundwater cells and stress packages that
support calculation of Newton-Raphson terms for groundwater exchanges. Cells
will not dry when this option is used. By default, the Newton-Raphson
formulation is not applied.
* under_relaxation : keyword
keyword that indicates whether the groundwater head in a cell will be under-
relaxed when water levels fall below the bottom of the model below any given
cell. By default, Newton-Raphson UNDER_RELAXATION is not applied.
nc_mesh2d_filerecord : record
netcdf layered mesh fileout record.
nc_structured_filerecord : record
netcdf structured fileout record.
nc_filerecord : record
netcdf filerecord
packages : [(ftype, fname, pname)]
* ftype : string
is the file type, which must be one of the following character values shown in
table ref{table:ftype-gwf}. Ftype may be entered in any combination of
uppercase and lowercase.
* fname : string
is the name of the file containing the package input. The path to the file
should be included if the file is not located in the folder where the program
was run.
* pname : string
is the user-defined name for the package. PNAME is restricted to 16 characters.
No spaces are allowed in PNAME. PNAME character values are read and stored by
the program for stress packages only. These names may be useful for labeling
purposes when multiple stress packages of the same type are located within a
single GWF Model. If PNAME is specified for a stress package, then PNAME will
be used in the flow budget table in the listing file; it will also be used for
the text entry in the cell-by-cell budget file. PNAME is case insensitive and
is stored in all upper case letters.
**kwargs
Extra keywords for :class:`flopy.mf6.mfmodel.MFModel`.
"""
model_type = "gwf"
def __init__(
self,
simulation,
modelname="model",
model_nam_file=None,
version="mf6",
exe_name="mf6",
model_rel_path=curdir,
list=None,
print_input=None,
print_flows=None,
save_flows=None,
newtonoptions=None,
nc_mesh2d_filerecord=None,
nc_structured_filerecord=None,
nc_filerecord=None,
**kwargs,
):
"""Initialize ModflowGwf."""
super().__init__(
simulation,
model_type="gwf6",
modelname=modelname,
model_nam_file=model_nam_file,
version=version,
exe_name=exe_name,
model_rel_path=model_rel_path,
**kwargs,
)
self.name_file.list.set_data(list)
self.list = self.name_file.list
self.name_file.print_input.set_data(print_input)
self.print_input = self.name_file.print_input
self.name_file.print_flows.set_data(print_flows)
self.print_flows = self.name_file.print_flows
self.name_file.save_flows.set_data(save_flows)
self.save_flows = self.name_file.save_flows
self.name_file.newtonoptions.set_data(newtonoptions)
self.newtonoptions = self.name_file.newtonoptions
self.name_file.nc_mesh2d_filerecord.set_data(nc_mesh2d_filerecord)
self.nc_mesh2d_filerecord = self.name_file.nc_mesh2d_filerecord
self.name_file.nc_structured_filerecord.set_data(nc_structured_filerecord)
self.nc_structured_filerecord = self.name_file.nc_structured_filerecord
self.name_file.nc_filerecord.set_data(nc_filerecord)
self.nc_filerecord = self.name_file.nc_filerecord
[docs] @classmethod
def load(
cls,
simulation,
structure,
modelname="NewModel",
model_nam_file="modflowtest.nam",
version="mf6",
exe_name="mf6",
strict=True,
model_rel_path=curdir,
load_only=None,
):
"""
Load an existing ModflowGwf model.
Parameters
----------
simulation : MFSimulation
Simulation object that this model is a part of.
structure : MFModelStructure
Structure of this type of model.
modelname : str, default "NewModel"
Name of the model.
model_nam_file : str, default "modflowtest.nam"
Relative path to the model name file from model working folder.
version : str, default "mf6"
Version of modflow.
exe_name : str or PathLike, default "mf6"
Model executable name or path.
strict : bool, default True
Strict mode when loading files.
model_rel_path : str or PathLike, default "." (curdir)
Relative path of model folder to simulation folder.
load_only : list of str, optional
Packages to load (e.g. ['btn', 'adv']). Default None
means that all packages will be loaded.
"""
return MFModel.load_base(
cls,
simulation,
structure,
modelname,
model_nam_file,
"gwf6",
version,
exe_name,
strict,
model_rel_path,
load_only,
)