diff options
author | 2022-07-13 08:41:23 -0700 | |
---|---|---|
committer | 2022-07-13 08:41:23 -0700 | |
commit | a69b7a2a029132d0eec09c5fa9768eb659b67852 (patch) | |
tree | 3bb5956c5082349211768e0b15b5185be4b7f3ba /Examples/Modules | |
parent | c498385f21fc5fa59e99a5a6ec3b5db51c1cda11 (diff) | |
download | WarpX-a69b7a2a029132d0eec09c5fa9768eb659b67852.tar.gz WarpX-a69b7a2a029132d0eec09c5fa9768eb659b67852.tar.zst WarpX-a69b7a2a029132d0eec09c5fa9768eb659b67852.zip |
Refactor code in fusion module to avoid machine-precision issues (#3229)
* Refactor code in fusion module to avoid machine-precision issues
* Update formula
Diffstat (limited to 'Examples/Modules')
-rwxr-xr-x | Examples/Modules/nuclear_fusion/analysis_proton_boron_fusion.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Examples/Modules/nuclear_fusion/analysis_proton_boron_fusion.py b/Examples/Modules/nuclear_fusion/analysis_proton_boron_fusion.py index dfd47fe9b..8550b8767 100755 --- a/Examples/Modules/nuclear_fusion/analysis_proton_boron_fusion.py +++ b/Examples/Modules/nuclear_fusion/analysis_proton_boron_fusion.py @@ -338,8 +338,8 @@ def E_com_to_p_sq_com(m1, m2, E): ## E is the total (kinetic+mass) energy of a two particle (with mass m1 and m2) system in ## its center of mass frame, in J. ## Returns the square norm of the momentum of each particle in that frame. - return E**2/(4.*scc.c**2) - (m1**2 + m2**2)*scc.c**2/2. + \ - scc.c**6/(4.*E**2)*((m1**2 - m2**2)**2) + E_ratio = E/((m1+m2)*scc.c**2) + return m1*m2*scc.c**2 * (E_ratio**2 - 1) + (m1-m2)**2*scc.c**2/4 * (E_ratio - 1./E_ratio)**2 def compute_relative_v_com(E): ## E is the kinetic energy of proton+boron in the center of mass frame, in keV |