- Timestamp:
- 06/30/2008 04:53:28 PM (6 months ago)
- Files:
-
- 1 modified
-
trunk/examples/diffusion/circle.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/diffusion/circle.py
r2565 r2620 7 7 # FILE: "circle.py" 8 8 # created: 4/6/06 {11:26:11 AM} 9 # last update: 6/ 4/08 {5:20:39PM}9 # last update: 6/30/08 {5:19:08 PM} 10 10 # Author: Jonathan Guyer <guyer@nist.gov> 11 11 # Author: Daniel Wheeler <daniel.wheeler@nist.gov> … … 66 66 .. _gmsh manual: http://www.geuz.org/gmsh/doc/texinfo/gmsh.html 67 67 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 82 68 The mesh created by gmsh_ is then imported into |FiPy| using the 83 69 `GmshImporter2D` object. … … 90 76 91 77 >>> 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()) 93 93 94 94 Using this mesh, we can construct a solution variable … … 104 104 ... value = 0.) 105 105 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} 106 We can now create a viewer to see the mesh 107 108 .. raw:: latex 109 114 110 \IndexModule{viewers} 115 111
FiPy: A Finite Volume PDE Solver Using Python