Loading...
Searching...
No Matches
spherical_shell.hpp File Reference
#include <cmath>
#include <iostream>
#include <ranges>
#include <stdexcept>
#include <vector>
#include "../grid_types.hpp"
#include "../terra/kokkos/kokkos_wrapper.hpp"
#include "communication/buffer_copy_kernels.hpp"
#include "dense/vec.hpp"
#include "mpi/mpi.hpp"
#include "util/logging.hpp"

Go to the source code of this file.

Classes

struct  terra::grid::shell::BaseCorners< T >
 
class  terra::grid::shell::SubdomainInfo
 (Sortable) Globally unique identifier for a single subdomain of a diamond. More...
 
class  terra::grid::shell::DomainInfo
 Information about the thick spherical shell mesh. More...
 
class  terra::grid::shell::SubdomainNeighborhood
 Neighborhood information of a single subdomain. More...
 
class  terra::grid::shell::DistributedDomain
 Parallel data structure organizing the thick spherical shell metadata for distributed (MPI parallel) simulations. More...
 
struct  terra::grid::shell::SubdomainDistribution
 

Namespaces

namespace  terra
 
namespace  terra::grid
 
namespace  terra::grid::shell
 

Typedefs

template<std::floating_point T>
using terra::grid::shell::MemoizationCache = std::map< std::pair< int, int >, dense::Vec< T, 3 > >
 
using terra::grid::shell::SubdomainToRankDistributionFunction = std::function< mpi::MPIRank(const SubdomainInfo &, const int, const int) >
 

Functions

template<std::floating_point T>
std::vector< T > terra::grid::shell::uniform_shell_radii (T r_min, T r_max, int num_shells)
 Computes the radial shell radii for a uniform grid.
 
template<std::floating_point T>
std::function< T(T) > terra::grid::shell::make_tanh_boundary_cluster (T k)
 Map to be used in mapped_shell_radii.
 
template<std::floating_point T>
std::vector< T > terra::grid::shell::mapped_shell_radii (T r_min, T r_max, int num_shells, const std::function< T(T) > &map)
 Computes the radial shell radii for a non-uniformly distributed grid.
 
template<std::floating_point T>
terra::grid::shell::min_radial_h (const std::vector< T > &shell_radii)
 Computes the min absolute distance of two entries in the passed vector of shell radii.
 
template<std::floating_point T>
terra::grid::shell::max_radial_h (const std::vector< T > &shell_radii)
 Computes the max absolute distance of two entries in the passed vector of shell radii.
 
template<std::floating_point T>
dense::Vec< T, 3 > terra::grid::shell::compute_node_recursive (int i, int j, const BaseCorners< T > &corners, MemoizationCache< T > &cache)
 Computes the coordinates for a specific node (i, j) in the final refined grid. Uses recursion and memoization, sourcing base points from the BaseCorners struct.
 
template<std::floating_point T>
void terra::grid::shell::compute_subdomain (const typename Grid3DDataVec< T, 3 >::HostMirror &subdomain_coords_host, int subdomain_idx, const BaseCorners< T > &corners, int i_start_incl, int i_end_incl, int j_start_incl, int j_end_incl)
 Generates coordinates for a rectangular subdomain of the refined spherical grid.
 
template<std::floating_point T>
void terra::grid::shell::unit_sphere_single_shell_subdomain_coords (const typename Grid3DDataVec< T, 3 >::HostMirror &subdomain_coords_host, int subdomain_idx, int diamond_id, int ntan, int i_start_incl, int i_end_incl, int j_start_incl, int j_end_incl)
 
template<std::floating_point T>
void terra::grid::shell::unit_sphere_single_shell_subdomain_coords (const typename Grid3DDataVec< T, 3 >::HostMirror &subdomain_coords_host, int subdomain_idx, int diamond_id, int global_refinements, int num_subdomains_per_side, int subdomain_i, int subdomain_j)
 
std::ostream & terra::grid::shell::operator<< (std::ostream &os, const SubdomainInfo &si)
 
mpi::MPIRank terra::grid::shell::subdomain_to_rank_all_root (const SubdomainInfo &subdomain_info, const int num_subdomains_per_diamond_laterally, const int num_subdomains_per_diamond_radially)
 Assigns all subdomains to root (rank 0).
 
mpi::MPIRank terra::grid::shell::subdomain_to_rank_iterate_diamond_subdomains (const SubdomainInfo &subdomain_info, const int num_subdomains_per_diamond_laterally, const int num_subdomains_per_diamond_radially)
 Distributes subdomains to ranks as evenly as possible.
 
SubdomainDistribution terra::grid::shell::subdomain_distribution (const DistributedDomain &domain)
 
template<typename ValueType >
Grid4DDataScalar< ValueType > terra::grid::shell::allocate_scalar_grid (const std::string label, const DistributedDomain &distributed_domain)
 
template<typename ValueType >
Grid4DDataScalar< ValueType > terra::grid::shell::allocate_scalar_grid (const std::string label, const DistributedDomain &distributed_domain, const int level)
 
Kokkos::MDRangePolicy< Kokkos::Rank< 4 > > terra::grid::shell::local_domain_md_range_policy_nodes (const DistributedDomain &distributed_domain)
 
Kokkos::MDRangePolicy< Kokkos::Rank< 3 > > terra::grid::shell::local_domain_md_range_policy_cells_lateral (const DistributedDomain &distributed_domain)
 
Kokkos::MDRangePolicy< Kokkos::Rank< 4 > > terra::grid::shell::local_domain_md_range_policy_cells (const DistributedDomain &distributed_domain)
 
Kokkos::RangePolicy terra::grid::shell::local_domain_md_range_policy_cells_linearized (const DistributedDomain &distributed_domain)
 
template<std::floating_point T>
Grid3DDataVec< T, 3 > terra::grid::shell::subdomain_unit_sphere_single_shell_coords (const DistributedDomain &domain)
 Returns an initialized grid with the coordinates of all subdomains' nodes projected to the unit sphere.
 
template<std::floating_point T>
Grid2DDataScalar< T > terra::grid::shell::subdomain_shell_radii (const DistributedDomain &domain)
 Returns an initialized grid with the radii of all subdomain nodes.
 
Grid2DDataScalar< int > terra::grid::shell::subdomain_shell_idx (const DistributedDomain &domain)
 Returns an initialized grid with the shell index of all subdomain nodes.
 
template<typename CoordsShellType , typename CoordsRadiiType >
dense::Vec< typename CoordsShellType::value_type, 3 > terra::grid::shell::coords (const int subdomain, const int x, const int y, const int r, const CoordsShellType &coords_shell, const CoordsRadiiType &coords_radii)
 
template<typename CoordsShellType , typename CoordsRadiiType >
dense::Vec< typename CoordsShellType::value_type, 3 > terra::grid::shell::coords (const dense::Vec< int, 4 > subdomain_x_y_r, const CoordsShellType &coords_shell, const CoordsRadiiType &coords_radii)