laplace equation - numerical example
TRANSCRIPT
1
Laplace equation - Numerical example
The Laplace equation is given as
π2π
ππ₯2+π2π
ππ¦2= 0
The scalar function π can be f.ex. velocity potential or
temperature. We will look at both.
2
Laplace equation - Numerical example
With temperature as input, the equation describes two-dimensional, steady heat conduction.
The velocity and its potential is related as π’ =ππ
ππ₯and π£ =
ππ
ππ¦,
where u and v are velocity components in x- and y-direction respectively. For flow, it requires incompressible, irrotational, non-viscous and steady conditions
As will be seen, it is easiest to start with temperature.
3
Laplace equation - Numerical example
The interior domain can be split up as shown in the figure below:
Numerical molecule:
Discretization:
ππ
ππ₯β
1
Ξπ₯ππ+1,π β ππ,π
π2π
ππ₯2β
1
Ξπ₯2ππ+1,π β 2ππ,π + ππβ1,π (same for y-dir.)
ππ,π
ππ,π+1
ππ+1,π
ππ,πβ1
ππβ1,π
4
Laplace equation - Numerical example
Adding the discretized differentials together gives us:
2 β 1 +Ξπ₯
Ξπ¦
2
ππ,π = ππβ1,π + ππ,πβ1 +Ξπ₯
Ξπ¦
2
ππ+1,π + ππ,π+1
Show this yourself !
So we have an explicit expression for point i,j that contains its neighbors.
For simplicity we continue with uniform grid -> Ξπ₯ = Ξπ¦
5
Laplace equation - Numerical example
The algebraic equation system we must solve gets:
β4 β ππ,π + ππβ1,π + ππ,πβ1 + ππ+1,π + ππ,π+1 = 0
Consider temperature first !
6
Laplace equation - Physical domain
ππ
ππ¦= 0 β ππ=π = ππ=πβ1
ππ
ππ¦= 0 β ππ=1 = ππ=2
π = 200πΎ π = 300πΎ
7
Laplace equation - Boundary conditions
Easiest to start with is temperature, because the directly
solved variable from the scalar equation is what we are
interested in. Two different BCs:
Dirichlet: πππ is given. Constant temperature at any boundary.
Neumann: ππ
ππ₯π πThe normal gradient is given. Heat flux.
8
Laplace equation - Numerical example
π1,1 = 200
π2,5 = π2,4
β¦
π2,2 =1
4π1,2 + π2,1 + π3,2 + π2,3
β¦
π4,5 = π4,4
β¦
π5,1 = 300
π¦
π₯π1,1
π2,1 π3,1
π1,2
π1,3
π2,2
π1,4
π1,5
π4,1 π5,1
π2,5 π5,5π3,5 π4,5
9
Laplace equation - Solution (Gauss-Seidel SOR)
ππ,π =1
4ππβ1,π + ππ,πβ1 + ππ+1,π + ππ,π+1
ππ,ππππ€ = ππ,π
πππ + πΌ β 1
4ππβ1,π + ππ,πβ1 + ππ+1,π + ππ,π+1 β ππ,π
πππ
πΏπ
We added and subtracted the old value of ππ,π on the right hand side. Inside brackets is the change in ππ,π for the current iteration. πΌ is the over-relaxation parameter.
10
Laplace equation - Numerical example
π₯
Remember to either exclude the indexes for boundary values, or
overwrite/enforce them inside the iteration loop.
Check the difference between old and new values (residual). Several ways to
calculate this !
11
Laplace equation - Numerical domain
10 20 30 40 50 60
5
10
15
20
25
200
220
240
260
280
300
ππ‘πππ‘ π£πππ’ππ : ππ π‘πππ‘ = 260 πΎ
12
Laplace equation - Numerical domain
10 20 30 40 50 60
5
10
15
20
25
200
210
220
230
240
250
260
270
280
290
300
Box inside, T=200K
13
Laplace equation - Solution procedure
1. Initialize the domain
2. Iteration
3. Enforce BCβs
4. Solve ππ· = π(πππβ )
5. Check toleranceππ· β ππ·
βIf tolerance > small
number
Convergence:
max πΏππ,π
max ππ,π< π
Where π is a small number
14
Laplace equation - Results
10 20 30 40 50 60
5
10
15
20
25
200
220
240
260
280
300
10 20 30 40 50 60
5
10
15
20
25
200
210
220
230
240
250
260
270
280
290
300
500 iterations
1000 iterations
15
Laplace equation - Velocity potential
We wish to study external flow. That is flow around an object.
The easiest is a rectangular box. The domain will be like
below:π£ =
ππ
ππ¦= 0
π£ =ππ
ππ¦= 0
π’ = πππ βππ
ππ₯= πππ
ππ’
ππ₯=π2π
ππ₯2= 0
π’ =ππ
ππ₯= 0
π£ =ππ
ππ¦= 0
π’ =ππ
ππ₯= 0
π£ =ππ
ππ¦= 0
16
Laplace equation - Velocity potential
It is solved exactly the same way as with temperature, but the boundary conditions are different. Also, Dirichlet conditions for uand v gives Neumann conditions for the velocity potential.
Inlet: π1,π = π2,π β πππ β Ξπ₯
Outlet: ππ,π = 2 β ππβ1,π β ππβ2,π
Top: ππ€ = ππ€β1 Bottom: ππ€ = ππ€+1
At the top and bottom use v=0
Correct initialization is important here (πππ all over the domain)
17
Laplace equation - Results
Streamlines
u-velocity
50 100 150 200 250
10
20
30
40
50
0
2
4
6
8
10
1.5 2 2.5 3 3.5
0.2
0.3
0.4
0.5
0.6
0.7
0.8