This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

adaptive mesh display

+1 vote

does anyone know how to display an adaptively refined mesh?
when plotting the mesh after adaptive solve, I just see the initially defined mesh (of course):

from dolfin import *
mesh = UnitSquareMesh(4, 4)
V = FunctionSpace(mesh , "CG", 1)
u = TrialFunction(V); v = TestFunction(V); u_h = Function(V)

a = dot(grad(u), grad(v))dx
L = v
dx
bc = DirichletBC(V, 0.0, "near(x[0], 0.0)")

M = u_h*dx
solve(a == L, u_h, bc, tol=1e-4, M=M)

plot(mesh); interactive()

asked Nov 16, 2013 by achim FEniCS Novice (260 points)

1 Answer

+3 votes
mesh.root_node() # the coarsest one
mesh.leaf_node() # the finest one

and similarly for other refined quantities.

answered Nov 17, 2013 by Jan Blechta FEniCS Expert (51,420 points)

How to get the mesh between the coarsest one and the finest one, and similarly for other refined quantities?
Thanks very much in advance.

object.parent()
object.child()
...