Hello List.  I will confess right away, though I'm sure it will be clear, that 
I'm a new FiPy and Python user (under Windows XP with python(x,y) 2.1.14).  I 
have had success working through most of the examples in FiPy Users Guide.pdf.  
One exception is the example in section 6.3: examples.diffusioncircle.  I have 
not been able to work through that example because I get hung up on the line 
where we must create the mesh:

>>> mesh = GmshImporter2D('''

See below for the input of the script and the errors.  I do have gmsh.exe 
installed in my working directory of Python.  I have read of issues regarding 
Gmsh interfacing with FiPy under Windows OS.

Can anybody send me a good reference or code of this example (or a similar 
problem) that has worked in Windows?  I think I have exhausted all the 
resources I found on Google, and I have already tried matforge.org.

Example 6.3 is of particular interest to me as I would like to run a similar 
problem setup using my own geometry I created with Gmsh.
Any help would be greatly appreciated!  And thanks for your patience.

Regards,
Jeff


In [1]: cellSize = 0.05

In [2]: radius = 1.

In [3]: from fipy import *

In [5]: mesh = GmshImporter2D('''
   ...: cellSize = %(cellSize)g;
   ...: radius = %(radius)g;
   ...: Point(1) = {0, 0, 0, cellSize};
   ...: Point(2) = {-radius, 0, 0, cellSize};
   ...: Point(3) = {0, radius, 0, cellSize};
   ...: Point(4) = {radius, 0, 0, cellSize};
   ...: Point(5) = {0, -radius, 0, cellSize};
   ...: Circle(6) = {2, 1, 3};
   ...: Circle(7) = {3, 1, 4};
   ...: Circle(8) = {4, 1, 5};
   ...: Circle(9) = {5, 1, 2};
   ...: Line Loop(10) = {6, 7, 8, 9};
   ...: Plane Surface(11) = {10};
   ...: ''' % locals())
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

C:\Program Files\pythonxy\startups\<ipython console> in <module>()

C:\Python25\lib\site-packages\fipy\meshes\numMesh\gmshImport.pyc in 
__init__(self, arg, coordDimensions)
    435     def __init__(self, arg, coordDimensions=2):
    436         mshfile = MshFile(arg)
--> 437         mesh2D.Mesh2D.__init__(self, 
**_DataGetter(mshfile.getFilename(), dimensions=2, coordDimensions=co
ordDimensions).getData())
    438         mshfile.remove()
    439

C:\Python25\lib\site-packages\fipy\meshes\numMesh\gmshImport.pyc in 
getData(self)
    194         self.fileType = self.getFileType() #gets version of gmsh, I 
think
    195         #vertexCoords are x,y coords of nodes/vertices from gmsh file
--> 196         vertexCoords = self._calcVertexCoords(self.coordDimensions)
    197
    198         self._calcCellVertexIDs()

C:\Python25\lib\site-packages\fipy\meshes\numMesh\gmshImport.pyc in 
_calcVertexCoords(self, coordDimensions)
    239         nodeToVertexIDdict = {}
    240
--> 241         numVertices = int(nodeLines[0])
    242         if numVertices != len(nodeLines[1:]):
    243             raise IndexError, "Number of nodes (%d) does not match 
number promised (%d)" % (numVertices, l
en(nodeLines[1:]))

TypeError: 'NoneType' object is unsubscriptable

Reply via email to