tobias bleninger matemÁtica aplicada i

41
1 Tobias Bleninger Universidade Federal do Paraná (UFPR) Departamento de Engenharia Ambiental(DEA) www.Bleninger.info MATEMÁTICA APLICADA I Tobias Bleninger

Upload: others

Post on 05-May-2022

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Tobias Bleninger MATEMÁTICA APLICADA I

1

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.Bleninger.info

MATEMÁTICA APLICADA ITobias Bleninger

Page 2: Tobias Bleninger MATEMÁTICA APLICADA I

2

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.Bleninger.info

Source:

Chapra, Numerical

Methods for Engineers,

2008

Page 3: Tobias Bleninger MATEMÁTICA APLICADA I

3

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.Bleninger.info

Differentiation

The mathematical definition of a derivative begins with a difference

approximation:

and as x is allowed to approach zero, the difference becomes a

derivative:

y

x=f xi + x( )− f xi( )

x

dy

dx= lim

x→0

f xi + x( )− f xi( )x

Source:

Chapra, Numerical Methods for Engineers, 2008

Page 4: Tobias Bleninger MATEMÁTICA APLICADA I

4

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.Bleninger.info

High-Accuracy Differentiation Formulas

Taylor series expansion can be used to generate high-accuracy formulas for

derivatives by using linear algebra to combine the expansion around several

points.

Three categories for the formula include forward finite-difference, backward

finite-difference, and centered finite-difference.

Source:

Chapra, Numerical Methods for Engineers, 2008

Page 5: Tobias Bleninger MATEMÁTICA APLICADA I

5

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.Bleninger.info

Forward Finite-Difference

Source: Chapra, Numerical Methods for Engineers, 2008

Page 6: Tobias Bleninger MATEMÁTICA APLICADA I

6

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.Bleninger.info

Backward Finite-Difference

Source: Chapra, Numerical Methods for Engineers, 2008

Page 7: Tobias Bleninger MATEMÁTICA APLICADA I

7

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.Bleninger.info

Centered Finite-Difference

Source: Chapra, Numerical Methods for Engineers, 2008

Page 8: Tobias Bleninger MATEMÁTICA APLICADA I

8

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.Bleninger.info

Page 9: Tobias Bleninger MATEMÁTICA APLICADA I

Ordinary Differential Equations

• Methods described here are for solving differential equations of the form:

• The methods in this chapter are all one-step methods and have the general format:

where is called an increment function, and is used to extrapolate from an old value yi to a new value yi+1.

dy

dt= f t, y( )

yi+1 = yi +h

Page 10: Tobias Bleninger MATEMÁTICA APLICADA I

Euler’s Method

• The first derivative

provides a direct

estimate of the slope

at ti:

and the Euler method

uses that estimate as

the increment

function:

dy

dt ti

= f ti , yi( )

= f ti , yi( )

yi+1 = yi + f ti , yi( )h

Page 11: Tobias Bleninger MATEMÁTICA APLICADA I
Page 12: Tobias Bleninger MATEMÁTICA APLICADA I

by Lale Yurttas, Texas A&M

University

Chapter 25 12

Figure 25.4

Page 13: Tobias Bleninger MATEMÁTICA APLICADA I

Error Analysis for Euler’s Method

• The numerical solution of ODEs involves two types of error:– Truncation errors, caused by the nature of the techniques employed

– Roundoff errors, caused by the limited numbers of significant digits that can be retained

• The total, or global truncation error can be further split into:– local truncation error that results from an application method in question over a

single step, and

– propagated truncation error that results from the approximations produced during previous steps.

Page 14: Tobias Bleninger MATEMÁTICA APLICADA I

Error Analysis for Euler’s Method

• The local truncation error for Euler’s method is O(h2) and proportional to the derivative of f(t,y) while the global truncation error is O(h).

• This means:

– The global error can be reduced by decreasing the step size, and

– Euler’s method will provide error-free predictions if the underlying function is linear.

• Euler’s method is conditionally stable, depending on the size of h.

Page 15: Tobias Bleninger MATEMÁTICA APLICADA I

Heun’s Method

• One method to improve Euler’s method is to determine derivatives at the beginning and predicted

ending of the interval and average them:

• This process relies on making a prediction of the new value of y, then correcting it based on the

slope calculated at that new value.

• This predictor-corrector approach can be iterated to convergence:

Page 16: Tobias Bleninger MATEMÁTICA APLICADA I

Midpoint Method

• Another improvement to Euler’s method is similar to Heun’s method, but predicts the slope at the midpoint of an interval rather than at the end:

• This method has a local truncation error of O(h3) and global error of O(h2)

Page 17: Tobias Bleninger MATEMÁTICA APLICADA I

Runge-Kutta Methods

• Runge-Kutta (RK) methods achieve the accuracy of a Taylor series approach without requiring the calculation of higher derivatives.

• For RK methods, the increment function can be generally written as:

where the a’s are constants and the k’s are

where the p’s and q’s are constants.

= a1k1 + a2k2 + + ankn

k1 = f ti , yi( )k2 = f ti + p1h, yi + q11k1h( )k3 = f ti + p2h, yi + q21k1h+ q22k2h( )

kn = f ti + pn−1h, yi + qn−1,1k1h+ qn−1,2k2h+ + qn−1,n−1kn−1h( )

Page 18: Tobias Bleninger MATEMÁTICA APLICADA I

Classical Fourth-Order Runge-Kutta Method

• The most popular RK methods are fourth-order, and the most

commonly used form is:

where:

yi+1 = yi +1

6k1 + 2k2 + 2k3 + k4( )h

k1 = f ti , yi( )

k2 = f ti +1

2h, yi +

1

2k1h

k3 = f ti +1

2h, yi +

1

2k2h

k4 = f ti + h, yi + k3h( )

Page 19: Tobias Bleninger MATEMÁTICA APLICADA I

Systems of Equations

• Many practical problems require the solution of a system of equations:

• The solution of such a system requires that n initial conditions be

known at the starting value of t.

dy1

dt= f1 t, y1, y2 , , yn( )

dy2

dt= f2 t, y1, y2 , , yn( )

dyn

dt= fn t, y1, y2 , , yn( )

Page 20: Tobias Bleninger MATEMÁTICA APLICADA I

Figure 20.9

Page 21: Tobias Bleninger MATEMÁTICA APLICADA I

Solution Methods

• Single-equation methods can be used to solve systems of

ODE’s as well; for example, Euler’s method can be used on

systems of equations - the one-step method is applied for

every equation at each step before proceeding to the next

step.

• Fourth-order Runge-Kutta methods can also be used, but

care must be taken in calculating the k’s.

Page 22: Tobias Bleninger MATEMÁTICA APLICADA I

by Lale Yurttas, Texas A&M

University

Chapter 25 22

Figure 25.14

Page 23: Tobias Bleninger MATEMÁTICA APLICADA I

23

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

Equações diferenciais parciais

Source:

Chapra, Numerical

Methods for Engineers,

2008

Page 24: Tobias Bleninger MATEMÁTICA APLICADA I

24

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

Source: Chapra, Numerical Methods for Engineers, 2008

Page 25: Tobias Bleninger MATEMÁTICA APLICADA I

25

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

Linear second-order PDEs are of the form

where A - H are functions of x and y only

Elliptic PDEs: B2 - AC < 0

(steady state heat equations)

Parabolic PDEs: B2 - AC = 0

(heat transfer equations)

Hyperbolic PDEs: B2 - AC > 0

(wave equations)

HGuFuEuCuBuAu yxyyxyxx =+++++ 2

Source:

School of Computing Science, University of Cincinatti,

http://www.cs.uc.edu

Page 26: Tobias Bleninger MATEMÁTICA APLICADA I

26

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

Solving PDEs

Finite element method

Finite difference method (our focus)

▪ Converts PDE into matrix equation• Linear system over discrete basis elements

▪ Result is usually a sparse matrix

Finite Volume method

Source:

School of Computing Science, University of Cincinatti,

http://www.cs.uc.edu

Page 27: Tobias Bleninger MATEMÁTICA APLICADA I

27

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

Elliptic Equations

Elliptic equations in engineering are typically used to characterizesteady-state, boundary value problems.

For numerical solution of elliptic PDEs, the PDE is transformed intoan algebraic difference equation.

Because of its simplicity and general relevance to most areas ofengineering, we will use a heated plate as an example for solvingelliptic PDEs.

Source: Chapra, Numerical Methods for Engineers, 2008

Page 28: Tobias Bleninger MATEMÁTICA APLICADA I

28

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

Source: Chapra, Numerical Methods for Engineers, 2008

Page 29: Tobias Bleninger MATEMÁTICA APLICADA I

29

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

The Laplacian Difference Equations/

04

022

2

2

0

,1,1,,1,1

2

1,,1,

2

,1,,1

2

1,,1,

2

2

2

,1,,1

2

2

2

2

2

2

=−+++

=

=

+−+

+−

+−=

+−=

=

+

−+−+

−+−+

−+

−+

jijijijiji

jijijijijiji

jijiji

jijiji

TTTTT

yx

y

TTT

x

TTT

y

TTT

y

T

x

TTT

x

T

y

T

x

T

Laplacian difference

equation.

Holds for all interior points

Laplace Equation

O[(x)2]

O[(y)2]

Source: Chapra, Numerical Methods for Engineers, 2008

Page 30: Tobias Bleninger MATEMÁTICA APLICADA I

30

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

Source: Chapra, Numerical Methods for Engineers, 2008

Page 31: Tobias Bleninger MATEMÁTICA APLICADA I

31

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

In addition, boundary conditions along the edges must be

specified to obtain a unique solution.

The simplest case is where the temperature at the boundary

is set at a fixed value, Dirichlet boundary condition.

A balance for node (1,1) is:

Similar equations can be developed for other interior points

to result a set of simultaneous equations.

04

0

75

04

211211

10

01

1110120121

=++−

=

=

=−+++

TTT

T

T

TTTTT

Source: Chapra, Numerical Methods for Engineers, 2008

Page 32: Tobias Bleninger MATEMÁTICA APLICADA I

32

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

1504

1004

1754

504

04

754

504

04

754

332332

33231322

231312

33322231

2332221221

13221211

323121

22132111

122111

=+−−

=−+−−

=−+−

=−+−−

=−−+−−

=−−+−

=−+−

=−−+−

=−−

TTT

TTTT

TTT

TTTT

TTTTT

TTTT

TTT

TTTT

TTT

• The result is a set of nine simultaneous equations with nine

unknowns:

Source: Chapra, Numerical Methods for Engineers, 2008

Page 33: Tobias Bleninger MATEMÁTICA APLICADA I

33

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

Soluções

• Método de eliminação Gauss

• Método de decomposição LU

• Método iterativo (aproximado) de Gauss-Seidel

mais detalhes.pdf

Page 34: Tobias Bleninger MATEMÁTICA APLICADA I

34

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

Parabolic Equations

Parabolic equations are employed to characterize time-variable

(unsteady-state) problems.

Conservation of energy can be used to develop an unsteady-state

energy balance for the differential element in a long, thin insulated

rod.

Source: Chapra, Numerical Methods for Engineers, 2008

Page 35: Tobias Bleninger MATEMÁTICA APLICADA I

35

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

Energy balance together with Fourier’s law ofheat conduction yields heat-conductionequation:

Just as elliptic PDEs, parabolic equations canbe solved by substituting finite divideddifferences for the partial derivatives.

In contrast to elliptic PDEs, we must nowconsider changes in time as well as in space.

Parabolic PDEs are temporally open-ended andinvolve new issues such as stability.

t

T

x

Tk

=

2

2

Source: Chapra, Numerical Methods for Engineers, 2008

Page 36: Tobias Bleninger MATEMÁTICA APLICADA I

36

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

36

Source: Chapra, Numerical Methods for Engineers, 2008

Page 37: Tobias Bleninger MATEMÁTICA APLICADA I

37

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

Explicit Methods

The heat conduction equation requires approximations for the second derivative in space and

the first derivative in time:

( )

( )( )211

1

1

2

11

1

2

11

2

2

2

2

2

x

tkTTTTT

t

TT

x

TTTk

t

TT

t

T

x

TTT

x

T

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

=+−+=

−=

+−

−=

+−=

−+

+

+

−+

+

−+

Source: Chapra, Numerical Methods for Engineers, 2008

This equation can be written for all interior nodes on the rod.

It provides an explicit means to compute values at each node for a future

time based on the present values at the node and its neighbors.

Page 38: Tobias Bleninger MATEMÁTICA APLICADA I

38

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

Source: Chapra, Numerical Methods for Engineers, 2008

Page 39: Tobias Bleninger MATEMÁTICA APLICADA I

39

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.msA simple Implicit Method

Implicit methods overcome difficulties

associated with explicit methods at the

expense of somewhat more complicated

algorithms.

In implicit methods, the spatial derivative is

approximated at an advanced time interval

l+1:

which is second-order accurate.

( )2

1

1

11

1

2

2 2

x

TTT

x

T l

i

l

i

l

i

+−

+

++

+

Source: Chapra, Numerical Methods for Engineers, 2008

Page 40: Tobias Bleninger MATEMÁTICA APLICADA I

40

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.tobias.br.ms

( )

( )

( )( ) ( )

( ) ( )1

1

1

1

1

1

01

1

2

1

1

1

0

1

0

1

1

11

1

1

2

1

1

11

1

21

21

21

2

+

+

+

+

+++

++

+

+

++

++

++

+

+=−+

=

+=−+

=

=−++−

−=

+−

l

m

l

m

l

m

l

m

llll

ll

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

tfTTT

mi

tfTTT

tfT

TTTT

t

TT

x

TTTk

This eqn. applies to all but the first and the last

interior nodes, which must be modified to reflect

the boundary conditions:

Resulting m unknowns and m linear algebraic

equations

Source: Chapra, Numerical Methods for Engineers, 2008

Page 41: Tobias Bleninger MATEMÁTICA APLICADA I

41

Tobias Bleninger

Universidade Federal do Paraná (UFPR)

Departamento de Engenharia Ambiental(DEA)

www.Bleninger.info

Referências

• Chapra, Numerical Methods for Engineers, 2008

• School of Computing Science, University of Cincinatti, http://www.cs.uc.edu

• Markus Uhlmann, "Numerical Fluid Mechanics I", IfH, Karlsruhe Institute of Technology

(www.ifh.kit.edu)