Transient, Source Terms and Relaxation€¦ · Relaxation • At each iteration, at each cell, a...

Post on 31-Oct-2020

0 views 0 download

Transcript of Transient, Source Terms and Relaxation€¦ · Relaxation • At each iteration, at each cell, a...

FMIA

ISBN 978-3-319-16873-9

Fluid Mechanics and Its ApplicationsFluid Mechanics and Its ApplicationsSeries Editor: A. Thess

F. MoukalledL. ManganiM. Darwish

The Finite Volume Method in Computational Fluid DynamicsAn Advanced Introduction with OpenFOAM® and Matlab®

The Finite Volume Method in Computational Fluid Dynamics

Moukalled · Mangani · Darwish

113

F. Moukalled · L. Mangani · M. Darwish The Finite Volume Method in Computational Fluid Dynamics An Advanced Introduction with OpenFOAM® and Matlab ®

This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications in Computational Fluid Dynamics (CFD). Readers will discover a thorough explanation of the FVM numerics and algorithms used in the simulation of incompressible and compressible fluid flows, along with a detailed examination of the components needed for the development of a collocated unstructured pressure-based CFD solver. Two particular CFD codes are explored. The first is uFVM, a three-dimensional unstructured pressure-based finite volume academic CFD code, implemented within Matlab®. The second is OpenFOAM®, an open source framework used in the development of a range of CFD programs for the simulation of industrial scale flow problems.

With over 220 figures, numerous examples and more than one hundred exercises on FVM numerics, programming, and applications, this textbook is suitable for use in an introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers.

Engineering

9 783319 168739

Transient, Source Terms and Relaxation

Chapter 14 to review

Source Term Discretization

Source Term

Source/Sink

Transient

DiffusionConvection

C

F1F2

F3

F4 F5

F6

f1f2

f3

f4

f5

f6

• ! !• !

! • !aF1 aC aF2 aF3

! •! ! • !

! •! •

!

"

##########

$

%

&&&&&&&&&&

φC

!

"

##########

$

%

&&&&&&&&&&

=bC

!

"

##########

$

%

&&&&&&&&&&

Q = Q φ( )

Source Term Linearization

-ve

Q(n+1) = Q(n) +∂Q φ( )∂φ

Q(n+1) −Q(n)( )

= Q(n) −∂Q φ( )∂φ

Q(n)

Pr evious iteration value! "### $###

+∂Q φ( )∂φ

Q(n+1)

Current iteration value! "## $##

aPφP(n+1) + aNBφNB

(n+1)

NB(P )∑ = QVP

aP −∂Q φ( )∂φ

VP⎛⎝⎜

⎞⎠⎟φP(n+1) + aNBφNB

(n+1)

NB(P )∑ = φ (n) −

∂Q φ (n)( )∂φ

φ (n)⎛

⎝⎜

⎠⎟VP

Example

Solution

Consequence

Relaxation

Under-Relaxation

• For non-linear problems, a common solution procedure is Picard Iteration‣ Guess Φ‣ Find coefficients ap, anb and bp‣ Use Iterative solver to find new Φ‣ Repeat until convergence

• No Guarantee to converge for strong non-linearities

• Control the amount of Φ from iteration to iteration using under-relaxation

Relaxation• At each iteration, at each cell, a new value for variableφ in cell P

can then be calculated from that equation.

• It is common to apply relaxation as follows:

• Here α is the relaxation factor :

• α < 1 is underrelaxation. This may slow down speed of convergence but increases the stability of the calculation, i.e. it decreases the possibility of divergence or oscillations in the solutions.

• α = 1 corresponds to no relaxation. One uses the predicted value of the variable.

φPnew, used = φP

old + λ(φPnew, predicted −φP

old )

Recommendations• Underrelaxation factors are there to suppress oscillations in

the flow solution that result from numerical errors.

• Underrelaxation factors that are too small will significantly slow down convergence, sometimes to the extent that the user thinks the solution is converged when it really is not.

• The recommendation is to always use underrelaxation factors that are as high as possible, without resulting in oscillations or divergence.

• Typically one should stay with the default factors in the solver.

• When the solution is converged but the pressure residual is still relatively high, the factors for pressure and momentum

Under-Relaxation

φ = φ• + ′φ

φ = φ• + λ ′φ

= φ• + λ φ new iteration −φ•( )

φC =bC − aNBφNB

NB(P )∑aC

φC = φC* + λ

bC − aNBφNBNB(C )∑aC

−φC*

⎜⎜⎜

⎟⎟⎟

aCλφC + aNBφNB

NB(C )∑ = bC +

1− λ( )λ

aCφC*

aCφC + aNBφNBNB(C )∑ = bP

Consider Φ’ the correction to field Φ, from one iteration to another

We want to control the amount of change introduced

Where λ is some factor with 0<λ<1

For the discrete equation

The updated Φ value could be written as

aC ← aCλ

bC ← bC +1− λ( )λ

aCφC*

False Time-Step

aP + aPo( )φP + aNBφNB

NB(P )∑ = bP + aP

oφP•

∂ ρφ( )∂t

+∇ ⋅ ρvφ( ) = ∇ ⋅ Γ∇φ( ) + S φ,...( )

ρV∆ t

φP −φPold( )→ ρV

∆ tφP −φP

•( )

aPo = ρV

∆ t

Relation betweenTransient and URF FactoraPφP = λ bP − aNBφNB

NB(P )∑⎛

⎝⎜⎞⎠⎟+ 1− λ( )aPφP•

aPφP =E

1+ EbP − aNBφNB

NB(P )∑⎛

⎝⎜⎞⎠⎟+ 1− E

1+ E⎛⎝⎜

⎞⎠⎟ aPφP

aP 1+ 1E

⎛⎝⎜

⎞⎠⎟φP + aNBφNB

NB(P )∑ = bP +

1EaPφP

• ∆ t = E∆ t•

∆ t• = ρ∆VaP

λ = ΕΕ +1

Implicit Relaxation

aPφP + aNBφNBNB(P )∑ = αbP + 1−α( )bP•

aPφP + aNBφNBNB(P )∑ = αbP + 1−α( ) aPφP

• + aNBφNB•

NB(P )∑⎛

⎝⎜⎞

⎠⎟

aP φP• + ′φP( ) + aNB φNB

• + ′φNB( )NB(P )∑ = bP

aP ′φP + aNB ′φNBNB(P )∑ = bP − aPφP

• + aNBφNB•

NB(P )∑⎛

⎝⎜⎞

⎠⎟

aP ′φP + aNB ′φNBNB(P )∑ = RES

aP ′φP + aNB ′φNBNB(P )∑ = αbP + 1−α( ) aPφP

• + aNBφNB•

NB(P )∑⎛

⎝⎜⎞

⎠⎟− aPφP

• + aNBφNB•

NB(P )∑⎛

⎝⎜⎞

⎠⎟

aP ′φP + aNB ′φNBNB(P )∑ = α bP − aPφP

• + aNBφNB•

NB(P )∑⎛

⎝⎜⎞

⎠⎟⎛

⎝⎜

⎠⎟ aP ′φP + aNB ′φNB

NB(P )∑ = αRES

aP φP• + ′φP( )+ = α bP − aNB φNB

• + ′φNB( )NB(P )∑⎛

⎝⎜⎞

⎠⎟+ 1−α( )aPφP•

aP ′φP +α aNB ′φNBNB(P )∑ = α bP − aNB φNB

• + ′φNB( )NB(P )∑⎛

⎝⎜⎞

⎠⎟+ 1−α( )aPφP• − aPφP•

aP ′φP +α aNB ′φNBNB(P )∑ = α bP − aPφP

• + aNB φNB• + ′φNB( )

NB(P )∑⎛

⎝⎜⎞

⎠⎟⎛

⎝⎜

⎠⎟

aP ′φP +α aNB ′φNBNB(P )∑ = αRES

Convergence Criteria

Convergence

• The iterative process is repeated until the change in the variable from one iteration to the next becomes so small that the solution can be considered converged.

• At convergence:‣ All discrete conservation equations (momentum, energy, etc.) are obeyed in

all cells to a specified tolerance.‣ The solution no longer changes with additional iterations.‣ Mass, momentum, energy and scalar balances are obtained.

• Residuals measure imbalance (or error) in conservation equations.

• The absolute residual at point P is defined as:

RP = aPφP − anbφnbnb∑ − b

• Residuals are usually scaled relative to the local value of the property φ in order to obtain a relative error:

• They can also be normalized, by dividing them by the maximum residual that was found at any time during the iterative process.

• An overall measure of the residual in the domain is:

R =aCφC + aNφN∑ − bC

aCφ⊗

all cells∑

RC ,scaled =aCφC + aNφN∑ − bC

aCφ⊗

Recommendations

• Always ensure proper convergence before using a solution: unconverged solutions can be misleading!!

• Solutions are converged when the flow field and scalar fields are no longer changing.

• Determining when this is the case can be difficult.

• It is most common to monitor the residuals.

Conclusion