<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">IJMNTA</journal-id><journal-title-group><journal-title>International Journal of Modern Nonlinear Theory and Application</journal-title></journal-title-group><issn pub-type="epub">2167-9479</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/ijmnta.2016.51006</article-id><article-id pub-id-type="publisher-id">IJMNTA-64273</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Engineering</subject><subject> Physics&amp;Mathematics</subject></subj-group></article-categories><title-group><article-title>
 
 
  A Comparative Study of Two Spatial Discretization Schemes for Advection Equation
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>uda</surname><given-names>O. Bakodah</given-names></name><xref ref-type="aff" rid="aff1"><sub>1</sub></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib></contrib-group><aff id="aff1"><label>1</label><addr-line>Department of Mathematics, Faculty of Science, Al Faisaliah Campus, King Abdulaziz University, Jeddah, Saudi Arabia</addr-line></aff><author-notes><corresp id="cor1">* E-mail:<email>h.o.bakodah@gmail.com</email></corresp></author-notes><pub-date pub-type="epub"><day>02</day><month>03</month><year>2016</year></pub-date><volume>05</volume><issue>01</issue><fpage>59</fpage><lpage>66</lpage><history><date date-type="received"><day>29</day>	<month>December</month>	<year>2015</year></date><date date-type="rev-recd"><day>accepted</day>	<month>5</month>	<year>March</year>	</date><date date-type="accepted"><day>8</day>	<month>March</month>	<year>2016</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  In this paper, we describe a comparison of two spatial discretization schemes for the advection equation, namely the first finite difference method and the method of lines. The stability of the methods has been studied by Von Neumann method and with the matrix analysis. The methods are applied to a number of test problems to compare the accuracy and computational efficiency. We show that both discretization techniques approximate correctly solution of advection equation and compare their accuracy and performance.
 
</p></abstract><kwd-group><kwd>Advection Equation</kwd><kwd> Finite Difference Method</kwd><kwd> The Method of Lines</kwd><kwd> Von Neumann Method</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>A currently active area of research is the numerical solution of nonlinear partial differential equations and nonlinear integral equations [<xref ref-type="bibr" rid="scirp.64273-ref1">1</xref>] -[<xref ref-type="bibr" rid="scirp.64273-ref7">7</xref>] . An advection equation is fairly in shape but it is one of the most difficult equations to approximate numerically.</p><p>The nonlinear advection equation arises in various branches of physics, engineering and applied sciences. The importance of obtaining the exact or approximate solution of this equation is still a significant problem that needs new methods to discover exact or approximate solution.</p><p>The linear advection equation is simple in form and yet it is one of the most difficult equations to solve accurately by numerical means [<xref ref-type="bibr" rid="scirp.64273-ref8">8</xref>] . This equation is challenging to solve as it causes some discontinuities with neither dispersion nor dissipation. However, all efforts to use a fixed number of space intervals will result in both dispersion and spurious oscillation. The use of traditional symmetric techniques is possible only if the terms of arbitrary second order artificial viscosity or damping are introduced to the equation. Directional (or upwind) methods have shown to be efficient for the purpose of finite difference analyses as it clears the oscillation problem, yet they will not remove it completely. The linear advection equation does provide a good case for testing methods to be used on systems of hyperbolic equations. Many schemes have been tested on it, generally by using propagating step, sine, Gaussian or triangular waveform [<xref ref-type="bibr" rid="scirp.64273-ref9">9</xref>] . These techniques were used to provide a rational for choosing a spatial scheme for first-order hyperbolic equations. The optimal choice is not invariant, but depends on the application.</p><p>In this paper, the advection equation is solved by finite difference method [<xref ref-type="bibr" rid="scirp.64273-ref10">10</xref>] [<xref ref-type="bibr" rid="scirp.64273-ref11">11</xref>] and the stability conditions for the scheme are also discussed. Numerical finite difference scheme is developed for obtaining approximate solution to an advection equation using the 3-point formula introduced in [<xref ref-type="bibr" rid="scirp.64273-ref12">12</xref>] . The same problem is considered using modified method of lines [<xref ref-type="bibr" rid="scirp.64273-ref13">13</xref>] -[<xref ref-type="bibr" rid="scirp.64273-ref15">15</xref>] , with a new three-point difference [<xref ref-type="bibr" rid="scirp.64273-ref12">12</xref>] . Using this new difference leads to stable schemes for the two methods. Numerical results are shown and compared with analytical solutions.</p></sec><sec id="s2"><title>2. Finite Difference Method with a Good Spatial Discretization</title><p>Let us consider the equation</p><disp-formula id="scirp.64273-formula707"><label>(1)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x6.png"  xlink:type="simple"/></disp-formula><p>and v is a nonzero constant velocity, where <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x7.png" xlink:type="simple"/></inline-formula> with the initial condition <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x8.png" xlink:type="simple"/></inline-formula> The finite difference method begins with discretization the space variable x and the time variable t as follows</p><p><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x9.png" xlink:type="simple"/></inline-formula>; and<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x10.png" xlink:type="simple"/></inline-formula>.</p><p>The using of some of the finite difference schemes on advection equations can cause unstable solutions. To add stability, upstream (backward or forward) could be used for spatial discretization for the first-order differences. However, for a given spatial accuracy, these differences need to use extra grid points than centered difference. An artificial dissipation (or viscosity) term is normally introduced to a central differencing scheme for stability reasons but it is not easy to determine the magnitude of this term required for the stability and effect of this term on the solutions.</p><p>The aim of new method is to develop a good formula with high accuracy for the numerical solution of the advection equation using the spatial discretization presented by Sharaf and Bakodah, [<xref ref-type="bibr" rid="scirp.64273-ref12">12</xref>] , using 3-points formula, thus the approximate form of the first derivative is</p><disp-formula id="scirp.64273-formula708"><label>(2)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x11.png"  xlink:type="simple"/></disp-formula><p>Adopting a forward temporal difference scheme, this yields</p><disp-formula id="scirp.64273-formula709"><label>(3)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x12.png"  xlink:type="simple"/></disp-formula><p>There are two standard methods of the finite-difference equation. In the first method, a finite Fourier series is used. In the other method, the equation is expressed in matrix form, and the eigenvalues of the associated matrix are examined. In order to investigate the stability of this scheme by the first method (Von Neumann stability analysis), it is considered</p><disp-formula id="scirp.64273-formula710"><label>(4)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x13.png"  xlink:type="simple"/></disp-formula><p>Replacing <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x14.png" xlink:type="simple"/></inline-formula> in relation (2) from (3), it is obtained:</p><disp-formula id="scirp.64273-formula711"><label>(5)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x15.png"  xlink:type="simple"/></disp-formula><p>where</p><disp-formula id="scirp.64273-formula712"><label>(6)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x16.png"  xlink:type="simple"/></disp-formula><p>The stability condition <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x17.png" xlink:type="simple"/></inline-formula> is fulfilled for all k as long as,</p><disp-formula id="scirp.64273-formula713"><label>(7)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x18.png"  xlink:type="simple"/></disp-formula><disp-formula id="scirp.64273-formula714"><label>(8)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x19.png"  xlink:type="simple"/></disp-formula><p>That is, the method (2) is stable.</p></sec><sec id="s3"><title>3. Modified of the Method of Lines</title><p>In the Numerical Method of Lines (NMOL), the partial differential equation (PDE), to be solved, is transformed into a system of ordinary differential equations (ODEs) by discretizing all the independent variables but one [<xref ref-type="bibr" rid="scirp.64273-ref16">16</xref>] . The advection equation, depending on time t and one spatial variable x, either t or x can be discretized, and the integration will be carried out along the remaining undiscretized independent variable.</p><p>The technique consists of converting the PDE into ODEs either by finite difference spline or by weighted-res- idual technique, then integrating the resulting ODEs [<xref ref-type="bibr" rid="scirp.64273-ref17">17</xref>] . Finite differencing in the spatial variable led to a set of timedependent ODEs. The advantage of using (NMOL) is that sophisticated software packages exist for the numerical solution of ordinary differential equations. These software packages contain iterative methods for handling non-linearities and feature automatic step-size adjustment and integration order selection to maintain a specified error and to solve the problem with near optimal efficiency. Several recently software packages for automated method of lines solution of arbitrarily defined PDEs have been very successful, particularly for parabolic and elliptic PDE systems.</p><p>Such facilities can be improved for hyperbolic equations by incorporating an upwind weighted residual technique. This technique is similar and superior to the use of an artificial viscosity term, and it could be implement easily in any software package. Previous considerations of the (NMOL) to solve PDEs have been geared to parabolic equation and generally used centered, second-order differences. Using these differences on hyperbolic equations can lead to unstable solution. To add stability, upstream (backward or forward) first-order differences could be used for the spatial discretization. But these differences require the use of more grid points than central differences for a given spatial accord. An artificial dissipation (or viscosity) term is often added to a central differencing scheme to add stability but it is difficult to determine the magnitude of this term required for the stability and the effect of this term on the solutions. Other stabilizing techniques that have been employed in the explicit finite difference procedures are generally not applicable to the method of lines approach because they involve manipulation of terms in both the time and space discretization.</p><p>In this paper, a modified method of lines using a new three-point difference [<xref ref-type="bibr" rid="scirp.64273-ref12">12</xref>] is used. The use of this new differences leads to stable schemes with good accuracy. In order to apply the method of lines to the advection equation (1), the spatial derivative must be approximated. An equally spaced mesh <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x20.png" xlink:type="simple"/></inline-formula> is used. As in the Ref. [<xref ref-type="bibr" rid="scirp.64273-ref12">12</xref>] a new difference scheme can be used in the calculation of <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x20.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x21.png" xlink:type="simple"/></inline-formula></p><disp-formula id="scirp.64273-formula715"><label>(9)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x22.png"  xlink:type="simple"/></disp-formula><p>It leads to stable schemes with good accuracy. In this section the second method shall be used. The analysis of eigenvalues of the system gives the necessary conditions for the stability of discretization of the problem [<xref ref-type="bibr" rid="scirp.64273-ref18">18</xref>] . The stability corresponds to real and negative values.</p><p>By considering equation (1) with the centered difference scheme of order two, then we get</p><disp-formula id="scirp.64273-formula716"><label>(10)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x23.png"  xlink:type="simple"/></disp-formula><p>where <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x24.png" xlink:type="simple"/></inline-formula> is</p><disp-formula id="scirp.64273-formula717"><label>(11)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x25.png"  xlink:type="simple"/></disp-formula><p>and<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x26.png" xlink:type="simple"/></inline-formula>.</p><p>Mathematically the difference scheme is stable if there exists a real positive eigenvalues. However, where <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x27.png" xlink:type="simple"/></inline-formula> is a tri-diagonal matrix, the corresponding eigenvalue <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x27.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x28.png" xlink:type="simple"/></inline-formula> of A can be calculated from the relation.</p><disp-formula id="scirp.64273-formula718"><label>(12)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x29.png"  xlink:type="simple"/></disp-formula><p>where<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x30.png" xlink:type="simple"/></inline-formula>. Thus</p><disp-formula id="scirp.64273-formula719"><label>(13)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x31.png"  xlink:type="simple"/></disp-formula><p>which are pure imaginary values.</p><p>So, we consider the non-centered formula approximation</p><disp-formula id="scirp.64273-formula720"><label>(14)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x32.png"  xlink:type="simple"/></disp-formula><p>with the matrix formula <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x33.png" xlink:type="simple"/></inline-formula> where</p><disp-formula id="scirp.64273-formula721"><label>(15)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x34.png"  xlink:type="simple"/></disp-formula><p>Thus the eigenvalues are given by</p><disp-formula id="scirp.64273-formula722"><label>(16)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x35.png"  xlink:type="simple"/></disp-formula><p>These values are real and negative, so the difference scheme is stable.</p></sec><sec id="s4"><title>4. Numerical Examples</title><sec id="s4_1"><title>4.1. Example 1</title><p>We apply the Finite Difference Method with a good spatial discretization to solve linear advection equation to demonstrate the validity of this method.</p><p>Consider the equation</p><disp-formula id="scirp.64273-formula723"><label>(17)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/6-2340211x36.png"  xlink:type="simple"/></disp-formula><p>with the conditions</p><disp-formula id="scirp.64273-formula724"><graphic  xlink:href="http://html.scirp.org/file/6-2340211x37.png"  xlink:type="simple"/></disp-formula><p>With the analytic solution</p><disp-formula id="scirp.64273-formula725"><graphic  xlink:href="http://html.scirp.org/file/6-2340211x38.png"  xlink:type="simple"/></disp-formula><p>Using equation (3) we find</p><disp-formula id="scirp.64273-formula726"><graphic  xlink:href="http://html.scirp.org/file/6-2340211x39.png"  xlink:type="simple"/></disp-formula><p>let</p><disp-formula id="scirp.64273-formula727"><graphic  xlink:href="http://html.scirp.org/file/6-2340211x40.png"  xlink:type="simple"/></disp-formula><p><xref ref-type="table" rid="table1">Table 1</xref> shows the absolute error <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x41.png" xlink:type="simple"/></inline-formula> for the finite difference method in different value of time.</p></sec><sec id="s4_2"><title>4.2. Example 2</title><p>We apply the Modified of the Method of lines to solve linear advection equation to demonstrate the validity of this method.</p><p>Consider the following advection equation</p><disp-formula id="scirp.64273-formula728"><graphic  xlink:href="http://html.scirp.org/file/6-2340211x42.png"  xlink:type="simple"/></disp-formula><p>with the conditions</p><table-wrap id="table1" ><label><xref ref-type="table" rid="table1">Table 1</xref></label><caption><title> Absolute errors of the finite difference method, where<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x43.png" xlink:type="simple"/></inline-formula></title></caption><table><tbody><thead><tr><th align="center" valign="middle"  colspan="5"  ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x44.png" xlink:type="simple"/></inline-formula></th><th align="center" valign="middle"  rowspan="2"  >t i</th></tr></thead><tr><td align="center" valign="middle" >0.05</td><td align="center" valign="middle" >0.04</td><td align="center" valign="middle" >0.03</td><td align="center" valign="middle" >0.02</td><td align="center" valign="middle" >0.01</td></tr><tr><td align="center" valign="middle" >0.000811146</td><td align="center" valign="middle" >0.00051992</td><td align="center" valign="middle" >0.000277333</td><td align="center" valign="middle" >0.000098253</td><td align="center" valign="middle" >4.675 &#215; 10<sup>−7 </sup></td><td align="center" valign="middle" >10</td></tr><tr><td align="center" valign="middle" >0.00357781</td><td align="center" valign="middle" >0.00221805</td><td align="center" valign="middle" >0.00114473</td><td align="center" valign="middle" >0.00039252</td><td align="center" valign="middle" >1.93417 &#215; 10<sup>−6 </sup></td><td align="center" valign="middle" >20</td></tr><tr><td align="center" valign="middle" >0.00831948</td><td align="center" valign="middle" >0.00510019</td><td align="center" valign="middle" >0.00260313</td><td align="center" valign="middle" >0.000882787</td><td align="center" valign="middle" >4.40083 &#215; 10<sup>−6 </sup></td><td align="center" valign="middle" >30</td></tr><tr><td align="center" valign="middle" >0.0150361</td><td align="center" valign="middle" >0.00916632</td><td align="center" valign="middle" >0.00465253</td><td align="center" valign="middle" >0.00156905</td><td align="center" valign="middle" >7.8675 &#215; 10<sup>−6 </sup></td><td align="center" valign="middle" >40</td></tr><tr><td align="center" valign="middle" >0.0237278</td><td align="center" valign="middle" >0.0144165</td><td align="center" valign="middle" >0.00729293</td><td align="center" valign="middle" >0.00245132</td><td align="center" valign="middle" >0.0000123342</td><td align="center" valign="middle" >50</td></tr><tr><td align="center" valign="middle" >0.0343945</td><td align="center" valign="middle" >0.0208506</td><td align="center" valign="middle" >0.0105243</td><td align="center" valign="middle" >0.00352959</td><td align="center" valign="middle" >0.0000178008</td><td align="center" valign="middle" >60</td></tr><tr><td align="center" valign="middle" >0.0470361</td><td align="center" valign="middle" >0.0284687</td><td align="center" valign="middle" >0.0143467</td><td align="center" valign="middle" >0.00480385</td><td align="center" valign="middle" >0.0000242675</td><td align="center" valign="middle" >70</td></tr><tr><td align="center" valign="middle" >0.0616528</td><td align="center" valign="middle" >0.0372709</td><td align="center" valign="middle" >0.0187601</td><td align="center" valign="middle" >0.00627412</td><td align="center" valign="middle" >0.0000317342</td><td align="center" valign="middle" >80</td></tr><tr><td align="center" valign="middle" >0.0782445</td><td align="center" valign="middle" >0.047257</td><td align="center" valign="middle" >0.0237645</td><td align="center" valign="middle" >0.00794039</td><td align="center" valign="middle" >0.0000402008</td><td align="center" valign="middle" >90</td></tr><tr><td align="center" valign="middle" >0.0968111</td><td align="center" valign="middle" >0.0584271</td><td align="center" valign="middle" >0.0293599</td><td align="center" valign="middle" >0.00980265</td><td align="center" valign="middle" >0.0000496675</td><td align="center" valign="middle" >100</td></tr></tbody></table></table-wrap><disp-formula id="scirp.64273-formula729"><graphic  xlink:href="http://html.scirp.org/file/6-2340211x45.png"  xlink:type="simple"/></disp-formula><p>and the analytic solution</p><disp-formula id="scirp.64273-formula730"><graphic  xlink:href="http://html.scirp.org/file/6-2340211x46.png"  xlink:type="simple"/></disp-formula><p>Substituting in equation (9) we find</p><disp-formula id="scirp.64273-formula731"><graphic  xlink:href="http://html.scirp.org/file/6-2340211x47.png"  xlink:type="simple"/></disp-formula><p>and the condition are</p><disp-formula id="scirp.64273-formula732"><graphic  xlink:href="http://html.scirp.org/file/6-2340211x48.png"  xlink:type="simple"/></disp-formula><p>Hence, we can write</p><disp-formula id="scirp.64273-formula733"><graphic  xlink:href="http://html.scirp.org/file/6-2340211x49.png"  xlink:type="simple"/></disp-formula><p>So, to confirm the accuracy and efficiency of the method, the absolute error <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x50.png" xlink:type="simple"/></inline-formula> are used (<xref ref-type="table" rid="table2">Table 2</xref>).</p></sec><sec id="s4_3"><title>4.3. Example 3</title><p>Consider the equation</p><disp-formula id="scirp.64273-formula734"><graphic  xlink:href="http://html.scirp.org/file/6-2340211x51.png"  xlink:type="simple"/></disp-formula><p>and</p><disp-formula id="scirp.64273-formula735"><graphic  xlink:href="http://html.scirp.org/file/6-2340211x52.png"  xlink:type="simple"/></disp-formula><p>with the analytic solution</p><table-wrap id="table2" ><label><xref ref-type="table" rid="table2">Table 2</xref></label><caption><title> Absolute errors of the modified of the method of lines where<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x53.png" xlink:type="simple"/></inline-formula></title></caption><table><tbody><thead><tr><th align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x54.png" xlink:type="simple"/></inline-formula></th><th align="center" valign="middle" >t</th></tr></thead><tr><td align="center" valign="middle" >0.00101545</td><td align="center" valign="middle" >0.01</td></tr><tr><td align="center" valign="middle" >0.00233093</td><td align="center" valign="middle" >0.02</td></tr><tr><td align="center" valign="middle" >0.00397634</td><td align="center" valign="middle" >0.03</td></tr><tr><td align="center" valign="middle" >0.00598185</td><td align="center" valign="middle" >0.04</td></tr><tr><td align="center" valign="middle" >0.00837779</td><td align="center" valign="middle" >0.05</td></tr><tr><td align="center" valign="middle" >0.01119470</td><td align="center" valign="middle" >0.06</td></tr><tr><td align="center" valign="middle" >0.01446333</td><td align="center" valign="middle" >0.07</td></tr><tr><td align="center" valign="middle" >0.01821444</td><td align="center" valign="middle" >0.08</td></tr><tr><td align="center" valign="middle" >0.02247890</td><td align="center" valign="middle" >0.09</td></tr><tr><td align="center" valign="middle" >0.02728780</td><td align="center" valign="middle" >0.10</td></tr></tbody></table></table-wrap><disp-formula id="scirp.64273-formula736"><graphic  xlink:href="http://html.scirp.org/file/6-2340211x55.png"  xlink:type="simple"/></disp-formula><p>In this example we apply the Modified of the Method of lines and the finite difference method to solve linear advection equation to demonstrate the validity of them and compare between them.</p><p><xref ref-type="table" rid="table3">Table 3</xref> shows the absolute error <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x56.png" xlink:type="simple"/></inline-formula> for the finite difference method equation (2), and the method of lines.</p></sec><sec id="s4_4"><title>4.4. Example 4</title><p>Consider the advection equation</p><disp-formula id="scirp.64273-formula737"><graphic  xlink:href="http://html.scirp.org/file/6-2340211x57.png"  xlink:type="simple"/></disp-formula><p>with the condition</p><disp-formula id="scirp.64273-formula738"><graphic  xlink:href="http://html.scirp.org/file/6-2340211x58.png"  xlink:type="simple"/></disp-formula><p>and the exact solution</p><disp-formula id="scirp.64273-formula739"><graphic  xlink:href="http://html.scirp.org/file/6-2340211x59.png"  xlink:type="simple"/></disp-formula><p>This problem is solved for<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x60.png" xlink:type="simple"/></inline-formula>, with<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x60.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x61.png" xlink:type="simple"/></inline-formula>.</p><p><xref ref-type="table" rid="table4">Table 4</xref> shows the absolute error <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x62.png" xlink:type="simple"/></inline-formula></p><table-wrap id="table3" ><label><xref ref-type="table" rid="table3">Table 3</xref></label><caption><title> Comparison of the absolute error between finite difference method and the method of lines, for example 1 with<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x63.png" xlink:type="simple"/></inline-formula></title></caption><table><tbody><thead><tr><th align="center" valign="middle" >The method of lines</th><th align="center" valign="middle" >Finite difference method</th><th align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x64.png" xlink:type="simple"/></inline-formula></th></tr></thead><tr><td align="center" valign="middle" >0.0003747</td><td align="center" valign="middle" >0.02067970</td><td align="center" valign="middle" >0.1</td></tr><tr><td align="center" valign="middle" >0.0016946</td><td align="center" valign="middle" >0.01054830</td><td align="center" valign="middle" >0.2</td></tr><tr><td align="center" valign="middle" >0.00400098</td><td align="center" valign="middle" >0.00921847</td><td align="center" valign="middle" >0.3</td></tr><tr><td align="center" valign="middle" >0.00709063</td><td align="center" valign="middle" >0.00851550</td><td align="center" valign="middle" >0.4</td></tr><tr><td align="center" valign="middle" >0.0106622</td><td align="center" valign="middle" >0.00790683</td><td align="center" valign="middle" >0.5</td></tr><tr><td align="center" valign="middle" >0.0144267</td><td align="center" valign="middle" >0.00863854</td><td align="center" valign="middle" >0.6</td></tr><tr><td align="center" valign="middle" >0.0181591</td><td align="center" valign="middle" >0.00712179</td><td align="center" valign="middle" >0.7</td></tr><tr><td align="center" valign="middle" >0.0217072</td><td align="center" valign="middle" >0.06114460</td><td align="center" valign="middle" >0.8</td></tr><tr><td align="center" valign="middle" >0.0249812</td><td align="center" valign="middle" >0.07981530</td><td align="center" valign="middle" >0.9</td></tr><tr><td align="center" valign="middle" >0.0279372</td><td align="center" valign="middle" >0.11121000</td><td align="center" valign="middle" >1.1</td></tr></tbody></table></table-wrap><table-wrap id="table4" ><label><xref ref-type="table" rid="table4">Table 4</xref></label><caption><title> Comparison of the absolute error between finite difference method and the method of lines, for example 2 with<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x65.png" xlink:type="simple"/></inline-formula></title></caption><table><tbody><thead><tr><th align="center" valign="middle" >The method of lines</th><th align="center" valign="middle" >Finite difference method</th><th align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x66.png" xlink:type="simple"/></inline-formula></th></tr></thead><tr><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x67.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" >0.00196377</td><td align="center" valign="middle" >0.1</td></tr><tr><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x68.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" >0.00392755</td><td align="center" valign="middle" >0.2</td></tr><tr><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x69.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" >0.00589132</td><td align="center" valign="middle" >0.3</td></tr><tr><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x70.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" >0.00785510</td><td align="center" valign="middle" >0.4</td></tr><tr><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x71.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" >0.00981887</td><td align="center" valign="middle" >0.5</td></tr><tr><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x72.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" >0.01283950</td><td align="center" valign="middle" >0.6</td></tr><tr><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x73.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" >0.00119615</td><td align="center" valign="middle" >0.7</td></tr><tr><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x74.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" >0.08608410</td><td align="center" valign="middle" >0.8</td></tr><tr><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x75.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" >0.09607220</td><td align="center" valign="middle" >0.9</td></tr><tr><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/6-2340211x76.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" >0.12879500</td><td align="center" valign="middle" >1.0</td></tr></tbody></table></table-wrap></sec></sec><sec id="s5"><title>5. Conclusions</title><p>From the studied test examples, it has been found that, the modified method of lines gives better results than the finite difference method. Although the modified method of lines is used to approximate the first order hyperbolic differential equation. Thus equations are one of the most difficult classes of PDEs to integrate numerically. To overcome this, a modified MOL scheme is suggested. The results are in good agreement with the exact solution as shown in <xref ref-type="table" rid="table1">Table 1</xref>, <xref ref-type="table" rid="table2">Table 2</xref>. The presented method is attractive for hyperbolic, parabolic and elliptic equations.</p><p>The methods introduced in this paper for solving the linear and nonlinear advection equation are based on finite difference method. The best choice of the numerical method for a given problem depends on the stability condition.</p></sec><sec id="s6"><title>Cite this paper</title><p>Huda O.Bakodah, (2016) A Comparative Study of Two Spatial Discretization Schemes for Advection Equation. International Journal of Modern Nonlinear Theory and Application,05,59-66. doi: 10.4236/ijmnta.2016.51006</p></sec></body><back><ref-list><title>References</title><ref id="scirp.64273-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">Biazar, J., Ghazvini, H. and Eslami, M. (2009) He’s Homotopy Perturbation Method for Systems of Integro-Differential Equations. Chaos, Solitons &amp; Fractals, 39, 1253-1258. http://dx.doi.org/10.1016/j.chaos.2007.06.001</mixed-citation></ref><ref id="scirp.64273-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">Biazar, J. and Eslami, M. (2011) Modified HPM for Solving Systems of Volterra Integral Equations of the Second Kind. Journal of King Saud University—Science, 23, 35-39. http://dx.doi.org/10.1016/j.jksus.2010.06.004</mixed-citation></ref><ref id="scirp.64273-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">Biazar, J., Eslami, M. and Islam, M.R. (2012) Differential Transform Method for Special Systems of Integral Equations. Journal of King Saud University—Science, 24, 211-214. http://dx.doi.org/10.1016/j.jksus.2010.08.015</mixed-citation></ref><ref id="scirp.64273-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">Eslami, M. (2014) New Homotopy Perturbation Method for a Special Kind of Volterra Integral Equations in Two-Dimensional Space. Computational Mathematics and Modeling, 25, 135-148. http://dx.doi.org/10.1007/s10598-013-9214-x</mixed-citation></ref><ref id="scirp.64273-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">Biazar, J. and Eslami, M. (2011) A New Homotopy Perturbation Method for Solving Systems of Partial Differential Equations. Computers &amp; Mathematics with Applications, 62, 225-234. http://dx.doi.org/10.1016/j.camwa.2011.04.070</mixed-citation></ref><ref id="scirp.64273-ref6"><label>6</label><mixed-citation publication-type="other" xlink:type="simple">Biazar, J., Eslami, M. and Aminikhah, H. (2009) Application of Homotopy Perturbation Method for Systems of Volterra Integral Equations of the First Kind. Chaos, Solitons &amp; Fractals, 42, 3020-3026. http://dx.doi.org/10.1016/j.chaos.2009.04.016</mixed-citation></ref><ref id="scirp.64273-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">Biazar, J. and Eslami, M. (2012) A New Method for Solving the Hyperbolic Telegraph Equation. Computational Mathematics and Modeling, 23, 519-527. http://dx.doi.org/10.1007/s10598-012-9153-y</mixed-citation></ref><ref id="scirp.64273-ref8"><label>8</label><mixed-citation publication-type="other" xlink:type="simple">Wazwaz, A.M. (2009) Partial Differential Equations and Solitary Waves Theory. Higher Education Press, Beijing and Springer-Verlag, Berlin Heidelberg. http://dx.doi.org/10.1007/978-3-642-00251-9</mixed-citation></ref><ref id="scirp.64273-ref9"><label>9</label><mixed-citation publication-type="other" xlink:type="simple">George, K. and Twizell, E.H. (2006) Stable Second-Order Finite-Difference Methods for Linear Initial-Boundary-Value Problems. Applied Mathematics Letters, 19, 146-154. http://dx.doi.org/10.1016/j.aml.2005.04.003</mixed-citation></ref><ref id="scirp.64273-ref10"><label>10</label><mixed-citation publication-type="other" xlink:type="simple">Smith, G.D. (1985) Numerical Solution of Partial Differential Equations (Finite Difference Method). 3rd Edition, Oxford University Press, Oxford.</mixed-citation></ref><ref id="scirp.64273-ref11"><label>11</label><mixed-citation publication-type="other" xlink:type="simple">Al-Malki, N.A. and Bakodah, H.O. (2014) A Stable Difference Algorithm for the Solution of Advection Equation. Far East Journal of Applied Mathematics, 88, 139-149.</mixed-citation></ref><ref id="scirp.64273-ref12"><label>12</label><mixed-citation publication-type="other" xlink:type="simple">Sharaf, A.A. and Bakodah, H.O. (2005) A Good Spatial Discretization in the Method of Lines. Applied Mathematics and Computation, 171-172, 1253-1263. http://dx.doi.org/10.1016/j.amc.2005.01.144</mixed-citation></ref><ref id="scirp.64273-ref13"><label>13</label><mixed-citation publication-type="other" xlink:type="simple">Alabdali, F.M. and Bakodah, H.O. (2014) A New Modification of the Method of Lines for First Order Hyperbolic PDEs. Applied Mathematics, 5, 1457-1462. http://dx.doi.org/10.4236/am.2014.510138</mixed-citation></ref><ref id="scirp.64273-ref14"><label>14</label><mixed-citation publication-type="other" xlink:type="simple">Bakodah, H.O. and Banaja, M.A. (2013) The Method of Lines Solution of the Regularized Long-Wave Equation Using Runge-Kutta Time Discretization Method. Mathematical Problems in Engineering, 2013, Article ID: 804317.http://dx.doi.org/10.1155/2013/804317</mixed-citation></ref><ref id="scirp.64273-ref15"><label>15</label><mixed-citation publication-type="other" xlink:type="simple">Banaja, M.A. and Bakodah, H.O. (2015) Runge-Kutta Integration of the Equal Width Wave Equation Using the Method of Lines. Mathematical Problems in Engineering, 2015, Article ID: 274579. http://dx.doi.org/10.1155/2015/274579</mixed-citation></ref><ref id="scirp.64273-ref16"><label>16</label><mixed-citation publication-type="other" xlink:type="simple">Smith, G.D. (1985) Numerical Solution of Partial Differential Equations (Finite Difference Methods). 3rd Edition, Oxford University Press, Oxford.</mixed-citation></ref><ref id="scirp.64273-ref17"><label>17</label><mixed-citation publication-type="other" xlink:type="simple">Schiesser, W.E. (1978) The Numerical Method of Lines, Integration of Partial Differential Equation. 2nd Edition, Clarendon Presses, Oxford.</mixed-citation></ref><ref id="scirp.64273-ref18"><label>18</label><mixed-citation publication-type="other" xlink:type="simple">Carver, M.B. and Hinds, H.W. (1978) The Method of Lines and Advective Equation. Simulation, 31, 59-69.http://dx.doi.org/10.1177/003754977803100205</mixed-citation></ref></ref-list></back></article>