HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
Contains the function to assemble the preconditioning matrix. More...
#include <stdio.h>
#include <arrayfunctions.h>
#include <simulation_object.h>
#include <mpivars_cpp.h>
#include <petscinterface.h>
Go to the source code of this file.
Macros | |
#define | __FUNCT__ "PetscComputePreconMatImpl" |
Functions | |
int | PetscComputePreconMatImpl (Mat Pmat, Vec Y, void *ctxt) |
Contains the function to assemble the preconditioning matrix.
Definition in file PetscComputePreconMatImpl.cpp.
#define __FUNCT__ "PetscComputePreconMatImpl" |
Definition at line 15 of file PetscComputePreconMatImpl.cpp.
int PetscComputePreconMatImpl | ( | Mat | Pmat, |
Vec | Y, | ||
void * | ctxt | ||
) |
Compute and assemble the preconditioning matrix for the implicit time integration of the governing equations: The ODE, obtained after discretizing the governing PDE in space, is expressed as follows:
\begin{equation} \frac {d{\bf U}}{dt} = {\bf L}\left({\bf U}\right) \Rightarrow \frac {d{\bf U}}{dt} - {\bf L}\left({\bf U}\right) = 0, \end{equation}
where \({\bf L}\) is the spatially discretized right-hand-side, and \({\bf U}\) represents the entire solution vector.
The Jacobian is thus given by:
\begin{equation} {\bf J} = \left[\alpha{\bf I} - \frac {\partial {\bf L}} {\partial {\bf U}} \right] \end{equation}
where \(\alpha\) is the shift coefficient (PETScContext::shift) of the time integration method.
Let \(\mathcal{D}_{\rm hyp}\) and \(\mathcal{D}_{\rm par}\) represent the spatial discretization methods for the hyperbolic and parabolic terms. Thus, the Jacobian can be written as follows:
\begin{equation} {\bf J} = \left[\alpha{\bf I} - \left(\mathcal{D}_{\rm hyp}\left\{\frac {\partial {\bf F}_{\rm hyp}} {\partial {\bf u}}\right\} + \mathcal{D}_{\rm par}\left\{\frac {\partial {\bf F}_{\rm par}} {\partial {\bf u}}\right\}\right)\right] \end{equation}
The preconditioning matrix is usually a close approximation of the actual Jacobian matrix, where the actual Jacobian may be too expensive to evaluate and assemble. In this function, the preconditioning matrix is the following approximation of the actual Jacobian:
\begin{equation} {\bf J}_p = \left[\alpha{\bf I} - \left(\mathcal{D}^{\left(l\right)}_{\rm hyp}\left\{\frac {\partial {\bf F}_{\rm hyp}} {\partial {\bf u}}\right\} + \mathcal{D}^{\left(l\right)}_{\rm par}\left\{\frac {\partial {\bf F}_{\rm par}} {\partial {\bf u}}\right\}\right) \right] \approx {\bf J}, \end{equation}
where \(\mathcal{D}^{\left(l\right)}_{\rm hyp,par}\) represent lower order discretizations of the hyperbolic and parabolic terms. The matrix \({\bf J}_p\) is provided to the preconditioner.
Note that the specific physics model provides the following functions:
Currently, this function doesn't include the source term.
Pmat | Preconditioning matrix to construct |
Y | Solution vector |
ctxt | Application context |
Definition at line 59 of file PetscComputePreconMatImpl.cpp.