I Numerical integration of PDEs: How do you satisfy boundary conditions

AI Thread Summary
The discussion focuses on the numerical integration of a diffusion equation while ensuring boundary conditions are satisfied. It highlights the importance of overwriting boundary values directly in the numerical scheme, rather than relying on the solution to naturally conform to these conditions. The participants emphasize that boundary conditions dictate fixed values at the endpoints, which must be applied during each iteration of the numerical method. Additionally, they clarify that while analytical solutions enforce boundary conditions through specific function forms, numerical methods assume these conditions are already met. Ultimately, the conversation underscores the necessity of explicitly managing boundary values in numerical PDE solutions for accurate results.
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 ?
 
Mathematics 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.
 
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Suppose ,instead of the usual x,y coordinate system with an I basis vector along the x -axis and a corresponding j basis vector along the y-axis we instead have a different pair of basis vectors ,call them e and f along their respective axes. I have seen that this is an important subject in maths My question is what physical applications does such a model apply to? I am asking here because I have devoted quite a lot of time in the past to understanding convectors and the dual...
Thread 'Imaginary Pythagoras'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...
Back
Top