SpECTRE
v2024.09.29
|
Protocol for an implicit sector of an IMEX system. More...
#include <ImplicitSector.hpp>
Classes | |
struct | test |
Protocol for an implicit sector of an IMEX system.
An implicit sector describes the sources for one implicit solve performed during IMEX evolution. A system may have multiple implicit sectors, but they must be independent, i.e., their sources must not depend on any tensors in other sectors.
Classes implementing this protocol must define:
tensors
type alias of tags for the variables to be solved forinitial_guess
type to be passed to db::mutate_apply
, taking additional arguments for the inhomogeneous terms \(X\) and implicit weight \(w\) in the equation to be solved: \(u = X + w S(u)\). (See example below.) It must return a std::vector<GuessResult>
indicating, for each point, whether the implicit equation has been solved analytically or whether the numerical solve should continue. An empty return is equivalent to imex::GuessResult::InitialGuess
for every point, so numerical solves will be performed for each. When this is called, the sector variables will have the value from the explicit part of the time step. This mutator will not be called if the implicit weight is zero, as the solution is trivial in that case. If using the value of the explicit step as an initial guess is acceptable, this can be the type imex::GuessExplicitResult
.solve_attempts
list of sources that will be attempted to be solved, in order. The first one that succeeds at each point will be used. Pieces of code that need "the" source for the sector will use the source from the first entry. Each attempt must be a struct with the following types:tags_from_evolution
for tags in addition to the sector tensors to be made available from the evolution DataBox. Volume quantities will be reduced to have one grid point, with the appropriate value for the point being solved for.simple_tags
for temporaries (e.g., primitives)compute_tags
source
type to be passed to db::mutate_apply
to compute the sources. It must conform to imex::protocols::ImplicitSource.jacobian
type to be passed to db::mutate_apply
to compute the source jacobian. It must conform to imex::protocols::ImplicitSourceJacobian. If the implicit equation can always be solved analytically for the sector, the jacobian is not required and this may be the type imex::NoJacobianBecauseSolutionIsAnalytic
.source_prep
and jacobian_prep
that will be called before the corresponding main mutator, e.g., for computing primitives. Mutators appearing in multiple lists, as well as the source
and jacobian
mutators, will be skipped if they have already been applied for the current point. Note that the source_prep
mutators are only used during the implicit solve, and any preparation needed before the source
call in the main action loop to record the history is the responsibility of the user.All Variables
in the DataBox, including the sources and source jacobian, will be initialized to zero with a single grid point.
Examples of definitions of a complicated implicit source and jacobian: