62 Create the actual sequence of tasks following the description
63 from @ref page_exahype_numerical_scheme "Adding a numerical scheme", as grid construction,
64 numerical scheme, but also plotting all follow the same pattern
65 of tasks and dependencies.
69 "Create setup task graph for fourth-order Finite Differences with Runge-Kutta over a regular, block-structured mesh"
73 isinstance(term, InitPointWisely)
for term
in self.
_solver_solver.pde_terms
75 f
"Solver {self._solver.name} has no InitPointWisely PDE term registered. "
76 "SetupSimulationOverRegularGrid needs one to fill in the initial condition - "
77 "add one via solver.add_pde_term(exahype2.api.InitPointWisely(...))."
85 name=f
"{self._solver.name}_Refine mesh",
86 entity=peano4.api.taskgraph.Task.GridEntity.CELL,
88 "not peano4::grid::isGridStationary( peano4::parallel::SpacetreeSet::getInstance().getGridStatistics() )"
89 " or ( ::toolbox::loadbalancing::LoadBalancingService::getInstance().hasLoadBalancing()"
90 " and ( not ::toolbox::loadbalancing::LoadBalancingService::getInstance().getLoadBalancing()->hasStagnated()"
91 " or ::toolbox::loadbalancing::LoadBalancingService::getInstance().getLoadBalancing()->hasSplitRecently() ) )"
95 name=f
"{self._solver.name}_Consolidate mesh",
96 entity=peano4.api.taskgraph.Task.GridEntity.CELL,
98 "not peano4::grid::isGridStationary( peano4::parallel::SpacetreeSet::getInstance().getGridStatistics() )"
99 " or ( ::toolbox::loadbalancing::LoadBalancingService::getInstance().hasLoadBalancing()"
100 " and ::toolbox::loadbalancing::LoadBalancingService::getInstance().getLoadBalancing()->hasSplitRecently() )"
104 assert hasattr(self.
_solver_solver.numerical_scheme,
"patch_size"), (
105 f
"Solver {self._solver.name}'s numerical scheme has no attribute "
106 "patch_size. SetupSimulationOverRegularGrid assumes the numerical "
107 "scheme has added this field to itself immediately upon construction."
116 refine_task.add_action_set(
120 "not ::toolbox::loadbalancing::LoadBalancingService::getInstance().hasLoadBalancing()"
121 " or not ::toolbox::loadbalancing::LoadBalancingService::getInstance().getLoadBalancing()->hasSplitRecently()"
124#include "toolbox/loadbalancing/AbstractLoadBalancing.h"
125#include "toolbox/loadbalancing/LoadBalancingService.h"
130 refine_task.add_action_set(toolbox.loadbalancing.api.actionsets.LoadBalancing())
134 consolidate_load_balancing_task.add_action_set(
135 toolbox.loadbalancing.api.actionsets.ToggleLoadBalancing(
136 enable_load_balancing=
False, plug_into_prepare_traversal=
True
139 consolidate_load_balancing_task.add_action_set(
140 toolbox.loadbalancing.api.actionsets.LoadBalancing()
144 name=f
"{self._solver.name} Initial condition",
145 entity=peano4.api.taskgraph.Task.GridEntity.CELL,
148 name=f
"{self._solver.name} Project on faces",
149 entity=peano4.api.taskgraph.Task.GridEntity.CELL,
152 consolidate_load_balancing_task.add_dependency(refine_task)
153 initial_condition_task.add_dependency(consolidate_load_balancing_task)
154 project_on_faces_task.add_dependency(initial_condition_task)
156 initial_condition_task.add_action_set(
161 project_on_faces_task.add_action_set(
172 project_on_faces_task.add_action_set(
173 RollOverUpdatedFaceWithSommerfeldBoundaryConditions.create_roll_over(
182 setup_simulation.add_task(refine_task)
183 setup_simulation.add_task(consolidate_load_balancing_task)
184 setup_simulation.add_task(initial_condition_task)
185 setup_simulation.add_task(project_on_faces_task)
187 initial_condition_task.use_cell(
188 self.
_solver_solver._patch, peano4.api.taskgraph.Task.DataAccess.WRITE
190 project_on_faces_task.use_cell(
191 self.
_solver_solver._patch, peano4.api.taskgraph.Task.DataAccess.READ_AND_WRITE
193 project_on_faces_task.use_face(
195 peano4.api.taskgraph.Task.DataAccess.TEMPORARY,
197 project_on_faces_task.use_face(
199 peano4.api.taskgraph.Task.DataAccess.WRITE,
203 setup_simulation.visualise(
207 setup_simulation.log_as_text(