I'm trying to implement the Helmholtz-Hodge Decomposition in 2D, which states that a vector field is composed by a rotational free component, a divergence free component and a harmonic component.
This leads me to a Poisson Equation:
$\begin{equation} \left\{ \begin{array}{lcl} \nabla \cdot \mathbf{F} & = & \Delta \varphi \\ (\nabla \cdot J) \mathbf{F} & = & - \Delta \psi \end{array} \right. \end{equation}$
I'm trying to solve it using finite-differences.
To comput gradients, I'm using:
$\left( \begin{array}{ccc} -1 & 0 & 1 \end{array} \right)$
For dx
.
$\left( \begin{array}{c} -1 \\ 0 \\ 1 \end{array} \right)$
For dy
.
For the Laplacian
, I'm using:
$\left( \begin{array}{ccc} 0 & -1 & 0 \\ -1 & +4 & -1 \\ 0 & -1 & 0 \end{array} \right)$
Then, for a 2 x 2 input, for example, I will have an equation of the form:
$\left( \begin{array}{c} \nabla \cdot \mathbf{F}_{11}\\ \nabla \cdot \mathbf{F}_{12}\\ \nabla \cdot \mathbf{F}_{21}\\ \nabla \cdot \mathbf{F}_{22}\\ \end{array} \right) $= $\left( \begin{array}{cccc} 4. & -1. & 0. & -1.\\ -1. & 4. & -1. & 0.\\ 0. & -1. & 4. & 0.\\ -1. & 0. & 0. & 4 \end{array} \right) $ $\left( \begin{array}{c} \varphi_{11}\\ \varphi_{12}\\ \varphi_{21}\\ \varphi_{22} \end{array} \right) $
To solve $\nabla \cdot \mathbf{F} = \Delta \varphi$.
Using this approach, I could solve the system and obtain the vector field components. However, I'm having problem at the boundaries.
Researching, I read about the Pure Neumann Boundary Conditions. However, I don't know how to include them in the system of equations. I'm wondering how to do that.
Thank you.