logo
  • userLoginStatus

Welcome

Our website is made possible by displaying online advertisements to our visitors.
Please disable your ad blocker to continue.

Current View

Biomedical Engineering - Computational Biomechanics Laboratory

Appunti lezioni completi CFD

Divided by topic

DarioGastaldiComputational BiomechanicsLaboratorythanksand creditsto: Claudio ChiastraIntroduction to computational fluid dynamics analysesContent21.WhatisaCFDsimulation?2.BasicstepsofaCFDsimulation3.AvailablemodelsinaCFDsoftware4.Applications5.GoverningEquations1.Continuityequation2.Momentumequation3.Energyequation 00.210.42VELOCITY[m/s]0459000,450,9Flow rate [mL/min]Time [s]Computational fluid dynamics(CFD) is the analysis of systems involving fluid flow, heat transfer and associated phenomena (e.g. chemical reactions) by means of computer-based simulation.What is a CFD simulation?3Coronary artery (angiography)FlowIDEALIZATIONDISCRETIZATIONSOLUTIONPhysical SystemMathematical ModelDiscrete ModelDiscrete SolutionSolution errorSolution + discretization errorSolution + discretization + modeling errorIncompressible flows•Governing equations•Boundary conditionsWhat is a CFD simulation? Basic Steps4FVM(or FEM)Physical systemCFD ResultsCFD Model IDEALIZATIONDISCRETIZATIONSOLUTIONPhysical SystemMathematical ModelDiscrete ModelDiscrete SolutionSolution errorSolution + discretization errorSolution + discretization + modeling errorWhat is a CFD simulation? Basic Steps21FVM(or FEM)Incompressible flowsPhysical systemCFD ModelGoverning Equations22Conservative form (Eulerian reference frame)Mass conservation!"!#=%!&'&#!(!"!#=)̇"!"−)̇"#$%Hence)̇"!"−)̇"#$%=−%"',-.!/=−%!0-(',)!(where%!&'&#+0-(',)!(=0&'&#+0-',=0Continuity equationIn case of steady-state flowIn case of incompressible fluid0-',=00-,=0̇"!"̇"#$%#"#$!"#$%$&'&'(')*( IDEALIZATIONDISCRETIZATIONSOLUTIONPhysical SystemMathematical ModelDiscrete ModelDiscrete SolutionSolution errorSolution + discretization errorSolution + discretization + modeling errorWhat is a CFD simulation? Basic Steps21FVM(or FEM)Incompressible flowsPhysical systemCFD ModelGoverning Equations22Conservative form (Eulerian reference frame)Mass conservation!"!#=%!&'&#!(!"!#=)̇"!"−)̇"#$%Hence)̇"!"−)̇"#$%=−%"',-.!/=−%!0-(',)!(where%!&'&#+0-(',)!(=0&'&#+0-',=0Continuity equationIn case of steady-state flowIn case of incompressible fluid0-',=00-,=0̇"!"̇"#$%#"#$!"#$%$&'&'(')*( Governing Equations23Non-Conservative form (Lagrangianreference frame)Mass conservationLet us introduce the substantive (or total) derivative of a generic scalar quantity g5'5#+'0-,=0Continuity equationIn case of steady-state flowIn case of incompressible fluid'0-,=00-,=0565#=&6&#+7&6&8+9&6&:+;&6&)(C8D=@#Γ'>(C8D+@":−27>++>;+>::24∆QPEWweEEΔxH$$&,'=Γ'>(C'=Γ'!>!Q'Spatial discretization10Interpolation techniques. AdvectivefluxLet us consider the face e:H$$#=#>)(C>'=λ',+:>:+1−λ',+:>+with = interpolation coefficientλ&,()=-&−-(-)−-(H$$#,'=#>)(C'=#>'9+>:ifif)(C'>0)(C'++Q'−Q+!>!Q++Q'−Y+/2!2>!Q/++⋯:==Q'−Q+!>!Q+H$$>?@=Γ'>(C+=Γ>?@!>!Q+withΓ>?@=#9'9'=[>++λ',+;>;−>+>:+λ',:::>::−>:ifif)(C'>0)(C''9'=X>++\.'>;−\.'+\/'>++\/'>:>:+\0'>+−\0'+\1'>:+\1'>::ifif)(C'>0)(C'=09!Q+9F!>!J=0g=0g=1v45°g=1g=0DD’Exact solutionCentral difference schemeQUICKUpwind difference schemeD-D’g Spatial discretization15Final discretized equationIn 2D steady-state problems, the final discretized equation isWhen using mid-point approximation for surface and volume integrals, and a linear interpolation (central difference scheme) for diffusive and advectivefluxes:D+>++D:>:+D;>;+D>>>+DG>G=O+D+>++F)HD)H>)H=O+̇3'=#9+]>JK−>L=0The equation can be rewritten as follows:When discretized:Finally:−Γ!>!Q+]>JK=]>L−Γ>+−>;∆Q1/2+]>;=]>L>;=>+2Γ2Γ+]∆Q1+]∆Q12Γ+]∆Q1>LClhsCrhswhere n=unit vector normal to the boundaryα= convective heat transfer coefficientgBC= given value of gg∞= undisturbed (external) value of g D++D;_87*>++D:>:+D>>>+DG>G=O+−D;_67*APSPSpatial discretization18Boundary conditionsDirichlet boundary condition(method 2) e.g. boundary condition on temperaturePEWweNΔx1SsnΔyjBoundaryxGhost cell>JK=>++>;2>;=2>JK−>+Given the assign value gBCSubstituting this expression in the discretized equation:D+−D;>++D:>:+D>>>+DG>G=O+−2D;>JKAPSP Dario Gastaldi Computational Biomechanics Laboratory Meshing: types of meshes and mesh quality Content21.Ty p e sofelement2.Structuredmeshes3.Unstructuredmeshes4.Meshquality1.Aspectratio2.Skewness3.Orthogonality4.Orthogonalquality5.Determinant6.Smoothness5.GuidelinesformeshingCFDmodels IDEALIZATIONDISCRETIZATIONSOLUTIONPhysical SystemMathematical ModelDiscrete ModelDiscrete SolutionSolution errorSolution + discretization errorSolution + discretization + modeling errorWhat is a CFD simulation? Basic Steps3FVM(or FEM)Physical systemDiscrete modelTy p e s o f e l e m e n t s ( c e l l s ) i n C F D a p p l i c a t i o n s42D elements3D elementsTriangleQuadrilateralTe t r a h e d r o nPrism / wedgeHexahedronPolyhedronPyramid Cell centerNodeFaceElementEdgeElementFaceNodeNomenclature52D computational grid3D computational gridØElement (cell) = control volume used to discretize the domainØFace= boundary of a cellØEdge= boundary of a faceØNode= vertex of the gridØCell center= location where cell data is storedTy p e s o f m e s h e s6ØThey are composed by orthogonal families of straight lines. ØThe elements are arranged in an array structure: A set of indices (i,j,k)(with the number of indices equal to the space dimension) is defined so that each element has a unique index set in which the indices of adjacent elements differ by at most unity in each indexØGeometric (coordinates) and topological information (neighbor relations) can be derived (i.e. they are not stored)ØThey are the most computationally efficient gridsØThey can be only used to discretize simple geometriesStructured Cartesian gridsSingle-blockMulti-block Ty p e s o f m e s h e s7Structured curvilinear gridsØThey are composed by families of lines such that each line of a family does not intersect a line of the same family and intersect the lines of the other families only one time. The lines are defined using curvilinear coordinates.ØHigher geometric flexibility but higher computational costs as compared to Cartesian grids Single-blockMulti-blockTy p e s o f m e s h e s8Unstructured gridsØThey are not defined by families of lines. The domain is subdivided into cells of arbitrary shape (usually, triangles or quadrilaterals in 2D, and tetrahedrons or hexahedrons in 3D).ØThey are more flexible than structured grids. They can be used to discretize every type of geometry, including very complex domains. ØThey provide greater freedom in providing fine resolution to one region, but having course resolution in other areas.ØA me a n i n g f u l a d v a n t a g e i s t h e p o s s i b i l i t y t o u s e u n s t r u c t u r e d g r i d s f o r a d a p t i v e mesh algorithms during analysis procedure. Unstructured grid with triangle elementsUnstructured grid with polyhedrons 9Hybrid gridsØUnstructured grids composed by different types of elements, typically:§Triangles and quadrilaterals in 2D§Te t r a h e d r o n s , p r i s m s , a n d p y r a m i d s i n 3 DØThey are usually used to define the prism / boundary layer Hybrid grid with boundary layerTy p e s o f m e s h e sMesh quality10Mesh quality can be measured by evaluating different criteria according to the type of problem and solver:ØComputational fluid dynamics analyses§Aspect ratio§Skewness§Orthogonality§Orthogonal quality§Smoothness§…ØStructural finite element analyses§Aspect ratio§Determinant§Smoothness§… 9Hybrid gridsØUnstructured grids composed by different types of elements, typically:§Triangles and quadrilaterals in 2D§Te t r a h e d r o n s , p r i s m s , a n d p y r a m i d s i n 3 DØThey are usually used to define the prism / boundary layer Hybrid grid with boundary layerTy p e s o f m e s h e sMesh quality10Mesh quality can be measured by evaluating different criteria according to the type of problem and solver:ØComputational fluid dynamics analyses§Aspect ratio§Skewness§Orthogonality§Orthogonal quality§Smoothness§…ØStructural finite element analyses§Aspect ratio§Determinant§Smoothness§… Mesh quality11Aspect ratioIt is a measure of the stretching of an elementAbaqusdefinition It is the ratio between the longest and shortest edge of an element. Aspect ratio = 1best elementsAspect ratio >> 1worst elementsMesh quality12Aspect ratioIt is a measure of the stretching of an elementFluent definition It is computed as the ratio of the maximum value to the minimum value of any of the following distances: the normal distances between the cell centroid and face centroids (computed as a dot product of the distance vector and the face normal), and the distances between the cell centroid and nodes.Note that for a unit cube the maximum distance is 0.866, and the minimum distance is 0.5. Hence, the aspect ratio is 1.732Aspect ratio > 100 worst elementscloser to 1 best elements Mesh quality13SkewnessSkewness determines how close to ideal (i.e. equilateral or equiangular) an element isEquilateral triangleHighly skewed triangleHighly skewed quadrilateralEquilateral quadrilateralMesh quality14SkewnessEquilateral volume-based skewness(Fluent definition)By considering the optimal cell size (volume) as the size of an equilateral element with the same circumradius of the element under analysis, the skewness is define as:Note: this definition applies only to triangles and tetrahedral elements!"#$%#&&=()*+,-./#..!+0#−/#..!+0#()*+,-./#..!+0#SkewnessElement quality1Degenerate0.9 –0–0.25Excellent0Equilateral Mesh quality15SkewnessNormalized equiangular skewness(Fluent definition)Note: this definition applies to all element typesSkewnessElement quality1Degenerate0.9 –0–0.25Excellent0Equilateral,-23!"#−3$180−3$,3$−3!%&3$where'!"#= largest angle in the element'!$%= smallest angle in the element'&= angle for an equilateral element (e.g. 60°for a triangle, 90°for a square)Mesh quality16Orthogonality (Fluent definition)Given an element, the following quantities can be calculated for each face i :ØThe normalized scalar product of the area vector of a face (⃗"!) and a vector from the centroid of the cell to the centroid of that face (⃗#!) ØThe normalized scalar product of the area vector of a face (⃗"!) and a vector from the centroid of the cell to the centroid of the adjacent cell that shares that face (⃗$!) The orthogonality is defined as the minimum value that results from calculating the two previous quantities for all faces ⃗"!%⃗#!⃗"!%⃗#!⃗"!%⃗$!⃗"!%⃗$!Orthogonality closer to 0 worst elementscloser to 1 best elements Mesh quality15SkewnessNormalized equiangular skewness(Fluent definition)Note: this definition applies to all element typesSkewnessElement quality1Degenerate0.9 –0–0.25Excellent0Equilateral,-23!"#−3$180−3$,3$−3!%&3$where'!"#= largest angle in the element'!$%= smallest angle in the element'&= angle for an equilateral element (e.g. 60°for a triangle, 90°for a square)Mesh quality16Orthogonality (Fluent definition)Given an element, the following quantities can be calculated for each face i :ØThe normalized scalar product of the area vector of a face (⃗"!) and a vector from the centroid of the cell to the centroid of that face (⃗#!) ØThe normalized scalar product of the area vector of a face (⃗"!) and a vector from the centroid of the cell to the centroid of the adjacent cell that shares that face (⃗$!) The orthogonality is defined as the minimum value that results from calculating the two previous quantities for all faces ⃗"!%⃗#!⃗"!%⃗#!⃗"!%⃗$!⃗"!%⃗$!Orthogonality closer to 0 worst elementscloser to 1 best elements Mesh quality17Orthogonal quality (Fluent definition)It is computed using cell skewness and the vector from the cell centroid to each of its faces, the corresponding face area vector, and the vector from the cell centroid to the centroids of each of the adjacent cells Orthogonal quality depends on cell type:ØMinimum of the orthogonalityand (1 -cell skewness)for hexahedrons and polyhedral elementsØOrthogonalityfor tetrahedrons, prisms and pyramidsMinimum orthogonality for element types should be more than 0.01, with average value that is significantly higherOrthogonality quality closer to 0 worst elementscloser to 1 best elementsMesh quality18SmoothnessIt indicates the change in size between adjacent elements.Smooth change in sizeSudden change in sizeFluent definition It is computed as volume change:The change in size should be gradual. There should not be sudden jumps in the element size to avoid erroneous results at nearby nodes8%=9%9&(with)%'= neighbor cell volume1.0 < σ< 1.5good mesh1.5 < σ< 2.5fair meshσ> 2.5poor mesh Mesh quality19Determinant (Jacobian) (HyperMeshdefinition)It is another measure of the deviation of an element from its ideal or "perfect" shape, such as a triangle’s deviation from equilateralThe determinant of the Jacobian relates the local stretching of the parametric space which is required to fit it onto the global coordinate spaceThe software evaluates the determinant of the Jacobian matrix at each of the element integration points or at the element nodes, and reports the ratio between the smallest and the largest. In the case of Jacobian evaluation at the integration points, values > 0.7 are acceptable Determinant closer to 0 worst elementscloser to 1 best elementsGeneral guidelines for meshing CFD models20Choosing the mesh strategy depends onAdapted from AnsysFluent training materialDesired mesh qualityWhat is the maximum acceptable skewness and aspect ratio?Desired element countLow element count for resolving overall flow features versus High cell count for greater detailsTime availableFaster tet-dominant mesh versus hex/hybrid mesh with lower element countAccuracyEfficiencyEasiness to generateGoal: to find the best compromise between accuracy, efficiency, and easiness to generate General guidelines for meshing CFD models21Mesh qualityMesh qualitycriteriaDesirablevaluesAspect ratio< 100 (if possible < 20)Skewness0.01, average closer to 1 Smoothness