... | ... | @@ -28,4 +28,73 @@ optPilot for Developers: Coding Style and Conventions |
|
|
=============================================
|
|
|
1. [Coding Style and Conventions](for-developers)
|
|
|
2. Download sources [here](https://gitlab.psi.ch/OPAL/opt-pilot) use `ssh` when having git access or `htm`l for anonymous clone.
|
|
|
3. For PSI user go [here](optPilotmerlin) to find out how to build on Merlin. |
|
|
\ No newline at end of file |
|
|
3. For PSI user go [here](optPilotmerlin) to find out how to build on Merlin.
|
|
|
|
|
|
|
|
|
This is a very simple example of a food cell. We want to achieve in both the x and y plane the same beam size.
|
|
|
|
|
|
```
|
|
|
OPTION, VERSION=10600;
|
|
|
REAL SOL = 2.9979246E8;
|
|
|
REAL Pcen = 100.0E6;
|
|
|
REAL BRho = Pcen/SOL;
|
|
|
REAL QK1 = 6.2519;
|
|
|
REAL QSTR = QK1*BRho/2.0;
|
|
|
REAL qb=77.0e-12;
|
|
|
REAL bfreq=1300.0E6;
|
|
|
REAL bcurrent=qb*bfreq;
|
|
|
|
|
|
QDX1: QUADRUPOLE, ELEMEDGE=0.0, L=0.10, K1=17.7 * BRho / 2;
|
|
|
QFX1: QUADRUPOLE, ELEMEDGE=0.91, L=0.20, K1=-17.5 * BRho / 2;
|
|
|
QDX2: QUADRUPOLE, ELEMEDGE=1.92, L=0.10, K1=17.5 * BRho / 2;
|
|
|
|
|
|
FODO_Full: LINE = (QDX1, QFX1, QDX2);
|
|
|
|
|
|
// SC calculations on:
|
|
|
Fs1:FIELDSOLVER, NONE = FFT, MX = 8, MY = 8, MT = 8,
|
|
|
PARFFTX = true, PARFFTY = true, PARFFTT = true,
|
|
|
BCFFTX = open, BCFFTY = open, BCFFTT = open,
|
|
|
BBOXINCR = 1, GREENSF = INTEGRATED;
|
|
|
|
|
|
Dist1:DISTRIBUTION, DISTRIBUTION=GAUSS,
|
|
|
sigmax=3E-3, sigmapx=1E-5,
|
|
|
sigmay=3E-3, sigmapy=1E-5,
|
|
|
sigmat=3E-3, sigmapt=1E-5, CORRX=0, CORRY=0, CORRT=0;
|
|
|
|
|
|
beam1: BEAM, PARTICLE = ELECTRON, pc = P0, NPART = 5000, BFREQ = bfreq,
|
|
|
BCURRENT = bcurrent, CHARGE = -1;
|
|
|
|
|
|
SELECT, LINE=FODO_Full;
|
|
|
|
|
|
TRACK, LINE=FODO_Full, BEAM=beam1, MAXSTEPS={6e5}, DT={1e-12}, ZSTOP={2.02};
|
|
|
RUN, METHOD = "PARALLEL-T", BEAM = beam1, FIELDSOLVER = Fs1, DISTRIBUTION = Dist1;
|
|
|
ENDTRACK;
|
|
|
QUIT;
|
|
|
```
|
|
|
|
|
|
With some random initial conditions we get the following solution
|
|
|
|
|
|

|
|
|

|
|
|
|
|
|
Now adding optimiser statements:
|
|
|
|
|
|
```
|
|
|
// ---- OPTIMIZER SECTION -------
|
|
|
//dv0: DVAR, VARIABLE="QDX1_K1", LOWERBOUND="0", UPPERBOUND="35";
|
|
|
//dv1: DVAR, VARIABLE="QDX2_K1", LOWERBOUND="0", UPPERBOUND="35";
|
|
|
//dv2: DVAR, VARIABLE="QFX1_K1", LOWERBOUND="-35", UPPERBOUND="0";
|
|
|
//dvars: DVARS=(dv0,dv1,dv2);
|
|
|
|
|
|
//drmsx:OBJECTIVE,EXPR="fabs(sameSDDSVariableAt("rms_x",2.00) - 0.0000977)";
|
|
|
//drmsy:OBJECTIVE,EXPR="fabs(sameSDDSVariableAt("rms_y",2.00) - 0.0001833)";
|
|
|
|
|
|
//objs: OBJECTIVES=(drmsx,drmsy);
|
|
|
//constrs: CONSTRAINTS = ();
|
|
|
//opt: OPTIMIZE, OBJECTIVES = objs, DVARS = dvars, CONSTRAINTS = constrs;
|
|
|
```
|
|
|
Now look at the initial pareto front:
|
|
|
|
|
|
|
|
|
|
|
|
|