pmgbergen / porepy

Python Simulation Tool for Fractured and Deformable Porous Media

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Impossible to import single phase flow

Francyrad opened this issue · comments

Dear users, after putting this string as there is written in the tutorials:

from porepy.models.fluid_mass_balance import SinglePhaseFlow

I got the following error:

python3.10 test2.py
Traceback (most recent call last):
  File "/Users/francyrad/Documents/porepy/simulations/test2.py", line 3, in <module>
    from porepy.models.incompressible_flow_model import SinglePhaseFlow
ImportError: cannot import name 'SinglePhaseFlow' from 'porepy.models.incompressible_flow_model' (/opt/homebrew/lib/python3.10/site-packages/porepy/models/incompressible_flow_model.py)
francyrad@MacBook-Pro-di-Francesco simulations % python3.10 test2.py
Traceback (most recent call last):
  File "/Users/francyrad/Documents/porepy/simulations/test2.py", line 3, in <module>
    from porepy.models.fluid_mass_balance import SinglePhaseFlow
ModuleNotFoundError: No module named 'porepy.models.fluid_mass_balance'

Is there been an update and tutorials have not been updated?
Thank you for the availability

Dear Francesco,

Your first import will not work with the latest version of PorePy since incompressible_flow_model.py no longer exists. We have moved to a new way of defining models in PorePy (see the release notes https://github.com/pmgbergen/porepy/releases/tag/v1.7.0).

However, the second import, e.g.,

from porepy.models.fluid_mass_balance import SinglePhaseFlow

should work. At least, locally, I have no problems importing the class. My best guess is that you are having some issues with your installation.

P.D.: There is a tutorial on how to set up models, see e.g., https://github.com/pmgbergen/porepy/blob/develop/tutorials/single_phase_flow.ipynb.

I had installation issues with 4 different versions of python. I solved the problem. Thank you very much!