SpECTRE
v2025.03.17
|
ParallelComponent representing a set of points to be interpolated to and a function to call upon interpolation to those points. More...
#include <InterpolationTarget.hpp>
Public Types | |
using | interpolation_target_tag = InterpolationTargetTag |
using | chare_type = ::Parallel::Algorithms::Singleton |
using | const_global_cache_tags = Parallel::get_const_global_cache_tags_from_actions< tmpl::flatten< tmpl::list< typename InterpolationTargetTag::compute_target_points, typename InterpolationTargetTag::post_interpolation_callbacks > > > |
using | metavariables = Metavariables |
using | phase_dependent_action_list = implementation defined |
using | simple_tags_from_options = Parallel::get_simple_tags_from_options< Parallel::get_initialization_actions_list< phase_dependent_action_list > > |
Static Public Member Functions | |
static std::string | name () |
static void | execute_next_phase (Parallel::Phase next_phase, Parallel::CProxy_GlobalCache< metavariables > &global_cache) |
ParallelComponent representing a set of points to be interpolated to and a function to call upon interpolation to those points.
Each InterpolationTarget will communicate with the Interpolator
.
InterpolationTargetTag
must conform to the intrp::protocols::InterpolationTargetTag protocol.
The metavariables must contain the following type aliases:
tmpl::list
of tags that define a Variables
sent from all Element
s to the local Interpolator
.tmpl::list
of all InterpolationTargetTag
s.Metavariables
must contain the following static constexpr members:
Each set of points to be interpolated onto is labeled by a temporal_id
. If any step of the interpolation procedure ever uses a time-dependent CoordinateMap
, then it needs to grab FunctionOfTime
s from the GlobalCache
. Before doing so, it must verify that those FunctionOfTime
s are up-to-date for the given temporal_id
.
Note that once the FunctionOfTime
has been verified to be up-to-date for a particular temporal_id
at one step in the interpolation procedure, all subsequent steps of the interpolation procedure for that same temporal_id
need not worry about re-verifying the FunctionOfTime
. Therefore, we need only focus on the first step in the interpolation procedure that needs FunctionOfTime
s: computing the points on which to interpolate.
Each InterpolationTarget
has a function InterpolationTargetTag::compute_target_points
that returns the points to be interpolated onto, expressed in the frame InterpolationTargetTag::compute_target_points::frame
. Then the function block_logical_coordinates
(and eventually element_logical_coordinates
) is called to convert those points to the element logical frame to do the interpolation. If InterpolationTargetTag::compute_target_points::frame
is different from the grid frame, and if the CoordinateMap
is time-dependent, then block_logical_coordinates
grabs FunctionOfTime
s from the GlobalCache
. So therefore any Action calling block_logical_coordinates
must wait until the FunctionOfTime
s in the GlobalCache
are up-to-date for the temporal_id
being passed into block_logical_coordinates
.
Here we describe the logic used in all the Actions that call block_logical_coordinates
.
Recall that InterpolationTarget
can be used with the Interpolator
ParallelComponent (as for the horizon finder), or by having the Element
s interpolate directly (as for most Observers). Here we discuss the case when the Interpolator
is used; the other case is discussed below.
Ensuring the FunctionOfTime
s are up-to-date is done via two Tags in the DataBox and a helper Action. When interpolation is requested for a new temporal_id
(e.g. by intrp::Events::Interpolate
), the temporal_id
is added to Tags::PendingTemporalIds
, which holds a std::deque<temporal_id>
, and represents temporal_ids
that we want to interpolate onto, but for which FunctionOfTime
s are not necessarily up-to-date. We also keep another list of temporal_ids
: Tags::TemporalIds
, for which FunctionOfTime
s are guaranteed to be up-to-date.
The action Actions::VerifyTemporalIdsAndSendPoints
moves temporal_id
s from PendingTemporalIds
to TemporalIds
as appropriate, and if any temporal_id
s have been so moved, it generates the block_logical_coordinates
and sends them to the Interpolator
ParallelComponent
. The logic is illustrated in pseudocode below. Recall that some InterpolationTargets are sequential, (i.e. you cannot interpolate onto one temporal_id until interpolation on previous ones are done, like the apparent horizon finder), and some are non-sequential (i.e. you can interpolate in any order).
Note that VerifyTemporalIdsAndSendPoints always exits in one of three ways:
TemporalIds
, and there are no PendingTemporalIds
left.We now describe the logic of the Actions that use VerifyTemporalIdsAndSendPoints.
Actions::AddTemporalIdsToInterpolationTarget
is called by intrp::Events::Interpolate
to trigger interpolation for new temporal_id
s. Its logic is as follows, in pseudocode:
Actions::InterpolationTargetReceiveVars
is called by the Interpolator
when it is finished interpolating the current temporal_id
. For the sequential case, it needs to start interpolating for the next temporal_id
. The logic is, in pseudocode:
intrp::callbacks::FindApparentHorizon calls
block_logical_coordinates
when it needs to start a new iteration of the horizon finder at the same temporal_id
, so one might think you need to worry about up-to-date FunctionOfTime
s. But since intrp::callbacks::FindApparentHorizon
always works on the same temporal_id
for which the FunctionOfTime
s have already been verified as up-to-date from the last iteration, no special consideration of FunctionOfTime
s need be done here.
This case is easier than the case with the Interpolator
, because the target points are always time-independent in the frame compute_target_points::frame
.
Actions::EnsureFunctionOfTimeUpToDate
verifies that the FunctionOfTime
s are up-to-date at the DgElementArray
s current time.
Actions::EnsureFunctionOfTimeUpToDate
is placed inDgElementArray
s PDAL before any use of interpolation.
Actions::InterpolationTargetSendTimeIndepPointsToElements
is invoked on InterpolationTarget
during the Registration PDAL, to send time-independent point information to Element
s.
Send the result of
compute_target_points
to allElement
s.
Note that this may need to be revisited because every Element
has a copy of every target point, which may use a lot of memory. An alternative is for each Element to invoke an Action on each InterpolationTarget
(presumably from an Event
) at each time, and then the InterpolationTarget invokes another Action to send points to only those Elements
that contain the points; this alternative uses less memory but much more communication. Another alternative would be to place the points in the GlobalCache (one copy per node) since the points need be computed only once.