CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Poisson equation,Neumann BCs (https://www.cfd-online.com/Forums/main/87885-poisson-equation-neumann-bcs.html)

zhangweisnoopy May 1, 2011 23:42

Poisson equation,Neumann BCs
 
Hi~all
I need to solve a pressure Poisson equation with only Neumann boundaries with F.D. method. Unfortunately, it leads to the sparse linear system equation Ax = b, where A is singular (because the Neumann BC in all boundaries).And I use matlab ....Any advise with possibility to solve singular linear systems? Thank you~

arjun May 2, 2011 02:35

Quote:

Originally Posted by zhangweisnoopy (Post 305837)
Hi~all
I need to solve a pressure Poisson equation with only Neumann boundaries with F.D. method. Unfortunately, it leads to the sparse linear system equation Ax = b, where A is singular (because the Neumann BC in all boundaries).And I use matlab ....Any advise with possibility to solve singular linear systems? Thank you~


pick any boundary cell treat it as fixed value of say 0. So all the boundary faces have neumann condition except for 1. if you do so, your equation will no longer be singular. Then use whatever matrix solver you want to solve the system.

julien.decharentenay May 2, 2011 20:09

I think that you can fix any point at the boundary (as mentioned by arjun) or anywhere within the computational domain.

zhangweisnoopy May 3, 2011 10:29

Hi
I've tried it ,but it seems that it's still hard to solve the equations.
In fact my problem is ∂²p/∂x²+∂²p/∂y²= ∂u(x,y)/∂x+∂v(x,y)/∂y
u(x,y) and v(x,y) are known in all points with 1 Dirichlet BC on west and 3 N BCs on the others.
(uu(x,y),vv(x,y))=( u(x,y), v(x,y) )-(∂p/∂x,∂p/∂y)
uu(x,y) and vv(x,y) have the same boudary with u(x,y) and v(x,y).
And p(x,y) is N BCs according to the paper .
But I don't know how to figure out the boundary conditions of p ...any advise?Thank you all~

arjun May 3, 2011 20:30

Quote:

Originally Posted by zhangweisnoopy (Post 306103)
Hi
I've tried it ,but it seems that it's still hard to solve the equations.
In fact my problem is ∂²p/∂x²+∂²p/∂y²= ∂u(x,y)/∂x+∂v(x,y)/∂y
u(x,y) and v(x,y) are known in all points with 1 Dirichlet BC on west and 3 N BCs on the others.
(uu(x,y),vv(x,y))=( u(x,y), v(x,y) )-(∂p/∂x,∂p/∂y)
uu(x,y) and vv(x,y) have the same boudary with u(x,y) and v(x,y).
And p(x,y) is N BCs according to the paper .
But I don't know how to figure out the boundary conditions of p ...any advise?Thank you all~


If you tried and it does not work then there are many possiblities:

1. You made mistake in implementing what is advised.

2. If matlab is using direct solver to solve that matrix system then point (1) is your only possiblity.

3. If matlab is using iterative method then it shall be noted that not all iterative solvers can solve all neumann problem (it also depends on size of your problem). As the size increases the difficulty in solving increases.

4. Usually though (3) only reduces rate of convergence that means you would observe some convergence but it would be converging very slowly. When the problem size increase after some point there will be virtually no convergence.



PS: In the end if you are using finite difference and you mesh is cartesian mesh then have a look at fishpack and its routine called blktri .
(But i think it can also not handle all neumann problem, but have a look to make sure).

pcumsill January 27, 2014 11:00

Implementing pure Neumann Boundary conditions for Poisson equations with FD method
 
Quote:

Originally Posted by arjun (Post 305851)
pick any boundary cell treat it as fixed value of say 0. So all the boundary faces have neumann condition except for 1. if you do so, your equation will no longer be singular. Then use whatever matrix solver you want to solve the system.

I have a question about the implementation of what you have said: I have to fix the value of the numerical solution at only one grid point (e.g. specifying the solution at one corner) or I have to fix the values of the solution at the four grid points of the boundary cell?

Thank you very much in advance

Best regards,
Patricio Cumsille

FMDenaro January 27, 2014 13:56

Quote:

Originally Posted by pcumsill (Post 471990)
I have a question about the implementation of what you have said: I have to fix the value of the numerical solution at only one grid point (e.g. specifying the solution at one corner) or I have to fix the values of the solution at the four grid points of the boundary cell?

Thank you very much in advance

Best regards,
Patricio Cumsille


You can fix the value of the solution in anyone of the grid points.
However, this is not necessary, the system admits infinite solutions and during a linear solver, your solution automatically sets a constant reference value.

adrin January 27, 2014 18:23

Not setting a Dirichlet BC for at least one point will not lead to a converged solution unless the implementation is noisy enough to remove the matrix singularity just enough (for convergence to take place).

On the other hand, setting a node value to a constant Dirichlet BC, as proposed in this thread, is a poor choice/strategy as well. Yes, it allows for the matrix to converge, but it yields a spike at, and in the immediate neighborhood of, the point the Dirichlet BC is applied. A few years ago, I'd developed (and published) a highly accurate and inexpensive solution, without a spike, in a boundary element methods setting. I've just begun searching for similarly accurate methods in a finite-difference/volume approach, but I haven't yet found an easy-to-implement and/or inexpensive strategy!

Adrin

pcumsill January 27, 2014 20:45

Thank you very much for the responses.

Adrin: Please, could you send to me your publication? I am interested! My email is pcumsill@gmail.com

Thank you again!

Best regards,
PC

arjun January 28, 2014 02:54

Quote:

Originally Posted by adrin (Post 472043)
Not setting a Dirichlet BC for at least one point will not lead to a converged solution unless the implementation is noisy enough to remove the matrix singularity just enough (for convergence to take place).

On the other hand, setting a node value to a constant Dirichlet BC, as proposed in this thread, is a poor choice/strategy as well. Yes, it allows for the matrix to converge, but it yields a spike at, and in the immediate neighborhood of, the point the Dirichlet BC is applied. A few years ago, I'd developed (and published) a highly accurate and inexpensive solution, without a spike, in a boundary element methods setting. I've just begun searching for similarly accurate methods in a finite-difference/volume approach, but I haven't yet found an easy-to-implement and/or inexpensive strategy!

Adrin

you are correct about the spikes part. But could you point to the paper you published, it would be good read. May be it could be applied to FV/FD scenario make things better.

FMDenaro January 28, 2014 03:36

Quote:

Originally Posted by adrin (Post 472043)
Not setting a Dirichlet BC for at least one point will not lead to a converged solution unless the implementation is noisy enough to remove the matrix singularity just enough (for convergence to take place).

On the other hand, setting a node value to a constant Dirichlet BC, as proposed in this thread, is a poor choice/strategy as well. Yes, it allows for the matrix to converge, but it yields a spike at, and in the immediate neighborhood of, the point the Dirichlet BC is applied. A few years ago, I'd developed (and published) a highly accurate and inexpensive solution, without a spike, in a boundary element methods setting. I've just begun searching for similarly accurate methods in a finite-difference/volume approach, but I haven't yet found an easy-to-implement and/or inexpensive strategy!

Adrin


well, this is not an issue of CFD but a mathematical property... The Poisson equation Div Grad (phi) = q with Neumann BC.s admits a solution (apart a constant) provided that the compatibility relation is satisfied. This does not require complicate implementation of the BC.s but only the fact that:

Int [S] d phi/dn dS = Int [S] q dS

The CFD task consists in fulfill such relation in discrete sense.

It is a common experience that fixing an arbitrary value leads to a slower convergence

sbaffini January 28, 2014 05:03

My experience agrees with that of adrin, for scale resolving simulations (e.g., LES/DNS) pressure should not be fixed, otherwise you cannot get the right statistics from it. Still, there should be no problem for the momentum equations

FMDenaro January 28, 2014 16:55

Let me say that the correct way to fix a value must accord with the correct BCs otherwise you get convergence towards some uncorrect solution
Try to fix the value not in the interior but by entering it by means of the Neumann BCs, it should work correctly without spike. However, as I said, the convergence rate is slower.

adrin January 28, 2014 17:12

>>>it should work correctly without spike. However, as I said, the convergence rate is slower.

Well, I happen to be working on this problem these days, and I can say that a pure neumann BC without any other modifications will _not_ work! I'm using a multigrid preconditioned krylov solver (PCG), which converges in ~10 iterations (to error of order 1.E-8) for the 3D poisson problem that I've tried. With a pure neumann BC the solution does not converge to even order 1.E-3 for up to 3000 iterations, which is the upper limit I set. In contrast, setting one of the boundary nodes to zero (dirichlet BC) leads to convergence in 7 iterations! I agree that convergence doesn't necessarily mean convergence to a correct solution (but in this case it seems it does)

Adrin

FMDenaro January 28, 2014 17:18

Quote:

Originally Posted by adrin (Post 472232)
>>>it should work correctly without spike. However, as I said, the convergence rate is slower.

Well, I happen to be working on this problem these days, and I can say that a pure neumann BC without any other modifications will _not_ work! I'm using a multigrid preconditioned krylov solver (PCG), which converges in ~10 iterations (to error of order 1.E-8) for the 3D poisson problem that I've tried. With a pure neumann BC the solution does not converge to even order 1.E-3 for up to 3000 iterations, which is the upper limit I set. In contrast, setting one of the boundary nodes to zero (dirichlet BC) leads to convergence in 7 iterations! I agree that convergence doesn't necessarily mean convergence to a correct solution (but in this case it seems it does)

Adrin


Adrin, something in the BC implementation could be wrong... I assume you are working on the pressure problem derived from the continuity equation in which you substitute the Hodge decomposition. The same decomposition, projected along the normal direction to the boundaries provides the correct Neumann BC.s that fulfill the compatibility relation ensuring the convergence.
I work usually with Neumann BC.s and it works....
Please, check if your BC.s satisfy numerically the relation

Int [S] d phi/dn dS - Int [S] q.n dS=0

adrin January 28, 2014 21:16

>> could you point to the paper you published

A. Gharakhani and A. F. Ghoniem,"BEM Solution of the 3D Internal Neumann Problem and A Regularized Formulation for the Potential Velocity Gradients," International Journal of Numerical Methods in Fluids, Vol. 24, No. 1, pp. 81-100, 1997.

sbaffini January 29, 2014 08:24

I remember having a possibly identical problem with a Vortex panel method applied to closed surfaces with lift (in practice the outside potential is well defined by its behavior at infinity, but the inside one is not). However, there the problem can be easily solved by assigning the circulation value for a panel as, just like the pressure, the solution is in terms of differences of circulations among adjacent panels and not their absolute values. Still, i never had the chance to apply the method to multiple closed surfaces to see if it really doesn't matter in general...

Actually, Adrin himself helped me in solving my issue here on CFD-ONLINE (http://www.cfd-online.com/Forums/mai...el-method.html).
I should read your paper to check if the matter is exactly the same.

Coming to the general issue, i guess that you both (Adrin and Filippo) are saying exactly the same thing, one of the equations should be switched to a global constraint instead of fixing it arbitrarily.

However, there might possibly be differences in the single approaches. I guess that if pressure has infinitely many solutions, the solution should simply converge to one of them just like for the pressure checkerboard case the solution converge to a specific checkerboard pattern. My experience is that point Gauss-Seidel iterations can converge to machine accuracy (not so fast actually) if the global b.c. constraint is preserved.

However, this global constraint implies a full coupling among the equations which might be difficult to solve in the context of an otherwise banded matrix.

pcumsill February 4, 2014 17:02

Quote:

Originally Posted by FMDenaro (Post 472223)
Let me say that the correct way to fix a value must accord with the correct BCs otherwise you get convergence towards some uncorrect solution
Try to fix the value not in the interior but by entering it by means of the Neumann BCs, it should work correctly without spike. However, as I said, the convergence rate is slower.


The problem I see is that the convergence rate is really slow. I have carried out some numerical tests and I got a convergence rate even less than 1!!!

Or even worst, for certain problems (for certain data) I did not get convergence!

Thus, the technique of fixing a value at a grid point is not good in general!!!

arjun February 6, 2014 02:27

Quote:

Originally Posted by pcumsill (Post 473434)
The problem I see is that the convergence rate is really slow. I have carried out some numerical tests and I got a convergence rate even less than 1!!!

Or even worst, for certain problems (for certain data) I did not get convergence!

Thus, the technique of fixing a value at a grid point is not good in general!!!


Yes, this was the main problem I faced when I tried to fix a single point for neumann. Even the additive corrective AMG was not that effective specially when case sizes were large.
If you could use, try smoothed aggregation AMG. I ended up taking out additive corrective and replacing it with smoothed aggregation that worked well.



Arjun

adrin March 25, 2014 16:01

Revisiting Neumann BC
 
It turns out that FMDenaro is correct. So long as the Neumann BC compatibility is satisfied _explicitly_ one need not set a Dirichlet BC at one node, and one can still get a solution. In my previous experiments in the finite volume formulation I was using a simple manufactured problem for benchmarking. It turns out that although compatibility was theoretically ensured it was _not_ satisfied numerically (in discrete form). So, a simple correction led to "a" solution. That solution shifts by a constant as a function of grid resolution, but that's not an issue. I still maintain the only reason any solution may be obtained with such an approach is sufficient numerical noise to remove the linear dependence of two arbitrary equations - this approach would fail in an "infinite accuracy" solution.

So, in summary, if the _discrete_ surface integral of the fluxes is not equal to the volume integral of the Poisson source term, perform the following pre-processing before assembling the matrix and RHS. Find the difference between the aforementioned two terms, and either (a) divide that difference by the total volume and then add the volume averaged error to the source term for every node, or (b) divide the difference by the total surface area and then add the surface averaged error to the fluxes on all surface nodes. Make sure the signs are such that compatibility is now satisfied. This yields a quick, converged solution!

Adrin


All times are GMT -4. The time now is 16:27.