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 <utility> 8 : 9 : #include "DataStructures/DataVector.hpp" 10 : #include "DataStructures/Variables.hpp" 11 : #include "Domain/Structure/Direction.hpp" 12 : #include "Domain/Structure/Side.hpp" 13 : #include "NumericalAlgorithms/Spectral/Mesh.hpp" 14 : #include "NumericalAlgorithms/Spectral/Quadrature.hpp" 15 : #include "NumericalAlgorithms/Spectral/Spectral.hpp" 16 : #include "Utilities/Gsl.hpp" 17 : 18 : namespace dg { 19 : namespace detail { 20 : template <size_t Dim> 21 : void interpolate_dt_terms_gauss_points_impl( 22 : gsl::not_null<double*> volume_dt_vars, size_t num_independent_components, 23 : const Mesh<Dim>& volume_mesh, size_t dimension, size_t num_boundary_pts, 24 : const gsl::span<const double>& dt_corrections, 25 : const DataVector& boundary_interpolation_term); 26 : } // namespace detail 27 : 28 : /*! 29 : * \brief Interpolate the Bjorhus/time derivative corrections to the volume time 30 : * derivatives in the specified direction. 31 : * 32 : * The general interpolation term (for the \f$+\xi\f$-dimension) is: 33 : * 34 : * \f{align*}{ 35 : * \partial_t u_{\alpha\breve{\imath}\breve{\jmath}\breve{k}}=\cdots 36 : * +\ell^{\mathrm{Gauss-Lobatto}}_{N} 37 : * \left(\xi_{\breve{\imath}}^{\mathrm{Gauss}}\right) 38 : * \partial_t u^{\mathrm{BC}}_{\alpha\breve{\jmath}\breve{k}}, 39 : * \f} 40 : * 41 : * where \f$\breve{\imath}\f$, \f$\breve{\jmath}\f$, and \f$\breve{k}\f$ are 42 : * indices in the logical \f$\xi\f$, \f$\eta\f$, and \f$\zeta\f$ dimensions. 43 : * \f$\partial_t u^{\mathrm{BC}}\f$ is the time derivative correction, and 44 : * the function Spectral::boundary_interpolation_term() is used to compute and 45 : * cache the terms from the lifting terms. 46 : */ 47 : template <size_t Dim, typename DtTagsList> 48 1 : void interpolate_dt_terms_gauss_points( 49 : const gsl::not_null<Variables<DtTagsList>*> dt_vars, 50 : const Mesh<Dim>& volume_mesh, const Direction<Dim>& direction, 51 : const Variables<DtTagsList>& dt_corrections) { 52 : ASSERT(std::all_of(volume_mesh.quadrature().begin(), 53 : volume_mesh.quadrature().end(), 54 : [](const Spectral::Quadrature quadrature) { 55 : return quadrature == Spectral::Quadrature::Gauss; 56 : }), 57 : "Must use Gauss points in all directions but got the mesh: " 58 : << volume_mesh); 59 : const Mesh<Dim - 1> boundary_mesh = 60 : volume_mesh.slice_away(direction.dimension()); 61 : const Mesh<1> volume_stripe_mesh = 62 : volume_mesh.slice_through(direction.dimension()); 63 : const size_t num_boundary_grid_points = boundary_mesh.number_of_grid_points(); 64 : detail::interpolate_dt_terms_gauss_points_impl( 65 : make_not_null(dt_vars->data()), dt_vars->number_of_independent_components, 66 : volume_mesh, direction.dimension(), num_boundary_grid_points, 67 : gsl::make_span(dt_corrections.data(), dt_corrections.size()), 68 : direction.side() == Side::Upper 69 : ? Spectral::boundary_interpolation_term(volume_stripe_mesh).second 70 : : Spectral::boundary_interpolation_term(volume_stripe_mesh).first); 71 : } 72 : } // namespace dg