google-deepmind / torax

TORAX: Tokamak transport simulation in JAX
https://torax.readthedocs.io
Other
345 stars 31 forks source link

Bugfix ion Coloumb logarithm. #203

Closed copybara-service[bot] closed 3 months ago

copybara-service[bot] commented 3 months ago

Bugfix ion Coloumb logarithm.

ne was previously used instead of ni. New references generated for cases with Zeff>1. This bug only led to small errors (1e-3 relative error level).

Also expanded the logs in the Coloumb logarithm for small computational savings.

The change triggered eqx.error_if errors on the transient term in test_iterhybrid_rampup, due to the small difference in simulation trajectory leading to a Newton-Raphson step predicting negative temperatures. This check was unnecessary, since such unphysical steps are rejected anyway later in the algorithm. The error_if check was thus reduced to only check for too small absolute values. Later, we can reenable the checks to raise errors for negative values, once we restrict the Newton-Raphson step to avoid unphysical values at an earlier stage in the algorithm.