mesh initialisation with iterators
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
FEniCS Project |
New
|
Undecided
|
Unassigned |
Bug Description
(using latest release of Mac binary for osx 10.6)
The code below uses a function on the boundary facets to mark certain facets for a Dirichlet boundary condition. This ONLY works when I uncomment the line
mesh.init()
in the code below.
If this line is commented, I get the error:
*** Warning: Found no facets matching domain for boundary condition.
Rich
#######
from dolfin import *
# Create mesh
mesh = UnitCircleMesh(20)
# Create function space
degree = 2
V = VectorFunctionS
Q = FunctionSpace(
W = MixedFunctionSp
(u, p) = TrialFunctions(W)
(v, q) = TestFunctions(W)
f = Constant((0.0, 0.0))
U = Function(W)
facet_function = FacetFunction(
#mesh.init() ## This MUST be uncommented to make the code work
D = mesh.topology(
for facet in facets(mesh):
if facet.num_
if facet.normal(
class BCExpression(
def __init__(self, mesh):
def eval_cell(self, values, x, ufc_cell):
cell = Cell(self.mesh, ufc_cell.index)
n = cell.normal(
def value_shape(self):
return (2,)
bcvel = BCExpression(mesh)
# Dirichlet bc
bcs = DirichletBC(
# Procedure B: Set operators and solve
sgu = sym(grad(u))
sgv = sym(grad(v))
a = ( + sgu[i,j]
- p*v[i].dx(i)*dx # pressure gradient
+ q*u[i].dx(i)*dx ) # velocity divergence
L = f[i]*v[i]*dx # body-force
solve(a==L,U,bcs)