Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematical LogicNumerical AnalysisUndergraduate MathAlgebra HelpRecreational Math M

  1. Jul 17, 2011 #1
    Hi
    a want to code implicite scheme for PDEs
    u_t =a laplace u + L p_t
    p_t = laplace p + u

    pls help
    I made a classical FEM discretization, but i dont know how to programe it.

    (u(n+1)ij - un)/t = a ((u(n+1)(i-1j) -2 u(n+1)(ij) +u(n+1)(i+1 j))
    /x2 + (u(n+1)(i j-1)-2u(n+1)(ij) + u(n+1)( i j+1 )/y2) +L (p(n+1)
    -pn)/t

    (p(n+1)ij - pn)/t = ((p(n+1)(i-1j) -2 p(n+1)(ij) +p(n+1)(i+1 j))
    /x2 + p(n+1)(i j-1)-2p(n+1)(ij) + p(n+1)( i j+1 )/y2) + un
     
  2. jcsd
  3. Jul 17, 2011 #2
    Re: Mathematical LogicNumerical AnalysisUndergraduate MathAlgebra HelpRecreational Ma

    Well, it's not simple. What kind of help are you looking for? "i dont know how to programe it" is pretty broad. Do you want to know how to program a computer? Or are you asking how to efficiently solve a banded system of linear equations? Or what?
     
  4. Jul 18, 2011 #3
    Re: Mathematical LogicNumerical AnalysisUndergraduate MathAlgebra HelpRecreational Ma

    I have explicite method and I need something similar for implicite metod

    k=1:T
    Pold=P;
    Uold=U;
    i=2:X-1;
    j=2:Y-1;
    P(i,j)=Pold(i,j) ...
    + ((Pold(i-1,j)-2*Pold(i,j)+Pold(i+1,j))/X^2 ...
    + (Pold(i,j-1)-2*Pold(i,j)+Pold(i,j+1))/Y^2)*tau ...
    + Uold(i,j)


    U(i,j)=Uold(i,j)+ ...
    a *( (Uold(i-1,j)-2*Uold(i,j)+Uold(i+1,j))/X^2 ...
    + (Uold(i,j-1)-2*Uold(i,j)+Uold(i,j+1))/Y^2) ...
    + L*(P(i,j) - Pold(i,j));


    figure(1)
    Pcolor(U)
    caxis([0 1.2])
    colorbar

    end
     
  5. Jul 18, 2011 #4
    Re: Mathematical LogicNumerical AnalysisUndergraduate MathAlgebra HelpRecreational Ma

    OK. For every i,j, you have an equation relating uij and pij at time n+1 to their values at time n. Let's suppose you have an m x m grid -- then these, together with the boundary conditions, give you 2m^2 equations in 2m^2 unknowns. You need to solve that big system of linear equations.

    There are a few different algorithms for solving systems of linear equations. Good programming practice forbids re-inventing the wheel, and at this point you should find a library available for your software environment and use it. In particular, you want algorithms and libraries for "sparse" or "banded" matrices. Systems like this give very big matrices (e.g., if you're working on a 30 x 30 grid, you'll have an 1800 x 1800 matrix), most of whose elements are 0. A sparse matrix library will represent this matrix compactly (i.e., without using up 3240000 reals in your memory) and will solve it efficiently. Solving a general system of linear equations is O(n^3), but algorithms designed for sparse systems will do it in O(N), where N is the number of non-zero elements. This is a big deal for practical applications.
     
    Last edited: Jul 18, 2011
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Mathematical LogicNumerical AnalysisUndergraduate MathAlgebra HelpRecreational Math M
  1. M i right (Replies: 2)

  2. Advanced Math (Replies: 1)

Loading...