Skip to content

Commit

Permalink
feat(mf6): Add MODFLOW 6 GWT dfn and classes
Browse files Browse the repository at this point in the history
black reformatting
  • Loading branch information
jdhughes-usgs committed Oct 20, 2020
1 parent 5ca8f25 commit f81630d
Show file tree
Hide file tree
Showing 58 changed files with 13,849 additions and 4,691 deletions.
134 changes: 103 additions & 31 deletions flopy/mf6/modflow/mfgnc.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,46 +92,118 @@ class ModflowGnc(mfpackage.MFPackage):
Package name for this package.
parent_file : MFPackage
Parent package file that references this package. Only needed for
utility packages (mfutl*). For example, mfutllaktab package must have
utility packages (mfutl*). For example, mfutllaktab package must have
a mfgwflak package parent_file.
"""
gncdata = ListTemplateGenerator(('gnc', 'gncdata', 'gncdata'))

gncdata = ListTemplateGenerator(("gnc", "gncdata", "gncdata"))
package_abbr = "gnc"
_package_type = "gnc"
dfn_file_name = "gwf-gnc.dfn"

dfn = [["block options", "name print_input", "type keyword",
"reader urword", "optional true"],
["block options", "name print_flows", "type keyword",
"reader urword", "optional true"],
["block options", "name explicit", "type keyword", "tagged true",
"reader urword", "optional true"],
["block dimensions", "name numgnc", "type integer",
"reader urword", "optional false"],
["block dimensions", "name numalphaj", "type integer",
"reader urword", "optional false"],
["block gncdata", "name gncdata",
dfn = [
[
"block options",
"name print_input",
"type keyword",
"reader urword",
"optional true",
],
[
"block options",
"name print_flows",
"type keyword",
"reader urword",
"optional true",
],
[
"block options",
"name explicit",
"type keyword",
"tagged true",
"reader urword",
"optional true",
],
[
"block dimensions",
"name numgnc",
"type integer",
"reader urword",
"optional false",
],
[
"block dimensions",
"name numalphaj",
"type integer",
"reader urword",
"optional false",
],
[
"block gncdata",
"name gncdata",
"type recarray cellidn cellidm cellidsj alphasj",
"shape (maxbound)", "reader urword"],
["block gncdata", "name cellidn", "type integer", "shape",
"tagged false", "in_record true", "reader urword",
"numeric_index true"],
["block gncdata", "name cellidm", "type integer", "shape",
"tagged false", "in_record true", "reader urword",
"numeric_index true"],
["block gncdata", "name cellidsj", "type integer",
"shape (numalphaj)", "tagged false", "in_record true",
"reader urword", "numeric_index true"],
["block gncdata", "name alphasj", "type double precision",
"shape (numalphaj)", "tagged false", "in_record true",
"reader urword"]]
"shape (maxbound)",
"reader urword",
],
[
"block gncdata",
"name cellidn",
"type integer",
"shape",
"tagged false",
"in_record true",
"reader urword",
"numeric_index true",
],
[
"block gncdata",
"name cellidm",
"type integer",
"shape",
"tagged false",
"in_record true",
"reader urword",
"numeric_index true",
],
[
"block gncdata",
"name cellidsj",
"type integer",
"shape (numalphaj)",
"tagged false",
"in_record true",
"reader urword",
"numeric_index true",
],
[
"block gncdata",
"name alphasj",
"type double precision",
"shape (numalphaj)",
"tagged false",
"in_record true",
"reader urword",
],
]

def __init__(self, simulation, loading_package=False, print_input=None,
print_flows=None, explicit=None, numgnc=None, numalphaj=None,
gncdata=None, filename=None, pname=None, parent_file=None):
super(ModflowGnc, self).__init__(simulation, "gnc", filename, pname,
loading_package, parent_file)
def __init__(
self,
simulation,
loading_package=False,
print_input=None,
print_flows=None,
explicit=None,
numgnc=None,
numalphaj=None,
gncdata=None,
filename=None,
pname=None,
parent_file=None,
):
super(ModflowGnc, self).__init__(
simulation, "gnc", filename, pname, loading_package, parent_file
)

# set up variables
self.print_input = self.build_mfdata("print_input", print_input)
Expand Down
71 changes: 52 additions & 19 deletions flopy/mf6/modflow/mfgwf.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,35 @@ class ModflowGwf(mfmodel.MFModel):
model_ws : string, strict : boolean) : MFSimulation
a class method that loads a model from files
"""
model_type = 'gwf'

def __init__(self, simulation, modelname='model', model_nam_file=None,
version='mf6', exe_name='mf6.exe', model_rel_path='.',
list=None, print_input=None, print_flows=None,
save_flows=None, newtonoptions=None, packages=None, **kwargs):
super(ModflowGwf, self).__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)
model_type = "gwf"

def __init__(
self,
simulation,
modelname="model",
model_nam_file=None,
version="mf6",
exe_name="mf6.exe",
model_rel_path=".",
list=None,
print_input=None,
print_flows=None,
save_flows=None,
newtonoptions=None,
packages=None,
**kwargs
):
super(ModflowGwf, self).__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.name_file.print_input.set_data(print_input)
Expand All @@ -94,11 +111,27 @@ def __init__(self, simulation, modelname='model', model_nam_file=None,
self.name_file.packages.set_data(packages)

@classmethod
def load(cls, simulation, structure, modelname='NewModel',
model_nam_file='modflowtest.nam', version='mf6',
exe_name='mf6.exe', strict=True, model_rel_path='.',
load_only=None):
return mfmodel.MFModel.load_base(simulation, structure, modelname,
model_nam_file, 'gwf', version,
exe_name, strict, model_rel_path,
load_only)
def load(
cls,
simulation,
structure,
modelname="NewModel",
model_nam_file="modflowtest.nam",
version="mf6",
exe_name="mf6.exe",
strict=True,
model_rel_path=".",
load_only=None,
):
return mfmodel.MFModel.load_base(
simulation,
structure,
modelname,
model_nam_file,
"gwf",
version,
exe_name,
strict,
model_rel_path,
load_only,
)
Loading

0 comments on commit f81630d

Please sign in to comment.