cfd2 computer fluid dynamics e181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/cfd2.pdf · 2016-10-06 ·...

55
Remark: foils with black backgroundcan be skipped, they are aimed to the more advanced courses Rudolf Žitný, Ústav procesní a zpracovatelské techniky ČVUT FS 2013 Overview of CFD numerical methods Computer Fluid Dynamics E181107 CFD2 2181106

Upload: others

Post on 17-Jan-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

Remark: foils with „black background“ can

be skipped, they are aimed to the more

advanced courses

Rudolf Žitný, Ústav procesní a

zpracovatelské techniky ČVUT FS 2013

Overview of CFD

numerical methods

Computer Fluid Dynamics E181107CFD2

2181106

Page 2: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

CFD and PDECFD2

CFD problems are described by transport partial differential equations (PDE) of the

second order (with second order derivatives). These equations describe transport of

mass, species, momentum, or thermal energy. Result are temperature, velocities,

concentrations etc. as a function of x,y,z and time t

PDE of second order are classified according to signs of coefficients at highest

derivatives of dependent variable (for more details, see next slides):

Hyperbolic equations (evolution, typical for description of waves, finite speed of information transfer)

Parabolic equations (evolution problems, information is only in the direction of evolution variable t -

usually time but it could be also distance from the beginning of an evolving boundary layer)

Eliptic equations (typical for stationary problems, infinite speed of information transfer)

fxt

2

2

2

2

fxy

2

2

2

2

fxt

2

2

0)( 2 Sau

0

yc

t

convection by velocity c

Examples: supersonic flow around a plane, flow in a Laval

nozzle, pulsation of gases at exhaust or intake pipes

Examples: evolution of boundary layer (in this case t-

represents spatial coordinate in the direction of flow and x

is coordinate perpendicular to the surface of body)

Examples: subsonic flows around bodies (spheres,

cylinders), flow of incompressible liquids

Page 3: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

CFD and PDECFD2

Why is it important to distinguish types of PDE?

Because different methods are suitable for different

types (e.g. central differencing in elliptical region

and time marching schemes in hyperbolic or

parabolic regions)

Page 4: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

Characteristics (1/3)CFD2

f can be function of x,y,

and first derivatives.

yx(),y()-parametrically defined curve, where

first derivatives p(),q() are specified

x

Page 5: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

Characteristics (2/3)CFD2

Right hand side is fully

determined by prescribed first

derivatives (by boundary

conditions) along selected curve

Proof!!!

Page 6: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

Characteristics (3/3)CFD2

Is the solution of quadratic

equation correct? Check signs.

Page 7: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

Characteristics CFD2

fxt

2

2

2

2

xt xt

x

t

Value at point x,t is determined

only by conditions at red boundary

Domain of

dependence

There can be

discontinuity across

the characteristic lines)

Wave equation - hyperbolic

Page 8: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

PDE type - example CFD2

One and the same equation can be in some region elliptic, in other hyperbolic

(for example regions of subsonic and supersonic flow, separated by a shock

wave).

An example is Prandl-Glauert equation describing steady, inviscid,

compressible and isentropic (adiabatic) flow of ideal fluid around a slender body

(e.g. airfoil)

0)1(2

2

2

22

yxM

yv

xu

,

x

y

Function (x,y) is velocity potential, M is Mach number (ratio of velocity of

fluid and speed of sound). For M<0 (subsonic flow region) the equation is

elliptic, for M>1 (supersonic flow) the equation is hyperbolic. See wikipedia.

Another example: Laval nozzle

Page 9: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

PDE type – example PWV CFD2

Pulse Wave Velocity in elastic pipe

(latex tube, arteries)

Model-hyperbolic equations

Experiment-cross correlation technique

using high speed cameras

Macková, H. - Chlup, H. - Žitný, R.: Numerical model

for verification of constitutive laws of blood vessel

wall. Journal of Biomechanical Science and

Engineering. 2007, vol. 2, no. 2/1, p. s66.

Page 10: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

PDE type – example WHCFD2

Water Hammer experiment with elastic

pipe (latex tube, artificial artery)

Model-hyperbolic equations

Experiment-cross correlation technique

using high speed cameras

Pressure sensors

Page 11: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

K

p

CFD2 Hyperbolic equations WHFlows in a pipe. Time dependent cross section A(t,x), or time dependent mean

velocity v(t,x). Compressible fluid or elastic pipe. Relationship between volume and

pressure is characterised by modulus of elasticity K [Pa]

Problem is to predict pressure and flowrate courses along the pipeline p(t,x), v(t,x).

Basic equations: continuity and momentum balance (Bernoulli). In simplified form

* 0

| | 02

p vK

t x

v p fv v

t x D

neglected convective

term. f-is friction factor

p

A

A

K

KK

1

*

2apK

related to speed of

sound a

,02

22

2

2

x

pa

t

p

*Ka

Speed of

soundVelocity v(t,x) can be eliminated by neglecting

friction, giving

Page 12: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

CFD2 Hyperbolic equations WHHow to derive equations of characteristics

2 0

z

p va

t x

v pe

t x

multiply by and

add both equations

2

this could be this could be directional derivative directional derivative

1( ) ( )

= + = +

z

p p v va e

t x t x

dp p x p dv v x v

dt t t x dt t t x

21a

dt

dx

sticcharacteristiccharacteri

, 1

adt

dxa

dt

dx

a

Page 13: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

CFD2 Hyperbolic equations WHThere are two characteristic lines corresponding to two values of

A

C

x1=at

Integration along the characteristic line from A to C

B

x2=-at

Integration along the characteristic line from B to C

Page 14: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

Method of characteristicCFD2

1( ( | | | |))

2 2

A BC A B A A B B

p p fhv v v v v v v

a aD

( ( ) ( | | | |))2 2

A BC A B B B A A

p pa fhp v v v v v v

a aD

Solution of previous system of 2 algebraic equations

v(t)

p=p0C

B

||2

BBBC

BC vvaD

fh

a

ppvv

A

||2

)( AAACAC vvD

fhvvapp

A B

C

x2=-atx1=at

h

h/a

Page 15: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

Method of characteristicCFD2

l=1;d=0.01;rho=1000;f=0.1;a=1;p0=2e3;

v0=(p0*2*d/(l*rho*f))^0.5

n=101;h=l/(n-1);v(1:n)=v0;p(1)=p0;

for i=2:n

p(i)=p(i-1)-f*rho*v0^2*h/(2*d);

end

dt=h/a;tmax=3;itmax=tmax/dt;fhr=f*h/(2*a*d);

for it=1:itmax

t=it*dt;

for i=2:n-1

pa=p(i-1);pb=p(i+1);va=v(i-1);vb=v(i+1);

pc(i)=a/2*((pa+pb)/a+rho*(va-vb)+fhr*(vb*abs(vb)-va*abs(va)));

vc(i)=0.5*((pa-pb)/(rho*a)+va+vb-fhr*(vb*abs(vb)+va*abs(va)));

end

pc(1)=p0; vb=v(2);pb=p(2);

vc(1)=vb+(pc(1)-pb)/(a*rho)-fhr*vb*abs(vb);

vc(n)=v0*valve(t); va=v(n-1);pa=p(n-1);

pc(n)=pa-rho*a*(vc(n)-va)+f*h*rho/(2*d)*va*abs(va);

vres(it,1:n)=vc(1:n); pres(it,1:n)=pc(1:n);

p=pc;v=vc;

end

pmax=max(max(pres))/p0

x=linspace(0,1,n);

time=linspace(0,tmax,itmax);

contourf(x,time,pres,30)

0 0.2 0.4 0.6 0.8 10

0.5

1

1.5

2

2.5

3

200

400

600

800

1000

1200

1400

1600

1800

2000

n=301

0 0.2 0.4 0.6 0.8 10

0.5

1

1.5

2

2.5

3

200

400

600

800

1000

1200

1400

1600

1800

2000

n=101

time (0-3 s)

Pressure profiles

Pipe L=1m, D=0.01 m, speed of sound a=1 m/s, inlet pressure 2 kPa (steady velocity v=0.6325 m/s).

Page 16: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

Method of characteristicCFD2

Incorrect boundary condition at exit (elastic and rigid tube connection)

1( | |)

2C A A C A A

fhv v p p v v

a D

Le

| |0

2

e

e e

p pv f v v

t L D

A

C

e

||2

)( AABCBC vvD

fhvvapp

Bernoulli at an elastic tube

| |0

2

v p f v v

t x D

| |( ) 0

2

ee

e e

p pp f v vD D

x L DD

Bernoulli at a rigid tube

D

| |( ) 0

2

C D C ee

e e

p p p p f v vD D

h L DD

Page 17: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

Method of characteristicCFD2

0 0.2 0.4 0.6 0.8 10

0.5

1

1.5

2

2.5

3

-400

-200

0

200

400

600

n=401,Le=0, pmax=669

0 0.2 0.4 0.6 0.8 10

0.5

1

1.5

2

2.5

3

-600

-400

-200

0

200

400

600

n=401,Le=0.5, pmax=669

0 0.2 0.4 0.6 0.8 10

0.5

1

1.5

2

2.5

3

-400

-200

0

200

400

600

n=401,Le=1, pmax=709

0 0.2 0.4 0.6 0.8 10

0.5

1

1.5

2

2.5

3

-400

-200

0

200

400

600

n=401,Le=2, pmax=803

0 0.5 1 1.5 2 2.5 3-0.5

-0.4

-0.3

-0.2

-0.1

0

0.1

0.2

0.3

0.4

0.5

function vrel=pump(t)

vrel=0.5*sin(3*t);

0 0.2 0.4 0.6 0.8 10

0.5

1

1.5

2

2.5

3

-400

-200

0

200

400

600

n=401,Le=0.1, pmax=669

Classical numerical methods (Lax Wendroff), require at least slightly flexible

connected pipe. MOC seems to be working with a rigid pipe too?

Page 18: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

NUMERICAL METHODS CFD2

The following slides are an attempt to

overview frequently used numerical

methods in CFD. It seems to me, that all

these methods can be classified as specific

cases of Weighted Residual Methods.

Schiele

Page 19: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

MWR methods of weighted residualsCFD2

Principles of Weighted Residual Methods will be demonstrated for a typical

transport equation (steady state) – transport of matter, momentum or energy

0)( 2 Sau

Convective

transportDispersion

(diffusion)Inner sources

Numerical solution (x,y,z) is only an approximation and the previous equation will

not be satisfied exactly, therefore the right hand side will be different from zero

),,()( 2 zyxresSau

res(x,y,z) is a RESIDUAL of differential equation. A good approximation

should exhibit the smallest residuals as possible, or zero weighted residuals

( , , ) ( , , ) 0, i 1,2,...Ni

V

res x y z w x y z dxdydz

wi are selected weighting functions, and V is the whole analyzed region.

Page 20: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

Approximation – base CFD2

Approximation is selected as linear combination of BASE functions Nj(x,y,z)

j

jj zyxNzyx ),,(),,(

0))((

))((

2

2

V

i

j

jj

j

jj

V

i

dxdydzwSNaNu

dxdydzwSau

Substituting into weighted residuals we obtain system of algebraic equations for

coefficients I (N-equations for N-selected weight functions wi)

Page 21: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

Weighting functionsCFD2

Weighting functions can be suggested more or less arbitrarily in advance and

independently of calculated solution. However there is always a systematic

classification and families of weighting functions. Majority of numerical methods can

be considered as MWR corresponding to different classes of weighting functions

Spectral methods (analytical wi(x))

Finite element methods (Galerkin – continuous weighting function)

Control volume methods (discontinuous but finite weighting function)

Collocation methods (zero residuals at nodal points, infinite delta functions)

)( ii xxw

xi

)()( 2/12/1 iii xxhxxhw

xi

xi

(or Finite Volume methods)

(Boundary element methods)

(Finite Differences)

Page 22: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

SPECTRAL METHOD ORTHOGONAL FUNCTIONSCFD2

General characteristics

Analytical approximation (analytical base functions)

Very effective and fast (when using Fast Fourier Transform)

Not very suitable for complex geometries (best case are rectangular regions)

0

)()(j

jj xPTxT

Page 23: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

SPECTRAL METHOD ORTHOGONAL POLYNOMIALSCFD2

Weight functions and base functions are selected as ORTHOGONAL functions (for

example orthogonal polynomials) Pj(x). Orthogonality in the interval x (a,b) means

b

a

ijji dxxPxPxg )()()(In words: scalar product of

different orthogonal

functions is always zero.

Page 24: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

WHY ORTHOGONAL?CFD2

Why not to use the simplest polynomials 1,x,x2,x3,…? Anyway, orthogonal

polynomials are nothing else than a linear combination of these terms? The reason is

that for example the polynomials x8 and x9 look similar and are almost linearly

dependent (it is difficult to see the difference by eyes if x8 and x9 are properly

normalised). Weight functions and base functions should be as different (linearly

independent) as possible. See different shapes of orthogonal polynomial on the next

slide. Remark: May be you know, that linear polynomial regression fails for polynomials of degree 7 and higher. The reason

are round-off errors and impossibility to resolve coefficients at higher order polynomial terms (using arithmetic with finite number

of digits). You can perform linear regression with orthogonal polynomials of any degree without any problem.

There is other reason. Given a function T(x) it is quite easy to calculate coefficients

of linear combination without necessity to solve a system of algebraic equations:

0

)()(j

jj xPTxT

b

a

jj dxxTxPT )()(

Proof!!!

Page 26: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

SPECTRAL METHOD FOURIER EXPANSIONCFD2

Goniometric functions (sin, cos) are orthogonal in interval (-,).

Orthogonality of. Pn(x)=cos nx follows from

])sin()sin(

[2

1

))cos()(cos(2

1coscos

nm

xnm

nm

xnm

dxxnmxnmnxdxmx

for m=n, otherwise 0

In a similar way the orthogonality of sin nx can be derived. From the Euler’s

formula follows orthogonality of jxijxexP ijx

j sincos)(

Linear combination of Pj(x) is called Fourier’s expansion

0

)()(j

jj xPTxT

Proof!!!

The transformation T(x) to Tj for j=0,1,2,…, is called Fourier transform and its

discrete form is DFT T(x1), T(x2),…. T(xN) to T1,T2,…TN . DFT can be realized by

FFT (Fast Fourier Transform) very effectively.

i-imaginary unit

Page 27: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

SPECTRAL METHOD EXAMPLECFD2

Poisson’s equation (elliptic). This equation describes for example

temperature in solids with heat sources, Electric field, Velocity potential

(inviscid flows).),(

2

2

2

2

yxfx

T

y

T

Fourier expansion of two variables x,y (i-imaginary unit, not an index)

)(),( kyjxi

jkeTyxT )(),( kyjxi

jkefyxf

Substituting into PDE )()(22 )( kyjxi

jk

kyjxi

jk efekjT

22 kj

fT

jk

jk

Evaluated Fourier

coefficients of solution

Technical realization

Use FFT routine for calculation fjkEvaluate Tjk

T(x,y) by inverse FFT

Page 28: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

FINITE ELEMENT methodCFD2

General characteristics

Continuous (but not smooth) base as well as weighting functions

Suitable for complicated geometries and structural problems

Combination of fluid and structures (solid-fluid interaction)

Page 29: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

FINITE ELEMENT methodCFD2

12

3

x

y

4

5

6

Base functions Ni(x), Ni(x,y) or Ni(x,y,z) and corresponding weight functions

are defined in each finite element (section, triangle, cube) separately as a

polynomial (linear, quadratic,…). Continuity of base functions is assured by

connectivity at nodes. Nodes xj are usually at perimeter of elements and are

shared by neighbours.

Base function Ni (identical with weight function wi) is associated with node

xi and must fulfill the requirement: (base function is 1 in

associated node, and 0 at all other nodes)ijji xN )(

In CFD (2D flow) velocities are approximated by quadratic polynomial (6

coefficients, therefore 6 nodes ) and pressures by linear polynomial (3

coefficients and nodes ). Blue nodes are prescribed at boundary.

Verify number

of coeffs.!

Page 30: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

FINITE ELEMENT exampleCFD2

),(2

2

2

2

yxfx

T

y

T

0)),(()),((

2

2

2

2

dyxwfy

T

y

w

x

T

x

wdyxf

x

T

y

Tw

)()( xNTxT jj

fdNTd

y

N

y

N

x

N

x

Ni

n

j

j

jiji

1

)(

fdNTA i

n

j

jij

1

Poisson’s equation

MWR and application of Green’s theorem

Base functions are identical with weight function (Galerkin’s method)

wi(x)=Ni(x)

Resulting system of linear algebraic equations for Ti

Derive Green’s

theorem!

Page 31: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

BOUNDARY element methodCFD2

General characteristics

Analytical (therefore continuous) weighting functions. Method evolved

from method of singular integrals (BEM makes use analytical weight

functions with singularities, so called fundamental solutions).

Suitable for complicated geometries (potential flow around cars,

airplanes… )

Meshing must be done only at boundary. No problems with

boundaries at infinity.

Not so advantageous for nonlinear problem.

Introductory course on BEM including Fortran source

codes is freely available in pdf ( Whye-Teong Ang 2007)

Page 32: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

BOUNDARY element exampleCFD2

),(2

2

2

2

yxfx

T

y

T

Poisson’s equation

MWR and application of Green’s theorem twice (second derivatives transferred to w)

Weight functions are solved as a fundamental solution of adjoined equation

Green’s

theorem!

fwdxdywd

y

Tn

x

Tndxdy

y

w

y

T

x

w

x

Tyx )()(

fwdxdyd

y

wT

y

Twn

x

wT

x

Twndxdy

y

w

x

wT yx ))()(()(

2

2

2

2

),(2

2

2

2

iiii yyxx

y

w

x

w

i

ir

yxw1

ln2

1),(

22 )()( iii yyxxr

Singularity: Delta function at a point xi,yi Delta function!

Solution (called Green’s function) is

Verify!

Page 33: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

BOUNDARY element exampleCFD2

Substituting w=wi (Green’s function at point i)

fwdxdyd

y

wT

y

Twn

x

wT

x

Twndxdy

y

w

x

wT yx ))()(()(

2

2

2

2

dxdyfwd

y

wn

x

wnT

y

Tn

x

TnwyxT i

i

y

i

xyxiii )]()([),(

N

j

jj NTT1

)()(

N

j

jnj NTn

T

1

)()(

Solution T at arbitrary point xi,yi is expressed in terms of boundary values

Γ2 (normal

derivative)Γ1 (fixed T)

At any boundary point

must be specified either T

or normal derivative of T,

not both simultaneously.

Page 34: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

BOUNDARY element exampleCFD2

Γ2 (normal

derivative)Γ1 (fixed T)

dxdyfwdN

y

wn

x

wnTwT ij

i

y

i

xjinj )]([0

dxdyfwdN

y

wn

x

wnTdNwT ij

i

y

i

xjjinj )(

Values at boundary nodes not specified as boundary conditions must be

evaluated from the following system of algebraic equations:

Page 35: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

FINITE VOLUME methodCFD2

Will be discussed in more details in this course

General characteristic:

Discontinuous weight functions

Structured, unstructured meshes.

Conservation of mass, momentum, energy (unlike FEM).

Only one value is assigned to each cell (velocities, pressures).

Page 36: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

FINITE VOLUME exampleCFD2

),(2

2

2

2

yxfx

T

y

T

0)),(()),(()),((2

2

2

2

2

2

2

2

ii

dyxfTdyxfx

T

y

Tdyxf

x

T

y

Tw

i

iT

P

TETW

TN

TS

0),()),(( iii

dyxfTdndyxfT

x

PS

PSy

PW

PWx

PN

PNy

PE

PE hyy

TTh

xx

TTh

yy

TTh

xx

TTTdn

i

yxPP hhyxfdyxf

i

),(),(

Poisson’s equation

MWR (Green’s theorem cannot be applied because w(x) is discontinuous)

Gauss theorem (instead of Green’s)

hy

hx

Page 37: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

FINITE DIFFERENCES methodCFD2

Will be discussed in more details in this course

General characteristic:

Substitution derivatives in PDE by finite differences.

Transformation from computational (rectangular) to physical (curvilinear) domain

Suitable first of all for gas dynamic (compressible flows – aerodynamics)

Page 38: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

Finite differences methods specify zero residuals in selected nodes (the

same requirement as in classical collocation method). However, residuals in

nodes are not calculated from a global analytical approximation (e.g. from

orthogonal polynomials), but from local approximations in the vicinity of zero

residual node.

It is very easy technically: Each derivative in PDE is substituted by finite

difference evaluated from neighbouring nodal values.

FINITE DIFFERENCESCFD2

2

11

2

2 2

x

TTT

x

T iii

Ti Ti+1Ti-1

x

x

TT

x

T ii

1

x

TT

x

T ii

2

11

Upwind 1st order

Central differencing 2st order

Central differencing 2st order

Verify!

Page 39: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

FINITE DIFFERENCES exampleCFD2

ji

jijijijijijif

y

TTT

x

TTT,2

1,,1,

2

,1,,1 22

),(2

2

2

2

yxfy

T

x

T

Poisson’s equation

Ti,jTi+1,jTi-1,j

Ti,j+1

Ti,j-1

xy

Eliptic equation – it is

necessary to solve a large

system of algebraic equations

Page 40: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

FINITE DIFFERENCES exampleCFD2

exact solution0

x

Tc

t

T

)(),( ctxTxtT

Wave equation (pure convection)

tn+1/2

tn

tn+1

xk-1 xk+1xk

x

t/2

First step – Lax’s scheme with time step t/2

Second step – central differences

Lax Wendroff method

tn+1/2

tn

tn+1

xk-1 xk+1xk

x

t

Hyperbolic PDE-it is possible to

use explicit method

?

1/2 1/21 11/2 1/2

1 12 20 0/ 2 / 2

n n n nn nk k k k

n n n nk kk k k k

T T T TT T

T T T Tc c

t x t x

1 1/2 1/2

1/2 1/2 0n n n n

k k k kT T T Tc

t x

Page 41: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

FINITE DIFFERENCES exampleCFD2

Wave equation (pure convection)

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-2.5

-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

2.5x 10

12

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.2

0.4

0.6

0.8

1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

x [m]

CFL=0.1

CFL=1

CFL=1.1

dt=0.011;c=1;l=1;n=101;dx=l/(n-1); cfl=c*dt/dx

for i=1:n

x(i)=(i-1)*dx;

if x(i)<0.1

t0(i)=0;

else

t0(i)=1;

end

end

tmax=1.;itm=tmax/dt;

for it=1:itm

for i=2:n-1

ta(i)=(t0(i-1)+t0(i))/2-cfl*(t0(i)-t0(i-1))/2;

end

ta(1)=t0(1);ta(n)=t0(n);

for i=2:n-1

t(i)=t0(i)-cfl*(ta(i+1)-ta(i));

end

t(1)=t0(1);t(n)=t0(n);

tres(it,:)=t(:); t0=t;

end

Stability restriction when using

explicit methods

1

x

tcCFL

in this case the PDE

is integrated along

characteristic

Page 42: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

MESHLESS methodsCFD2

General characteristics

Not available in commercial software packages

Suitable for problems with free boundary

Multiphase problems

Easy remeshing (change of geometry) / in fact no meshing is necessary

Page 43: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

MESHLESS methodsCFD2

Recommended literature: Shaofan Li, Wing Kam Liu: Meshfree Particle Method, Springer Berlin 2007

(MONOGRAPhy analyzing most of the mentioned method and applications in mechanics of elastoplastic materials, transient

phenomena, fracture mechanics, fluid flowm biological systems, for example red blood cell flow, heart vale dynamics). Summary

of Galerkin Petrov integral methods Atluri S.N., Shen S.: The meshless local Petrov Galerkin (MLPG) method, CMES, vol.3,

No.1, (2002), pp.11-51. Collocaton method: Shu C., Ding H., Yeo K.S.: Local radial basis function-based differential quadrature

method and its application to solve two dimensional incompressible Navier Stokes equations, Comp.Methods Appl.Mech.Engng,

192 (2003), pp.941-954

There exist many methods that can be classified as meshless, for example SPH

(smoothed particle hydrodynamics), Lattice Boltzman (model od particles), RKP

(Reproducing Kernel Particle method, Liu:large deformation Mooney), MLPG (Meshless

Local Petrov Galerkin), RBF (Radial basis function, wave equation). All the methods

approximate solution by the convolution integrals

ydyhyxwyxcxh

nconvolutio-SPH classicalmethods RKP MLS,at

aplied correction

)(),(),()(

Page 44: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

MESHLESS methods collocationCFD2

12

N+1

N

N+2

Radial base functions )()( jj rxN

where is simply a distance from node j.jj xxr

linear

cubic

Gaussian

multiquadrics

rr )(

3)( rr

2

)( crer

22)( crr

Most frequently used radial base functions

Page 45: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

MESHLESS methods EXAMPLECFD2

12

N+1

N

N+2

),(2

2

2

2

yxfx

T

y

T

),( yxgT

n

j

jj rTyxT1

)(),( 22 )()( jjj yyxxr

),())()(

(1

2

2

2

2

ii

n

j

j

jjyxfT

y

r

x

r

),()(1

ii

n

j

jj yxgrT

22222 )()()( cyyxxcrr jjjj

22

22

2

2 )(

cr

cyy

xj

j

22

22

2

2 )(

cr

cxx

yj

j

Poisson’s equation

Boundary conditions

Approximation

i=1,2,….,N

(inner points)

i=N+1,N+2,…,n

(boundary)

For multiquadric radial function

Page 46: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

MESHLESS method EXAMPLE RBFCFD2

Result is a system of n-linear algebraic equations that can be solved by any

solver. In case of more complicated and nonlinear equations (Navier Stokes

equations) the system can be solved for example by the least square

optimization method, e.g. Marquardt Levenberg.

Few examples of papers available from Science Direct

Page 47: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

MESHLESS method EXAMPLE RBFCFD2

Page 48: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

This radial base function (TPS) was

used in this paper

MESHLESS method EXAMPLE RBFCFD2

Page 49: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

Comparison with results obtained by FVM package CFD-ACE

MESHLESS method EXAMPLE RBFCFD2

Page 50: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

MESHLESS method EXAMPLE RBFCFD2

Page 51: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

Local topology:

each point is

associated with

nearest NF

points

……

This is Hardy

multiquadrics radial

base function

MESHLESS method EXAMPLE RBFCFD2

Page 52: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

MESHLESS methods EXAMPLECFD2

Moving Least Squares

Page 53: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

Benchmark-pure

convection

MESHLESS method EXAMPLE RBFCFD2

Page 54: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

FLUENT 6.2

MESHLESS method EXAMPLE RBFCFD2

Page 55: CFD2 Computer Fluid Dynamics E181107 - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD2.pdf · 2016-10-06 · transport equation (steady state) –transport of matter, momentum or energy (u

MESHLESS Navier StokesCFD2

Elsevier

500 articles on

Meshless

Navier Stokes