laplace equation - numerical example€¦ · 05/09/2017  · laplace equation - numerical example...

17
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.

Upload: others

Post on 31-Jul-2020

15 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

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.

Page 2: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

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.

Page 3: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

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,𝑗

Page 4: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

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 -> Δ𝑥 = Δ𝑦

Page 5: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

5

Laplace equation - Numerical example

The algebraic equation system we must solve gets:

−4 ⋅ 𝜙𝑖,𝑗 + 𝜙𝑖−1,𝑗 + 𝜙𝑖,𝑗−1 + 𝜙𝑖+1,𝑗 + 𝜙𝑖,𝑗+1 = 0

Consider temperature first !

Page 6: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

6

Laplace equation - Physical domain

𝜕𝑇

𝜕𝑦= 0 → 𝑇𝑗=𝑁 = 𝑇𝑗=𝑁−1

𝜕𝑇

𝜕𝑦= 0 → 𝑇𝑗=1 = 𝑇𝑗=2

𝑇 = 200𝐾 𝑇 = 300𝐾

Page 7: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

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.

Page 8: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

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

Page 9: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

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.

Page 10: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

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 !

Page 11: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

11

Laplace equation - Numerical domain

10 20 30 40 50 60

5

10

15

20

25

200

220

240

260

280

300

𝑆𝑡𝑎𝑟𝑡 𝑣𝑎𝑙𝑢𝑒𝑠: 𝑇𝑠𝑡𝑎𝑟𝑡 = 260 𝐾

Page 12: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

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

Page 13: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

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

Page 14: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

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

Page 15: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

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

Page 16: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

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)

Page 17: Laplace equation - Numerical example€¦ · 05/09/2017  · Laplace equation - Numerical example With temperature as input, the equation describes two-dimensional, steady heat conduction

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