Discretising Elliptic PDE: How to Handle Derivatives and Summations?

In summary, the conversation is discussing the derivation of a discrete approximation to a partial differential equation (PDE) through a variational principle. The approach involves approximating the PDE in terms of field values at lattice points and then varying with respect to them. The resulting approximation involves the use of a two-point difference formula and the trapezoidal rule. The conversation also touches on the application of the principle of least action and the use of summations and partial derivatives. The conversation ends with a question about an exercise involving the minimization of E when phi is the correct solution.
  • #1
ognik
643
2
Hi, struggling to follow some text which later leads to computer algorithms for Elliptic PDEs...
It reads:

To derive a discrete approx. to the PDE based on the variational principle,. we 1st approx. E in terms of the values of the field at the lattice points and then vary w.r.t. them. The simplest approx. to E is to employ the 2-point diiference formula to approx. each 1st deriv in $ {\left(\nabla \phi\right)}^{2} $ at the points halway between the lattice points and to use the trapezoidal rule for the integrals. This leads to:

$ E=\frac{1}{2}\sum_{i=1}^{N}\sum_{j=1}^{N}[({\phi}_{i,j} - {\phi}_{i-1,j})^2 + ({\phi}_{i,j} - {\phi}_{i,j-1})^2] - {h}^{2} \sum_{i=1}^{N}\sum_{j=1}^{N}{S}_{i,j}{\phi}_{i,j} $

Putting $ \pd{E}{{\phi}_{i,j}}=0 $ in the above, leads to $ -\frac{1}{{h}^{2}}[({\phi}_{i+1,j}+{\phi}_{i-1,j}-2{\phi}_{i,j}) + ({\phi}_{i,j+1}+{\phi}_{i,j-1}-2{\phi}_{i,j})] = {S}_{i,j} $

<Twitch>
I have never encountered a derivative like this before - a derivative w.r.t. an indexed function, I'd appreciate how to handle this.
Reasonably $ \pd{{\phi}_{i,j}}{{\phi}_{i,j}}=1 $ will sort the last term, but I have no idea how to approach things like $ \pd{{\phi}_{i-1,j}}{{\phi}_{i,j}} $, especially hiding inside summations on those indexes ?

(BTW, h is the lattice size, some in both i & j directions)

Thanks
 
Last edited:
Mathematics news on Phys.org
  • #2
Hi ognik,

Let's compare with a regular vector $(x_1, ..., x_n)$ or $(x_i)$ for short.
If we have a function $f(x_i)=f(x_1, ..., x_n)$, we can take its partial derivatives, which are $\pd f {x_i}$.

Similarly, if we have a function $E(\phi_{i,j}) = E(\phi_{1,1}, \phi_{1,2}, ..., \phi_{n,n})$ of a matrix $(\phi_{i,j})$, we can take the partial derivatives $\pd E {\phi_{i,j}}$.

A particular $\phi_{i,j}$ is just a variable that can change independently from the rest of the matrix.
So the partial derivative tells us how much $E$ changes if we change a specific element of the matrix.

I think that setting $\pd E {\phi_{i,j}}$ to zero means that $\phi$ should be such that a small change has no effect on $E$.
It sounds like an application of the principle of least action.
 
  • #3
Hi, and thanks, what I took from your vector example was that I can treat the i-1 & j-1 indices as referencing different variables/functions, so can be treated as constants for the partial diff.?

However I must still be missing something - maybe in the summations (which I still struggle with)?
Looking at the 1st/main term, I get:

$ \frac{1}{2}\pd{}{{\phi}_{ij}} [({\phi}_{ij}-{\phi}_{i-1,j})^2 + ({\phi}_{ij}-{\phi}_{i,j-1})^2] = \frac{1}{2}[2({\phi}_{ij}-{\phi}_{i-1,j}) + 2({\phi}_{ij}-{\phi}_{i,j-1})]
\ne \: -[({\phi}_{i+1,j}+{\phi}_{i-1,j}-2{\phi}_{i,j})+({\phi}_{i,j+1}+{\phi}_{i,j-1}-2{\phi}_{i,j})] $

It looks naively like more needs to happen with the partial diff. within the brackets?

Alternatively they are applying something like the trapezoidal rule to manipulate the terms subsequent to the partial diff. - but I would not be sure how to justify that...I went back quite a few chapters in the book because I can see that $ {\phi}_{i+1,j}+{\phi}_{i-1,j}-2{\phi}_{i,j} $ is an approximation to the 2nd differential of $ {\phi}_{i,j} $ - which is how they arrived at the formula I am trying to get from this partial deriv. - but sadly no inspiration from that.

So maybe $ \pd{}{{\phi}_{ij}} ({\phi}_{ij}-{\phi}_{i-1,j})= ({\phi}_{i+1,j}+{\phi}_{i-1,j}-2{\phi}_{i,j}) $ - but I can't justify that...?
 
  • #4
It looks like you're mixing up the $i,j$ from the partial derivative with the indices of the summation.
Admittedly it's a bit confusing that the same symbols are used twice for different purposes, but they are really distinct.
We could name the indices in the summation different to eliminate the confusion.

Anyway, the trapezoidal rule is:
$$\int f(x) dx \approx \frac h 2 \sum_k (f(x_{k+1}) + f(x_k))$$
After this discretization, we're done with the trapezoidal rule and it's not part of the partial differentiation.

Now suppose we want to take the following partial derivative:
$$\pd {} {\phi_i} \sum_i (\phi_i - \phi_{i-1})^2$$

We can write this with a different index $k$ to distinguish from the $i$ that we're using for the partial derivative:
$$\pd {} {\phi_i} \sum_k (\phi_k - \phi_{k-1})^2$$

Now we can take the partial derivative with respect to $\phi_i$:
$$\begin{aligned}
\pd {}{\phi_i}\sum_k (\phi_k - \phi_{k-1})^2
&= \pd {}{\phi_i}\left( (\phi_1 - \phi_0)^2 + ... + (\phi_i - \phi_{i-1})^2 + (\phi_{i+1} - \phi_i)^2 + ... + (\phi_n - \phi_{n-1})^2\right) \\
&= 2(\phi_i - \phi_{i-1}) - 2(\phi_{i+1} - \phi_i) \\
&= 2(-\phi_{i-1} + 2\phi_i - \phi_{i+1})
\end{aligned}$$
Note that there are 2 terms in the summation that contain $\phi_i$ and we have to take those 2 into account when taking the partial derivative.
 
  • #5
Many thanks, I really should have been able to work that out myself though - do you perhaps know of a good video or link that would help me learn and practice summation algebra/calculus to a much better level than I'm floundering at currently?

Could you also please check the following exercise, I am asked to 'prove or argue heuristically that E is a minimum when \(\displaystyle \phi\) is the correct solution" I am a little confused about the way the question is worded, I can't see why we would need to heuristics? or why they need to emphasize '...when \(\displaystyle \phi\) is the correct solution'?

Anyway it seemed simple to me - $\pd{E}{{\phi}_{ij}} = 0 $ gives the stationary point(s) of E w.r.t. $ {\phi}_{ij} $
To determine max or min, we need to find $\pd{^2E}{{\phi}_{ij}^2} $
I get $\pd{^2E}{{\phi}_{ij}^2} $ = $ \frac{4}{h} $ which must be > 0 because h = lattice interval which must be > 0.
Therefore E is a minimum because the stationary point at $\pd{E}{{\phi}_{ij}} = 0 $ is $ \frac{4}{h} $ which is > 0

Is that enough?
Thanks
 
  • #6
ognik said:
Many thanks, I really should have been able to work that out myself though - do you perhaps know of a good video or link that would help me learn and practice summation algebra/calculus to a much better level than I'm floundering at currently?

Could you also please check the following exercise, I am asked to 'prove or argue heuristically that E is a minimum when \(\displaystyle \phi\) is the correct solution" I am a little confused about the way the question is worded, I can't see why we would need to heuristics? or why they need to emphasize '...when \(\displaystyle \phi\) is the correct solution'?

Anyway it seemed simple to me - $\pd{E}{{\phi}_{ij}} = 0 $ gives the stationary point(s) of E w.r.t. $ {\phi}_{ij} $
To determine max or min, we need to find $\pd{^2E}{{\phi}_{ij}^2} $
I get $\pd{^2E}{{\phi}_{ij}^2} $ = $ \frac{4}{h} $ which must be > 0 because h = lattice interval which must be > 0.
Therefore E is a minimum because the stationary point at $\pd{E}{{\phi}_{ij}} = 0 $ is $ \frac{4}{h} $ which is > 0

Is that enough?
Thanks

That seems to be fine to me.
Additionally, it would be heuristic, since we're using a discretization and the assumption that changing a single entry of the discretization tells us what we need.

Presumably, the original problem is about an integral, so if we have the correct solution for that integral, the discretized result will be slightly off anyway.
 
  • #7
Thanks , your comments were exactly what I needed to make it all 'solid'.

Some left over questions if you (or anyone else) has some ideas:

1. A link to some good intermediate-to-advanced summation algebra examples/solved problems (including differentials and integrals etc)
2. Thoughts on det [] - I am happy to have it defined = 1, but wondered if there was some formal determination ?

Thanks again, this is such a valuable forum.
 
  • #8
ognik said:
Thanks , your comments were exactly what I needed to make it all 'solid'.

Good! (Smile)
Some left over questions if you (or anyone else) has some ideas:

1. A link to some good intermediate-to-advanced summation algebra examples/solved problems (including differentials and integrals etc)
2. Thoughts on det [] - I am happy to have it defined = 1, but wondered if there was some formal determination ?

Thanks again, this is such a valuable forum.

I don't really know of such a link. I can give a couple of hints on how to deal with summations though - pretty much open-door type of hints:
  • When in doubt, expand a summation to (at least) the first 2 and the last term.
    Usually everything becomes clear then (as in this case).
  • Swap summations and integrals/differentials as needed.
    The sum rule for differentatiation allows us to do so.

I don't understand what you mean by "det []" or "defined = 1".
Can you clarify?
 

FAQ: Discretising Elliptic PDE: How to Handle Derivatives and Summations?

What is meant by "discretising" an elliptic PDE?

"Discretising" refers to the process of approximating a continuous elliptic PDE (partial differential equation) by breaking it down into a finite number of smaller equations, making it easier to solve using numerical methods. This is typically done by dividing the domain of the PDE into a grid or mesh and calculating the PDE at discrete points within the grid.

Why is discretisation necessary for solving elliptic PDEs?

Discretisation is necessary because most PDEs do not have exact analytical solutions. By discretising the PDE, we can use numerical methods to approximate the solution, giving us a close enough answer for practical purposes.

What are some common numerical methods used for discretising elliptic PDEs?

Some common numerical methods include finite difference, finite element, and spectral methods. These methods differ in their approach to discretisation and have varying levels of accuracy and computational efficiency.

What factors should be considered when choosing a discretisation method for a specific PDE?

The choice of discretisation method depends on the specific properties of the PDE, such as its order, boundary conditions, and the geometry of the domain. Other factors to consider include the desired accuracy and computational resources available.

How can one assess the accuracy of a discretised solution to an elliptic PDE?

The accuracy of a discretised solution can be assessed by comparing it to an analytical solution, if one exists, or by using convergence analysis. Convergence analysis involves decreasing the step size of the discretisation and observing how the solution changes, with a more accurate solution being achieved as the step size approaches zero.

Similar threads

Replies
8
Views
3K
Replies
1
Views
2K
Replies
9
Views
1K
Replies
1
Views
2K
Replies
4
Views
944
Replies
1
Views
1K
Replies
23
Views
1K
Back
Top