On 10/12/15 14:12, Angwenyi David wrote:
nx = 10 ny = 10 nz = 20 mesh = BoxMesh(nx, ny, nz, 1.0, 1.0, 2.0) V = FunctionSpace(mesh, "CG", 1) u = TrialFunction(V) v = TestFunction(V) f = Function(V) f.interpolate(Expression("(2*x[0])+(3*x[1])+(0.5*x[2])")) Coefficient(FunctionSpace(Mesh(VectorElement('Lagrange', tetrahedron, 1, dim=3), 3), FiniteElement('Lagrange', tetrahedron, 1)), 4) a = (dot(grad(v), grad(u)) - v * u) * dx
This is the indefinite form of the Helmholtz equation. Did you actually want the sign-positive Helmholtz equation? The later has strong form: -laplacian u + u = f When integrating by parts the weak form becomes: <grad u, grad v> + <u, v> = <f, v> As to incorporation of boundary conditions, see http://firedrakeproject.org/variational-problems.html#incorporating-boundary... Cheers, Lawrence