-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add full particle orbit models (Pauli particle and classical particle) #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||
…rticle) Add support for two new orbit integration models alongside the existing guiding-center model: - ORBIT_PAULI_PARTICLE (orbit_model=1): Full 6D particle orbit with magnetic moment mu conserved (mu*grad(B) force term) - ORBIT_PARTICLE (orbit_model=2): Full 6D particle orbit without magnetic moment conservation (mu=0, pure Lorentz force) Implementation details: - New orbit_model parameter in simple.in namelist (default=0 for backward compatibility with guiding-center) - Cylindrical coordinates (R, phi, Z, p_R, p_phi, p_Z) for full orbit - Symplectic implicit midpoint integrator with Newton iteration - Gyrophase=0 convention using grad(B) x b direction (physically motivated) - mu computed per particle from initial conditions (same IC format as GC) - Requires field_input coils file for Biot-Savart field evaluation New files: - src/orbit_full.f90: Full orbit state type and integration routines - src/field/field_coils_cyl.f90: Cylindrical coordinate field evaluation Modified files: - src/params.f90: Added orbit_model parameter and validation - src/simple.f90: Added Tracer.fo (FullOrbitState) and init_full/timestep - src/simple_main.f90: Added full orbit dispatch in trace_orbit/macrostep - src/coordinates/coordinates.f90: Added transform_cyl_to_vmec for output - src/CMakeLists.txt: Added new source files
- Add SI-to-CGS unit conversion for coils in simple_main.f90 (meters->cm, Amperes->statamperes) - Fix B_cyl handling in orbit_full.f90: B_cyl(2) from field_coils_cyl is R*B_phi (covariant), not B_phi (contravariant) - Fix canonical momentum p_phi initialization to use m*R*v_phi_phys instead of m*R^2*v_phi - Add cyclotron-based timestep calculation for full orbit integration (50 steps per cyclotron period instead of transit-based dtau) - Store B00 from VMEC in vmec_B_scale for cyclotron frequency calculation - Add compare_gc_pauli.py example script for orbit comparison
c9de1a6 to
4154a71
Compare
User description
Summary
orbit_modelparameter: 0=guiding-center (default), 1=Pauli particle, 2=classical particleTest plan
PR Type
Enhancement
Description
Add full 6D particle orbit integration models (Pauli and classical)
Implement symplectic implicit midpoint integrator with Newton iteration
Support cylindrical coordinate field evaluation via Biot-Savart coils
Transform between cylindrical and VMEC coordinates for orbit output
Add orbit_model parameter (0=guiding-center, 1=Pauli, 2=classical)
Diagram Walkthrough
File Walkthrough
orbit_full.f90
Full orbit integration with implicit midpoint schemesrc/orbit_full.f90
p_phi, p_Z) and magnetic moment mu
proper gyrophase initialization
Newton iteration
and Jacobians for Newton solver
coordinates for output
contribution
field_coils_cyl.f90
Cylindrical Biot-Savart field evaluation modulesrc/field/field_coils_cyl.f90
Biot-Savart
Bmod, and gradient gradB
Jacobian handling
calculations
coordinates.f90
Cylindrical to VMEC coordinate transformationsrc/coordinates/coordinates.f90
VMEC coordinates
equations
[0,2π]
simple.f90
Integrate full orbit state into Tracer typesrc/simple.f90
guiding-center ICs
conversion back to GC coords
simple_main.f90
Add full orbit dispatch and coils initializationsrc/simple_main.f90
timestep_full_z)
not guiding-center
orbit_model
params.f90
Add orbit model selection and validationsrc/params.f90
(0), ORBIT_PAULI_PARTICLE (1), ORBIT_PARTICLE (2)
CMakeLists.txt
Register new source files in build systemsrc/CMakeLists.txt