6from .RollOverUpdatedFace
import RollOverUpdatedFace
7from ...blockstructured.BoundaryConditions
import get_boundary_conditions
14 Roll over the face data, and set the ghost volumes along the domain
15 boundary through exahype2.api.SommerfeldBoundaryConditions first
17 The action set replaces exahype2.api.fv.actionsets.RollOverUpdatedFace
18 if the solver uses Sommerfeld boundary conditions. Such a solver has no
19 separate boundary task (exahype2.api.fv.actionsets.ApplyDirichletBoundaryConditions).
20 In touchFaceLastTime(), the action set first writes the ghost volumes
21 into the ghost half of patch_overlap_update, and then rolls over both
22 halves into patch_overlap_current_time_step like RollOverUpdatedFace.
23 Faces within the domain and faces along periodic axes are rolled over
24 unchanged. There are two variants:
26 - With a time_step_size, the action set advances the ghost volumes
27 through @ref exahype2::blockstructured::applySommerfeldBoundaryConditions().
28 patch_overlap_current_time_step still holds the old solution, i.e.
29 both its halves are valid, and patch_overlap_update holds the new
30 interior solution. The time step uses this variant.
31 - Without a time_step_size, the action set initialises the ghost volumes
32 with the initial condition, i.e. it evaluates the solver's
33 initPointWisely() at their centres through
34 @ref exahype2::blockstructured::applyDirichletBoundaryConditions().
35 The grid construction uses this variant, so the first time step finds
38 The C++ header documents the conditions, their discretisation and why
39 they replace the roll over.
43 TemplateSommerfeldBoundaryConditions = jinja2.Template(
45 ::exahype2::blockstructured::applySommerfeldBoundaryConditions(
48 const tarch::la::Vector<Dimensions, double>& x,
52 repositories::{{SOLVER_INSTANCE}}.maxEigenvalue(Q, x, normal, &lambdaMax);
55 [](const tarch::la::Vector<Dimensions, double>& x, double* Q) -> void {
56 repositories::{{SOLVER_INSTANCE}}.sommerfeldFarFieldSolution(x, Q);
64 {{NUMBER_OF_UNKNOWNS}},
65 {{NUMBER_OF_AUXILIARY_VARIABLES}},
66 tarch::la::Vector<Dimensions, double>({{ORIGIN}}),
68 {{CURRENT_TIME_STEP_ACCESSOR}}.value,
69 {{UPDATE_ACCESSOR}}.value
74 TemplateInitialGhostCells = jinja2.Template(
76 ::exahype2::blockstructured::applyDirichletBoundaryConditions(
77 [](const tarch::la::Vector<Dimensions, double>& x, double t, double* Q) -> void {
78 repositories::{{SOLVER_INSTANCE}}.initPointWisely(x, Q);
86 {{NUMBER_OF_UNKNOWNS}} + {{NUMBER_OF_AUXILIARY_VARIABLES}},
87 repositories::{{SOLVER_INSTANCE}}.getMinTimeStamp(),
88 {{UPDATE_ACCESSOR}}.value
96 patch_overlap_current_time_step,
105 @param solver: exahype2.api.Solver
106 The solver whose maxEigenvalue(), sommerfeldFarFieldSolution() and
107 initPointWisely() are invoked.
109 @param patch_overlap_current_time_step: peano4.api.datamodel.Patch
110 @see RollOverUpdatedFace.
112 @param patch_overlap_update: peano4.api.datamodel.Patch
113 @see RollOverUpdatedFace.
116 @see RollOverUpdatedFace.
119 @see RollOverUpdatedFace.
121 @param origin: List[float]
122 Centre of the system, one entry per dimension, @ref
123 exahype2.api.blockstructured.SommerfeldBoundaryConditions.SommerfeldBoundaryConditions.get_origin().
125 @param time_step_size: str
126 C++ expression for the time step size by which the ghost volumes
127 are advanced, or None to initialise the ghost volumes with the
128 initial condition instead.
132 patch_overlap_current_time_step, patch_overlap_update, guard, includes
135 self.
d[
"SOLVER_INSTANCE"] = solver.get_name_of_global_instance()
136 self.
d[
"NUMBER_OF_UNKNOWNS"] = str(solver.unknowns)
137 self.
d[
"NUMBER_OF_AUXILIARY_VARIABLES"] = str(solver.auxiliary_variables)
138 self.
d[
"ORIGIN"] =
"{" +
", ".join(repr(float(x))
for x
in origin) +
"}"
139 self.
d[
"TIME_STEP_SIZE"] = time_step_size
145 == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_FACE_LAST_TIME
152 result = template.render(**self.
d) + result
156 return __name__.replace(
".py",
"").replace(
".",
"_")
161#include "exahype2/blockstructured/DirichletBoundaryConditions.h"
162#include "exahype2/blockstructured/SommerfeldBoundaryConditions.h"
177 Create the roll over of the solver's face data
179 @return RollOverUpdatedFace
180 RollOverUpdatedFaceWithSommerfeldBoundaryConditions if the solver
181 uses exahype2.api.SommerfeldBoundaryConditions, and a plain
182 RollOverUpdatedFace otherwise, i.e. for Dirichlet boundary
183 conditions or a domain without boundary.
185 @param solver: exahype2.api.Solver
186 The solver whose solver._patch_overlap_update is rolled over into
187 solver._patch_overlap_current_time_step. Its boundary condition
188 terms have to be consistent with the domain, @ref
189 exahype2.api.blockstructured.BoundaryConditions.get_boundary_conditions().
191 @param exahype2_project: exahype2.api.Project
192 Provides the periodic boundary conditions.
195 @see RollOverUpdatedFace.
198 @see RollOverUpdatedFace.
200 @param time_step_size: str
201 @see the constructor. Ignored for a plain RollOverUpdatedFace.
204 term = get_boundary_conditions(solver, exahype2_project)
205 if isinstance(term, SommerfeldBoundaryConditions):
208 solver._patch_overlap_current_time_step,
209 solver._patch_overlap_update,
212 origin=term.get_origin(len(exahype2_project.periodic_BC)),
213 time_step_size=time_step_size,
216 solver._patch_overlap_current_time_step,
217 solver._patch_overlap_update,
Sommerfeld (radiative, outgoing) boundary conditions: waves leave the domain with little reflection,...
Roll over the face data, and set the ghost volumes along the domain boundary through exahype2....
get_action_set_name(self)
Return unique action set name.
get_includes(self)
Return include statements that you need.
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
create_roll_over(solver, exahype2_project, guard, includes, time_step_size=None)
Create the roll over of the solver's face data.
__init__(self, solver, patch_overlap_current_time_step, patch_overlap_update, guard, includes, origin, time_step_size=None)
TemplateInitialGhostCells
TemplateSommerfeldBoundaryConditions
Copy patch_overlap_update - the face overlap exahype2.api.fv.actionsets.ProjectPatchOntoFaces has jus...