additive manufacturing module 8 - am³ lab | am³ lab

35
Additive Manufacturing – Module 8 Spring 2015 Wenchao Zhou [email protected] (479) 575-7250 The Department of Mechanical Engineering University of Arkansas, Fayetteville 1

Upload: others

Post on 02-Jan-2022

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

Additive Manufacturing – Module 8

Spring 2015

Wenchao Zhou

[email protected]

(479) 575-7250

The Department of Mechanical EngineeringUniversity of Arkansas, Fayetteville 1

Page 2: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

2

CAEEvaluating design

https://www.youtube.com/watch?v=p__-QbQbntI

A design of a motion system – motion can be described using kinematic

equations when approximated as rigid structures

Page 3: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

3

CAEEvaluating design

What if your design is deformable structure,

involves heat transfer, or fluids

Page 4: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

4

CAEEvaluating design

Conservation Equations Conservation of MassConservation of EnergyConservation of Momentum

Partial Differential EquationsDescribing change in space and time

Constitutive Models for MaterialsHooke’s LawNewtonian FluidEtc.

Page 5: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

5

CAEEvaluating design

Even much more basic properties of the solutions to Navier–Stokes have neverbeen proven. For the three-dimensional system of equations, and given someinitial conditions, mathematicians have not yet proved that smooth solutionsalways exist, or that if they do exist, they have bounded energy per unit mass.

What about higher order, higher dimension PDEs

Reality: Most PDEs CANNOT be solved analytically!!!

Page 6: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

6

CAEEvaluating design

Numerical solutionsDiscretize and turn PDEs into a system of algebraic equations (mostly linear)

Finite difference methodsFinite element methods

Most popular methods

Finite volume methodBoundary element methodDiscrete element methodSpectral methodParticle based methods

Other methods

http://en.wikipedia.org/wiki/List_of_numerical_analysis_topics#Numerical_methods_for_partial_differential_equations

Page 7: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

7

CAEClassification of PDEsSecond-order linear PDEs

are classified based on the value of the discriminant b2 − 4ac

b2 − 4ac > 0: hyperbolice.g., wave equation: utt− uxx=0Hyperbolic PDEs describe time dependent, conservative physical processes, such as convection, that are not evolving toward steady state.

b2 − 4ac = 0: parabolice.g., heat equation: ut− uxx=0Parabolic PDEs describe time-dependent dissipative physical processes, such as diffusion, that are evolving toward steady state.

b2 − 4ac < 0: elliptice.g., Laplace equation: uxx+ uyy=0Elliptic PDEs describe processes that have already reached steady states, and hence are time-independent.

Wave equation

Heat equation

Laplace equation

Page 8: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

8

CAEFinite Difference Method

dx

xfdxxff

dxx

)()(lim

0

dx

xfdxxffx

)()(

Discretize

Forward difference

dx

dxxfxffx

)()(

Backward difference

dx

dxxfdxxffx

2

)()( Centered difference

Page 9: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

9

CAEFinite Difference Method

Consider a 1D initial-boundary value problem for heat equation

Credit: Vrushali A. Bokil and Nathan L. Gibson @ Oregon State U

Page 10: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

10

CAEFinite Difference Method

Consider a 1D initial-boundary value problem for heat equation

Credit: Vrushali A. Bokil and Nathan L. Gibson @ Oregon State U

Page 11: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

11

CAEFinite Difference Method

Consider a 1D initial-boundary value problem for heat equation

...)(!4

)(!3

)(!2

)(dx)()( ''''4

'''3

''2

' xfdx

xfdx

xfdx

xfxfdxxf

Using Taylor series to determine order of accuracy for the approximation

First order

accurate in time

)()(

...)(!3

)(!2

)(dx1)()(

'

'''3

''2

'

dxOxf

xfdx

xfdx

xfdxdx

xfdxxf

Second order

accurate in space

Page 12: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

12

CAEFinite Difference Method

Consider a 1D initial-boundary value problem for heat equation

Computational Stencil

How to choose ∆t and ∆x?

Page 13: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

13

CAEFinite Difference Method

How to choose ∆t and ∆x?

With ∆x = 0.01 and ∆t = 10−5

t

u

Initial condition: discontinuous at x = 0.5Rapid smoothing of discontinuity as time evolvesHigh frequency damps quickly. The heat equation is stiff

What happens if r is greater than1/2?

Page 14: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

14

CAEFinite Difference Method

How to choose ∆t and ∆x?

Unstable behavior of numerical solution∆t and ∆x cannot be chosen arbitrarily. Must satisfy a stable condition.

What happens if r is greater than1/2?

Page 15: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

15

CAEFinite Difference Method

Implicit FDM

Explicit computational stencilImplicit computational stencil

Page 16: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

16

CAEFinite Difference Method

Implicit FDM

Stable behavior of numerical solution∆t and ∆x cannot be chosen to have the same order of magnitude. Unconditionally stable.

Page 17: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

17

CAEFinite Difference Method

Implicit FDM – 2nd order accurate in time – trapezoid rule

Computational stencil

Unconditionally stableSecond order accurate in time

Page 18: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

18

CAEFinite Difference Method

FDM for advection equation

Information propagates along characteristics

Page 19: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

19

CAEFinite Difference Method

FDM for advection equation

Scheme is explicitFirst order accurate in space and time∆t and ∆x are related by CFL number: ν = a∆t / ∆x

Computational stencil

Page 20: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

20

CAEFinite Difference Method

FDM for advection equation

CFL ν <= 1CFL is a necessary condition for stability of explicit FDM applied to Hyperbolic PDEs. It is not a sufficient condition.

Page 21: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

21

CAEFinite Difference Method

FDM for Laplace equation

Boundary conditions Discretization

Page 22: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

22

CAEFinite Difference Method

FDM for Laplace equation – centered difference scheme

Five-point stencil

Page 23: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

CAEFinite Difference Method

FDM for Laplace equation – form a system of linear equations

23

b contains boundary informationA is block tridiagonalStructure of A depends on the order of grid pointsCan be solved using iterative or direct methods, such as Gaussian elimination

Page 24: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

CAEFinite Element Method

FeaturesComplicated geometriesHigh-order approximationsStrong mathematical foundationFlexibility

24

Basic Idea

Page 25: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

CAEFinite Element Method

25

)()( xfxu

Poisson’s Equation – Elliptic

2

2

2

2

2

22

zyx

Steady state heat transfer

1D Example

Solution must be twice differentiable

Unnecessarily strong if f (e.g., heat supply) is discontinuous

Page 26: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

CAEFinite Element Method

Weak Formulation

26

Page 27: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

CAEFinite Element Method

Approximation

27

The Basic Idea of FEM

Linear System of Equations

Page 28: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

CAEFinite Element Method

Basis functions

... otherwise we are

free to choose any

function ...

The simplest choice

are of course linear

functions:

+ grid nodes

blue lines – basis

functions ji

1

2

3

4

5

6

7

8

9

10

we are looking for functions

with the following property

28

ijxxfor

xxforx

j

i

i ,0

1)(

Page 29: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

CAEFinite Element Method

Stiffness Matrix

29

1

2

3

4

5

6

7

8

9

10

To assemble the stiffness matrix we need the

gradient (red) of the basis functions (blue)

Page 30: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

CAEFinite Element Method

Compare to FDM

30

... regular grid ...

... irregular grid ...

Domain D

Advantage of FEM: do not have to use regular grid

Page 31: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

CAEFinite Element Method

Simplest Matlab FEM code

31

% source term

b=(1:nx)*0;b(nx/2)=1.;

% boundary left u_1 int{ nabla phi_1 nabla phij }

u1=0; b(1) =0;

% boundary right u_nx int{ nabla phi_nx nabla phij }

unx=0; b(nx)=0;

% assemble matrix Aij

A=zeros(nx);

for i=2:nx-1,

for j=2:nx-1,

if i==j,

A(i,j)=2/dx;

elseif j==i+1

A(i,j)=-1/dx;

elseif j==i-1

A(i,j)=-1/dx;

else

A(i,j)=0;

end

end

End

% solve linear system of equations

fem(2:nx-1)=inv(A(2:nx-1,2:nx-1))*s(2:nx-1)'; fem(1)=u1;

fem(nx)=unx;

Domain: [0,1]; nx=100;

dx=1/(nx-1);f(x)=d(1/2)

Boundary conditions:

u(0)=u(1)=0

Page 32: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

CAEFinite Element Method

Results

32

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.05

0.1

0.15

0.2

0.25

x

u(x

) FD (red) - FEM (blue)

Where heat supply is at

Page 33: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

CAESolving Linear Systems

Equations

33

Matrix form

In Matlab

Or X = A-1B

Page 34: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

CAESolving Linear Systems

Linear Algebra (Solving Linear Algebraic Equations)

34

Direct(LU factorization)

More accurate

Maybe cheaper for many time steps

Banded matrix

Need more memory

Typically faster

Iterative

Matrix-free (less memory)

Sparse

SPD (Symmetric Positive Definite)

Converging Issue

Page 35: Additive Manufacturing Module 8 - AM³ Lab | AM³ Lab

CAE

FEM

FDM

35