Hi,
I've run a simply poisson script similar to the poisson.py demo (see below). It solves the poisson equation on a square mesh. A boundary condition is defined on one side of the mesh.
My question is: How does the finite element method treat the other three sides of the mesh without boundary conditions? I am used to working with a finite difference scheme, where boundary conditions are set all around the mesh. Typically, a sufficiently large mesh is used to simulate dirichlet boundary conditions at infinity. Is something similar happening here?
from dolfin import *
# Create mesh and define function space
mesh = UnitSquareMesh(32, 32)
V = FunctionSpace(mesh, "Lagrange", 1)
# Define Dirichlet boundary (x = 0 or x = 1)
def boundary(x):
return x[0] < DOLFIN_EPS
# Define boundary condition
u0 = Constant(0.0)
bc = DirichletBC(V, u0, boundary)
# Define variational problem
u = TrialFunction(V)
v = TestFunction(V)
f = Constant(1.0)
a = inner(grad(u), grad(v))*dx
L = f*v*dx
# Compute solution
u = Function(V)
solve(a == L, u, bc)
# Save solution in VTK format
file = File("poisson.pvd")
file << u