OPTION, PSDUMPFREQ = 50000; OPTION, STATDUMPFREQ = 1000; OPTION, BOUNDPDESTROY = 10; OPTION, VERSION = 10900; OPTION, ASCIIDUMP = FALSE; Title, string = "test-chicane-1 analytic four-SBEND C-chicane placement regression"; // Symmetric C-shape four-bend chicane placement seed. // // Documentation: // See sandbox/BenTest/bend-tests.tex and sandbox/test-chicane-1/README.md. // // Analytic hard-edge configuration: // L_b = 1.0 m // theta = 0.1 rad // D = 1.5 m // C = 2.0 m // // Physical bend signs are (+theta, -theta, -theta, +theta). OPALX SBEND // ANGLE has the opposite sign relative to the positive-X survey convention // used in this file, so B1 and B4 use ANGLE = -theta. // // The entrance is centered at (X, Y, Z) = (0, 0, 0), with entrance tangent // along +Z. The design exit is centered at X = 0, Z = 8.978349161707204 m, // and is parallel to the entrance. // // R56 probe: // The FROMFILE distribution contains five particles with // delta = (pz - p0) / p0 = {-2e-3, -1e-3, 0, +1e-3, +2e-3}, // where p0 = 1957.950928190185 beta*gamma. // Use the MEXIT monitor H5 output to fit final local z versus these // initial deltas. // // Small-angle longitudinal target: // R56 ~= -theta^2 * (4 L_b / 3 + 2 D) = -4.333333333333334e-2 m. // Chicane design parameters. LB is the magnet arc length, TH is the absolute // bend angle, D_CH is the outer drift between B1-B2 and B3-B4, and C_CH is the // central drift between B2-B3. R_CH is the sector-bend radius rho = L_b / TH. REAL LB = 1.0; REAL TH = 0.1; REAL D_CH = 1.5; REAL C_CH = 2.0; REAL R_CH = LB / TH; // Survey origin: entrance port center, with the reference tangent along +Z and // horizontal bend excursions in +X. REAL X0 = 0.0; REAL Y0 = 0.0; REAL Z0 = 0.0; // Full SBEND exit displacement for a positive survey bend: // dx = rho * (1 - cos(TH)), dz = rho * sin(TH). // These locate the monitor planes at the bend exits. REAL SB_DX = R_CH * (1 - cos(TH)); REAL SB_DZ = R_CH * sin(TH); // Half-SBEND displacement from an entry edge to the body origin: // dx = rho * (1 - cos(TH/2)), dz = rho * sin(TH/2). // OPALX places X/Y/Z at the analytic bend body origin, not at the edge. REAL SBH_DX = R_CH * (1 - cos(TH / 2)); REAL SBH_DZ = R_CH * sin(TH / 2); // Half-SBEND displacement for the return bends, written from entry edge to // body origin while the orbit bends back toward smaller X. REAL RBH_DX = R_CH * (cos(TH / 2) - cos(TH)); REAL RBH_DZ = R_CH * (sin(TH) - sin(TH / 2)); // Projection of an outer drift whose tangent is tilted by TH in the X-Z plane. REAL DR_DX = D_CH * sin(TH); REAL DR_DZ = D_CH * cos(TH); // Assemble all element body origins and monitor positions from the survey // increments. B1/B4 use ANGLE = -TH because OPALX's SBEND ANGLE sign is // opposite to the positive-X survey convention used here. REAL B1_X = X0 + SBH_DX; REAL B1_Z = Z0 + SBH_DZ; REAL M1_X = X0 + SB_DX; REAL M1_Z = Z0 + SB_DZ; REAL B2I_X = M1_X + DR_DX; REAL B2I_Z = M1_Z + DR_DZ; REAL B2_X = B2I_X + RBH_DX; REAL B2_Z = B2I_Z + RBH_DZ; REAL M2_X = B2I_X + SB_DX; REAL M2_Z = B2I_Z + SB_DZ; REAL B3I_X = M2_X; REAL B3I_Z = M2_Z + C_CH; REAL B3_X = B3I_X - SBH_DX; REAL B3_Z = B3I_Z + SBH_DZ; REAL M3_X = B3I_X - SB_DX; REAL M3_Z = B3I_Z + SB_DZ; REAL B4I_X = M3_X - DR_DX; REAL B4I_Z = M3_Z + DR_DZ; REAL B4_X = B4I_X - RBH_DX; REAL B4_Z = B4I_Z + RBH_DZ; REAL MEXIT_X = B4I_X - SB_DX; REAL MEXIT_Z = B4I_Z + SB_DZ; // Small-angle analytic reference used by check-r56.py and the README. REAL R56_REF = -TH^2 * (4 * LB / 3 + 2 * D_CH); M0: MONITOR, L = 0.0, X = X0, Y = Y0, Z = Z0, THETA = 0.0, PHI = 0.0, PSI = 0.0, TYPE = TEMPORAL, OUTFN = "test-chicane-1_m0"; B1: SBEND, L = LB, ANGLE = -TH, E1 = 0.0, E2 = 0.0, HGAP = 0.0, FINT = 0.0, X = B1_X, Y = Y0, Z = B1_Z, THETA = TH / 2, PHI = 0.0, PSI = 0.0; M1: MONITOR, L = 0.0, X = M1_X, Y = Y0, Z = M1_Z, THETA = TH, PHI = 0.0, PSI = 0.0, TYPE = TEMPORAL, OUTFN = "test-chicane-1_m1"; D12: DRIFT, L = D_CH, X = M1_X, Y = Y0, Z = M1_Z, THETA = TH, PHI = 0.0, PSI = 0.0; B2: SBEND, L = LB, ANGLE = TH, E1 = 0.0, E2 = 0.0, HGAP = 0.0, FINT = 0.0, X = B2_X, Y = Y0, Z = B2_Z, THETA = TH / 2, PHI = 0.0, PSI = 0.0; M2: MONITOR, L = 0.0, X = M2_X, Y = Y0, Z = M2_Z, THETA = 0.0, PHI = 0.0, PSI = 0.0, TYPE = TEMPORAL, OUTFN = "test-chicane-1_m2"; D23: DRIFT, L = C_CH, X = M2_X, Y = Y0, Z = M2_Z, THETA = 0.0, PHI = 0.0, PSI = 0.0; B3: SBEND, L = LB, ANGLE = TH, E1 = 0.0, E2 = 0.0, HGAP = 0.0, FINT = 0.0, X = B3_X, Y = Y0, Z = B3_Z, THETA = -TH / 2, PHI = 0.0, PSI = 0.0; M3: MONITOR, L = 0.0, X = M3_X, Y = Y0, Z = M3_Z, THETA = -TH, PHI = 0.0, PSI = 0.0, TYPE = TEMPORAL, OUTFN = "test-chicane-1_m3"; D34: DRIFT, L = D_CH, X = M3_X, Y = Y0, Z = M3_Z, THETA = -TH, PHI = 0.0, PSI = 0.0; B4: SBEND, L = LB, ANGLE = -TH, E1 = 0.0, E2 = 0.0, HGAP = 0.0, FINT = 0.0, X = B4_X, Y = Y0, Z = B4_Z, THETA = -TH / 2, PHI = 0.0, PSI = 0.0; MEXIT: MONITOR, L = 0.0, X = MEXIT_X, Y = Y0, Z = MEXIT_Z, THETA = 0.0, PHI = 0.0, PSI = 0.0, TYPE = TEMPORAL, OUTFN = "test-chicane-1_exit"; Line1: LINE = (M0, B1, M1, D12, B2, M2, D23, B3, M3, D34, B4, MEXIT); Dist0: DISTRIBUTION, TYPE = FROMFILE, FNAME = "test-chicane-1_distribution.txt", NPARTDIST = 5; ES0: EMISSIONSOURCE, DISTRIBUTION = Dist0; Sources0: EMISSIONSOURCELIST = (ES0); FS0: FIELDSOLVER, TYPE = NONE, NX = 16, NY = 16, NZ = 16, PARFFTX = false, PARFFTY = false, PARFFTZ = true, BCFFTX = open, BCFFTY = open, BCFFTZ = open, BBOXINCR = 1, GREENSF = INTEGRATED; BEAM0: BEAM, PARTICLE = ELECTRON, NALLOC = 5, BCHARGE = 1.6021766339999998e-19, SOURCES = Sources0, CHARGE = -1; TRACK, LINE = Line1, BEAM = BEAM0, MAXSTEPS = 20000, DT = 1.0e-11, ZSTOP = 9.2; RUN, METHOD = "PARALLEL", FIELDSOLVER = FS0; ENDTRACK; QUIT;