5 Unsteady Flows 2005

117
Modeling Transient Flows Modeling Transient Flows with Fluent 6 with Fluent 6 Frank Kelecy Frank Kelecy Fluent Inc. Fluent Inc. June 9, 2005 June 9, 2005

Transcript of 5 Unsteady Flows 2005

Page 1: 5 Unsteady Flows 2005

Modeling Transient FlowsModeling Transient Flowswith Fluent 6with Fluent 6

Frank KelecyFrank KelecyFluent Inc.Fluent Inc.

June 9, 2005June 9, 2005

Page 2: 5 Unsteady Flows 2005

Agenda

� Motivation and Goals� Algorithms

� Temporal Discretization� Sub-iteration and Dual Time Stepping� Non-iterative Schemes

� Setting Up Unsteady Problems� Solving and Post-processing� Physical Models and Unsteady Flows� Summary� Appendix

� Additional Material on Solver Features and Physical Models

Page 3: 5 Unsteady Flows 2005

Motivation

� Nearly all flows in nature are unsteady!� Steady-state assumption is possible if we…

� Ignore unsteady fluctuations� Employ ensemble/time-averaging to remove

unsteadiness (e.g. turbulence modeling)� In CFD, steady-state methods are preferred

� Lower computational cost� Easier to post-process and analyze

� Many applications, however, require resolution of unsteady flow

Page 4: 5 Unsteady Flows 2005

Typical Applications

� Aerodynamics (aircraft, land vehicles,etc.)� Vortex shedding

� Rotating Machinery� Rotor-stator interaction� Rotating stall, surging

� Multiphase Flows� Free surface motions� Bubble dynamics (fluidized beds, bubble columns)

� Deforming Domains� In-cylinder combustion� Store separation

� Unsteady Heat Transfer� Transient heating, cooling

Page 5: 5 Unsteady Flows 2005

Origin of Unsteady Flow� “Natural” unsteadiness

� Unsteady flow due to growth of instabilities within the fluid or a non-equilibrium initial fluid state

� Examples: natural convection flows, turbulent eddies of all scales, fluid waves (gravity waves, shock waves)

� “Forced” unsteadiness� Time-dependent boundary conditions, source terms drive the unsteady flow

field� Examples: pulsing flow in a nozzle, rotor-stator interaction in a turbine stage

Kelvin-Helmholtz cloud instability Rotor-stator interaction in an axial compressor

Page 6: 5 Unsteady Flows 2005

Goals of Unsteady CFD Analysis

� Simulate transient flow field over a specified time period� Solution may approach

� Steady-state solution � flow variables stop changing with time� Time-periodic solution � flow variables fluctuate with a repeating

temporal pattern� Goal may also be to simply track the flow over the simulation

period� Free surface flows, moving shock waves

� Extract quantities of interest� Natural frequencies (e.g. Strouhal Number)� Time, RMS averages� Time-related parameters (e.g. time required to cool a hot solid,

residence time of a pollutant)� Spectral data (FFT)

Page 7: 5 Unsteady Flows 2005

Agenda

� Motivation and Goals� Algorithms

� Temporal Discretization� Sub-iteration and Dual Time Stepping� Non-iterative Schemes

� Setting Up Unsteady Problems� Solving and Post-processing� Physical Models and Unsteady Flows� Summary� Appendix

� Additional Material on Solver Features and Physical Models

Page 8: 5 Unsteady Flows 2005

Unsteady Equations

∫∫∫∫ +⋅∇Γ=⋅+∂∂

VAAVdVSAdAdVdV

t φφ φρφρφ rrr

unsteady convection diffusion generation

Eqn.continuity 1x-mom. uy-mom. venergy h

φφφφGeneric unsteady transport equation

Page 9: 5 Unsteady Flows 2005

Finite Volume Discretization

VSAAVVt ffaces

ffffaces

fff ∆+⋅∇Γ=⋅+∆∂∂ ∑∑ φφφρρφ rrr )()(

control volume

• Evaluate surface and volume integrals over control volume using finite volume approach

• Variables now represent averages evaluated at cell or face centers

• Temporal discretization to be determined…

Page 10: 5 Unsteady Flows 2005

Temporal Discretization

∆+⋅∇Γ+⋅−∆=

=∂∂

∑∑ VSAAVVF

Ft

ffaces

ffffaces

fff φφ φφρφ

φρφ

rrr )()(1)(

)()(

• Write discrete unsteady equations as

� Need to discretize the time derivative…

Page 11: 5 Unsteady Flows 2005

Temporal Discretization (2)

� First-Order Scheme

)()()( 1φρφρφ Ft

nn=∆

−+

)(2)()(4)(3 11

φρφρφρφ Ftnnn

=∆+− −+

time

tt-∆t

t+∆tnn+1

n-1

n = time step indext = physical time

� Second-Order Scheme

� How is F(φ) evaluated?

Page 12: 5 Unsteady Flows 2005

Explicit Time Integration

� Evaluate F(φ) at current time level (n)� Example: First order explicit scheme

)()()( 1 nnn tF φρφρφ ∆+=+

� Implications� Simplest approach – data known at current time level� All cells are marched in time with the same time step� Time step is restricted by stability limits, typically in the form of the

Courant number:

� Since Courant number < 1, maximum stable time step is mesh dependent, and is tied to the smallest cell in the domain!

1 No.Courant <∆∆≡ xtV V = fluid velocity scale

∆t = time step∆x = characteristic mesh size

Page 13: 5 Unsteady Flows 2005

Explicit Runge-Kutta Scheme

� Fluent’s Coupled-Explicit Solver uses a multi-stage Runge-Kutta scheme

� Runge-Kutta scheme provides better stability and a less-restrictive time step limit for non-linear equations than simple explicit scheme

� For compressible flows, time step is computed as

mn

ii

ni

n

tF)()(

)()()()()(

1

1

0

1,2,3...m iρφρφ

φαρφρφρφρφ

=

∆+==

+

− =

auxCFLt

+∆=∆ ∆x = local grid size

u = local fluid velocitya = speed of soundCFL=Courant number

Page 14: 5 Unsteady Flows 2005

Implicit Time Integration

� Evaluate F(φ) at future (n+1) time level� Example: First order (Euler) implicit scheme

)()()( 11 ++ ∆+= nnn tF φρφρφ� Implications

� Solution unknowns are coupled together at future time level (n+1)� Time step is not tied to Courant number stability restrictions

� We can “theoretically” use as large a time step as we want (unconditionally stable) – though this is only strictly true for linear equations, for which unconditional stability can be proven mathematically

� How do we handle the coupling at future time levels?

Page 15: 5 Unsteady Flows 2005

Sub-iteration

� We can deal with the coupling of the discrete equations at the future time level by iteratively solving the implicit equations as follows:

� Define a provisional solution φi which is initialized with the current solution φn

� Iteratively solve the implicit equations until the provisional solution satisfies the equations� φ i � φ n+1 as the sub-iteration process converges

� Example: First Order Implicit Scheme1,2,3...i )()()( =∆+= ini tF φρφρφ (i = iteration count)

Page 16: 5 Unsteady Flows 2005

Implications of Sub-iteration

� Solution of implicit equations for a single time step is identical to the solution of a steady-state problem� Sub-iteration process is similar to solving a steady-state solution

from a prescribed initial condition� The number of sub-iterations required to converge the sub-iteration

process will depend upon the time step� In general, the number of sub-iterations increases as the time

step is increased� Residuals are a general guide to convergence, but…� …you may wish to observe other solution monitors as functions of

iteration to ensure that the solution is converging properly� Sub-iteration is also deals with non-linearity and coupling in the

unsteady equations � Sub-iteration can be applied to both the segregated and coupled

solvers

Page 17: 5 Unsteady Flows 2005

Sub-iteration Convergence Behavior

∆t 10∆t

Page 18: 5 Unsteady Flows 2005

Dual-Time Stepping

� Dual time stepping is a variation of sub-iteration which is better suited to the coupled solver algorithms

� Essential idea – add an extra “unsteady” term to the equations which is integrated in a “pseudo-time” τ

)(~)(

)(

=∂∂−=∂

∂=∂

∂+∂∂

t

t

τ

τ terms)source (fluxes, vector RHS variablesdependent coupled ofvector

==

Page 19: 5 Unsteady Flows 2005

Dual-Time Stepping (2)

� We note that the new form of the equations is identical in form to the old – so we can employ the same algorithms� Example: m-stage Runge-Kutta scheme

mp

ii

pi

p

tF)()(

)()()()()(

1

1

0

1,2,3...Pp 1,2,3...m iρφρφ

φαρφρφρφρφ

=

∆+==

+

− ==

P = number of pseudo-time steps

Page 20: 5 Unsteady Flows 2005

Implications of Dual-Time Stepping

� Dual-time stepping permits explicit schemes (like Runge-Kutta) to be used with an implicit temporal discretization

� Like sub-iteration, dual-time stepping requires convergence of the solution in pseudo-time to obtain the solution at the next time level

� The number of pseudo-time steps required depends on the time step

Page 21: 5 Unsteady Flows 2005

� Improved preconditioning for coupled implicit (in time) solver� Mainly benefits accuracy and robustness for low Mach

number flows

Coupled Solver Efficiency Improvements in Fluent 6.2

Old preconditioningNew preconditioning

Baseline solution(Four-stage R-K)

Pressure wavepropagation

Page 22: 5 Unsteady Flows 2005

� .One of the downsides of sub-iteration schemes is that they can be inefficient (i.e. solver uses more sub-iterations than it really needs)� Time derivative discretization introduces truncation error� Splitting of the operators in the solver introduces a time step related

splitting error� Sub-iteration tries to eliminate the splitting error….BUT…� …the overall time-accuracy can be preserved as long as the

splitting error is O(∆t2)

Truncation errorO(∆∆∆∆t2)

Splitting errorO(∆∆∆∆tn)

Overall time-discretization error for 2nd-order scheme

O(∆∆∆∆t2)

Non-iterative Schemes (Segregated Solver)

Page 23: 5 Unsteady Flows 2005

� New in 6.2 for the segregated solver� No outer (pressure-velocity) iteration

within a time-step� Sub-iterations are needed to account for

the deferred-corrections, non-linearity in and coupling among the equations�

� Splitting error ~ O(∆t2)� Speed-up by a factor ~ NITA/2 (NITA is the

number of iterations per time step)� Two flavors

� PISO� Fractional-step method

Solve k and ε

Solve U,V,W Eq.

Solve Pressure Correction

Correct Velocity, Pressure,Flux

Next time-stepn += 1

t = t + n∆t

Solve other scalars

Non-Iterative Time-Advancement (NITA) Schemes

Page 24: 5 Unsteady Flows 2005

� Originally proposed as a non-iterative scheme (Issa, 1985)� Splitting error in the PISO scheme can be made smaller

than the truncation error (by multiple “corrector” steps).� Consists of 1 predictor and N corrector steps (N =2 for

2nd-order accuracy)� Fluent 6.2 newly offers a new NITA version of PISO

scheme� Energy & turbulence equations and compressibility

effects are still loosely coupled. � You can still use PISO in a sub-iterative manner is

desired

The NITA PISO Scheme

Page 25: 5 Unsteady Flows 2005

The NITA Fractional-Step Method (FSM)

� Employs an Approximate Factorization technique to solve the momentum and pressure correction equations

+

=

+

+

c

m

n

n

bpDGA bru

00 1

1

matrix-block Originalδ43421

( )[ ]21

1matrices Factorized

000 t

bpItGI

DGtDA

c

m

n

n∆+

+

=

∆ +

+

Obruδ

4444 84444 76

Exact

approximate factorization

Approximate

Page 26: 5 Unsteady Flows 2005

+

=

+

+

+

c

m

p

n

n

bpItGI

DGtDA

n

bru

u

000

1

1

444 3444 21δ

δ

=

+

=

++

+

+

11

1

1

ˆ0

0ˆ0

nn

n

c

m

n

ppItGI

bpDGtDA

δδ

δuu

bru

11

1

ˆ

ˆ

++

+

∆−==∆

+=

nn

cn

m

ptGbpDGt

A

δδuu

bru

NITA FSM – Splitting of Equations

Page 27: 5 Unsteady Flows 2005

� The FSM is very similar to the “segregated” algorithm.� Closely resembles the SIMPLEC scheme on a per-iteration

basis� Cheaper (by approx. 20 %) than the PISO scheme on a

per-time-step basis� Splitting errors will be different than the PISO

� Best choice between PISO and FSM will be somewhat problem dependent

NITA FSM Implications

Page 28: 5 Unsteady Flows 2005

� Sub-iterations are introduced to the individual equations and/or a group of the individual equations.� Accounts for non-linearity in and coupling among the

equations, deferred-correction terms, BC’s and solution-dependent source terms

� New convergence criteria for the sub-iterations� Use initial residuals at each time-step as the reference

values for the convergence for the sub-iterations and the AMG cycle

� The default criteria were determined based on an extensive testing.

� Solutions can be explicitly under-relaxed in the sub-iterations. � The mass-flux is updated after each momentum sub-iteration.

� Default for second-order time-discretization

NITA Sub-iteration

Page 29: 5 Unsteady Flows 2005

� Supported physical models � Incompressible and weakly compressible (up to high

subsonic) � Laminar (DNS)� All turbulence models including LES, DES and RANS

models� Passive scalars (heat transfer with constant properties,

species transport w/o reaction)� VOF� Compressible liquid (UDF)� Sliding mesh� 1-D coupling (WAVE, GT-Power, Optimal Power) � Compressible flows (transonic, supersonic)� Non-Newtonian fluids� MDM

NITA Schemes and Physical models

Page 30: 5 Unsteady Flows 2005

NITA Schemes and Physical models (2)

� Not supported (NITA schemes cannot be selected with these models)� Multiphase models (except VOF)� Radiation models� Reacting species and all combustions models� DPM, spark, crevice models� Phase change (solidification & melting)� UDS transport� Inviscid ideal gas� Porous media, porous jump, fan model

Page 31: 5 Unsteady Flows 2005

tuu ωsin0=

y

Non-iterative fractional-step (NITA) method vs. fully-iterative method (ITA) and exact solution

NITA Example: Oscillating Plate

Page 32: 5 Unsteady Flows 2005

� Non-iterative scheme vs. fully-iterative scheme

NITA Example: Exhaust Manifold

Non-iterative solution identical tostandard sub-iteration scheme

Page 33: 5 Unsteady Flows 2005

� Comparison of total CPU-time� Non-iterative scheme reduces CPU time by factor of 5!

0

0.2

0.4

0.6

0.8

1

Iterative Non-iterative

IterativeNon-iterative

NITA Example: Exhaust Manifold (2)

Page 34: 5 Unsteady Flows 2005

FLUENT 6.1ITERATIVE PISO

CPU=29,591

FLUENT 6.2ITERATIVE PISO

CPU=15,794

FLUENT 6.2NITA –

Fractional Step CPU=4,043

FLUENT 6.2NITA – PISO CPU=3,450

NITA Example: VOF Tank Sloshing

Page 35: 5 Unsteady Flows 2005

Agenda

� Motivation and Goals� Algorithms

� Temporal Discretization� Sub-iteration and Dual Time Stepping� Non-iterative Schemes

� Setting Up Unsteady Problems� Solving and Post-processing� Physical Models and Unsteady Flows� Summary� Appendix

� Additional Material on Solver Features and Physical Models

Page 36: 5 Unsteady Flows 2005

Unsteady Schemes: Segregated Solver

� Implicit Schemes only� First or Second order

accuracy in time� NITA schemes

� PISO or FSM set in Solve�Controls

� Frozen Flux Formulation� Not applicable to NITA

schemes

Page 37: 5 Unsteady Flows 2005

Frozen Flux Formulation

� An option for the segregated solver which reduces the non-linearity of the convection terms

� Advantage: Improves convergence of the sub-iteration loop� Limitations

� Only available for single phase flows� Cannot be used with moving/deforming meshes

ffaces

nf

nf

nf

n

ffaces

fff AVAV ∑∑ +

+

11

φρφρ

Page 38: 5 Unsteady Flows 2005

Segregated Solver Notes - Sub-iteration

� Use PISO scheme for Pressure-Velocity coupling� Provides faster convergence for unsteady flows than the

standard SIMPLE approach� Select number of sub-iterations per time step to obtain good

convergence� Ideally, you should observe residuals decline by several orders of

magnitude to levels similar to that of a steady-state calculation (actual residual level will be problem dependent)

� If convergence is not adequate…� Adjust solver controls (under-relaxations, discretizations)� Reduce the time step

� In general, try to employ second order accurate scheme unless…� Numerical stability is a concern� Transient is not of interest (time march to steady-state or time

periodic solution)� Activate second order when time-periodicity is achieved

� Beginning a calculation from an approximate initial condition (e.g. impulsive start-up)

Page 39: 5 Unsteady Flows 2005

Segregated Solver Notes - NITA

� Choose PISO or FSM under Pressure-Velocity Coupling

� NITA Controls – The BASIC Solution Process� Inner sub-iterations are

performed for both PISO and FSM until a termination criterion is satisfied (described on next slide)

� A final sub-iteration is then performed before exiting the loop – a residual tolerance is applied to ensure this final sub-iteration is well converged

� Note – convergence within each sub-iteration is controlled by the AMG solver settings in Solve�Controls�Multigrid

Page 40: 5 Unsteady Flows 2005

Segregated Solver Notes – NITA (2)

� NITA Controls� Max. Corrections

� maximum number of (inner) sub-iterations performed for each equation � Correction Tolerance

� Sub-iterations terminate when ratio of current sub-iteration initial (0th) AMG residual and the first sub-iteration initial (0th) AMG residual fall below this value

� Residual Tolerance� During the final iteration, the AMG solver is converged until the ratio of the

current AMG residual and the first sub-iteration initial (0th) AMG residual fall below this value

� Relaxation Factor� Explicit underrelaxation factor applied to variables between sub-iterations

Page 41: 5 Unsteady Flows 2005

Segregated Solver Notes – NITA (3)

� NITA Controls – Recommendations� Default settings should be good for most problems� Convergence of the AMG solver can be monitored by Verbosity

in the Multigrid Controls panel to 1� For problems involving very small time steps, diagonal

dominance is high and convergence should be driven down further by reducing the Residual Tolerance

� For problems involving larger time steps, Residual Tolerancemay be increased to avoid wasting AMG iterations due to residual tolerance threshold not being met

� If divergence is detected in the sub-iteration process, reduce the Relaxation Factor values to 0.7 – 0.8.

Page 42: 5 Unsteady Flows 2005

Unsteady Schemes: Coupled Solvers

� Coupled Explicit� Explicit time marching scheme

� NOTE – For this scheme, the time step is chosen by the solver based on stability considerations

� First and second order implicit schemes (dual-time stepping)

� Coupled Implicit� First and second order implicit

schemes (dual-time stepping)

Page 43: 5 Unsteady Flows 2005

Coupled Solver Notes

� Use coupled explicit solver with the explicit time stepping formulation for transient shock waves and related flows� More accurate and less expensive than the implicit

formulations� The FAS multigrid and residual smoothing should not be used

for time-accurate calculations when using the explicit-time stepping formulation.

� The 2nd-order time-implicit formulation should not be used in capturing time accurate shock propagation. The scheme is dispersive.� The 1st-order time-implicit formulation can be used to capture time

accurate shock propagation if sufficiently small time step is specified and if the solution is allowed to converge at each time level.

Page 44: 5 Unsteady Flows 2005

Unsteady Boundary Conditions

� Most boundary conditions can be prescribed as functions of time through� User-Define Functions (UDF)� Profile files

Page 45: 5 Unsteady Flows 2005

Unsteady UDF Macros

� Several macros are available for accessing various time related quantities in your UDF

Page 46: 5 Unsteady Flows 2005

Unsteady UDF Example

/**********************************************************************

unsteady.c

UDF for specifying a transient velocity profile boundary condition

***********************************************************************/

#include "udf.h"

DEFINE_PROFILE(unsteady_velocity, thread, position)

{

face_t f;

real t = CURRENT_TIME;

begin_f_loop(f, thread)

{

F_PROFILE(f, thread, position) = 20. + 5.0*sin(10.*t);

}

end_f_loop(f, thread)

}

Macro for accessing physical time

Page 47: 5 Unsteady Flows 2005

Unsteady Profile Files (1)

((profile-name transient n periodic?)

(field_name-1 a1 a2 a3 .... an)

(field_name-2 b1 b2 b3 .... bn)

.

.

.

.

(field_name-r r1 r2 r3 .... rn))

Flag for time periodicprofile (0=no, 1=yes)

Number of data pointsper field

((sampleprofile transient 3 0)(time 1 2 3)(u 10 20 30))

Sample file

Standard Format

Read into FLUENT using File�Read�Profile…

Page 48: 5 Unsteady Flows 2005

Unsteady Profile Files (2)

profile-name n_field n_data periodic?

field-name-1 field-name-2 field-name-3 .... field-name-n_field

v-1-1 v-2-1 ... ... ... ... v-n_field-1

v-1-2 v-2-2 ... ... ... ... v-n_field-2

.

.

.

v-1-n_data v-2-n_data ... ... ... ... v-n_field-n_data

Flag for time periodicprofile (0=no, 1=yes)

Number of data pointsper field

sampletabprofile 2 3 1 time u 1 10 2 20 3 30

Sample file

Number of fieldsTabular Format

Read into FLUENT using TUI Command:file/read-transient-table

Page 49: 5 Unsteady Flows 2005

Agenda

� Motivation and Goals� Algorithms

� Temporal Discretization� Sub-iteration and Dual Time Stepping� Non-iterative Schemes

� Setting Up Unsteady Problems� Solving and Post-processing� Physical Models and Unsteady Flows� Summary� Appendix

� Additional Material on Solver Features and Physical Models

Page 50: 5 Unsteady Flows 2005

Running an Unsteady Solution

� Basic Steps� Select unsteady option in Define����Models����Solver

� Set up physical models, BCs as usual� Prescribe initial conditions� Set solver settings and monitors� If using segregated solver with sub-iteration

or dual time stepping…� Select time step and max iterations per

time step� Prescribe the number of time steps� Run the calculation (Iterate)

Page 51: 5 Unsteady Flows 2005

Initial Conditions

� Accurate initial conditions are just as important as boundary conditions for unsteady problems

� Initial solution should be physically realistic� Arbitrary initial guess may lead to unphysical transients

� If the solution is time-periodic or a steady-state solution is sought (transients are not important), the initial condition can be more approximate

� Some suggest ways of setting initial conditions� Use a steady-state solution

� Example – run a nozzle with steady flow BC before activating unsteady BC

� Write an Initial Condition UDF - DEFINE_INIT( name, d)

Page 52: 5 Unsteady Flows 2005

Initial Condition UDF Example/******************************************************************** UDF for initializing flow field variables *********************************************************************/ #include "udf.h" DEFINE_INIT(my_init_func,d) {

cell_t c;Thread *t; real xc[ND_ND];

/* loop over all cell threads in the domain */

thread_loop_c(t,d) {

/* loop over all cells */ begin_c_loop_all(c,t) {C_CENTROID(xc,c,t); if (sqrt(ND_SUM(pow(xc[0] - 0.5,2.),

pow(xc[1] - 0.5,2.), pow(xc[2] - 0.5,2.))) < 0.25)

C_T(c,t) = 400.; else C_T(c,t) = 300.;

} end_c_loop_all(c,t)}

}

Page 53: 5 Unsteady Flows 2005

Initial Transients

Unsteady rotor lift becomesperiodic after initial transient

Solution started from steady-state

Rotor lift coefficient for 2D unsteady turbine stage

Page 54: 5 Unsteady Flows 2005

Autosaving Files

� Fluent permits files to be saved automatically during a transient run� File����Write����Autosave

� The frequency is the number of time steps between saves

� Fluent automatically appends the time step count to the filename (e.g. 0001, 0002, etc.)

� Compression suffix in filename will cause stored files to be compressed in desired format (.gz or .Z)

� Overwriting existing files� New in Fluent 6.2� Defines the maximum number

of files of each type (case and.or data) which are stored

� When maximum is reached the earliest file will be overwritten when Fluent writes another file

Page 55: 5 Unsteady Flows 2005

Monitors

� Surface and Force monitors can be set up to compute and save unsteady data as a function of time step

� Select Time Step under Every column in GUI

� By default, Force monitors are written every time step for unsteady calculations

Page 56: 5 Unsteady Flows 2005

Choosing Your Time Step

� Simple estimate

� Fluid particle should move no more than one cell’s distance in one time step.

Vxt ∆∆ ~ ∆x = representative cell size

V = characteristic velocity

t t+∆∆∆∆t

Page 57: 5 Unsteady Flows 2005

Choosing Your Time Step (2)

� Physically-based estimate� Choose time step which resolves the unsteady physics of

interest (∆t < T)

t

φφφφ

∆∆∆∆t < T

TT = characteristictime scale of unsteadyflow

Page 58: 5 Unsteady Flows 2005

Choosing Your Time Step (3)

� Time Scale Examples� Vortex Shedding

� Buoyant Flows

� Rotor-Stator Interaction

VStLT ⋅~

ωθ pT ∆~

TLgLT ∆β~

velocityFreestreamVlength sticCharacteri

Number Strouhal

===

LSt

difference re temperatuFreestream-SurfaceTtcoefficienexpansion Thermal

onaccelerati nalGravitatioglength sticCharacteri

=∆===

β

L

speed rotationalRotor anglepitch Blade

=

=∆ωθ p

Page 59: 5 Unsteady Flows 2005

Choosing Your Time Step (4)

� Adaptive time stepping� Adaptive time stepping (ATS) permits automatic adjustment of

time step size as the calculation proceeds� Based on local truncation error analysis

� Available for both segregated and coupled solvers� Compatible with first and second order temporal discretization

schemes� Customization possible via UDF� Limitations

� Not compatible with VOF model� Not available for coupled explicit solver

� Additional information provided in the Appendix

Page 60: 5 Unsteady Flows 2005

Data Sampling

� FLUENT can save and store unsteady solution data in order to derive useful field variables, namely� Time averages

� Root mean square (RMS)

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

=∆−=−= ∑∫ ii

if

t

tfttttdtt

f

φφφ

1,2,...Ni 2 =∑=i

iRMS φφ

Page 61: 5 Unsteady Flows 2005

Activating Data Sampling

� Select data sampling option in the Iterate panel

� Sampled variables are computed and stored “on the fly” for subsequent time steps

� Sampled variables are also stored in case and data files

� Available time-averaged and RMS variables� Static pressure� Velocity magnitude and

components� Temperature� Combustion variables (e.g.

mixture fracture…)

Page 62: 5 Unsteady Flows 2005

Sampled Data Contour Plots

Instantaneous Time-AverageSliding mesh solution:

2D Turbine Stage

Sliding interface

Page 63: 5 Unsteady Flows 2005

Post-processing Unsteady Solutions

� Unsteady data from solution monitors can be viewed using Fluent’sx-y plotting tools� FFT can be applied to unsteady x-y plot data

� Animation of solutions� Setup animations in Solve� Animate panel� Write image files “on the fly” using macros in Solve�Execute

Commands panel� Instantaneous solution case/data files (written using Autosave

feature) can be reread into FLUENT for further processing� Can be automated using journal files

� Solution data can also be exported in formats compatible with dedicated third-party post-processing software (e.g. Fieldview, Ensight, etc.).

� Additional information is provided in the Appendix

Page 64: 5 Unsteady Flows 2005

Agenda

� Motivation and Goals� Algorithms

� Temporal Discretization� Sub-iteration and Dual Time Stepping� Non-iterative Schemes

� Setting Up Unsteady Problems� Solving and Post-processing� Physical Models and Unsteady Flows� Summary� Appendix

� Additional Material on Solver Features and Physical Models

Page 65: 5 Unsteady Flows 2005

Turbulence – Unsteady RANS

� Unsteady solutions are possible using the Reynolds-Averaged Navier-Stokes (RANS) equations provided the time scale of the unsteadiness is much larger than the turbulent time scales

( ) ( )( )∑=∞→=N

n

niNi txuNtxU

1,1lim, rr

( ) ( ) ( )txutxUtxu iii ,,, rrr ′+=

U

Long time scale unsteadinesspreserved in ensemble average

Page 66: 5 Unsteady Flows 2005

Unsteady RANS Modeling

� Unsteady RANS Momentum Equations

� Turbulence closure models available in Fluent� Spalart-Allmaras (1 eqn)� k-ε (standard, RNG, Realizable) (2 eqn)� k-ω (2 eqn)� V2F (4 eqn)� Reynolds Stress Model (RSM) (7 eqn)

j

ij

j

i

jik

ik

ixR

xU

xxp

xUUt

U∂∂

+

∂∂

∂∂+∂

∂−=

∂∂+∂

∂ µρ

jiij uuR ′′−= ρ Reynolds Stress

Page 67: 5 Unsteady Flows 2005

Unsteady RANS Notes

� Unsteady RANS is the most practical approach for unsteady turbulent flows� Modest mesh requirements� Reasonable run times� Applicable to a wide range of problems

� Large scale unsteady flow features can usually be resolved on a RANS mesh� Example – vortex shedding at High Reynolds numbers

� For flows where unsteady RANS is unsuitable, you can attempt to use LES or DES

Page 68: 5 Unsteady Flows 2005

Large Eddy Simulation (LES)

� LES is recommended for high-end applications where the RANS models are not adequate ( e.g. mixing, combustion, external aerodynamics)

� LES dispenses with Reynolds-averaging, and instead solves the N-S equations directly to capture turbulent fluctuations resolvable by the mesh� Eddies smaller than the grid size are removed and modeled by a

sub-grid scale model (SGS)� Larger eddies are directly solved numerically by the “filtered”

transient N-S equations.� Sufficiently long solution time is required to reach statistically stationary

state and obtain stable statistics of the solution.

Page 69: 5 Unsteady Flows 2005

LES Setup

� Activate LES Model in Define����Models����Viscous Model GUI� Three sub-grid scale (SGS) models

are available� Smagorinsky-Lilly� WALE� Kinetic-Energy Transport

� Simple near-wall model (two-layer wall functions similar to the model by Werner and Wengle)

� Second-order spatial and temporal discretizations (including new bounded central differencing scheme)

� Need to provide appropriate initial and boundary conditions

•Note: You can use NITA for LES/DES models

Page 70: 5 Unsteady Flows 2005

� Vortex shedding over a cylinder with Re = 90,000

� The simulation uses� large eddy simulation

(LES) turbulence model � a fine grid with 170,000

quadrilateral elements � A transient calculation is

performed for many cycles until periodic flow is achieved

Example: LES Vortex Shedding

Page 71: 5 Unsteady Flows 2005

Fine scale vortices captured by LES

LES Solution: Pressure Field

Page 72: 5 Unsteady Flows 2005

NITA Example - LES of Channel Flow (Reτ = 180)

NITA/FSM, node-based gradient, BCD

72 x 72 x 72 hex. mesh

Page 73: 5 Unsteady Flows 2005

Detached Eddy Simulation (DES)

� DES is a hybrid model which uses LES in the bulk (core turbulent) and a RANS model (Spalart-Allmaras) in the near-wall region

� DES is a practical alternative to LES for high-Reynolds number flows over airfoils in the external aerodynamic applications

� New in Fluent 6.2 - access to DES through viscous model GUI

Page 74: 5 Unsteady Flows 2005

Unsteady DPM Modeling

� Discrete Phase Model (DPM) in FLUENT can be run within an unsteady flow calculation� Particle paths are updated in time along with the flow

� Can be used with sliding mesh and moving/deforming mesh� Applications

� Particle flows through rotating machinery� Unsteady settling, erosion, and accretion problems

Page 75: 5 Unsteady Flows 2005

Unsteady DPM Setup

� Specify DPM model parameters in Define����Models����DiscretePhase…

� Create injections� For unsteady DPM, you

need to set the Start Timeand End Time to define when particles will be introduced

� Run unsteady solution� Use Display�Particle Tracks To

display particle positions at current time

Page 76: 5 Unsteady Flows 2005

Unsteady DPM Example

Page 77: 5 Unsteady Flows 2005

Moving Reference Frames

� Unsteady solutions can be carried out in a moving reference frame� Only Single Reference Frame (SRF) models are applicable!

� Multiple Reference Frame (MRF) and Mixing Plane models are by definition steady-state models

� SRF solutions will capture unsteadiness in the relative frame� Example: vortex shedding from the trailing edge of a turbine rotor

blade

Page 78: 5 Unsteady Flows 2005

Sliding Mesh Model

� The sliding mesh model permits motion multiple domains sliding relative to one another along interface boundaries

� Numerous applications� Mixing tanks� Rotor-stator interaction� Vehicles in tunnels

� The governing equations are solved in the inertial reference frame for absolute quantities (e.g. absolute velocities).� For each time step, the meshes are moved and the fluxes at the sliding

interfaces are recomputed.

cells at time t cells at time t+∆t

moving mesh zone

Page 79: 5 Unsteady Flows 2005

� Sliding interface requirements:� Interfaces are non-conformal� For rotating domains, the interface between a rotating subdomain

and the adjacent stationary/rotating subdomain must be a surface of revolution with respect to the axis of rotation of the rotating subdomain.� Many failures of sliding mesh models can be traced to interface

geometries which are not surfaces of revolution!� Any translation of the interface cannot be normal to itself.

� A sliding mesh preview is now available in Fluent 6.1 to help detect sliding mesh problems before you run your calculation

time t = 0

t + ∆t

Elliptic interface is not a surface of revolution.

Solve����Mesh Motion…

Sliding Interfaces

Page 80: 5 Unsteady Flows 2005

Sliding Mesh Setup

� Enable unsteady solver.� Define overlapping zones as Interface

types� For moving zones, select Moving Mesh

as Motion Type in Fluid BC panel.� By default, velocity of walls are zero

relative to the adjacent mesh's motion.

� For each interface zone pair, create a non-conformal interface� Enable Periodic option if

sliding/rotating motion is periodic.� Enable Coupled for conjugate heat

transfer.

Page 81: 5 Unsteady Flows 2005

Sliding Mesh Example

Page 82: 5 Unsteady Flows 2005

Accelerating Reference Frames

� Fluent’s moving reference frame model does not account for accelerating reference frames� Two additional acceleration terms are required

� You can incorporate acceleration effects in two ways� Use Moving Reference Frame option for the fluid zone and add the

additional acceleration terms as source terms using UDFs� Use Moving Mesh option for the fluid zone and adjust the

translation and/or rotational frame velocities through UDFs

Page 83: 5 Unsteady Flows 2005

Illustration of Reference Frames

x

y

z

z

y

x

stationaryframe

movingframe

axis ofrotation

rr

ωr

CFD domain

orr R

Note: R is perpendicularto axis of rotation

)()(

00 trrt

rrrr

==ωω

Page 84: 5 Unsteady Flows 2005

Additional Acceleration Terms

� Additional acceleration terms need to be added to the RHS of the MRF momentum equations when rotation or translation of the frame is time dependent…

+×−= 20

2

dtrdrdt

dSaccelrrrr ωρ

tangentialacceleration

linearacceleration

Add these termsusing a Source term UDF applied to the momentum equations…

Page 85: 5 Unsteady Flows 2005

Example: Tank Sloshing

� A rectangular tank is 20% filled with liquid

� The periodic accelerations of tank introduced using source term UDFs

� Results are compared to experiment1 for� general flow patterns� pressures recorded at three

sites (shown)

1Hadzic, et al., Numerical Simulation of Sloshing, Proc. SRI-TUHH Mini Workshop on Numerical Simulation of Two-phase Flows, Ship Research Institute, Tokyo, Japan, 2001.

Page 86: 5 Unsteady Flows 2005

Example: Tank Sloshing (2)

� The volume of fluid (VOF) model is used in FLUENT

� A user-defined function (UDF) is used to simulate the periodic swaying motion

� At one instant, the liquid sloshes up the right side of the tank (top)

� The FLUENT simulation captures this motion accurately (bottom)

Velocity vectors colored by static pressure

Page 87: 5 Unsteady Flows 2005

Moving Mesh Option

� Another way of handling accelerating reference frames is to employ the Moving Mesh option

� Advantage – no additional acceleration terms are required in the momentum equations� This is because the momentum equations are referred to the

absolute frame (no MRF transformation is used)� Accelerations are prescribed by defining the time dependent grid

locations� For rotation, you need only prescribe ω(t).

Page 88: 5 Unsteady Flows 2005

Example: Flapping Airfoil

Flapping NACA 0012 airfoil (+/- 8 deg)

Moving zone

Sliding interface

Page 89: 5 Unsteady Flows 2005

Moving Mesh UDF/**********************************************//* flap.c *//* UDF for specifying a time-varying omega *//* *//* Simulates +/- 8 deg flapping with cycle of *//* of 1 sec. *//* *//**********************************************/

#include "udf.h“#define PI 3.141592654

DEFINE_ADJUST(speed, domain){

real omega;Thread *t;

real time = RP_Get_Real("flow-time");omega = 0.8773*cos(2.*PI*time); /* rotational speed about axis */

thread_loop_c(t,domain) { if (THREAD_VAR(t).cell.motion_spec == MOTION_TYPE_MOVING_GRID){ THREAD_VAR(t).cell.omega = omega;

} }

}

Page 90: 5 Unsteady Flows 2005

Flapping Airfoil: Unsteady Velocity

Page 91: 5 Unsteady Flows 2005

Additional Physical Models

� Other models/features in FLUENT 6 which employ unsteady solutions� Dynamic mesh refinement� Moving Deforming Mesh� Acoustics

� Additional information on these topics provided in the Appendix

Page 92: 5 Unsteady Flows 2005

Agenda

� Motivation and Goals� Algorithms

� Temporal Discretization� Sub-iteration and Dual Time Stepping� Non-iterative Schemes

� Setting Up Unsteady Problems� Solving and Post-processing� Physical Models and Unsteady Flows� Summary� Appendix

� Additional Material on Solver Features and Physical Models

Page 93: 5 Unsteady Flows 2005

Summary

� CFD analysis of unsteady flows are becoming more commonplace

� FLUENT 6 has the ability to address a wide range of unsteady problems

� In this lecture we have discussed� Unsteady algorithms in FLUENT 6� Setting up, running, and post-processing unsteady solutions� Physical models and unsteady flows

� New algorithms in Fluent 6.2 will make the solution of unsteady flows more efficient than ever!

� Thank you for your attention!

Page 94: 5 Unsteady Flows 2005

Appendix

� Dynamic Mesh Refinement� Fast Fourier Transforms (FFT)� Animations� Automatic Time Step Adjustment� Moving/Deforming Mesh� Acoustics

Page 95: 5 Unsteady Flows 2005

Dynamic Mesh Refinement

� Gradient adaption can be used to dynamically adapt the mesh to a time-evolving solution

� This approach can be useful for a wide range of applications� Moving shock waves� Free surface flows� Unsteady wakes

Page 96: 5 Unsteady Flows 2005

Dynamic Adaption Setup

� Method� Curvature (smooth flows)� Gradient (strong gradients, shocks)

� Normalization� Standard

� No scaling (not recommended for dynamic adaption)

� Scale� Normalizes with average value

� Normalize� Normalizes with max value

� Dynamic Interval� Set value from to 1 – 10, depending

on the unsteady flow Coarsen Threshold– Scale (0.3 – 0.5)– Normalize (0.2 – 0.4)

Refine Threshold– Scale (0.7 – 0.9)– Normalize (0.5 – 0.9)

Page 97: 5 Unsteady Flows 2005

Shock Waves in a Channel

Mesh Colored by Contours of Static Pressure

Page 98: 5 Unsteady Flows 2005

Fast Fourier Transform (FFT)

� FFT utility is available for general analysis of unsteady data� Features

� Plot and pruning utility� Enables users to inspect and select signal

� Multiple choices of window functions � X-axis function

� Frequency� Strouhal number

� Y-axis function� Power spectral density � Magnitude� Sound Pressure Level (db)� Sound Amplitude (db)

Page 99: 5 Unsteady Flows 2005

FFT – How It Works

� An FFT performs a discrete Fourier transform of an unsteady signal φ(t) to derive spectral information about the signal, e.g.� vortex shedding frequency� higher harmonics associated with rotor-stator interaction

� For an unsteady function φk sampled uniformly at a finite number of points, N, the coefficients of the Fourier transform are given by

∑−=

−=1

0

/21ˆ N

k

Niknkn eN

πφφ

Page 100: 5 Unsteady Flows 2005

FFT – How It Works (2)

� The variables define the relative influence of discrete frequencies contained in the signal

� Derived variables� Power Spectral Density (E)

� Amplitude (A)

kφ̂

2

200

ˆ2)(

ˆ)(

nnfE

fE

φφ

=

=

)()( nn fEfA =

Page 101: 5 Unsteady Flows 2005

FFT - Windowing

� FFT assumes sampled data are periodic in time� Windowing addresses cases where the data are not periodic, thereby

leading to aliasing errors� Windowing applies filters to the signal to remove the influence of the

ends of the data range (approximately ¼ of the entire range)� Four windowing filters are available in Fluent 6.1

� Hamming� Hanning� Barlett� Blackman

Page 102: 5 Unsteady Flows 2005

FFT – Main Interface

� Usage1. Read in plot file containing

data2. Apply “pruning” to remove

unwanted portions of the data set

3. Select Window option and x-y axes functions

4. Plot the FFT� Can optionally write FFT data

to file

Page 103: 5 Unsteady Flows 2005

FFT – Pruning Interface

� Pruning permits you to set the x-data range (typically time)� Removes unwanted regions

of the signal such as a start-up transient

� Pruned data will then be used by the FFT

� You can plot the pruned signal and compute statistics

Page 104: 5 Unsteady Flows 2005

FFT – Example

Original Data Pruned Data

Page 105: 5 Unsteady Flows 2005

FFT – Example (2)

Page 106: 5 Unsteady Flows 2005

Animations

� FLUENT 6 provides a facility for creating animations� Define a sequence of frames for subsequent playback

� Can use for contours, meshes, XY plots, vectors, and monitors� Options for storing data

� “Memory” - Meta files are saved that allow user to select the animation view (pan, zoom, rotate, etc.) after performing the simulation

� “Disk” - User chooses a hardcopy option (MPEG, series of .tifs, etc.) and the animation parameters are fixed a priori

� Limitation� MPEG is the only currently supported movie format

� No AVI export yet

Page 107: 5 Unsteady Flows 2005

Animation SetupSet up as many animationsequences as desired…

Page 108: 5 Unsteady Flows 2005

Animation Playback

� Playback interface permits� selection of sequences � frame-by-frame analysis of

sequences� export of animations or

individual animation frames� Use individual frames if

you want to use third party animation software

Page 109: 5 Unsteady Flows 2005

� Adaptive time stepping (ATS) permits automatic adjustment of time step size as the calculation proceeds� Based on local truncation error analysis

� Available for both segregated and coupled solvers� Compatible with first and second order temporal discretization

schemes� Customization possible via UDF� Limitations

� Not compatible with VOF model� Not available for coupled explicit solver

Adaptive Time Stepping

Page 110: 5 Unsteady Flows 2005

GUI Panel for ATS

� Specify initial time step and total number of time steps desired

� Set control parameters for ATS

� Set the sub-iteration parameters as usual

� Click on Iterate to begin computation…

Page 111: 5 Unsteady Flows 2005

ATS Controls (1)

� Truncation Error Tolerance (TEtol)� Trunction Error = a measure of solution error� TEtol is a user-specified threshold value which is compared to the

actual truncation error for the purpose of determining if the time step should be increased or decreased

� Default value (0.01) is acceptable for most cases, but you can decrease this value if you want to maintain a smaller time step

� Ending Time� The maximum time permitted for the calculation� Note that the calculation will terminate sooner if the number of time

steps equals the user-specified number in the GUI panel

Page 112: 5 Unsteady Flows 2005

ATS Controls (2)

� Minimum/Maximum Time Step Size� Maximum/Minimum limits placed on time step size� Choose the minimum based on simple estimate (∆x/V)� Choose maximum as no more than one or two orders of magnitude

greater than this (too large a value may lead to inaccuracy)� Minimum/Maximum Step Change Factor (f)

� Define step change factor as the ratio of the truncation error tolerance and the actual (computed) truncation error value:

� Limiting f results in smoother changes in the time step size, especially in flows with high frequency fluctuations.

actual

tolTETEf ~

Page 113: 5 Unsteady Flows 2005

ATS Controls (3)

� The algorithm for computing the time step based on f proceeds as follows:� If f > 1 and f < fmax, then ∆t is increased (since TE < TEtol)� If f > 1 and f > fmax, then ∆t is increased, but limited to fmax ∆tn-1

� Prevents time step from increasing too rapidly� If f < 1 and f < fmin, then ∆t is decreased (since TE > TEtol)� If f < 1 and f > fmin, then ∆t is unchanged

� Prevents time step from getting too small� Number of Fixed Time Steps

� The number of fixed time steps which are performed before ATS isapplied to the calculation

� It is recommended that a number of fixed-size time steps be performed, especially for impulsive initial conditions

Page 114: 5 Unsteady Flows 2005

UDFs for ATS

� A UDF can be hooked to ATS using the drop down list in the ATS GUI panel

� Sample UDF shown on right� Uses DEFINE_DELTAT

macro� Returns time step (in units

of seconds)

DEFINE_DELTAT(mydeltat, domain)

{

real time_step;

real t = CURRENT_TIME;

if (t < 0.5)

time_step = 0.1;

else

time_step = 0.2;

return time_step;

}

Page 115: 5 Unsteady Flows 2005

Example: Transient Heating in a Cavity

Contours of Velocity Magnitude (m/s) Contours of Static Temperature (K)

Final Solution at Steady-State

Page 116: 5 Unsteady Flows 2005

Transient Temperature History

Total Volume Integral of Temperature (K/m3)

Flow Time (s)

Page 117: 5 Unsteady Flows 2005

Comparison of Computational Effort

Total Volume Integral of Temperature (K/m3)

Adaptive Time Stepping Constant Time Stepping

# of Time Steps # of Time Steps