44def get_access_to_persistent_face_data(solver, exahype2_project, default):
47 Access qualifier of the persistent face data for a task of the time step
49 Sommerfeld boundary conditions advance the ghost cells within the roll
50 over of the projection onto the faces, and they read the old face data
51 there (@ref exahype2::blockstructured::applySommerfeldBoundaryConditions()).
52 The face data hence has to survive the reconstruction of the halo, and
53 the projection has to load it:
54 peano4.api.taskgraph.compiler.DeriveLoadStoreComputeFlag only stores
55 data after tasks which write it, and only loads it before tasks which
56 read it. With Sommerfeld boundary conditions, all tasks of the time step
57 which use the persistent face data therefore have to declare
60 @param solver: exahype2.api.Solver
62 @param exahype2_project: exahype2.api.Project
64 @param default: peano4.api.taskgraph.Task.DataAccess
65 The qualifier the task uses without Sommerfeld boundary conditions,
66 typically READ_AND_DISCARD for the reconstruction and WRITE for the
69 @return peano4.api.taskgraph.Task.DataAccess
75 get_boundary_conditions(solver, exahype2_project), SommerfeldBoundaryConditions
77 return peano4.api.taskgraph.Task.DataAccess.READ_AND_WRITE
81def get_boundary_conditions(solver, exahype2_project):
84 The solver's boundary condition term, or None if the domain has no boundary
86 @param solver: exahype2.api.Solver
87 The solver whose PDE terms are checked.
89 @param exahype2_project: exahype2.api.Project
90 Provides the periodic boundary conditions (periodic_BC).
92 @return exahype2.api.DirichletBoundaryConditions,
93 exahype2.api.SommerfeldBoundaryConditions or None
94 None if and only if all axes are periodic.
97 If all axes are periodic and the solver holds a boundary condition
98 term, if at least one axis is not periodic and the solver holds no or
99 more than one boundary condition term, if the term is stateless, or if
100 the solver holds a SommerfeldBoundaryConditions term but no
101 non-stateless MaxEigenvalue term.
105 term
for term
in solver.pde_terms
if isinstance(term, BOUNDARY_CONDITION_TERMS)
107 periodic_BC = exahype2_project.periodic_BC
112 f
"Solver {solver.name} holds the boundary condition term(s) "
113 f
"{', '.join(type(term).__name__ for term in terms)}, but all axes "
114 f
"are periodic (periodic_BC={periodic_BC}), i.e. the domain has "
115 "no boundary. Remove the term(s) via solver.remove_pde_term(...), "
116 "or make at least one axis non-periodic."
122 f
"Solver {solver.name} has non-periodic boundaries "
123 f
"(periodic_BC={periodic_BC}), but no boundary condition PDE term. "
124 "Add one via solver.add_pde_term(exahype2.api.DirichletBoundaryConditions(...)) "
125 "or solver.add_pde_term(exahype2.api.SommerfeldBoundaryConditions(...)), "
126 "or make all axes periodic."
130 f
"Solver {solver.name} holds more than one boundary condition term "
131 f
"({', '.join(type(term).__name__ for term in terms)}). Keep exactly one."
137 f
"Solver {solver.name} holds a stateless {type(term).__name__} term, "
138 "but only the non-stateless variant is supported. Add it with stateless=False."
140 if isinstance(term, SommerfeldBoundaryConditions)
and not any(
141 isinstance(other, MaxEigenvalue)
and not other.stateless
142 for other
in solver.pde_terms
145 f
"Solver {solver.name} uses Sommerfeld boundary conditions, which take "
146 "their wave speed from the maximum eigenvalue, but has no non-stateless "
147 "MaxEigenvalue PDE term. Add one via "
148 "solver.add_pde_term(exahype2.api.MaxEigenvalue(...))."
150 if isinstance(term, SommerfeldBoundaryConditions):
152 term.get_origin(len(periodic_BC))