Skip to content

NAM file not up to date after calling rename_all_packages()? #1133

@dbrakenhoff

Description

@dbrakenhoff

I was attempting something along the following lines:

  1. Load existing model.
  2. Rename model and update working directory.
  3. Write model to new directory and run simulation.

I was hoping something along these lines would be possible and I managed to sort of get that working with e.g.:

sim = flopy.mf6.MFSimulation.load("mfsim.nam", sim_ws="./model")
gwf = sim.get_model("test")

# ...
# add/modify something in gwf model
# ...

sim.rename_all_packages("test2")
sim.set_sim_path("./model2")

sim.write_simulation()
sim.run_simulation()

This writes model input files to my new working directory with the new name I specified. The trouble is that the Simulation NAM-file still contains references to the old gwf model name, while all the files now have the new name. And the same goes for the GWF NAM-file. Is there a way to update the model name such that the nam-files point to the new file names and I can use sim.run_simulation() directly to run the new copy of the model?

I'm not sure if flopy + mf6 was designed to work this way, but figured I'd ask.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions