51 def __init__(self, ccz4_name: str =
"CCZ4", euler_name: str =
"Euler"):
54 Create the two solvers and the auxiliary variables through which they see each other
56 The solvers exchange data once per time step only, so the numerical
57 schemes of the solvers remain flexible.
60 Name of the CCZ4 solver.
62 @param euler_name: str
63 Name of the Euler solver.
68 Mode = exahype2.api.AuxiliaryVariables.Mode
72 mode=Mode.STATIONARY_THROUGHOUT_TIME_STEPS_ON_FACES,
73 data_name=
"EulerFieldsForCCZ4",
77 dict(FOCCZ4Solver.Unknowns),
78 mode=Mode.STATIONARY_THROUGHOUT_TIME_STEPS_ON_FACES,
79 data_name=
"CCZ4FieldsForEuler",
83 self.
_name = f
"{ccz4_name}With{euler_name}"
105 Realise both solvers, chain their time stepping graphs, and add the outcome to the project's graphs
107 The arguments are those of exahype2.api.Solver.generate_solver_realisation().
108 Both solvers are realised without global tasks. The load balancing and the dynamic
109 mesh refinement wrap the chained time step graph afterwards, through the scheme of CCZ4.
113 Entity = peano4.api.taskgraph.Task.GridEntity
123 add_global_tasks=
False,
133 add_global_tasks=
False,
147 coupled_time_step.append(euler_into_ccz4)
148 coupled_time_step.append(ccz4_time_step)
149 coupled_time_step.append(ccz4_into_euler)
150 coupled_time_step.append(euler_time_step)
156 for task
in coupled_time_step.sink_tasks():
157 synchronise.add_dependency(task)
158 synchronise.add_action_set(SynchroniseTimeStepSizes([self.
ccz4, self.
euler]))
159 coupled_time_step.add_task(synchronise)
161 self.
ccz4.numerical_scheme.wrap_task_graph_in_load_balancing_and_amr_tasks(
164 if self.
ccz4.mesh_adaptation
is not None:
165 self.
ccz4.mesh_adaptation.construct_output(
166 exahype2_project, peano_project, mesh_adaptation
169 title = f
"Time stepping task graph for host {self.name}"
171 coupled_time_step.visualise(title=title)
173 coupled_time_step.log_as_text(title=title)
174 time_step.merge(coupled_time_step)
177 self, time_step, source_solver, target_solver, auxiliary_copies
181 Create the task that fills the auxiliary variables of one solver with the solution of the other one
183 auxiliary copies (auxiliary_copies) of the target solver (copy, with
184 auxiliary variables auxiliary_copies of the target solver (copy, with
185 interpolation if the patches differ in size), projects them onto the
186 faces, restricts them on hanging faces, and rolls the faces over. It is
187 added to time_step, but no dependencies are set: the caller wires it.
188 It is the one place that writes new face data.
190 @param time_step: peano4.api.taskgraph.Graph
193 @param source_solver: exahype2.api.Solver
196 @param target_solver: exahype2.api.Solver
197 Holds the auxiliary variables.
199 @param auxiliary_copies: exahype2.api.AuxiliaryVariables
200 The auxiliary variables of the target solver.
202 @return peano4.api.taskgraph.Task
206 Access = peano4.api.taskgraph.Task.DataAccess
207 Entity = peano4.api.taskgraph.Task.GridEntity
210 target_solver._get_default_includes() + target_solver.user_solver_includes
216 prep.use_cell(source_solver._patch, Access.READ_AND_WRITE)
217 prep.use_cell(auxiliary_copies.patch, Access.READ_AND_WRITE)
218 prep.use_face(auxiliary_copies.patch_overlap_update, Access.TEMPORARY)
219 prep.use_face(auxiliary_copies.patch_overlap_current_time_step, Access.READ_AND_WRITE)
221 CopyPatchWithLinearInterpolation(
222 source_patch=source_solver._patch,
223 target_patch=auxiliary_copies.patch,
224 guard=target_solver.grid_selector.createCellGuard(),
225 additional_includes=includes,
229 actionsets.ProjectPatchOntoFaces(
230 auxiliary_copies.patch,
231 auxiliary_copies.patch_overlap_update,
232 guard=target_solver.grid_selector.createCellGuard(),
237 toolbox.blockstructured.api.RestrictHangingFaces(
238 auxiliary_copies.patch_overlap_update,
239 scheme=target_solver.numerical_scheme.restriction,
240 clear_guard=target_solver.grid_selector.createFaceGuard(),
241 additional_includes=includes,
245 actionsets.RollOverUpdatedFace(
246 auxiliary_copies.patch_overlap_current_time_step,
247 auxiliary_copies.patch_overlap_update,
248 guard=target_solver.grid_selector.createFaceGuard(),
252 time_step.add_task(prep)