Numerical integration of PDEs: How do you satisfy boundary conditions

Click For Summary

Discussion Overview

The discussion centers around the numerical integration of partial differential equations (PDEs), specifically focusing on how to satisfy boundary conditions while solving a diffusion equation. Participants explore various numerical schemes and their implications for maintaining boundary conditions during the integration process.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant presents a diffusion equation and questions how to ensure boundary conditions are satisfied using a forward time centered space integration scheme.
  • Another participant explains that the finite difference scheme applies only to spatial mesh points between the end points and suggests overwriting boundary values directly in the numerical scheme to maintain conditions.
  • A participant questions whether only overwriting the boundary points is sufficient for ensuring boundary conditions.
  • Some participants argue that boundary conditions dictate the values at the endpoints, and thus the numerical solution does not need to ensure these conditions but rather assumes them.
  • There is a discussion about the analytical approach to solving PDEs, where participants note that solutions are constructed to inherently satisfy boundary conditions, contrasting this with numerical methods.
  • One participant illustrates how to compute values at boundary-adjacent points using boundary conditions, emphasizing that the numerical method can incorporate these conditions directly in calculations.

Areas of Agreement / Disagreement

Participants express differing views on how boundary conditions are treated in numerical integration. While some agree that boundary conditions are assumed rather than enforced, others suggest that overwriting boundary values is a necessary step in the numerical process. The discussion remains unresolved regarding the best approach to handle boundary conditions in numerical schemes.

Contextual Notes

Participants highlight that the treatment of boundary conditions can vary based on the complexity of the conditions and the numerical methods employed. There is an acknowledgment that certain boundary conditions may require specific adjustments to the numerical scheme, which adds to the complexity of the discussion.

davidbenari
Messages
466
Reaction score
18
Suppose we are solving a diffusion equation.

##\frac{\partial}{\partial t} T = k\frac{\partial^2}{\partial x^2} T##

On the domain ##0 < x < L##

Subject to the conditions

##T(x,0) = f(x) ## and ##T = 0 ## at the end points.

My question is:

Suppose we solve this with some integration scheme (forward time centered space), such that we use a formula like

##T_{i}^{n+1} = \frac{k\tau}{h^2} (T_{i+1}^{n} - 2 T_{i}^{n} + T_{i-1}^n)+T_{i}^n##

how is it that we are ensuring that ##T=0## at the end points in the future?

Is a partial differential equation completely determined by its initial configuration (including its initial boundary)?

How are we respecting the boundary conditions when we do such integration of the pde ?
 
Physics news on Phys.org
That finite difference scheme you supplied is a central difference scheme, meaning it applies exactly as written only for spatial mesh points (x points) between the end points (exclusively). Its easiest to supply the boundary conditions if you treat that recurrence relation as a matrix (or an excel formula). For consistency, let's say each column holds data varying over time at constant position and each row contains data sampled over space (x coordinate) at a fixed time. Then your initial condition ( t = 0 ) fills all the data in the top row ( n = 0 ). This isn't enough information to fully determine the unknown data. If you put that recursion formula into a rectangular table in excel and filled the top row only with givens, it wouldn't find any data when it looks left ( i - 1 ) and right ( i + 1 ). It would only see the data above it ( n - 1 ).
The end points correspond to the leftmost ( i = i_min, x = 0 ) and rightmost ( i = i_max, x = L) columns of the array. What I've done in the past and worked in MATLAB is to overwrite these side columns with the fixed boundary value data (in your case, T = 0 for all entries in both the first and last columns). Then you have 1 temporal constraint and 2 spatial constraints for a difference scheme that is 1st order in time and 2nd order in space. It's fully defined.
 
Hmm. So you only overwrite the boundary points?
 
You're not supposed to ensure the boundary conditions hold as such, the boundary conditions tell you what the value should be.

Think of a guitar string. No amount of plucking will move the endpoints of the string. They're fixed in place.
 
Lord Crc said:
You're not supposed to ensure the boundary conditions hold as such,

When you solve these problems analytically you basically force your solution to be zero at the end points. Think of when, when applying separation of variables and you get some sine function as a solution, you construct the sine's argument to ensure that its zero on the endpoints.

When we solve PDEs numerically, I don't see how were forcing our boundaries to hold a specific condition. It seems logical to me to just overwrite the boundaries in each iteration step though.
 
Disclaimer: it has been a few years since I left uni, so maybe a bit rusty...

davidbenari said:
When you solve these problems analytically you basically force your solution to be zero at the end points. Think of when, when applying separation of variables and you get some sine function as a solution, you construct the sine's argument to ensure that its zero on the endpoints.

Yes that's what I mean. You assume that nothing your solution does affects that value, and so you use the value as-is at the boundary. Thus your solution does not ensure the boundary conditions hold, it assumes they do.

davidbenari said:
When we solve PDEs numerically, I don't see how were forcing our boundaries to hold a specific condition.

Let's write out explicitly how to compute T^{n+1}_1 given your above formula:T^{n+1}_1 = \frac{k\tau}{h^2}\left(T^n_2 - 2T^n_1 + T^n_0\right) + T^n_1

If n &gt; 1, what value will you use for T^n_0? You can't compute it using your formula, because then you'd need to know the value of T^n_{-1} which is outside the domain and thus not defined.

But, you have a boundary condition saying that T^n_0 = 0. So let's use that: T^{n+1}_1 = \frac{k\tau}{h^2}\left(T^n_2 - 2T^n_1 + 0\right) + T^n_1T^{n+1}_1 = \frac{k\tau}{h^2}\left(T^n_2 - 2T^n_1\right) + T^n_1
Now you've forced the value at T^n_0 to be zero, and used that to solve the PDE, instead of ensuring it winds up as zero afterwards.

Of course, in this case you could have just overwritten the boundary values in your array holding T in your program, as Twigg suggested, and used your regular formula for all internal points. However in some cases you have more complicated boundary conditions where it makes more sense to change the expression used to evaluate the points near the boundaries, like I did above for T^{n+1}_1.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 0 ·
Replies
0
Views
3K