1D fields

For 1 space dimension fields \(f(x,t)\) there are 2 ways to render:

Movie 1D

Each frame shows the field at a specific time \(f(x,t_i)\).

 1from idefix2python import RunContext, Pipeline, LineMovie1D
 2from pathlib import Path
 3
 4projectPath = Path(__file__).parent / "data_test"
 5task = "1D_test"
 6# By default the vtks are expected to be in {projetPath}/{task}/outputs/vtks/
 7
 8custom_LineMovie1Ds = [
 9    LineMovie1D(
10        "Dust0_RHO",
11        r"$\rho^\mathrm{dust}$",
12        plot_coords=[0, 0],
13        title="Dust0 Density",
14        vmin=0,
15        vmax=1.5e-4,
16    )
17]
18
19LineMovie1D.suptitle = "Evolution of the density profile"
20runContext = RunContext(task, projectPath)
21pipeline = Pipeline(runContext, movies1D=custom_LineMovie1Ds)
22
23pipeline.run()
Space-Time Heatmap

A single figure showing the entire evolution of the field \(f(x,t)\).

 1from idefix2python import RunContext, Pipeline, SpaceTimeHeatmap
 2from pathlib import Path
 3
 4projectPath = Path(__file__).parent / "data_test"
 5task = "1D_test"
 6# By default the vtks are expected to be in {projetPath}/{task}/outputs/vtks/
 7
 8custom_spaceTimeHeatmaps = [
 9    SpaceTimeHeatmap(
10        "Dust0_RHO",
11        r"$\rho^\mathrm{dust}$",
12        plot_coords=[0, 0],
13        title="Dust0 Density",
14    )
15]
16
17SpaceTimeHeatmap.suptitle = "Dust density on a heatmap"
18
19runContext = RunContext(task, projectPath)
20pipeline = Pipeline(runContext, spaceTimeHeatmaps=custom_spaceTimeHeatmaps)
21pipeline.run()
../_images/1D_test_spacetimeheatmap1.png

Adding a reference line

On the heatmap, one can add a reference line (e.g., an analytical trajectory) by passing a ref_function to the SpaceTimeHeatmap object.

 1from idefix2python import RunContext, Pipeline, SpaceTimeHeatmap
 2import utilities
 3from pathlib import Path
 4
 5projectPath = Path(__file__).parent / "data_test"
 6task = "1D_test"
 7# By default the vtks are expected to be in {projetPath}/{task}/outputs/vtks/
 8
 9
10def analytical_trajectory(t):
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)
15
16
17custom_spaceTimeHeatmaps = [
18    SpaceTimeHeatmap(
19        "Dust0_RHO",
20        r"$\rho^\mathrm{dust}$",
21        plot_coords=[0, 0],
22        title="Dust0 Density",
23        ref_function=analytical_trajectory,
24    )
25]
26
27SpaceTimeHeatmap.suptitle = "Dust density on heatmap, with an analytical trajectory"
28
29runContext = RunContext(
30    task,
31    projectPath,
32    frameFolder="1D_test_withref",
33)
34pipeline = Pipeline(
35    runContext,
36    spaceTimeHeatmaps=custom_spaceTimeHeatmaps,
37)
38
39pipeline.run()
../_images/1D_test_spacetimeheatmap.png

1D_test_spacetimeheatmap.png