Skip to content
New issue

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

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

Already on GitHub? # to your account

mf2005 doesn't read the name file which I created in Tutorial1 #257

Closed
hjia1005 opened this issue Nov 7, 2017 · 4 comments
Closed

mf2005 doesn't read the name file which I created in Tutorial1 #257

hjia1005 opened this issue Nov 7, 2017 · 4 comments

Comments

@hjia1005
Copy link

hjia1005 commented Nov 7, 2017

I am new to flopy. Followed every step of tutorial #1, but mf2005 cannot read my name file. The name file does exist.

warning: assuming SpatialReference units are meters
FloPy is using the following executable to run the model: C:/D Drive/Program Files/mf2005/mf2005.exe

                              MODFLOW-2005     
U.S. GEOLOGICAL SURVEY MODULAR FINITE-DIFFERENCE GROUND-WATER FLOW MODEL
                         Version 1.8.00 12/18/2009                       

Enter the name of the NAME FILE:
forrtl: The pipe has been ended.
forrtl: severe (24): end-of-file during read, unit -4, file CONIN$
Image PC Routine Line Source
mf2005.exe 0081573A Unknown Unknown Unknown
mf2005.exe 00792950 Unknown Unknown Unknown
mf2005.exe 00791B2A Unknown Unknown Unknown
mf2005.exe 0075FD52 Unknown Unknown Unknown
mf2005.exe 0068AE76 Unknown Unknown Unknown
mf2005.exe 0068439D Unknown Unknown Unknown
mf2005.exe 0081FEE3 Unknown Unknown Unknown
mf2005.exe 007FC919 Unknown Unknown Unknown
kernel32.dll 755D336A Unknown Unknown Unknown
ntdll.dll 771698F2 Unknown Unknown Unknown
ntdll.dll 771698C5 Unknown Unknown Unknown

@langevin-usgs
Copy link
Contributor

Please paste your script into the issue here so we can see what the problem is.

@hjia1005
Copy link
Author

hjia1005 commented Nov 8, 2017

Hi thanks for the reply.

I was using exactly the same code from the tutorial 1 on this website (https://modflowpy.github.io/flopydoc/tutorial1.html). Just copied and paste them into a python file and save then run the file from Python IDLE.

Later I tried to run the file directly by double click it. Then the cmd window wants me to manually input the name of the model and I did so. Then it run the model properly.

My question is why Modflow doesn't pick up the name file automatically? That's where the problem was started.

Kind regards
hjia

@langevin-usgs
Copy link
Contributor

The following script works fine for me on Windows. I created the script by copying the lines directly from https://modflowpy.github.io/flopydoc/tutorial1.html. Note that you are using an old version of MODFLOW, but I don't think that is your problem.

import os
import sys
import numpy as np
flopypth = os.path.join('..', '..', 'flopy')
if flopypth not in sys.path:
    sys.path.append(flopypth)
import flopy

# Assign name and create modflow model object
modelname = 'tutorial1'
mf = flopy.modflow.Modflow(modelname, exe_name='mf2005')

# Model domain and grid definition
Lx = 1000.
Ly = 1000.
ztop = 0.
zbot = -50.
nlay = 1
nrow = 10
ncol = 10
delr = Lx/ncol
delc = Ly/nrow
delv = (ztop - zbot) / nlay
botm = np.linspace(ztop, zbot, nlay + 1)

# Create the discretization object
dis = flopy.modflow.ModflowDis(mf, nlay, nrow, ncol, delr=delr, delc=delc,
                               top=ztop, botm=botm[1:])
                               
# Variables for the BAS package
ibound = np.ones((nlay, nrow, ncol), dtype=np.int32)
ibound[:, :, 0] = -1
ibound[:, :, -1] = -1
strt = np.ones((nlay, nrow, ncol), dtype=np.float32)
strt[:, :, 0] = 10.
strt[:, :, -1] = 0.
bas = flopy.modflow.ModflowBas(mf, ibound=ibound, strt=strt)

# Add LPF package to the MODFLOW model
lpf = flopy.modflow.ModflowLpf(mf, hk=10., vka=10.)

# Add OC package to the MODFLOW model
oc = flopy.modflow.ModflowOc(mf)

# Add PCG package to the MODFLOW model
pcg = flopy.modflow.ModflowPcg(mf)


# Write the MODFLOW model input files
mf.write_input()

# Run the MODFLOW model
success, buff = mf.run_model()

import matplotlib.pyplot as plt
import flopy.utils.binaryfile as bf
plt.subplot(1,1,1,aspect='equal')
hds = bf.HeadFile(modelname+'.hds')
head = hds.get_data(totim=1.0)
levels = np.arange(1,10,1)
extent = (delr/2., Lx - delr/2., Ly - delc/2., delc/2.)
plt.contour(head[0, :, :], levels=levels, extent=extent)
plt.show()

image

screen shot 2017-11-08 at 8 44 16 am

@hjia1005
Copy link
Author

hjia1005 commented Nov 9, 2017

Hi,

Thanks a lot. I downloaded the latest MODFLOW 2005, it works now, reading the name file and run the model. But can only run the script in the command window. If run in IDLE, the problem remains. But it's not a problem to run in command window.

Your contribution and patience is appreciated!

Regards
hjia

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants