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 "DataStructures/Tensor/EagerMath/Magnitude.hpp"
14 #include "DataStructures/VariablesTag.hpp"
15 #include "Elliptic/BoundaryConditions/AnalyticSolution.hpp"
16 #include "Elliptic/BoundaryConditions/BoundaryCondition.hpp"
17 #include "Elliptic/Systems/Poisson/Equations.hpp"
18 #include "Elliptic/Systems/Poisson/Geometry.hpp"
21 #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp"
22 #include "Utilities/TMPL.hpp"
23
24 namespace Poisson {
25
26 /*!
27  * \brief The Poisson equation formulated as a set of coupled first-order PDEs.
28  *
29  * \details This system formulates the Poisson equation \f$-\Delta_\gamma u(x) = 30 * f(x)\f$ on a background metric \f$\gamma_{ij}\f$ as the set of coupled
31  * first-order PDEs
32  *
33  * \f[
34  * -\partial_i \gamma^{ij} v_j(x) - \Gamma^i_{ij}\gamma^{jk}v_k = f(x) \\
35  * -\partial_i u(x) + v_i(x) = 0
36  * \f]
37  *
38  * where we have chosen the field gradient as an auxiliary variable \f$v_i\f$
39  * and where \f$\Gamma^i_{jk}=\frac{1}{2}\gamma^{il}\left(\partial_j\gamma_{kl} 40 * +\partial_k\gamma_{jl}-\partial_l\gamma_{jk}\right)\f$ are the Christoffel
41  * symbols of the second kind of the background metric \f$\gamma_{ij}\f$. The
42  * background metric \f$\gamma_{ij}\f$ and the Christoffel symbols derived from
43  * it are assumed to be independent of the variables \f$u\f$ and \f$v_i\f$, i.e.
44  * constant throughout an iterative elliptic solve.
45  *
46  * This scheme also goes by the name of _mixed_ or _flux_ formulation (see e.g.
47  * \cite Arnold2002). The reason for the latter name is that we can write the
48  * set of coupled first-order PDEs in flux-form
49  *
50  * \f[
51  * -\partial_i F^i_A + S_A = f_A(x)
52  * \f]
53  *
54  * by choosing the fluxes and sources in terms of the system variables
55  * \f$u(x)\f$ and \f$v_i(x)\f$ as
56  *
57  * \f{align*}
58  * F^i_u &= \gamma^{ij} v_j(x) \\
59  * S_u &= -\Gamma^i_{ij}\gamma^{jk}v_k \\
60  * f_u &= f(x) \\
61  * F^i_{v_j} &= u \delta^i_j \\
62  * S_{v_j} &= v_j \\
63  * f_{v_j} &= 0 \text{.}
64  * \f}
65  *
66  * Note that we use the system variables to index the fluxes and sources, which
67  * we also do in the code by using DataBox tags.
68  * Also note that we have defined the _fixed sources_ \f$f_A\f$ as those source
69  * terms that are independent of the system variables.
70  *
71  * The fluxes und sources simplify significantly when the background metric is
72  * flat and we employ Cartesian coordinates so \f$\gamma_{ij} = delta_{ij}\f$
73  * and \f$\Gamma^i_{jk} = 0\f$. Set the template parameter BackgroundGeometry
74  * to Poisson::Geometry::FlatCartesian to specialise the system for this case.
75  * Set it to Poisson::Geometry::Curved for the general case.
76  */
77 template <size_t Dim, Geometry BackgroundGeometry>
79  private:
80  using field = Tags::Field;
83
84  public:
85  static constexpr size_t volume_dim = Dim;
86
87  // The physical fields to solve for
88  using primal_fields = tmpl::list<field>;
90  using fields_tag =
92
93  // Tags for the first-order fluxes. We just use the standard Flux prefix
94  // because the fluxes don't have symmetries and we don't need to give them a
95  // particular meaning.
96  using primal_fluxes =
97  tmpl::list<::Tags::Flux<field, tmpl::size_t<Dim>, Frame::Inertial>>;
98  using auxiliary_fluxes = tmpl::list<
100
101  // The variable-independent background fields in the equations
102  using background_fields = tmpl::conditional_t<
103  BackgroundGeometry == Geometry::FlatCartesian, tmpl::list<>,
104  tmpl::list<
107  DataVector>>>;
108  using inv_metric_tag = tmpl::conditional_t<
109  BackgroundGeometry == Geometry::FlatCartesian, void,
111
112  // The system equations formulated as fluxes and sources
113  using fluxes_computer = Fluxes<Dim, BackgroundGeometry>;
114  using sources_computer = Sources<Dim, BackgroundGeometry>;
115
116  // The supported boundary conditions. Boundary conditions can be
117  // factory-created from this base class.
120  Dim, tmpl::list<elliptic::BoundaryConditions::Registrars::
121  AnalyticSolution<FirstOrderSystem>>>;
122
123  // The tag of the operator to compute magnitudes on the manifold, e.g. to
124  // normalize vectors on the faces of an element
125  template <typename Tag>
126  using magnitude_tag =
127  tmpl::conditional_t<BackgroundGeometry == Geometry::FlatCartesian,
130 };
131 } // namespace Poisson
Frame::Inertial
Definition: IndexType.hpp:44
Tags::Variables
Definition: VariablesTag.hpp:21
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:78
Tags::EuclideanMagnitude
Definition: Magnitude.hpp:109
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::NonEuclideanMagnitude
Definition: Magnitude.hpp:124
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: Equations.cpp:16
TMPL.hpp
gr::Tags::InverseSpatialMetric
Inverse of the spatial metric.
Definition: Tags.hpp:33
Tags.hpp