Skip to content

Commit

Permalink
Add trcking modes to dashboard ui and setup initial connection to sim
Browse files Browse the repository at this point in the history
  • Loading branch information
proy30 committed Feb 21, 2025
1 parent 220531e commit c3f91ce
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/python/impactx/dashboard/Input/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class DashboardDefaults:
}

INPUT_PARAMETERS = {
"tracking_mode": "Particle Tracking",
"charge_qe": -1,
"mass_MeV": 0.51099895,
"npart": 1000,
Expand Down Expand Up @@ -67,6 +68,11 @@ class DashboardDefaults:
"poisson_solver_list": ["fft", "multigrid"],
"particle_shape_list": [1, 2, 3],
"max_level_list": [0, 1, 2, 3, 4],
"tracking_mode_list": [
"Particle Tracking",
"Envelope Tracking",
"Reference Tracking",
],
}

# -------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ def card(self):
with vuetify.VCard(style="width: 340px; height: 350px"):
CardComponents.input_header("Input Parameters")
with vuetify.VCardText():
with vuetify.VRow(classes="py-2"):
with vuetify.VCol(cols=6, classes="py-0"):
with vuetify.VRow():
with vuetify.VCol(cols=5.5):
InputComponents.select(
label="Tracking Mode",
)
with vuetify.VCol(cols="auto"):
vuetify.VCheckbox(
label="Space Charge",
v_model=("space_charge", False),
Expand Down
9 changes: 7 additions & 2 deletions src/python/impactx/dashboard/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,16 @@ def run_simulation():
sim.add_particles(bunch_charge_C, distribution, npart)

lattice_configuration = lattice_elements()

sim.lattice.extend(lattice_configuration)

tracking_modes = {
"Particle Tracking": sim.track_particles,
"Envelope Tracking": sim.track_envelope,
"Reference Tracking": sim.track_reference,
}

# simulate
sim.evolve()
tracking_modes[state.tracking_mode]()

fig = adjusted_settings_plot(pc)
ctrl.matplotlib_figure_update(fig)
Expand Down

0 comments on commit c3f91ce

Please sign in to comment.