Пример #1
0
void GWigPass_4th(struct gwig *pWig, double *X)
{

  const double x1 = 1.3512071919596576340476878089715e0;
  const double x0 =-1.7024143839193152680953756179429e0;

  int    i, Nstep;
  double dl, dl1, dl0;
 
  Nstep = pWig->PN*(pWig->Nw);
  dl = pWig->Lw/(pWig->PN);

  dl1 = x1*dl;
  dl0 = x0*dl;

  if (pWig->sr || pWig->isr)  {
    double B[2];
    double ax, ay, axpy, aypx;
    GWigAx(pWig, X, &ax, &axpy);
    GWigAy(pWig, X, &ay, &aypx);
    GWigB(pWig, X, B);
    X[1] -= ax;
    X[3] -= ay;
    GWigRadiationKicks(pWig, X, B, dl);
    X[1] += ax;
    X[3] += ay;
  }
  
  for (i = 1; i <= Nstep; i++ ) {
    GWigMap_2nd(pWig, X, dl1);
    GWigMap_2nd(pWig, X, dl0);
    GWigMap_2nd(pWig, X, dl1);
    if (pWig->sr || pWig->isr || pWig->cwiggler->fieldOutputInitialized) {
      double B[2];
      double ax, ay, axpy, aypx;
      GWigAx(pWig, X, &ax, &axpy);
      GWigAy(pWig, X, &ay, &aypx);
      GWigB(pWig, X, B);
      X[1] -= ax;
      X[3] -= ay;
      if (pWig->sr || pWig->isr)
        GWigRadiationKicks(pWig, X, B, dl);
      if (pWig->cwiggler->fieldOutputInitialized)
        GWigAddToFieldOutput(pWig->cwiggler, pWig->Zw, X, B);
      X[1] += ax;
      X[3] += ay;
    }
  }
}
Пример #2
0
void GWigPass_4th(struct gwig *pWig, double *X)
{

  const double x1 = 1.3512071919596576340476878089715e0;
  const double x0 =-1.7024143839193152680953756179429e0;

  int    i, Nstep;
  double dl, dl1, dl0;
 
  Nstep = pWig->PN*(pWig->Nw);
  dl = pWig->Lw/(pWig->PN);

  dl1 = x1*dl;
  dl0 = x0*dl;

  for (i = 1; i <= Nstep; i++ ) {
    GWigMap_2nd(pWig, X, dl1);
    GWigMap_2nd(pWig, X, dl0);
    GWigMap_2nd(pWig, X, dl1);
  }
}
Пример #3
0
void GWigPass_2nd(struct gwig *pWig, double *X) 
{
  int    i, Nstep;
  double dl;
  
  Nstep = pWig->PN*(pWig->Nw);
  dl    = pWig->Lw/(pWig->PN);

  for (i = 1; i <= Nstep; i++) {
    GWigMap_2nd(pWig, X, dl);
  }
}
Пример #4
0
void GWigPass_2nd(struct gwig *pWig, double *X) 
{
  int    i, Nstep;
  double dl;
#if FIELD_OUTPUT
  static FILE *fpd = NULL;
  static long index = 0;
  if (!fpd) {
    fpd = fopen("gwig.sdds", "w");
    fprintf(fpd, "SDDS1\n");
    fprintf(fpd, "&column name=i type=long &end\n");
    fprintf(fpd, "&column name=z type=double &end\n");
    fprintf(fpd, "&column name=x type=double &end\n");
    fprintf(fpd, "&column name=y type=double &end\n");
    fprintf(fpd, "&column name=px type=double &end\n");
    fprintf(fpd, "&column name=py type=double &end\n");
    fprintf(fpd, "&column name=delta type=double &end\n");
    fprintf(fpd, "&column name=Bx type=double &end\n");
    fprintf(fpd, "&column name=By type=double &end\n");
    fprintf(fpd, "&data mode=ascii no_row_counts=1 &end\n");
  }
#endif

  Nstep = pWig->PN*(pWig->Nw);
  dl    = pWig->Lw/(pWig->PN);

  if (pWig->sr || pWig->isr || FIELD_OUTPUT)  {
    double B[2];
    double ax, ay, axpy, aypx;
    GWigAx(pWig, X, &ax, &axpy);
    GWigAy(pWig, X, &ay, &aypx);
    GWigB(pWig, X, B);
    X[1] -= ax;
    X[3] -= ay;
    if (pWig->sr || pWig->isr)
      GWigRadiationKicks(pWig, X, B, dl);
#if FIELD_OUTPUT
    fprintf(fpd, "%ld %e %e %e %e %e %e %e %e\n",
            index, pWig->Zw, X[0], X[2], X[1], X[3], X[4], B[0], B[1]);
    index ++;
#endif
    X[1] += ax;
    X[3] += ay;
  }
  
  for (i = 1; i <= Nstep; i++) {
    GWigMap_2nd(pWig, X, dl);
    if (pWig->sr || pWig->isr || pWig->cwiggler->fieldOutputInitialized) {
      double B[2];
      double ax, ay, axpy, aypx;
      GWigAx(pWig, X, &ax, &axpy);
      GWigAy(pWig, X, &ay, &aypx);
      GWigB(pWig, X, B);
      X[1] -= ax;
      X[3] -= ay;
      if (pWig->sr || pWig->isr)
        GWigRadiationKicks(pWig, X, B, dl);
      if (pWig->cwiggler->fieldOutputInitialized)
        GWigAddToFieldOutput(pWig->cwiggler, pWig->Zw, X, B);
#if FIELD_OUTPUT
      fprintf(fpd, "%ld %e %e %e %e %e %e %e %e\n",
              index, pWig->Zw, X[0], X[2], X[1], X[3], X[4], B[0], B[1]);
      index ++;
#endif
      X[1] += ax;
      X[3] += ay;
    }
  }
}