SpECTRE Documentation Coverage Report
Current view: top level - Evolution/DgSubcell - Matrices.hpp Hit Total Coverage
Commit: 3c072f0ce967e2e56649d3fa12aa2a0e4fe2a42e Lines: 3 4 75.0 %
Date: 2024-04-23 20:50:18
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // 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             : enum class Side;
      15             : namespace Spectral {
      16             : enum class Quadrature;
      17             : }  // namespace Spectral
      18             : /// \endcond
      19             : 
      20             : namespace evolution::dg::subcell::fd {
      21             : /*!
      22             :  * \ingroup DgSubcellGroup
      23             :  * \brief Computes the projection matrix in 1 dimension going from a DG
      24             :  * mesh to a conservative finite difference subcell mesh.
      25             :  */
      26           1 : const Matrix& projection_matrix(const Mesh<1>& dg_mesh, size_t subcell_extents,
      27             :                                 const Spectral::Quadrature& subcell_quadrature);
      28             : 
      29             : /*!
      30             :  * \ingroup DgSubcellGroup
      31             :  * \brief Computes the matrix needed for reconstructing the DG solution from
      32             :  * the subcell solution.
      33             :  *
      34             :  * Reconstructing the DG solution from the FD solution is a bit more
      35             :  * involved than projecting the DG solution to the FD subcells. Denoting the
      36             :  * projection operator by \f$\mathcal{P}\f$ and the reconstruction operator by
      37             :  * \f$\mathcal{R}\f$, we desire the property
      38             :  *
      39             :  * \f{align*}{
      40             :  *   \mathcal{R}(\mathcal{P}(u_{\breve{\imath}}
      41             :  *   J_{\breve{\imath}}))=u_{\breve{\imath}} J_{\breve{\imath}},
      42             :  * \f}
      43             :  *
      44             :  * where \f$\breve{\imath}\f$ denotes a grid point on the DG grid, \f$u\f$ is
      45             :  * the solution on the DG grid, and \f$J\f$ is the determinant of the Jacobian
      46             :  * on the DG grid. We also require that the integral of the conserved variables
      47             :  * over the subcells is equal to the integral over the DG element. That is,
      48             :  *
      49             :  * \f{align*}{
      50             :  *   \int_{\Omega}u \,d^3x =\int_{\Omega} \underline{u} \,d^3x \Longrightarrow
      51             :  *   \int_{\Omega}u J \,d^3\xi=\int_{\Omega} \underline{u} J \,d^3\xi,
      52             :  * \f}
      53             :  *
      54             :  * where \f$\underline{u}\f$ is the solution on the subcells. Because the number
      55             :  * of subcell points is larger than the number of DG points, we need to solve a
      56             :  * constrained linear least squares problem to reconstruct the DG solution from
      57             :  * the subcells.
      58             :  *
      59             :  * The final reconstruction matrix is given by
      60             :  *
      61             :  * \f{align*}{
      62             :  *   R_{\breve{\jmath}\underline{i}}
      63             :  *   &=\left\{(2 \mathcal{P}\otimes\mathcal{P})^{-1}2\mathcal{P} - (2
      64             :  *   \mathcal{P}\otimes\mathcal{P})^{-1}\vec{w}\left[\mathbf{w}(2
      65             :  *   \mathcal{P}\otimes\mathcal{P})^{-1}\vec{w}\right]^{-1}\mathbf{w}(2
      66             :  *   \mathcal{P}\otimes\mathcal{P})^{-1}2\mathcal{P}
      67             :  *   + (2 \mathcal{P}\otimes\mathcal{P})^{-1}\vec{w}\left[\mathbf{w}(2
      68             :  *   \mathcal{P}\otimes\mathcal{P})^{-1}\vec{w}\right]^{-1}\vec{\underline{w}}
      69             :  *   \right\}_{\breve{\jmath}\underline{i}},
      70             :  * \f}
      71             :  *
      72             :  * where \f$\vec{w}\f$ is the vector of integration weights on the DG element,
      73             :  * \f$\mathbf{w}=w_{\breve{l}}\delta_{\breve{l}\breve{\jmath}}\f$, and
      74             :  * \f$\vec{\underline{w}}\f$ is the vector of integration weights over the
      75             :  * subcells. The integration weights \f$\vec{\underline{w}}\f$ on the subcells
      76             :  * are those for 6th-order integration on a uniform mesh.
      77             :  */
      78             : template <size_t Dim>
      79           1 : const Matrix& reconstruction_matrix(const Mesh<Dim>& dg_mesh,
      80             :                                     const Index<Dim>& subcell_extents);
      81             : 
      82             : /*!
      83             :  * \ingroup DgSubcellGroup
      84             :  * \brief Computes the projection matrix in 1 dimension going from a DG
      85             :  * mesh to a conservative finite difference subcell mesh for only the ghost
      86             :  * zones.
      87             :  *
      88             :  * This is used when a neighbor sends DG volume data and we need to switch to
      89             :  * FD. In this case we need to project the DG volume data onto the ghost zone
      90             :  * cells.
      91             :  *
      92             :  * \note Currently assumes a max ghost zone size of `5` and a minimum ghost zone
      93             :  * size of 2.
      94             :  */
      95           1 : const Matrix& projection_matrix(const Mesh<1>& dg_mesh, size_t subcell_extents,
      96             :                                 size_t ghost_zone_size, Side side);
      97             : }  // namespace evolution::dg::subcellfd

Generated by: LCOV version 1.14