diff --git a/scripts/ex-prt-mp7-p01.py b/scripts/ex-prt-mp7-p01.py index cac97ee5..c15feb2e 100644 --- a/scripts/ex-prt-mp7-p01.py +++ b/scripts/ex-prt-mp7-p01.py @@ -988,4 +988,4 @@ def scenario(silent=False): # We are now ready to run the example problem. Subproblems 1A and 1B are solved by a single MODFLOW 6 run and a single MODPATH 7 run, so they are included under one "scenario". Each of the two subproblems is represented by its own particle release package (for MODFLOW 6) or particle group (for MODPATH 7). -scenario(silent=True) +scenario() diff --git a/scripts/ex-prt-mp7-p02.py b/scripts/ex-prt-mp7-p02.py index d9d5cf4c..79fe8eaa 100644 --- a/scripts/ex-prt-mp7-p02.py +++ b/scripts/ex-prt-mp7-p02.py @@ -32,7 +32,6 @@ from pprint import pformat import flopy -import flopy.utils.binaryfile as bf import git import matplotlib as mpl import matplotlib.pyplot as plt @@ -464,11 +463,13 @@ def add_prp(part): # Instantiate the MODFLOW 6 prt flow model interface # using "time-reversed" budget and head files + gwf_headfile = f"{gwf_name}.hds" + gwf_budgetfile = f"{gwf_name}.cbb" pd = [ - ("GWFHEAD", Path(f"../{gwf_ws.name}/{headfile_bkwd}")), - ("GWFBUDGET", Path(f"../{gwf_ws.name}/{budgetfile_bkwd}")), + ("GWFHEAD", Path(f"../{gwf_ws.name}/{gwf_headfile}")), + ("GWFBUDGET", Path(f"../{gwf_ws.name}/{gwf_budgetfile}")), ] - flopy.mf6.ModflowPrtfmi(prt, packagedata=pd) + flopy.mf6.ModflowPrtfmi(prt, packagedata=pd, backward=True) # Create an explicit model solution (EMS) for the MODFLOW 6 prt model ems = flopy.mf6.ModflowEms( @@ -547,32 +548,9 @@ def run_models(*sims, silent=False): success, buff = sim.run_model(silent=silent, report=True) assert success, pformat(buff) - if "gwf" in sim.name: - # Reverse budget and head files for backward tracking - reverse_budgetfile(gwf_ws / budgetfile, gwf_ws / budgetfile_bkwd, sim.tdis) - reverse_headfile(gwf_ws / headfile, gwf_ws / headfile_bkwd, sim.tdis) - - -# - - -# Because this problem tracks particles backwards, we need to reverse the head and budget files after running the groundwater flow model and before running the particle tracking model. Define functions to do this. - -# + - - -def reverse_budgetfile(fpth, rev_fpth, tdis): - f = bf.CellBudgetFile(fpth, tdis=tdis) - f.reverse(rev_fpth) - - -def reverse_headfile(fpth, rev_fpth, tdis): - f = bf.HeadFile(fpth, tdis=tdis) - f.reverse(rev_fpth) - # - - # Define a function to load pathline data from MODFLOW 6 PRT and MODPATH 7 pathline files. # + diff --git a/scripts/ex-prt-mp7-p03.py b/scripts/ex-prt-mp7-p03.py index a69b9238..be6271b8 100644 --- a/scripts/ex-prt-mp7-p03.py +++ b/scripts/ex-prt-mp7-p03.py @@ -939,4 +939,4 @@ def scenario(silent=False): # Run the MODPATH 7 example problem 3 scenario. -scenario(silent=True) +scenario() diff --git a/scripts/ex-prt-mp7-p04.py b/scripts/ex-prt-mp7-p04.py index 2e250135..ce3eb18a 100644 --- a/scripts/ex-prt-mp7-p04.py +++ b/scripts/ex-prt-mp7-p04.py @@ -22,7 +22,6 @@ from pprint import pformat import flopy -import flopy.utils.binaryfile as bf import git import matplotlib as mpl import matplotlib.pyplot as plt @@ -609,9 +608,10 @@ def build_prt(): flopy.mf6.ModflowPrtfmi( prt, packagedata=[ - ("GWFHEAD", Path(f"../{gwf_ws.name}/{headfile_bkwd}")), - ("GWFBUDGET", Path(f"../{gwf_ws.name}/{budgetfile_bkwd}")), + ("GWFHEAD", Path(f"../{gwf_ws.name}/{headfile}")), + ("GWFBUDGET", Path(f"../{gwf_ws.name}/{budgetfile}")), ], + backward=True, ) # Create an explicit model solution (EMS) for the MODFLOW 6 prt model @@ -658,16 +658,6 @@ def build_models(): return gwfsim, prtsim, mp7sim -def reverse_budgetfile(fpth, rev_fpth, tdis): - f = bf.CellBudgetFile(fpth, tdis=tdis) - f.reverse(rev_fpth) - - -def reverse_headfile(fpth, rev_fpth, tdis): - f = bf.HeadFile(fpth, tdis=tdis) - f.reverse(rev_fpth) - - def write_models(*sims, silent=False): for sim in sims: if isinstance(sim, MFSimulation): @@ -685,11 +675,6 @@ def run_models(*sims, silent=False): success, buff = sim.run_model(silent=silent, report=True) assert success, pformat(buff) - if "gwf" in sim.name: - # Reverse budget and head files for backward tracking - reverse_budgetfile(gwf_ws / budgetfile, gwf_ws / budgetfile_bkwd, sim.tdis) - reverse_headfile(gwf_ws / headfile, gwf_ws / headfile_bkwd, sim.tdis) - # - @@ -960,6 +945,6 @@ def scenario(silent=False): # Now run the scenario for example problem 4. -scenario(silent=False) +scenario() # -