source: MML/trunk/at/simulator/element/user/atphyslib.c @ 4

Last change on this file since 4 was 4, checked in by zhangj, 11 years ago

Initial import--MML version from SOLEIL@2013

File size: 902 bytes
Line 
1/*   File: atphyslib.c
2     Common physics functions for Accelerator Toolbox
3     A. Terebilo   10/28/04
4     Laurent S. NAdolski, April 8th, 2007
5          add energy dependance in edge_fringe and edge
6*/
7       
8#include "mex.h"
9void edge(double* r, double inv_rho, double edge_angle)
10{       /* Edge focusing in dipoles with hard-edge field */
11    double psi = inv_rho*tan(edge_angle);
12
13    /* r[1]+=r[0]*psi; */
14    r[1]+=r[0]*psi/(1+r[4]); 
15        r[3]-=r[2]*psi/(1+r[4]);
16}
17
18
19void edge_fringe(double* r, double inv_rho, double edge_angle, double fint, double gap)
20{   /* Edge focusing in dipoles with fringe field */
21    double fx = inv_rho*tan(edge_angle);
22    double psi_bar = edge_angle-inv_rho*gap*fint*(1+sin(edge_angle)*sin(edge_angle))/cos(edge_angle)/(1+r[4]);
23    double fy = inv_rho*tan(psi_bar);
24    /* r[1]+=r[0]*fx;
25    r[3]-=r[2]*fy; */
26    r[1]+=r[0]*fx/(1+r[4]);
27    r[3]-=r[2]*fy/(1+r[4]);   
28}
29
Note: See TracBrowser for help on using the repository browser.