modelling & computer applications in engineering geng2140€¦ · a.v. dyskin, cre, uwa...

Post on 30-Jun-2020

1 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

A.V. Dyskin, CRE, UWA

Modelling & Computer Applications in Engineering

GENG2140 Pantazis C. Houlis

Notes by Prof. Arcady Dyskin

A.V. Dyskin, CRE, UWA GENG2140 Slide 2

Objectives

  Create mathematical and numerical models of simple but realistic engineering systems

  Solve models using a computer and critically assess results   Understand when an engineering system may be treated as

linear and when non-linear treatment is necessary as well as when the system can by considered probabilistic and when statistical methods are required

  Use mathematical software to efficiently analyse and solve problems in engineering

  Apply the knowledge of basic science and engineering fundamentals; and undertake problem identification, formulation and solution

A.V. Dyskin, CRE, UWA GENG2140 Slide 3

What is the unit about?

  Numerical methods   Packages (Excel, MathLab)   Numerical errors   Sensitivity analysis   Computer simulations

A.V. Dyskin, CRE, UWA GENG2140 Slide 4

Topics

 Computer arithmetic. Truncation and roundoff errors

 Matrices and linear equations

  Ill-conditioned matrices  Sensitivity analysis

A.V. Dyskin, CRE, UWA GENG2140 Slide 5

Additional literature   Forsythe, G.E., M.A. Malcolm & C.B. Moler. 1977.

Computer Methods for Mathematical Computations. Prentice-Hall, Inc.

  Woodford, C. and C. Phillips. 1997. Numerical Methods with Worked Examples. Chapman and Hall, London

  Montgomery, D.C., Runger, G.C. and Hubele, N.F. 2001. Engineering Statistics. John Wiley & Sons, Inc.

  S.M. Ross, 1987. Introduction to Probability and statistics for engineers and scientists. John Wiley & Sons, Inc., New York, London, Sydney, Toronto.

  I.M. Sobol, 1994. A Primer for the Monte-Carlo Method. CRC Press.

A.V. Dyskin, CRE, UWA GENG2140 Slide 6

Teaching material

Lecture notes and assignments – from http://undergraduate.csse.uwa.edu.au/units/GENG2140/

WebCT Lectopia

A.V. Dyskin, CRE, UWA GENG2140 Slide 7

Rules

Room 1.48 E-mail: pantazis.houlis@uwa.edu.au

 Have a copy of the submitted assignment  Remember the name of your tutors  Make sure that all your assignments are

marked  Keep the marked assignments until the end

of the semester

A.V. Dyskin, CRE, UWA GENG2140 Slide 8

Errors

  Types of errors   Computer arithmetic. Truncation and roundoff

errors   Example. Numerical differentiation   Example. Unstable algorithm

Absolute error rrar −=Δ

Relative error a

rrr rr

Δ≈

Δ=δ

Here r is the exact value, ra is an approximate value

A.V. Dyskin, CRE, UWA GENG2140 Slide 9

Points to learn  Types of error  Precision  Catastrophic cancellation  Numerical differentiation  Sensitivity of numerical differentiation to

errors  How to choose the increment  Unstable algorithms

A.V. Dyskin, CRE, UWA GENG2140 Slide 10

Example. Compression of a layered sample Uniaxial loading of

layered material (glass layers) stress vs strain - glass1

01020304050607080

0 0.002 0.004 0.006 0.008

strain

stre

ss (M

Pa)

Stress-strain curve (courtesy Glen Snowen)

A.V. Dyskin, CRE, UWA GENG2140 Slide 11

Tangential modulus εΔ

σΔ≈

ε

σ=εddE )(

-20000

-10000

0

10000

20000

30000

40000

50000

60000

70000

80000

0 10 20 30 40 50 60 70 80

ε [10-6]

E(ε) [MPa]

A.V. Dyskin, CRE, UWA GENG2140 Slide 12

Types and sources of errors   Human/Faulty equipment errors (can be corrected)

•  Checks and verifications   Errors of measurements

•  Systematic –  Calibration

•  Random –  Repeated measurements –  Statistical treatment

  Truncation/Roundoff errors •  Computer arithmetic •  Small •  Double precision computations

A.V. Dyskin, CRE, UWA GENG2140 Slide 13

Computer arithmetic. Truncation and roundoff errors

The floating-point arithmetic

Real numbers are usually represented in computers by floating-point numbers F. They are characterised by: the number base β, the precision t and the exponent range [L, U].

UeLtiddddx ie

tt ≤≤=−β≤≤β⋅⎟⎟⎠

⎞⎜⎜⎝

β++

β+

β±= ,,,1,10,2

21 …

If d1≠0 (for x≠0), then the floating-point number system F is normalised. The integer e is called the exponent

( )ttddf β++β= …1 is the mantissa (fraction)

A.V. Dyskin, CRE, UWA GENG2140 Slide 14

Precision PC

Real (real*4) mode β = = = = −2 24 123 123, , ,t U LDouble precision (real*8) mode, β = = = = −2 53 1023 1023, , ,t U L

Real (real*4) mode β = = = = −10 7 38 38, , ,t U LDouble precision (real*8) mode, β = = = = −10 16 308 308, , ,t U L

Any real number x is replaced in a computer by the closest number, fl(x), from F

The relative error in rounding: t

xxxfl −β≤

− 1

21)(

In decimal system it would approximately correspond to

A.V. Dyskin, CRE, UWA GENG2140 Slide 15

Influence of small errors

  Catastrophic cancellation •  Loss of accuracy due to subtraction of close numbers

0.123456-0.123455=0.000001 (only one significant digit left)

•  Numerical differentiation

  Unstable algorithms   Sensitive models

•  Ill conditioned systems (next two chapters)

A.V. Dyskin, CRE, UWA GENG2140 Slide 16

Numerical differentiation

Finite difference x

xfxxfxfΔ

−Δ+≈ʹ′

)()()(

Choice of Δx: the smaller the better?

Derivative x

xfxxfxfx Δ

−Δ+=ʹ′

→Δ

)()(lim)(0

Other approximations

xxxfxf

xxxfxfxf

x Δ

Δ−−≈

Δ

Δ−−=ʹ′

→Δ

)()()()(lim)(0

xxxfxxf

xxxfxxfxf

x Δ

Δ−−Δ+≈

Δ

Δ−−Δ+=ʹ′

→Δ 2)()(

2)()(lim)(

0

A.V. Dyskin, CRE, UWA GENG2140 Slide 17

Example 1. Function with random errors of amplitude 0.1

x

y = 1 + sin ( ) + errorsxπ

10

2.2

1

1.4

1.8

lL

1x

Δ = 0.1x

Δ = 0.01x

010

5

0

5

10

15Derivative

Lxl <<Δ<<

A.V. Dyskin, CRE, UWA GENG2140 Slide 18

Example 2

RAND()1.02 ∗+= xy

x y 0.1 0.2 0.3 Exact0 0.03401 0

0.1 0.033396 -0.00613 0.20.2 0.1349 1.015037 0.504452 0.40.3 0.123053 -0.11847 0.448285 0.296812 0.60.4 0.195969 0.729159 0.305346 0.54191 0.80.5 0.323187 1.272176 1.000668 0.627623 10.6 0.44743 1.242435 1.257305 1.081257 1.20.7 0.562628 1.151978 1.197206 1.222196 1.40.8 0.739883 1.772547 1.462262 1.388987 1.60.9 0.878518 1.38635 1.579449 1.436958 1.81 1.033344 1.54826 1.467305 1.569052 2

Approximation for yʹ′

A.V. Dyskin, CRE, UWA GENG2140 Slide 19

Plots

0

2

4

6

0 0.5 1 1.5 2 2.5 X

Yy(x)

Exact y'(x)

Δx=0.1 Δx=0.2

Δx=0.3

A.V. Dyskin, CRE, UWA GENG2140 Slide 20

Unstable algorithms. Example: Moment of inertia

x

y

Non-homogeneous material

1)( −= xexρ

1 m

1 m

2

1

0

12 EdxexI xy ≡= ∫ −

∫ ρ=1

0

2 )( dxxxI y

Relative density distribution

A.V. Dyskin, CRE, UWA GENG2140 Slide 21

Moments of inertia for different shapes

x

y

1 m

1 m

3

1

0

13 EdxexI xy ≡= ∫ −

x 1 m

4

1

0

14 EdxexI xy ≡= ∫ −

y

1 m

A.V. Dyskin, CRE, UWA GENG2140 Slide 22

General case

∫ >= −1

0

1 0dxexE xnn

Integration by parts gives the following direct recurrent formula

632120.011,1 01 ≈−=−= − eEnEE nn

x 1 m

y

1 m

A.V. Dyskin, CRE, UWA GENG2140 Slide 23

Calculations Computer with β=10 and t=6 n

Recurrent formula Exact

2 0.264242 0.2642413 0.207274 0.2072774 0.170904 0.1708935 0.14548 0.145336 0.12712 0.1268027 0.11016 0.1123848 0.11872 0.1009329 -0.06848 0.091612

A.V. Dyskin, CRE, UWA GENG2140 Slide 24

Analysis of recurrent computation of inertia moments

Δ×−=Δ×−=

Δ×−=Δ××−×−=

Δ×+=Δ×+×−=

Δ−=

Δ+=

362880!9

6207274.023264242.0312264242.02367879.021

367879.063212.0

999

3

2

1

0

exactexact EEE

EEEE

Initial roundoff error 610368.0 −×≈Δ

The error of 9-th step is 0.133>E9exact

This algorithm is unstable – error accumulation

11 −−= nn nEE

A.V. Dyskin, CRE, UWA GENG2140 Slide 25

Summary   Errors

•  Measurements •  Computational

–  Computer arithmetic –  Truncation and roundoff errors –  Controlled by precision - formula

  Catastrophic cancellation •  Subtraction of close numbers •  Numerical differentiation

–  Amplifies errors –  Choice of step (not too large, not too small)

  Unstable algorithms •  Inertia moment example •  Simple methods could lead to catastrophic accumulation of errors

A.V. Dyskin, CRE, UWA GENG2140 Slide 26

Matrices and linear equations  Matrix operations  Example of applications of matrices.

Stresses  Stress transformations under coordinate

rotations

 Principal stresses and principal directions  Systems of linear algebraic equations   Inverse matrix

A.V. Dyskin, CRE, UWA GENG2140 Slide 27

Points to note   Matrix – a table of numbers with special operations   Stress is a matrix (it is not just force per area)   Matrix can represent the effect of co-ordinate rotations

•  Change of stress matrix due to co-ordinate rotations •  Principal stresses and principal co-ordinate axes

–  How to find –  Engineering significance

  System of linear equations •  One solution •  Many solutions •  No solutions •  Engineering significance

  Methods of solution •  Gaussian elimination •  Method of inverse matrix

A.V. Dyskin, CRE, UWA GENG2140 Slide 28

Matrix operations   Addition A+B   Multiplication AB   Transpose AT

  Determinant det(A)   Inverse matrix A-1

  Eigenvalues and eigenvectors   Matrix norm (equivalent to the length of vector)   Condition number (indicator of sensitivity of the

system of linear equations to random errors)   Matrix rank

A.V. Dyskin, CRE, UWA GENG2140 Slide 29

Matrix addition and multiplication

A 1 4 7

2 5 8

3 6 9

B 1 2 1

0 3 1

1 4 2

C A B = C 0 6 6

2 8 7

4 10 7

A 1 4 7

2 5 8

3 6 9

B 1

2 1

0 3 1

1 4 2

= . A B 0 0 0

3 9 15

3 12 21

= . B A 6 42 19

6 51 23

6 60 27

BAAB ≠

=TA

1

2

3

4

5

6

7

8

9

A

1

4

7

2

5

8

3

6

9Matrix transpose

A.V. Dyskin, CRE, UWA GENG2140 Slide 30

Inverse matrix

IAAAA == −− 11

A is a square matrix

The inverse matrix exists if and only if det(A)≠0

If det(A)=0, matrix A is called singular

Inverse matrix A-1:

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

−−−−=

nnnn

n

n

aaa

aaaaaa

A

21

22121

11211

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

−−−−=

100

010001

Iwhere I is the identity matrix:

A.V. Dyskin, CRE, UWA GENG2140 Slide 31

Determinant and inverse

B 1

2 1

0 3 1

1 4 2

Determinant: = B 3

= B 1 0.667 0 0.333

0.333 1 0.333

1 2 1

=.B B 11

0

0

0

1

0

0

0

1

=.B 1 B

1

0

0

0

1

0

0

0

1

A.V. Dyskin, CRE, UWA

A 2 1

1 2

x

y Ax = λx = λ

Ax - λx = 0 Ax – (λΙ )x = 0 (A – λΙ )x = 0

λΙ λ

0 0 λ

Α - λΙ 2 - λ

1 1

2 - λ

det(Α - λΙ ) = 0 ⇒ λ2 - 4λ + 3 = 0 ⇒ λ1 = 1 , λ2 = 3

2 - λ1

1 1

2 - λ1

x

y

0

0 = ⇒ ⇒ x + y = 0 ⇒

x

y

0

0 = 1

1 1 1

1

-1 x1 =

2 - λ2

1 1

2 - λ2

x

y

0

0 = ⇒ ⇒ x - y = 0 ⇒

x

y

0

0 = -1

1 1 -1

1

1 x2 =

Ax1 = λ1x1

Ax2 = λ2x2 ⇒ A (x1 x2) = (x1 x2)

λ1

0 0 λ2

⇒ (x1 x2) -1 A (x1 x2) = λ1

0 0 λ2

Eigenvalues and eigenvectors

1 -1

1 1

2 1

1 2

1 -1

1 1

1 0

0 3 = ⇒

-1

A.V. Dyskin, CRE, UWA GENG2140 Slide 33

Eigenvalues and eigenvectors

M 1 2 3

2 5 8

3 8 9

= eigenvals ( ) M 0.192 1.294 16.102

R eigenvecs ( ) M = R 0.957 0.282 0.07

0.175 0.752 0.635

0.232 0.596 0.769

= . . T R M R 0.192 0 0

0 1.294 1.776 10 15

0 1.554 10 15

16.102

A.V. Dyskin, CRE, UWA GENG2140 Slide 34

Stress

n

F A

Surface element

  Force is a vector   Direction of surface element is

represented by its normal vector

  Stress is a matrix

AreaForceStress = ?

High School

A.V. Dyskin, CRE, UWA GENG2140 Slide 35

Stress matrix σz

x

y

z

σy

σx

τzy

τzx

τyx

τyz

τxy

τxz σ

σ τ ττ σ τ

τ τ σ

σ σ

σ σ

σ σ

=

⎜⎜⎜

⎟⎟⎟

x xy xz

yx y yz

zx zy z

x xx

y yy

z zz

Stress matrix (tensor)

τ τ τ τ τ τxy yx xz zx yz zy= = =, ,Symmetry:

A.V. Dyskin, CRE, UWA GENG2140 Slide 36

Stress in the given direction (on the given surface element)

Stress acting on the surface element

z

y

x

F=(Fx, Fy, Fz)

n=(nx, ny, nz)

A

S FA

n n n

SFA

n n n

S FA

n n n

xx

x x y yx z zx

yy

x xy y y z zy

zz

x xz y yz z z

= = + +

= = + +

= = + +

σ τ τ

τ σ τ

τ τ σ

A.V. Dyskin, CRE, UWA GENG2140 Slide 37

Stresses at different angles p

p

p

p p

p

p

p

A.V. Dyskin, CRE, UWA GENG2140 Slide 38

Coordinate rotation

x

y

z

i j

k

ix

iy

iz

σ σʹ′

Rotation matrix

⎟⎟⎟

⎜⎜⎜

=

zyx

zyx

zyx

Rkkkjjjiii

where ⎟⎟⎟

⎜⎜⎜

=

zzz

yyy

xxxTR

kjikjikji

σʹ′=RσRT

Stress transformation

- transposed matrix

A.V. Dyskin, CRE, UWA GENG2140 Slide 39

Example. Fault in Earth’s crust

x

y

z

N

12 MPa

6 MPa

9 MPa

MPa⎟⎟⎟

⎜⎜⎜

9000120006

20° 60°

zf

yf

xf

The fault dips 60 ° in the dip direction 20° North-West. The friction angle is ϕ= 30°, the cohesion C=0.

A.V. Dyskin, CRE, UWA GENG2140 Slide 40

Stresses at the fault Step 1

x

y

z

x ʹ′

20°

z ʹ′ y ʹ′

20°

⎟⎟⎟⎟

⎜⎜⎜⎜

−=

100020cos20sin020sin20cos

R

x ʹ′

y ʹ′

z ʹ′ zf

yf

xf

60° ⎟⎟⎟⎟

⎜⎜⎜⎜

=

60cos060sin01060sin060cos

fRStep 2

( ) ( ) 2.430tan276.7944.1232

231 =<=σ+σ=τ ff The fault is stable

σ1:=RσRT

σf:=Rfσ1RfT

⎟⎟⎟

⎜⎜⎜

−−

−−

9000298.11928.10928.1702.6

1

⎟⎟⎟

⎜⎜⎜

−−

−−−

276.767.1995.067.1298.11964.0995.0964.0425.8

f

A.V. Dyskin, CRE, UWA GENG2140 Slide 41

Principal stresses σI≥ σII≥ σIII

Principal directions Three special orientations of the axes at which there are no shear stresses

⎟⎟⎟

⎜⎜⎜

σ

σ

σ

III

II

I

000000

σz

x

y

z

σy

σx

τzy

τzx

τyx

τyz

τxy

τxz

Eigenvectors Eigenvalues

Principal directions ( principal axes)

xx xy xz

yx yy yz

zx zy zz

σ τ τ

σ τ σ τ

τ τ σ

⎛ ⎞⎜ ⎟

= ⎜ ⎟⎜ ⎟⎝ ⎠

A.V. Dyskin, CRE, UWA GENG2140 Slide 42

Example

10 MPa

5 MPa

x

y

z

MPa⎟⎟⎟

⎜⎜⎜

1050500000

σ

0

0

0

0

0

5

0

5

10

=eigenvals ( )σ

0

2.071

12.071

=eigenvecs ( )σ

1

0

0

0

0.924

0.383

0

0.383

0.924

MPaprinc⎟⎟⎟

⎜⎜⎜

071.120000000071.2 I II III

II

I III θ

θ=cos-10.924=22.48°

σII

σI

σIII

A.V. Dyskin, CRE, UWA GENG2140 Slide 43

Solving systems of linear algebraic equations

 Gaussian eliminations  Method of inverse matrix

A.V. Dyskin, CRE, UWA GENG2140 Slide 44

Solution

Gaussian elimination

⎩⎨⎧

=+−

=+

22412yx

yxExample

⇒⎩⎨⎧

=

=+

4412

yyx

Gaussian elimination The first equation is multiplied with 2 and added to the second one

Back substitutions

⎩⎨⎧

=

=+

112

yyx

⇒⎩⎨⎧

=

=

102

yx

10

=

=

yx

Matrix form

⎟⎟⎠

⎞⎜⎜⎝

−=

2412

A ⎟⎟⎠

⎞⎜⎜⎝

⎛=21

BMatrix of the system

Vector of right parts ⎟⎟

⎞⎜⎜⎝

−=

224112

)|( bAAugmented matrix

⎟⎟⎠

⎞⎜⎜⎝

⎛→⎟⎟⎠

⎞⎜⎜⎝

⎛→⎟⎟⎠

⎞⎜⎜⎝

⎛→⎟⎟⎠

⎞⎜⎜⎝

⎛→⎟⎟⎠

⎞⎜⎜⎝

− 101001

101002

111012

414012

212412

detA=8≠0

A.V. Dyskin, CRE, UWA GENG2140 Slide 45

Case 1 of detA=0 Example

⎪⎩

⎪⎨

=++

=++

=+−

3422321

zyxzyxzyx

0412321111

det =

=A

⎟⎟⎟

⎜⎜⎜

→⎟⎟⎟

⎜⎜⎜

⎛ −

→⎟⎟⎟

⎜⎜⎜

⎛ −

→⎟⎟⎟

⎜⎜⎜

⎛ −

→⎟⎟⎟

⎜⎜⎜

⎛ −

03/13/4

0003/2103/501

03/11

0003/210111

011

000230111

111

230230111

321

412321111

x=4/3-5/3 z

y=1/3-2/3 z Mechanical interpretation: statically indeterminate system

Infinite number of solutions

A.V. Dyskin, CRE, UWA GENG2140 Slide 46

Case 2 of detA=0 Example

⎪⎩

⎪⎨

=++

=++

=+−

4422321

zyxzyxzyx

0412321111

det =

=A

⎟⎟⎟

⎜⎜⎜

⎛ −

→⎟⎟⎟

⎜⎜⎜

⎛ −

→⎟⎟⎟

⎜⎜⎜

⎛ −

111

000230111

211

230230111

421

412321111

Mechanical interpretation: Mechanism

No solutions

A.V. Dyskin, CRE, UWA GENG2140 Slide 47

Method of inverse matrix Matrix form BAX =

is the vector of unknowns ⎟⎟⎠

⎞⎜⎜⎝

⎛=yx

X

If the inverse matrix exists, the solution of the linear system can be expressed in the matrix form

BAX 1−=

A method of finding inverse matrix

i-th column of the inverse matrix is a solution of ⎟

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜⎜

=

0...1...0

Axi-th place

A.V. Dyskin, CRE, UWA GENG2140 Slide 48

Summary   In many packages operations written in a matrix form run faster   Matrix multiplication is not commutative AB≠BA   Inverse matrix A-1 exists only if detA≠0   Stress is a (symmetric) matrix with diagonal elements

representing normal stresses, non-diagonal elements – shear stresses

  Change with co-ordinate rotation: σʹ′=RσRT

  In principal directions only normal (principal) stresses exist. Principal directions and stresses are eigenvectors and eigenvalues of the stress matrix. An application: failure analysis

  Singular matrix of the system •  Many solutions – statically indetermined system •  No solutions – mechanism

  Inverse matrix is used to solve systems with the same matrix but varying right hand parts

top related