FirstOrderSystem.hpp
Go to the documentation of this file.
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"
13 #include "Elliptic/BoundaryConditions/AnalyticSolution.hpp"
14 #include "Elliptic/BoundaryConditions/BoundaryCondition.hpp"
15 #include "Elliptic/Systems/Poisson/BoundaryConditions/Robin.hpp"
16 #include "Elliptic/Systems/Poisson/Equations.hpp"
17 #include "Elliptic/Systems/Poisson/Geometry.hpp"
20 #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.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[
33  * -\partial_i \gamma^{ij} v_j(x) - \Gamma^i_{ij}\gamma^{jk}v_k = f(x) \\
34  * -\partial_i u(x) + v_i(x) = 0
35  * \f]
36  *
37  * where we have chosen the field gradient as an auxiliary variable \f$v_i\f$
38  * and where \f$\Gamma^i_{jk}=\frac{1}{2}\gamma^{il}\left(\partial_j\gamma_{kl} 39 * +\partial_k\gamma_{jl}-\partial_l\gamma_{jk}\right)\f$ are the Christoffel
40  * symbols of the second kind of the background metric \f$\gamma_{ij}\f$. The
41  * background metric \f$\gamma_{ij}\f$ and the Christoffel symbols derived from
42  * it are assumed to be independent of the variables \f$u\f$ and \f$v_i\f$, i.e.
43  * constant throughout an iterative elliptic solve.
44  *
45  * This scheme also goes by the name of _mixed_ or _flux_ formulation (see e.g.
46  * \cite Arnold2002). The reason for the latter name is that we can write the
47  * set of coupled first-order PDEs in flux-form
48  *
49  * \f[
50  * -\partial_i F^i_A + S_A = f_A(x)
51  * \f]
52  *
53  * by choosing the fluxes and sources in terms of the system variables
54  * \f$u(x)\f$ and \f$v_i(x)\f$ as
55  *
56  * \f{align*}
57  * F^i_u &= \gamma^{ij} v_j(x) \\
58  * S_u &= -\Gamma^i_{ij}\gamma^{jk}v_k \\
59  * f_u &= f(x) \\
60  * F^i_{v_j} &= u \delta^i_j \\
61  * S_{v_j} &= v_j \\
62  * f_{v_j} &= 0 \text{.}
63  * \f}
64  *
65  * Note that we use the system variables to index the fluxes and sources, which
66  * we also do in the code by using DataBox tags.
67  * Also note that we have defined the _fixed sources_ \f$f_A\f$ as those source
68  * terms that are independent of the system variables.
69  *
70  * The fluxes und sources simplify significantly when the background metric is
71  * flat and we employ Cartesian coordinates so \f$\gamma_{ij} = delta_{ij}\f$
72  * and \f$\Gamma^i_{jk} = 0\f$. Set the template parameter BackgroundGeometry
73  * to Poisson::Geometry::FlatCartesian to specialise the system for this case.
74  * Set it to Poisson::Geometry::Curved for the general case.
75  */
76 template <size_t Dim, Geometry BackgroundGeometry>
78  private:
79  using field = Tags::Field;
82
83  public:
84  static constexpr size_t volume_dim = Dim;
85
86  // The physical fields to solve for
87  using primal_fields = tmpl::list<field>;
89
90  // Tags for the first-order fluxes. We just use the standard Flux prefix
91  // because the fluxes don't have symmetries and we don't need to give them a
92  // particular meaning.
93  using primal_fluxes =
94  tmpl::list<::Tags::Flux<field, tmpl::size_t<Dim>, Frame::Inertial>>;
95  using auxiliary_fluxes = tmpl::list<
97
98  // The variable-independent background fields in the equations
99  using background_fields = tmpl::conditional_t<
100  BackgroundGeometry == Geometry::FlatCartesian, tmpl::list<>,
101  tmpl::list<
104  DataVector>>>;
105  using inv_metric_tag = tmpl::conditional_t<
106  BackgroundGeometry == Geometry::FlatCartesian, void,
108
109  // The system equations formulated as fluxes and sources
110  using fluxes_computer = Fluxes<Dim, BackgroundGeometry>;
111  using sources_computer = Sources<Dim, BackgroundGeometry>;
112
113  // The supported boundary conditions. Boundary conditions can be
114  // factory-created from this base class.
117  Dim, tmpl::list<elliptic::BoundaryConditions::Registrars::
118  AnalyticSolution<FirstOrderSystem>,
119  Poisson::BoundaryConditions::Registrars::Robin<Dim>>>;
120 };
121 } // namespace Poisson
Frame::Inertial
Definition: IndexType.hpp:44
Tags::Flux
Prefix indicating a flux.
Definition: Prefixes.hpp:40
Poisson::FirstOrderSystem
The Poisson equation formulated as a set of coupled first-order PDEs.
Definition: FirstOrderSystem.hpp:77
cstddef
gr::Tags::SpatialChristoffelSecondKindContracted
Contraction of the first two indices of the spatial Christoffel symbols: . Useful for covariant diver...
Definition: Tags.hpp:111
elliptic::BoundaryConditions::BoundaryCondition
Base class for boundary conditions for elliptic systems.
Definition: BoundaryCondition.hpp:91
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:46
Poisson::Tags::Field
The scalar field to solve for.
Definition: Tags.hpp:28
Tags::deriv
Prefix indicating spatial derivatives.
Definition: PartialDerivatives.hpp:52
PartialDerivatives.hpp
Prefixes.hpp
Poisson::Geometry::FlatCartesian
@ FlatCartesian
Euclidean (flat) manifold with Cartesian coordinates, i.e. the metric has components in these coordi...
Poisson
Items related to solving a Poisson equation .
Definition: Robin.hpp:21
TMPL.hpp
gr::Tags::InverseSpatialMetric
Inverse of the spatial metric.
Definition: Tags.hpp:33
Tags.hpp