SpECTRE Documentation Coverage Report
Current view: top level - Elliptic/Systems/Poisson - FirstOrderSystem.hpp Hit Total Coverage
Commit: 1c32b58340e006addc79befb2cdaa7547247e09c Lines: 2 10 20.0 %
Date: 2024-04-19 07:30:15
Legend: Lines: hit not hit

          Line data    Source code
       1           1 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : /// \file
       5             : /// Defines class Poisson::FirstOrderSystem
       6             : 
       7             : #pragma once
       8             : 
       9             : #include <cstddef>
      10             : 
      11             : #include "DataStructures/DataBox/PrefixHelpers.hpp"
      12             : #include "DataStructures/DataBox/Prefixes.hpp"
      13             : #include "Elliptic/BoundaryConditions/BoundaryCondition.hpp"
      14             : #include "Elliptic/Protocols/FirstOrderSystem.hpp"
      15             : #include "Elliptic/Systems/Poisson/Equations.hpp"
      16             : #include "Elliptic/Systems/Poisson/Geometry.hpp"
      17             : #include "Elliptic/Systems/Poisson/Tags.hpp"
      18             : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp"
      19             : #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp"
      20             : #include "Utilities/ProtocolHelpers.hpp"
      21             : #include "Utilities/TMPL.hpp"
      22             : 
      23             : namespace Poisson {
      24             : 
      25             : /*!
      26             :  * \brief The Poisson equation formulated as a set of coupled first-order PDEs.
      27             :  *
      28             :  * \details This system formulates the Poisson equation \f$-\Delta_\gamma u(x) =
      29             :  * f(x)\f$ on a background metric \f$\gamma_{ij}\f$ as the set of coupled
      30             :  * first-order PDEs
      31             :  *
      32             :  * \f{align*}
      33             :  * -\partial_i v^i - \Gamma^i_{ij} v^j = f(x) \\
      34             :  * v^i = \gamma^{ij} \partial_j u(x)
      35             :  * \f}
      36             :  *
      37             :  * where \f$\Gamma^i_{jk}=\frac{1}{2}\gamma^{il}\left(\partial_j\gamma_{kl}
      38             :  * +\partial_k\gamma_{jl}-\partial_l\gamma_{jk}\right)\f$ are the Christoffel
      39             :  * symbols of the second kind of the background metric \f$\gamma_{ij}\f$. The
      40             :  * background metric \f$\gamma_{ij}\f$ and the Christoffel symbols derived from
      41             :  * it are assumed to be independent of the variables \f$u\f$, i.e.
      42             :  * constant throughout an iterative elliptic solve.
      43             :  *
      44             :  * The system can be formulated in terms of these fluxes and sources (see
      45             :  * `elliptic::protocols::FirstOrderSystem`):
      46             :  *
      47             :  * \f{align*}
      48             :  * F^i &= v^i = \gamma^{ij} \partial_j u \\
      49             :  * S &= -\Gamma^i_{ij} v^j \\
      50             :  * f &= f(x) \text{.}
      51             :  * \f}
      52             :  *
      53             :  * The fluxes and sources simplify significantly when the background metric is
      54             :  * flat and we employ Cartesian coordinates so \f$\gamma_{ij} = \delta_{ij}\f$
      55             :  * and \f$\Gamma^i_{jk} = 0\f$. Set the template parameter `BackgroundGeometry`
      56             :  * to `Poisson::Geometry::FlatCartesian` to specialise the system for this case.
      57             :  * Set it to `Poisson::Geometry::Curved` for the general case.
      58             :  */
      59             : template <size_t Dim, Geometry BackgroundGeometry>
      60           1 : struct FirstOrderSystem
      61             :     : tt::ConformsTo<elliptic::protocols::FirstOrderSystem> {
      62           0 :   static constexpr size_t volume_dim = Dim;
      63             : 
      64           0 :   using primal_fields = tmpl::list<Tags::Field>;
      65             :   // We just use the standard `Flux` prefix because the fluxes don't have
      66             :   // symmetries and we don't need to give them a particular meaning.
      67           0 :   using primal_fluxes =
      68             :       tmpl::list<::Tags::Flux<Tags::Field, tmpl::size_t<Dim>, Frame::Inertial>>;
      69             : 
      70           0 :   using background_fields = tmpl::conditional_t<
      71             :       BackgroundGeometry == Geometry::FlatCartesian, tmpl::list<>,
      72             :       tmpl::list<
      73             :           gr::Tags::InverseSpatialMetric<DataVector, Dim>,
      74             :           gr::Tags::SpatialChristoffelSecondKindContracted<DataVector, Dim>>>;
      75           0 :   using inv_metric_tag =
      76             :       tmpl::conditional_t<BackgroundGeometry == Geometry::FlatCartesian, void,
      77             :                           gr::Tags::InverseSpatialMetric<DataVector, Dim>>;
      78             : 
      79           0 :   using fluxes_computer = Fluxes<Dim, BackgroundGeometry>;
      80           0 :   using sources_computer =
      81             :       tmpl::conditional_t<BackgroundGeometry == Geometry::FlatCartesian, void,
      82             :                           Sources<Dim, BackgroundGeometry>>;
      83             : 
      84           0 :   using boundary_conditions_base =
      85             :       elliptic::BoundaryConditions::BoundaryCondition<Dim>;
      86             : };
      87             : }  // namespace Poisson

Generated by: LCOV version 1.14