1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

RHS of Laplace's Equation is f(u(x,y))

  1. Mar 29, 2015 #1
    1. The problem statement, all variables and given/known data

    I need to (computationally) solve the following linear elliptic problem for the function u(x,y):

    [itex] \Delta u(x,y) = u_{x,x} + u_{y,y} = k u(x,y) [/itex]

    on the domain

    [itex] \Omega = [0,1]\times[0,1] [/itex] with u(x,y) = 1 at all points on the boundary.


    2. Relevant equations

    I know that I have to use discretization to solve the problem by considering u(x,y) as an n x n grid of points separated by distance h (and mapping them to a one dimensional array of points to make a vector U of n2 components). Then the relevant equation for each point Ui is:

    (1) [itex] u_{x,x} + u_{y,y} = \frac{U_{i-1} + U_{i+1} +U_{i+n} + U_{i-n} - 4 U_{i}}{h^{2}} = k U_{i} [/itex]

    This is known to be true for this problem (see the link http://en.wikipedia.org/wiki/Discrete_Laplace_operator#Finite_Differences for the explanation)

    and it results in a linear system of equations as follows:

    (2) [itex] A U = kU + B [/itex]

    Where A is a sparse matrix which has five diagonals (1,1,-4,1,1) at the offsets ( -(n+1),-1,0,1,(n+1) ). Then B is another vector (of dimension n2) containing the boundary condition values - any point on the edge of the grid will contain a +1 term in equation (1) instead of the value of the point beside it (since U = 1 for all boundary points).

    The system (2) should be solved by a linear solver (eg. conjugate gradient method or something similar) computationally. The result can be plotted as a surface and I believe all u(x,y) values should be between 0 and 1. (i.e. the surface should 'dip' down at all points within the boundaries.)

    3. The attempt at a solution

    I understand the general theory behind writing the problem as a linear system of equations and that it should be solve-able as such. However when writing a program to solve this I'm unsure how to deal with

    (a) The fact that the RHS of the linear system now depends on the solution U

    (b) The boundary condition vector B

    I'm used to solving linear systems of the form [itex]Ax=b[/itex] where the right hand side is a constant, known vector. So my question is, how do I make the system (2) look like this? I will input a LHS and RHS but should all values of U be on the left, and which side does the vector B go on? Am I right in thinking that the RHS of the system must be constantly updated?

    Any comments are appreciated, and I'm happy to clarify any other info about the problem. Thank you
     
  2. jcsd
  3. Mar 29, 2015 #2

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    Your linear equations are of the form
    [tex] \frac{1}{h^2} (U_{i-1} + U_{i+1} +U_{i+n} + U_{i-n} - 4 U_{i}) = k U_i \\
    \;\;\;\;\;\;\text{or}\\
    \frac{1}{h^2}(U_{i-1} + U_{i+1} +U_{i+n} + U_{i-n}) - \left(\frac{4}{h^2} + k \right) U_i = 0 \\
    \;\;\;\;\;\; \text{or}\\
    U_{i-1} + U_{i+1} +U_{i+n} + U_{i-n} - (4 + k h^2) U_i = 0
    [/tex]
     
  4. Mar 29, 2015 #3
    That makes sense - would it be correct then to say that: rather than necessarily having 0 on the right hand side for the above equation, I have [itex]B_{i}[/itex] where [itex]B_{i}[/itex] is:

    -2 for the four points on the corner of the grid
    -1 for points along the edge
    0 for all other points

    Thanks for the quick reply
     
  5. Mar 29, 2015 #4

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    It is important to note that the difference-equation holds only for points not along an edge (because the pde holds in the interior of ##\Omega##). So, in your 1-dimensional representation of the 2-dimensional region, let ##S = \{1,2, \ldots N \}## be the set of all possible ##i## values and ##E \subset S## be the points on an "edge". Then we ought to have
    [tex] U_{i-1} + U_{i+1} +U_{i+n} + U_{i-n} - (4 + k h^2) U_i = 0, i \not \in E, \\
    U_i = 1, i \in E . [/tex]
    Of course, when ##i \not \in E##, some of the ##U_{i \pm 1}## or ##U_{i \pm n}## could be in ##E##, so you would substitute ##1## for them in that case. Basically, you have ##N - |E|## equations in ##N - |E|## unknowns (where ##|E|## denotes the cardinality of the set ##E##).
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted