SpECTRE  v2024.04.12
LinearSolver::multigrid Namespace Reference

Items related to the multigrid linear solver. More...

Namespaces

namespace  Actions
 Actions related to the Multigrid linear solver.
 
namespace  Tags
 DataBox tags for the LinearSolver::multigrid::Multigrid linear solver.
 

Classes

struct  DataFromChildrenInboxTag
 
struct  ElementsAllocator
 A Parallel::protocols::ArrayElementsAllocator that creates array elements to cover the initial computational domain multiple times at different refinement levels, suitable for the LinearSolver::multigrid::Multigrid algorithm. More...
 
struct  Multigrid
 A V-cycle geometric multgrid solver for linear equations \(Ax = b\). More...
 
struct  VcycleDownLabel
 A label indicating the pre-smoothing step in a V-cycle multigrid algorithm, i.e. the smoothing step before sending the residual to the coarser (parent) grid. More...
 
struct  VcycleUpLabel
 A label indicating the post-smoothing step in a V-cycle multigrid algorithm, i.e. the smoothing step before sending the correction to the finer (child) grid. More...
 

Functions

template<size_t Dim>
std::vector< std::array< size_t, Dim > > coarsen (std::vector< std::array< size_t, Dim > > initial_refinement_levels)
 Coarsen the initial refinement levels of all blocks in the domain. More...
 
template<size_t Dim>
ElementId< Dim > parent_id (const ElementId< Dim > &child_id)
 The element covering the child_id on the coarser grid. More...
 
template<size_t Dim>
std::unordered_set< ElementId< Dim > > child_ids (const ElementId< Dim > &parent_id, const std::array< size_t, Dim > &children_refinement_levels)
 The elements covering the parent_id on the finer grid. More...
 

Detailed Description

Items related to the multigrid linear solver.

See also
LinearSolver::multigrid::Multigrid

Function Documentation

◆ child_ids()

template<size_t Dim>
std::unordered_set< ElementId< Dim > > LinearSolver::multigrid::child_ids ( const ElementId< Dim > &  parent_id,
const std::array< size_t, Dim > &  children_refinement_levels 
)

The elements covering the parent_id on the finer grid.

Template Parameters
DimThe spatial dimension of the domain
Parameters
parent_idThe ID of an element on the coarser grid
children_refinement_levelsThe refinement level of the finer grid in this block

Returns: std::unordered_set<ElementId<Dim>> The IDs of the elements on the finer grid that cover the parent_id. Returns an empty set if the parent_id is already on the finest grid. Else, returns at least one child (if the grids have the same refinement levels) and at most \(2^\mathrm{Dim}\) children (if the grid is finer in every dimension).

◆ coarsen()

template<size_t Dim>
std::vector< std::array< size_t, Dim > > LinearSolver::multigrid::coarsen ( std::vector< std::array< size_t, Dim > >  initial_refinement_levels)

Coarsen the initial refinement levels of all blocks in the domain.

Simply decrement the refinement level uniformly over the entire domain. Doesn't do anything for blocks that are already fully coarsened, so if the return value equals the input argument the entire domain is fully coarsened. Decrementing the refinement level means combining two elements into one, thereby halving the number of elements per dimension.

Template Parameters
DimThe spatial dimension of the domain
Parameters
initial_refinement_levelsThe refinement level in each block of the domain and in every dimension.

Returns: std::vector<std::array<size_t, Dim>> The coarsened refinement levels by decrementing every entry in initial_refinement_levels unless it is already zero.

◆ parent_id()

template<size_t Dim>
ElementId< Dim > LinearSolver::multigrid::parent_id ( const ElementId< Dim > &  child_id)

The element covering the child_id on the coarser grid.

Template Parameters
DimThe spatial dimension of the domain
Parameters
child_idThe ID of an element on the finer grid

Returns: ElementId<Dim> The ID of the element on the coarser grid that covers the child_id. This parent element covers at most two child elements per dimension.