Particle quantities over heatmap¶
1from idefix2python import RunContext, Pipeline, PartQuantity, SpaceTimeHeatmap
2import utilities
3from pathlib import Path
4
5projectPath = Path(__file__).parent / "data_test"
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)
24
25custom_partQuantities = [z_part]
26SpaceTimeHeatmaps = [
27 SpaceTimeHeatmap(
28 "Dust0_RHO",
29 r"$\rho^\mathrm{dust}$",
30 plot_coords=[0, 0],
31 trace_over=[z_part],
32 ref_function=analytical_trajectory,
33 )
34]
35
36SpaceTimeHeatmap.suptitle = (
37 "Dust density: presureless fluid, particles, and an analytical trajectory"
38)
39
40runContext = RunContext(
41 task,
42 projectPath,
43 active_directions=[2], # currently necessary for lagrangian particles.)
44)
45pipeline = Pipeline(
46 runContext,
47 partQuantities=custom_partQuantities,
48 spaceTimeHeatmaps=SpaceTimeHeatmaps,
49)
50
51pipeline.run()
particles_over_test_spacetimeheatmap.png¶