Help with Undergraduate Math, Algebra & PDE Implicit Scheming

  • Thread starter Thread starter kriss2
  • Start date Start date
  • Tags Tags
    Mathematical
kriss2
Messages
2
Reaction score
0
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 don't 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
 
Physics news on Phys.org


Well, it's not simple. What kind of help are you looking for? "i don't 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?
 


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
 


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:
Thread 'Direction Fields and Isoclines'
I sketched the isoclines for $$ m=-1,0,1,2 $$. Since both $$ \frac{dy}{dx} $$ and $$ D_{y} \frac{dy}{dx} $$ are continuous on the square region R defined by $$ -4\leq x \leq 4, -4 \leq y \leq 4 $$ the existence and uniqueness theorem guarantees that if we pick a point in the interior that lies on an isocline there will be a unique differentiable function (solution) passing through that point. I understand that a solution exists but I unsure how to actually sketch it. For example, consider a...

Similar threads

Back
Top