-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add defaults.py, Custom Step Values, and fix code in dashboard (#772)
* Added missing init files * Added custom steps increment for various inputs Functionality to add custom step for all inputs except lattice is set. * Centralize parameter units in PARAMETER_UNITS dictionary * Centralize parameter default values in PARAMETER_VALUES dictionary * Add more defaults and rename default variables * fix bug1 Users could not run a simulation because the 'name' parameter in lattice element was always stuck with an error message * Fix matplotlib errors * Re-arrange defaults.py and update corresponding code
- Loading branch information
Showing
11 changed files
with
263 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
class DashboardDefaults: | ||
""" | ||
Defaults for input parameters in the ImpactX dashboard. | ||
""" | ||
|
||
# ------------------------------------------------------------------------- | ||
# Inputs by section | ||
# ------------------------------------------------------------------------- | ||
|
||
INPUT_PARAMETERS = { | ||
"space_charge": False, | ||
"csr": False, | ||
"charge_qe": -1, | ||
"mass_MeV": 0.51099895, | ||
"npart": 1000, | ||
"kin_energy": 2e3, | ||
"kin_energy_unit": "MeV", | ||
"bunch_charge_C": 1e-9, | ||
} | ||
|
||
DISTRIBUTION = { | ||
"selected_distribution": "Waterbag", | ||
"selected_distribution_type": "Twiss", | ||
} | ||
|
||
LATTICE = { | ||
"selected_lattice_list": [], | ||
"selected_lattice": None, | ||
} | ||
|
||
SPACE_CHARGE = { | ||
"dynamic_size": False, | ||
"poisson_solver": "fft", | ||
"particle_shape": 2, | ||
"max_level": 0, | ||
"n_cell": 32, | ||
"blocking_factor": 16, | ||
"prob_relative_first_value_fft": 1.1, | ||
"prob_relative_first_value_multigrid": 3.1, | ||
"mlmg_relative_tolerance": 1.0e-7, | ||
"mlmg_absolute_tolerance": 0, | ||
"mlmg_verbosity": 1, | ||
"mlmg_max_iters": 100, | ||
} | ||
|
||
CSR = { | ||
"particle_shape": 2, | ||
"csr_bins": 150, | ||
} | ||
|
||
LISTS = { | ||
"kin_energy_unit_list": ["meV", "eV", "keV", "MeV", "GeV", "TeV"], | ||
"distribution_type_list": ["Twiss", "Quadratic"], | ||
"poisson_solver_list": ["fft", "multigrid"], | ||
"particle_shape_list": [1, 2, 3], | ||
"max_level_list": [0, 1, 2, 3, 4], | ||
} | ||
|
||
# ------------------------------------------------------------------------- | ||
# Main | ||
# ------------------------------------------------------------------------- | ||
|
||
DEFAULT_VALUES = { | ||
**INPUT_PARAMETERS, | ||
**DISTRIBUTION, | ||
**LATTICE, | ||
**SPACE_CHARGE, | ||
**CSR, | ||
**LISTS, | ||
} | ||
|
||
# If a parameter is not included in the dictionary, default step amount is 1. | ||
STEPS = { | ||
"mass_MeV": 0.1, | ||
"bunch_charge_C": 1e-11, | ||
"prob_relative": 0.1, | ||
"mlmg_relative_tolerance": 1e-12, | ||
"mlmg_absolute_tolerance": 1e-12, | ||
"beta": 0.1, | ||
"emitt": 1e-7, | ||
"alpha": 0.1, | ||
} | ||
|
||
UNITS = { | ||
"charge_qe": "qe", | ||
"mass_MeV": "MeV", | ||
"bunch_charge_C": "C", | ||
"mlmg_absolute_tolerance": "V/m", | ||
"beta": "m", | ||
"emitt": "m", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.