The Galerkin method is a numerical technique that transforms boundary value problems, particularly partial differential equations (PDEs), into a system of linear algebraic equations by projecting the problem onto a finite-dimensional subspace.
Steps of the Galerkin Method
Problem Setup:
Start with the weak form of the differential equation integrated against a test function.
Choice of Basis Functions:
Select basis functions {ϕi}ni=1 that satisfy the boundary conditions.
Approximation of the Solution:
Assume u(x)≈un(x)=∑ni=1ciϕi(x).
Galerkin Projection:
Ensure the residual is orthogonal to the span of the basis functions:
∫Residual⋅ϕjdx=0for all j.
Example: One-Dimensional Poisson Equation
Consider the problem
−u″(x)=f(x),u(0)=u(1)=0.
on the interval [0,1].
Step 1: Weak Form
Multiply by a test function v(x) and integrate by parts to get:
∫10u′(x)v′(x)dx=∫10f(x)v(x)dx.
Step 2: Discretization
Choose linear basis functions and assume:
u(x)≈un(x)=n∑i=1ciϕi(x).
Step 3: Galerkin Projection
Insert the approximation into the weak form using basis functions as test functions:
n∑i=1ci∫10ϕ′i(x)ϕ′j(x)dx=∫10f(x)ϕj(x)dxfor all j.
Step 4: Matrix Formulation
Define the stiffness matrix A and load vector b as follows:
Aij=∫10ϕ′i(x)ϕ′j(x)dx,bj=∫10f(x)ϕj(x)dx.
This leads to the linear system:
Ac=b,
where c is the vector of coefficients.
\subsection*{Example: Very simple and concrete}
Take a differential equation
d2ydx2+x+y=0,0≤x≤1
with boundary condition y(0)=y(1)=0
Example:
Step 1
Take a trail solution y(x)=a0+a1x+a2x2. Always take the number of constants one greater than the highest differential power. Here we have second order differential. So, we take 2+1=3 constants a0,a1,a2.
Apply boundary conditions x=0,y=0. This leads to a0=0. Then apply boundary condition x=1,y=0 leads to a1=−a2. Then the trail function becomes y(x)=a2(x2−x). This is one parameter solution - namely a2.
Step 2
Compute Weighting function
W(x)=∂ya2=x2−x
Step 3
Compute domain residuals. Simply substitute the trail function into original differential equation.
Rd=d2ydx2+x+yRd(x)=da2(x2−x)dx2+x+a2(x2−x)
Step 4
Minimization of domain residual:
∫10W(x)Rd(x)dx=0
Compute minimization. You will get a2=−598.
Then the solution is y(x)=−598(x−x2).
Other formulations
For the differential equation −u″=f, we can write this as first order by setting
σ=−u′,σ′=f
The pair σ,f can be characterized variationally as unique critical point of the functional
I(σ,u)=∫1−1(12σ2−uσ′)dx+∫1−1fudx
over H1(−1,1)×L2(−1,1)
Note if we take the original J(x) the Energy functional and substitute, we get above.
J(u)=12∫1−1|u′(x)|2dx−∫1−1f(x)u(x)dx=12∫1−1σ2−∫1−1f(x)u(x)dx=12∫1−1σ2+f(x)∫1−1u(x)dx−∫1−1∫1−1u(x)dxf′(x)dx=12∫1−1σ2+0=12∫1−1σ2+∫1−1f(x)u(x)dx−∫1−1f(x)u(x)dx=∫1−112σ2−fσ′+∫1−1f(x)u(x)dx
No comments:
Post a Comment