Upload
trinhthuan
View
242
Download
3
Embed Size (px)
Computational Fluid Dynamics
Computational Fluid Dynamics
http://www.nd.edu/~gtryggva/CFD-Course/
Grétar Tryggvason
Lecture 18March 27, 2017
Computational Fluid Dynamics
Adaptive Mesh Refinement
Computational Fluid Dynamics
Use patches of finer grids in regions of high shear and around the front. The patches are moved as needed.
Patches
Data structures• Octrees (Quesdtree in 3D)• Block structured Cartesian meshes• Unstructured grid
Adaptive Mesh Refinement (AMR)
The fluxes must be matched at the boundaries between the different patches. Interpolating the coarse grid solution to use as boundary conditions for the fine grid generally results in reduced accuracy
Octree refining
Computational Fluid DynamicsAdaptive Mesh Refinement (AMR)
Computational Fluid DynamicsAdaptive Mesh Refinement (AMR)
Computational Fluid DynamicsAdaptive Mesh Refinement (AMR)
Computational Fluid DynamicsAdaptive Mesh Refinement (AMR)
Computational Fluid Dynamics
From Agreasar et al.
Adaptive Mesh Refinement (AMR)
Computational Fluid Dynamics
Example of a computation of the flow around a F16XL fighter jet using cut cells and AMR
From:M. J. Aftosmis, M. J. Berger, J. E. Melton: Adaptive Cartesian Mesh Generation (downloaded from the web)
Adaptive Mesh Refinement (AMR)Computational Fluid Dynamics
Developing codes using adaptive mesh refinement is a major undertaking. Nevertheless, several investigators have undertaken such efforts. The products are either:
• Libraries that can be integrated with other codes, or
• Complete codes
A major challenge for AMR codes has traditionally been to ensure efficient running on parallel computers.
Before embarking on writing an AMR code, investing time in finding out if something that meets one’s need is likely to be a wise decision.
Adaptive Mesh Refinement (AMR)
Computational Fluid Dynamics
http://www.physics.drexel.edu/~olson/paramesh-doc/Users_manual/amr.htmlhttps://opensource.gsfc.nasa.gov/projects/paramesh/index.php
PARAMESHParallel Adaptive Mesh Refinement
Partial “feature” list from the web site:• Multidimensional• Structured Grid Blocks• Parallelized FORTRAN 90 and C• Portable• Uses MPI• User Tunable Load Balancing• Support for Conservation Laws• Distribution contains source code• Builds upon user's existing codes
Adaptive Mesh Refinement (AMR)Computational Fluid Dynamics
PARAMESH: Block Adaptive Structures with bisected volumes, using a quadtree data structure
http://www.physics.drexel.edu/~olson/paramesh-doc/Users_manual/amr.html
Adaptive Mesh Refinement (AMR)
Computational Fluid DynamicsAdaptive Mesh Refinement (AMR)
Chombo: a Software Framework for Block-Structured AMR
The Chombo package provides a set of tools for implementing finite difference methods for the solution of partial differential equations on block-structured adaptively refined rectangular grids. Both elliptic and time-dependent modules are included. Support for parallel platforms and standardized self-describing file formats are included.
https://commons.lbl.gov/display/chombo/Chombo+-+Software+for+Adaptive+Solutions+of+Partial+Differential+Equations
Computational Fluid Dynamics
http://gfs.sourceforge.net/wiki/index.php/Main_Page
• Solves the time-dependent incompressible variable-density Euler, Stokes or Navier-Stokes equations• Solves the linear and non-linear shallow-water equations• Adaptive mesh refinement: the resolution is adapted dynamically to the features of the flow• Entirely automatic mesh generation in complex geometries• Second-order in space and time• Unlimited number of advected/diffused passive tracers• Flexible specification of additional source terms• Portable parallel support using the MPI library, • dynamic load-balancing, • parallel offline visualisation• Volume of Fluid advection scheme for interfacial flows• Accurate surface tension model
Adaptive Mesh Refinement (AMR)
Computational Fluid Dynamics
http://gerris.dalembert.upmc.fr/gerris/examples/examples/tangaroa.html
Unlike PARAMESH and Chombo, Gerris is a complete code, not a library that you can use with your own code.Features include the ability to track free surfaces and fluid interfaces using the VOF method
Adaptive Mesh Refinement (AMR)Computational Fluid DynamicsAdaptive Mesh Refinement (AMR)
Computational Fluid Dynamics
http://basilisk.fr
Adaptive Mesh Refinement (AMR)
A replacement for Gerris that supposedly has much better parallel performance
Computational Fluid Dynamics
Chimera grids
Several strategies have been developed that involve using two or more overlapping grids
Computational Fluid DynamicsChimera grids
Locally body-fitted grid. Need to interpolate between the grids
Computational Fluid Dynamics
UnstructuredGrids
Computational Fluid Dynamics
Grid generation for complex geometries is usually a major task, requiring both large amount of time and money. Structured grids generally lead to fast and accurate flow solvers and are therefore preferred where the cost of generating the grid is not excessive.
For situations where the complexity of the domain is such that grid generation is very expensive and where the user can live with modest accuracy, unstructured grids are generally used.
Computational Fluid Dynamics
Sometimes it is not possible to maintain a regular layout of the grid. In those cases it is necessary to use UNSTRUCTURED grids where the connectivity of the grid is part of the data structure. In some case it is possible to use hexahedron cells but in other cases we need more irregularly shaped control volumes.
hexahedron tetrahedron
Or other polyhedron
shapes
Unstructured Grids
Computational Fluid Dynamics
Unstructured versus structured grids
structured grids: an ordered layout of
grid points.
unstructured grids: an arbitrary layout of grid
points. Information about the layout must be provided
Unstructured GridsComputational Fluid Dynamics
Since the points are laid out in an irregular unstructured way, the point location and connectivity must be stored
Unstructured grids can consist of arbitrarily shaped control volumes but tetrahedrons (pyramids) and
hexahedrons (boxes) are most common
Unstructured Grids
Computational Fluid Dynamics
For a cell based scheme each cell is a control volume and we solve for the average values in each cell
Cell
Edge
Face
Unstructured GridsComputational Fluid Dynamics
While it may seems straight forward to use the polyhedron as a control volume, for time dependent problems this results in a a coupling between the nodal points. The mass in the control volume at t+Δt is, for example:
Al =
12
xA yB − xA yc + xB yC − xB yA + xC yA − xC yB
l A
B
C
Ml
n+1 = Al ρAn+1 + ρB
n+1 + ρCn+1( )
Unstructured Grids
Computational Fluid Dynamics
For vertex based schemes a control volume is constructed by dividing up the cells next to the vertex
Cell
Edge
FaceThe cells can be divided by drawing a line perpendicular to each edge. The corners of the control volume are where two such lines intersect.
Or, we can connect the center of each triangle and the center of the vertex
Unstructured GridsComputational Fluid Dynamics
Data Structure:Indirect addressing
x1 y1
x2 y2
x3 y3
x4 y4
x5 y5
. .
Node coordinates n11 n12 n13
n21 n22 n23
n31 n32 n33
n41 n42 n43
n51 n52 n53
. . .
Element corners
x-coordinate of the first corner point of element m: x(m(1))
Usually it also helps if the elements know
about their neighbors
n11
n12
n13Elem 1
Unstructured Grids
Computational Fluid Dynamics
The finite volume method is usually used to derive numerical approximations for unstructured grids. However, finite element methods and “mesh free” methods also use unstructured grids
Here we will briefly outline a vertex centered method for the advection/diffusion equation
Unstructured GridsComputational Fluid Dynamics
Vertex centered advection diffusion equation
�
∂f∂t
+ ∇ ⋅uf = ν∇2 f
Integrate over a control volume
�
∂f∂tdv +
V∫ ∇ ⋅uf dvV∫ = ν ∇2 f dv
V∫
�
∂∂t
fdv +V∫ fu ⋅nds
S∫ = ν ∇f ⋅ndsS∫
Convert volume integrals to surface integrals
Unstructured Grids
Computational Fluid Dynamics
�
A jddt
f j = − feall edges∑ ue ⋅neΔse + ν Δfe
all edges∑ Δse
le
�
fe = 12
f j + f i( )Δfe = f j − f i
ue = 12u j + u i( )
Node iNode jAj
le
Δse
�
f j = fdvV j∫
ne =x j − xi
x j − xi
le = x j − xi
Numerical approximation
Generally we loop over the elements
Unstructured GridsComputational Fluid Dynamics
For the full Euler and the Navier-Stokes equations, the numerical approximations are derived in the same way as for for finite volume methods on body fitted grids.
While hexahedrons and tetrahedrons are the most common shapes for the control volumes, any shape is possible.
Unstructured Grids
http://en.wikipedia.org/wiki/CD-adapco
Computational Fluid Dynamics
Generation of unstructured grids
Computational Fluid Dynamics
Grid based generation of unstructured meshesStart with a regular mesh. Split rectangles and move grid points to confirm to boundaries
Octree meshingInstead of starting with a regular grid, split cells into four cells (in 2D) until grid is refined enough.
Often the size of the triangles is determined by a mesh function that changes from one point in the domain to another
Triangulated grids
Computational Fluid Dynamics
Advancing front method: Start at the boundaries and keep adding points until you run into the grid from other boundaries
Triangulated gridsComputational Fluid Dynamics
A number of algorithms exist to generate Delauny triangulation. Most are based on starting with a coarse grid and then refine it. Usually points are inserted and the triangles around the new point are reconstructed to be a Delauny triangulation.
Triangulated grids
Computational Fluid Dynamics
Generation of unstructured triangular grids:
A Delaunay triangulation of a set of points is defined so that no points fall within the circle defined by the three points of a triangle
http://en.wikipedia.org/wiki/Delaunay_triangulation
Triangulated gridsComputational Fluid Dynamics
Delaunay triangulation: By reconnecting the points, we can construct a valid triangulation
Not a Delaunay triangulation: Points fall within the circle that goes through the points defining the triangle
Triangulated grids
Computational Fluid Dynamics
Hybrid Meshes
Sometimes it is convenient to keep hexahedron control volumes near a boundary to better resolve boundary layers, even if the rest of the domain is gridded using tetrahedrons
Unstructured grids
Originally, triangular grid were developed for the compressible Euler equations. Approximating the viscous fluxes and enforcing incompressibility is more complex. For boundary layer like flow, sometimes hybrid tetrahedron/hexahedron grids have been advocated
Computational Fluid Dynamics
http://www-2.cs.cmu.edu/~quake/triangle.html
Triangulated grids
Generation of unstructured triangular grids is a well developed field with a number of packages available to do so.
Computational Fluid Dynamics
Visualizing the Results
http://www.nd.edu/~gtryggva/CFD-Course/Computational Fluid Dynamics
File formatsVisualization softwareWhat to look atVisit demoA few examples
http://www.nd.edu/~gtryggva/CFD-Course/
Computational Fluid Dynamics
• The goal of computations and simulations is to produce results that usually need to be examined in some way.
• A visualization is usually an important part of this analysis.
• For computations of small systems using matlab the visualization is sometimes part of the computations. In most cases, however, the data needs to be stored in output files
• The format of the files needs to be compatible with the analysis and visualization software used
• The data can be stored as either ascii or binary files. Usually the former is used for smaller files and during development and the latter during production runs.
http://www.nd.edu/~gtryggva/CFD-Course/Computational Fluid Dynamics
• Several efforts have been made to standardize output formats, allowing for structured and unstructured grids and a variety of data types.
• In many cases this involves not only the format but also libraries to generate and read the files
• Such effort include the Hierarchical Data Format (HDF) of which HDF5 is the latest version, and software libraries, such as NetCDF (Network Common Data Form) for array data.
• The most commonly used ones are open source formats developed by US Government agencies
• In addition, various commercial vendors have promoted various formats
http://www.nd.edu/~gtryggva/CFD-Course/
Computational Fluid Dynamicshttp://www.nd.edu/~gtryggva/CFD-Course/
SILOSilo is a library which implements an application programing interface (API) designed for reading and writing a wide variety of scientific data to binary, disk files. The files Silo produces and the data within them can be easily shared and exchanged between wholly independently developed applications running on disparate computing platforms. Consequently, the Silo API facilitates the development of general purpose tools for processing scientific data. One of the more popular tools that process Silo data files is the VisIt visualization tool. (from the Silo Users Manual)
https://wci.llnl.gov/simulation/computer-codes/silo
Computational Fluid Dynamics
One of the simplest formats that is widely used is the Visualization Toolkit (VTK) supported by Kitware. VTK is “VTK supports a wide variety of visualization algorithms including scalar, vector, tensor, texture, and volumetric methods, as well as advanced modeling techniques such as implicit modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay triangulation. VTK has an extensive information visualization framework and a suite of 3D interaction widgets. The toolkit supports parallel processing and integrates with various databases”
From: http://www.vtk.org
http://www.nd.edu/~gtryggva/CFD-Course/
Computational Fluid Dynamicshttp://www.nd.edu/~gtryggva/CFD-Course/
# vtk DataFile Version 2.0time 0.00000000ASCIIDATASET RECTILINEAR_GRIDDIMENSIONS 49 33 25X_COORDINATES 49 float 0.00000 0.06545 0.13090 0.19635 0.26180 0.32725 0.39270 0.45815 0.52360 0.58905 0.65450 0.71995 0.78540 0.85085 0.91630 0.98175 1.04720 1.11265 1.17810 1.24355 1.30900 1.37445 1.43990 1.50535 1.57080 1.63625 1.70170 1.76715 1.83260 1.89805 1.96350 2.02895 2.09440 2.15985 2.22530 2.29075 2.35620 2.42165 2.48710 2.55255 2.61800 2.68345 2.74890 2.81435 2.87980 2.94525 3.01070 3.07615 3.14160Y_COORDINATES 33 float 0.00000 0.01762 0.04191 0.07313 0.11135 0.15656 0.20860 0.26720 0.33199 0.40252 0.47824 0.55853 0.64273 0.73011 0.81991 0.91132 1.00354 1.09574 1.18708 1.27676 1.36397 1.44795 1.52797 1.60336 1.67351 1.73786 1.79595 1.84742 1.89199 1.92950 1.95992 1.98334 2.00000Z_COORDINATES 25 float 0.00000 0.06545 0.13090 0.19635 0.26180 0.32725 0.39270 0.45815 0.52360 0.58905 0.65450 0.71995 0.78540 0.85085 0.91630 0.98175 1.04720 1.11265 1.17810 1.24355 1.30900 1.37445 1.43990 1.50535 1.57080POINT_DATA 40425VECTORS velocity float 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 MORE DATA
Computational Fluid Dynamicshttp://www.nd.edu/~gtryggva/CFD-Course/
# vtk DataFile Version 2.0Lamd2ASCIIDATASET RECTILINEAR_GRIDDIMENSIONS 97 65 49X_COORDINATES 97 float 0.000000000000000E+000 3.272499889135361E-002 6.544999778270721E-002 MORE DATA 3.04342489689589 3.07614989578724 3.10887489467859 3.14159989356995 Y_COORDINATES 65 float 0.000000000000000E+000 7.996319000000000E-003 1.761964600000000E-002 MORE DATA 1.95992405000000 1.97249746400000 1.98334344200000 1.99249600400000 2.00000000000000 Z_COORDINATES 49 float 0.000000000000000E+000 3.272499889135361E-002 6.544999778270721E-002 MORE DATA 1.47262495011091 1.50534994900227 1.53807494789362 1.57079994678497 POINT_DATA 308945SCALARS Lamda2 floatLOOKUP_TABLE defalut -0.1897E-18 0.6302E-18 -0.4012E-17 0.4588E-17 -0.4091E-17 0.5200E-17 MORE DATA
Computational Fluid Dynamicshttp://www.nd.edu/~gtryggva/CFD-Course/
http://www.paraview.org
Computational Fluid Dynamicshttp://www.nd.edu/~gtryggva/CFD-Course/
https://wci.llnl.gov/simulation/computer-codes/visit
Computational Fluid Dynamics
Examples
http://www.nd.edu/~gtryggva/CFD-Course/Computational Fluid Dynamics
Channel Flow
Streamwise velocity
Flow direction
Periodic streamwise
and spanwise boundaries
Wall
Computational Fluid Dynamics
Streamwise velocity
Computational Fluid Dynamics
Streamwise vorticity
Turbulent shear stress
Turbulent eddies generate a nearly uniform velocity profile
Channel Flow
Computational Fluid Dynamics
Turbulence are intrinsically linked to vorticity, yet laminar flows can also be vortical so looking at the vorticity is not sufficient to understand what is going on in a turbulent flows. Several attempts have been made to define properties of the turbulent flows that identifies vortices (as opposed to simply vortical flows.
One of the most successful method is the lambda-2 method of Hussain.
Computational Fluid Dynamics
Visualizing turbulence
�
∇u =
∂u∂x
∂u∂y
∂u∂z
∂v∂x
∂v∂y
∂v∂z
∂w∂x
∂w∂y
∂w∂z
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥ �
S = 12∇u +∇Tu( ) = 12
2∂u∂x
∂u∂y
+ ∂v∂x
∂u∂z
+ ∂w∂x
∂v∂x
+ ∂u∂y
2∂v∂y
∂v∂z
+ ∂w∂y
∂w∂x
+ ∂u∂z
∂w∂y
+ ∂v∂z
2∂w∂z
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥
�
Ω = 12∇u -∇Tu( ) = 12
0 ∂u∂y
− ∂v∂x
∂u∂z
− ∂w∂x
∂v∂x
− ∂u∂y
0 ∂v∂z
− ∂w∂y
∂w∂x
− ∂u∂z
∂w∂y
− ∂v∂z
0
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥
Computational Fluid Dynamics
It can be shown that the second eigenvalue of
�
S2 + Ω2
define vortex structuresReferece: J. Jeong and F. Hussain, "On the identification of a vortex," Journal of Fluid Mechanics, Vol. 285, 69-94, 1995.
The second invariant of the velocity gradient is also widely used and gives somewhat similar results
�
Q = ∂ui∂x j
∂u j
∂xi
�
λ2
Computational Fluid Dynamics
�
λ2 = −0.3
�
λ2 = −0.2
Computational Fluid Dynamicshttp://www.nd.edu/~gtryggva/CFD-Course/
Computational Fluid Dynamics
�
���������������������������������Vortices�are�visualized�by�the�isoͲsurface�of�ʄ2,�and�colored�by�the�streamwise�vorticity��at�T=34.��(Left:�ʄ2=Ͳ2��;�Right:�ʄ2=Ͳ4)�
Computational Fluid Dynamics
209
Computational Fluid DynamicsBubbles in Vertical Channels
Computational Fluid Dynamics
Visit demoExample files can be downloaded from:
https://www.dropbox.com/s/rt2vdjh4y8y5uqc/VisitExamples.zip?dl=0
http://www.nd.edu/~gtryggva/CFD-Course/Computational Fluid Dynamicshttp://www.nd.edu/~gtryggva/CFD-Course/
Several alternatives:
• Helicity Method by Levy et al. [4]• Swirl Parameter Method by Berdahl and Thompson [5] • Lambda2 Method by Jeong and Hussain [6]• Predictor-Corrector Method by Banks and Singer [7]• Eigenvector Method by Sujudi and Haimes [8]• Parallel Vectors Method by Roth and Peikert [9]• Maximum Vorticity Method by Strawn et al. [10]• Streamline Methods by Sadarjoen et al. [11]• Combinatorial Method by Jiang et al. [12]
From: Detection and Visualization of Vortices M. Jiang, R. Machiraju and D. Thompson https://www.cavs.msstate.edu/publications/docs/2005/01/3269visHandbook.pdf