COMPUTATIONAL FLUID DYNAMICS: FDM: Appromaton of Second Order Dervatves Lecture APPROXIMATION OF SECOMD ORDER DERIVATIVES. APPROXIMATION OF SECOND ORDER DERIVATIVES Second order dervatves appear n dffusve terms of transport/conservaton equatons. To obtan a fnte dfference appromaton of the second dervatve at a pont, we can ether use the appromaton of the frst dervatves or etend any of the technques descrbed n the prevous lecture for the frst order dervatves. We dscuss applcaton of each of these approaches n the sequel.. USE OF APPROXIMATIONS OF FIRST ORDER DERIVATIVE To obtan the second order dervatve at a pont, one may use appromaton of frst order dervatves. For eample, an appromaton of the second order dervatve can be obtaned usng the forward dfference formula f f f (.) We can use a dfferent formula (say, BDS) for the appromaton of the frst order dervatves n the precedng equaton whch results n f f f f f f f f On a unform grd, Eq. (.) reduces to (.) f f f f (.) Appromaton (.) s frst order accurate. A better appromaton for the second order dervatve can be obtaned usng CDS at ponts halfway between nodes,.e. f f f (.) CDS s also used for appromaton of the frst order dervatves n Eq. (.),.e. f f f f f f and (.5) Dr K M Sngh, Indan Insttute of Technology Roorkee NPTEL.
COMPUTATIONAL FLUID DYNAMICS: FDM: Appromaton of Second Order Dervatves Substtuton of Eq. (.5) nto Eq. (.) yelds the followng formula for the second order dervatve f f f f (.6) On a unform grd, Eq. (.6) reduces to Eq. (.).. TAYLOR SERIES EXPANSION Usng Taylor seres epanson about, functon values at grd ponts and can be epressed as f f f f f H (.7)!! f f f f f H (.8)!! Multply Eq. (.8) by and add t to Eq. (.7) to elmnate the frst order dervatve. Rearrangement of the resultng equaton leads to the followng relaton for the second order dervatve: f f f f (.9) f H whch s dentcal to Eq. (.6) obtaned usng CDS. The leadng term n the truncaton error of precedng appromaton s formally of frst order on a non-unform grd, and of second order on unform grds. However, even for a non-unform grd, the truncaton error s reduced as n a second order scheme wth the grd refnement (Ferzger and Perc, 00). A general procedure on unform grds On unform grds, we can defne the dfference appromaton for the second order dervatve as (Chung, 00) f af bf cfdf ef... (.0) Coeffcents a, b, c, d, e,. can be determned from Taylor seres epanson for the functon values nvolved at the RHS around pont. Usng ths approach, the three pont central dfference formula (.) can be derved startng wth the relaton Dr K M Sngh, Indan Insttute of Technology Roorkee NPTEL.
COMPUTATIONAL FLUID DYNAMICS: FDM: Appromaton of Second Order Dervatves f af bf cf (.) Taylor seres epanson for f and f lead to the followng relaton: af bf cf ( abc) ( cb) f ( bc) f f (.) f f ( cb) ( b c)... 6 From the precedng equaton, t s clear that Eq. (.) wll represent an appromaton for the second order dervatve f and only f a bc0, b c 0and bc. Clearly, bcand a. Thus, we obtan the followng central dfference appromaton f f f f f (.) whch s second order accurate. Smlarly, we can derve the followng one-sded formula f f f f f (.) whch s only frst order accurate (Chung, 00). Further, usng ths approach, we can easly derve a hgher order central dfference appromaton usng functon values at fve ponts (for detals, see Eample. below) gven by f 0 f 6( f f ) ( f f) O (.5) Eample. Derve a fve pont central dfference formula for the second order dervatve on unform grd usng Taylor seres epanson and Eq. (.0). Soluton Fve pont central dfference formula for the second order dervatve can epressed as f af bf cf df ef Taylor seres epansons for f, f, f and f, we get a b c d e b c d e af bf cf df ef f f f f bcd e bc8d 8e 6 0 5 f f bc6d 6e bcd e 5 6 f bc6d 6e H 6 70 () () Dr K M Sngh, Indan Insttute of Technology Roorkee NPTEL.
COMPUTATIONAL FLUID DYNAMICS: FDM: Appromaton of Second Order Dervatves Equatons () and (v) ndcate that the coeffcents n Eq. () must satsfy the followng condtons: abcde 0 () bcd e 0 (v) bcd e (v) bc8d 8e 0 (v) bc6d 6e (v) Solvng Eqs. (v)-(v), we get a5 /, bc /, d e / (v) The truncaton error (TE) s gven by 6 6 f f bc6d6e 6 6 70 90 Therefore, the desred fve-pont central dfference formula s f 0 f 6( f f ) ( f f), TE~ O () (). POLYNOMIAL FITTING For any functon, an nterpolatng polynomal of degree n can be ft usng functon values at ( n ) data ponts and appromaton to all dervatves up to order n can be obtaned by dfferentaton. Use of quadratc nterpolaton loads to three pont CDS formula (.) or (.) for the second order dervatve. In general, truncaton error of the appromaton to second order dervatve obtaned by fttng a polynomal of degree n s of order ( n ). One order s ganed (.e., truncaton error s of order n) f grd spacng s unform and an even-order polynomals s used. For eample, polynomal of degree on unform grd leads to the fourth order accurate formula gven by Eq. (.5). Eample. Derve Eq. (.5) by fttng a polynomal of degree on unform grd. Also obtan the correspondng appromatons for the frst, thrd and fourth order dervatves. Soluton To obtan a central dfference appromaton, we can ft the followng th degree polynomal through fve ponts,,, and : 0 f a a a a a () Formal dfferentaton of the precedng equaton leads to the followng relatons: f f f f a, a, 6 a, a () To obtan the values of coeffcents a, we ft the nterpolaton curve () to the functon values at ponts,,, and, whch results n the followng set of lnear equatons: Dr K M Sngh, Indan Insttute of Technology Roorkee NPTEL.
COMPUTATIONAL FLUID DYNAMICS: FDM: Appromaton of Second Order Dervatves f a0 () f f a a a a (v) f f a a a a (v) f f a a a a (v) f f a a a a (v) Soluton of smultaneous Eqs. (v)-(v) yelds the followng values for coeffcents a : f 8 f 8 f f f 6 f 0 f 6 f f a, a f f f f f f 6f f f a, a (v) Thus, appromatons for the dervatves obtaned from two-sded th fttng on a unform grd are f a f 8f 8f f f f 6 f 0 f 6 f f a f f f f f 6a f f f 6f f f a degree polynomal () () () () Equaton () s the same as Eq. (.5) derved earler usng Taylor seres epanson..5 APPROXIMATION OF SECOND ORDER DERIVATIVE IN GENERIC TRANSPORT EQUATION The dffuson term n the generc conservaton equaton nvolves a second order dervatve of the form ( / )/. If Γ s constant, ths term becomes ( / ) and fnte dfference appromatons n the precedng secton can be used. Otherwse, we have to employ sutable fnte dfference appromatons for the frst order dervatves for nner and outer dervatves. The most popular approach s to employ the central dfference appromaton for both the nner and outer dervatves. Let us use the values of the nner frst order dervatve at ponts md-way between the nodes and central dfference formula to obtan the appromaton for the outer dervatve gven by (.6) Dr K M Sngh, Indan Insttute of Technology Roorkee NPTEL.5
COMPUTATIONAL FLUID DYNAMICS: FDM: Appromaton of Second Order Dervatves Central dfference appromaton of the frst order dervatves on RHS of the precedng equaton are and Combnng Eq. (.6) and Eq. (.7), we get On a unform grd, the precedng equaton smplfes to ( ) (.7) (.8) (.9) Note that f s a functon of, values at a pont mdway between the nodes can be evaluated usng smple average of functon values at the neghbourng nodes,.e., ( ) (.0) Other appromatons can be easly obtaned usng dfferent fnte dfference appromatons for the nner and outer dervatves. REFERENCES Chung, T. J. (00). Computatonal Flud Dynamcs. nd Ed., Cambrdge Unversty Press, Cambrdge, UK. Ferzger, J. H. and Perć, M. (00). Computatonal Methods for Flud Dynamcs. Sprnger. Dr K M Sngh, Indan Insttute of Technology Roorkee NPTEL.6