Help with Undergraduate Math, Algebra & PDE Implicit Scheming

  • Context: Graduate 
  • Thread starter Thread starter kriss2
  • Start date Start date
  • Tags Tags
    Mathematical
Click For Summary

Discussion Overview

The discussion revolves around coding an implicit scheme for partial differential equations (PDEs), specifically focusing on the equations involving variables u and p. Participants are exploring methods for implementing this scheme, including discretization techniques and numerical solutions.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant seeks assistance in programming an implicit scheme for PDEs, providing a classical finite element method (FEM) discretization.
  • Another participant questions the type of help needed, suggesting that the request is too broad and asking for clarification on whether the inquiry is about programming in general or solving a specific type of linear equation.
  • A third participant shares an explicit method and expresses the need for a similar implicit method, providing code snippets for both u and p updates.
  • A later reply explains that the implicit scheme results in a system of equations that must be solved simultaneously, emphasizing the need for efficient algorithms and libraries for handling sparse or banded matrices.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best approach to implement the implicit scheme, and multiple views on programming techniques and numerical methods remain present.

Contextual Notes

Participants mention the complexity of solving large systems of equations and the importance of using appropriate libraries for sparse matrices, but do not resolve the specifics of the programming implementation or the choice of algorithms.

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:

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 61 ·
3
Replies
61
Views
13K