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[
"Probe_Evaluate right hand side stage 1"].action_sets
62 assert scheme.overlap == 3
63 assert solver._patch_with_halo.dim == (11, 11, 11)
65 assert scheme.advection_velocity == [2, 3, 4]
66 assert scheme.advected_quantities == [0, 1]
67 tasks =
_tasks(solver, tmp_path)
68 for stage
in range(2):
69 action_sets = tasks[f
"Probe_Evaluate right hand side stage {stage}"].action_sets
70 assert [type(action_set)
for action_set
in action_sets] == [
74 body = action_sets[1].get_body_of_operation(
75 peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME
77 assert "::exahype2::fd::addLopsidedAdvection(" in body
78 assert "constexpr int advectionVelocity[] = { 2, 3, 4 };" in body
79 assert "constexpr int advectedQuantities[] = { 0, 1 };" in body
81 assert f
"fineGridCellProbeQRhsEstimates.value + {stage * 2 * 125};" in body
85 with pytest.raises(ValueError):
88 right_hand_side_kernel=Kernel.CentralDifferencesWithLopsidedAdvection,
89 advected_quantities=[
"u"],
91 with pytest.raises(ValueError):
94 right_hand_side_kernel=Kernel.CentralDifferencesWithLopsidedAdvection,
95 advection_velocity=
"v",
100 with pytest.raises(ValueError):
101 _scheme(
_solver(), advection_velocity=
"v", advected_quantities=[
"u"])
105 with pytest.raises(TypeError):
110 with pytest.raises(ValueError):
113 right_hand_side_kernel=Kernel.CentralDifferencesWithLopsidedAdvection,
114 advection_velocity=
"v",
115 advected_quantities=[
"v"],
123 right_hand_side_kernel=Kernel.CentralDifferencesWithLopsidedAdvection,
124 advection_velocity=[2, 3],
125 advected_quantities=[
"u"],
127 with pytest.raises(ValueError):
133 resolve = exahype2.api.rkfd4.resolve_quantities
134 assert resolve(solver, [
"u", 1]) == [0, 1]
135 assert resolve(solver, [
"v"], include_auxiliary_variables=
True) == [2, 3, 4]
136 for quantities
in ([
"v"], [2], [], [
True], [1.5]):
137 with pytest.raises((ValueError, TypeError)):
138 resolve(solver, quantities)
147 kreiss_oliger_sigma=1.0,
148 right_hand_side_kernel=Kernel.CentralDifferencesWithLopsidedAdvection,
149 advection_velocity=exagrype.api.CCZ4Solver.ADVECTION_VELOCITY,
150 advected_quantities=solver.lopsided_advection_quantities(),
152 assert scheme.advection_velocity == [17, 18, 19]
154 assert scheme.advected_quantities == list(range(6, 16)) + list(range(20, 54)) + [
170 kreiss_oliger_sigma=1.0,
171 right_hand_side_kernel=Kernel.CentralDifferencesWithLopsidedAdvection,
172 advection_velocity=
"shift",
173 advected_quantities=solver.lopsided_advection_quantities(),
175 assert solver.numerical_scheme.overlap == 3
176 tasks =
_tasks(solver, tmp_path)
179 for action_set
in tasks[
"CCZ4_Evaluate right hand side stage 0"].action_sets
Solver for the Einstein equations in the first-order CCZ4 formulation.
Fourth-order Finite Differences with Kreiss-Oliger dissipation.
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_advected_quantities_have_to_be_unknowns()
test_ccz4_lopsided_advection_quantities()
test_central_differences_reject_advection_arguments()
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)
_tasks(solver, directory)
test_lopsided_advection_runs_after_central_differences(tmp_path)
test_resolve_quantities_accepts_auxiliary_variables_on_request()