Particle quantities¶
1from idefix2python import RunContext, Pipeline, Fig, PartQuantity
2import utilities
3from pathlib import Path
4
5projectPath = Path(__file__).parent / "data_examples"
6task = "particles_test"
7# By default the vtks are expected to be in {projetPath}/{task}/outputs/vtks/
8
9
10def analytical_drift(t_array):
11 Stokes0 = 1
12 fluid = utilities.Fluid(0.05, -0.5, 0.125, -0.5, Stokes0=Stokes0)
13 r0 = 2
14 return utilities.integrate(fluid.vrDrift, r0, t_array)
15
16
17px1 = PartQuantity(
18 "PART_X1",
19 r"$r$",
20 plot_coords=[0, 0],
21 ref_function=analytical_drift,
22)
23
24fig0 = Fig([px1], suptitle="A particle radial evolution, with an analytical trajectory")
25
26runContext = RunContext(
27 task,
28 projectPath,
29 active_directions=[0], # necessary when there are only part*.vtk
30)
31
32
33if __name__ == "__main__":
34 pipeline = Pipeline(runContext, [fig0])
35 pipeline.run()
particles_test_fig0.png¶