SpECTRE Documentation Coverage Report
Current view: top level - Evolution/DiscontinuousGalerkin/Actions - VolumeTermsImpl.hpp Hit Total Coverage
Commit: f23e75c235cae5144b8ac7ce01280be5b8cd2c8a Lines: 0 1 0.0 %
Date: 2024-09-07 06:21:00
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #pragma once
       5             : 
       6             : #include <cstddef>
       7             : #include <optional>
       8             : #include <ostream>
       9             : 
      10             : #include "DataStructures/DataBox/Prefixes.hpp"
      11             : #include "DataStructures/DataVector.hpp"
      12             : #include "DataStructures/Tensor/TypeAliases.hpp"
      13             : #include "DataStructures/Variables.hpp"
      14             : #include "NumericalAlgorithms/DiscontinuousGalerkin/Formulation.hpp"
      15             : #include "NumericalAlgorithms/LinearOperators/Divergence.hpp"
      16             : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp"
      17             : #include "NumericalAlgorithms/Spectral/Mesh.hpp"
      18             : #include "Utilities/Gsl.hpp"
      19             : #include "Utilities/TMPL.hpp"
      20             : 
      21             : namespace evolution::dg::Actions::detail {
      22             : /*
      23             :  * Computes the volume terms for a discontinuous Galerkin scheme.
      24             :  *
      25             :  * The function does the following (in order):
      26             :  *
      27             :  * 1. Compute the partial derivatives of the `System::gradient_variables`.
      28             :  *
      29             :  *    The partial derivatives are needed in the nonconservative product terms
      30             :  *    of the evolution equations. Any variable whose evolution equation does
      31             :  *    not contain a flux must contain a nonconservative product and the
      32             :  *    variable must be listed in the `System::gradient_variables` type alias.
      33             :  *    The partial derivatives are also needed for adding the moving mesh terms
      34             :  *    to the equations that do not have a flux term.
      35             :  *
      36             :  * 2. The volume time derivatives are calculated from
      37             :  *    `System::compute_volume_time_derivative_terms`
      38             :  *
      39             :  *    The source terms and nonconservative products are contributed directly
      40             :  *    to the `dt_vars` arguments passed to the time derivative function, while
      41             :  *    the volume fluxes are computed into the `volume_fluxes` arguments. The
      42             :  *    divergence of the volume fluxes will be computed and added to the time
      43             :  *    derivatives later in the function.
      44             :  *
      45             :  * 3. If the mesh is moving the appropriate mesh velocity terms are added to
      46             :  *    the equations.
      47             :  *
      48             :  *    For equations with fluxes this means that \f$-v^i_g u_\alpha\f$ is
      49             :  *    added to the fluxes and \f$-u_\alpha \partial_i v^i_g\f$ is added
      50             :  *    to the time derivatives. For equations without fluxes
      51             :  *    \f$v^i\partial_i u_\alpha\f$ is added to the time derivatives.
      52             :  *
      53             :  * 4. Compute flux divergence contribution and add it to the time derivatives.
      54             :  *
      55             :  *    Either the weak or strong form can be used. Currently only the strong
      56             :  *    form is coded, but adding the weak form is quite easy.
      57             :  *
      58             :  *    Note that the computation of the flux divergence and adding that to the
      59             :  *    time derivative must be done *after* the mesh velocity is subtracted
      60             :  *    from the fluxes.
      61             :  */
      62             : template <typename ComputeVolumeTimeDerivativeTerms, size_t Dim,
      63             :           typename... TimeDerivativeArguments, typename... VariablesTags,
      64             :           typename... PartialDerivTags, typename... FluxVariablesTags,
      65             :           typename... TemporaryTags>
      66             : void volume_terms(
      67             :     const gsl::not_null<Variables<tmpl::list<::Tags::dt<VariablesTags>...>>*>
      68             :         dt_vars_ptr,
      69             :     [[maybe_unused]] const gsl::not_null<Variables<tmpl::list<::Tags::Flux<
      70             :         FluxVariablesTags, tmpl::size_t<Dim>, Frame::Inertial>...>>*>
      71             :         volume_fluxes,
      72             :     [[maybe_unused]] const gsl::not_null<Variables<tmpl::list<::Tags::deriv<
      73             :         PartialDerivTags, tmpl::size_t<Dim>, Frame::Inertial>...>>*>
      74             :         partial_derivs,
      75             :     [[maybe_unused]] const gsl::not_null<
      76             :         Variables<tmpl::list<TemporaryTags...>>*>
      77             :         temporaries,
      78             :     [[maybe_unused]] const gsl::not_null<
      79             :         Variables<tmpl::list<::Tags::div<::Tags::Flux<
      80             :             FluxVariablesTags, tmpl::size_t<Dim>, Frame::Inertial>>...>>*>
      81             :         div_fluxes,
      82             :     const Variables<tmpl::list<VariablesTags...>>& evolved_vars,
      83             :     const ::dg::Formulation dg_formulation, const Mesh<Dim>& mesh,
      84             :     [[maybe_unused]] const tnsr::I<DataVector, Dim, Frame::Inertial>&
      85             :         inertial_coordinates,
      86             :     const InverseJacobian<DataVector, Dim, Frame::ElementLogical,
      87             :                           Frame::Inertial>&
      88             :         logical_to_inertial_inverse_jacobian,
      89             :     [[maybe_unused]] const Scalar<DataVector>* const det_inverse_jacobian,
      90             :     const std::optional<tnsr::I<DataVector, Dim, Frame::Inertial>>&
      91             :         mesh_velocity,
      92             :     const std::optional<Scalar<DataVector>>& div_mesh_velocity,
      93             :     const TimeDerivativeArguments&... time_derivative_args);
      94             : }  // namespace evolution::dg::Actions::detail

Generated by: LCOV version 1.14