Computational costs solving PDEs in PBCs in finite element and finite difference methods compared to Dirichlet BCs

128 Views Asked by At

Hi would like to know if someone could comment on the costs of solving a partial differential equation (PDE) with finite differences (FD) with periodic boundary conditions (PBCs) compared to solving it with Dirichlet boundary conditions. Is it much more expensive? On what factors does the performance of solving in PBCs depend, which kind of PDEs work best compared to Dirichlet?

Edit: Lets take as example

1) the Poisson equation:

$\Delta v(r) = q(r)$

where $q$ plays the role of a charge density (local function) and $v$ the electrostatic potential (solution).

2) the Poisson-Boltzmann equation:

$\Delta v(r) = q(r) + f(v(r))$,

where $f(v(r))$ is a nonlinear function of $v$.

I would also like to know how the cost increase from Dirichlet to PBC differs in FD methods and finite element methods.

1

There are 1 best solutions below

3
On BEST ANSWER

So, it really depends on the equation & the method you are working on.

For a simple case where the spatial operators work uniformly everywhere (so no local sources) the structure of the discretization matrix $A$ changes, and in a special case where you compare performance to homogenous Dirichlet BC's your matrix will get slightly bigger (from $N^d \times N^d$ to $(N+1)^d \times (N+1)^d$ where $d$ is the dimension of the problem).

So, it could be more expensive, but this extra cost can be very small compared to other things. Please describe the equation you are working on some more.

EDIT: Okay, the Poisson equation will be somewhat easy example: we define matrix $A$ which is the FD version of the $\nabla^2$ operator, a vector $v$ which corresponds to the potential and a RHS vector $q$ which is the charge density. The nice thing about this is that the nonuniform enters only in the RHS vector - in other words $Av = q$ has a structured matrix $A$. To incorporate nonhomogenous BC you need to make the matrix bigger and change the matrix a bit. For details check the chapter 3 of those notes.

So, a upperbound on computational expense. The most brute force way (by computing an inversion which you should never do) of solving $Av =q$ is an $\mathcal{O}(n^3)$ algorithm, where matrix $A$ is $n\times n$.

Like I mentioned before your matrix should be something like $N^d \times N^d$ and when you add the boundaries to it you will go to $(N+1)^d \times (N+1)^d$ thus your cost increase scale like: $$\mathcal{O}(N^{3d})- \mathcal{O}((N+1)^{3d}) = \mathcal{O}(N^{3d -1}).$$

Ofcourse you can do way better - look in the same notes in chapters 6 and 7 to solve your system more efficiently.

As of the second example: this is a very hard question which depends on the function $f$. I have worked on a similar problem before where the nonlinear coupling was the electrostatics of the system and giving bounds on performace wasn't really a in the cards for me. You will need to use some kind of iterative method to solve $A v_{n+1} = q + f(v_n)$ and here you really need to pick the right tool depending on the $f$. Anderson mixing scheme is a GREAT start.

Finite elements and finite volumes approaches aren't techniques I have in my backyard so I can't help you on that ground.