Ignore:
Timestamp:
Dec 6, 2013, 5:12:43 PM (10 years ago)
Author:
zhangj
Message:

Clean version of Tracy: SoleilVersion at the end of 2011.Use this clean version to find the correct dipole fringe field to have the correct FMAP and FMAPDP of ThomX. Modified files: tpsa_lin.cc, soleillib.cc, prtmfile.cc, rdmfile.cc, read_script.cc, physlib.cc, tracy.cc, t2lat.cc, t2elem.cc, naffutils.cc in /tracy/tracy/src folder; naffutils.h, tracy_global.h, physlib.h, tracy.h, read_script.h, solielilib.h, t2elem.h in /tracy/tracy.inc folder; soltracy.cc in tracy/tools folder

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/tracy3-3.10.1b/tracy/tracy/src/t2lat.cc

    r11 r23  
    4444  leq, pwrsym, lss, geo, gtr, period_, charcon, stringcon, ident, geq, lsym,
    4545  bobrhosym, bobrhovsym, bobrhohsym, kxvsym, kxhsym, phisym, ksym,
    46   tsym, t1sym, t2sym,h1sym,h2sym,
     46  tsym, t1sym, t2sym,
    4747  gapsym, thksym, invsym, thnsym,
    4848  endsym, tsksym, bemsym, corsym, prnsym, tblsym, possym, prmsym,
     
    5151  nbdsym, frgsym, latsym, mpsym, dbnsym, kssym, homsym, lmdsym, dtsym, xytsym,
    5252  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,
    5454  ff1sym, ff2sym, ffscalingsym, tiltsym
    5555} Lat_symbol;   /*\*/
    5656// idsym fnamesym1 fnamesym2 scalingsym added for insertion
    5757// ring sym added
    58   //edge_effect1sym, edge_effect2sym added, to turn on/off the edge effect of dipoles @ 05/10/2012 by Jianfeng Zhang
    5958// ff1sym ff2sym for quadrupole entrance and exit fringe field
    6059// ffscalingsym scaling factor for entrance and exit fringe field.  /*J.Zhang
     
    658657      if (!strncmp(id, "t              ", sizeof(alfa_)))
    659658        *sym = tsym;
    660       else if (!strncmp(id, "h1            ", sizeof(alfa_)))
    661         *sym = h1sym;
    662       else if (!strncmp(id, "h2            ", sizeof(alfa_)))
    663         *sym = h2sym;
    664659      else if (!strncmp(id, "gap            ", sizeof(alfa_)))
    665660        *sym = gapsym;
     
    10591054        else if (!strncmp(fname, "t2             ", sizeof(partsName)))
    10601055          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;
    10651056        else if (!strncmp(fname, "gap            ", sizeof(partsName)))
    10661057          x = WITH1->Pgap;
     
    20262017  struct LOC_Lat_DealElement V;
    20272018  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;
    20392026  Lat_symbol     sym1;
    20402027  symset         mysys, SET;
     
    20892076    test__(P_expset(SET, 1 << ((long)semicolon)), "<;> expected", &V);
    20902077    GetSym__(&V);
    2091     QL = *V.rnum;
    20922078    globval.Elem_nFam++;
    20932079    if (globval.Elem_nFam <= Elem_nFamMax) {
     
    20952081      WITH1 = &WITH->ElemF;
    20962082      memcpy(WITH1->PName, ElementName, sizeof(partsName));
    2097    //   WITH1->PL = *V.rnum;
    2098        WITH1->PL = QL;
     2083      WITH1->PL = *V.rnum;
    20992084      WITH1->Pkind = PartsKind(drift);
    21002085      Drift_Alloc(&WITH->ElemF);
     
    21162101            T2     = <exit angle>, ( [degree] )
    21172102            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)
    21222103            K      = <K-value>, ( [m^-2] )
    21232104                     ( K > 0 : focusing in horizontal plane )
     
    21352116    Example
    21362117
    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;
    21382119
    21392120    *************************************************************************/
     
    21432124    QL = 0.0;   /* L */
    21442125    QK = 0.0;   /* K, quadrupole components*/
    2145     k1 = 1;   /* N */
     2126    k1 = 0;   /* N */
    21462127    t  = 0.0;   /* T */
    21472128    t1 = 0.0;   /* T1 */
    21482129    t2 = 0.0;   /* T2 */
    2149     h1 = 0.0;
    2150     h2 = 0.0;
    21512130    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 */
    21552132    dt = 0.0;
    21562133    ClearHOMandDBN(&V);
     
    21632140    P_addset(mysys, (long)t1sym);
    21642141    P_addset(mysys, (long)t2sym);
    2165     P_addset(mysys, (long)h1sym);
    2166     P_addset(mysys, (long)h2sym);
    21672142    P_addset(mysys, (long)gapsym);
    2168     P_addset(mysys, (long)edge_effect1sym);
    2169     P_addset(mysys, (long)edge_effect2sym);
    21702143    P_addset(mysys, (long)homsym);
    21712144    P_addset(mysys, (long)dbnsym);
     
    22052178        break;
    22062179
    2207         case h1sym:
    2208         h1 = EVAL_(&V);
    2209         break;
    2210 
    2211       case h2sym:
    2212         h2 = EVAL_(&V);
    2213         break;
    2214        
    22152180      case gapsym:
    22162181        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);
    22252182        break;
    22262183
     
    22662223      else
    22672224        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;
    22732226      WITH2->n_design = Dip;
    22742227      AssignHOM(globval.Elem_nFam, &V);
     
    23022255
    23032256      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;
    23052258
    23062259    **************************************************************/
     
    23102263    QL = 0.0;   /* L */
    23112264    QK = 0.0;   /* K */
    2312     k1 = 1;   /* N */
     2265    k1 = 0;   /* N */
    23132266    k2 = Meth_Fourth;   /* method */
    23142267    dt = 0.0;
     
    24382391    QL = 0.0;   /* L */
    24392392    QK = 0.0;   /* K */
    2440     k1 = 1;   /* N */
     2393    k1 = 0;   /* N */
    24412394    k2 = Meth_Fourth;   /* method */
    24422395    FF1 = 0;     /* Entrance Fringe field */
     
    26532606    QKick = 0.0; /* kick angle of the corrector [rad]*/
    26542607    Kplane = 0;   /* 1 is horizontal corrector, -1 is vertical corrector */
    2655     k1 = 1;     /* N */
     2608    k1 = 0;     /* N */
    26562609    k2 = Meth_Linear;   /* method */
    26572610    dt = 0.0;
     
    29312884    QL = 0.0;   /* L */
    29322885    QK = 0.0;   /* K */
    2933     k1 = 1;   /* N */
     2886    k1 = 0;   /* N */
    29342887    t = 0.0;   /* T */
    29352888    t1 = 0.0;   /* T1 */
    29362889    t2 = 0.0;   /* T2 */
    2937     h1 = 0.0;
    2938     h2 = 0.0;
    29392890    gap = 0.0;   /* gap */
    2940     k2 = Meth_Fourth;   /* method */
     2891    k2 = Meth_Linear;   /* method */
    29412892    dt = 0.0;
    29422893    ClearHOMandDBN(&V);
     
    29472898    P_addset(mysys, (long)t1sym);
    29482899    P_addset(mysys, (long)t2sym);
    2949     P_addset(mysys, (long)h1sym);
    2950     P_addset(mysys, (long)h2sym);
    29512900    P_addset(mysys, (long)gapsym);
    29522901    P_addset(mysys, (long)rollsym);
     
    29832932        break;
    29842933
    2985       case h1sym:
    2986         h1 = EVAL_(&V);
    2987         break;
    2988 
    2989       case h2sym:
    2990         h2 = EVAL_(&V);
    2991         break;
    2992        
    29932934      case gapsym:
    29942935        gap = EVAL_(&V);
     
    30382979      }
    30392980      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;
    30432982      WITH2->PdTpar = dt;
    30442983      AssignHOM(globval.Elem_nFam, &V);
     
    30833022    getest__(P_expset(SET, 1 << ((long)comma)), "<, > expected", &V);
    30843023    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;
    30963026    ClearHOMandDBN(&V);
    30973027    P_addset(P_expset(mysys, 0), (long)lsym);
     
    32193149    getest__(P_expset(SET, 1 << ((long)comma)), "<, > expected", &V);
    32203150    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, "");
    32253152    P_addset(P_expset(mysys, 0), (long)lsym);
    32263153    P_addset(mysys, (long)nsym);
     
    35723499    QL = 0.0; /* L */
    35733500    QK = 0.0; /* K */
    3574     k1 = 1;   /* N */
     3501    k1 = 0;   /* N */
    35753502    P_addset(P_expset(mysys, 0), (long)lsym);
    35763503    P_addset(mysys, (long)bobrhosym);
     
    37313658  Reg("drift          ", drfsym, &V);
    37323659  Reg("dt             ", dtsym, &V);
    3733   Reg("edge_effect1   ", edge_effect1sym, &V);     /* Jianfeng Zhang*/
    3734   Reg("edge_effect2   ", edge_effect2sym, &V);     /* Jianfeng Zhang */
    37353660  Reg("end            ", endsym, &V);
    37363661  Reg("ff1            ", ff1sym, &V);     /* Laurent */
     
    37463671  Reg("gap            ", gapsym, &V);
    37473672  Reg("ghost          ", gstsym, &V);
    3748   Reg("h1             ", h1sym, &V);
    3749   Reg("h2             ", h2sym, &V);
    37503673  Reg("harm           ", harmsym, &V);
    37513674  Reg("harnum         ", harnumsym, &V);
Note: See TracChangeset for help on using the changeset viewer.