Summary
chabrier1998 and chugunov2009 use fast_atan in their free energies.
Its two polynomial branches do not meet at abs(x) = 0.378. This makes
the free energies discontinuous at Gamma = 0.378^2, and can introduce
finite jumps in reaction screening as temperature or density varies.
Suggested priority: medium. The jump is small in the enhancement factor,
but it violates the smoothness needed by derivative-based solvers.
No full reaction integration failure was reproduced in this review.
Affected code
screening/screen.H:461: chugunov2009_f0 uses fast_atan.
screening/screen.H:553: chabrier1998_helmholtz_F uses fast_atan.
util/approx_math/approx_math.H:57-63: unmatched polynomial branches.
Reviewed commit: e4b401b7637894a3db5ffa1e4b401509a332a1d6.
Related approximation changes: PR #1583 and PR #1611 (24fc8547).
Reproduction
Run the harness described in README.md. It calls the production headers
with double precision, CPU execution, and Debye-Huckel skipping disabled.
It also evaluates fast_atan immediately on either side of 0.378.
For pure hydrogen at rho = 100 g/cm^3, with a proton-proton screening
pair, choose T0 = 23459845.13964622 K. This puts the compound-nucleus
coupling parameter at 0.378^2 in the Chabrier free energy.
The resulting actual_log_screen values are:
T = T0 * (1 - 1.e-9): h = 0.01856207303271599
T = T0 * (1 + 1.e-9): h = 0.01871818296030522
A relative temperature change of only 2.e-9 causes a jump in h of
approximately 1.5611e-4, or about 0.84% of h. The multiplicative
enhancement exp(h) jumps by approximately 0.0156%.
The same polynomial defect affects chugunov2009_f0; its reaction-level
transition occurs at a different temperature because that method passes
Gamma / t_12 to the free-energy function. The Chabrier transition
temperature above is not a Chugunov transition temperature.
Proposed fix
Use admath::atan in both screening free-energy functions. It provides a
smooth value and a consistent automatic derivative. This also addresses
the separate derivative issue in 03-screening-temperature-derivative.md.
If the approximation is needed for performance, replace it with a fit
whose values and first derivatives match at every branch boundary,
including the reciprocal transformations. Benchmark the replacement and
measure errors in the complete screening expression, where cancellation
can amplify approximation errors.
Validation
Probe both free-energy functions on both sides of every approximation
boundary. Verify the value difference tends to zero with the probe
spacing. Repeat at the reaction level with skipping disabled and compare
with an atan reference across weak and strong coupling.
Summary
chabrier1998andchugunov2009usefast_atanin their free energies.Its two polynomial branches do not meet at
abs(x) = 0.378. This makesthe free energies discontinuous at
Gamma = 0.378^2, and can introducefinite jumps in reaction screening as temperature or density varies.
Suggested priority: medium. The jump is small in the enhancement factor,
but it violates the smoothness needed by derivative-based solvers.
No full reaction integration failure was reproduced in this review.
Affected code
screening/screen.H:461:chugunov2009_f0usesfast_atan.screening/screen.H:553:chabrier1998_helmholtz_Fusesfast_atan.util/approx_math/approx_math.H:57-63: unmatched polynomial branches.Reviewed commit:
e4b401b7637894a3db5ffa1e4b401509a332a1d6.Related approximation changes: PR #1583 and PR #1611 (
24fc8547).Reproduction
Run the harness described in
README.md. It calls the production headerswith double precision, CPU execution, and Debye-Huckel skipping disabled.
It also evaluates
fast_atanimmediately on either side of0.378.For pure hydrogen at
rho = 100 g/cm^3, with a proton-proton screeningpair, choose
T0 = 23459845.13964622 K. This puts the compound-nucleuscoupling parameter at
0.378^2in the Chabrier free energy.The resulting
actual_log_screenvalues are:A relative temperature change of only
2.e-9causes a jump inhofapproximately
1.5611e-4, or about 0.84% ofh. The multiplicativeenhancement
exp(h)jumps by approximately 0.0156%.The same polynomial defect affects
chugunov2009_f0; its reaction-leveltransition occurs at a different temperature because that method passes
Gamma / t_12to the free-energy function. The Chabrier transitiontemperature above is not a Chugunov transition temperature.
Proposed fix
Use
admath::atanin both screening free-energy functions. It provides asmooth value and a consistent automatic derivative. This also addresses
the separate derivative issue in
03-screening-temperature-derivative.md.If the approximation is needed for performance, replace it with a fit
whose values and first derivatives match at every branch boundary,
including the reciprocal transformations. Benchmark the replacement and
measure errors in the complete screening expression, where cancellation
can amplify approximation errors.
Validation
Probe both free-energy functions on both sides of every approximation
boundary. Verify the value difference tends to zero with the probe
spacing. Repeat at the reaction level with skipping disabled and compare
with an
atanreference across weak and strong coupling.