Introduction To Computational Hydraulics

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 33

Introduction to Computational

Hydraulics

Instructor: Van Thinh Nguyen


Introduction
• Fluid dynamics
• Fluid dynamics is the science of fluid motion.
• Fluid flow is commonly studied in one of three ways:
– Theoretical fluid dynamics.
– Experimental fluid dynamics.
– Numerically: computational hydraulics/fluid dynamics (CFD).
• During this course we will focus on obtaining the knowledge required
to be able to solve practical fluid flow problems using CFD.
• Topics covered during this course is shown in the syllabus
What is fluid flows?
Fluid flows encountered in everyday life include

• meteorological phenomena (rain, wind, hurricanes, floods, fires)


• environmental hazards (air pollution, transport of contaminants)
• heating, ventilation and air conditioning of buildings, cars, etc.
• combustion in automobile engines and other propulsion systems
• interaction of various objects with the surrounding air/water
• complex flows in furnaces, heat exchangers, chemical reactors, etc.
• processes in human body (blood flow, breathing, drinking . . . )
• and so on and so forth

• Channels, rivers, flood plains, lakes, estuaries, coastal areas, etc.


What is computational fluid dynamics?

• Computational fluid dynamics (CFD) is the science of predicting fluid flow,


heat transfer, mass transfer, chemical reactions, and related phenomena by
solving the mathematical equations which govern these processes using a
numerical process.

• CFD enables scientists and engineers to perform ‘numerical experiments’


(i.e. computer simulations) in a ‘virtual flow laboratory’

• The result of CFD analyses is relevant engineering data used in:


– Conceptual studies of new designs.
– Detailed product development.
– Troubleshooting.
– Redesign.

• CFD analysis complements testing and experimentation.


– Reduces the total effort required in the laboratory.
Why use CFD
Basically, the compelling reasons to use CFD are:

1. Insight
There are many devices, systems and natural phenomena that are very
difficult to prototype. Often, CFD analysis shows you parts of the system
or phenomena happening within the system that would not otherwise be
visible through any other means. CFD gives you a means of visualizing
and enhanced understanding of your systems and designs.
2. Foresight
Because CFD is a tool for predicting what will happen under a given set of
circumstances, it can answer many ‘what if?’ questions very quickly. You
give it variables. It gives you outcomes. In a short time, you can predict
how your design will perform, and test many variations until you arrive at
an optimal result. All of this is done before physical prototyping and
testing. The foresight you gain from CFD helps you to design better and
faster.
3. Efficiency
Better and faster design or analysis leads to shorter design cycles. Time
and money are saved. Products get to market faster. Equipment
improvements are built and installed with minimal downtime. CFD is a tool
for compressing the design and development cycle.
Experiments vs. Simulations
• CFD gives an insight into flow patterns that are difficult,
expensive or impossible to study using traditional
(experimental) techniques

Experiments Simulations

Quantitative description of flow Quantitative prediction of flow phenomena


phenomena using measurements using CFD software
• for one quantity at a time • for all desired quantities
• at a limited number of points and time • with high resolution in space and time
instants
• for a laboratory-scale model • for the actual flow domain
• for a limited range of problems and • for virtually any problem and realistic
operating conditions operating conditions
Error sources: measurement errors, Error sources: modeling, discretization,
flow disturbances by the probes iteration, implementation
Experiments vs. Simulations
• As a rule, CFD does not replace the measurements completely but the
amount of experimentation and the overall cost can be significantly
reduced.
• Equipment and personnel are difficult to transport. CFD software is
portable, easy to use and modify.

Experiments Simulations

• expensive • cheap(er)
• slow • fast(er)
• sequential • parallel
• single-purpose • multiple-purpose
Examples of CFD applications
Examples of CFD applications
Examples of CFD applications
CFD – How it works
CFD analysis process:

1. Problem statement information about the flow


2. Mathematical model IBVP = PDE + IC + BC
3. Mesh generation nodes/cells, time instants
4. Space discretization coupled ODE/DAE systems
5. Time discretization algebraic system Ax = b
6. Iterative solver discrete function values
7. CFD software implementation, debugging
8. Simulation run parameters, stopping criteria
9. Postprocessing visualization, analysis of data
10. Verification model validation / adjustment
Problem statement
• What is known about the flow problem to be dealt with?
• What physical phenomena need to be taken into account?
• What is the geometry of the domain and operating conditions?
• Define material properties: fluid, solid, mixture?
• Are there any internal obstacles or free surfaces/interfaces?
• What is the type of flow (laminar/turbulent, steady/unsteady,
single/multiphase, etc.)?
• What is the objective of the CFD analysis to be performed?
– computation of integral quantities (lift, drag, yield)
– snapshots of field data for velocities, concentrations etc.
• What is the easiest/cheapest/fastest way to achieve the
goal?
Mathematical model
1. Choose a suitable flow model (viewpoint) and reference frame.
2. Identify the forces which cause and influence the fluid motion.
3. Define the computational domain in which to solve the problem.
4. Formulate conservation laws for the mass, momentum, and energy.
5. Simplify the governing equations to reduce the computational effort:
• use available information about the prevailing flow regime (e.g.
steady-state, incompressible, inviscid, laminar, two-dimensional)
• check for symmetries and predominant flow directions (1D/2D)
• neglect the terms which have little or no influence on the
results
• model the effect of small-scale fluctuations that cannot be
captured
• incorporate a priori knowledge (measurement data, CFD
results)
6. Add constitutive relations and specify initial/boundary conditions.
Mesh generation
• Should you use a quad/hex (structured) grid, a tri/tet (unstructured) grid, a
hybrid grid, or a non-conformal grid?
• What degree of grid resolution is required in each region of the domain?
• How many cells are required for the problem?
• Will you use adaption to add resolution?
• Do you have sufficient computer memory?
Mesh generation
• For simple geometries, quad/hex meshes can provide high-quality solutions
with fewer cells than a comparable tri/tet mesh.
• For complex geometries, quad/hex meshes show no numerical advantage,
and you can save meshing effort by using a tri/tet mesh.
• Hybrid mesh: Specific regions can be meshed with different cell types.
Discretization process
• Domain is discretized into a finite set of control volumes or cells. The discretized
domain is called the “grid” or the “mesh.”
• General conservation (transport) equations for mass, momentum, energy, etc.,
are discretized into algebraic equations.
• All equations are solved to render flow field.

 dV    V  dS     dS  S dV
t V S S V
unstead convection diffusion source/sink
y
Equation F
Continuity 1
xi – momentum ui
Energy
E
Discretization process
The PDE system is transformed into a set of algebraic equations
1. Mesh generation (decomposition the region of interest into cells/elements)

Region of interest Meshing


Discretization
• Using CAD tools & grid generators

2. Space discretization (approximation of spatial derivatives)


• finite differences/volumes/elements
• high- vs. low-order approximations

3. Time discretization (approximation of temporal derivatives)


• explicit vs. implicit schemes, stability constraints
• local time-stepping, adaptive time step control
Iterative solution strategy
The coupled nonlinear algebraic equations must be solved iteratively
• Outer iterations: the coefficients of the discrete problem are updated
using the solution values from the previous iteration so as to
– get rid of the nonlinearities by a Newton-like method
– solve the governing equations in a segregated fashion
• Inner iterations: the resulting sequence of linear subproblems
is typically solved by an iterative method (conjugate gradients,
multigrid) because direct solvers (Gaussian elimination) are
prohibitively expensive
• Convergence criteria: it is necessary to check the residuals,
relative solution changes and other indicators to make sure that
the iterations converge.

As a rule, the algebraic systems to be solved are very large (millions


of unknowns) but sparse, i.e., most of the matrix coefficients are equal
to zero.
CFD Simulations
The computing times for a flow simulation depend on
• the choice of numerical algorithms and data structures
• linear algebra tools, stopping criteria for iterative solvers
• discretization parameters (mesh quality, mesh size, time step)
• cost per time step and convergence rates for outer iterations
• programming language (most CFD codes are written in Fortran
and C/C++)
•many other things (hardware, vectorization, parallelization etc.)
The quality of simulation results depends on
• the mathematical model and underlying assumptions
• approximation type, stability of the numerical scheme
• mesh, time step, error indicators, stopping criteria . . .
Post-processing and analysis
Postprocessing of the simulation results is performed in order to
extract the desired information from the computed flow field
• calculation of derived quantities (streamfunction, vorticity)
• calculation of integral parameters (lift, drag, total mass)
• visualization (representation of numbers as images) can be used to
answer such questions as:
– What is the overall flow pattern?
– Where do shocks, shear layers, etc. form?
– Are key flow features being resolved?
– Are physical models and boundary conditions appropriate?

• Systematic data analysis by means of statistical tools


• Debugging, verification, and validation of the CFD model
Tools to examine the results
• Graphical tools:
– Grid, contour, and vector plots.
– Pathline and particle trajectory plots.
– XY plots.
– Animations.
• Numerical reporting tools:
– Flux balances.
– Surface and volume integrals and averages.
– Forces and moments.
Consider revisions to the model
Are physical models appropriate?
– Is flow turbulent?
– Is flow unsteady?
– Are there compressibility effects?
– Are there 3D effects?
– Are boundary conditions correct?
Is the computational domain large enough?
– Are boundary conditions appropriate?
– Are boundary values reasonable?
Is grid adequate?
– Can grid be adapted to improve results?
– Does solution change significantly with adaption, or is the solution
- Grid independent?
– Does boundary resolution need to be improved?
Limitations of CFD
• Physical models.
– CFD solutions rely upon physical models of real world processes
(e.g. turbulence, compressibility, chemistry, multiphase flow, etc.).
– The CFD solutions can only be as accurate as the physical
models on which they are based.
• Numerical errors.
– spatial discretization error due to a finite grid resolution
– temporal discretization error due to a finite time step size
– Round-off error due to finite precision of the computer
arithmetic.
– Truncation error due to approximations in the numerical
models.
Truncation errors will go to zero as the grid is refined. Mesh
refinement is one way to deal with truncation error.
• Other errors: error in original data, propagated error, etc.
Limitations of CFD (cont.)
• Boundary conditions.
– As with physical models, the accuracy of the CFD solution is
only as good as the initial/boundary conditions provided to the
numerical model.
– Example: flow in a duct with sudden expansion. If flow is supplied
to domain by a pipe, you should use a fully-developed profile for
velocity rather than assume uniform conditions.
Verification of CFD codes
• Verification amounts to looking for errors in the implementation of the
models (loosely speaking, the question is: “are we solving the equations
right”?)
• Examine the computer programming by visually checking the source code,
documenting it and testing the underlying subprograms individually
• Examine iterative convergence by monitoring the residuals, relative
changes of integral quantities and checking if the prescribed tolerance is
attained
• Examine consistency (check if relevant conservation principles are satisfied)
• Examine grid convergence: as the mesh and/or and the time step are
refined, the spatial and temporal discretization errors, respectively, should
asymptotically approach zero (in the absence of round-off errors)
• Compare the computational results with analytical and numerical solutions
for standard benchmark configurations (representative test cases)
Validation of CFD models
Validation amounts to checking if the model itself is adequate for practical
purposes (loosely speaking, the question is: “are we solving the right equations”?)

• Verify the code to make sure that the numerical solutions are correct.
• Compare the results with available experimental data (making a provision for
measurement errors) to check if the reality is represented accurately enough.
• Perform sensitivity analysis and a parametric study to assess the inherent
uncertainty due to the insufficient understanding of physical processes.
• Try using different models, geometry, and initial/boundary conditions.
• Report the findings, document model limitations and parameter settings.

The goal of verification and validation is to ensure that the CFD code produces
reasonable results for a certain range of flow problems.
Example
• Forces on the dinosaur
• Drag force: 17.4 N.
• Lift force: 5.5 N.
• Wind velocity: 5 m/s.
• Air density: 1.225 kg/m3.
• The dinosaur is 3.2 m tall.
• It has a projected frontal area of A = 2.91 m2.
• The drag coefficient is:

This is pretty good compared to the average car! The streamlined


back of the dinosaur resulted in a flow pattern with very little
separation.
Summary
• CFD is a method to numerically calculate fluid flows and
transport processes.
• Currently, its main application is as an engineering
method, to provide data that is complementary to
theoretical and experimental data. This is mainly the
domain of commercially available codes and in-house
codes at large companies.
• CFD can also be used for purely scientific studies, e.g.
into the fundamentals of turbulence. This is more
common in academic institutions and government
research laboratories. Codes are usually developed to
specifically study a certain problem.

You might also like