EGSnrc icon indicating copy to clipboard operation
EGSnrc copied to clipboard

Unit conversion 1.602E-10 in DOSRZnrc, DOSXYZnrc etc is off by 0.011% vs current data

Open dworogers opened this issue 3 years ago • 5 comments

Various RZ and other codes need to convert from scored MeV/g to Gy. Using latest codata values the conversion is 1.6021766E-10 rather than 1.602E-10 used in the codes, i.e. 0.011% higher. Not a big deal but might as well have it exact.

dworogers avatar Mar 14 '21 11:03 dworogers

Agreed. Since this value is exact in the SI, I would go all the way and define e = 1.602 176 634 x 10^-19 C.

ftessier avatar Apr 28 '21 12:04 ftessier

Found this in src/EEMF_macros_beamnrc.mortran: REPLACE{$EC_em}WITH{1.60217662E-19}; "electron charge". I suggest we simply make such a constant available throughout, along with conversion factors such as eVToMeV, MeVPerGramToGray, etc., as suggested by @MartinMartinov in #701.

ftessier avatar Apr 28 '21 13:04 ftessier

Something like this, in a new header egs_constants.h:


// Physical constants

const EGS_Float     e_charge = 1.602176634e-19;    // Coulomb, exact, CODATA 2018

// Conversion factors

const EGS_Float     eV_to_MeV           = 1e-6;
const EGS_Float     eV_to_Joule         = e_charge;
const EGS_Float     MeV_to_Joule        = 1e6 * eV_to_Joule;
const EGS_Float     MeVPerGram_to_Gray  = 1e3 * MeV_to_Joule;

// (and more...)

ftessier avatar Apr 28 '21 13:04 ftessier