Skip to content

RTMF6 does not support hierarchical MODFLOW 6 input directories #10

Closed

Description

@FTW12345

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:

  1. a minimal number of cells and layers (X=2, Y=3, Z=8);
  2. two active boundary packages (CHD and RCH).

The model is attached as zip file: VMP_5_C15_Github_without_NAN.zip

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.

Activity

  1. added theissue type on Oct 11, 2026
  2. self-assigned this
    on Oct 17, 2026
  3. pya commented on Oct 17, 2026

    @pya
    Contributor

    @FTW12345 Thanks for reporting this problem. I will have look. May take few days until I get to it.

  4. pya commented on Oct 27, 2026

    @pya
    Contributor

    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.

  5. FTW12345 commented on Oct 27, 2026

    @FTW12345
    Author
  6. pya commented on Oct 27, 2026

    @pya
    Contributor

    Thanks @FTW12345. The MF6 model doesn't seem to be setup for rtmf6. For example, the rtmf6.toml specifies the recharge:

    [[bc_concentrations]]
    model_name = "VMP_5_gwf"
    bc_type = "RCH"
    file_name = "mf6/VMP_5_gwf/rch.rch"
    src = "rtmf6_sol_number" 						#3 = RCH = Precipitation
    dst = "concentration"

    but the data looks like this:

    begin options
      auxiliary TDS
      save_flows
    end options  
    
    # layer row column rate TDS
    1 1 1 0.00129695050418376923 0.804153025150299072
    1 3 2 0.00113675533793866634 0.70482558012008667                                                      
    

    but according to the rtmf6.toml it should look like this;

    BEGIN options
      auxiliary  CONCENTRATION  rtmf6_sol_number
    END options     
    
    # layer row column rate CONCENTRATION  rtmf6_sol_number
    1 1 1 .00129695050418376923 0.0 3
    1 3 2 0.00113675533793866634 0.0 3                                                      
    

    Can you provide a version for a rtmf6 run.

  7. FTW12345 commented on Oct 27, 2026

    @FTW12345
    Author

    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.

  8. FTW12345 commented on Oct 28, 2026

    @FTW12345
    Author

    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.

  9. added
    enhancementNew feature or request
    and removed
    bugSomething isn't working
    on Oct 28, 2026
  10. changed the issue type fromtoon Oct 28, 2026
  11. pya commented on Oct 28, 2026

    @pya
    Contributor

    Thanks. There are still problems with the model:

    1. rtmf6/init_exchanges.ic doesn't match the grid. It has about 5,300 values including NAN, but the model has 48 cells.
    2. chd.chd has 46 periods but TDIS has nper 45.
    3. 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.
    4. The PhreeqcRM directory needs to be named phreeqcrm not phreeqrcm.
  12. FTW12345 commented on Oct 28, 2026

    @FTW12345
    Author

    Thanks. I will correct the model files and directory name.

  13. FTW12345 commented on Oct 28, 2026

    @FTW12345
    Author

    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.

  14. pya commented on Oct 29, 2026

    @pya
    Contributor

    New version 0.2.0 supports hierarchical MODFLOW 6 input directories

  15. FTW12345 commented on Oct 30, 2026

    @FTW12345
    Author

    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.

  16. reopened this on Oct 30, 2026
  17. pya commented on Oct 30, 2026

    @pya
    Contributor

    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?

  18. FTW12345 commented on Oct 30, 2026

    @FTW12345
    Author

    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

  19. pya commented on Oct 30, 2026

    @pya
    Contributor

    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:

    rtmf6 
    rtmf6 - A reactive transport model based on MODFLOW 6 and PhreeqcRM.
    Creating input files...
    Running rtmf6...
    stress period:     1
    step:     2
    stress period:     2
    step:     5
    stress period:     3
    step:     8
    stress period:     4
    step:    11
    stress period:     5
    step:    14
    stress period:     6
    step:    17
    stress period:     7
    step:    20
    stress period:     8
    step:    23
    stress period:     9
    step:    26
    stress period:    10
    step:    29
    stress period:    11
    step:    32
    stress period:    12
    step:    35
    stress period:    13
    step:    38
    stress period:    14
    step:    41
    stress period:    15
    step:    44
    stress period:    16
    step:    47
    stress period:    17
    step:    50
    stress period:    18
    step:    53
    stress period:    19
    step:    56
    stress period:    20
    step:    59
    stress period:    21
    step:    62
    stress period:    22
    step:    65
    stress period:    23
    step:    68
    stress period:    24
    step:    71
    stress period:    25
    step:    74
    stress period:    26
    step:    77
    stress period:    27
    step:    80
    stress period:    28
    step:    83
    stress period:    29
    step:    86
    stress period:    30
    step:    89
    stress period:    31
    step:    92
    stress period:    32
    step:    95
    stress period:    33
    step:    98
    stress period:    34
    step:   101
    stress period:    35
    step:   104
    stress period:    36
    step:   107
    stress period:    37
    step:   110
    stress period:    38
    step:   113
    stress period:    39
    step:   116
    stress period:    40
    step:   119
    stress period:    41
    step:   122
    stress period:    42
    step:   125
    stress period:    43
    step:   128
    stress period:    44
    step:   131
    stress period:    45
    step:   134
    rtmf6 run complete.
    
  20. FTW12345 commented on Oct 30, 2026

    @FTW12345
    Author

    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.

  21. pya commented on Oct 31, 2026

    @pya
    Contributor

    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.

  22. FTW12345 commented on Oct 31, 2026

    @FTW12345
    Author

    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).)

  23. pya commented on Oct 31, 2026

    @pya
    Contributor

    I submitted an issue and a PR for FloPy. Once it is merged, FloPy should work without copying the files.

  24. pya commented on Nov 1, 2026

    @pya
    Contributor

    My PR is already merged into develop. So, the next FloPy release should work without patching. :)

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions