1
$\begingroup$

Suppose that I have a very long and tedious set of differential equations. After discretization, I can get a mapping $f:\mathbb{R}^N \to \mathbb{R}^N$ such that solutions $\phi =(\phi_0,...,\phi_{N-1})$ to the discretized diffferential equations are exactly the zeros of $f$, i.e., $f(\phi)=0$.

Now say I want to find solutions $\phi$ which satisfy some Neumann boundary equation, e.g., $$ \frac{\phi_1-\phi_0}{dx}=1 $$ Of course, I can always define another function $$ F(\phi)= \left(\frac{\phi_1-\phi_0}{dx} -1, f(\phi) \right):\mathbb{R}^{N} \to\mathbb{R}^{N+1} $$ And just use Newton's method on $F(\phi)$. However, since the derivative/Jacobian $DF$ is not a square matrix in this case, things are a little more complicated. Is there an easy way to modify Newton's method to incorporate Neumann conditions?

Indeed, in this post, the OP deals with Dirichlet boundary conditions, e.g., $\phi_0=0$,, by removing row $0$ of the Jacobian $Df$ and replacing it with the Jacobian of $\phi \mapsto \phi_0$, which is just the Dirac delta at $0$, i.e., $(Df)_{0j} \mapsto \delta_{0j}$. This way the "modified" Jacobian is a still a square matrix. However, this doesn't seem to work if I were to replace row $0$ of $Df$ with the Jacobian of $\phi \mapsto (\phi_1-\phi_0)-dx$, i.e., $(Df)_{0j}\mapsto \delta_{1j}-\delta_{0j}$.

I have also read posts, e.g., here, where they substitute the Neumann boundary condition into the differential equation. However, since my $f$ mapping is quite long and tedious (and not just a simple second order derivative), this would be a little cumbersome for me to do by hand.

Are there any simple alternatives to applying Neumann boundary conditions?

EDIIT. Actually, I realized there was a typo in my code. My initial method works.

$\endgroup$
1
  • 5
    $\begingroup$ shall we close this question? $\endgroup$ Nov 3, 2021 at 4:28

0