Structured meshes Very smple computatonal domans can be dscretzed usng boundary-ftted structured meshes (also called grds) The grd lnes of a Cartesan mesh are parallel to one another
Structured meshes A general structured mesh s logcally equvalent to a unform Cartesan grd (there exsts a one-to-one mappng) There are d famles of grd lnes n R d, d = 1, 2, 3 Members of the same famly do not cross each other and cross each member of the other famles just once The grd lnes of each famly can be numbered consecutvely The poston of each grd pont (or mesh cell) s unquely dentfed by a set of d ndces n R d, e.g., (x, y j ) R 2, (x, y j, z k ) R 3
Structured meshes Each nternal grd pont has 4 nearest neghbors n 2D, 6 n 3D One of the ndces of each par of neghbor ponts dffers by ±1 Ths neghbor connectvty smplfes programmng, provdes fast data access and leads to effcent numercal algorthms The matrces of lnear algebrac systems are banded and fast solvers (both drect and teratve) are readly avalable for such systems
Structured meshes The generaton of a structured mesh may be dffcult or mpossble for computatonal domans of complex geometrcal shape Local mesh refnement n one subdoman produces unnecessarly small spacng n other parts of the doman Long thn cells may adversely affect convergence of teratve solvers or result n volatons of dscrete maxmum prncples
Block-structured meshes Two (or more) level subdvson of the computatonal doman Decomposton nto relatvely large overlappng or nonoverlappng subdomans (blocks, macroelements) on the coarse level Dscretzaton of these blocks usng structured meshes
Block-structured meshes Block-structured meshes wth overlappng blocks are sometmes called composte or Chmera meshes Mesh generaton for complex domans and flow problems wth movng objects or nterfaces becomes relatvely easy
Block-structured meshes More flexblty than wth sngle-block structured meshes Mesh spacng may be chosen ndvdually for each block Local refnement n one block does not affect other blocks Solvers for structured grds can be appled blockwse Programmng s more dffcult than for structured meshes Interpolaton and/or conservaton errors at block nterfaces
Unstructured meshes No restrctons on the number of neghbor elements or nodes Automatc mesh generaton for complex domans (trangles or quadrlaterals n 2D, tetrahedra or hexaedra n 3D)
Unstructured meshes Hghest flexblty w.r.t. mesh generaton and adaptaton (refnement, coarsenng, redstrbuton of mesh ponts) The coordnates of each mesh pont and numbers of nodes belongng to each element must be stored and retreved Hgh mplementaton effort, rregular sparsty pattern of coeffcent matrces, slow data access due to ndrect addressng Computatonal cost s sgnfcantly hgher than that for a structured grd wth the same number of mesh ponts/elements
Choce of the mesh Summary of pros and cons structured unstructured complex geometres + local mesh refnement + automatc mesh generaton + cost of mesh generaton + programmng effort + effcency of data access + effcency of algorthms +
Fnte approxmatons Followng the choce of the computatonal mesh, a dscretzaton method for the equatons of the mathematcal model s selected Partal dervatves or ntegrals are commonly approxmated by lnear combnatons of dscrete functon values The choce of the dscretzaton method depends on the mesh structured meshes: fnte dfferences or fnte volumes unstructured meshes: fnte volumes or fnte elements
Fnte dfferences Conservaton law u + f = q n Ω (0, T ) t Dscrete unknowns u (t) u(x, t), Approxmaton of dervatves ( ) u u +1 u 1, 2 x = 1,..., N ( 2 ) u u +1 2u + u 1 2 ( x) 2
Fnte dfferences Ths s the smplest and oldest dscretzaton technque Dervaton from the PDE form of the governng equaton The dscrete unknowns are soluton values at the grd ponts The approxmaton of partal dervatves n terms of these values yelds one algebrac equaton per grd pont The use of a (block-)structured mesh s usually requred
Fnte volumes Integral conservaton law d u dx + f nds = q dx dt V S V Dscrete soluton values u (t) = 1 V V u(x, t) dx u(x, t) V n Vj xj V n x n Vj
Fnte volumes Dervaton from the ntegral form of a conservaton law The dscrete unknowns are cell averages or soluton values at the centers of control volumes (mesh cells or dual mesh cells) Volume and surface ntegrals that appear n the conservaton law are approxmated usng numercal quadrature rules Functon values at the quadrature ponts are obtaned usng nterpolaton technques (polynomal fttng) The computatonal mesh can be structured or unstructured
Fnte elements Varatonal problem ( w u ) w f wq dx + wf nds = 0 t Γ Ω Dscrete soluton values u h (x, t) = j u j (t)ϕ j (x), u (t) u(x, t) Bass and test functons ϕ (x ) = 1, ϕ (x j ) = 0, j
Fnte elements Dervaton from a varatonal form of a PDE model The coeffcents of the bass functons ϕ typcally represent approxmate functon values at nterpolaton ponts Insde each cell, the approxmate soluton u h s a polynomal Substtuton of u h u nto the varatonal formulaton wth w {ϕ } yelds one algebrac equaton per mesh node The computatonal mesh can be structured or unstructured
Tme dscretzaton Dscrete tme levels 0 = t 0 < t 1 < < t M = T, t n = n t Approxmaton of the tme dervatve u t un+1 u n, u n u (t n ), u 0 = u 0 (x ) t Lnear algebrac systems Au n+1 = b(u n ), n = 0, 1,..., M 1
Lnear solvers Explct methods: A s a dagonal matrx; the equatons of the lnear system are decoupled and can be solved n a segregated manner Implct methods: A s a sparse matrx; the equatons of the lnear system are coupled and must be solved usng numercal methods Iteratve solvers that explot sparsty (and structure, f any) of the coeffcent matrx are usually more effcent than drect methods
Choce of numercal tools There are many possbltes to dscretze a gven problem usng fnte dfference, fnte volume or fnte element methods The choce of approxmatons nfluences the accuracy of numercal solutons, programmng effort, and computatonal cost A compromse between smplcty, ease of mplementaton, accuracy and computatonal effcency has to be made Numercal algorthms must be stable to produce reasonable results
Desgn crtera Consstency: local dscretzaton errors should be proportonal to postve powers of the mesh sze h and tme step t Stablty: roundng and teraton errors that appear n the process of numercal soluton should not be magnfed Convergence: numercal solutons should become exact n the lmt of vanshng mesh szes and tme steps
Desgn crtera Conservaton: numercal solutons should satsfy a dscrete form of the ntegral conservaton law (local or global) Boundedness: dscrete maxmum prncples should hold f the exact soluton satsfes a maxmum prncple Accuracy: at least second-order convergence for smooth data
Fnte dfferences n 1D Let u : [a, b] R be a dfferentable functon of x A unform mesh s generated usng a subdvson of the doman Ω = (a, b) nto N subntervals of equal length x x = a + x, x = b a N The dscrete unknowns are gven by u u(x ), = 0, 1,..., N
Frst dervatve The frst dervatve of u(x) at the mesh pont x s defned by u (x u(x + x) u(x ) ) = lm x 0 x u(x ) u(x x) = lm x 0 x u(x + x) u(x x) = lm x 0 2 x and can be approxmated usng a fnte (but small) spacng x
Fnte dfferences The frst dervatve of u(x) at x can be approxmated by forward dfference backward dfference central dfference ( ) u u +1 u x ( ) u u u 1 x ( ) u u +1 u 1 2 x The qualty of these approxmatons depends on u and x
Geometrc nterpretaton The frst dervatve of u at the mesh pont x s the slope of the tangent to the curve u(x) at that mesh pont It can be approxmated by the slope of a straght lne passng through two nearby ponts on the curve Ù ÒØÖ Ð ÓÖÛ Ö Û Ö Ü Ü Ü Ø Ü ½ Ü Ü ½ Ü
Dervaton from Taylor seres The Taylor seres expanson of u about x s gven by u(x) = ( ) u u(x ) + (x x ) + (x x ) 2 ( 2 ) u 2 2 + (x x ) 3 ( 3 ) u 6 3 + + (x x ) n ( n ) u n! n +... Usng ths expanson at the neghbor ponts, we fnd that u(x ±1 ) = u(x ) ± x ( u ) + ( x)2 2 ( 2 u ± ) ( x)3 2 6 ( 3 u 3 ) +...
Truncaton errors Forward dfference ( ) u = u +1 u x Backward dfference ( ) u = u u 1 x Central dfference ( ) u x 2 + x 2 = u +1 u 1 2 x ( 2 ) u 2 ( x)2 6 ( 2 ) u 2 ( x)2 6 ( x)2 6 ( 3 ) u 3 +... ( 3 ) u 3 +... ( 3 ) u 3 +...
Truncaton errors The local truncaton error ɛ of a fnte dfference approxmaton s the neglected remander of the Taylor seres ɛ = α p+1 ( x) p + α p+2 ( x) p+1 +... The term proportonal to ( x) p s the leadng truncaton error whch determnes the order of consstency ɛ = O( x) p The order of a numercal approxmaton ndcates how fast the error s reduced when the mesh s refned It does not, however, provde any nformaton about the accuracy of the approxmaton on a gven mesh
Second dervatve Taylor seres expanson about x u(x +1 ) = u(x )+ x u(x 1 ) = u(x ) x ( ) u + ( x)2 2 ) ( u + ( x)2 2 ( 2 ) u 2 + ( x)3 6 ) ( 2 u 2 ( x)3 6 ( 3 ) u 3 +... ) ( 3 u 3 +... Central dfference approxmaton ( 2 ) u 2 = u +1 2u + u 1 ( x) 2 + O( x) 2
Second dervatve Approxmaton n terms of frst-order dvded dfferences 2 u 2 = ( ) ( u 2 ) ( u ) u +1/2 2 ( ) u x 1/2 Central dfference approxmaton at the ponts x ±1/2 ( 2 ) u 2 u +1 u x u u 1 x x = u +1 2u + u 1 ( x) 2
Dffusve fluxes Approxmaton n terms of frst-order dvded dfferences ( f x, u ) = a(x) u ( ) f f +1/2 f 1/2 x Central dfference approxmaton at the ponts x ±1/2 ( ) f a +1/2 u+1 u x a 1/2 u u 1 x x = a +1/2u +1 (a +1/2 + a 1/2 )u + a 1/2 u 1 ( x) 2
One-sded approxmatons No left or rght neghbors at the boundary ponts x 0 = a, x N = b Ü ¼ Ü ½ Ü ¾ Frst-order forward dfference ( ) u = u 1 u 0 + O( x) 0 x How can we construct hgher-order one-sded approxmatons?
Polynomal fttng Taylor expanson about the boundary pont x = 0 ( ) ( u u(x) = u(0) + x + x2 2 ) ( u 0 2 2 + x3 3 ) u 0 6 3 +... 0 Approxmaton by a polynomal and dfferentaton u(x) a + bx + cx 2, u 0 = a u 1 = a + b x + c( x) 2 u 2 = a + 2b x + 4c( x) 2 u b + 2cx, ( ) u b 0 c( x) 2 = u 1 u 0 b x b = 3u0+4u1 u2 2 x
Error analyss Consder a one-sded dfference approxmaton of the form ( ) u αu + βu +1 + γu +2, α, β, γ R x To prove consstency and derve the local truncaton error, substtute the Taylor seres expansons u +1 = u + x ( ( u ) + ( x)2 2 u 2 + ) ( x)3 2 6 u +2 = u + 2 x ( u ) + (2 x)2 2 ( ) 2 u 2 + (2 x) 3 6 ( 3 u 3 ) +... ( 3 u 3 ) +...
Error analyss Substtuton of the Taylor seres expansons yelds αu + βu +1 + γu +2 x = α + β + γ u + (β + 2γ) x + x (β + 4γ) 2 The approxmaton s second-order accurate f ( ) u ( 2 ) u 2 + O( x) 2 α + β + γ = 0, β + 2γ = 1, β + 4γ = 0 It follows that ( u ) = 3u+4u+1 u+2 2 x + O( x) 2
Error analyss Consder a one-sded dfference approxmaton of the form ( 2 ) u 2 αu + βu +1 + γu +2 ( x) 2, α, β, γ R To prove consstency and derve the local truncaton error, substtute the Taylor seres expansons u +1 = u + x ( ( u ) + ( x)2 2 u 2 + ) ( x)3 2 6 u +2 = u + 2 x ( u ) + (2 x)2 2 ( 2 u + ) (2 x)3 2 6 ( 3 u 3 ) +... ( 3 u 3 ) +...
Error analyss Substtuton of the Taylor seres expansons yelds αu + βu +1 + γu +2 ( x) 2 = α + β + γ ( x) 2 u + β + 2γ ( ) u x + β + 4γ ( 2 ) u 2 2 + O( x) The approxmaton s frst-order accurate f α + β + γ = 0, β + 2γ = 0, β + 4γ = 2 It follows that ( 2 u = ) u 2u+1+u+2 2 ( x) + O( x) 2
Hgher-order approxmatons Thrd-order forward dfference / 1st dervatve ( ) u = u +2 + 6u +1 3u 2u 1 6 x + O( x) 3 Thrd-order backward dfference / 1st dervatve ( ) u = 2u +1 + 3u 6u 1 + u 2 + O( x) 3 6 x
Hgher-order approxmatons Fourth-order central dfference / 1st dervatve ( ) u = u +2 + 8u +1 8u 1 + u 2 + O( x) 4 12 x Fourth-order central dfference / 2nd dervatve ( 2 ) u 2 = u +2 + 16u +1 30u + 16u 1 u 2 12( x) 2 + O( x) 4
Propertes To acheve hgher order accuracy, we need more grd ponts One-sded hgh-order approxmatons must be used at boundary ponts; the mplementaton becomes more nvolved The larger number of unknowns per equaton requres more memory and ncreases the cost of solvng lnear systems Desred accuracy can be attaned on coarser meshes Second-order approxmatons are usually optmal for CFD
Posson equaton n 1D Drchlet problem { 2 u 2 = f n Ω = (0, 1) u(0) = 0, u(1) = 0 Physcal nterpretaton: u(x) s the dsplacement of a suspenson brdge, f(x) s the load at pont x Ω Maxmum prncple: f(x) 0, x u(x) 0, x Dscretzaton: x = x, where x = 1 N u u(x ), f = f(x )
Posson equaton n 1D Approxmaton by central dfferences { u 1 2u+u+1 ( x) = f 2, = 1,..., N 1 u 0 = u N = 0 (boundary condtons) Lnear algebrac system = 1 = 2 = 3 = N 1 u0 2u1+u2 ( x) 2 = f 1 u1 2u2+u3 ( x) 2 = f 2 u2 2u3+u4 ( x) = f 2 3... u N 2 2u N 1 +u N ( x) 2 = f N 1
Posson equaton n 1D The matrx form of the lnear system s gven by Au = f, A R (N 1) (N 1), u, f R N 1 where A s trdagonal, symmetrc postve-defnte 2 1 A = 1 1 2 1 ( x) 2 1 2 1... 1 2 The dscrete problem s well-posed (the soluton u = A 1 f exsts and s unque snce the matrx A s nvertble) There are effcent drect solvers for trdagonal matrces
Thomas algorthm Trdagonal matrx algorthm (TDMA) a x 1 + b x + c x +1 = d, = 1,..., n a 1 = 0, c n = 0 Matrx form of the lnear system b 1 c 1 a 2 b 2 c 2 a 3 b 3 c 3... a n b n x 1 x 2 x 3 x n = d 1 d 2 d 3 d n
Thomas algorthm Fast Gaussan elmnaton for trdagonal systems: Forward sweep for k = 2,..., n do c b k = b k a k 1 k b k 1 d d k = d k a k 1 k b k 1 end k-loop Backward sweep x n = dn b n for k = n 1,..., 1 do x k = d k c k x k+1 b k end k-loop Computatonal cost: just O(n) arthmetc operatons nstead of O(n 3 )