SpECTRE  v2024.04.12
domain Namespace Reference

Holds entities related to the computational domain. More...

Namespaces

namespace  BoundaryConditions
 Domain support for applying boundary conditions
 
namespace  CoordinateMaps
 Contains all coordinate maps.
 
namespace  creators
 Defines classes that create Domains.
 
namespace  FunctionsOfTime
 Contains functions of time to support the dual frame system.
 
namespace  Tags
 Tags for the domain.
 

Classes

class  BlockId
 Index a block of the computational domain. More...
 
struct  BlockZCurveProcDistribution
 Distribution strategy for assigning elements to CPUs using a Morton ('Z-order') space-filling curve to determine placement within each block, where Elements are distributed across CPUs. More...
 
struct  CheckFunctionsOfTimeAreReadyPostprocessor
 check that functions of time are up-to-date. More...
 
class  CoordinateMap
 A coordinate map or composition of coordinate maps. More...
 
class  CoordinateMapBase
 Abstract base class for CoordinateMap. More...
 
struct  ExpandOverBlocks
 Produce a std::vector<T> over all blocks of the domain. More...
 
struct  make_faces_tag
 Wrap Tag in domain::Tags::Faces, unless Tag is in the VolumeTags list. More...
 
struct  object_list
 Similar to a tmpl::list but for ObjectLabels. More...
 
struct  RadiallyCompressedCoordinatesOptions
 Options for radially compressed coordinates. More...
 

Typedefs

template<typename T >
using is_map_time_dependent_t = tt::is_callable_t< T, std::array< std::decay_t< T >, std::decay_t< T >::dim >, double, std::unordered_map< std::string, std::unique_ptr< domain::FunctionsOfTime::FunctionOfTime > > >
 Check if the calls to the coordinate map and its inverse map are time-dependent.
 
template<typename Map , typename T >
using is_jacobian_time_dependent_t = detail::is_jacobian_callable_t< Map, std::array< std::decay_t< T >, std::decay_t< Map >::dim >, double, std::unordered_map< std::string, std::unique_ptr< domain::FunctionsOfTime::FunctionOfTime > > >
 Check if the calls to the Jacobian and inverse Jacobian of the coordinate map are time-dependent.
 
using FunctionsOfTimeMap = std::unordered_map< std::string, std::unique_ptr< domain::FunctionsOfTime::FunctionOfTime > >
 
template<size_t Dim, typename TagsList , typename VolumeTags = tmpl::list<>>
using make_faces_tags = tmpl::transform< TagsList, make_faces_tag< tmpl::pin< tmpl::size_t< Dim > >, tmpl::_1, tmpl::pin< VolumeTags > > >
 Wrap all tags in TagsList in domain::Tags::Faces, except those in the VolumeTags list.
 

Enumerations

enum class  ElementWeight { Uniform , NumGridPoints , NumGridPointsAndGridSpacing }
 The weighting scheme for assigning computational costs to Elements for distributing balanced compuational costs per processor (see BlockZCurveProcDistribution) More...
 
enum class  ObjectLabel { A , B , C , None }
 Labels for the objects in a binary system. More...
 

Functions

template<typename SourceFrame , typename TargetFrame , typename... Maps>
auto make_coordinate_map (Maps &&... maps) -> CoordinateMap< SourceFrame, TargetFrame, std::decay_t< Maps >... >
 Creates a CoordinateMap of maps...
 
template<typename SourceFrame , typename TargetFrame , typename... Maps>
auto make_coordinate_map_base (Maps &&... maps) -> std::unique_ptr< CoordinateMapBase< SourceFrame, TargetFrame, CoordinateMap< SourceFrame, TargetFrame, std::decay_t< Maps >... >::dim > >
 Creates a std::unique_ptr<CoordinateMapBase> of maps...
 
template<typename SourceFrame , typename TargetFrame , typename Arg0 , typename... Args>
auto make_vector_coordinate_map_base (Arg0 &&arg_0, Args &&... remaining_args) -> std::vector< std::unique_ptr< CoordinateMapBase< SourceFrame, TargetFrame, std::decay_t< Arg0 >::dim > > >
 Creates a std::vector<std::unique_ptr<CoordinateMapBase>> containing the result of make_coordinate_map_base applied to each argument passed in.
 
template<typename SourceFrame , typename TargetFrame , size_t Dim, typename Map , typename... Maps>
auto make_vector_coordinate_map_base (std::vector< Map > maps, const Maps &... remaining_maps) -> std::vector< std::unique_ptr< CoordinateMapBase< SourceFrame, TargetFrame, Dim > > >
 Creates a std::vector<std::unique_ptr<CoordinateMapBase>> containing the result of make_coordinate_map_base applied to each element of the vector of maps composed with the rest of the arguments passed in.
 
template<typename SourceFrame , typename TargetFrame , typename... Maps, typename NewMap >
CoordinateMap< SourceFrame, TargetFrame, Maps..., NewMap > push_back (CoordinateMap< SourceFrame, TargetFrame, Maps... > old_map, NewMap new_map)
 Creates a CoordinateMap by appending the new map to the end of the old maps.
 
template<typename SourceFrame , typename TargetFrame , typename... Maps, typename NewMap >
CoordinateMap< SourceFrame, TargetFrame, NewMap, Maps... > push_front (CoordinateMap< SourceFrame, TargetFrame, Maps... > old_map, NewMap new_map)
 Creates a CoordinateMap by prepending the new map to the beginning of the old maps.
 
bool block_is_in_group (const std::string &block_name, const std::string &block_or_group_name, const std::unordered_map< std::string, std::unordered_set< std::string > > &block_groups)
 Check if a block is in the given group. More...
 
std::unordered_set< std::stringexpand_block_groups_to_block_names (const std::vector< std::string > &block_or_group_names, const std::vector< std::string > &all_block_names, const std::unordered_map< std::string, std::unordered_set< std::string > > &block_groups)
 Expand a list of block or group names into a list of block names. More...
 
std::ostreamoperator<< (std::ostream &os, ElementWeight weight)
 
template<size_t Dim>
std::unordered_map< ElementId< Dim >, double > get_element_costs (const std::vector< Block< Dim > > &blocks, const std::vector< std::array< size_t, Dim > > &initial_refinement_levels, const std::vector< std::array< size_t, Dim > > &initial_extents, ElementWeight element_weight, const std::optional< Spectral::Quadrature > &quadrature)
 Get the cost of each Element in a list of Blocks where element_weight specifies which weight distribution scheme to use. More...
 
template<size_t Dim>
std::unique_ptr< CoordinateMapBase< Frame::ElementLogical, Frame::BlockLogical, Dim > > element_to_block_logical_map (const ElementId< Dim > &element_id)
 Constructs the affine map from ElementLogical to BlockLogical coordinates. More...
 
template<size_t Dim>
void flat_logical_metric (const gsl::not_null< tnsr::ii< DataVector, Dim, Frame::ElementLogical > * > result, const Jacobian< DataVector, Dim, Frame::ElementLogical, Frame::Inertial > &jacobian)
 The "flat logical metric" \(\sum_k \frac{\partial x^k}{\partial \xi^\hat{i}} \frac{\partial x^k}{\partial \xi^\hat{j}}\), which is the flat spatial metric in element-logical coordinates. More...
 
template<size_t Dim, typename Fr >
void jacobian_diagnostic (const gsl::not_null< tnsr::i< DataVector, Dim, typename Frame::ElementLogical > * > jacobian_diag, const Jacobian< DataVector, Dim, typename Frame::ElementLogical, Fr > &analytic_jacobian, const TensorMetafunctions::prepend_spatial_index< tnsr::I< DataVector, Dim, Fr >, Dim, UpLo::Lo, typename Frame::ElementLogical > &numeric_jacobian_transpose)
 A diagnostic comparing the analytic and numerical Jacobians for a map. More...
 
bool operator== (const BlockId &lhs, const BlockId &rhs)
 
bool operator!= (const BlockId &lhs, const BlockId &rhs)
 
std::ostreamoperator<< (std::ostream &os, const BlockId &block_id)
 
std::string name (const ObjectLabel x)
 
std::ostreamoperator<< (std::ostream &s, const ObjectLabel x)
 
template<size_t Dim, typename T >
void remove_nonexistent_neighbors (const gsl::not_null< DirectionalIdMap< Dim, T > * > map_to_trim, const Element< Dim > &element)
 Remove entries in map_to_trim that aren't face neighbors of the element
 
template<size_t Dim>
size_t z_curve_index (const ElementId< Dim > &element_id)
 Computes the Z-curve index of a given ElementId More...
 
template<typename Metavariables >
std::string diagnostic_info (const size_t total_number_of_blocks, const Parallel::GlobalCache< Metavariables > &cache, const std::vector< size_t > &elements_per_core, const std::vector< size_t > &elements_per_node, const std::vector< size_t > &grid_points_per_core, const std::vector< size_t > &grid_points_per_node)
 Returns a std::string with diagnostic information about how elements and grid points are distributed on the nodes and cores.
 
template<typename CacheTag , typename Metavariables , typename ArrayIndex , typename Component >
bool functions_of_time_are_ready_algorithm_callback (Parallel::GlobalCache< Metavariables > &cache, const ArrayIndex &array_index, const Component *component_p, const double time, const std::optional< std::unordered_set< std::string > > &functions_to_check=std::nullopt)
 Check that functions of time are up-to-date. More...
 
template<typename CacheTag , typename SimpleAction , typename Metavariables , typename ArrayIndex , typename Component , typename... Args>
bool functions_of_time_are_ready_simple_action_callback (Parallel::GlobalCache< Metavariables > &cache, const ArrayIndex &array_index, const Component *component_p, const double time, const std::optional< std::unordered_set< std::string > > &functions_to_check, Args &&... args)
 Check that functions of time are up-to-date. More...
 
template<size_t Dim, typename Fr >
void jacobian_diagnostic (const gsl::not_null< tnsr::i< DataVector, Dim, Frame::ElementLogical > * > jacobian_diag, const ::Jacobian< DataVector, Dim, Frame::ElementLogical, Fr > &analytic_jacobian, const tnsr::I< DataVector, Dim, Fr > &mapped_coords, const ::Mesh< Dim > &mesh)
 A diagnostic comparing the analytic and numerical Jacobians for a map. More...
 
template<size_t Dim, typename Fr >
tnsr::i< DataVector, Dim, Frame::ElementLogicaljacobian_diagnostic (const ::Jacobian< DataVector, Dim, Frame::ElementLogical, Fr > &analytic_jacobian, const tnsr::I< DataVector, Dim, Fr > &mapped_coords, const ::Mesh< Dim > &mesh)
 A diagnostic comparing the analytic and numerical Jacobians for a map. More...
 
template<typename DataType , size_t Dim, typename CoordsFrame >
void radially_compressed_coordinates (gsl::not_null< tnsr::I< DataType, Dim, CoordsFrame > * > result, const tnsr::I< DataType, Dim, CoordsFrame > &coordinates, double inner_radius, double outer_radius, CoordinateMaps::Distribution compression)
 Coordinates suitable for visualizing large radii by compressing them logarithmically or inversely. More...
 
template<typename DataType , size_t Dim, typename CoordsFrame >
tnsr::I< DataType, Dim, CoordsFrame > radially_compressed_coordinates (const tnsr::I< DataType, Dim, CoordsFrame > &coordinates, double inner_radius, double outer_radius, CoordinateMaps::Distribution compression)
 Coordinates suitable for visualizing large radii by compressing them logarithmically or inversely. More...
 
Spectral::ChildSize child_size (const SegmentId &child_segment_id, const SegmentId &parent_segment_id)
 Size of a child segment relative to its parent. More...
 
template<size_t Dim>
std::array< Spectral::ChildSize, Dim > child_size (const std::array< SegmentId, Dim > &child_segment_ids, const std::array< SegmentId, Dim > &parent_segment_ids)
 Size of a child segment relative to its parent. More...
 

Variables

template<typename T >
constexpr bool is_map_time_dependent_v = is_map_time_dependent_t<T>::value
 Check if the calls to the coordinate map and its inverse map are time-dependent.
 
template<typename Map , typename T >
constexpr bool is_jacobian_time_dependent_v
 Check if the calls to the Jacobian and inverse Jacobian of the coordinate map are time-dependent. More...
 

Detailed Description

Holds entities related to the computational domain.

Enumeration Type Documentation

◆ ElementWeight

enum class domain::ElementWeight
strong

The weighting scheme for assigning computational costs to Elements for distributing balanced compuational costs per processor (see BlockZCurveProcDistribution)

Enumerator
Uniform 

A weighting scheme where each Element is assigned the same computational cost.

NumGridPoints 

A weighting scheme where each Element's computational cost is equal to the number of grid points in that Element

NumGridPointsAndGridSpacing 

A weighting scheme where each Element's computational cost is weighted by both the number of grid points and minimum spacing between grid points in that Element (see get_num_points_and_grid_spacing_cost() for details)

◆ ObjectLabel

enum class domain::ObjectLabel
strong

Labels for the objects in a binary system.

Enumerator

The object along the positive x-axis in the grid frame.

The object along the negative x-axis in the grid frame.

A third object, typically centered at the origin.

None 

This object has no label.

Function Documentation

◆ block_is_in_group()

bool domain::block_is_in_group ( const std::string block_name,
const std::string block_or_group_name,
const std::unordered_map< std::string, std::unordered_set< std::string > > &  block_groups 
)

Check if a block is in the given group.

Parameters
block_nameThe name of the block to check
block_or_group_nameThe group name we're testing. Returns true if the block is in this group. This can also be the name of the block itself.
block_groupsAll block groups.

◆ child_size() [1/2]

Spectral::ChildSize domain::child_size ( const SegmentId child_segment_id,
const SegmentId parent_segment_id 
)

Size of a child segment relative to its parent.

Determines which part of the parent_segment_id is covered by the child_segment_id: The full segment, its lower half or its upper half.

◆ child_size() [2/2]

template<size_t Dim>
std::array< Spectral::ChildSize, Dim > domain::child_size ( const std::array< SegmentId, Dim > &  child_segment_ids,
const std::array< SegmentId, Dim > &  parent_segment_ids 
)

Size of a child segment relative to its parent.

Determines which part of the parent_segment_id is covered by the child_segment_id: The full segment, its lower half or its upper half.

◆ element_to_block_logical_map()

template<size_t Dim>
std::unique_ptr< CoordinateMapBase< Frame::ElementLogical, Frame::BlockLogical, Dim > > domain::element_to_block_logical_map ( const ElementId< Dim > &  element_id)

Constructs the affine map from ElementLogical to BlockLogical coordinates.

An element is the result of repeatedly splitting a block in half along any of its logical axes. This map transforms from ElementLogical coordinates [-1, 1]^dim to the subset of BlockLogical coordinates [-1, 1]^dim that cover the element. For instance, the two elements at refinement level 1 in 1D cover [-1, 0] and [0, 1] in BlockLogical coordinates, respectively.

◆ expand_block_groups_to_block_names()

std::unordered_set< std::string > domain::expand_block_groups_to_block_names ( const std::vector< std::string > &  block_or_group_names,
const std::vector< std::string > &  all_block_names,
const std::unordered_map< std::string, std::unordered_set< std::string > > &  block_groups 
)

Expand a list of block or group names into a list of block names.

Parameters
block_or_group_namesBlock or group names to expand
all_block_namesAll block names in the domain
block_groupsBlock groups used to expand the names

Returns: std::unordered_set<std::string> List of block names that appear in all_block_names. If one of the input names was a group, then all block names from that group are included. Overlaps between groups are allowed.

◆ flat_logical_metric()

template<size_t Dim>
void domain::flat_logical_metric ( const gsl::not_null< tnsr::ii< DataVector, Dim, Frame::ElementLogical > * >  result,
const Jacobian< DataVector, Dim, Frame::ElementLogical, Frame::Inertial > &  jacobian 
)

The "flat logical metric" \(\sum_k \frac{\partial x^k}{\partial \xi^\hat{i}} \frac{\partial x^k}{\partial \xi^\hat{j}}\), which is the flat spatial metric in element-logical coordinates.

We define the "flat logical metric" to be the matrix of inner products of the \(\hat{i}\)-th logical coordinate basis vector \(\partial_{\xi^\hat{i}}\) with the \(\hat{j}\)-th logical coordinate basis vector \(\partial_{\xi^\hat{j}}\), where the inner product is taken assuming a flat spatial metric. When expressed in the ("inertial") \(x\)-coordinate system, each basis vector is a column of the Jacobian.

◆ get_element_costs()

template<size_t Dim>
std::unordered_map< ElementId< Dim >, double > domain::get_element_costs ( const std::vector< Block< Dim > > &  blocks,
const std::vector< std::array< size_t, Dim > > &  initial_refinement_levels,
const std::vector< std::array< size_t, Dim > > &  initial_extents,
ElementWeight  element_weight,
const std::optional< Spectral::Quadrature > &  quadrature 
)

Get the cost of each Element in a list of Blocks where element_weight specifies which weight distribution scheme to use.

Details

It is only necessary to pass in a value for quadrature if the value for element_weight is ElementWeight::NumGridPointsAndGridSpacing. Otherwise, the argument isn't needed and will have no effect if it does have a value.

◆ z_curve_index()

template<size_t Dim>
size_t domain::z_curve_index ( const ElementId< Dim > &  element_id)

Computes the Z-curve index of a given ElementId

Details

The Z-curve index is computed by interleaving the bits of the ElementId's Segment indices. Here is a sketch of a 2D block with 4x2 elements, with bit indices and the resulting z-curve:

x-->
00 01 10 11
y 0 | 0 2 4 6
| |
v 1 | 1 3 5 7
Parameters
element_idthe ElementId for which to compute the Z-curve index

Variable Documentation

◆ is_jacobian_time_dependent_v

template<typename Map , typename T >
constexpr bool domain::is_jacobian_time_dependent_v
constexpr
Initial value:
=
detail::is_jacobian_callable_t< Map, std::array< std::decay_t< T >, std::decay_t< Map >::dim >, double, std::unordered_map< std::string, std::unique_ptr< domain::FunctionsOfTime::FunctionOfTime > > > is_jacobian_time_dependent_t
Check if the calls to the Jacobian and inverse Jacobian of the coordinate map are time-dependent.
Definition: TimeDependentHelpers.hpp:41

Check if the calls to the Jacobian and inverse Jacobian of the coordinate map are time-dependent.