Skip to content
Merged
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
23 changes: 22 additions & 1 deletion autotest/test_model_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
def test_structured_model_splitter(function_tmpdir):
sim_path = get_example_data_path() / "mf6-freyberg"

from pathlib import Path

function_tmpdir = Path("./temp")

split_path = function_tmpdir / "split_model"

sim = MFSimulation.load(sim_ws=sim_path)
sim.set_sim_path(function_tmpdir)
sim.write_simulation()
Expand All @@ -32,7 +38,7 @@ def test_structured_model_splitter(function_tmpdir):
mfsplit = Mf6Splitter(sim)
new_sim = mfsplit.split_model(array)

new_sim.set_sim_path(function_tmpdir / "split_model")
new_sim.set_sim_path(split_path)
new_sim.write_simulation()
new_sim.run_simulation()

Expand All @@ -49,6 +55,21 @@ def test_structured_model_splitter(function_tmpdir):
err_msg = "Heads from original and split models do not match"
np.testing.assert_allclose(new_heads, original_heads, err_msg=err_msg)

# test that line length is ncol for each model....
ll_dict = {
split_path / "freyberg_001.npf": ml0.dis.ncol.get_data(),
split_path / "freyberg_100.npf": ml1.dis.ncol.get_data(),
}
for f, ncol in ll_dict.items():
with open(f) as foo:
while "internal" not in foo.readline().lower():
continue

line = foo.readline().strip()
tmp = line.split()
if len(tmp) != ncol:
raise AssertionError("Array column length is not equal to ncol")


@requires_exe("mf6")
def test_vertex_model_splitter(function_tmpdir):
Expand Down
7 changes: 7 additions & 0 deletions flopy/mf6/mfmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,13 @@ def write(self, ext_file_action=ExtFileAction.copy_relative_paths):

self.name_file.write(ext_file_action=ext_file_action)

if not self.simulation_data.max_columns_user_set:
grid_type = self.get_grid_type()
if grid_type == DiscretizationType.DIS:
self.simulation_data.max_columns_of_data = self.dis.ncol.get_data()
self.simulation_data.max_columns_user_set = False
self.simulation_data.max_columns_auto_set = True

# write packages
for pp in self.packagelist:
if (
Expand Down
Loading