Closed JDS19 closed 2 years ago
Hello,
I am trying to make some 2D simulations, and I need to create a circular mesh, so I'm following the instructions from https://www.ctcms.nist.gov/fipy/examples/diffusion/generated/examples.diffusion.circle.html .
However, when I try to make the mesh as shown in the example, I get "KeyError: 'cellSize'". My code is:
from fipy import Variable, FaceVariable, CellVariable, Grid1D, TransientTerm, DiffusionTerm, Viewer, Gmsh2D radius = 0.1 diam = 2*radius # Create mesh nx = 100 cellSize = diam/nx mesh = Gmsh2D(''' 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())
I am using Python version 3.8.3 and Fipy version 3.4.3.
Thank you for any help!
I think there was an issue with how I had Gmsh imported. I messed around with where Gmsh is stored, and it seems to work now. I apologize for the confusion.
Glad you got it to work
Hello,
I am trying to make some 2D simulations, and I need to create a circular mesh, so I'm following the instructions from https://www.ctcms.nist.gov/fipy/examples/diffusion/generated/examples.diffusion.circle.html .
However, when I try to make the mesh as shown in the example, I get "KeyError: 'cellSize'". My code is:
I am using Python version 3.8.3 and Fipy version 3.4.3.
Thank you for any help!