Difference in numerical approach for PDE vs ODE

In summary: A stiff ODE is an ODE for which the numerical solutions do not converge asymptotically to a stable point as the time variable t increases.
  • #1
TheCanadian
367
13
I think I am missing something painfully obvious, but what exactly is the difference in algorithms used to solve PDEs vs ODEs? For example, I've been looking at finite difference methods and the general steps (from what I've seen, although particular approaches may vary) used to numerically solve PDEs and ODEs using this method is to set up a grid for your domain, define boundary/initial conditions, and then take the total (partial) derivative and add it to the previous step's value to find adjacent values.

For example (after initializing values), if I have a function P composed of two variables (t and z) with the total (partial) derivative operator given by Dt for the time derivative and Dz for the spatial derivative, then I set up a loop and it might look something like this:

Code:
j = 0
i = 0
while i < len(t):
    DtP = Dt(P[j,i])
    P[j,i+1] = P[j,i] + ht*DtP

    while j < len(z):
       DzP = Dz(P[j,i])
       P[j+1,i] = P[j,i] + hz*DzP
       j = j + 1

    i = i + 1

Please correct my huge misunderstanding here (or if my basic code is incredibly wrong in its approach), but how exactly is the finite difference method different for the two approaches, besides using a partial or total derivative to iterate the next step?

If you have any other methods besides finite difference methods that could also help distinguish the two approaches to solving ODEs and PDEs, that would be helpful as well.[/code]
 
Last edited:
Technology news on Phys.org
  • #2
If you use the straightforward finite differencing for a PDE, you usually encounter numerically unstable behavior, which means that the numerical errors in your solution grow exponentially as a function of the time variable t. That is why there are Crank-Nicolson schemes and semi-implicit schemes for solution of PDE:s.
 
  • Like
Likes TheCanadian
  • #3
hilbert2 said:
If you use the straightforward finite differencing for a PDE, you usually encounter numerically unstable behavior, which means that the numerical errors in your solution grow exponentially as a function of the time variable t. That is why there are Crank-Nicolson schemes and semi-implicit schemes for solution of PDE:s.

Thank you for the clarifying that. I'll definitely read more about the stability of the different approaches for PDE solvers. In case I'm misinterpreting you, why do ODE not encounter the same unstable behaviour for the different approaches?
 
  • #4
Sometimes the finite difference method can be unstable for ODE:s too, but it's more rare. When it happens, the equation is called a "stiff" ODE.
 

1. What is the main difference between solving a PDE and an ODE numerically?

The main difference between solving a partial differential equation (PDE) and an ordinary differential equation (ODE) numerically is that PDEs involve multiple independent variables, while ODEs only have one independent variable. This means that PDEs require a spatial discretization in addition to a time discretization, making them more complex to solve.

2. Are the numerical methods used for PDEs and ODEs different?

Yes, the numerical methods used for solving PDEs and ODEs are different. While ODEs can often be solved using explicit or implicit methods, PDEs typically require more specialized techniques such as finite difference, finite element, or spectral methods.

3. Can the same numerical method be used to solve both PDEs and ODEs?

In some cases, yes, the same numerical method can be used to solve both PDEs and ODEs. For example, the finite difference method can be applied to both types of equations. However, in general, PDEs require more advanced and specialized numerical techniques due to their higher dimensionality.

4. Is it more difficult to solve a PDE numerically compared to an ODE?

Yes, it is typically more difficult to solve a PDE numerically compared to an ODE. This is because PDEs involve higher dimensionality and require spatial discretization, making them more complex and computationally demanding.

5. Can you use any numerical method to solve any PDE or ODE?

No, not all numerical methods are suitable for solving all types of PDEs and ODEs. The choice of numerical method depends on the specific equations and boundary conditions, and some methods may be more efficient or accurate for certain types of equations.

Similar threads

  • Differential Equations
Replies
3
Views
296
  • Programming and Computer Science
Replies
2
Views
2K
  • Science and Math Textbooks
Replies
12
Views
907
  • Programming and Computer Science
Replies
4
Views
4K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
6
Views
2K
Replies
5
Views
598
  • Programming and Computer Science
Replies
8
Views
2K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
1
Views
935
Back
Top