Skip to content

Remove clight factor from u#1311

Merged
MaxThevenet merged 10 commits intoHi-PACE:developmentfrom
AlexanderSinn:Remove_clight_factor_from_u
Nov 25, 2025
Merged

Remove clight factor from u#1311
MaxThevenet merged 10 commits intoHi-PACE:developmentfrom
AlexanderSinn:Remove_clight_factor_from_u

Conversation

@AlexanderSinn
Copy link
Copy Markdown
Member

@AlexanderSinn AlexanderSinn commented Nov 12, 2025

This PR removes the factor of clight from the momentum arrays of beam and plasma particles. Whereas before the proper velocity was stored in u, now it is the normalized momentum = gamma * beta. This is much cleaner because it matches what is output to the user, saving many conversions between the two formats. In exchange, the particle pusher now normalizes the electric field with 1/c.

This seems to give a slight performance improvement:
PR

TinyProfiler total time across processes [min...avg...max]: 10.45 ... 10.45 ... 10.45
TinyProfiler total time across processes [min...avg...max]: 10.43 ... 10.43 ... 10.43
TinyProfiler total time across processes [min...avg...max]: 10.4 ... 10.4 ... 10.4
TinyProfiler total time across processes [min...avg...max]: 10.42 ... 10.42 ... 10.42

dev

TinyProfiler total time across processes [min...avg...max]: 10.56 ... 10.56 ... 10.56
TinyProfiler total time across processes [min...avg...max]: 10.51 ... 10.51 ... 10.51
TinyProfiler total time across processes [min...avg...max]: 10.51 ... 10.51 ... 10.51
TinyProfiler total time across processes [min...avg...max]: 10.51 ... 10.51 ... 10.51

I made sure that radiation reactions still work even in normalized units with the constants canceled out:

image image
  • Small enough (< few 100s of lines), otherwise it should probably be split into smaller PRs
  • Tested (describe the tests in the PR description)
  • Runs on GPU (basic: the code compiles and run well with the new module)
  • Contains an automated test (checksum and/or comparison with theory)
  • Documented: all elements (classes and their members, functions, namespaces, etc.) are documented
  • Constified (All that can be const is const)
  • Code is clean (no unwanted comments, )
  • Style and code conventions are respected at the bottom of https://github.com/Hi-PACE/hipace
  • Proper label and GitHub project, if applicable

@AlexanderSinn AlexanderSinn added the cleaning Code cleaning, avoid duplication, better naming, better style etc. label Nov 12, 2025
Copy link
Copy Markdown
Member

@MaxThevenet MaxThevenet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleaning, thanks for this PR!

@MaxThevenet MaxThevenet merged commit c46816d into Hi-PACE:development Nov 25, 2025
9 of 10 checks passed
@AlexanderSinn AlexanderSinn mentioned this pull request Nov 26, 2025
9 tasks
@AlexanderSinn AlexanderSinn added the unit system handling of both SI and normalized units options label Nov 26, 2025
@AlexanderSinn AlexanderSinn mentioned this pull request Jan 9, 2026
9 tasks
@AlexanderSinn AlexanderSinn deleted the Remove_clight_factor_from_u branch April 8, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleaning Code cleaning, avoid duplication, better naming, better style etc. unit system handling of both SI and normalized units options

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants