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 <iosfwd> 8 : #include <optional> 9 : 10 : #include "DataStructures/DataVector.hpp" 11 : #include "Evolution/DiscontinuousGalerkin/InterpolatedBoundaryData.hpp" 12 : #include "NumericalAlgorithms/Spectral/Mesh.hpp" 13 : #include "Time/TimeStepId.hpp" 14 : 15 : /// \cond 16 : namespace gsl { 17 : template <class T> 18 : class not_null; 19 : } // namespace gsl 20 : /// \endcond 21 : 22 : namespace evolution::dg { 23 : /*! 24 : * \brief The data communicated between neighber elements. 25 : * 26 : * The stored data consists of the following: 27 : * 28 : * 1. the volume mesh of the element. 29 : * 2. the volume mesh corresponding to the ghost cell data. This allows eliding 30 : * projection when all neighboring elements are doing DG. 31 : * 3. the mortar mesh of the data on the mortar 32 : * 4. the variables at the ghost zone cells for finite difference/volume 33 : * reconstruction 34 : * 5. the data on the mortar needed for computing the boundary corrections (e.g. 35 : * fluxes, characteristic speeds, conserved variables) 36 : * 6. the TimeStepId beyond which the boundary terms are no longer valid, when 37 : * using local time stepping. 38 : * 7. the troubled cell indicator status used for determining halos around 39 : * troubled cells. 40 : * 8. the integration order of the time-stepper 41 : * 9. the InterpolatedBoundaryData sent by a non-conforming Element that 42 : * interpolates its data to a subset of the points of the Element receiving 43 : * this BoundaryData 44 : */ 45 : template <size_t Dim> 46 1 : struct BoundaryData { 47 : // NOLINTNEXTLINE(google-runtime-references) 48 0 : void pup(PUP::er& p); 49 : 50 0 : Mesh<Dim> volume_mesh{}; 51 0 : std::optional<Mesh<Dim>> volume_mesh_ghost_cell_data{}; 52 0 : std::optional<Mesh<Dim - 1>> boundary_correction_mesh{}; 53 0 : std::optional<DataVector> ghost_cell_data{}; 54 0 : std::optional<DataVector> boundary_correction_data{}; 55 0 : ::TimeStepId validity_range{}; 56 0 : int tci_status{}; 57 0 : size_t integration_order{std::numeric_limits<size_t>::max()}; 58 0 : std::optional<InterpolatedBoundaryData<Dim>> interpolated_boundary_data{}; 59 : }; 60 : 61 : template <size_t Dim> 62 0 : bool operator==(const BoundaryData<Dim>& lhs, const BoundaryData<Dim>& rhs); 63 : template <size_t Dim> 64 0 : bool operator!=(const BoundaryData<Dim>& lhs, const BoundaryData<Dim>& rhs); 65 : template <size_t Dim> 66 0 : std::ostream& operator<<(std::ostream& os, const BoundaryData<Dim>& value); 67 : 68 : /*! 69 : * \brief Merge DG boundary correction data into an existing 70 : * BoundaryData object. 71 : * 72 : * In a 2-send implementation, we can receive DG boundary correction 73 : * data at a time for which we have already received ghost cell data. 74 : * This function sanity checks that the data we already have is the 75 : * ghost cells and then copes in the DG data. 76 : * 77 : * \note We do not currently use a 2-send implementation. We 78 : * generally find that the number of communications is more important 79 : * than the size of each communication, and so a single communication 80 : * per time/sub step is preferred. 81 : */ 82 : template <size_t Dim> 83 1 : void merge_boundary_data(gsl::not_null<BoundaryData<Dim>*> destination, 84 : BoundaryData<Dim> source); 85 : } // namespace evolution::dg