You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RTMF6 does not support hierarchical MODFLOW 6 input directories #10
Describe the bug
RTMF6 currently appears to assume that all MODFLOW 6 input files are located in a single directory. My MODFLOW 6 model uses a hierarchical directory structure, with files referenced from subdirectories and sub-subdirectories. MODFLOW 6 itself runs this setup correctly, but RTMF6 cannot resolve the referenced files.
To Reproduce
A MODFLOW6 model is attached that reproduces the behavior that has:
a minimal number of cells and layers (X=2, Y=3, Z=8);
Running the model with MODFLOW 6 confirms that it works.
However, the model in a RTMF6 configuration fails as RTMF6 expects all mf6 files to be in the same directory.
Expected behavior
RTMF6 should follow the relative file paths specified in the MODFLOW 6 name/input files, including references to files in subdirectories and sub-subdirectories.
Environment
MODFLOW6: 6.6.3
RTMF6: 0.1.0
Phreeqcrm: 0.0.16 (because 0.0.20 does not support multi threating)
Python: 3.1.4
iMOD-Python: 1.1.0
OS: Windows 11 Pro
Additional context
The attached minimal model contains no RTMF6 configuration. Its purpose is only to reproduce the hierarchical-path issue and potentially serve as an automated regression test.
I added support for hierarchical input file directories. In order to run this version on your model, I also need the file rtmf6.toml as well as the directories rtmf6 and phreeqcrm with their input files. @FTW12345 can you provide these files.
Uploaded a bit too quickly. Sorry. \mf6 did indeed contains a normal version (without rtmf6 modifications). I will upload the modified version tomorrow morning. That version does not contain yet any NaN values.
Herewith the RTMF6 model without NAN values: VMP_5_C15_CHD_RCH___RTMF6_without_NAN.zip.
Accordingly, I will replace the in issue #11 uploaded mf6 model by the RTMF6 model with NAN values.
rtmf6/init_exchanges.ic doesn't match the grid. It has about 5,300 values including NAN, but the model has 48 cells.
chd.chd has 46 periods but TDIS has nper 45.
SSM still reads CHD aux TDS and RCH auxmixed TDS. Since rtmf6 writes the concentrations into the concentration column, the run would use the original TDS values. SSM should reference concentration.
The PhreeqcRM directory needs to be named phreeqcrm not phreeqrcm.
Ad 1: rtmf6/init_exchanges.ic: Shortened to 48 cells.
Ad 2: chd.chd: Shortened to 45 periods.
Ad 3: ssm.ssm: Changed TDS to concentration.
Ad 4: PhreeqcRM directory: Corrected its name.
Testing the above mentioned model with RTMF6 0.2.0: RTMF6 expects to find the path ...\VMP_5_C15_CHD_RCH___RTMF6_without_NAN\mf6\VMP_5_gwf\VMP_5_gwf/dis/botm.dat, which has a double subdirectory and thus not exists in the model.
I cannot reproduce this problem. Does MODFLOW 6 run standalone, i.e. running mf6 from the directory VMP_5_C15_CHD_RCH___RTMF6_without_NAN\mf6 that contains mfsim.nam?
Does MODFLOW 6 run standalone ...?: Yes. mfsim.nam and VMP_5_gwf.nam?: See the uploaded RTMF6 model above (VMP_5_C15_CHD_RCH___RTMF6_without_NAN_B.zip) and the copies below.
mfsim.nam
begin options
end options
begin timing
tdis6 time_discretization.tdis
end timing
begin models
gwf6 VMP_5_gwf/VMP_5_gwf.nam VMP_5_gwf
gwt6 VMP_5_gwt/VMP_5_gwt.nam VMP_5_gwt
end models
begin exchanges
GWF6-GWT6 VMP_5_gwf_VMP_5_gwt.gwfgwt VMP_5_gwf VMP_5_gwt
end exchanges
begin solutiongroup 1
ims6 ims_gwf.ims VMP_5_gwf
ims6 ims_gwt.ims VMP_5_gwt
end solutiongroup
VMP_5_gwf.nam
begin options
end options
begin packages
dis6 VMP_5_gwf/dis.dis dis
ic6 VMP_5_gwf/ic.ic ic
npf6 VMP_5_gwf/npf.npf npf
sto6 VMP_5_gwf/sto.sto sto
chd6 VMP_5_gwf/chd.chd chd
rch6 VMP_5_gwf/rch.rch rch
oc6 VMP_5_gwf/oc.oc oc
end packages
I made a new project and installed version 0.2.0 with Pixi, i.e, the conda package, from anaconda.org. I downloaded the zip file above and unzipped it.
After changing EXCHANGE 1 to EXCHANGE 5 inVMP_5_C15_CHD_RCH___RTMF6_without_NAN/phreeqcrm/advect.pqi I run rtmf6 from the directory VMP_5_C15_CHD_RCH___RTMF6_without_NAN/ and get this:
(base) C:\Users\FTW\rtmf6_project>pixi run rtmf6 -V
rtmf6 version 0.2.0
(base) C:\Users\FTW\rtmf6_project>pixi run rtmf6 C:\IP_MF6\VMP_5_C15_CHD_RCH___RTMF6_without_NAN\rtmf6.toml
…
MFDataException: An error occurred in data element "botm" model "vmp_5_gwf" package "chd". The error occurred while
getting data in the "_get_data" method.
Additional Information:
(1) Unable to open file C:\IP_MF6\VMP_5_C15_CHD_RCH___RTMF6_without_NAN\mf6\VMP_5_gwf\VMP_5_gwf/dis/botm.dat in mode r.
Make sure the file is not locked and the folder exists.
(2) Error occurred while adding dataset "stress_period_data" to block "period"
Thus both installations result in the same error message with VMP_5_gwf\VMP_5_gwf.
I run the model on Windows (I usually develop on macOS) and found the problem. FloPy has problems handling paths that mix forward and backward slashes. This has no effect on unix-like system such macOS but on Windows. MODFLOW has no problems and iMOD seems to handle this situation too. I will prepare a PR for FloPy.
In the meanwhile, please replace mfdataplist.py and mfdatastorage.py in site-packages/flopy/mf6/data of you installation with these version.
I replaced mfdataplist.py and mfdatastorage.py in site-packages/flopy/mf6/data for both environments (C:\Users\FTW\.conda\envs\rtmf6_020 and C:\Users\FTW\rtmf6_project).
Good news: RTMF6 0.2.0 now supports running the RTMF6 model 'VMP_5_C15_CHD_RCH___RTMF6_without_NAN' in both environments.
(The RTMF6 model 'VMP_5_C15_CHD_RCH___RTMF6' does not yet run because of the NaN values in the model present (issue #11).)
Activity
pya commentedon Oct 17, 2026
@FTW12345 Thanks for reporting this problem. I will have look. May take few days until I get to it.
pya commentedon Oct 27, 2026
I added support for hierarchical input file directories. In order to run this version on your model, I also need the file
rtmf6.tomlas well as the directoriesrtmf6andphreeqcrmwith their input files. @FTW12345 can you provide these files.FTW12345 commentedon Oct 27, 2026
Herewith:
VMP_5_C15_Github_without_NAN_RTMF6.zip
pya commentedon Oct 27, 2026
Thanks @FTW12345. The MF6 model doesn't seem to be setup for rtmf6. For example, the
rtmf6.tomlspecifies the recharge:but the data looks like this:
but according to the
rtmf6.tomlit should look like this;Can you provide a version for a rtmf6 run.
FTW12345 commentedon Oct 27, 2026
Uploaded a bit too quickly. Sorry. \mf6 did indeed contains a normal version (without rtmf6 modifications). I will upload the modified version tomorrow morning. That version does not contain yet any NaN values.
FTW12345 commentedon Oct 28, 2026
Herewith the RTMF6 model without NAN values: VMP_5_C15_CHD_RCH___RTMF6_without_NAN.zip.
Accordingly, I will replace the in issue #11 uploaded mf6 model by the RTMF6 model with NAN values.
pya commentedon Oct 28, 2026
Thanks. There are still problems with the model:
rtmf6/init_exchanges.icdoesn't match the grid. It has about 5,300 values including NAN, but the model has 48 cells.chd.chdhas 46 periods but TDIS has nper 45.CHD aux TDSandRCH auxmixed TDS. Since rtmf6 writes the concentrations into the concentration column, the run would use the original TDS values. SSM should reference concentration.phreeqcrmnotphreeqrcm.FTW12345 commentedon Oct 28, 2026
Thanks. I will correct the model files and directory name.
FTW12345 commentedon Oct 28, 2026
Ad 1: rtmf6/init_exchanges.ic: Shortened to 48 cells.
Ad 2: chd.chd: Shortened to 45 periods.
Ad 3: ssm.ssm: Changed TDS to concentration.
Ad 4: PhreeqcRM directory: Corrected its name.
The corrected RTMF6 model: VMP_5_C15_CHD_RCH___RTMF6_without_NAN_B.zip
Accordingly, I have corrected the uploaded model in issues #11, #14 and #15 too.
pya commentedon Oct 29, 2026
New version 0.2.0 supports hierarchical MODFLOW 6 input directories
FTW12345 commentedon Oct 30, 2026
Testing the above mentioned model with RTMF6 0.2.0: RTMF6 expects to find the path ...\VMP_5_C15_CHD_RCH___RTMF6_without_NAN\mf6\VMP_5_gwf\VMP_5_gwf/dis/botm.dat, which has a double subdirectory and thus not exists in the model.
pya commentedon Oct 30, 2026
I cannot reproduce this problem. Does MODFLOW 6 run standalone, i.e. running
mf6from the directoryVMP_5_C15_CHD_RCH___RTMF6_without_NAN\mf6that containsmfsim.nam?FTW12345 commentedon Oct 30, 2026
Does MODFLOW 6 run standalone ...?: Yes.
mfsim.nam and VMP_5_gwf.nam?: See the uploaded RTMF6 model above (VMP_5_C15_CHD_RCH___RTMF6_without_NAN_B.zip) and the copies below.
mfsim.nam
begin options
end options
begin timing
tdis6 time_discretization.tdis
end timing
begin models
gwf6 VMP_5_gwf/VMP_5_gwf.nam VMP_5_gwf
gwt6 VMP_5_gwt/VMP_5_gwt.nam VMP_5_gwt
end models
begin exchanges
GWF6-GWT6 VMP_5_gwf_VMP_5_gwt.gwfgwt VMP_5_gwf VMP_5_gwt
end exchanges
begin solutiongroup 1
ims6 ims_gwf.ims VMP_5_gwf
ims6 ims_gwt.ims VMP_5_gwt
end solutiongroup
VMP_5_gwf.nam
begin options
end options
begin packages
dis6 VMP_5_gwf/dis.dis dis
ic6 VMP_5_gwf/ic.ic ic
npf6 VMP_5_gwf/npf.npf npf
sto6 VMP_5_gwf/sto.sto sto
chd6 VMP_5_gwf/chd.chd chd
rch6 VMP_5_gwf/rch.rch rch
oc6 VMP_5_gwf/oc.oc oc
end packages
pya commentedon Oct 30, 2026
I made a new project and installed version 0.2.0 with Pixi, i.e, the conda package, from anaconda.org. I downloaded the zip file above and unzipped it.
After changing
EXCHANGE 1toEXCHANGE 5inVMP_5_C15_CHD_RCH___RTMF6_without_NAN/phreeqcrm/advect.pqiI runrtmf6from the directoryVMP_5_C15_CHD_RCH___RTMF6_without_NAN/and get this:FTW12345 commentedon Oct 30, 2026
I installed Rtmf6 0.2.0 with conda:
conda config --add channels conda-forge
conda config --add channels hydrocomputing
conda create -n rtmf6_020 python=3.14
conda activate rtmf6_020
conda install rtmf6
Alas, I get still the same error message: RTMF6_error_message_30_10_2026.txt.
Therefore, I also installed RTMF6 0.2.0 with pixi:
(base) C:\Users\FTW>pixi init rtmf6_project
Created C:\Users\FTW\rtmf6_project\pixi.toml
(base) C:\Users\FTW>cd rtmf6_project
(base) C:\Users\FTW\rtmf6_project>pixi workspace channel add --prepend hydrocomputing
(base) C:\Users\FTW\rtmf6_project>pixi add rtmf6
(base) C:\Users\FTW\rtmf6_project>pixi run rtmf6 -V
rtmf6 version 0.2.0
(base) C:\Users\FTW\rtmf6_project>pixi run rtmf6 C:\IP_MF6\VMP_5_C15_CHD_RCH___RTMF6_without_NAN\rtmf6.toml
…
MFDataException: An error occurred in data element "botm" model "vmp_5_gwf" package "chd". The error occurred while
getting data in the "_get_data" method.
Additional Information:
(1) Unable to open file C:\IP_MF6\VMP_5_C15_CHD_RCH___RTMF6_without_NAN\mf6\VMP_5_gwf\VMP_5_gwf/dis/botm.dat in mode r.
Make sure the file is not locked and the folder exists.
(2) Error occurred while adding dataset "stress_period_data" to block "period"
Thus both installations result in the same error message with VMP_5_gwf\VMP_5_gwf.
pya commentedon Oct 31, 2026
I run the model on Windows (I usually develop on macOS) and found the problem. FloPy has problems handling paths that mix forward and backward slashes. This has no effect on unix-like system such macOS but on Windows. MODFLOW has no problems and iMOD seems to handle this situation too. I will prepare a PR for FloPy.
In the meanwhile, please replace mfdataplist.py and mfdatastorage.py in
site-packages/flopy/mf6/dataof you installation with these version.FTW12345 commentedon Oct 31, 2026
I replaced mfdataplist.py and mfdatastorage.py in site-packages/flopy/mf6/data for both environments (C:\Users\FTW\.conda\envs\rtmf6_020 and C:\Users\FTW\rtmf6_project).
Good news: RTMF6 0.2.0 now supports running the RTMF6 model 'VMP_5_C15_CHD_RCH___RTMF6_without_NAN' in both environments.
(The RTMF6 model 'VMP_5_C15_CHD_RCH___RTMF6' does not yet run because of the NaN values in the model present (issue #11).)
pya commentedon Oct 31, 2026
I submitted an issue and a PR for FloPy. Once it is merged, FloPy should work without copying the files.
pya commentedon Nov 1, 2026
My PR is already merged into
develop. So, the next FloPy release should work without patching. :)