Protocols.hpp
2 // See LICENSE.txt for details.
3
4 #pragma once
5
6 #include "Domain/Tags.hpp"
7
8 namespace LinearSolver::Schwarz {
9 /// Protocols related to the Schwarz solver
10 namespace protocols {
11
12 /*!
13  * \brief A linear operator restricted to an element-centered Schwarz subdomain
14  *
15  * A subdomain operator must have these static member variables:
16  * - size_t volume_dim: The number of spatial dimensions
17  *
18  * A subdomain operator must have these type aliases:
19  * - element_operator: A DataBox-invokable that applies the operator to the
20  * data on the central element of the subdomain. It must take these arguments,
21  * in this order, and following the types of the argument_tags it specifies:
22  * - LinearSolver::Schwarz::ElementCenteredSubdomainData: The operand data
23  * to which the operator should be applied
24  * - gsl::not_null<LinearSolver::Schwarz::ElementCenteredSubdomainData*>:
25  * The data where the result of the operator applied to the operand should be
26  * written to
27  * - gsl::not_null<SubdomainOperator*>: An instance of the subdomain
28  * operator. Can be used to store buffers to avoid repeatedly allocating
29  * memory or to cache quantities for subsequent invocations of the
30  * face_operator.
31  * - face_operator: A DataBox-invokable on interfaces that applies the
32  * operator to the data on an element face. It must be specialized for
33  * domain::Tags::InternalDirections and
34  * domain::Tags::BoundaryDirectionsInterior and must take the same arguments
35  * as the element_operator in addition to the argument_tags it specifies.
36  *
37  * Since the subdomain operator is implemented as DataBox-invokables, it can
38  * retrieve any background data, i.e. data that does not depend on the variables
39  * it operates on, from the DataBox. Background data on overlap regions with
40  * other elements can be either initialized in advance if possible or
41  * communicated with the LinearSolver::Schwarz::Actions::SendOverlapFields and
42  * LinearSolver::Schwarz::Actions::ReceiveOverlapFields actions. Note that
43  * such communication should not be necessary between iterations of the Schwarz
44  * solve, but only between successive solves, because background data should not
45  * change during the solve. All variable data is passed to the operator as an
46  * argument (see above).
47  *
48  * Here's an example of a subdomain operator that is the restriction of an
49  * explicit global matrix:
50  *
51  * \snippet Test_SchwarzAlgorithm.cpp subdomain_operator
52  */
54  template <typename ConformingType>
55  struct test {
56  static constexpr size_t volume_dim = ConformingType::volume_dim;
57  using element_operator = typename ConformingType::element_operator;
58  using face_operator_internal =
59  typename ConformingType::template face_operator<
61  using face_operator_external =
62  typename ConformingType::template face_operator<
64  };
65 };
66
67 } // namespace protocols
68 } // namespace LinearSolver::Schwarz
Tags.hpp
domain::Tags::BoundaryDirectionsInterior
Definition: Tags.hpp:296
LinearSolver::Schwarz
Items related to the Schwarz linear solver.
Definition: CommunicateOverlapFields.hpp:36
LinearSolver::Schwarz::protocols::SubdomainOperator
A linear operator restricted to an element-centered Schwarz subdomain.
Definition: Protocols.hpp:53
domain::Tags::InternalDirections
Definition: Tags.hpp:269
LinearSolver::Schwarz::protocols::SubdomainOperator::test
Definition: Protocols.hpp:55