jonghyunharrylee/pyPCGA

No mf.hds output file

Opened this issue · 2 comments

Amazing project!
I just compiled mf2005 on debian 11 and can run it just fine but I can't run the inversion in this example, because Modflow doesn't create a head file (I am using Python 3.9.13). All the input files are properly generated, but I think that the simulation doesn't terminate.
Have you noted this before?
Bernard

FileNotFoundError Traceback (most recent call last)
Cell In [2], line 1
----> 1 s_hat, simul_obs, post_diagv, iter_best = prob.Run()

File ~/anaconda3/envs/hlflopy/lib/python3.9/site-packages/pyPCGA/pcga.py:1334, in PCGA.Run(self)
1331 if self.priorU is None or self.priord is None:
1332 self.ComputePriorEig()
-> 1334 s_hat, simul_obs, post_diagv, iter_best = self.GaussNewton()
1335 #start = time()
1336 print("** Total elapsed time is %f secs" % (time()-start))

File ~/anaconda3/envs/hlflopy/lib/python3.9/site-packages/pyPCGA/pcga.py:1219, in PCGA.GaussNewton(self)
1216 print('##### 4. Start PCGA Inversion #####')
1217 print('-- evaluate initial solution')
-> 1219 simul_obs_init = self.ForwardSolve(s_init)
1220 self.simul_obs_init = simul_obs_init
1221 RMSE_init = np.linalg.norm(simul_obs_init-self.obs)/np.sqrt(n)

File ~/anaconda3/envs/hlflopy/lib/python3.9/site-packages/pyPCGA/pcga.py:379, in PCGA.ForwardSolve(self, s)
377 else:
378 with HiddenPrints():
--> 379 simul_obs = self.forward_model(s,par)
381 simul_obs = simul_obs.reshape(-1,1)
383 return simul_obs
...
--> 218 f = open(filename, "rb")
219 f.seek(0, 2)
220 totalbytes = f.tell()

FileNotFoundError: [Errno 2] No such file or directory: '/home/berna/modflow/pyPCGA/examples/modflow_flopy/simul/simul0000/mf.hds'

Sorry for the late reply. Can you also send me your flopy version to reproduce the error? I will test it on colab.

I tested the modflow_flopy inversion example and successfully reproduced the results on Colab with python==3.7.15/flopy==3.3.5 on Ubuntu 18.03. Below is the colab link. The script will take ~15 mins since the colab basic account request only 1 physical core/notebook:

https://colab.research.google.com/drive/1djVDZNjh390czXlzBbu7FvRQne9mf8SP?usp=sharing

My suggestions are

  1. recompile mf2005 on your machine (use mfpymake) and copy it to ./input_files/ folder and run the script again.
  2. if it does not work, create a virtual env with python 3.7.15 (and recompile mf2005) and test the script.

Best,
Harry