1"""Hanging faces on adaptive meshes: the toolbox action sets
2(toolbox.blockstructured.api.InterpolateHangingFaces,
3toolbox.blockstructured.api.RestrictHangingFaces) and how the Finite
4Volume scheme uses them."""
14Interpolate = toolbox.blockstructured.api.InterpolateHangingFaces
15Restrict = toolbox.blockstructured.api.RestrictHangingFaces
24 body = action_set.get_body_of_operation(ActionSet.OPERATION_CREATE_HANGING_FACE)
25 assert "interpolateHaloLayer_AoS_linear_with_constant_extrapolation(" in body
26 assert "coarseGridFacesQFace(marker.getSelectedFaceNumber()).value" in body
27 assert "fineGridFaceQFace.value" in body
29 ActionSet.OPERATION_DESTROY_HANGING_FACE,
30 ActionSet.OPERATION_TOUCH_FACE_FIRST_TIME,
31 ActionSet.OPERATION_CREATE_CELL,
33 assert action_set.get_body_of_operation(operation) ==
""
38 body = action_set.get_body_of_operation(ActionSet.OPERATION_CREATE_HANGING_FACE)
39 assert "interpolateHaloLayer_AoS_piecewise_constant(" in body
44 body = action_set.get_body_of_operation(ActionSet.OPERATION_DESTROY_HANGING_FACE)
45 assert "restrictInnerHalfOfHaloLayer_AoS_averaging(" in body
46 assert "coarseGridFacesQFace(marker.getSelectedFaceNumber()).value" in body
47 clear = action_set.get_body_of_operation(ActionSet.OPERATION_TOUCH_FACE_FIRST_TIME)
48 assert "clearHaloLayerAoS(" in clear
50 action_set.get_guard_of_operation(ActionSet.OPERATION_TOUCH_FACE_FIRST_TIME)
57 body = action_set.get_body_of_operation(ActionSet.OPERATION_DESTROY_HANGING_FACE)
58 assert "restrictInnerHalfOfHaloLayer_AoS_inject(" in body
60 action_set.get_body_of_operation(ActionSet.OPERATION_TOUCH_FACE_FIRST_TIME)
71 solver, 9, **scheme_arguments
74 solver, volume_size=0.1
77 [
"probe"],
"probe",
"probe", directory=str(tmp_path)
79 exahype2_project.set_global_simulation_parameters(
84 periodic_BC=[
True,
True,
True],
88 solver.generate_solver_realisation(exahype2_project, peano_project, *graphs)
89 return solver, [{task.name: task
for task
in graph.tasks}
for graph
in graphs[:2]]
93 return [a
for a
in task.action_sets
if isinstance(a, action_set_type)]
99 solver, (setup, time_step) =
_graphs(tmp_path)
101 time_step[
"Probe_Reconstruct"], Interpolate
104 assert "Probe_Interpolate hanging faces" not in time_step
105 actions = time_step[
"Probe_Reconstruct"].action_sets
106 assert actions.index(interpolation) < min(
107 i
for i, a
in enumerate(actions)
if type(a).__name__ ==
"ReconstructPatchWithHalo"
109 assert interpolation.scheme == Interpolate.Scheme.Linear
110 assert interpolation.d[
"FACE_NAME"] == solver._patch_overlap_current_time_step.name
111 assert "Probe_Restrict on hanging faces" not in time_step
113 time_step[
"Probe_Project on faces"], Restrict
115 assert restriction.scheme == Restrict.Scheme.Averaging
116 assert restriction.d[
"FACE_NAME"] == solver._patch_overlap_update.name
118 setup[
"Probe Project on faces"], Restrict
120 assert setup_restriction.d[
"FACE_NAME"] == solver._patch_overlap_update.name
124 _, (setup, time_step) =
_graphs(
126 interpolation=Interpolate.Scheme.PiecewiseConstant,
127 restriction=Restrict.Scheme.Inject,
130 time_step[
"Probe_Reconstruct"], Interpolate
132 assert interpolation.scheme == Interpolate.Scheme.PiecewiseConstant
134 time_step[
"Probe_Project on faces"],
135 setup[
"Probe Project on faces"],
138 assert restriction.scheme == Restrict.Scheme.Inject
146 _, (_, time_step) =
_graphs(tmp_path)
147 projection = time_step[
"Probe_Project on faces"]
148 assert "Probe_Restrict on hanging faces" not in time_step
149 assert "Probe_Roll over faces" not in time_step
150 assert [type(a).__name__
for a
in projection.action_sets] == [
151 "ProjectPatchOntoFaces",
152 "RestrictHangingFaces",
153 "RollOverUpdatedFace",
The conservative flux F(Q) of a hyperbolic PDE.
Point-wise initial condition: given the physical position of a single degree of freedom,...
The maximum absolute eigenvalue of the flux Jacobian in a given direction, i.e.
Abstract base class for all ExaHyPE 2 solvers.
Finite Volumes with a Rusanov Riemann solver and explicit Euler time stepping, realised over a block-...
Setup phase counterpart to RusanovWithExplicitEuler: sets the initial condition for a Finite Volume s...
Represents a Peano 4 project.
Patch implementation of a degree of freedom.
Action set (reactions to events).
Holds a sequence of Task instances.
The Python-side model of "what happens during one mesh sweep".
The task graph abstraction allows users to formalise their solver steps over small task graphs which ...
test_interpolation_defaults_to_linear_in_create_hanging_face()
test_reconstruction_interpolates_before_it_reconstructs_and_restricts_projection(tmp_path)
_action_sets_of_type(task, action_set_type)
test_injection_does_not_clear_faces()
test_averaging_restricts_in_destroy_hanging_face_and_clears_faces()
test_piecewise_constant_interpolation()
test_projection_hosts_the_restriction_and_the_roll_over(tmp_path)
_graphs(tmp_path, **scheme_arguments)
test_schemes_are_configurable(tmp_path)