SpECTRE Documentation Coverage Report
Current view: top level - Domain - TagsCharacteristicSpeeds.hpp Hit Total Coverage
Commit: 3c072f0ce967e2e56649d3fa12aa2a0e4fe2a42e Lines: 1 7 14.3 %
Date: 2024-04-23 20:50:18
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 <array>
       7             : #include <cstddef>
       8             : #include <optional>
       9             : 
      10             : #include "DataStructures/DataVector.hpp"
      11             : #include "DataStructures/Tensor/EagerMath/DotProduct.hpp"
      12             : #include "DataStructures/Tensor/EagerMath/Magnitude.hpp"  // For Tags::Normalized
      13             : #include "DataStructures/Tensor/Tensor.hpp"
      14             : #include "Domain/InterfaceHelpers.hpp"
      15             : #include "Domain/Tags.hpp"
      16             : #include "Domain/TagsTimeDependent.hpp"
      17             : #include "Utilities/Gsl.hpp"
      18             : #include "Utilities/TMPL.hpp"
      19             : 
      20             : namespace domain {
      21             : namespace Tags {
      22             : /// Compute the characteristic speeds on the moving mesh given the
      23             : /// characteristic speeds if the mesh were stationary.
      24             : ///
      25             : /// \note Assumes that `typename CharSpeedsComputeTag::return_type` is a
      26             : /// `std::array<DataVector, NumberOfCharSpeeds>`
      27             : template <typename CharSpeedsComputeTag, size_t Dim>
      28           1 : struct CharSpeedCompute : CharSpeedsComputeTag::base, db::ComputeTag {
      29           0 :   using base = typename CharSpeedsComputeTag::base;
      30           0 :   using return_type = typename CharSpeedsComputeTag::return_type;
      31             : 
      32             :   template <typename... Ts, typename T, size_t NumberOfCharSpeeds>
      33           0 :   static void function(
      34             :       const gsl::not_null<std::array<T, NumberOfCharSpeeds>*> result,
      35             :       const std::optional<tnsr::I<DataVector, Dim, Frame::Inertial>>&
      36             :           grid_velocity,
      37             :       const tnsr::i<DataVector, Dim, Frame::Inertial>& unit_normal_covector,
      38             :       const Ts&... ts) {
      39             :     // Note that while the CharSpeedsComputeTag almost certainly also needs the
      40             :     // unit normal covector for computing the original characteristic speeds, we
      41             :     // don't know which of the `ts` it is, and thus we need the unit normal
      42             :     // covector to be passed explicitly.
      43             :     CharSpeedsComputeTag::function(result, ts...);
      44             :     if (grid_velocity.has_value()) {
      45             :       const Scalar<DataVector> normal_dot_velocity =
      46             :           dot_product(*grid_velocity, unit_normal_covector);
      47             :       for (size_t i = 0; i < result->size(); ++i) {
      48             :         gsl::at(*result, i) -= get(normal_dot_velocity);
      49             :       }
      50             :     }
      51             :   }
      52             : 
      53           0 :   using argument_tags =
      54             :       tmpl::push_front<typename CharSpeedsComputeTag::argument_tags,
      55             :                        MeshVelocity<Dim, Frame::Inertial>,
      56             :                        ::Tags::Normalized<UnnormalizedFaceNormal<Dim>>>;
      57           0 :   using volume_tags = get_volume_tags<CharSpeedsComputeTag>;
      58             : };
      59             : }  // namespace Tags
      60             : }  // namespace domain

Generated by: LCOV version 1.14