Sunteți pe pagina 1din 24

Lecture Objectives:

Review
- Explicit vs. Implicit
- Residual, Stability, Relaxation

Simple algorithm
General Transport Equation
unsteady-state 1-D
Fully explicit method:

Φ Pτ Δτ  Φ Pτ ρVx τ Γ Φ, eff


ρ
Δτ

Δx

Φ E( or P)  Φ P(or
τ
W) ΔxΔx
 
2Φ Pτ  Φ Eτ  Φ τW  SΦ

Implicit method:

Φ Pτ Δτ  Φ Pτ ρVx τ Δτ Γ Φ, eff


ρ
Δτ

Δx
 τ  Δτ
Φ E( or P)  Φ P(or W)
ΔxΔx
 
2Φ Pτ Δτ  Φ Eτ Δτ  Φ τWΔτ  SΦ

Value form previous time step (known value)

Make the difference between


- Calculation for different time step
- Calculation in iteration step
Unsteady state
Advection diffusion equation, 1-D
Explicit:



ρ    ρV
 
T N  T N  x T N  T N-1 
x
k/c p
xx
 
2T N  T N 1  T N 1  q source 

a N T   N  a N-1T N-1  a N 1T N 1  f - a NoT N

T   N  a N-1/a N T N-1  a N 1/a N T N 1  f/a N - a No /a N T N

Rarely used due to the problem with stability of calculation

To achieve stable calculation  should be very small


Unsteady state
Advection diffusion equation, 1-D
Implicit:


T
ρ    
N T N  
x
T 
ρVx   
N T
  
N -1  
k/cp
xx
 
2T   N  T   N 1  T   N 1  q source

a N T   N  a N-1T   N -1  a N 1T   N 1  f - a NoT N


Explicit format
(to solve system
Iterative method: of equations)

T   N  a N-1/a N T   N-1  a N 1/a N T   N 1  f/a N - a No /a N T N

2) Guess initial values: T10  ..., T20  .., T30  .., T40  ..

3) Substitute and calculate:


In iteration substitute only these values
4….) Iterate for considered time step

Make the difference between iteration and calculation for next time step
Residual
Example:

x-exp(1/x)-2=0

Find x using iteration

Explicit form 1:
Explicit form 2:
x=exp(1/x)+2
x=1/(ln(x-2))

Solution process:

Guess x0
Not all iteration
Iteration : process converge!
x1=exp(1/x0)+2 , R1=x1-x0 See the example for
X2=exp(1/x1)+2 , R2=x2-x1 the same equation
……..
…….
Convergence example

Explicit form 2:

x=1/(ln(x)-ln(2)
Residual calculation for CFD
• Residual for the cell iteration
RFijk=Fkijk-Fk-1ijk
cell position
Variable: p,V,T,…

• Total residual for the simulation domain


RFtotal=S|RFijk|
For all cells

• Scaled (normalized) residual


RF=S|RFijk|/FF
Flux of variable F used for normalization
Vary for different CFD software
Relaxation
Relaxation with iterative solvers: divergence
variable

When the equations are nonlinear


solution
it can happen that you get divergency
in iterative procedure for solving considered
time step convergence

Solution is Under-Relaxation:
iteration
Y*=f·Y(n)+(1-f)·Y(n-1) Y – considered parameter , n –iteration , f – relaxation factor
Value which is should be used for the next iteration
For our example Y*in iteration 101=f·Y(100)+(1-f) ·Y(99)

f = [0-1] – under-relaxation -stabilize the iteration


f = [1-2] – over-relaxation - speed-up the convergence

Under-Relaxation is often required when you have nonlinear equations!


Example of relaxation
Example: Advection diffusion equation, 1-D, steady-state, 4 nodes
a N TN-1  b N TN  c N TN1  f N
1) Explicit format:
TN  1 / b N f N  a N /b N TN-1  c N /b N TN1 1 2 3 4
2) Guess initial values:
T10  ..., T20  .., T30  .., T40  ..
3) Substitute and calculate:
T11  1 / b1f1  c1/b1T 0 2
T1 2  1 / b 2 f 2  a 2 /b 2 T11  c 2 /b 2 T 0 3 T11  ..., T21  .., T31  .., T41  ..
T13  1 / b 3 f 3  a 3 /b 3 T1 2  c 3 /b 3 T 0 4
T1 4  1 / b 4 f 4  a 4 /b 4 T13 T11r  fT11  (1 - f)T10 , T21r  fT21  (1 - f)T20 , ....
4) Substitute and calculate: T12  ..., T22  .., T32  .., T42  ..

Substitute and calculate: T12r  fT12  (1 - f)T11 , T22r  fT22  (1 - f)T21 , ....
………………………….
Navier Stokes Equations
CFD Specific Solver
Continuity equation
v x v y v z
  0
x y z This velocities that constitute advection coefficients: F=rV
Momentum x
v x v x v x v x p  2vx  2vx  2vx
ρ(  vx  vy  vz )    μ 2  μ 2  μ 2  SM x
τ x y z x x y z
Momentum y
v y v y v y v yp 2vy 2vy 2vy
ρ(  vx  vy  vz )    μ 2  μ 2  μ 2  SM y  ρ g (T  T )
τ x y z y x y z
Momentum z
v z v z v z v z p  2 vz  2 vz  2 vz
ρ(  vx  vy  vz )    μ 2  μ 2  μ 2  SM z
τ x y z z x y z
Pressure is in momentum equations
which already has one unknown

In order to use linear equation solver we need to solve two problems:

1) find velocities that constitute in advection coefficients


2) link pressure field with continuity equation
Pressure and velocities in NS
equations
How to find velocities that constitute advection coefficients?

v x v x v x v x p  2vx  2vx  2vx


ρ(  vx  vy  vz )    μ 2  μ 2  μ 2  SM x
τ x y z x x y z

a P Vx, P  a E Vx, E  a W Vx, W  a S Vx, S  a N Vx, N  a H Vx, H  a L Vx, P L  f

 Vx  Vy  Vz For the first step use Initial guess


aP  6 r And for next iterative steps use
x 2
x the values from previous iteration
 Vx 
aE   r , a  
x 2 x x 2
W

................................
Pressure and velocities in NS
equations
How to link pressure field with continuity equation?
SIMPLE (Semi-Implicit Method for Pressure-Linked Equations ) algorithm
v x v x v x v x p  2vx  2vx  2vx
ρ(  vx  vy  vz )    μ 2  μ 2  μ 2  SM x
τ x y z x x y z
W x P x E

p Pw – Pe (PW  PP )/2 – (PP  PE )/2 (PW – PE )/2 x


    Aw Ae
x x x x Aw=Ae=Aside

(PW – PE )/2
a P Vx P  a E Vx E  a W Vx W  a SVx S  a N Vx N  a H Vx H  a L Vx L  f  Aside
x
We have two additional equations for y and x directions

The momentum equations can be solved only when the pressure field is given or is
somehow estimated. Use * for estimated pressure and the corresponding velocities
SIMPLE algorithm
Guess pressure field: P*W, P*P, P*E, P*N , P*S, P*H, P*L

1) For this pressure field solve system of equations:


(PW – PE )/2
x: a P Vx P  a E Vx E  a W Vx W  a SVx S  a N Vx N  a H Vx H  a L Vx L  f  Aside
x
y: ………………..
z: ………………..

Solution is: V *x P , V *x E , V *x W , V *x S , V *x N , V *x H , V *x L

2) The pressure and velocity correction

P = P* + P’ P’ – pressure correction For all nodes E,W,N,S,…


V = V* + V’ V’ – velocity correction

Substitute P=P* + P’ and V = V* + V’ into momentum equations and obtain


V’=f(P’) V = V* + f(P’)
3) Substitute V = V* + f(P’) into continuity equation solve P’ and then V

4) Solve T , k , e equations
SIMPLE algorithm
start
Assume V and calculate coefficients
p=p* Guess p*
Update V in coefficients

Step1: solve V* from momentum equations

Step2: introduce correction P’ and express V = V* + f(P’)

Step3: substitute V into continuity equation solve P’ and then V

Step4: Solve T , k , e equations

no Converged
(residual check)
yes
end
Other methods

SIMPLER
SIMPLEC variation of SIMPLE
PISO
V = V* + V’
COUPLED - use Jacobeans of nonlinear velocity functions to form
linear matrix ( and avoid iteration )
HW3
Boundary condition and differencing scheme
Newton-Raphson method
(example of Jacobean solver)
- Faster convergence
- Used in many professional tools (MathCAD, EES, MatLab, Mathematica, etc)

More complex for programming


- Requires linear solver

Based on Taylor-Series Expansion


- You need first derivative for each function to create the Jacobean matrix
- Equations in the form where all side are on one side of equality sign

Our simple example: X-Y/2=-1 → X-Y/2+1=0


X2-Y=-3 → X2-Y+3=0
Newton-Raphson method
Our simple example: Section 6.11 of handouts
f1 = X-Y/2+1=0
f2 = X2-Y+3=0
Function values
for guessed
variables

Jacobean matrix
Steps:
0) Find derivatives d(f1)/dX =1 , d(f1)/dY =-1/2 Unknowns
d(f2)/dX =2X , d(f2)/dY =-1 (correction xi)

1) Initial guess: Y(0)=2, X(0)=2


2) Find f1(Y(0),X(0))=2-2/2+1=2
f2(Y(0),X(0))=22-2+3=5

3) Using derivatives and guess values find the Jacobean matrix


4) Solve the matrix using linear solver and find X and Y
5) Find Y(1)=Y(0)+ Y, X(1)=X(0)+ X,

Repeat step (2) with Y(1) and X(1) ….. Follow the procedure till convergence
Course Review (so far)
Conservation Equations
Navier Stokes Equations
v x v y v z
  0
x y z

v x v x v x v x p  2vx  2vx  2vx


ρ(  vx  vy  vz )    μ 2  μ 2  μ 2  SM x
τ x y z x x y z
v y v y v y v y p 2vy 2vy 2vy
ρ(  vx  vy  vz )    μ 2  μ 2  μ 2  SM y  ρ g (T  T )
τ x y z y x y z
v z v z v z v z p  2 vz  2 vz  2 vz
ρ(  vx  vy  vz )   μ  μ 2  μ 2  SM z
τ x y z z x 2
y z

T T T T  2T  2T  2T
ρc p (  Vx  Vy  Vz )  k 2 k 2 k 2 Φq
τ x y z x y z

v x 2 v y 2 v z 2 v x v y 2 v x v z 2 v y vz 2
F  {( ) ( ) ( ) (  ) (  ) (  ) }
x y z y x z x z y
Reynolds Averaged Navier Stokes
equations
Continuity:
Vx Vy Vz
1)   0
x y z
Momentum:
Vx V V V P  Vy  Vy  Vy
2) ρ(  Vx x  Vy x  Vz x )    [(μ  μ t ) ]  [(μ  μ t ) ]  [(μ  μ t ) ]  ST x
τ x y z x x x y y z z

Vy Vy Vy Vy P  Vy  Vy  Vy


3) ρ(  Vx  Vy  Vz )  [(μ  μ t ) ]  [(μ  μ t ) ]  [(μ  μ t ) ]  ST y
τ x y z x x x y y z z

Vz V V V P  Vy  Vy  Vy


4) ρ(  Vx z  Vy z  Vz z )    [(μ  μ t ) ]  [(μ  μ t ) ]  [(μ  μ t ) ]  ST z
τ x y z x x x y y z z

 v v y v
STz  Sz  stz  Sz  [(μ  μ t ) x  (μ  μ t )  (μ  μ t ) z ]
z x y z
Similar is for STy and STx

4 equations 5 unknowns → We need to model μt


Modeling of Turbulent Viscosity
μ Fluid property – often called laminar viscosity

μt Flow property – turbulent viscosity

 constant  t
 MVM  MVM: Mean velocity models
  mixing length
TKEM: Turbulent kinetic energy equation models
 One - Eq.
 
     Free
    
     1  Layer
  
High Re  wall 


  2  Layer
  bounded 
 k - e   3  Layer
  
Models based on μ t    
TKEM Two 
  Low Re
   Buoyancy
  
 Eq.  Curvature
 
 k - 
 
 
 k - l
 
  Additional models:
 k - kl
 k  f
 
  LES: Large Eddy simulation models
  ......
 RSM: Reynolds stress models
Discretization and equation solver
Discretization of RANS SIMPLE algorithm
Guess p*
p=p*

Step1: solve V* from momentum equations

Step2: introduce correction P’ and express V = V* + f(P’)

Step3: substitute V into continuity equation solve P’ and then V

Step4: Solve T , k , e equations

Converged no
(residual check)
yes
end
Write down this
146.6.228.78

or

• 146.6.228.78 - CAEE-LicSrv07.austin.utexas.edu

S-ar putea să vă placă și