Re: [fipy] Problem in opening of mesh file by FiPy Gmsh3D module

97 views
Skip to first unread message
Message has been deleted

Guyer, Jonathan E. Dr. (Fed)

unread,
Mar 31, 2021, 7:22:00 PM3/31/21
to FIPY
It seems like we keep having the same conversation. The answer remains the same: contact ITASCA for support. They have embedded very old versions of FiPy that we don’t support. FiPy is free and open. There is zero reason not to upgrade to what we do support.

- FiPy 3.1 is eight years old. Don’t use it. We don’t support it.

- This line:

File "C:\Program Files\Itasca\PFC700\exe64\python36\lib\site-packages\fipy\meshes\gmshMesh.py", line 124, in openMSHFile
    if version < StrictVersion("2.0"):
means that you’ve now got FiPy 3.3. That’s two years old. Don’t use it. We don’t support it.

- Even in FiPy 3.3, `version` is a StrictVersion object, not a float, so the error you get is impossible.

- However, in your own script, this line of code breaks FiPy and returns a float, causing the error.
fp.meshes.gmshMesh._gmshVersion = lambda **kwargs: 2.0
Don’t do that.



On Mar 31, 2021, at 7:04 PM, Ali Sheikholeslam <sheikhol...@gmail.com> wrote:

I have written a question in:

I'm trying to couple ITASCA software named PFC v7 demo with FiPy using PFC embedded python environment to solve a coupled solid-fluid interaction. The mesh file and a short sample code is as follows:

https://drive.google.com/file/d/1O89bRXT7xu_msMJda4QJmi1wCSuy5xze/view?usp=sharing

import fipy as fp
fp.meshes.gmshMesh._gmshVersion = lambda **kwargs: 2.0
def Mesh():
    print("Test")
    mesh = fp.Gmsh3D('small.msh')
    print("Ok")
Mesh()

or

if __name__ == '__main__':
    import fipy as fp
    fp.meshes.gmshMesh._gmshVersion = lambda **kwargs: 2.0
    class DD(object):
        def __init__(self):
            print("Test")
            self.mesh = fp.Gmsh3D('small.msh')
            print("Ok")
    solver = DD()

I have simulated the coupling with PFC v5 (where python v: 2.7.9, FiPy v: 3.1, and numpy v: 1.9.2) and v6 (where python v: 3.6.1, FiPy v: 3.1, and numpy v: 1.13) before. In PFC v7, where python and its libraries are the same version as PFC v6, I have got the following error:

Traceback (most recent call last):
  File "'<itasca-code-1-fa569b32e3be>'", line 151, in <module>
  File "'<itasca-code-1-fa569b32e3be>'", line 13, in __init__
  File "C:\Program Files\Itasca\PFC700\exe64\python36\lib\site-packages\fipy\meshes\gmshMesh.py", line 1948, in __init__
    background=background)
  File "C:\Program Files\Itasca\PFC700\exe64\python36\lib\site-packages\fipy\meshes\gmshMesh.py", line 124, in openMSHFile
    if version < StrictVersion("2.0"):
  File "C:\Program Files\Itasca\PFC700\exe64\python36\lib\distutils\version.py", line 64, in __gt__
    c = self._cmp(other)
  File "C:\Program Files\Itasca\PFC700\exe64\python36\lib\distutils\version.py", line 170, in _cmp
    if self.version != other.version:
AttributeError: 'float' object has no attribute 'version'

I'm guessing it is related to FiPy mesh file opening because my code stopped at there (error is related to: line 136, https://github.com/usnistgov/fipy/blob/master/fipy/meshes/gmshMesh.py), where the code reach self.mesh = fp.Gmsh3D('small.msh'), and mesh elements were not applied even by mesh file location addressing; the mesh file is converted from VTK to gmsh2_ascii and is working in PFC v6. It is not related to incompatibility of old FiPy library version 3.1 and Python version upper 3 because this error was not appeared by these FiPy and python versions in PFC v6 !! I think this error is not related to 'demo' PFC version and is related to another reason. I would be appreciated if anybody could advise on this error. Where the error is related to? Is there any solution without FiPy upgrading to 3.3 and upper?

Note that, it seems, the final error "AttributeError: 'float' object has no attribute 'version'" is due to unrecognized mesh file.

--
To unsubscribe from this group, send email to fipy+uns...@list.nist.gov
 
View this message at https://list.nist.gov/fipy

Ali Sheikholeslam

unread,
Mar 31, 2021, 8:26:33 PM3/31/21
to fipy, Jonathan, FIPY
Thank you for your rapid responses. Yes, you're right and I apologize to you if I disturbed you by such questions; I asked questions before about FiPy old version. I'm trying to upgrade it due to various problems that I faced to, but I couldn't until now, it will be done. I have solved pervious problems by various tricks. As you mentioned before to Mr. Furtney comment, I used "fp.meshes.gmshMesh._gmshVersion = lambda **kwargs: 2.0" in previous versions of Itasca PFC software, and they have worked correctly. Without this statement, mesh file couldn't open in previous versions as it was issued at "https://groups.google.com/a/list.nist.gov/g/fipy/c/XUV2NRMZnZg/m/YhgzKjebAQAJ". The only reason that I posted this question is that I didn't make any changes to my main code, which is working in previous version of PFC correctly. But I get this new error in the last demo version, in which all python libs such as FiPy, numpy, scipy, pyside, pysparse, and ... have the same version numbers as the previous version. I didn't ask them for this error because the code was as before and I thought it doesn't start to reading the mesh file. I tried to run before without " fp.meshes.gmshMesh._gmshVersion = lambda **kwargs: 2.0", but error was the same as the link above. Perhaps a change has been applied to the new version that I didn't find out until now.

Thank you dear Mr. Guyer
yours sincerely

Reply all
Reply to author
Forward
0 new messages