Add basic support for design exploration/optimisation.
Problem
The current implementation of virtual-ipm only allows the user to create (and run) one simulation-configuration at a time. When a user use virtual IPM to design a new IPM, he/she is required to run many simulations where each simulation only change a single parameter by a small value. This is called design exploration/optimization.
This is done in order:
- To find the optimal value for a certain design parameter (e.g. what is the minimum value or the magnetic field strength required to measure a certain beam with < 1% error, which electric field-map is best, etc...).
- To check corner cases (e.g. sweep the beam transverse position to check that the IPM can measure the beam at all required location, at what beam energy does the instrument stop working properly, etc...).
- To try to reproduce a certain behavior seen in a real IPM but that you are unsure of the exact parameters causing it.
Current solution
Currently the workaround for this limitation of the software is to:
- Create a "seed" configuration using virtual-ipm gui.
- Use a custom script to make copies of the "seed" where the parameter to be "explored" is changed based on what the user try to achieve (e.g. move the beam X position from -10 to 10 mm with a 1mm step).
- Run each configuration file in a separate call to virtual-ipm (e.g. GNUparallel on my machine(s), or use a HPC ...)
This method works fine but it can be tedious to create many "seed" files and to write custom scripts the create the simulation files.
Proposed new solution
Have an new tab (or menu) in the GUI to directly let the user create "design exploration" simulation-configurations.
- The "seed" configuration would be the one currently loaded in virtual-ipm (the one that would run if you clicked run in the gui).
The parameters available for design exploration would be all beam or IPM related parameters:
- Beam size (transverse and longitudinal), position (transverse), energy, population.
- Particle generation longitudinal position (if we still generate particle on a plane).
- IPM electric and magnetic fields. For field maps, perhaps having an option to use all field-map files located in a given folder.
- Number of generated electrons (this could be used to emulate a change in vacuum pressure for instance).
The menu would also allow the user to:
- Select or create a folder as the destination of all the simulation files.
- Create a .txt file with the names of all simulation files created (on file name per line).
Also, to avoid a file naming nightmare, a standard file naming scheme would have to be defined (e.g. mysimfile_beam-position-0-0-0_beam-intensity-12.xml).
In my opinio it would be wise to leave the "running all the simulations" part as an step external to virtual-ipm. Running multiple simulations is relatively easy, the only tedious part is to create the simulation files.