Changeset 2620 for trunk

Show
Ignore:
Timestamp:
06/30/2008 04:53:28 PM (6 months ago)
Author:
guyer
Message:

No reason not to just put gmsh instructions directly in the importer.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/examples/diffusion/circle.py

    r2565 r2620  
    77 #  FILE: "circle.py" 
    88 #                                    created: 4/6/06 {11:26:11 AM} 
    9  #                                last update: 6/4/08 {5:20:39 PM} 
     9 #                                last update: 6/30/08 {5:19:08 PM} 
    1010 #  Author: Jonathan Guyer <guyer@nist.gov> 
    1111 #  Author: Daniel Wheeler <daniel.wheeler@nist.gov> 
     
    6666.. _gmsh manual: http://www.geuz.org/gmsh/doc/texinfo/gmsh.html 
    6767 
    68     >>> lines = [ 'cellSize = ' + str(cellSize) + ';\n', 
    69     ...           'radius = ' + str(radius) + ';\n', 
    70     ...           'Point(1) = {0, 0, 0, cellSize};\n', 
    71     ...           'Point(2) = {-radius, 0, 0, cellSize};\n', 
    72     ...           'Point(3) = {0, radius, 0, cellSize};\n', 
    73     ...           'Point(4) = {radius, 0, 0, cellSize};\n', 
    74     ...           'Point(5) = {0, -radius, 0, cellSize};\n', 
    75     ...           'Circle(6) = {2, 1, 3};\n', 
    76     ...           'Circle(7) = {3, 1, 4};\n', 
    77     ...           'Circle(8) = {4, 1, 5};\n', 
    78     ...           'Circle(9) = {5, 1, 2};\n', 
    79     ...           'Line Loop(10) = {6, 7, 8, 9} ;\n', 
    80     ...           'Plane Surface(11) = {10};\n'] 
    81  
    8268The mesh created by gmsh_ is then imported into |FiPy| using the 
    8369`GmshImporter2D` object. 
     
    9076 
    9177    >>> from fipy import * 
    92     >>> mesh = GmshImporter2D(lines) 
     78    >>> mesh = GmshImporter2D(''' 
     79    ...                       cellSize = %(cellSize)g; 
     80    ...                       radius = %(radius)g; 
     81    ...                       Point(1) = {0, 0, 0, cellSize}; 
     82    ...                       Point(2) = {-radius, 0, 0, cellSize}; 
     83    ...                       Point(3) = {0, radius, 0, cellSize}; 
     84    ...                       Point(4) = {radius, 0, 0, cellSize}; 
     85    ...                       Point(5) = {0, -radius, 0, cellSize}; 
     86    ...                       Circle(6) = {2, 1, 3}; 
     87    ...                       Circle(7) = {3, 1, 4}; 
     88    ...                       Circle(8) = {4, 1, 5}; 
     89    ...                       Circle(9) = {5, 1, 2}; 
     90    ...                       Line Loop(10) = {6, 7, 8, 9}; 
     91    ...                       Plane Surface(11) = {10}; 
     92    ...                       ''' % locals()) 
    9393     
    9494Using this mesh, we can construct a solution variable 
     
    104104    ...                    value = 0.) 
    105105 
    106 We can now create a viewer to see the mesh (only the `Gist2DViewer` is 
    107 capable of displaying variables on this sort of irregular mesh) 
    108  
    109 .. raw:: latex 
    110  
    111    \IndexSoftware{Pygist} 
    112    \IndexSoftware{gist} 
    113    \IndexClass{Gist2DViewer} 
     106We can now create a viewer to see the mesh 
     107 
     108.. raw:: latex 
     109 
    114110   \IndexModule{viewers} 
    115111