Exercise : Partial Differential Equations J F Ider Chitham Astrophysics Group, HH Wills Physics Laboratory, University of Bristol, Tyndall Avenue, Bristol BS8 TL Accepted March Received March ; in original form March ABSTRACT Partial differential equations can be implemented to solve a vast range of physical problems abundant in many engineering and scientific fields of study Analytical solutions are often difficult to calculate due to their continuous nature, this makes computational analysis via simulations of continuous physical systems a useful and efficient alternative INTRODUCTION The general form of Poission s equation: Φ(r) = σ(r), is an example of a second order partial differential equation relating a generic potential Φ(r) to a source function σ(r) Poission s equation lies at the foundation of potential theory and is imperative to concepts such as electromagnetism, Newtonian gravity and fluid dynamics due to the accurate representation of the respective potentials When σ(r) = Poission s equation reduces to Laplace s equation If the system under consideration is discrete rather than continuous, it becomes extremely useful to approximate derivatives in partial differential equations as finite differences during numerical analysis For example in electrostatics this concept allows the discretizization of Laplace s equation in two dimensions to be expressed in the form of () This can be solved in the computational plane via projection onto a square (n + ) (n + ) grid with the i,j grid points providing the (x, y) co-ordinates of each point in physical space with respective grid spacings of x and y ( V (x, y) = x + y ) V (x, y) = () By considering the Taylor Series expansion of V (x i, y j) = V i,j about an i,j grid point and evaluating the four adjacent nodes, a first order finite difference approximation for the internal points () can be found providing < i < n and < j < n V i+,j V i,j + V i,j x + Vi,j+ Vi,j + Vi,j y = () For methods of finite difference to be effective well defined boundary conditions must be appropriately imposed on the system Dirichlet and Von Neumann boundary conditions specify the value of V and the normal component ˆn V at the boundary respectively In electrostatics this corresponds to specifying the potential and the normal component of the electric field E = V [] RELAXATION Large linear systems used to model partial differential equations can be solved via iterative methods which implement methods of relaxation This allows the discrete modification of the components of an initially approximated solution to progressively resemble its genuine form with each relaxation step (modification) until convergence is reached The Jacobi method is the simplest of the considered iterative techniques and can be used to solve Laplace s equation in two dimensions by rearranging () to construct a discrete form of the Laplacian operator () [] This effectively averages over neighbouring grid points, allowing iterative alteration to the value at each grid point as the old solution V i,j is continually replaced by a refined estimate V i,j V i,j = [Vi+,j + Vi,j + Vi,j+ + Vi,j )] () An alternative to the Jacobi method is the Gauss-Seidel iteration, the only contrasting feature is that the improved estimate V i,j is returned to the solution immediately after completion, rather than postponing its use until the subsequent iteration This leads to a slight variation in computational performance and efficiency COMPUTATIONAL ANALYSIS Convergence Criterion The process of solution refinement () can continue indefinitely so it is necessary to implement an appropriate convergence criterion X, which specifies the maximum percentage difference a value at a particular grid point can change by between successive iterations When the solution no longer satisfies this condition the iterative process ceases as convergence is deemed sufficient To compare the performance of the iterative algorithms at solving Laplace s equation the initial grid system was set to be symmetrically square ( ) with boundary conditions of V and all other elements at V, X was varied logarithmically and the relative progress compared at each interval as shown in Figure The optimal convergence criterion for iterative techniques emerged as X = %, achieving the maximum degree of convergence in the least time (for this specific system configuration) This was taken as the maximum order of X for adequate convergence hereafter (for the remaining duration of the investigation) as solutions at this level of precision are almost identical regardless of iterative method The contrasting iterative technique of each algorithm is subtly depicted via the isocontours of Figure Jacobi contours are centred as the grid is discretely refined after each iteration over the whole system Gauss-Seidel contours on the other hand become
J F Ider Chitham increasingly off centre as X (see X = {, }) as the algorithm continually refines grid elements starting from the origin resulting in the greater degree of convergence in this vicinity Visual comparisons are consistent with computational time evaluation over a more extensive range of X as shown in Figure The relative degree of convergence is similar for X & however the Gauss-Seidel algorithm is far more efficient when X This can be explained intuitively via algorithm memory requirements; Jacobi iterations bear an additional computational expense of storing Vi,j however this is not necessary for Gauss-Seidel iterations which allows solutions to tend to converge relatively quicker Grid Density Solutions are also sensitive to grid point number density ρn variation, as this determines the effective resolution of the solution due to an increasing resemblance with a continuous system as grid density tends to infinity This was investigated by incrementally changing the number of grid points in the x and y direction n, as the dimensions and spacing of the system and convergence criterion were constrained to ( ), x = y = m, and X = % respectively Grid density scales linearly with the number of grid points n, and the number of iterations N required to reduce the overall error by a factor of P for Laplace s equation in two dimensions is given by ()[] X and therefore P are the same for both methods so the rate of change of iterations as a function of grid density for Jacobi is expected to be approximately twice that of Gauss-Seidel (), this can be seen in Figure with an actual relative gradient ratio of 6 despite the poor goodness of fit This inaccuracy is explained by the breaks down of the relationship at low densities (and very small X), this limiting sensitivity is highlighted by apparent curve at densities P n / for Jacobi N () P n / for Gauss-Seidel The form of computational time differs from the number of iterations because the interaction between grid points must also be considered as well the number of points iterated over, this complicates the rate of variation as shown in Figure via an approximate quadratic form NB All graphical fit analysis is summarised in Table PHYSICS PROBLEMS Parallel Plate Capacitor A one dimensional, finitely extending parallel plate capacitor is located within the structure of the grid and the potential V and electric field, E must be evaluated at every point within and around its proximity The grid dimensions were specified to be much greater than that of the capacitor ( ) >> (a d) to give physical justification to the simplified approximation of the Dirchlet boundary conditions at the edges of the grid, Vbc = (in reality V as the distance from the centre of the capacitor, r ) Potential and field configurations were determined by solving Laplace s equation via relaxation as mentioned in and however due to its superior computational performance the Gauss-Seidel iteration was designated as primary method of solution Electric field vectors E = V can be approximated at each grid point in terms of their x and y components via discrete differentiation () using methods of finite differences analogous to those X = % X = % V (V) 7 7 V (V) X = % 7 7 V (V) 7 7 V (V) 7 7 7 V (V) 7 7 7 7 X = % X = % V (V) 7 X = % V (V) 7 X=% X = % 7 V (V) X=% X = % V (V) 7 7 V (V) 7 Figure Converged solutions for a system with initial potential approximations of V and boundary conditions of V for both Jacobi (left) and Gauss-Seidel (right) iterative methods with X = {,,,, }% discussed in, and justified by the relatively small grid spacings x and y Vi+,j Vi,j Vi,j Vi+,j Exij = lim x x x () Vi,j+ Vi,j Vi,j Vi,j+ Eyij = lim y y y Although lacking multi-dimensional sophistication, it is clear the electric field configuration resembles that of reality It is expected that as a : d increases the field configuration should approach 7
Exercise : Partial Differential Equations Log (Time(ms)) - Jacobi Gauss-Seidel - -8-6 - - 6 8 Log (X) Figure Logarithmic evaluation of computational time as a function of the convergence criterion, X for both Jacobi (red) and Gauss-Seidel (blue) iterative methods Iterations 8 7 6 Jacobi Gauss-Seidel 6 7 8 9 Grid Density (m - ) Figure Number of iterations as a function of the grid density with linear fit for both Jacobi (red) and Gauss-Seidel (blue) iterative methods Computational Time (ms) Jacobi Gauss-Seidel 6 7 8 9 Grid Density (m - ) Figure Computational time as a function of the grid density with quadratic fit for both Jacobi (red) and Gauss-Seidel (blue) iterative methods V (V) - - 7 V (V) - - 7 a : d = 7 a : d = 7 Figure Electric potential, V as a function of grid position for capacitor dimension ratios; a: d = {, } the infinite plane solution between parallel plates and zero elsewhere (6) This is first demonstrated in Figure via an increasingly constant rate of change of potential between the plates at larger a:d and supported by the increasing uniformity of the respective vector field configuration of Figure 6 Electric field lines are expected to resemble the perpendicular bisectors of equipotentials, this relation is illustrated via the sample of isocontours and corresponding vector plots in Figures & 6 respectively, further supporting the validity of the solutions lim E a:d { V/d between plates otherwise - - - - The deviation from the theoretical infinite plane solution, E = V/d was investigated as a function of the capacitor dimensional ratio a : d in terms of a percentage difference, E/E as shown in Figure 7 NB E represents the difference between the mean electric field magnitude (between parallel plates) and the respective infinite plane value (7) E = E N (6) N E ij (7) The origin of deviation can be explained by a fringing field effect around the periphery (between the sides of the capacitor) The degree of fringing becomes increasingly significant as the distance between the electrodes is no longer negligible relative to the lateral dimensions of the capacitor, resulting in an increased effective capacitance Fringing fields are always present as long as the system is finite and should be accounted for quantitatively when modelling the electrostatic forces via Maxwell s equations The percentage difference between computational and infinite plane solution shown in Figure 7 drops off as (a : d) (see Table for detailed fit analysis) with a deviation of only 6% achievable at a relatively small dimensional ratio of a : d = The asymptotic appearance of Figure 7 suggests an accurate relation over this small range, however extrapolation reveals that the infinite plane solution is reached prematurely (ie at a : d < ) ij
J F Ider Chitham a : d = 9 8 7 6 6 7 8 9 8 6 8 6 E Magnitude (Vm - ) E / E (%) 6 8 a : d 9 8 7 6 a : d = 6 7 8 9 Figure 6 Electric vector field, E as a function of grid position for capacitor dimension ratios; a: d = {, } as indicated via a small but negative asymptotic intercept, C = ( 68 ± )% Combining this feature with the small reduced χ of implies an overestimated error in the variance, suggesting a more precise fit is only attainable if a larger dataset is compiled with evaluation over a greater range of dimensional ratios Despite the quantity and crudeness of approximations the combination of Figures -7 provide good confirmation of a strong resemblance between expectations and computational solutions Heat Diffusion A m iron rod initially at room temperature is thrust into a C furnace The time evolution of the thermal distribution as a function of position along the rod, T (x, t) must be determined given that the rod can be approximated as one dimensional and heat losses along the length of the poker are assumed to be negligible The diffusion of heat is best described by the heat equation (8) as it models how the temperature distribution evolves with time as heat spreads through space The thermal diffusivity, α characterises the rod s ability to conduct thermal energy relative to storing it and is deduced via its relationship with thermal conductivity, specific heat and mass density, α = κ/cρ Two physical situations were investigated comparatively; (i) There is no heat loss from the far end of the poker (ii) The far end of the rod is immersed in a block of ice ( C) 6 E Magnitude (Vm - ) Figure 7 Percentage difference, E/E between computational and infite plane solutions of mean electric field magnitude (between parrallel plates) as a function of the capacitor dimensional ratio, a : d of the form A (a : d) B + C (red) α T (x, t) = T (x, t) t The heat equation can be solved in a similar way to Poission s equation and minor modifications to the one dimensional equivalent of the finite difference relation () yield a stable implicit relation (9) which can rearranged and manipulated to solve for T (x, t) T i T i t = α [ T x i T i + T i+ ] (9) conveniently reduces to the matrix equation () with γ = α t/ x This was solved via Lower-Upper triangular decomposition by implementing appropriate GNU library functions + γ γ γ + γ γ γ + γ γ γ + γ T i T i T i+ = T i T i T i+ () The time taken for the system to tend toward steady state thermal conduction was the subject of preliminary investigation This describes the time taken for thermal convergence, at which a constant temperature gradient is achieved as the temperature at every discrete point along the rod remains constant, while varying linearly in space along the original direction of heat transfer [] These times were found to be O s and O s for situations (i) and (ii) respectively as shown in Figure 8 The order of magnitude discrepancy can be accounted for by the presence of the ice reducing the mean thermal energy within the rod allowing quicker convergence Despite the similarities at early times, the steady state distribution for (i) is a horizontal line at T (x) = C and a diagonal line of the form T (x) = ( x + ) C for (ii) as the final element is always fixed by the temperature of the ice Alteration of the source code allowed time to be varied incrementally with the approximate steady state times determined from Figure 8 set as maximal values This created near continuous, three dimensional thermal distributions, T (x, t) as shown in Figures 9 & (8) (9)
Exercise : Partial Differential Equations Table Summary of graphical fit analysis Figure Fit Form A B C Reduced χ (Jacobi) Bρ n + C - 6877 ± 8667 6 ± 9668 (Gauss-Seidel) Bρ n + C - ± 98 77 ± 89 6 (Jacobi) Aρ n + C 69 ± - 687 ± 6 7 (Gauss-Seidel) Aρ n + C 7 ± 96-7 ± 77 777 7 A (a/d) B + C 6 ± 9 666 ± 88 68 ± 8 777 T(x,t) ( C) 8 8 6 t = s t = s t = s t = s t = s 6 8 6 t = s t = s t = s t = s t = s Figure 8 Preliminary temperature distribution as a function of position along the rod, T (x, t) at a variety of elapsed times for each physical situation; no heat loss from the far end of the poker (above) and the far end of the poker is immersed in a block of ice at C (below) 7 T(x,t) ( C) 7 8 6 Figure 9 Temperature distribution T (x, t) for each physical situation; no heat loss from the far end of the poker (above) and the far end of the poker is immersed in a block of ice at C (below) This paper has been typeset from a TEX/ L A TEX file prepared by the author ACKNOWLEDGEMENTS I thank my collaborators for assistance and C Lucas for guidance throughout the duration of the course This work made extensive use of GNU s GSL library REFERENCES () Trefethen, LN, Bau III, D, Numerical Linear Algebra, Society for Industrial and Applied Mathematics, 997, 8, () Press, WH, et al, Numerical Recipes in C (The Art of Scientific Computing), rd edn Cambridge Univ Press, Cambridge, 7 ()Blundell, S, Blundell, K, Concepts In Thermal Physics, nd edn Oxford Univ Press, Oxford 6
6 J F Ider Chitham T(x,t) 8 6 8 6 7 T(x,t) 8 6 8 6 7 Figure Three dimensional temperature distribution T (x, t) for each physical situation; no heat loss from the far end of the poker (above) and the far end of the poker is immersed in a block of ice at C (below)