Tutorial | Poisson Equation
Today, I want to explain a bit about how to solve one of the simplest and fundamental equations in PDE.
Poisson Equation
Here, the coefficient q(u) makes the equation nonlinear.
Applying the identity ∇ ⋅ (uv) = (∇ u)v + u⋅ ∇ v
Applying weak form transformation: ∀ v ∈ 𝜕𝛺∶ v = 0
Now, for the variational form:
and L(u,v) = ∫_𝛺 f v dx
V = FunctionSpace(mesh, 'P', 1)
u_D = Expression(u_ccode, degree=2)
bc = DirichletBC(V, u_D, boundary)
u = Function(V)
v = TestFunction(V)
f = Expression(f_ccode, degree=1)
F = q(u)*dot(grad(u), grad(v))*dx - f*v*dx
solve(F == 0, u, bc)

Membrane Poisson Equation
We want to compute the deflection D(x,y) of a two-dimensional, circular membrane of radius R, subject to a load p over the membrane. The appropriate PDE model is:
Here, T is the tension in the membrane (constant), and p is the external pressure load. The bounday of the membrane has no deflection, implying D = 0 as a boundary condition. A localized load can be modeled as a Gaussian function:
The parameter A is the amplitude of the pressure, (x₀, y₀) the localization of the maximum point of the load, and 𝜎 the “width” of p. We will take the center (x₀, y₀) of the pressure to be (0, R₀) for some 0<R₀<R.
Applying the identity ∇ ⋅ (uv) = (∇ u)v + u ⋅ ∇ v:
Applying weak form transformation ∀ v ∈ 𝜕𝛺, v = 0:
Now, for the variational form:
# Define boundary condition
w_D = Constant(0) #w = 0 on boundaries
def boundary(x, on_boundary):
return on_boundary
bc = DirichletBC(V, w_D, boundary)
# Define load
beta = 8
R0 = 0.6
p = Expression('4*exp(-pow(beta, 2)*(pow(x[0], 2) + pow(x[1] - R0, 2)))', degree=1, beta=beta, R0=R0)
# Define variational problem
w = TrialFunction(V)
v = TestFunction(V)
a = dot(grad(w), grad(v))*dx
L = p*v*dx
# Solve
w = Function(V)
solve(a == L, w, bc)

