Showing posts with label FFT. Show all posts
Showing posts with label FFT. Show all posts

Dec 13, 2012

Screenshots for configuration of FFTW3 in C++ (Windows)


When you download the zip file from “http://fftw.org/install/windows.html”,



By default, the zip file is like this (I use 64-bit version):






First thing you should do is to generate .lib files for these .dll files. Refer to the post here:
(notice in this post also have information for debug in case you find this problem)
Then copy them to the same folder which should looks like:

Copy this folder to your project’s folder (actually you can put it anywhere).
Here begins the screen shots of configuration:

1 Open the property configuration for present project. Choose “General” under “C/C++” option tab.

2 add the .dll file’s directory by click “Additional Include Directories”:

3 under the “Linker/General” option, choose “Additional Library Directories”

4 add the directory of your  .dll file here:

5 add the .lib files’ names under the “Linker/Input” option here:

6 make sure you’ve input all the .lib files you want to use;


Now you should be able to see the external header file under “External Dependencies” :



And include it above the other library:


Done.


In my code, I begin to use it like this:


You should refer to the manual of FFTW3 for the use of it.


·         You can choose “Optimization for running the code” to save running time if you don't need debug info.
·         

May 13, 2012

The Mathematica Documents

Beam Lattice


  • ring Lattice: finished and justified(two methods)
  • LEBT lattice: almost finished

(both of them could be compared with Madx's output)

Experimental Data Analyzing

  • Bdc results: finished. with FFT to get the period and a manipulate to get a dynamic view turn by turn
  • Bac results: no

Others:


  • FFT method for LSC(part II)--needed to be improved
  • part I needed to be write

Period for 200kV Helium 1 plus in DA

 The difference between calculated one and experimental one

calculation

For this calculation, at first glance, it is as simple as C0/v. Yes, you can say that only if:
  • correct circumference of the ring
  • correct rest mass of Helium
  • properly choose the right constant for light speed, proton mass, neutron mass, electron charge
  • the kinetic energy for the beam is precisely as 200 kv
After I choose the  following parameters(as used in harada's table calculation)
  • C0 = 37.71 m
  • const double lightSpeed = 2.99792458e8 m/s
  • const double electronCharge = 1.60217646e-19 C
  • const double protonMass = 1.672621e-27 kg
  • const double NeutronMass = 1.674927e-27 kg
for 200kv Helium 1+, circumference of the ring taken as 37.71m, 
lightSpeed = 2.99792458*10^8;
electronCharge=1.60217646*10^-19;
protonMass=1.672621*10^-27;
NeutronMass=1.674927*10^-27;
HeliumRest = 2*(NeutronMass+protonMass)*lightSpeed^2/electronCharge
ringLength=37.71;
extV=2*10^5;
gamma=extV/HeliumRest+1
beta=Sqrt[1-1/gamma^2]
T=ringLength/(beta*lightSpeed)
Output:
 beta = 0.0103197
T=12.189 us
if calculated with (as in Harada's "TsGEN3_20111025"):

  •  m0 = A * 1.6726231e-27 
  • A = 4
  • gamma = 1.0 + kinetic_energy * e / ( m0 * c * c )
  • beta = sqrt( 1 - 1/(gamma*gamma) )

the output is the same.

energy error

if we assume some energy differece at the injection, for example, 201kV, then the result is
T=12.1586 us

method error and ring length error

if we use atomic weight of helium as 4.002602 and atomic mass unit corresponding to energy in eV as 931.494061×10^6, the result is
T=12.1446 us
further more, if the change the ring length to be 37.75(4 cm longer)
T=12.1575 us

experiment

However, after doing FFT analysis to the bunch signal from the experimental data, the period is(2011116,1206,1222),:
T_experiment=12.1579 us
the difference is about: ( T - T_experiment )/T_experiment = 0.26%. This is a difference of 31 ns. Provided that the rise time of our Vbb is around ~80, or ~100 ns, in the experiment with Vbb this might be a problem.(in fact it may be good for commissioning, because the bunch tends to  "arrive later" when the B field is rising without acceleration to the beam.

others

I notice that for the 20111116 data, we did the experiment for different bunch length and different beam current. But the FFT analysis suggests that the period is changing as time goes by. This may suggested that the voltage is not so consistent with the B-field.

A better way is to do FFT to the part of the data ( for example, every 5 turns) until the time end(for example, 4ms as we usually use), then we can get a T changing along the time.

Strictly speaking, we cannot keep the extraction energy precisely every time we do the beam commissioning. However, as we can see by different date, the period given by the experiment is somehow repeat itself. With this we can safely say they're unnoticeable difference on the injection energy.

Note that if the injection energy is different from the what it needs to be with the B field, the period will change as time goes on.

conclusion at this momentum

as discussed above, use the atomic weight and a length of 37.75m is closer to the experiment result, if the result is reliable.




May 7, 2012

Problems for the LSC with FFT


Today's task(1 simulation):

  1. compare the phase space evolution between different momentum spread without LSC
  2. find the relationship between number of bins & number of test particles versus the density profile
  3. find a better way to retrieving the density profile

(2 Master Thesis)

  1. Finishing learning LaTeX
  2. study the Material of Bac-Bdc
(3 20111116 data summary)