wschreyer / PENTrack

PENTrack - a simulation tool for ultra-cold neutrons, protons and electrons
GNU General Public License v2.0
8 stars 20 forks source link

Created new EDMFields class that has Electric and Magnetic fields used in Ramsey's method and added vxE effect when spin tracking is done #25

Closed ssc5 closed 8 years ago

ssc5 commented 9 years ago

I have added a new class called edmfields that currently includes 2 fields that could be used for a simulation of an nEDM measurement using Ramsey's method of separated oscillatory field.

Currently the static B0 field has been added using a model that is given here: http://physics.princeton.edu/~mcdonald/examples/axial.pdf. The model is currently quite simplistic because it assumes the EDM cell is centred and rotationally aligned with the coordinate system in the simulation. Also there is no cutoff on the field and it permeates all space in the simulation.

The second field added is the static electric field used in the EDM cell. It is also quite simplistic because it supposes that field is z-aligned and hence aligned with the B0 field.

The other addition in this pull request is the addition of the vxE effect which can have an effect on the larmor frequency. I couldn't think of a way to analytically derive formulae for the derivatives of the B field with the presence of the vxE effect and so they are currently not changed by the addition of the vxE effect. This might be a good enough approximation as this effect only contributes a B field on the order of 10^-11 - 10^-12 T.

ssc5 commented 9 years ago

The two most recent commits added 3 new bash scripts that I believe could be useful. Commit 3aa0fa2 added the postRunCheck.sh and preRunCheck.sh that are useful to do a preRunCheck of basic settings before launching a multi-job batch system run of PENTrack and a preliminary post multi-job run analysis.

Commit 013caa3 added the genGeomList.sh that produces a list of the STL files organized by priority defined in the file name and the material type defined in the file name, if the file name follows the following format: partName_mater_CuBe_prior_1.stl. This reduces the errors that are prone to happen when creating a simulation with a complex and large geometry and also speeds up the process of geometry.in significantly.

More details of how to run the 3 scripts can be read inside the files.

wschreyer commented 9 years ago

Your larmor frequency calculation only works in the special case that the magnetic field is parallel to the z-axis and the output is written faster then the spin rotates. The changed initial spin vector completely breaks the tracking in general fields. Also, the vxE effect should only be added inside the TBFIntegrator class, to not introduce this effect into the already fully relativistic particle tracking.

ssc5 commented 9 years ago

Yes, the current method of larmor frequency calculation is limited and I'm looking into making it more general but it was just a first attempt at adding the larmor frequency calculation to PENTrack.

I thought about adding the vxE too TBFIntegrator but the current construction of the class does not accept an electric field as an argument and also my understanding of that class is not as good as TFieldManager. I thought it would be ok to have the TFieldManager::AddvCrossE function because it would be only called in the condition when BFint.Integrate is called in particle.cpp.

Do you want me to still add the function to the TBFIntegrator?

wschreyer commented 9 years ago

Such a preliminary solution is not something I would include into the main repository. Especially since it breaks original functionality.

You should add the electric field as a parameter to the TBFIntegrator::Integrate function and calculate the vxE effect there. There you could also calculate the temporal derivatives of the resulting magnetic field. That's not possible in the TFieldManager class which only knows spatial derivatives.

ssc5 commented 9 years ago

Ok I will work on both of these problems.

ssc5 commented 9 years ago

What about the bash scripts I have added? Do you think those are useful and could be added to the main repository in their current state?

wschreyer commented 9 years ago

The bash scripts should definitely be useful. I have to see if I can merge the pull request partially.

ssc5 commented 8 years ago

I am not sure how it is typically done on GitHub, but how can I create a different fork that contains only the addition of the bash scripts and nothing else? I have already looked here

https://adrianshort.org/create-multiple-forks-of-a-github-repo/

and created PENTrack-2 repository but I don't have the option of creating a pull request to wschreyer/PENTrack from that repository.

Should I delete this fork and add the changes one at a time? I am not sure what the best way forward is. What do you suggest?

wschreyer commented 8 years ago

I played around with the git cherry-pick command and was able to include parts of your pull requests. http://mispdev.blogspot.de/2013/02/github-cherry-picking-commits-from-pull.html explains how to include single commits into another branch.