Changeset 2601 for trunk

Show
Ignore:
Timestamp:
06/19/2008 11:38:21 AM (7 months ago)
Author:
wd15
Message:

changed the anisotropy test case to use a previously created mesh to avoid the issues with different versions of gmsh creating different meshes

Location:
trunk/examples/diffusion
Files:
1 added
1 modified

Legend:

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

    r2591 r2601  
    6767 
    6868    >>> from fipy import * 
    69     >>> cellSize = 0.03 
    70     >>> radius = 1. 
    7169 
    72 Create the mesh with Gmsh. 
     70Import a mesh previously created using Gmsh. 
    7371 
    74     >>> lines = [ 'cellSize = ' + str(cellSize) + ';\n', 
    75     ...             'radius = ' + str(radius) + ';\n', 
    76     ...       'Point(1) = {0, 0, 0, cellSize};\n', 
    77     ...       'Point(2) = {-radius, 0, 0, cellSize};\n', 
    78     ...       'Point(3) = {0, radius, 0, cellSize};\n', 
    79     ...       'Point(4) = {radius, 0, 0, cellSize};\n', 
    80     ...       'Point(5) = {0, -radius, 0, cellSize};\n', 
    81     ...       'Circle(6) = {2, 1, 3};\n', 
    82     ...       'Circle(7) = {3, 1, 4};\n', 
    83     ...       'Circle(8) = {4, 1, 5};\n', 
    84     ...       'Circle(9) = {5, 1, 2};\n', 
    85     ...       'Line Loop(10) = {6, 7, 8, 9} ;\n', 
    86     ...       'Plane Surface(11) = {10};\n'] 
    87  
    88  
    89  
    90     >>> mesh = GmshImporter2D(lines) 
     72    >>> mesh = GmshImporter2D(os.path.splitext(__file__)[0] + '.msh') 
    9173 
    9274Set the center most cell to have a value. 
     
    9476    >>> var = CellVariable(mesh=mesh, hasOld=1) 
    9577    >>> x, y = mesh.getCellCenters() 
    96     >>> circleRadius = radius / 10.0 
    9778    >>> var[numerix.argmin(x**2 + y**2)] = 1. 
    9879 
     
    132113    >>> X, Y = numerix.dot(mesh.getCellCenters(), CellVariable(mesh=mesh, rank=2, value=rotationMatrix)) 
    133114    >>> solution = mass * numerix.exp(-(X**2 / gamma_prime[0][0] + Y**2 / gamma_prime[1][1]) / (4 * time)) / (4 * numerix.pi * time * numerix.sqrt(gamma_prime[0][0] * gamma_prime[1][1])) 
    134     >>> if int(os.popen4('gmsh --version')[1].read().split('.')[0]) < 2: 
    135     ...     tolerance = 0.14 
    136     ... else: 
    137     ...     tolerance = 0.06 
    138     >>> print max(abs((var - solution) / max(solution))) < tolerance 
     115    >>> print max(abs((var - solution) / max(solution))) < 0.05 
    139116    True 
    140117