feat(poly): major work on preconditioner for block form of lane emden equation

working on a "smart" schur compliment preconditioner for the block form of the lane emden equation. Currently this is stub and should not be considered usable
This commit is contained in:
2025-04-09 15:17:55 -04:00
parent acf5367556
commit 08b68c22de
14 changed files with 525 additions and 118 deletions

View File

@@ -122,6 +122,114 @@ We can then set this up as a matrix operation
\end{bmatrix}
\end{align}
From this form we can easily see that the residual matrix is
\begin{align}
R &= \begin{bmatrix}
f(\bar{\theta}) - M\bar{\phi} \\
D\bar{\phi} - Q\bar{\theta}
\end{bmatrix}
\end{align}
\subsection{The Jacobian}
We need to define the Jacobian of this system of equations so that we can use it
in our Newton-Raphson method. Generally the Jacobian is the matrix of partial derivitives wrt. the state vector. We will let our state vector, $X$, be
\begin{align}
X = \begin{bmatrix}
\bar{\theta} \\
\bar{\phi}
\end{bmatrix}
\end{align}
So then the Jacobian is
\begin{align}
J &= \begin{bmatrix}
\frac{\partial}{\partial \theta}\left(f(\theta) - M\phi\right) & \frac{\partial}{\partial \phi}\left(f(\theta) - M\phi\right) \\
\frac{\partial}{\partial \theta}\left(D\phi - Q\theta\right) & \frac{\partial}{\partial \phi}\left(D\phi - Q\theta\right)
\end{bmatrix} \\
J &= \begin{bmatrix}
\frac{df}{d\theta} - \phi\frac{\partial M}{\partial \theta} & -M-\phi\frac{\partial M}{\partial \phi} \\
-Q - \theta\frac{\partial Q}{\partial \theta} & D + \phi\frac{\partial D}{\partial \phi} - \theta\frac{\partial Q}{\partial \phi}
\end{bmatrix}
\end{align}
Finally, we know that the matrices $M$, $D$, and $Q$ are constant with respect to $\theta$ and $\phi$. Therefore, we can drop the partial derivatives with respect to $\theta$ and $\phi$ from the Jacobian. This gives us
\begin{align}
\mathbf{J} &= \begin{bmatrix}
\frac{df}{d\theta} & -M \\
-Q & D
\end{bmatrix}
\end{align}
\noindent In a fully assembled, distritized form this will look like
\begin{align}
\mathbf{J} = \begin{bmatrix} \frac{df}{d\theta}_{00} & \dots & \frac{df}{d\theta}_{0n_{\theta}} & -M_{00} & \dots & -M_{0n_{\phi}} \\
\vdots & \ddots & & \vdots & \ddots & \\
\frac{df}{d\theta}_{n_{\theta}0} & & \frac{df}{d\theta}_{n_{\theta}n_{\theta}} & -M_{n_{\theta}0} & & -M_{n_{\theta}n_{\phi}} \\
-Q_{00} & \dots & -Q_{0n_{\theta}} & D_{00} & \dots & D_{0n_{\phi}} \\
\vdots & \ddots & & \vdots & \ddots & \\
-Q_{n_{\phi}0} & & -Q_{n_{\phi}n_{\theta}} & D_{n_{\phi}0} & & D_{n_{\phi}n_{\phi}}
\end{bmatrix}
\end{align}
\noindent Where $N_{dof}^{\theta} = n_{\theta}$ is the number of degrees of freedom on $\theta$, and $N_{dof}^{\phi} = n_{\phi}$ is the number of degrees of freedom on $\phi$. Note how the Jacobian is a matrix of size $\left(N_{dof}^{\theta} + N_{dof}^{\phi} \times N_{dof}^{\theta} + N_{dof}^{\phi}\right)$
\subsection{Preconditioner}
Due to the eventual size of these matrices we would like to be able to solve
each step in this using a memory efficiet approach. Krylov solvers, such as
GMRES, allow for matrix free iterative solutions (as long the concept of
multiplication is defined). However, for these systems to be well formed for
such solvers it is useful for us to use a preconditioner. However, this is a
somewhat strongly coupled system where we cannot simply use the inverse
diagonals of the matrix as a preconditioner. Instead, to encode the coupling we
will use Schur's Compliment. Each Newton iteration we solve the equation
\begin{align}
\mathbf{J}\Delta \vec{x} = \vec{b}
\end{align}
If we expand this out
\begin{align}
\begin{bmatrix} \mathbf{\dot{f}} & -\mathbf{M} \\
-\mathbf{Q} & \mathbf{D}
\end{bmatrix}\begin{bmatrix} \theta \\
\phi
\end{bmatrix} = \begin{bmatrix} b_{0} \\
b_{1}\end{bmatrix}
\end{align}
We can pull out the first equation from this system
\begin{align}
\mathbf{\dot{f}}\theta - \mathbf{M}\phi &= b_{0} \\
\theta &= \mathbf{\dot{f}}^{-1}b_{0} + \mathbf{\dot{f}}^{-1}\mathbf{M}\phi
\end{align}
Then if we pull out the second equation from the system
\begin{align}
-\mathbf{Q}\theta + \mathbf{D}\phi &= b_{1} \\
-\mathbf{Q}\left(\mathbf{\dot{f}}^{-1}b_{0} + \mathbf{\dot{f}}^{-1}\mathbf{M}\phi\right) + \mathbf{D}\phi &= b_{1}
\end{align}
rearanging terms a bit
\begin{align}
-\mathbf{Q}\mathbf{\dot{f}}^{-1}b_{0}-\mathbf{Q}\mathbf{\dot{f}}^{-1}\mathbf{M}\phi + \mathbf{D}\phi &= b_{1} \\
\left(\mathbf{D} - \mathbf{Q}\mathbf{\dot{f}}^{-1}\mathbf{M}\right)\phi &= b_{1} + \mathbf{Q}\mathbf{\dot{f}}^{-1}b_{0}
\end{align}
The term $\mathbf{D}-\mathbf{Q}\mathbf{\dot{f}}^{-1}\mathbf{M}$ is Schur's Compliment for this system, and we will represent this by the symbol $\mathbf{\tilde{S}}$. We can use Schur's Compilment to precondition our equation if we let the preconditioner be of the form
\begin{align}
\mathbf{P} = \begin{bmatrix} \mathbf{\dot{f}}^{-1} & 0 \\
0 & \mathbf{\tilde{S}}^{-1}
\end{bmatrix}
\end{align}
So then the preconditioned equation which can be more easily solved by some Krylov solver (such as GMRES) is
\begin{align}
\mathbf{P}\mathbf{J}\Delta \vec{x} = \mathbf{P}\vec{b}
\end{align}
It is easy to see here that for this system to be solvable / well defined both
$\mathbf{\tilde{S}}$ and $\mathbf{\dot{f}}$ need to be invertable
matrices. They are both easily shown to be square (with $\mathbf{\tilde{S}}$
having a size $\left(N_{dof}^{\phi}\times N_{dof}^{\phi}\right)$ and
$\mathbf{\dot{f}}$ having a size $\left(N_{dof}^{\theta}\times
N_{dof}^{\theta}\right)$).
\subsection{A Few Quick Notes}
A few notes on the dimensions of $\mathbf{M}$, $\mathbf{Q}$, $\mathbf{D}$, and $f(\bar{\theta})$.
\begin{itemize}