OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
TestSpinTBMTPusher.cpp File Reference

Unit tests for the Thomas-BMT spin pusher (Rodrigues-rotation kernel). More...

#include <gtest/gtest.h>
#include "Physics/Physics.h"
#include "Steppers/SpinTBMTPusher.h"
#include "Utility/Inform.h"
#include <cmath>
Include dependency graph for TestSpinTBMTPusher.cpp:

Go to the source code of this file.

Classes

class  SpinTBMTPusherTest
 

Functions

 TEST_F (SpinTBMTPusherTest, PrecessesAtCorrectFrequencyInStaticBz)
 
 TEST_F (SpinTBMTPusherTest, NoEvolutionWhenPolParallelToBAndNoE)
 
 TEST_F (SpinTBMTPusherTest, NoEvolutionWhenFieldsAreZero)
 
 TEST_F (SpinTBMTPusherTest, PreservesMagnitudeOverManySteps)
 

Variables

Inform * gmsg
 

Detailed Description

Unit tests for the Thomas-BMT spin pusher (Rodrigues-rotation kernel).

The SpinTBMTPusher evolves the per-particle polarization vector \(\vec P\) over a timestep \(\Delta t\) by the Thomas-BMT equation \(d\vec P / dt = \vec\Omega \times \vec P\), with the lab-frame angular velocity

\[ \vec\Omega = -\frac{q}{m}\Big[\, \big(G + \frac{1}{\gamma}\big)\,\vec B - \frac{G\,\gamma}{\gamma+1}\,(\vec\beta \cdot \vec B)\,\vec\beta - \big(G + \frac{1}{\gamma+1}\big)\,\frac{\vec\beta \times \vec E}{c} \,\Big], \]

applied as an analytic rotation by angle \(\phi = |\vec\Omega|\,\Delta t\) about \(\hat n = \vec\Omega / |\vec\Omega|\) via Rodrigues' formula. The rotation form preserves \(|\vec P|\) exactly per step.

Here \(G = (g - 2) / 2\) is the magnetic moment anomaly: the dimensionless deviation of the particle's gyromagnetic ratio \(g\) from the Dirac value \(g = 2\). For the muon, \(G = a_\mu \approx 1.166 \times 10^{-3}\); for the proton, \(G \approx 1.793\). \(G = 0\) recovers pure Larmor precession at \(\omega = qB/(\gamma m)\), so the contribution \(G\,\vec B\) in \(\vec\Omega\) is precisely the part the BMT equation adds beyond the Dirac result.

References:

  • V. Bargmann, L. Michel, V. L. Telegdi, *"Precession of the Polarization of Particles Moving in a Homogeneous Electromagnetic Field"*, Phys. Rev. Lett. 2, 435 (1959).
  • J. D. Jackson, Classical Electrodynamics, 3rd ed., §11.11 (T-BMT eq.).
  • PDG listings for the muon (used here for \(a_\mu = (g-2)/2\)): https://pdg.lbl.gov/2024/listings/rpp2024-list-muon.pdf

The cyclotron-frequency reference used in the precession check is \(\omega_c = q\,c^2\,B / (\gamma\,m_{\text{eV}})\), which in OPALX conventions equals the SI \(qB/(\gamma m)\) because mass is stored as rest energy \(m c^2\) in eV.

Tests in this file:

  • SpinTBMTPusherTest::PrecessesAtCorrectFrequencyInStaticBz — at rest in a uniform \(B_z\) with \(\vec E = 0\), T-BMT reduces to Larmor precession at \(\omega_S = (1 + a_\mu)\,\omega_c\). Pol starts along \(\hat x\); after one step the rotation angle in the \(xy\) plane is compared to \(\omega_S\,\Delta t\), and \(|\vec P|\) is verified to remain 1.
  • SpinTBMTPusherTest::NoEvolutionWhenPolParallelToBAndNoE — with \(\vec P \parallel \vec B\) and \(\vec E = 0\), the cross product \(\vec\Omega \times \vec P\) vanishes; Pol must be unchanged.
  • SpinTBMTPusherTest::NoEvolutionWhenFieldsAreZero — with \(\vec E = \vec B = 0\), \(\vec\Omega = 0\) regardless of momentum; Pol must be unchanged.
  • SpinTBMTPusherTest::PreservesMagnitudeOverManySteps — drives 1000 rotations under uniform \(B_z\) and checks that \(|\vec P|\) stays 1 to float-storage precision, validating that the Rodrigues form does not let \(|\vec P|\) drift across many steps.

Definition in file TestSpinTBMTPusher.cpp.

Function Documentation

◆ TEST_F() [1/4]

TEST_F ( SpinTBMTPusherTest  ,
NoEvolutionWhenFieldsAreZero   
)

Definition at line 153 of file TestSpinTBMTPusher.cpp.

References SpinTBMTPusher::evolve().

Here is the call graph for this function:

◆ TEST_F() [2/4]

TEST_F ( SpinTBMTPusherTest  ,
NoEvolutionWhenPolParallelToBAndNoE   
)

Definition at line 136 of file TestSpinTBMTPusher.cpp.

References SpinTBMTPusher::evolve().

Here is the call graph for this function:

◆ TEST_F() [3/4]

TEST_F ( SpinTBMTPusherTest  ,
PrecessesAtCorrectFrequencyInStaticBz   
)

Definition at line 104 of file TestSpinTBMTPusher.cpp.

References SpinTBMTPusher::evolve().

Here is the call graph for this function:

◆ TEST_F() [4/4]

TEST_F ( SpinTBMTPusherTest  ,
PreservesMagnitudeOverManySteps   
)

Definition at line 169 of file TestSpinTBMTPusher.cpp.

References SpinTBMTPusher::evolve().

Here is the call graph for this function:

Variable Documentation

◆ gmsg

Inform* gmsg
extern