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"
12 #include "DataStructures/Tensor/EagerMath/Magnitude.hpp"
13 #include "DataStructures/VariablesTag.hpp"
14 #include "Elliptic/Systems/Poisson/Equations.hpp"
15 #include "Elliptic/Systems/Poisson/Geometry.hpp"
19 #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp"
20 #include "Utilities/TMPL.hpp"
21
22 /// \cond
23 namespace LinearSolver {
24 namespace Tags {
25 template <typename>
26 struct Operand;
27 } // namespace Tags
28 } // namespace LinearSolver
29 /// \endcond
30
31 namespace Poisson {
32
33 /*!
34  * \brief The Poisson equation formulated as a set of coupled first-order PDEs.
35  *
36  * \details This system formulates the Poisson equation \f$-\Delta_\gamma u(x) = 37 * f(x)\f$ on a background metric \f$\gamma_{ij}\f$ as the set of coupled
38  * first-order PDEs
39  *
40  * \f[
41  * -\frac{1}{\sqrt{\gamma}} \partial_i \sqrt{\gamma}\gamma^{ij} v_j(x) = f(x) \\
42  * -\partial_i u(x) + v_i(x) = 0
43  * \f]
44  *
45  * where we have chosen the field gradient as an auxiliary variable \f$v_i\f$.
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 &= \sqrt{\gamma}\gamma^{ij} v_j(x) \\
59  * S_u &= 0 \\
60  * f_u &= \sqrt{\gamma} 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 field gradient \f$v_i\f$ is treated on the same footing as the field
72  * \f$u\f$ in this first-order formulation. This allows us to make use of the DG
73  * architecture developed for coupled first-order hyperbolic PDEs in flux-form,
74  * in particular the flux communication and lifting code. It does, however,
75  * introduce auxiliary degrees of freedom that can be avoided in the
76  * second-order (or _primal_) formulation. Furthermore, the linear operator that
77  * represents the DG discretization for this system is not symmetric. This
78  * property further increase the computational cost (see \ref LinearSolverGroup)
79  * and is remedied in the second-order formulation.
80  */
81 template <size_t Dim, Geometry BackgroundGeometry>
83  private:
84  using field = Tags::Field;
87
88  public:
89  static constexpr size_t volume_dim = Dim;
90
91  // The physical fields to solve for
92  using primal_fields = tmpl::list<field>;
94  using fields_tag =
96
97  // The variables to compute bulk contributions and fluxes for.
98  using variables_tag =
100  using primal_variables =
102  using auxiliary_variables =
104
105  using fluxes =
106  tmpl::conditional_t<BackgroundGeometry == Geometry::Euclidean,
108  using sources = Sources;
109
110  // The tag of the operator to compute magnitudes on the manifold, e.g. to
111  // normalize vectors on the faces of an element
112  template <typename Tag>
113  using magnitude_tag = tmpl::conditional_t<
114  BackgroundGeometry == Geometry::Euclidean,
118 };
119 } // namespace Poisson
Wrap Tag in Prefix<_, Args...>, also wrapping variables tags if Tag is a Tags::Variables.
Definition: PrefixHelpers.hpp:145
Definition: VariablesTag.hpp:21
Functionality for solving linear systems of equations.
Definition: TerminateIfConverged.hpp:22
The Euclidean magnitude of a (co)vector.
Definition: Magnitude.hpp:94
Items related to solving a Poisson equation .
Definition: Equations.cpp:15
tmpl::transform< TagList, tmpl::bind< Wrapper, tmpl::_1, tmpl::pin< Args >... > > wrap_tags_in
Create a new list of Tags by wrapping each tag in TagList using the Wrapper.
Definition: PrefixHelpers.hpp:30
Prefix indicating spatial derivatives.
Definition: PartialDerivatives.hpp:54
Compute the sources for the Poisson equation.
Definition: Equations.hpp:118
Compute the fluxes for the curved-space Poisson equation on a spatial metric .
Definition: Equations.hpp:87
Defines DataBox tags for the Poisson system.
Definition: Tags.hpp:26
Compute the fluxes for the Poisson equation on a flat metric in Cartesian coordinates.
Definition: Equations.hpp:61
Defines functions computing partial derivatives.
Definition: DataBoxTag.hpp:27
The Poisson equation formulated as a set of coupled first-order PDEs.
Definition: FirstOrderSystem.hpp:82
Wraps the template metaprogramming library used (brigand)
The scalar field to solve for.
Definition: Tags.hpp:28
The magnitude of a (co)vector with respect to a specific metric.
Definition: Magnitude.hpp:107
Definition: IndexType.hpp:44
Defines DataBox tags for the linear solver.