In [40]:
from dolfin import *
mesh = RectangleMesh(0, 0, 1, 1, 1, 1)
ff = FacetFunction("size_t", mesh, 0)
# calculate boundaries :
for f in facets(mesh):
n = f.normal()
tol = 1e-3
# surface :
if n.z() >= tol and f.exterior():
ff[f] = 1
# base :
elif n.z() <= -tol and f.exterior():
ff[f] = 2
# define function space :
In [61]:
V = FunctionSpace(mesh,"CG",2)
In [62]:
u = Function(V)
GradU = grad(u)
In [34]:
D_element = V.dolfin_element()
In [11]:
D_element.evaluate_basis_derivatives_all?
In [63]:
u.vector()[0] = 1
In [55]:
import matplotlib.pylab as plt
plt.plot(u.vector().array())
plt.show()
In [67]:
ucell = u.cell()
In [76]:
cell = Cell(mesh,0)
dof.cell_dofs(1)
Out[76]:
In [52]:
U_element = V.ufl_element()
In [53]:
dof=V.dofmap()
dof.