📄 16.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> body { font-family: Verdana, Arial, Helvetica, sans-serif;} a.at-term { font-style: italic; } </style> <title>Laplace's Equation in Two Dimensions</title> <meta name="Generator" content="ATutor"> <meta name="Keywords" content=""></head><body> <h3>Mathematical and Physical Significance</h3>
<p>One of the first partial differential equations (PDEs) encountered in most courses on differential equations or numerical methods is <em><a href="../glossary.html#Laplace%27s+equation" target="body" class="at-term">Laplace's equation</a></em> (also known as the <em><a href="../glossary.html#potential+equation" target="body" class="at-term">potential equation</a></em>) in two dimensions:<br>
<blockquote>
<code>c<sup>2</sup> ( ð<sup>2</sup>u/ðx<sup>2</sup> +
ð<sup>2</sup>u/ðy<sup>2</sup> ) = 0</code>
</blockquote>
<p>This equation is the governing equation for electrostatics, steady-state heat diffusion, and steady-state frictionless incompressible fluid flow. Adding terms to the left-hand side of this equation also results in other well known PDEs: </p>
<ul>
<li>Adding a function <var>f(x,y)</var> results in Poisson's equation.</li>
<li>Adding a first derivative in time <code>ðu/ðt</code> results in the diffusion equation.</li>
<li>Adding a second derivative in time
<code>ð<sup>2</sup>u/ðt<sup>2</sup></code> results in the wave equation.</li>
</ul>
<p>Thus, understanding how to solve Laplace's equations is a first step in solving a wide range of physical and mathematical problems. </p>
<p></p>
<h3>Finite Difference Numerical Methods</h3>
<p>(For the purposes of brevity, analytical solution methods for Laplace's equation are not discussed here; however, any number of books on differential equations discuss these methods. The authors recommend either <em>Elementary Differential Equations and Boundary Value Problems</em> by Boyce and DiPrima, or <em>Advanced Engineering Mathematics</em> by Kreyszig.)
</p>
<p>There are several ways to compute numerical solutions to PDEs, but the one that will be used in these interludes is a finite difference based approach. In finite difference approaches, the partial derivatives are replaced with differences between values taken at selected locations in the solution domain. These finite differences have a truncation error associated with them, the size of which depends on the spacing of the points and the order of accuracy used in the finite differences; by selecting a fine enough spacing of points, the truncation error can be neglected.
</p>
<p>For Laplace's equation, two second derivatives in space and one second derivative in time are approximated. For the purpose of simplicity, let us also assume that we are solving Laplace's equation on a mesh where points in the <code>x</code>-direction are spaced a constant distant <code>dx</code> apart, and points in the <code>y</code>-direction are spaced a constant distant <code>dy</code> apart. The derivatives can then be replaced with the following finite differences:
<blockquote>
<code>ð<sup>2</sup>u/ðx<sup>2</sup> =
( u<sub>i-1,j</sub> - 2u<sub>i,j</sub> + u<sub>i+1,j</sub> ) / dx<sup>2</sup> +
O(dx<sup>2</sup>)</code>
</blockquote>
<blockquote>
<code>ð<sup>2</sup>u/ðy<sup>2</sup> =
( u<sub>i,j-1</sub> - 2u<sub>i,j</sub> + u<sub>i,j+1</sub> ) / dy<sup>2</sup> +
O(dy<sup>2</sup>)</code>
</blockquote>
<p>Substituting these back into Laplace's equation and rearranging slightly: </p>
<blockquote>
<code>( u<sub>i-1,j</sub> - 2u<sub>i,j</sub> + u<sub>i+1,j</sub> ) /
dx<sup>2</sup> + ( u<sub>i,j-1</sub> - 2u<sub>i,j</sub> +
u<sub>i,j+1</sub> ) / dy<sup>2</sup> =
O(dx<sup>2</sup>,dy<sup>2</sup>)</code>
</blockquote>
<p>The term <code>O(dx<sup>2</sup>,dy<sup>2</sup>)</code> represents the truncation error resulting from the finite difference approximation. If we select <code>dx</code> and <code>dy</code> to be small enough, this term can be neglected entirely. If we further assume that <code>dx</code> and <code>dy</code> are equal, we can simplify to the following: </p>
<blockquote>
<code>u<sub>i,j</sub> = ( u<sub>i-1,j</sub> + u<sub>i+1,j</sub> +
u<sub>i,j-1</sub> + u<sub>i,j+1</sub> ) / 4</code>
</blockquote>
<p>However, solving this set of equations once will not give an accurate solution of Laplace's equation. Instead, an iterative method must be used where the above equations are solved repeatedly until the change from one iteration to the next is small enough to be neglected. The difference between one iteration and the
next can be expressed as: </p>
<blockquote>
<code>du<sup>n+1</sup><sub>i,j</sub> = ( u<sup>n</sup><sub>i-1,j</sub> +
u<sup>n</sup><sub>i+1,j</sub> + u<sup>n</sup><sub>i,j-1</sub> +
u<sup>n</sup><sub>i,j+1</sub> ) / 4 -
u<sup>n</sup><sub>i,j</sub></code>
</blockquote>
<blockquote>
<code>u<sup>n+1</sup><sub>i,j</sub> = u<sup>n</sup><sub>i,j</sub> +
du<sup>n+1</sup><sub>i,j</sub></code>
</blockquote>
<p>(Note that here the superscript <var>n</var> represents iteration number, <strong>not</strong> an exponent.) </p>
<p></p>
<h3>Boundary Conditions</h3>
<p>Let us consider solving Laplace's equation on a finite square plate of length <code>L</code> in the <code>x</code>- and <code>y</code>-directions, and that the number of points in the <code>x</code>- and <code>y</code>-directions are <code>imax</code> and <var>jmax</var>, respectively. To solve Laplace's equation, we may use the above equations to solve on the interior of the domain (<code>i = 2:(imax-1)</code>, <code>j = 2:(jmax-1)</code>); however, we must separately specify the behavior at the boundaries. There are two ways to handle this:
<ul>
<li><em><a href="../glossary.html#Dirichlet+problem" target="body" class="at-term">Dirichlet problem</a></em>: The solution on the boundary is of the form
<blockquote>
<code>
u(0,y) = f(y)<br>
u(L,y) = g(y)<br>
u(x,0) = h(x)<br>
u(x,L) = k(x)
</code>
</blockquote>
</li>
<li>
<em><a href="../glossary.html#Neumann+problem" target="body" class="at-term">Neumann problem</a></em>: The solution on the boundary is of the form
<blockquote>
<code>
ðu/ðy(0,y) = f(y)<br>
ðu/ðy(L,y) = g(y)<br>
ðu/ðx(x,0) = h(x)<br>
ðu/ðx(x,L) = k(x)
</code>
</blockquote>
</li>
</ul>
<p>These conditions can also be mixed, in that Dirichlet conditions can be enforced on some boundaries and Neumann conditions enforced on others. For the Laplace
solution described in this and following interludes, we will assume the following set of Dirichlet conditions: </p>
<blockquote>
<code>
u(0,y) = 0<br>
u(L,y) = umax*sin( pi*y/L )<br>
u(x,0) = 0<br>
u(x,L) = 0
</code>
</blockquote>
<p></p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -