42 project_on_tracer_properties_kernel,
43 projection_kernel_arguments="""
46 {{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}},
47 fineGridCell{{SOLVER_NAME}}Q.value,
55 Setting up the tracing first and foremost means that we have to couple
56 the tracer particle set with the solver, and then we have to specify which
57 projection kernels and which time integrator we want to use. Basically,
58 we have to provide the C++ kernels which shall be used to move the tracer
59 and to write new data into the tracer.
61 For the time stepping, Peano's particle toolbox provides some default
62 integrators. If you use stationary tracers, toolbox::particles::StaticPosition
63 (handed in as string) or None do the job. See comment below.
65 For the projection of solution data onto the tracer, the file
66 exahype2/fv/Tracer.h provides a few pre-manufactured routines. Again, the
67 projection kernel here requires a plain function call, and you have to
68 ensure that this function call matches the data you actually wanna dump.
73 particle_set: ParticleSet
75 time_stepping_kernel: String
76 Function call which does projection onto the particles and the actual
77 position update. Hand in "toolbox::particles::StaticPosition" or None
78 if you don't want the particles' to move.
80 project_on_tracer_properties_kernel: String
81 Name of the routine that projects the Finite Volumes representation
82 onto the tracers' properties. Hand in None if you don't want any field
83 properties to be projected on the tracer. This makes sense if the
84 velocity/trajectory of a tracer already encodes all information.
85 Some popular arguments for this routine are enlisted above.
92 self.
tracerDict[
"PARTICLE"] = particle_set.particle_model.name
93 self.
tracerDict[
"PARTICLES_CONTAINER"] = particle_set.name
95 self.
tracerDict[
"SOLVER_INSTANCE"] = solver.get_name_of_global_instance()
96 self.
tracerDict[
"PATCH_SIZE"] = solver._patch_size
97 self.
tracerDict[
"NUMBER_OF_UNKNOWNS"] = solver._unknowns
98 self.
tracerDict[
"NUMBER_OF_AUXILIARY_VARIABLES"] = solver._auxiliary_variables
99 self.
tracerDict[
"PROJECTION_KERNEL"] = project_on_tracer_properties_kernel
100 self.
tracerDict[
"PROJECTION_KERNEL_ARGUMENTS"] = jinja2.Template(
101 projection_kernel_arguments
104 cell_compute_kernel =
"""
106 fineGridCell{{SOLVER_NAME}}CellLabel.getHasUpdated()
109 repositories::{{SOLVER_INSTANCE}}.isLastGridSweepOfTimeStep()
111 repositories::{{SOLVER_INSTANCE}}.getSolverState()=={{SOLVER_NAME}}::SolverState::GridInitialisation
114 for (auto* p: localParticles) {
116 p->getMoveState()==globaldata::{{PARTICLE}}::MoveState::NotMovedYet and marker.isContained(p->getX())
118 p->getMoveState()==globaldata::{{PARTICLE}}::MoveState::Moved;
121 {{PROJECTION_KERNEL}}(
122 {{PROJECTION_KERNEL_ARGUMENTS}}
129 touch_vertex_first_time_compute_kernel =
"""
130 for (auto* p: assignedParticles) {
131 p->setMoveState(globaldata::{{PARTICLE}}::MoveState::NotMovedYet);
135 super(FiniteVolumesTracing, self).
__init__(
137 jinja2.Template(cell_compute_kernel).render(**self.
tracerDict),
138 jinja2.Template(touch_vertex_first_time_compute_kernel).render(