Hi,
Below is a demo Poisson equation solver that was included in the Fenics installation. I have changed function space from CG_1 to CG_2. But the solution plot does not reflects this change. Plot is still showing a piecewise linear function.
from dolfin import *
mesh = UnitSquareMesh(3,3)
V = FunctionSpace(mesh, "CG", 2)
def boundary(x):
return x[0] < DOLFIN_EPS or x[0] > 1.0 - DOLFIN_EPS
u0 = Constant(0.0)
bc = DirichletBC(V, u0, boundary)
u = TrialFunction(V)
v = TestFunction(V)
f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
g = Expression("sin(5*x[0])")
a = inner(grad(u), grad(v))*dx
L = f*v*dx + g*v*ds
u = Function(V)
solve(a == L, u, bc)
plot(u, interactive = True)
Please tell me what am I missing. Thanks in advance.
Ajit