← Back to team overview

dolfin team mailing list archive

[Question #129583]: Plotting a basis function

 

New question #129583 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/129583

Hello,

I tried to plot a basis function for 2nd order Lagrange elements.
This is my code:

#mesh = UnitInterval(10)
mesh = UnitSquare(2, 2)

V = FunctionSpace(mesh, 'CG', 2) 

# Refine mesh and define corresponding functionspace
refinedMesh = refine(refine(refine(mesh)))
refinedV = FunctionSpace(refinedMesh, 'CG', 2) 

# Create zero function
v = Function(V)
v.vector()[2] = 1.0    # set a degree of freedom to 1.0

# Project( or interpolate) function to the finer mesh
v = project(v, refinedV) 
# v = interpolate(v, refinedV)

# plot
plot(v),interactive()

It works in 2D, but in 1D( for UnitInterval) I got a weird plot.
Don't you know where the problem is?

Vlado

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.