Peano
Loading...
Searching...
No Matches
test_rkfd4_actionsets.py
Go to the documentation of this file.
1import pathlib
2
3import peano4.api
5
6import exahype2.api
7
8
9def _solver():
10 solver = exahype2.api.Solver("Probe", 3, 1)
11 solver.add_pde_term(exahype2.api.InitPointWisely(implementation="Q[0] = 0.0;"))
13 solver, patch_size=7, rk_order=4
14 )
15 return solver
16
17
19 solver = _solver()
20 action_set = exahype2.api.rkfd4.actionsets.InitialCondition(solver, guard="true")
21 body = action_set.get_body_of_operation(
22 peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME
23 )
24 assert "parallelDfor( gridCell, 7 )" in body
25 assert (
26 "::exahype2::fd::getGridCellCentre( marker.x(), marker.h(), 7, gridCell)"
27 in body
28 )
29 assert "* (3 + 1)" in body
30 assert '#include "exahype2/fd/PatchUtils.h"' in action_set.get_includes()
31
32
34 solver = _solver()
36 solver, solver._patch_overlap_current_time_step, guard="true"
37 )
38 body = action_set.get_body_of_operation(
39 peano4.api.solversteps.ActionSet.OPERATION_TOUCH_FACE_FIRST_TIME
40 )
41 assert "::exahype2::blockstructured::applyDirichletBoundaryConditions(" in body
42 # 7 grid cells per axis, an overlap of 2, 3+1 doubles per grid cell
43 assert " 7,\n 2,\n 3 + 1,\n" in body
44 assert "fineGridFaceProbeQCurrentTimeStep.value" in body
45 assert (
46 '#include "exahype2/blockstructured/DirichletBoundaryConditions.h"'
47 in action_set.get_includes()
48 )
49
50
52 solver = _solver()
54 solver._patch_overlap_current_time_step,
55 solver._patch_overlap_update,
56 guard="true",
57 includes="",
58 )
59 body = action_set.get_body_of_operation(
60 peano4.api.solversteps.ActionSet.OPERATION_TOUCH_FACE_LAST_TIME
61 )
62 assert body.count("::exahype2::fv::copyHalfOfHalo(") == 2
63 assert " 4,\n 7,\n 2," in body
64
65
67 package = pathlib.Path(exahype2.api.rkfd4.__file__).parent
68 for source in package.rglob("*.py"):
69 code = source.read_text()
70 assert "from ..fv" not in code and "import exahype2.api.fv" not in code, source
Point-wise initial condition: given the physical position of a single degree of freedom,...
Abstract base class for all ExaHyPE 2 solvers.
Definition Solver.py:17
Fourth-order central Finite Differences with explicit Runge-Kutta time stepping, realised over a bloc...
Set the ghost grid cells along the domain boundary through the solver's exahype2.api....
Fill a patch's initial condition, one grid cell at a time, by calling the solver's exahype2....
Copy patch_overlap_update - the face overlap exahype2.api.rkfd4.actionsets.ProjectPatchOntoFaces has ...
The Python-side model of "what happens during one mesh sweep".
Definition __init__.py:1