LiftFlux.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 /// \file
5 /// Defines function lift_flux.
6 
7 #pragma once
8 
9 #include <cstddef>
10 #include <utility>
11 
13 #include "DataStructures/DataVector.hpp"
16 #include "Utilities/TMPL.hpp"
17 
18 namespace dg {
19 /// \ingroup DiscontinuousGalerkinGroup
20 /// \brief Lifts the flux contribution from an interface to the volume.
21 ///
22 /// The lifting operation takes the (d-1)-dimensional flux term at the
23 /// interface and computes the corresponding d-dimensional term in the
24 /// volume. SpECTRE implements an efficient DG method in which each
25 /// interface grid point contributes only to that same grid point of the
26 /// volume.
27 ///
28 /// \details
29 /// SpECTRE implements a DG method with a diagonalized mass matrix (also
30 /// known as a mass-lumping scheme). This choice gives a large
31 /// reduction in the computational cost of the lifting operation, however,
32 /// the scheme is slightly less accurate, especially when the grid is
33 /// deformed by non-trivial Jacobians. For more details on the
34 /// diagonalization of the mass matrix and its implications,
35 /// \cite Teukolsky2015ega, especially Section 3.
36 ///
37 /// \note The result is still provided only on the boundary grid. The
38 /// values away from the boundary are zero and are not stored.
39 template <typename... FluxTags>
40 auto lift_flux(Variables<tmpl::list<FluxTags...>> flux,
41  const size_t extent_perpendicular_to_boundary,
42  Scalar<DataVector> magnitude_of_face_normal) noexcept
43  -> Variables<tmpl::list<db::remove_tag_prefix<FluxTags>...>> {
44  auto lift_factor = std::move(get(magnitude_of_face_normal));
45  lift_factor *= -0.5 * (extent_perpendicular_to_boundary *
46  (extent_perpendicular_to_boundary - 1));
47 
48  Variables<tmpl::list<db::remove_tag_prefix<FluxTags>...>> lifted_data(
49  std::move(flux));
50  lifted_data *= lift_factor;
51  return lifted_data;
52 }
53 } // namespace dg
Definition: InitializeElement.hpp:63
Defines class Variables.
Defines classes for Tensor.
Wraps the template metaprogramming library used (brigand)
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
auto lift_flux(Variables< tmpl::list< FluxTags... >> flux, const size_t extent_perpendicular_to_boundary, Scalar< DataVector > magnitude_of_face_normal) noexcept -> Variables< tmpl::list< db::remove_tag_prefix< FluxTags >... >>
Lifts the flux contribution from an interface to the volume.
Definition: LiftFlux.hpp:40
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21