Changeset 23 in TRACY3 for branches/tracy3-3.10.1b/tracy/tracy/src/t2lat.cc
- Timestamp:
- Dec 6, 2013, 5:12:43 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/tracy3-3.10.1b/tracy/tracy/src/t2lat.cc
r11 r23 44 44 leq, pwrsym, lss, geo, gtr, period_, charcon, stringcon, ident, geq, lsym, 45 45 bobrhosym, bobrhovsym, bobrhohsym, kxvsym, kxhsym, phisym, ksym, 46 tsym, t1sym, t2sym, h1sym,h2sym,46 tsym, t1sym, t2sym, 47 47 gapsym, thksym, invsym, thnsym, 48 48 endsym, tsksym, bemsym, corsym, prnsym, tblsym, possym, prmsym, … … 51 51 nbdsym, frgsym, latsym, mpsym, dbnsym, kssym, homsym, lmdsym, dtsym, xytsym, 52 52 vrfsym, harnumsym, frqsym, gstsym, typsym, rollsym, idsym, 53 fnamesym1, fnamesym2, scalingsym1, scalingsym2, fmsym, harmsym, sprsym, recsym, solsym, edge_effect1sym,edge_effect2sym,53 fnamesym1, fnamesym2, scalingsym1, scalingsym2, fmsym, harmsym, sprsym, recsym, solsym, 54 54 ff1sym, ff2sym, ffscalingsym, tiltsym 55 55 } Lat_symbol; /*\*/ 56 56 // idsym fnamesym1 fnamesym2 scalingsym added for insertion 57 57 // ring sym added 58 //edge_effect1sym, edge_effect2sym added, to turn on/off the edge effect of dipoles @ 05/10/2012 by Jianfeng Zhang59 58 // ff1sym ff2sym for quadrupole entrance and exit fringe field 60 59 // ffscalingsym scaling factor for entrance and exit fringe field. /*J.Zhang … … 658 657 if (!strncmp(id, "t ", sizeof(alfa_))) 659 658 *sym = tsym; 660 else if (!strncmp(id, "h1 ", sizeof(alfa_)))661 *sym = h1sym;662 else if (!strncmp(id, "h2 ", sizeof(alfa_)))663 *sym = h2sym;664 659 else if (!strncmp(id, "gap ", sizeof(alfa_))) 665 660 *sym = gapsym; … … 1059 1054 else if (!strncmp(fname, "t2 ", sizeof(partsName))) 1060 1055 x = WITH1->PTx2; 1061 else if (!strncmp(fname, "h1 ", sizeof(partsName)))1062 x = WITH1->PH1;1063 else if (!strncmp(fname, "h2 ", sizeof(partsName)))1064 x = WITH1->PH2;1065 1056 else if (!strncmp(fname, "gap ", sizeof(partsName))) 1066 1057 x = WITH1->Pgap; … … 2026 2017 struct LOC_Lat_DealElement V; 2027 2018 bool Result = false; 2028 double t=0.0, t1=0.0, t2=0.0, h1=0,h2=0,gap=0.0, QL = 0.0, QK=0.0; 2029 double QKick=0.0; /* kick angle of the corrector [rad]*/ 2030 int Kplane=0; /* kick plane of the corrector, 1 for H plane, -1 for V plane*/ 2031 double QKV=0.0, QKH=0.0, QKxV=0.0, QKxH=0.0, QPhi=0.0, QKS=0.0; 2032 double dt=0.0, Frf=0.0, Vrf=0.0; 2033 long harnum=0L; 2034 int k1=1; //number of cut slice of the element 2035 int k2=4; //integration method; Meth_Linear=0, Meth_First=1,Meth_Second=2,Meth_Fourth=4 2036 int edge_effect1=0,edge_effect2=0; //flag to turn on/off dipole fringe field 2037 int FF1=0, FF2=0; 2038 double FFscaling=0.0; 2019 double t, t1, t2, gap, QL = 0.0, QK; 2020 double QKick; /* kick angle of the corrector [rad]*/ 2021 int Kplane; /* kick plane of the corrector, 1 for H plane, -1 for V plane*/ 2022 double QKV, QKH, QKxV, QKxH, QPhi, QKS; 2023 double dt, Frf, Vrf; 2024 long k1, k2, harnum, FF1, FF2; 2025 double FFscaling; 2039 2026 Lat_symbol sym1; 2040 2027 symset mysys, SET; … … 2089 2076 test__(P_expset(SET, 1 << ((long)semicolon)), "<;> expected", &V); 2090 2077 GetSym__(&V); 2091 QL = *V.rnum;2092 2078 globval.Elem_nFam++; 2093 2079 if (globval.Elem_nFam <= Elem_nFamMax) { … … 2095 2081 WITH1 = &WITH->ElemF; 2096 2082 memcpy(WITH1->PName, ElementName, sizeof(partsName)); 2097 // WITH1->PL = *V.rnum; 2098 WITH1->PL = QL; 2083 WITH1->PL = *V.rnum; 2099 2084 WITH1->Pkind = PartsKind(drift); 2100 2085 Drift_Alloc(&WITH->ElemF); … … 2116 2101 T2 = <exit angle>, ( [degree] ) 2117 2102 gap = <total magnet gap>, ( [m] ) 2118 edge_effect1 = 1/0, turn on/ff the entrance edge effect,2119 and fringe field (if gap != 0)2120 edge_effect2 = 1/0, turn on/ff the exit edge effect,2121 and fringe field (if gap != 0)2122 2103 K = <K-value>, ( [m^-2] ) 2123 2104 ( K > 0 : focusing in horizontal plane ) … … 2135 2116 Example 2136 2117 2137 B: bending, L=0.70, T=10.0, T1:=5.0, T2:=5.0, H1=0, H2=0, gap=0.03, edge_effect1=1, edge_effect2=1,K=-1.0, N=8, Method=2;2118 B: bending, L=0.70, T=10.0, T1:=5.0, T2:=5.0, K=-1.0, N=8, Method=2; 2138 2119 2139 2120 *************************************************************************/ … … 2143 2124 QL = 0.0; /* L */ 2144 2125 QK = 0.0; /* K, quadrupole components*/ 2145 k1 = 1; /* N */2126 k1 = 0; /* N */ 2146 2127 t = 0.0; /* T */ 2147 2128 t1 = 0.0; /* T1 */ 2148 2129 t2 = 0.0; /* T2 */ 2149 h1 = 0.0;2150 h2 = 0.0;2151 2130 gap = 0.0; /* gap */ 2152 edge_effect1 = 0; /* edge_effect effect at the entrance */ 2153 edge_effect2 = 0; /* edge effect at the exit */ 2154 k2 = Meth_Fourth; /* method */ 2131 k2 = Meth_Linear; /* method */ 2155 2132 dt = 0.0; 2156 2133 ClearHOMandDBN(&V); … … 2163 2140 P_addset(mysys, (long)t1sym); 2164 2141 P_addset(mysys, (long)t2sym); 2165 P_addset(mysys, (long)h1sym);2166 P_addset(mysys, (long)h2sym);2167 2142 P_addset(mysys, (long)gapsym); 2168 P_addset(mysys, (long)edge_effect1sym);2169 P_addset(mysys, (long)edge_effect2sym);2170 2143 P_addset(mysys, (long)homsym); 2171 2144 P_addset(mysys, (long)dbnsym); … … 2205 2178 break; 2206 2179 2207 case h1sym:2208 h1 = EVAL_(&V);2209 break;2210 2211 case h2sym:2212 h2 = EVAL_(&V);2213 break;2214 2215 2180 case gapsym: 2216 2181 gap = EVAL_(&V); 2217 break;2218 2219 case edge_effect1sym:2220 edge_effect1 = (long)EVAL_(&V);2221 break;2222 2223 case edge_effect2sym:2224 edge_effect2 = (long)EVAL_(&V);2225 2182 break; 2226 2183 … … 2266 2223 else 2267 2224 WITH2->Pirho = t * M_PI / 180.0; 2268 WITH2->PTx1 = t1; WITH2->PTx2 = t2; //entrance and exit angle of the dipoles (relative to rectangular magnets) 2269 WITH2->PH1 = h1; WITH2->PH2 = h2; //entrance and exit angle of the dipoles 2270 WITH2->Pgap = gap; 2271 WITH2->dipEdge_effect1 = edge_effect1;//edge_effect effect at the entrance 2272 WITH2->dipEdge_effect2 = edge_effect2;//edge effect at the exit 2225 WITH2->PTx1 = t1; WITH2->PTx2 = t2; WITH2->Pgap = gap; 2273 2226 WITH2->n_design = Dip; 2274 2227 AssignHOM(globval.Elem_nFam, &V); … … 2302 2255 2303 2256 Q1: Quadrupole, L=0.5, K=2.213455, N=4, Method=4; 2304 Q1 : Quadrupole, L=0.5, K=2.213455, N=4, FF1 =1, FF2 =0, FFscaling=1, Method=4;2257 Q1 : Quadrupole, L=0.5, K=2.213455, N=4, FF1 =1, FF2, FFscaling=1, Method=4; 2305 2258 2306 2259 **************************************************************/ … … 2310 2263 QL = 0.0; /* L */ 2311 2264 QK = 0.0; /* K */ 2312 k1 = 1; /* N */2265 k1 = 0; /* N */ 2313 2266 k2 = Meth_Fourth; /* method */ 2314 2267 dt = 0.0; … … 2438 2391 QL = 0.0; /* L */ 2439 2392 QK = 0.0; /* K */ 2440 k1 = 1; /* N */2393 k1 = 0; /* N */ 2441 2394 k2 = Meth_Fourth; /* method */ 2442 2395 FF1 = 0; /* Entrance Fringe field */ … … 2653 2606 QKick = 0.0; /* kick angle of the corrector [rad]*/ 2654 2607 Kplane = 0; /* 1 is horizontal corrector, -1 is vertical corrector */ 2655 k1 = 1; /* N */2608 k1 = 0; /* N */ 2656 2609 k2 = Meth_Linear; /* method */ 2657 2610 dt = 0.0; … … 2931 2884 QL = 0.0; /* L */ 2932 2885 QK = 0.0; /* K */ 2933 k1 = 1; /* N */2886 k1 = 0; /* N */ 2934 2887 t = 0.0; /* T */ 2935 2888 t1 = 0.0; /* T1 */ 2936 2889 t2 = 0.0; /* T2 */ 2937 h1 = 0.0;2938 h2 = 0.0;2939 2890 gap = 0.0; /* gap */ 2940 k2 = Meth_ Fourth; /* method */2891 k2 = Meth_Linear; /* method */ 2941 2892 dt = 0.0; 2942 2893 ClearHOMandDBN(&V); … … 2947 2898 P_addset(mysys, (long)t1sym); 2948 2899 P_addset(mysys, (long)t2sym); 2949 P_addset(mysys, (long)h1sym);2950 P_addset(mysys, (long)h2sym);2951 2900 P_addset(mysys, (long)gapsym); 2952 2901 P_addset(mysys, (long)rollsym); … … 2983 2932 break; 2984 2933 2985 case h1sym:2986 h1 = EVAL_(&V);2987 break;2988 2989 case h2sym:2990 h2 = EVAL_(&V);2991 break;2992 2993 2934 case gapsym: 2994 2935 gap = EVAL_(&V); … … 3038 2979 } 3039 2980 WITH2->PN = k1; WITH2->Pmethod = k2; 3040 WITH2->PTx1 = t1; WITH2->PTx2 = t2; 3041 WITH2->PH1 = h1; WITH2->PH2 = h2; 3042 WITH2->Pgap = gap; 2981 WITH2->PTx1 = t1; WITH2->PTx2 = t2; WITH2->Pgap = gap; 3043 2982 WITH2->PdTpar = dt; 3044 2983 AssignHOM(globval.Elem_nFam, &V); … … 3083 3022 getest__(P_expset(SET, 1 << ((long)comma)), "<, > expected", &V); 3084 3023 GetSym__(&V); 3085 QL = 0e0; 3086 QK = 0e0; 3087 QKV = 0e0; 3088 QKH = 0e0; 3089 QKxV = 0e0; 3090 QKxH = 0e0; 3091 QPhi = 0e0; 3092 QKS = 0e0; 3093 k1 = 1; 3094 k2 = Meth_Fourth; 3095 dt = 0e0; 3024 QL = 0e0; QK = 0e0; QKV = 0e0; QKH = 0e0; QKxV = 0e0; QKxH = 0e0; 3025 QPhi = 0e0; QKS = 0e0; k1 = 0; k2 = Meth_Linear; dt = 0e0; 3096 3026 ClearHOMandDBN(&V); 3097 3027 P_addset(P_expset(mysys, 0), (long)lsym); … … 3219 3149 getest__(P_expset(SET, 1 << ((long)comma)), "<, > expected", &V); 3220 3150 GetSym__(&V); 3221 QL = 0.0; 3222 k1 = 1; 3223 strcpy(str1, ""); 3224 strcpy(str2, ""); 3151 QL = 0.0; k1 = 0; strcpy(str1, ""); strcpy(str2, ""); 3225 3152 P_addset(P_expset(mysys, 0), (long)lsym); 3226 3153 P_addset(mysys, (long)nsym); … … 3572 3499 QL = 0.0; /* L */ 3573 3500 QK = 0.0; /* K */ 3574 k1 = 1; /* N */3501 k1 = 0; /* N */ 3575 3502 P_addset(P_expset(mysys, 0), (long)lsym); 3576 3503 P_addset(mysys, (long)bobrhosym); … … 3731 3658 Reg("drift ", drfsym, &V); 3732 3659 Reg("dt ", dtsym, &V); 3733 Reg("edge_effect1 ", edge_effect1sym, &V); /* Jianfeng Zhang*/3734 Reg("edge_effect2 ", edge_effect2sym, &V); /* Jianfeng Zhang */3735 3660 Reg("end ", endsym, &V); 3736 3661 Reg("ff1 ", ff1sym, &V); /* Laurent */ … … 3746 3671 Reg("gap ", gapsym, &V); 3747 3672 Reg("ghost ", gstsym, &V); 3748 Reg("h1 ", h1sym, &V);3749 Reg("h2 ", h2sym, &V);3750 3673 Reg("harm ", harmsym, &V); 3751 3674 Reg("harnum ", harnumsym, &V);
Note: See TracChangeset
for help on using the changeset viewer.