7explicit = importlib.import_module(
"exahype2.api.fv.RusanovWithExplicitEuler")
8optimistic = importlib.import_module(
9 "exahype2.api.fv.RusanovWithOptimisticExplicitEuler"
14 explicit.timeStepWithRusanov2D,
15 explicit.timeStepWithRusanov3D,
16 optimistic.timeStepWithRusanov2DOnPatchInterior,
17 optimistic.timeStepWithRusanov2DOnShell,
18 optimistic.timeStepWithRusanov3DOnPatchInterior,
19 optimistic.timeStepWithRusanov3DOnShell,
24 """The argument eval("maxEigenvalue", ...) is applied to, per call"""
26 r'eval\("maxEigenvalue", (\w+(?:\[[^\]]*\])?)', inspect.getsource(kernel)
31 for kernel
in KERNELS:
35 assert region !=
"input", kernel.__name__
41 for axis
in region[region.index(
"[") + 1 : -1].split(
","):
42 axis = axis.strip().replace(
" ",
"")
45 start, end = axis.split(
":")
46 assert start
not in (
"-H",
"0-H"), (kernel.__name__, region)
47 assert end
not in (
"NV+H",), (kernel.__name__, region)
52 return set(re.findall(
r"^\s*if (\w+):", inspect.getsource(kernel), re.M))
54 expected = {
"volumetricSource",
"flux",
"nonconservativeProduct"}
55 assert guards(explicit.timeStepWithRusanov2D) == expected
56 assert guards(explicit.timeStepWithRusanov3D) == expected
57 assert guards(explicit.maxEigenvalueOverPatch2D) == {
"maxEigenvalue"}
58 assert guards(explicit.maxEigenvalueOverPatch3D) == {
"maxEigenvalue"}
62 for kernel
in KERNELS:
63 assert "patchData.maxEigenvalue" not in inspect.getsource(kernel), (
66 assert "if maxEigenvalue:" not in inspect.getsource(kernel), kernel.__name__
70 for kernel
in [explicit.maxEigenvalueOverPatch2D, explicit.maxEigenvalueOverPatch3D]:
71 source = inspect.getsource(kernel)
72 assert "patchData.maxEigenvalue" in source
73 assert "H" not in re.findall(
r"\b[NH]V?\b", source), kernel.__name__
74 assert len(re.findall(
r'eval\("maxEigenvalue", input, x', source)) >= 2
test_eigenvalues_are_never_evaluated_on_the_whole_halo()
test_2d_and_3d_kernels_test_for_the_same_pde_terms()
_evaluated_regions(kernel)
The argument eval("maxEigenvalue", ...) is applied to, per call.
test_eigenvalue_kernels_read_the_patch_without_halo()
test_time_step_kernels_do_not_return_an_eigenvalue()