Moukalled F., Mangani L., Darwish M. The finite volume method in computational fluid dynamics. An advanced introduction with OpenFOAM and Matlab (811443), страница 78
Текст из файла (страница 78)
(13.73) and theSOUE scheme. Use a time step 0.05 to find the values at 0.1, 0.2, and 0.3.SolutionThe analytical solution at times 0.1, 0.2, and 0.3 were found in example 1.Since two old values are needed, the value at the first time step is foundusing the first order backward Euler scheme. Thus the numerical solution isobtained using Eqs. (13.61), (13.73), and (13.80), which are reduced to1/1 þ Dt/CN ðt þ DtÞ ¼ / 2Dt/4/ //SOEU ðt þ DtÞ ¼3 þ 2Dt/EU ðt þ DtÞ ¼Based on the suggested implementation note, the first temporal element spansthe time interval ½0:025; 0:075, the second element spans the interval½0:075; 0:125, and so on.Numerical solution using the second order CN schemeApplying the above equations, the solutions are found as51813 Temporal Discretization: The Transient Term1/ð0Þ ¼ 0:952381 þ 0:05/CN ð0:1Þ ¼ / 2Dt/ ¼ 1 2 0:05 0:95238 ¼ 0:90476/CN ð0:15Þ ¼ 0:95238 2 0:05 0:90476 ¼ 0:861904/CN ð0:2Þ ¼ 0:90476 2 0:05 0:861904 ¼ 0:81857/CN ð0:25Þ ¼ 0:861904 2 0:05 0:81857 ¼ 0:780047/EU ð0:05Þ ¼9>>>>>>>>>>=>>>>>>>>>>;/CN ð0:3Þ ¼ 0:81857 2 0:05 0:780047 ¼ 0:7405685>< errorCN ð0:1Þ ¼ 4 10) errorCN ð0:2Þ ¼ 1:3 104>:errorCN ð0:3Þ ¼ 2:4 104It is clear that the solution error indicates second order accuracy.
The slightdifferences between the error values obtained here and those reported inexample 1 are due to the number of decimal values carried duringcomputations.Numerical solution using the SOUE scheme91>>/ð0Þ ¼ 0:9524/EU ð0:05Þ ¼>>>1 þ 0:05>>>>4/ /4 0:9524 1>¼¼ 0:90632 >/SOUE ð0:1Þ ¼>=3 þ 2Dt3:1/SOUE ð0:15Þ ¼ ð4 0:90632 0:9524Þ=3:1 ¼ 0:86219 >>>>/SOUE ð0:2Þ ¼ ð4 0:86219 0:90632Þ=3:1 ¼ 0:82014 >>>>/SOUE ð0:25Þ ¼ ð4 0:82014 0:86219Þ=3:1 ¼ 0:780119 >>>>;/SOUE ð0:3Þ ¼ ð4 0:780119 0:82014Þ=3:1 ¼ 0:7420483>< errorSOUE ð0:1Þ ¼ 1:5 10) errorSOUE ð0:2Þ ¼ 1:44 103>:errorSOUE ð0:3Þ ¼ 1:24 103The solution is second order accurate, however it is less accurate than the CNsolution.13.4Non-Uniform Time Steps13.4519Non-Uniform Time StepsSo far a uniform time step was considered.
In practical applications it is common touse variable time steps mainly to reduce the computational cost by selecting, atevery time step, the maximum allowable time step value that does not violate theCFL condition.For first order schemes, the discretization is not affected by whether the time stepis variable or constant. The situation is different for second order transient schemessince they use a stencil involving two time step values. For the case of the two stepimplementation of the Crank-Nicolson transient scheme nothing changes exceptthat for each of the two steps a different time step is used. This affects the accuracyas the spatial derivative is no longer at the center of the temporal element.
For othersecond order schemes, the interpolation profile has to be modified to account for thenon equal time steps. In what follows a non uniform transient grid is used in thediscretization of the transient term for the standard CN [2] and the SOUE [4, 19, 20]schemes. While the finite volume and finite difference methods yield equivalentalgebraic relations in a uniform grid, this is not the case for variable time steps asdemonstrated in the derivations to follow.13.4.1Non-Uniform Time Steps with the Finite DifferenceApproach13.4.1.1Crank-Nicolson SchemeThe CN scheme with non uniform time steps is derived, as shown in Fig. 13.17, byexpressing the values of ρϕ at times t þ Dt and t Dt in terms of its value and thevalues of its derivatives at time t using Taylor series asðq/ÞtþDt ¼ ðq/Þt þðq/ÞtDt@ ðq/Þ@ 2 ðq/Þ Dt2 @ 3 ðq/Þ Dt3þþ Dtþ@t t@t2 t 2!@t3 t 3!ð13:89Þ@ ðq/Þ @ 2 ðq/Þ ðDt Þ2 @ 3 ðq/Þ ðDt Þ3þ ¼ ðq/Þ Dt þ@t t@t2 t 2!@t3 3!ttð13:90ÞThen, multiplying Eq.
(13.89) by ðDt Þ2 and Eq. (13.90) by Dt2 and subtracting theresulting equations from each other, an equation for the first derivative is obtained as52013 Temporal Discretization: The Transient Termt+ ttttttFig. 13.17 The finite difference temporal mesh of the CN scheme with non uniform time stepshitþDt 2 22ðDtÞðq/ÞðDtÞDtðq/Þt Dt2 ðq/ÞtDt@ ðq/Þhi@t tDtðDt Þ2 þ Dt Dt2ð13:91ÞSubstituting the expression for the gradient from Eq.
(13.91) in Eq. (13.3), thediscretized equation for the CN scheme with non uniform time steps is given byhiðDt Þ2 ðq/Þ ðDt Þ2 Dt2 ðq/Þ Dt2 ðq/Þ VC þ L /C ¼ 0ð13:92ÞDt DtðDt þ Dt ÞExpanding the spatial term, the final form of the algebraic equation becomesX aF /F ¼ bC aC /C að13:93ÞaC þ a C / C þC /CF NBðC Þwith the time dependent coefficients computed fromDtq VCDtðDt þ Dt Þ CDt Dt aC ¼q VCDt þ Dt CDtq VCaC ¼Dt ðDt þ Dt Þ CaC ¼For uniform time steps, the coefficients in Eq. (13.39) are recovered.ð13:94Þ13.4Non-Uniform Time Steps13.4.2521Adams-Moulton (or SOUE) SchemeReferring to Fig.
13.18, the Adams-Moulton scheme, also denoted by the SOUEscheme, with non uniform time steps is derived by expressing the values of thedependent variable ϕ at times t Dt and t Dt Dt in terms of its value and thevalues of its derivatives at time t using Taylor series asðq/ÞtDtðq/ÞtDtDt @ ðq/Þ Dt2 @ 2 ðq/Þ¼ ðq/Þ Dtþþ O Dt32@t t 2 @tttð13:95Þ 2 2 @ðq/ÞðDtþDtÞ@ðq/Þþ¼ ðq/Þt ðDt þ Dt Þ þ O Dt32@t @t2 ttð13:96ÞMultiplying Eq. (13.95) by ðDt þ Dt Þ2 =Dt2 and subtracting the resulting equationfrom Eq.
(13.96), a second order representation of the first derivative (i.e., theSOUE scheme) is obtained as@ ðq/Þ1DtDtDt2ttDttDtDtðq/Þðq/Þ¼1þþðq/Þ1þDt ðDt þ Dt Þ@t t DtDt þ DtDtð13:97ÞSubstituting the expression for the gradient from Eq. (13.97) in Eq. (13.3), thediscretized equation becomesttttttttFig. 13.18 The finite difference temporal mesh of the SOUE scheme with non uniform time steps52213 Temporal Discretization: The Transient TermVC1111þþðqC /C Þ VCð qC / C Þ Dt Dt þ DtDt Dt Dtþ VCðqC /C Þ þ L /tC ¼ 0Dt ðDt þ Dt Þð13:98ÞExpanding the spatial term, the final form of the algebraic equation is written asX aC þ aC /C þaF /F ¼ bC aC /C að13:99ÞC /CF NBðC Þwith the time dependent coefficients obtained from11q VCþDt Dt þ Dt C11þ qC VCaC ¼ Dt DtDtq VCaC ¼Dt ðDt þ Dt Þ CaC ¼ð13:100ÞFor uniform time steps the coefficients given in Eq.
(13.54) are recovered.13.4.3Non-Uniform Time Steps with the Finite VolumeApproachFollowing the terminology used with the FVM, the size of a temporal element isdenoted by Dt, while the distance between the centroids of two consecutive temporal elements is designated by dt. For uniform time steps both are equal and thetime between two consecutive computed fields is Dt ¼ dt for both the finite difference and finite volume methods. For non-uniform time steps the time remains Dtfor the finite difference method, however it becomes dt ¼ ðDt þ Dt Þ=2 for thefinite volume method leading to different formulations.As for the finite difference method, with non-uniform time steps, the current andold time step values affect the scheme interpolation profile and hence its finitevolume discretization. This is similar to writing the profile for a convection schemeover a structured non-uniform grid.
The procedure used will be illustrated byconsidering the CN and SOUE schemes. Extension to other profiles isstraightforward.13.4Non-Uniform Time Steps13.4.4523Crank-Nicolson SchemeThe CN scheme is obtained by calculating the value of ρϕ at an interface as theaverage of the ρϕ values at the main points straddling the interface (Fig. 13.19), i.e.,DtDtðq / Þt þðq / ÞtðDt þDtÞ=2Dt þ Dt C CDt þ Dt C CDtDt¼ ðqC /C ÞtðDt þDtÞ=2 þ ðq / ÞtDt ðDtþDt Þ=2Dt þ DtDt þ Dt C CðqC /C ÞtDt=2 ¼ðqC /C ÞtDt=2Dtð13:101ÞSubstituting in Eq.
(13.57), the discretized ρϕ field equation is obtained asDt VCDtDtVCqð/Þþðq / ÞDt þ Dt Dt þ Dt Dt C CDt þ Dt Dt C C DtVC ðqC /C Þ þ L /C ¼ 0Dt þ Dt Dtð13:102ÞThe linearization coefficients for the CN scheme with non uniform time steps areinferred to bettt(ttt/2tt/2t)t + t /2tttt(tt+ t)/2tFig. 13.19 The finite volume temporal mesh of the CN scheme with non uniform time steps52413 Temporal Discretization: The Transient TermDt qC VCDt þ Dt Dt DtDtqC VCFluxC ¼Dt þ DtDtDt þ DtDtqV/C C CFluxV ¼ Dt þ DtDtFluxC ¼ð13:103ÞAs in the constant time step case, the method is explicit necessitating storing valuesof the two previous time steps. Moreover the uniform time steps formulation can berecovered by setting Dt ¼ Dt ¼ Dt in Eqs.
(13.102) and (13.103).13.4.5Adams-Moulton (or SOUE) SchemeWith the second-order “upwind” interpolation profile given by Eq. (11.84), theinterface ρϕ values at the faces t þ Dt=2 and t Dt=2 displayed in Fig. 13.20 arefound to bet+ t/2ttt(ttt/2tt/ 2t)t + t /2tttt(tt+ t)/2tFig. 13.20 The finite volume temporal mesh of the SOUE scheme with non uniform time steps13.4Non-Uniform Time Stepshi Dtðq/ÞtþDt=2 ¼ ðq/Þt þ ðq/Þt ðq/ÞtðDtþDt Þ=2Dt þ Dthiðq/ÞtDt=2 ¼ ðq/ÞtðDtþDt Þ=2 þ ðq/ÞtðDtþDt Þ=2 ðq/ÞtDt ðDtþDt Þ=2525DtDt þ Dtð13:104ÞUsing this profile approximation, the discretized form of Eq.