# Presentation: 574155

## How To Solve Poisson Equation with Neumann Boundary Values

- Jin Chen
- CPPG

## Background

## Outlines

- Characteristics of Neumann Boundary Values
- Numerical singularity of such Boundary Values
- Null Space method for such singularity
- CG and GMRES for non-singular linear equation
- Null Space based CG and GMRES for singular linear equation
- Application to eigenvalue problem
- Application to M3D

## Characteristics of Neumann Boundary Values

- Solvability
-     not every system of equation has a solution.
- Unique
-     if u is a solution, so is u + c.

## Eigenvalues of the Poisson Equation with Neumann BV

## Is there anything we can do?

- Let’s assume A is non-singular FIRST.
- Direct solver
- Iterative solver
-     Krylov Subspace Methods.

## Iterative solver

## Krylov Subspace Methods...

_**Conjugate Gradient (CG)**_
-     symmetric positive definite matrix
_**Generalized Minimal Residual (GMRES)**_
-     non-symmetric indefinite matrix

## CG

**Notes:**
2nd book Page 30.

## GMRES

**Notes:**
K=K_m, L=AK_m: find x* in K, such that b-Ax* _|_ L.
MINRES is the symmetric variant of GMRES. GMRES wastes time orthogonalizing vectors that are already orthogonal.
Conjugate Gradients-Squared (cgs), often shows a rather irregular convergence behavior, and this leads to substantial build-up of rounding errors, or probably even overflow.Bi-CGSTAB (bcgs), was developed to remedy this difficulty and has been proposed as a fast and smoothly variant of the conjugate gradients type. CG, BCGS converges (50 steps), cgs blows at 7th step.

## Numerical Complexity 

| Methods | Inner Product | SAXPY | Matrix-Vector Product |
| --- | --- | --- | --- |
| CG | 2 | 3 | 1 |
| GMRES | i+1 | i+1 | 1 |

| Methods | Storage requirements |
| --- | --- |
| CG | Matrix+6n |
| GMRES | Matrix+(i+5)n |

**Notes:**
Summary of Operations for Iteration i;
Storage requirements for the Methods in iteration i, n denote the order of the matrix.

## If A is singular ...

**Notes:**
The singularity of A is related to the Neumann bc. If u is a solution to the PDE so is u+c, where c is any constant. Similarly, if x is a solution, so is x+ce, and this is equivalent to adding the constant c to each point u_ij of the solution. 
The singularity of the operator also implies that not every system of equations has a solution. A system of equations is consistent if and only if it has solution. The characterization of consistency for these operators is simple to express: 

## Definition of Null Space

**Notes:**
U^H A U = upper triangular.  U is unitary.  If A is symmetry, U is orthogonal matrix.

## Null Space

**Notes:**
U^H A U = upper triangular.  U is unitary.  If A is symmetry, U is orthogonal matrix.

## CG for singular systems

## Slide 16

## Slide 17

## If

## If                    ...

## If                    ...

## If                     ...

## If                        ...

- Re-orthogonlization

- To assure there exists a solution.

## GMRES for singular systems

## GMRES for singular systems ...

## Slide 25

## Numerical Experiment

## Matrix Structure

## Singular and Solvability Check

## Spectrum with a zero eigenvalue

## Strategy I:   Fix one point

- Spectrum shift

## Spectrum shift by one point fixing...

- You are solving an
- approximate problem !!!

**Notes:**
eigenvale 0.0000 1.9098 1.9098 3.8197 6.9098 6.9098 8.8197 8.8197 13.0902 13.0902 13.8197 15.0000 15.0000 18.0902 18.0902 20.0000 20.0000 20.0000 20.0000 25.0000 25.0000 26.1803 31.1803 31.1803 36.1803 
Eigenvale shifted  0.2180 1.0000 1.9098 2.6908 5.1815 6.9098 7.6415 8.8197 11.7251 13.0902 13.4169 14.4774 15.0000 17.8461 18.0902 19.0287 20.0000 20.0000 20.0000 24.6810 25.0000 25.9595 30.9871 31.1803 36.1464 

## Eigenmode k=2, l=0

## Strategy II: null space

## Eigenmode  k=2  l=0

## Eigenmode k=3, l=0

## Application in M3D

- F equation,
- Singular check: Ae=0,
- Solvability check: (b,e)=0,
- Re-orthogonalization: b=b-(b,e)/(e,e),
- Uniqueness check: (x,e)=0,
- CG with nullspace,
- GMRES with nullspace,

## If you want to try it...

- ... I am happy to help you ...

## Eigenvalues for Poisson Equation

## Dirichlet Boundary Values

## Neumann Boundary Values

## Krylov Subspace Methods

## Matrix Representation of Krylov Subspace Methods

## Krylov Subspace Methods...

_**CG**_
-     symmetric positive definite matrix
_**GMRES**_
-     non-symmetric indefinite matrix

## Slide 44

## How to interpret poisson equation

- Neumann: correspond to a solid boundary which fluid cannot penetrate.  www.math.umn.edu/~olver/appl_/

## Slide 46

## Matrix Structure

## Eigenvalues via grid resolution

- You are solving a
- different problem !!!