9import toolbox.loadbalancing.api.actionsets
13Cells = toolbox.blockstructured.api.InterpolateAndRestrictCells
18 solver.add_pde_term(
exahype2.api.Flux(implementation=
"F[0] = Q[0]; F[1] = Q[1];"))
26 elif scheme ==
"fv-optimistic":
35 solver, patch_size=4, rk_order=2
45 [
"probe"],
"probe",
"probe", directory=str(tmp_path)
47 exahype2_project.set_global_simulation_parameters(
52 periodic_BC=[
True,
True,
True],
56 solver.generate_solver_realisation(exahype2_project, peano_project, *graphs)
60@pytest.mark.parametrize("scheme", ["fv", "fv-optimistic"])
65 adapt, project = graph.ordered_tasks()
66 assert adapt.name ==
"Probe_Adapt mesh and balance load"
67 assert adapt.has_to_repeat
is not None
68 assert project.name ==
"Probe_Project on faces"
69 assert project.dependencies == [adapt]
70 kinds = [type(action_set)
for action_set
in adapt.action_sets]
73 assert toolbox.loadbalancing.api.actionsets.LoadBalancing
in kinds
75 assert discards == (scheme ==
"fv-optimistic")
84 adapt, project = graph.ordered_tasks()
85 kinds = [type(action_set)
for action_set
in adapt.action_sets]
88 projection_kinds = [type(action_set)
for action_set
in project.action_sets]
90 assert toolbox.blockstructured.api.RestrictHangingFaces
in projection_kinds
95 [
"probe"],
"probe",
"probe", directory=str(tmp_path)
97 exahype2_project.set_global_simulation_parameters(
102 periodic_BC=[
True,
True,
True],
106 solver.generate_solver_realisation(exahype2_project, peano_project, *graphs)
107 return {task.name: task
for task
in graphs[1].tasks}
113 for stage
in range(2):
114 reconstruction = tasks[f
"Probe_Reconstruct stage {stage}"]
116 isinstance(a, toolbox.blockstructured.api.InterpolateHangingFaces)
117 for a
in reconstruction.action_sets
120 "Probe_Project stage 1 onto faces",
121 "Probe_Project solution onto faces",
123 kinds = [type(a)
for a
in tasks[name].action_sets]
124 restriction = kinds.index(toolbox.blockstructured.api.RestrictHangingFaces)
130 assert restriction < len(kinds) - 1
136 solver, interpolation=Cells.Interpolation.PiecewiseConstant
138 mine = solver.mesh_adaptation
140 assert solver.mesh_adaptation
is mine
141 adapt = graph.ordered_tasks()[0]
142 [cells] = [a
for a
in adapt.action_sets
if isinstance(a, Cells)]
143 assert "interpolateCell_AoS_piecewise_constant" in cells.get_body_of_operation(
144 ActionSet.OPERATION_CREATE_CELL
151 created = cells.get_body_of_operation(ActionSet.OPERATION_CREATE_CELL)
152 assert "interpolateCell_AoS_linear_with_constant_extrapolation" in created
153 assert "coarseGridCellQ.value,\n fineGridCellQ.value" in created
154 touched = cells.get_body_of_operation(ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME)
155 assert "marker.hasBeenRefined() and not marker.willBeRefined()" in touched
156 assert "clearCell" in touched
157 destroyed = cells.get_body_of_operation(ActionSet.OPERATION_DESTROY_CELL)
158 assert "restrictCell_AoS_averaging" in destroyed
159 assert "fineGridCellQ.value,\n coarseGridCellQ.value" in destroyed
166 "RefinementControlService"
167 in consume.get_body_of_createGridControlEventsForNextTraversal()
169 unprepare = consume.get_body_of_unprepareTraversal()
170 assert "RefinementControlService::getInstance().finishStep()" in unprepare
171 assert "resetTimeStepSize()" in unprepare
173 ActionSet.OPERATION_CREATE_CELL,
174 ActionSet.OPERATION_DESTROY_CELL,
176 assert "_meshHasChanged = true" in consume.get_body_of_operation(operation)
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.
Hand the refine and erase requests of the last time step over to Peano, and restart the time stepping...
Default mesh adaptation of the Finite Volume schemes.
Finite Volumes with a Rusanov Riemann solver and explicit Euler time stepping, realised over a block-...
Finite Volumes with a Rusanov Riemann solver and optimistic explicit Euler time stepping,...
Setup phase counterpart to RusanovWithExplicitEuler: sets the initial condition for a Finite Volume s...
Discard the patch interior.
Default mesh adaptation of the fourth-order finite differences.
Fourth-order central Finite Differences with explicit Runge-Kutta time stepping, realised over a bloc...
Setup phase of the fourth-order Finite Differences with Runge-Kutta time stepping (exahype2....
Project a patch's data onto the overlap held on its surrounding faces, so the halo layers can be reco...
Represents a Peano 4 project.
Patch implementation of a degree of freedom.
Action set (reactions to events)
Holds a sequence of Task instances.
One task within a peano4.api.taskgraph.Graph.
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_cells_are_interpolated_cleared_and_restricted()
test_finite_differences_handle_hanging_faces_in_every_stage(tmp_path)
test_user_defined_mesh_adaptation_is_kept(tmp_path)
test_finite_differences_adapt_mesh_and_balance_load_by_default(tmp_path)
test_consumption_hands_over_requests_and_resets_time_step_size()
_mesh_adaptation_graph(solver, tmp_path)
test_finite_volumes_adapt_mesh_and_balance_load_by_default(scheme, tmp_path)
_time_step_tasks(solver, tmp_path)