12Kernel = exahype2.api.rkfd4.CentralDifferencesWithRungeKutta.RightHandSideKernel
23 solver, patch_size=5, rk_order=2, time_step_size=0.1, **arguments
25 solver.numerical_scheme = scheme
32 right_hand_side_kernel=Kernel.CentralDifferencesWithLopsidedAdvection,
33 advection_velocity=
"v",
34 advected_quantities=[
"u"],
40 exahype2_project = types.SimpleNamespace(periodic_BC=[
True,
True,
True])
43 solver.numerical_scheme.construct_output(exahype2_project, peano_project, time_step)
44 return {task.name: task
for task
in time_step.tasks}
50 assert scheme.right_hand_side_kernel == Kernel.CentralDifferences
51 assert scheme.overlap == 2
52 tasks =
_tasks(solver, tmp_path)
55 for action_set
in tasks[
56 "Probe_Evaluate Runge-Kutta right hand side stage 1"
59 assert "Probe_Add lopsided advection stage 1" not in tasks
65 assert scheme.overlap == 3
66 assert solver._patch_with_halo.dim == (11, 11, 11)
68 assert scheme.advection_velocity == [2, 3, 4]
69 assert scheme.advected_quantities == [0, 1]
70 tasks =
_tasks(solver, tmp_path)
71 for stage
in range(2):
74 evaluation = tasks[f
"Probe_Evaluate Runge-Kutta right hand side stage {stage}"]
75 advection = tasks[f
"Probe_Add lopsided advection stage {stage}"]
76 assert [type(a)
for a
in evaluation.action_sets] == [
79 assert [type(a)
for a
in advection.action_sets] == [
82 assert advection.dependencies == [evaluation]
83 body = advection.action_sets[0].get_body_of_operation(
84 peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME
86 assert "::exahype2::fd::addLopsidedAdvection(" in body
87 assert "constexpr int advectionVelocity[] = { 2, 3, 4 };" in body
88 assert "constexpr int advectedQuantities[] = { 0, 1 };" in body
90 assert f
"fineGridCellProbeQRhsEstimates.value + {stage * 5 * 125};" in body
94 with pytest.raises(ValueError):
97 right_hand_side_kernel=Kernel.CentralDifferencesWithLopsidedAdvection,
98 advected_quantities=[
"u"],
100 with pytest.raises(ValueError):
103 right_hand_side_kernel=Kernel.CentralDifferencesWithLopsidedAdvection,
104 advection_velocity=
"v",
109 with pytest.raises(ValueError):
110 _scheme(
_solver(), advection_velocity=
"v", advected_quantities=[
"u"])
114 with pytest.raises(TypeError):
119 with pytest.raises(ValueError):
122 right_hand_side_kernel=Kernel.CentralDifferencesWithLopsidedAdvection,
123 advection_velocity=
"v",
124 advected_quantities=[
"w"],
132 right_hand_side_kernel=Kernel.CentralDifferencesWithLopsidedAdvection,
133 advection_velocity=[2, 3],
134 advected_quantities=[
"u"],
136 with pytest.raises(ValueError):
142 resolve = exahype2.api.rkfd4.resolve_quantities
143 assert resolve(solver, [
"u", 1]) == [0, 1]
144 assert resolve(solver, [
"v"]) == [2, 3, 4]
145 for quantities
in ([
"w"], [5], [], [
True], [1.5]):
146 with pytest.raises((ValueError, TypeError)):
147 resolve(solver, quantities)
156 kreiss_oliger_sigma=1.0,
157 right_hand_side_kernel=Kernel.CentralDifferencesWithLopsidedAdvection,
158 advection_velocity=exagrype.api.FOCCZ4Solver.ADVECTION_VELOCITY,
159 advected_quantities=solver.advected_quantities(),
161 assert scheme.advection_velocity == [17, 18, 19]
163 assert scheme.advected_quantities == (
164 list(range(6, 16)) + list(range(20, 24)) + list(range(25, 58))
172 "CCZ4", parameters={
"CCZ4b": 0,
"CCZ4s": 1}
173 ).advected_quantities()
174 shifting = solver.advected_quantities()
175 assert set(shifting) - set(non_shifting) == {
"b",
"dxShift",
"dyShift",
"dzShift"}
184 kreiss_oliger_sigma=1.0,
185 right_hand_side_kernel=Kernel.CentralDifferencesWithLopsidedAdvection,
186 advection_velocity=
"shift",
187 advected_quantities=solver.advected_quantities(),
189 assert solver.numerical_scheme.overlap == 3
190 tasks =
_tasks(solver, tmp_path)
192 "CCZ4_Evaluate Runge-Kutta right hand side stage 0",
193 "CCZ4_Add lopsided advection stage 0",
194 "CCZ4_Add Kreiss-Oliger dissipation stage 0",
196 assert [[type(a)
for a
in tasks[name].action_sets]
for name
in chain] == [
201 assert tasks[chain[1]].dependencies == [tasks[chain[0]]]
202 assert tasks[chain[2]].dependencies == [tasks[chain[1]]]
Fourth-order Finite Differences with Kreiss-Oliger dissipation.
Solver for the Einstein equations in the first-order CCZ4 formulation.
Add the Kreiss-Oliger dissipation to the right-hand side of one Runge-Kutta stage.
Point-wise initial condition: given the physical position of a single degree of freedom,...
Abstract base class for all ExaHyPE 2 solvers.
Fourth-order central Finite Differences with explicit Runge-Kutta time stepping, realised over a bloc...
Add advection terms with lopsided stencils to the right-hand side of one Runge-Kutta stage.
Evaluate the right-hand side of one Runge-Kutta stage over a patch.
Represents a Peano 4 project.
Holds a sequence of Task instances.
This file is part of the ExaGRyPE project.
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 ...
_lopsided(solver, **arguments)
test_central_differences_reject_advection_arguments()
test_advected_quantities_have_to_exist()
test_kernel_has_to_be_an_enum()
_scheme(solver, **arguments)
test_velocity_needs_one_entry_per_dimension(tmp_path)
test_lopsided_advection_needs_velocity_and_quantities()
test_central_differences_are_the_default(tmp_path)
test_dissipation_runs_after_lopsided_advection(tmp_path)
test_ccz4_advected_quantities()
_tasks(solver, directory)
test_lopsided_advection_runs_after_central_differences(tmp_path)
test_resolve_quantities_selects_names_and_indices()