Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Separate input and out files in different directories #2462

Open
pya opened this issue Mar 2, 2025 · 2 comments
Open

feature: Separate input and out files in different directories #2462

pya opened this issue Mar 2, 2025 · 2 comments
Milestone

Comments

@pya
Copy link
Contributor

pya commented Mar 2, 2025

Is your feature request related to a problem? Please describe.

Models tend to get big with many input and output files. Therefore, distributing files in directories and sub-directories can be helpful to organize a project. All examples I found so far use a flat directory structure, i.e. all input and output files are in one directory.

This is my attempt to separate input and output files.

This is the directory structure after running mf6:

├── input
│   ├── rivercond.chd
│   ├── rivercond.dis
│   ├── rivercond.dis.grb
│   ├── rivercond.ic
│   ├── rivercond.ims
│   ├── rivercond.nam
│   ├── rivercond.npf
│   ├── rivercond.oc
│   ├── rivercond.riv
│   └── rivercond.tdis
├── mfsim.lst
├── mfsim.nam
└── output
    ├── rivercond.cbc
    └── rivercond.hds

The content of mfsim.nam:

BEGIN options
  MEMORY_PRINT_OPTION  all
END options

BEGIN timing
  TDIS6  input/rivercond.tdis
END timing

BEGIN models
  gwf6  input/rivercond.nam  rivercond
END models

BEGIN exchanges
END exchanges

BEGIN solutiongroup  1
  ims6  input/rivercond.ims  rivercond
END solutiongroup  1             

rivercond.oc:

BEGIN options
  BUDGET  FILEOUT  output/rivercond.cbc
  HEAD  FILEOUT  output/rivercond.hds
END options

BEGIN period  1
  SAVE  head  all
  SAVE  budget  all
  PRINT  budget  all
END period  1                  

rivercond.nam:

BEGIN options
  PRINT_INPUT
  SAVE_FLOWS
END options

BEGIN packages
  DIS6  input/rivercond.dis  dis
  NPF6  input/rivercond.npf  npf
  IC6  input/rivercond.ic  ic
  RIV6  input/rivercond.riv  river
  CHD6  input/rivercond.chd  chd_0
  OC6  input/rivercond.oc  oc
END packages

This works. I guess this could be extend into a deeper structure that would allow to use the same input files for multiple models. For example, these models could share files for the model geometry and use specific files for some boundary conditions that are different for each model (variant).

Looking at the source of flopy, it seems that it always assumes a flat structure (i.e. all files in one directory) for model post processing such as plotting. I this correct?

Describe the solution you'd like

A flexible directory structure, that allows to distribute input and output files to specified directories would help to organize large models and scenario runs that modify only small parts of the input. Maybe this already possible but I don't know how to do it.

Describe alternatives you've considered

See problem description above.

Additional context

Test runs done with MF 6.6.

@pya pya added the enhancement label Mar 2, 2025
@wpbonelli wpbonelli added this to the 4.0 milestone Mar 2, 2025
@mwtoews
Copy link
Contributor

mwtoews commented Mar 2, 2025

Further to this idea is to use consistent filenames regardless of model name. For instance, a model with a groundwater-flow simulation could look like this:

Part of mfsim.nam:

BEGIN models
  gwf6  input/gwf.nam  rivercond
END models

Part of input/gwf.nam:

BEGIN packages
  DIS6  input/gwf.dis  dis
  NPF6  input/gwf.npf  npf
  IC6   input/gwf.ic   ic
  RIV6  input/gwf.riv  river
  CHD6  input/gwf.chd  chd_0
  OC6   input/gwf.oc   oc
END packages

and if there were a groundwater-transport component, the gwt.nam, gwt.dis, etc. files would be in the input directory.

However, there are many exceptions where there is more than one package per model (e.g. two WEL packages wells1.wel and wells2.wel), or nested groundwater-flow models (e.g. parent.nam and child.nam). So this simple approach is sometime too simple to use broadly.


One side observation is that input/rivercond.dis.grb is an output file that can only be suppressed with NOGRB. I'm not sure how to convince mf6 to output it separately.

@pya
Copy link
Contributor Author

pya commented Mar 3, 2025

Thanks for your suggestion. I tend to use the naming pattern gwf_modelname_suffix.*´, gwt_modelname_suffix.*, gwe_modelname_suffix.*´ etc. modelname is also the name of the base directory. Once parameterized with flopy, this should have the same benefits as using the same name stems for all model files across models. I realized that the *.dis.rgb file appears in the input directory. My approach would be a post-run cleanup step, moving to output. But flopy doesn't know this and would not find this file. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants