Matrices.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 #pragma once
4 
5 #include <cstddef>
6 
7 /// \cond
8 class DataVector;
9 template <size_t Dim>
10 class Index;
11 class Matrix;
12 template <size_t Dim>
13 class Mesh;
14 /// \endcond
15 
17 /*!
18  * \ingroup DgSubcellGroup
19  * \brief Computes the projection matrix in `Dim` dimensions going from a DG
20  * mesh to a conservative finite difference subcell mesh.
21  */
22 template <size_t Dim>
23 const Matrix& projection_matrix(const Mesh<Dim>& dg_mesh,
24  const Index<Dim>& subcell_extents) noexcept;
25 
26 /*!
27  * \ingroup DgSubcellGroup
28  * \brief Computes the matrix needed for reconstructing the DG solution from
29  * the subcell solution.
30  *
31  * Reconstructing the DG solution from the FD solution is a bit more
32  * involved than projecting the DG solution to the FD subcells. Denoting the
33  * projection operator by \f$\mathcal{P}\f$ and the reconstruction operator by
34  * \f$\mathcal{R}\f$, we desire the property
35  *
36  * \f{align*}{
37  * \mathcal{R}(\mathcal{P}(u_{\breve{\imath}}
38  * J_{\breve{\imath}}))=u_{\breve{\imath}} J_{\breve{\imath}},
39  * \f}
40  *
41  * where \f$\breve{\imath}\f$ denotes a grid point on the DG grid, \f$u\f$ is
42  * the solution on the DG grid, and \f$J\f$ is the determinant of the Jacobian
43  * on the DG grid. We also require that the integral of the conserved variables
44  * over the subcells is equal to the integral over the DG element. That is,
45  *
46  * \f{align*}{
47  * \int_{\Omega}u \,d^3x =\int_{\Omega} \underline{u} \,d^3x \Longrightarrow
48  * \int_{\Omega}u J \,d^3\xi=\int_{\Omega} \underline{u} J \,d^3\xi,
49  * \f}
50  *
51  * where \f$\underline{u}\f$ is the solution on the subcells. Because the number
52  * of subcell points is larger than the number of DG points, we need to solve a
53  * constrained linear least squares problem to reconstruct the DG solution from
54  * the subcells.
55  *
56  * The final reconstruction matrix is given by
57  *
58  * \f{align*}{
59  * R_{\breve{\jmath}\underline{i}}
60  * &=\left\{(2 \mathcal{P}\otimes\mathcal{P})^{-1}2\mathcal{P} - (2
61  * \mathcal{P}\otimes\mathcal{P})^{-1}\vec{w}\left[\mathbf{w}(2
62  * \mathcal{P}\otimes\mathcal{P})^{-1}\vec{w}\right]^{-1}\mathbf{w}(2
63  * \mathcal{P}\otimes\mathcal{P})^{-1}2\mathcal{P}
64  * + (2 \mathcal{P}\otimes\mathcal{P})^{-1}\vec{w}\left[\mathbf{w}(2
65  * \mathcal{P}\otimes\mathcal{P})^{-1}\vec{w}\right]^{-1}\vec{\underline{w}}
66  * \right\}_{\breve{\jmath}\underline{i}},
67  * \f}
68  *
69  * where \f$\vec{w}\f$ is the vector of integration weights on the DG element,
70  * \f$\mathbf{w}=w_{\breve{l}}\delta_{\breve{l}\breve{\jmath}}\f$, and
71  * \f$\vec{\underline{w}}\f$ is the vector of integration weights over the
72  * subcells. The integration weights \f$\vec{\underline{w}}\f$ on the subcells
73  * are those for 6th-order integration on a uniform mesh.
74  */
75 template <size_t Dim>
76 const Matrix& reconstruction_matrix(const Mesh<Dim>& dg_mesh,
77  const Index<Dim>& subcell_extents) noexcept;
78 } // namespace evolution::dg::subcellfd
Matrix
A dynamically sized matrix of doubles with column-major storage.
Definition: Matrix.hpp:19
evolution::dg::subcell::fd::projection_matrix
const Matrix & projection_matrix(const Mesh< Dim > &dg_mesh, const Index< Dim > &subcell_extents) noexcept
Computes the projection matrix in Dim dimensions going from a DG mesh to a conservative finite differ...
Index
Definition: Index.hpp:31
cstddef
evolution::dg::subcell::fd
Code specific to a conservative finite difference subcell limiter.
Definition: DgSubcell.hpp:29
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:46
Mesh
Holds the number of grid points, basis, and quadrature in each direction of the computational grid.
Definition: Mesh.hpp:48
evolution::dg::subcell::fd::reconstruction_matrix
const Matrix & reconstruction_matrix(const Mesh< Dim > &dg_mesh, const Index< Dim > &subcell_extents) noexcept
Computes the matrix needed for reconstructing the DG solution from the subcell solution.