InitializeElement.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <array>
7 #include <cstddef>
8 #include <cstdint>
9 #include <tuple>
10 #include <utility> // IWYU pragma: keep
11 #include <vector>
12 
16 #include "DataStructures/Index.hpp"
17 #include "DataStructures/Tensor/EagerMath/Magnitude.hpp" // IWYU pragma: keep
18 #include "DataStructures/Variables.hpp" // IWYU pragma: keep
19 #include "Domain/Mesh.hpp"
20 #include "Domain/MinimumGridSpacing.hpp"
21 // IWYU pragma: no_include "DataStructures/VariablesHelpers.hpp"
22 #include "Domain/CreateInitialElement.hpp"
23 #include "Domain/Domain.hpp"
24 #include "Domain/Element.hpp"
25 #include "Domain/ElementId.hpp"
26 #include "Domain/ElementMap.hpp"
27 #include "Domain/FaceNormal.hpp"
28 #include "Domain/LogicalCoordinates.hpp" // IWYU pragma: keep
29 #include "Domain/OrientationMap.hpp" // IWYU pragma: keep
30 #include "Domain/SizeOfElement.hpp"
31 #include "Domain/Tags.hpp"
32 #include "ErrorHandling/Assert.hpp"
33 #include "Evolution/Conservative/Tags.hpp" // IWYU pragma: keep
34 #include "NumericalAlgorithms/DiscontinuousGalerkin/FluxCommunicationTypes.hpp"
35 #include "NumericalAlgorithms/DiscontinuousGalerkin/MortarHelpers.hpp"
36 #include "NumericalAlgorithms/DiscontinuousGalerkin/Tags.hpp"
37 #include "NumericalAlgorithms/LinearOperators/Divergence.hpp" // IWYU pragma: keep
41 #include "PointwiseFunctions/AnalyticSolutions/Tags.hpp"
42 #include "Time/Slab.hpp"
43 #include "Time/Tags.hpp"
44 #include "Time/Time.hpp"
45 #include "Time/TimeId.hpp"
46 #include "Utilities/Gsl.hpp"
47 #include "Utilities/Requires.hpp"
48 #include "Utilities/TMPL.hpp"
49 
50 /// \cond
51 // IWYU pragma: no_forward_declare db::DataBox
52 template <size_t VolumeDim>
53 class ElementIndex;
54 namespace Frame {
55 struct Inertial;
56 } // namespace Frame
57 namespace tuples {
58 template <typename... Tags>
59 class TaggedTuple; // IWYU pragma: keep
60 } // namespace tuples
61 /// \endcond
62 
63 namespace dg {
64 namespace Actions {
65 /// \ingroup ActionsGroup
66 /// \ingroup DiscontinuousGalerkinGroup
67 /// \brief Initialize a dG element with analytic initial data
68 ///
69 /// Uses:
70 /// - ConstGlobalCache:
71 /// * A tag deriving off of Cache::AnalyticSolutionBase
72 /// * OptionTags::TimeStepper
73 ///
74 /// DataBox changes:
75 /// - Adds:
76 /// * Tags::TimeId
77 /// * Tags::Time
78 /// * Tags::TimeStep
79 /// * Tags::LogicalCoordinates<Dim>
80 /// * Tags::Mesh<Dim>
81 /// * Tags::Element<Dim>
82 /// * Tags::ElementMap<Dim>
83 /// * System::variables_tag
84 /// * Tags::HistoryEvolvedVariables<System::variables_tag,
85 /// db::add_tag_prefix<Tags::dt, System::variables_tag>>
86 /// * Tags::Coordinates<Tags::ElementMap<Dim>,
87 /// Tags::LogicalCoordinates<Dim>>
88 /// * Tags::InverseJacobian<Tags::ElementMap<Dim>,
89 /// Tags::LogicalCoordinates<Dim>>
90 /// * Tags::deriv<System::gradients_tags>
91 /// * db::add_tag_prefix<Tags::dt, System::variables_tag>
92 /// * Tags::UnnormalizedFaceNormal<Dim>
93 /// - Removes: nothing
94 /// - Modifies: nothing
95 template <size_t Dim>
97  static Mesh<Dim> element_mesh(
98  const std::vector<std::array<size_t, Dim>>& initial_extents,
99  const ElementId<Dim>& element_id,
100  const OrientationMap<Dim>& orientation = {}) noexcept {
101  const auto& unoriented_extents = initial_extents[element_id.block_id()];
102  Index<Dim> extents;
103  for (size_t i = 0; i < Dim; ++i) {
104  extents[i] = gsl::at(unoriented_extents, orientation(i));
105  }
106  return {extents.indices(), Spectral::Basis::Legendre,
107  Spectral::Quadrature::GaussLobatto};
108  }
109 
110  // Items related to the basic structure of the domain
111  struct DomainTags {
112  using simple_tags =
115 
116  using compute_tags = db::AddComputeTags<
119  Tags::LogicalCoordinates<Dim>>,
121  Tags::LogicalCoordinates<Dim>>,
123 
124  template <typename TagsList>
125  static auto initialize(
126  db::DataBox<TagsList>&& box, const ElementIndex<Dim>& array_index,
127  const std::vector<std::array<size_t, Dim>>& initial_extents,
128  const Domain<Dim, Frame::Inertial>& domain) noexcept {
129  const ElementId<Dim> element_id{array_index};
130  const auto& my_block = domain.blocks()[element_id.block_id()];
131  Mesh<Dim> mesh = element_mesh(initial_extents, element_id);
132  Element<Dim> element = create_initial_element(element_id, my_block);
134  element_id, my_block.coordinate_map().get_clone()};
135 
136  return db::create_from<db::RemoveTags<>, simple_tags, compute_tags>(
137  std::move(box), std::move(mesh), std::move(element), std::move(map));
138  }
139  };
140 
141  // Tags related only to the system
142  template <typename System, bool IsInFluxConservativeForm =
143  System::is_in_flux_conservative_form>
144  struct SystemTags {
146 
147  using compute_tags = db::AddComputeTags<>;
148 
149  template <typename TagsList, typename Metavariables>
150  static auto initialize(
151  db::DataBox<TagsList>&& box,
153  const double initial_time) noexcept {
154  using Vars = typename System::variables_tag::type;
155 
156  const size_t num_grid_points =
157  db::get<Tags::Mesh<Dim>>(box).number_of_grid_points();
158  const auto& inertial_coords =
159  db::get<Tags::Coordinates<Dim, Frame::Inertial>>(box);
160 
161  // Set initial data from analytic solution
162  using solution_tag = OptionTags::AnalyticSolutionBase;
163  Vars vars{num_grid_points};
164  vars.assign_subset(Parallel::get<solution_tag>(cache).variables(
165  inertial_coords, initial_time, typename Vars::tags_list{}));
166 
167  return db::create_from<db::RemoveTags<>, simple_tags, compute_tags>(
168  std::move(box), std::move(vars));
169  }
170  };
171 
172  template <typename System>
173  struct SystemTags<System, true> {
174  using variables_tag = typename System::variables_tag;
175  using fluxes_tag = db::add_tag_prefix<Tags::Flux, variables_tag,
176  tmpl::size_t<Dim>, Frame::Inertial>;
178 
179  using simple_tags =
181 
182  using compute_tags = db::AddComputeTags<>;
183 
184  template <typename TagsList, typename Metavariables>
185  static auto initialize(
186  db::DataBox<TagsList>&& box,
188  const double initial_time) noexcept {
189  using Vars = typename System::variables_tag::type;
190 
191  const size_t num_grid_points =
192  db::get<Tags::Mesh<Dim>>(box).number_of_grid_points();
193  const auto& inertial_coords =
194  db::get<Tags::Coordinates<Dim, Frame::Inertial>>(box);
195 
196  // Set initial data from analytic solution
197  using solution_tag = OptionTags::AnalyticSolutionBase;
198  Vars vars{num_grid_points};
199  vars.assign_subset(Parallel::get<solution_tag>(cache).variables(
200  inertial_coords, initial_time, typename Vars::tags_list{}));
201 
202  // Will be set before use
203  typename fluxes_tag::type fluxes(num_grid_points);
204  typename sources_tag::type sources(num_grid_points);
205 
206  return db::create_from<db::RemoveTags<>, simple_tags, compute_tags>(
207  std::move(box), std::move(vars), std::move(fluxes),
208  std::move(sources));
209  }
210  };
211 
212  // Items related to the structure of the interfaces
213  template <typename System>
215  using simple_tags =
217  typename System::variables_tag>>;
218 
219  template <typename Directions>
220  using face_tags = tmpl::list<
221  Directions,
225  Tags::InterfaceComputeItem<Directions,
227  Tags::InterfaceComputeItem<Directions,
228  typename System::template magnitude_tag<
229  Tags::UnnormalizedFaceNormal<Dim>>>,
232 
233  using ext_tags = tmpl::list<
237  Tags::InterfaceComputeItem<Tags::BoundaryDirectionsExterior<Dim>,
239  Tags::InterfaceComputeItem<Tags::BoundaryDirectionsExterior<Dim>,
241  Tags::InterfaceComputeItem<Tags::BoundaryDirectionsExterior<Dim>,
242  Tags::UnnormalizedFaceNormal<Dim>>,
243  Tags::InterfaceComputeItem<Tags::BoundaryDirectionsExterior<Dim>,
244  typename System::template magnitude_tag<
245  Tags::UnnormalizedFaceNormal<Dim>>>,
247  Tags::BoundaryDirectionsExterior<Dim>,
248  Tags::Normalized<Tags::UnnormalizedFaceNormal<Dim>>>>;
249 
250  using compute_tags =
251  tmpl::append<face_tags<Tags::InternalDirections<Dim>>,
252  face_tags<Tags::BoundaryDirectionsInterior<Dim>>,
253  ext_tags>;
254 
255  template <typename TagsList>
256  static auto initialize(db::DataBox<TagsList>&& box) noexcept {
257  const auto& mesh = db::get<Tags::Mesh<Dim>>(box);
260  external_boundary_vars{};
261 
262  for (const auto& direction :
263  db::get<Tags::Element<Dim>>(box).external_boundaries()) {
264  external_boundary_vars[direction] =
266  mesh.slice_away(direction.dimension()).number_of_grid_points()};
267  }
268 
269  return db::create_from<db::RemoveTags<>, simple_tags, compute_tags>(
270  std::move(box), std::move(external_boundary_vars));
271  }
272  };
273 
274  // Tags related to time-evolution of the system.
275  template <typename System>
276  struct EvolutionTags {
277  using variables_tag = typename System::variables_tag;
278  using dt_variables_tag = db::add_tag_prefix<Tags::dt, variables_tag>;
279 
280  using simple_tags = db::AddSimpleTags<
282  dt_variables_tag,
284 
285  template <typename LocalSystem,
286  bool IsInFluxConservativeForm =
287  LocalSystem::is_in_flux_conservative_form>
288  struct ComputeTags {
289  using type = db::AddComputeTags<
291  variables_tag,
294  typename System::gradients_tags>>;
295  };
296 
297  template <typename LocalSystem>
298  struct ComputeTags<LocalSystem, true> {
299  using type = db::AddComputeTags<
300  Tags::Time,
306  };
307 
308  using compute_tags = typename ComputeTags<System>::type;
309 
310  // Global time stepping
311  template <typename Metavariables,
313  static TimeDelta get_initial_time_step(
314  const Time& initial_time, const double initial_dt_value,
315  const Parallel::ConstGlobalCache<Metavariables>& /*cache*/) noexcept {
316  return (initial_dt_value > 0.0 ? 1 : -1) * initial_time.slab().duration();
317  }
318 
319  // Local time stepping
320  template <typename Metavariables,
322  static TimeDelta get_initial_time_step(
323  const Time& initial_time, const double initial_dt_value,
324  const Parallel::ConstGlobalCache<Metavariables>& cache) noexcept {
325  const auto& step_controller =
326  Parallel::get<OptionTags::StepController>(cache);
327  return step_controller.choose_step(initial_time, initial_dt_value);
328  }
329 
330  template <typename TagsList, typename Metavariables>
331  static auto initialize(
332  db::DataBox<TagsList>&& box,
334  const double initial_time_value, const double initial_dt_value,
335  const double initial_slab_size) noexcept {
336  using DtVars = typename dt_variables_tag::type;
337 
338  const size_t num_grid_points =
339  db::get<Tags::Mesh<Dim>>(box).number_of_grid_points();
340 
341  // Will be overwritten before use
342  DtVars dt_vars{num_grid_points};
343 
344  const bool time_runs_forward = initial_dt_value > 0.0;
345  const Slab initial_slab =
346  time_runs_forward ? Slab::with_duration_from_start(initial_time_value,
347  initial_slab_size)
348  : Slab::with_duration_to_end(initial_time_value,
349  initial_slab_size);
350  const Time initial_time =
351  time_runs_forward ? initial_slab.start() : initial_slab.end();
352  const TimeDelta initial_dt =
353  get_initial_time_step(initial_time, initial_dt_value, cache);
354 
355  const auto& time_stepper = Parallel::get<OptionTags::TimeStepper>(cache);
356 
357  typename Tags::HistoryEvolvedVariables<variables_tag,
358  dt_variables_tag>::type history;
359  // This is stored as Tags::Next<Tags::TimeId> and will be used
360  // to update Tags::TimeId at the start of the algorithm.
361  //
362  // The slab number is increased in the self-start phase each
363  // time one order of accuracy is obtained, and the evolution
364  // proper starts with slab 0.
365  const TimeId time_id =
366  TimeId(time_runs_forward,
367  -static_cast<int64_t>(time_stepper.number_of_past_steps()),
368  initial_time);
369 
370  return db::create_from<db::RemoveTags<>, simple_tags, compute_tags>(
371  std::move(box), TimeId{}, time_id, initial_dt, std::move(dt_vars),
372  std::move(history));
373  }
374  };
375 
376  // Tags related to limiting
377  template <typename Metavariables>
378  struct LimiterTags {
379  // Add the tags needed by the minmod limiter, whether or not the limiter is
380  // in use. This struct will have to be generalized to handle initialization
381  // of arbitrary limiters. Doing so will require more precise type aliases
382  // in the limiters, and then adding these tags to (minus anything already
383  // present in) the databox.
384  using simple_tags = db::AddSimpleTags<>;
385  using compute_tags = tmpl::list<Tags::SizeOfElement<Dim>>;
386 
387  template <typename TagsList>
388  static auto initialize(db::DataBox<TagsList>&& box) noexcept {
389  return db::create_from<db::RemoveTags<>, simple_tags, compute_tags>(
390  std::move(box));
391  }
392  };
393 
394  // Tags related to DG details (numerical fluxes, etc.).
395  template <typename Metavariables>
396  struct DgTags {
397  using temporal_id_tag = typename Metavariables::temporal_id;
399  using mortar_data_tag = tmpl::conditional_t<
400  Metavariables::local_time_stepping,
403 
404  template <typename Tag>
406 
407  template <typename Tag>
408  using interior_boundary_tag =
410 
411  template <typename Tag>
412  using external_boundary_tag =
414 
415  template <typename TagsList>
416  static auto add_mortar_data(
417  db::DataBox<TagsList>&& box,
418  const std::vector<std::array<size_t, Dim>>& initial_extents) noexcept {
419  const auto& element = db::get<Tags::Element<Dim>>(box);
420  const auto& mesh = db::get<Tags::Mesh<Dim>>(box);
421 
422  typename mortar_data_tag::type mortar_data{};
423  typename Tags::Mortars<Tags::Next<temporal_id_tag>, Dim>::type
424  mortar_next_temporal_ids{};
425  typename Tags::Mortars<Tags::Mesh<Dim - 1>, Dim>::type mortar_meshes{};
426  typename Tags::Mortars<Tags::MortarSize<Dim - 1>, Dim>::type
427  mortar_sizes{};
428  const auto& temporal_id = get<Tags::Next<temporal_id_tag>>(box);
429  for (const auto& direction_neighbors : element.neighbors()) {
430  const auto& direction = direction_neighbors.first;
431  const auto& neighbors = direction_neighbors.second;
432  for (const auto& neighbor : neighbors) {
433  const auto mortar_id = std::make_pair(direction, neighbor);
434  mortar_data[mortar_id]; // Default initialize data
435  mortar_next_temporal_ids.insert({mortar_id, temporal_id});
436  mortar_meshes.emplace(
437  mortar_id,
438  dg::mortar_mesh(mesh.slice_away(direction.dimension()),
439  element_mesh(initial_extents, neighbor,
440  neighbors.orientation())
441  .slice_away(direction.dimension())));
442  mortar_sizes.emplace(
443  mortar_id,
444  dg::mortar_size(element.id(), neighbor, direction.dimension(),
445  neighbors.orientation()));
446  }
447  }
448 
449  for (const auto& direction : element.external_boundaries()) {
450  const auto mortar_id = std::make_pair(
452  mortar_data[mortar_id];
453  // Since no communication needs to happen for boundary conditions,
454  // the temporal id is not advanced on the boundary, so we set it equal
455  // to the current temporal id in the element
456  mortar_next_temporal_ids.insert({mortar_id, temporal_id});
457  mortar_meshes.emplace(mortar_id,
458  mesh.slice_away(direction.dimension()));
459  mortar_sizes.emplace(mortar_id,
460  make_array<Dim - 1>(Spectral::MortarSize::Full));
461  }
462 
463  return db::create_from<
465  db::AddSimpleTags<mortar_data_tag,
467  Tags::Mortars<Tags::Mesh<Dim - 1>, Dim>,
468  Tags::Mortars<Tags::MortarSize<Dim - 1>, Dim>>>(
469  std::move(box), std::move(mortar_data),
470  std::move(mortar_next_temporal_ids), std::move(mortar_meshes),
471  std::move(mortar_sizes));
472  }
473 
474  template <typename LocalSystem,
475  bool IsInFluxConservativeForm =
476  LocalSystem::is_in_flux_conservative_form>
477  struct Impl {
478  using simple_tags = db::AddSimpleTags<
479  mortar_data_tag,
481  Tags::Mortars<Tags::Mesh<Dim - 1>, Dim>,
482  Tags::Mortars<Tags::MortarSize<Dim - 1>, Dim>,
487  typename flux_comm_types::normal_dot_fluxes_tag>>;
488 
489  using compute_tags = db::AddComputeTags<>;
490 
491  template <typename TagsList>
492  static auto initialize(db::DataBox<TagsList>&& box,
494  initial_extents) noexcept {
495  auto box2 = add_mortar_data(std::move(box), initial_extents);
496 
497  const auto& internal_directions =
498  db::get<Tags::InternalDirections<Dim>>(box2);
499 
500  const auto& boundary_directions =
501  db::get<Tags::BoundaryDirectionsInterior<Dim>>(box2);
502 
503  typename interface_tag<
504  typename flux_comm_types::normal_dot_fluxes_tag>::type
505  normal_dot_fluxes_interface{};
506  for (const auto& direction : internal_directions) {
507  const auto& interface_num_points =
508  db::get<interface_tag<Tags::Mesh<Dim - 1>>>(box2)
509  .at(direction)
510  .number_of_grid_points();
511  normal_dot_fluxes_interface[direction].initialize(
512  interface_num_points, 0.);
513  }
514 
515  typename interior_boundary_tag<
516  typename flux_comm_types::normal_dot_fluxes_tag>::type
517  normal_dot_fluxes_boundary_exterior{},
518  normal_dot_fluxes_boundary_interior{};
519  for (const auto& direction : boundary_directions) {
520  const auto& boundary_num_points =
521  db::get<interior_boundary_tag<Tags::Mesh<Dim - 1>>>(box2)
522  .at(direction)
523  .number_of_grid_points();
524  normal_dot_fluxes_boundary_exterior[direction].initialize(
525  boundary_num_points, 0.);
526  normal_dot_fluxes_boundary_interior[direction].initialize(
527  boundary_num_points, 0.);
528  }
529 
530  return db::create_from<
533  interface_tag<typename flux_comm_types::normal_dot_fluxes_tag>,
535  typename flux_comm_types::normal_dot_fluxes_tag>,
537  typename flux_comm_types::normal_dot_fluxes_tag>>>(
538  std::move(box2), std::move(normal_dot_fluxes_interface),
539  std::move(normal_dot_fluxes_boundary_interior),
540  std::move(normal_dot_fluxes_boundary_exterior));
541  }
542  };
543 
544  template <typename LocalSystem>
545  struct Impl<LocalSystem, true> {
546  using simple_tags =
547  db::AddSimpleTags<mortar_data_tag,
549  Tags::Mortars<Tags::Mesh<Dim - 1>, Dim>,
550  Tags::Mortars<Tags::MortarSize<Dim - 1>, Dim>>;
551 
552  template <typename Tag>
553  using interface_compute_tag =
555 
556  template <typename Tag>
559  Tag>;
560 
561  template <typename Tag>
564  Tag>;
565 
566  using compute_tags = db::AddComputeTags<
569  typename LocalSystem::variables_tag,
570  tmpl::size_t<Dim>, Frame::Inertial>>,
572  typename LocalSystem::variables_tag, Dim, Frame::Inertial>>,
574  db::add_tag_prefix<Tags::Flux,
575  typename LocalSystem::variables_tag,
576  tmpl::size_t<Dim>, Frame::Inertial>>,
578  typename LocalSystem::variables_tag, Dim, Frame::Inertial>>,
580  db::add_tag_prefix<Tags::Flux,
581  typename LocalSystem::variables_tag,
582  tmpl::size_t<Dim>, Frame::Inertial>>,
584  typename LocalSystem::variables_tag, Dim, Frame::Inertial>>>;
585 
586  template <typename TagsList>
587  static auto initialize(db::DataBox<TagsList>&& box,
589  initial_extents) noexcept {
590  return db::create_from<db::RemoveTags<>, db::AddSimpleTags<>,
591  compute_tags>(
592  add_mortar_data(std::move(box), initial_extents));
593  }
594  };
595 
597  using simple_tags = typename impl::simple_tags;
598  using compute_tags = typename impl::compute_tags;
599 
600  template <typename TagsList>
601  static auto initialize(
602  db::DataBox<TagsList>&& box,
603  const std::vector<std::array<size_t, Dim>>& initial_extents) noexcept {
604  return impl::initialize(std::move(box), initial_extents);
605  }
606  };
607 
608  template <class Metavariables>
609  using return_tag_list = tmpl::append<
610  typename DomainTags::simple_tags,
611  typename SystemTags<typename Metavariables::system>::simple_tags,
612  typename DomainInterfaceTags<typename Metavariables::system>::simple_tags,
613  typename EvolutionTags<typename Metavariables::system>::simple_tags,
614  typename DgTags<Metavariables>::simple_tags,
615  typename LimiterTags<Metavariables>::simple_tags,
616  typename DomainTags::compute_tags,
617  typename SystemTags<typename Metavariables::system>::compute_tags,
618  typename DomainInterfaceTags<
619  typename Metavariables::system>::compute_tags,
620  typename EvolutionTags<typename Metavariables::system>::compute_tags,
621  typename DgTags<Metavariables>::compute_tags,
622  typename LimiterTags<Metavariables>::compute_tags>;
623 
624  template <typename... InboxTags, typename Metavariables, typename ActionList,
625  typename ParallelComponent>
626  static auto apply(const db::DataBox<tmpl::list<>>& /*box*/,
627  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
629  const ElementIndex<Dim>& array_index,
630  const ActionList /*meta*/,
631  const ParallelComponent* const /*meta*/,
632  std::vector<std::array<size_t, Dim>> initial_extents,
634  const double initial_time, const double initial_dt,
635  const double initial_slab_size) noexcept {
636  using system = typename Metavariables::system;
637  auto domain_box = DomainTags::initialize(
638  db::DataBox<tmpl::list<>>{}, array_index, initial_extents, domain);
639  auto system_box = SystemTags<system>::initialize(std::move(domain_box),
640  cache, initial_time);
641  auto domain_interface_box =
642  DomainInterfaceTags<system>::initialize(std::move(system_box));
643  auto evolution_box = EvolutionTags<system>::initialize(
644  std::move(domain_interface_box), cache, initial_time, initial_dt,
645  initial_slab_size);
646  auto dg_box = DgTags<Metavariables>::initialize(std::move(evolution_box),
647  initial_extents);
648  auto limiter_box =
649  LimiterTags<Metavariables>::initialize(std::move(dg_box));
650 
651  return std::make_tuple(std::move(limiter_box));
652  }
653 };
654 } // namespace Actions
655 } // namespace dg
Prefix< DataBox_detail::dispatch_add_tag_prefix_impl< Prefix, Tag, Args... >, Args... > add_tag_prefix
Wrap Tag in Prefix<_, Args...>, also wrapping variables tags if Tag is a Tags::Variables.
Definition: DataBoxTag.hpp:533
Tag for step size.
Definition: Tags.hpp:45
Definition: InitializeElement.hpp:378
The normalized (co)vector represented by Tag.
Definition: Magnitude.hpp:93
Definition: BlockId.hpp:16
Definition: InitializeElement.hpp:396
Definition: InitializeElement.hpp:276
static Slab with_duration_to_end(double end, double duration) noexcept
Construct a slab with a given end time and duration. The actual duration may differ by roundoff from ...
Definition: Slab.hpp:49
The time in a simulation. Times can be safely compared for exact equality as long as they do not belo...
Definition: Time.hpp:31
The unnormalized face normal one form.
Definition: FaceNormal.hpp:68
Direction to an interface
Definition: Tags.hpp:364
Definition: InitializeElement.hpp:63
A unique identifier for the temporal state of an integrated system.
Definition: TimeId.hpp:25
Holds the number of grid points, basis, and quadrature in each direction of the computational grid...
Definition: Mesh.hpp:49
static Slab with_duration_from_start(double start, double duration) noexcept
Construct a slab with a given start time and duration. The actual duration may differ by roundoff fro...
Definition: Slab.hpp:43
Mesh< Dim > mortar_mesh(const Mesh< Dim > &face_mesh1, const Mesh< Dim > &face_mesh2) noexcept
Find a mesh for a mortar capable of representing data from either of two faces.
Definition: MortarHelpers.cpp:19
Computes the coordinates in the frame Frame on the faces defined by Direction. Intended to be prefixe...
Definition: Tags.hpp:392
Definition: TaggedTuple.hpp:25
Define prefixes for DataBox tags.
A chunk of time. Every element must reach slab boundaries exactly, no matter how it actually takes ti...
Definition: Slab.hpp:29
Tag for compute item for current Time (from TimeId)
Definition: Tags.hpp:53
Defines class TimeId.
Defines class ElementId.
tmpl::flatten< tmpl::list< Tags... > > RemoveTags
List of Tags to remove from the DataBox.
Definition: DataBox.hpp:1220
Prefix computing a boundary unit normal vector dotted into the flux from a flux on the boundary...
Definition: Tags.hpp:30
Defines the type alias Requires.
constexpr auto apply(F &&f, const DataBox< BoxTags > &box, Args &&... args)
Apply the function f with argument Tags TagsList from DataBox box
Definition: DataBox.hpp:1595
Definition: InitializeElement.hpp:111
The CoordinateMap for the Element from the Logical frame to the TargetFrame
Definition: ElementMap.hpp:38
Defines Time and TimeDelta.
Computes the VolumeDim-1 dimensional mesh on an interface from the volume mesh. Tags::InterfaceComput...
Definition: Tags.hpp:375
Defines class template Index.
Definition: InitializeElement.hpp:214
Initialize a dG element with analytic initial data.
Definition: InitializeElement.hpp:96
Defines class template Domain.
Data on mortars, indexed by (Direction, ElementId) pairs.
Definition: Tags.hpp:34
Defines functions logical_coordinates and interface_logical_coordinates.
Holds an IterationId that identifies a step in the linear solver algorithm.
Definition: Tags.hpp:66
Derived tag for representing a compute item which acts on Tags on an interface. Can be retrieved usin...
Definition: Tags.hpp:440
Computes the inverse Jacobian of the map held by MapTag at the coordinates held by SourceCoordsTag...
Definition: Tags.hpp:125
Prefix for TimeStepper history.
Definition: Tags.hpp:75
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:272
Defines classes and functions used for manipulating DataBox&#39;s.
constexpr auto create_from(db::DataBox< TagsList > &&box, Args &&... args) noexcept
Create a new DataBox from an existing one adding or removing items and compute items.
Definition: DataBox.hpp:1414
Definition: InitializeElement.hpp:144
The minimum coordinate distance between grid points.
Definition: MinimumGridSpacing.hpp:34
tmpl::flatten< tmpl::list< Tags... > > AddSimpleTags
List of Tags to add to the DataBox.
Definition: DataBox.hpp:1227
The logical coordinates in the Element.
Definition: LogicalCoordinates.hpp:64
Represents an interval of time within a single slab.
Definition: Time.hpp:108
Prefix indicating a flux.
Definition: Prefixes.hpp:38
Element< VolumeDim > create_initial_element(const ElementId< VolumeDim > &element_id, const Block< VolumeDim, TargetFrame > &block) noexcept
Creates an initial element of a Block.
Definition: CreateInitialElement.cpp:27
A spectral element with knowledge of its neighbors.
Definition: Element.hpp:29
Defines functions computing partial derivatives.
Defines class Slab.
Indicates the Frame that a TensorIndexType is in.
Definition: IndexType.hpp:36
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
Defines class Variables.
Types related to flux communication.
Definition: FluxCommunicationTypes.hpp:37
Derived tag for representing a compute item which slices a Tag containing a Variables from the volume...
Definition: Tags.hpp:479
Definition: DataBoxTag.hpp:29
A Charm++ chare that caches constant data once per Charm++ node.
Definition: ConstGlobalCache.hpp:76
Size of a mortar, relative to the element face. That is, the part of the face that it covers...
Definition: Tags.hpp:46
Defines the class template Mesh.
Compute the spatial derivatives of tags in a Variables.
Definition: PartialDerivatives.hpp:150
Declares function unnormalized_face_normal.
The Element associated with the DataBox.
Definition: Tags.hpp:64
std::array< Spectral::MortarSize, Dim - 1 > mortar_size(const ElementId< Dim > &self, const ElementId< Dim > &neighbor, const size_t dimension, const OrientationMap< Dim > &orientation) noexcept
Determine the size of the mortar (i.e., the part of the face it covers) for communicating with a neig...
Definition: MortarHelpers.cpp:36
Can be used to retrieve the analytic solution from the cache without having to know the template para...
Definition: Tags.hpp:12
Defines macro ASSERT.
const auto & get(const DataBox< TagList > &box) noexcept
Retrieve the item with tag Tag from the DataBox.
Definition: DataBox.hpp:1211
A wrapper around a vector of Blocks that represent the computational domain.
Definition: Domain.hpp:38
The Poisson equation formulated as a set of coupled first-order PDEs.
Definition: FirstOrderSystem.hpp:55
Wraps the template metaprogramming library used (brigand)
The coordinates in the target frame of MapTag. The SourceCoordsTag&#39;s frame must be the source frame o...
Definition: Tags.hpp:107
An integer multi-index.
Definition: Index.hpp:28
The computational grid of the Element in the DataBox.
Definition: Tags.hpp:75
Prefix indicating the value a quantity will take on the next iteration of the algorithm.
Definition: Prefixes.hpp:98
typename DataBox_detail::item_type_impl< TagList, Tag >::type item_type
Get the type that is returned by the Tag. If it is a base tag then a TagList must be passed as a seco...
Definition: DataBoxTag.hpp:410
Defines functions and classes from the GSL.
Defines tags related to domain quantities.
BasedMortars< Tags::VariablesBoundaryData, Tags::SimpleBoundaryData< db::item_type< typename Metavariables::temporal_id >, LocalData, PackagedData >, volume_dim > simple_mortar_data_tag
The DataBox tag for the data stored on the mortars for global stepping.
Definition: FluxCommunicationTypes.hpp:85
typename Requires_detail::requires_impl< B >::template_error_type_failed_to_meet_requirements_on_template_parameters Requires
Express requirements on the template parameters of a function or class, replaces std::enable_if_t ...
Definition: Requires.hpp:67
Definition: IndexType.hpp:44
Definition: SolvePoissonProblem.hpp:38
A class for indexing a Charm array by Element.
Definition: ElementIndex.hpp:53
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
Defines class template ConstGlobalCache.
Compute the divergence of a Variables.
Definition: Divergence.hpp:80
The set of directions which correspond to external boundaries. To be used to represent data which exi...
Definition: Tags.hpp:177
db::add_tag_prefix< Tags::NormalDotFlux, typename system::variables_tag > normal_dot_fluxes_tag
The DataBox tag for the normal fluxes of the evolved variables.
Definition: FluxCommunicationTypes.hpp:49
Tag which is either a SimpleTag for quantities on an interface, base tag to a compute item which acts...
Definition: Tags.hpp:217
BasedMortars< Tags::VariablesBoundaryData, Tags::BoundaryHistory< LocalData, PackagedData, db::item_type< typename system::variables_tag > >, volume_dim > local_time_stepping_mortar_data_tag
The DataBox tag for the data stored on the mortars for local stepping.
Definition: FluxCommunicationTypes.hpp:93
The coordinate map from logical to grid coordinate.
Definition: Tags.hpp:84
Tag for TimeId for the algorithm state.
Definition: Tags.hpp:35
Defines tags related to Time quantities.
Defines functions and tags for taking a divergence.
Definition: ComputeTimeDerivative.hpp:28
constexpr T & at(std::array< T, N > &arr, Size index)
Retrieve a entry from a container, with checks in Debug mode that the index being retrieved is valid...
Definition: Gsl.hpp:124
tmpl::flatten< tmpl::list< Tags... > > AddComputeTags
List of Compute Item Tags to add to the DataBox.
Definition: DataBox.hpp:1234
Definition: InitializeElement.hpp:477
Defines class Element.