Particle quantities over spacetime heatmap

 1from idefix2python import RunContext, Pipeline, Fig, PartQuantity, SpaceTimeHeatmap
 2import utilities
 3from pathlib import Path
 4
 5projectPath = Path(__file__).parent / "data_examples"
 6task = "particles_over_test"
 7# By default the vtks are expected to be in {projetPath}/{task}/outputs/vtks/
 8# In this example, the vtks/ folder contains both part*.vtk and data*.vtk
 9
10
11def analytical_trajectory(t):
12    z0 = 0.1
13    fluid = utilities.Fluid(0.05, -0.5, 0.125, -0.5, Stokes0=1, z0=z0)
14    return utilities.solve_2nd_order_ode(fluid.azSettling, z0, 0, t)
15
16
17analytical_trajectory.plot_kwargs = {"ls": "--", "color": "cyan", "lw": 2}
18
19z_part = PartQuantity(
20    "PART_X3",
21    r"$z^\mathrm{part}$",
22    plot_coords=[0, 0],
23)
24dust0_rho = SpaceTimeHeatmap(
25    "Dust0_RHO",
26    r"$\rho^\mathrm{dust}$",
27    plot_coords=[0, 0],
28    uids="all",
29    ref_function=analytical_trajectory,
30)
31
32fig0 = Fig(
33    [z_part, dust0_rho],
34    suptitle="Dust density: pressureless fluid, particles, and an analytical trajectory",
35)
36
37runContext = RunContext(
38    task,
39    projectPath,
40)
41
42if __name__ == "__main__":
43    pipeline = Pipeline(runContext, [fig0])
44    pipeline.run()
../_images/particles_over_test_fig0.png

particles_over_test_fig0.png