Skip to Content.
Sympa Menu

opal - [Opal] Re: emittance calculation

opal AT lists.psi.ch

Subject: The OPAL Discussion Forum

List archive

[Opal] Re: emittance calculation


Chronological Thread 
  • From: jjyang <jianjun.yang AT psi.ch>
  • To: "<suzie.sheehy AT stfc.ac.uk>" <suzie.sheehy AT stfc.ac.uk>
  • Cc: opal AT lists.psi.ch
  • Subject: [Opal] Re: emittance calculation
  • Date: Wed, 23 May 2012 08:59:45 -0400
  • List-archive: <https://lists.web.psi.ch/pipermail/opal/>
  • List-id: The OPAL Discussion Forum <opal.lists.psi.ch>

Hi Suzie,

You can find the following related code at OPAL/src/Track/TrackRun.cpp.

Since cyclotron is CW machine, we always have: (bunches number per turn) =
(harmonic number),
i.e., all the 'bucket' is filled by a bunch.

In your case with FFAG, if you work at pulsed mode, only one bucket is filled
by a bunch,
then you need to multiply the harmnoic number onto 'macrocharge' and
'macromass'.

Cheers,
Jianjun


/**
getFrequency() gets RF frequency [MHz], NOT isochronous
revolution frequency of particle!
getCurrent() gets beamcurrent [A]

*/
macrocharge = beam->getCurrent() / (beam->getFrequency() *
1.0e6); // [MHz]-->[Hz]

if(!OPAL->hasBunchAllocated()) {
if(!OPAL->inRestartRun()) {
macrocharge /= beam->getNumberOfParticles();
macromass = beam->getMass() * macrocharge /
(beam->getCharge() * q_e);
dist->create(*Track::block->bunch,
beam->getNumberOfParticles(), Options::scan);

} else {
dist->doRestart_cycl(*Track::block->bunch,
beam->getNumberOfParticles(),
OPAL->getRestartStep(),
specifiedNumBunch);
macrocharge /= beam->getNumberOfParticles();
macromass = beam->getMass() * macrocharge /
(beam->getCharge() * q_e);
}
} else if(OPAL->hasBunchAllocated() && Options::scan) {
macrocharge /= beam->getNumberOfParticles();
macromass = beam->getMass() * macrocharge /
(beam->getCharge() * q_e);
dist->create(*Track::block->bunch,
beam->getNumberOfParticles(), Options::scan);
}
}
Track::block->bunch->setMass(macromass); // set the Mass per
macro-particle, [GeV/c^2]
Track::block->bunch->setCharge(macrocharge); // set the charge per
macro-particle, [C]

*gmsg << "Mass of simulation particle= " << macromass << "GeV/c^2" <<
endl;
*gmsg << "Charge of simulation particle= " << macrocharge << "[C]" <<
endl;


在 2012-5-23,上午7:18, <suzie.sheehy AT stfc.ac.uk> <suzie.sheehy AT stfc.ac.uk> 写道:

> Hi Jianjun,
>
> So if I give a beam current of 10mA, and an RF frequency which is 10x the
> frequency of the time of flight (which I set as BFREQ), harmonic number
> 10. What does this assume? That I have 10 bunches (one in each 'bucket',
> or do I have 10 'buckets' with one bunch?
>
> I just want to make sure that when I say a 10mA beam, that I really am
> putting in a bunch which has the space-charge forces of a 10mA beam, and
> not orders of magnitude different due to the bunch structure!
>
> Clearly the definition of the distribution in the longitudinal direction
> must play a part in this calculation as well, does it use the defined
> bunch length somehow?
>
> Perhaps you could point me to where the code uses these input parameters
> so I can see how it uses them?
>
>
> Thanks,
> Suzie
>
> On 22/05/2012 23:23, "jjyang" <jianjun.yang AT psi.ch> wrote:
>
>> Hi Suzie,
>>
>> When you give the beam current, RF frequency, harmonic number and
>> simulation particle number,
>> the code will calculated the charge per particle, no matter how long your
>> beam length is.
>>
>> Cheers,
>> Jianjun
>>
>> 在 2012-5-22,上午11:41, <suzie.sheehy AT stfc.ac.uk> <suzie.sheehy AT stfc.ac.uk> 写
>> 道:
>>
>>> Hi Andreas and Jianjun,
>>> Sorry for another question (I have so many!) but how is the parameter
>>> 'BCURRENT' used together with the definition of a distribution?
>>> For example, if I specify a 10mA beam current but my beam length only
>>> fills 1% of the ring circumference, what does the code do?
>>> This doesn't seem to be discussed in the manual anywhere…
>>>
>>> Thanks,
>>> Suzie
>>>
>>>
>>> From: Andreas Adelmann
>>> <andreas.adelmann AT psi.ch<mailto:andreas.adelmann AT psi.ch>>
>>> Date: Fri, 11 May 2012 16:13:58 +0200
>>> To: Suzie Sheehy
>>> <suzie.sheehy AT stfc.ac.uk<mailto:suzie.sheehy AT stfc.ac.uk>>
>>> Subject: Re: emittance calculation
>>>
>>> Hello Suzie I am doing something between
>>> E and E^2 :-), here the details:
>>>
>>> calcMoments(); // second order (loops over all particles)
>>>
>>> for(unsigned int i = 0 ; i < Dim; i++) {
>>> rmean_m(i) = centroid_m[2 * i] / N;
>>> pmean_m(i) = centroid_m[(2 * i) + 1] / N;
>>> rsqsum(i) = moments_m(2 * i, 2 * i) - N * rmean_m(i) *
>>> rmean_m(i);
>>> psqsum(i) = moments_m((2 * i) + 1, (2 * i) + 1) - N * pmean_m(i)
>>> * pmean_m(i);
>>> if(psqsum(i) < 0)
>>> psqsum(i) = 0;
>>> rpsum(i) = moments_m((2 * i), (2 * i) + 1) - N * rmean_m(i) *
>>> pmean_m(i);
>>> }
>>>
>>> eps2 = (rsqsum * psqsum - rpsum * rpsum) / (N * N);
>>>
>>>
>>> for(unsigned int i = 0 ; i < Dim; i++) {
>>> ....
>>> eps_norm_m(i) = sqrt(max(eps2(i), zero));
>>>
>>> }
>>>
>>> // not normalize emittance (geom emittance)
>>> eps_m = eps_norm_m / Vector_t(gamma * sqrt(1.0 - 1.0 / (gamma *
>>> gamma)));
>>>
>>>
>>> CHeers Andreas
>>>
>>>
>>>
>>> On May 10, 2012, at 10:12 PM,
>>> <suzie.sheehy AT stfc.ac.uk<mailto:suzie.sheehy AT stfc.ac.uk>>
>>> <suzie.sheehy AT stfc.ac.uk<mailto:suzie.sheehy AT stfc.ac.uk>> wrote:
>>>
>>> Hi Andreas,
>>>
>>> I just want to check on the form of the emittance calculation that
>>> eventually goes into the .h5 output files. Could you point me to where
>>> the
>>> emittance is calculated in the code?
>>>
>>> Or perhaps you know the answer already - I just want to make sure that
>>> it
>>> is the RMS emittance calculated as a confirmed positive number, ie.
>>> instead of the calculation using:
>>> E = sqrt(<x^2><x'^2> - <xx'>^2)
>>>
>>> It should use:
>>> E^2= <x'^2><(x-x'<xx'>/<x'^2>)^2>
>>>
>>> This is to get around computational issues of small numbers etc... As
>>> per
>>> page 5-6 of:
>>> http://cas.web.cern.ch/cas/Bilbao-2011/Lectures/PriorbeamDynamics2.pdf
>>>
>>> Just making sure I understand each step!
>>> Thanks,
>>> Suzie
>>>
>>> On 08/05/2012 14:54, "Andreas Adelmann"
>>> <andreas.adelmann AT psi.ch<mailto:andreas.adelmann AT psi.ch>> wrote:
>>>
>>> no problem, great that it is working now!
>>>
>>> Andreas
>>>
>>>
>>> On 08.05.2012, at 15:33,
>>> <suzie.sheehy AT stfc.ac.uk<mailto:suzie.sheehy AT stfc.ac.uk>> wrote:
>>>
>>> Hi Andreas,
>>> I think I see what is happening, I end up with .dylib libraries instead
>>> of .so when following the instructions because I'm on OSX!
>>> Suzie
>>>
>>>
>>> From: Andreas Adelmann
>>>
>>> <andreas.adelmann AT psi.ch<mailto:andreas.adelmann AT psi.ch><mailto:andreas.a
>>> delmann AT psi.ch>>
>>> Date: Tue, 8 May 2012 11:03:55 +0200
>>> To: Suzie Sheehy
>>>
>>> <suzie.sheehy AT stfc.ac.uk<mailto:suzie.sheehy AT stfc.ac.uk><mailto:suzie.she
>>> ehy AT stfc.ac.uk>>
>>> Subject: Re: [Opal] New H5root
>>>
>>> Hi Suzie, from the webpage:
>>> http://amas.web.psi.ch/tools/H5root/index.html
>>>
>>> Get the tar ball from here:
>>>
>>> h5root-1.1.tar.gz<http://amas.web.psi.ch/tools/H5root/src-1.0.1/h5root-1.
>>> 1.tar.gz>
>>>
>>>
>>> tar zxf h5root-1.1.tar.gz
>>> cd h5root-1.1
>>> ./configure --with-hdf5=$HDF5ROOT/hdf5-1.8.5
>>> --with-h5hut=$H5HUTROOT/H5hut-s --with-root=$ROOTSYS --enable-h5hut
>>> --enable-root --enable-hdf5
>>> make install
>>>
>>>
>>>
>>> Now you will find a static executable H5root in the subdirectory
>>> $LIBPATH/h5root-1.1/h5root, which you may copy anywhere you find
>>> convenient. To test the program, you can download a small (11M) test
>>> file<http://amas.web.psi.ch/tools/H5root/data/test.h5>, and do:
>>>
>>>
>>> ./H5root test.h5
>>>
>>>
>>> The shard objets are at $LIBPATH/h5root-1.1/src/.libs/ This will give
>>> you a shared library $LIBPATH/libh5root.so, which you can load into a
>>> regular ROOT session (see below).
>>>
>>> Let me know if that works
>>> Andrea s
>>>
>>>
>>>
>>> On 08.05.2012, at 10:37,
>>>
>>> <suzie.sheehy AT stfc.ac.uk<mailto:suzie.sheehy AT stfc.ac.uk><mailto:suzie.she
>>> ehy AT stfc.ac.uk>> wrote:
>>>
>>> Hi Andreas,
>>>
>>> Do you have any advice for compiling H5root to produce the libH5root.so
>>> library to load in a ROOT session in order to use macros to do some more
>>> advanced plotting?
>>>
>>> On the h5root site it has this configuration:
>>> ./configure --with-hdf5=$HDF5ROOT/hdf5-1.8.5
>>> --with-h5hut=$H5HUTROOT/H5hut-s --with-root=$ROOTSYS --enable-h5hut
>>> --enable-root --enable-hdf5
>>> make install
>>>
>>>
>>> Do I need to add --enable-shared or something similar to get the .so
>>> library? And do I need to use -fPIC at some point?
>>>
>>> I notice that the install helpfiles still have reference to H5Part which
>>> I'm ignoring as I believe we need H5hut nowadays.
>>>
>>> Suzie
>>>
>>>
>>>
>>>
>>> On 06/09/2011 07:03, "Andreas Adelmann"
>>>
>>> <andreas.adelmann AT psi.ch<mailto:andreas.adelmann AT psi.ch><mailto:andreas.a
>>> delmann AT psi.ch>> wrote:
>>>
>>> Dear colleagues please check out the new release (1.1) of H5root at
>>> http://amas.web.psi.ch/tools/H5root/index.html
>>> .
>>> We migrated to H5hut and the newest version of root (5.30.00).
>>>
>>>
>>> PSI felsim users:
>>>
>>> Make sure /gpfs/homefelsim/adelmann/amas/bin is in your path and you
>>> have
>>>
>>> module load root
>>>
>>> in your .bashrc.
>>>
>>>
>>> Best Andreas
>>> ------
>>> Dr. sc. math. Andreas (Andy) Adelmann
>>> Staff Scientist
>>> Paul Scherrer Institut WLGB/132 CH-5232 Villigen PSI
>>> Phone Office: xx41 56 310 42 33 Fax: xx41 56 310 31 91
>>> Phone Home: xx41 62 891 91 44
>>> -------------------------------------------------------
>>> Friday: ETH CAB H 83.1 +41 44 632 36 72
>>> ============================================
>>> The more exotic, the more abstract the knowledge,
>>> the more profound will be its consequences.
>>> Leon Lederman
>>> ============================================
>>>
>>>
>>>
>>> _______________________________________________
>>> Opal mailing list
>>> Opal AT lists.psi.ch<mailto:Opal AT lists.psi.ch><mailto:Opal AT lists.psi.ch>
>>> https://lists.web.psi.ch/mailman/listinfo/opal
>>>
>>> --
>>> Scanned by iCritical.
>>>
>>> Best Andreas
>>> ------
>>> Dr. sc. math. Andreas (Andy) Adelmann
>>> Staff Scientist
>>> Paul Scherrer Institut WLGB/132 CH-5232 Villigen PSI
>>> Phone Office: xx41 56 310 42 33 Fax: xx41 56 310 31 91
>>> Phone Home: xx41 62 891 91 44
>>> -------------------------------------------------------
>>> Friday: ETH CAB H 83.1 +41 44 632 36 72
>>> ============================================
>>> The more exotic, the more abstract the knowledge,
>>> the more profound will be its consequences.
>>> Leon Lederman
>>> ============================================
>>>
>>>
>>>
>>> --
>>> Scanned by iCritical.
>>>
>>> Best Andreas
>>> ------
>>> Dr. sc. math. Andreas (Andy) Adelmann
>>> Staff Scientist
>>> Paul Scherrer Institut WLGB/132 CH-5232 Villigen PSI
>>> Phone Office: xx41 56 310 42 33 Fax: xx41 56 310 31 91
>>> Phone Home: xx41 62 891 91 44
>>> -------------------------------------------------------
>>> Friday: ETH CAB H 83.1 +41 44 632 36 72
>>> ============================================
>>> The more exotic, the more abstract the knowledge,
>>> the more profound will be its consequences.
>>> Leon Lederman
>>> ============================================
>>>
>>>
>>>
>>>
>>> --
>>> Scanned by iCritical.
>>>
>>> ------
>>> Dr. sc. math. Andreas (Andy) Adelmann
>>> Staff Scientist
>>> Paul Scherrer Institut WBBA/219 CH-5232 Villigen PSI
>>> Phone Office: xx41 56 310 42 33 Fax: xx41 56 310 31 91
>>> Phone Home: xx41 62 891 91 44
>>> -------------------------------------------------------
>>> Friday: ETH CAB H 8x.x +41 44 632 xx xx
>>> ============================================
>>> The more exotic, the more abstract the knowledge,
>>> the more profound will be its consequences.
>>> Leon Lederman
>>> ============================================
>>>
>>>
>>>
>>> --
>>> Scanned by iCritical.
>>
>
> --
> Scanned by iCritical.




  • [Opal] Re: emittance calculation, jjyang, 05/23/2012

Archive powered by MHonArc 2.6.19.

Top of Page