Skip to content

bug: flopy creates a column with "nan" values when assigning auxiliary variable in the EVT package #1782

@giovannifi

Description

@giovannifi

Describe the bug
I am building a flow+transpot model with Modflow 6 and I noticed a problem with the EVT package. I wanted to define 0 concentration to be extracted from the EVT. To do that I used the "auxiliary" variable option to be defined in the EVT package of the GWF model. By doing that I noticed that once the package is written there is, for each node where I define the evt, an additional and unwanted item at the end of each line with the value "nan". Is this the correct behaviour of the software?

To Reproduce
Steps to reproduce the behavior:

  1. Please run the code below where I built a dummy GWF model (only the flow model). I used pycharm and python 3.9 to run the code below. In the code below I define only one node with evapotranspiration.
import flopy
import numpy as np

path_ws = r'F:\Working_Folder\testing\test_evt'
name = "test_evt"
h1 = 100
h2 = 90
Nlay = 10
N = 101
L = 400.0
H = 50.0
k = 1.0

sim = flopy.mf6.MFSimulation(sim_name=name, exe_name="mf6", version="mf6", sim_ws=path_ws)

tdis = flopy.mf6.ModflowTdis(sim, pname="tdis", time_units="DAYS", nper=1, perioddata=[(1.0, 1, 1.0)])

ims = flopy.mf6.ModflowIms(sim, pname="ims", complexity="SIMPLE")

model_nam_file = "{}.nam".format(name)

gwf = flopy.mf6.ModflowGwf(sim, modelname=name, model_nam_file=model_nam_file, )

bot = np.linspace(-H / Nlay, -H, Nlay)
delrow = delcol = L / (N - 1)
dis = flopy.mf6.ModflowGwfdis(gwf,
                              nlay=Nlay,
                              nrow=N,
                              ncol=N,
                              delr=delrow,
                              delc=delcol,
                              top=0.0,
                              botm=bot,
                              )

start = h1 * np.ones((Nlay, N, N))
ic = flopy.mf6.ModflowGwfic(gwf, pname="ic", strt=start)

npf = flopy.mf6.ModflowGwfnpf(gwf, icelltype=1, k=k, save_flows=True)

chd_rec = []
chd_rec.append(((0, int(N / 4), int(N / 4)), h2))
for layer in range(0, Nlay):
    for row_col in range(0, N):
        chd_rec.append(((layer, row_col, 0), h1))
        chd_rec.append(((layer, row_col, N - 1), h1))
        if row_col != 0 and row_col != N - 1:
            chd_rec.append(((layer, 0, row_col), h1))
            chd_rec.append(((layer, N - 1, row_col), h1))

chd = flopy.mf6.ModflowGwfchd(gwf,
                              maxbound=len(chd_rec),
                              stress_period_data=chd_rec,
                              save_flows=True,
                              )

iper = 0
ra = chd.stress_period_data.get_data(key=iper)

# Create the output control (`OC`) Package
headfile = "{}.hds".format(name)
head_filerecord = [headfile]
budgetfile = "{}.cbb".format(name)
budget_filerecord = [budgetfile]
saverecord = [("HEAD", "ALL"), ("BUDGET", "ALL")]
printrecord = [("HEAD", "LAST")]
oc = flopy.mf6.ModflowGwfoc(
    gwf,
    saverecord=saverecord,
    head_filerecord=head_filerecord,
    budget_filerecord=budget_filerecord,
    printrecord=printrecord,
)

rate = 0.001
ex_depth = 5.
concentration = 0.
evt = flopy.mf6.ModflowGwfevt(gwf,
                              maxbound=1,
                              nseg=1,
                              stress_period_data={0: [0, 0, 0, 0.0, rate, ex_depth, concentration]},
                              auxiliary='concentration'
                              )

sim.write_simulation()
  1. open the generated EVT package and you will notice the "nan" values.

Expected behavior
I would expect the EVT to be created without the "nan" values.

Desktop (please complete the following information):

  • OS: windows 10
  • Browser: chrome
  • python version: 3.9
  • flopy version: 3.3.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions