Thanks for the feedback Jon.  The example would not run when I executed: 

run examples/diffusion/circle.py

It turns out Gmsh v.2.4.0 does not work for the example circle.py or any 
geometry I tried to load.  I deleted v.2.4.0 and installed Gmsh v.2.0 (I 
randomly selected this version) in the working directory and executed the 
example again.  Everything worked with the older version.

After trying a few binaries, it seems v.2.3.1 is the most recent version of 
Gmsh that allows irregular mesh imports.

Jeff



-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jonathan Guyer
Sent: Wednesday, September 09, 2009 1:31 PM
To: Multiple recipients of list
Subject: Re: GmshImporter error when using WindowsXP



On Sep 9, 2009, at 2:15 PM, Sowards, Jeffrey wrote:

> 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).

Welcome to the list.


> 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.diffusion.circle.  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.

Interesting. When I paste these lines into ipython (which it looks  
like you're using) on a Mac OS X machine, I get the same error you do,  
but before that, it prints out:

Error   : '/var/folders/kF/kF4nCVfY2RWCI++1YoH0LU+++TM/-Tmp-/ 
tmp9XNIwB.geo', line 2 : Unknown numeric option class '_ip'
Error   : '/var/folders/kF/kF4nCVfY2RWCI++1YoH0LU+++TM/-Tmp-/ 
tmp9XNIwB.geo', line 2 : parse error (()
Error   : '/var/folders/kF/kF4nCVfY2RWCI++1YoH0LU+++TM/-Tmp-/ 
tmp9XNIwB.geo', line 5 : Unknown variable 'radius'
Error   : '/var/folders/kF/kF4nCVfY2RWCI++1YoH0LU+++TM/-Tmp-/ 
tmp9XNIwB.geo', line 5 : Unknown variable 'cellSize'
Error   : '/var/folders/kF/kF4nCVfY2RWCI++1YoH0LU+++TM/-Tmp-/ 
tmp9XNIwB.geo', line 6 : Unknown variable 'radius'
Error   : '/var/folders/kF/kF4nCVfY2RWCI++1YoH0LU+++TM/-Tmp-/ 
tmp9XNIwB.geo', line 6 : Unknown variable 'cellSize'
Error   : '/var/folders/kF/kF4nCVfY2RWCI++1YoH0LU+++TM/-Tmp-/ 
tmp9XNIwB.geo', line 7 : Unknown variable 'radius'
Error   : '/var/folders/kF/kF4nCVfY2RWCI++1YoH0LU+++TM/-Tmp-/ 
tmp9XNIwB.geo', line 7 : Unknown variable 'cellSize'
Error   : '/var/folders/kF/kF4nCVfY2RWCI++1YoH0LU+++TM/-Tmp-/ 
tmp9XNIwB.geo', line 8 : Unknown variable 'radius'
Error   : '/var/folders/kF/kF4nCVfY2RWCI++1YoH0LU+++TM/-Tmp-/ 
tmp9XNIwB.geo', line 8 : Unknown variable 'cellSize'
Error   : Unknown control point 1 in Curve 6
Fatal   : Wrong list index (read)
debug!

This is generated by gmsh, and it turns out that it's because ipython  
sees the '%' characters and is interpreting them as "magic" commands.  
A related problem is already filed against ipython 
<https://bugs.launchpad.net/ipython/+bug/343992 
 >. I don't know any further workaround to make this Python syntax  
work in ipython, but I've added comments about it to the bug report.

In this case, you could simply write:

In [5]: mesh = GmshImporter2D('''
    ...: cellSize = 0.05;
    ...: radius = 1.;
    ...: 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};
    ...: ''')

instead of doing the Python string substitution with locals().

Just as confirmation, I assume that the example runs properly if you  
type

   In [8]: run examples/diffusion/circle.py

in ipython?

> Can anybody send me a good reference or code of this example (or a  
> similar problem) that has worked in Windows?

We have an automated test suite that exercises all of the examples,  
including this one, on a variety of platforms. You can see from 
http://matforge.org/fipy/build/trunk/1239 
  that examples.diffusion.circle passes on a Windows XP machine for us.





Reply via email to