Skip to content

PENTRC - BUG FIX - Keep exact-zero omega_E controls exact in read_kin - #12

Draft
krystophny wants to merge 1 commit into
developfrom
fix/pentrc-zero-omega-e-20261107
Draft

krystophny wants to merge 1 commit into
developfrom
fix/pentrc-zero-omega-e-20261107

Conversation

@krystophny

@krystophny krystophny commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

read_kin replaces every zero $\omega_E$ knot by $10^{-9}$ rad/s before it rescales the rotation (pentrc/inputs.f90#L290-L306). The replacement is there because the rescaling divides by $\omega_E$. Here $\omega_E$ is the $E\times B$ frequency after the input factor wefac, and wpfac scales the total rotation $\omega_E + \omega_{*n} + \omega_{*T}$, where $\omega_{*n}$ and $\omega_{*T}$ are the density- and temperature-gradient frequencies (wdian, wdiat). As a result, a run with wefac = 0 and wpfac = 1 uses $10^{-9}$ rad/s instead of zero, and every knot where the profile itself is zero is shifted in the same way.

The rescaling now uses the equivalent form without the division, and the replacement and its warning are removed:

$$\omega_E \leftarrow \omega_E + (w_p - 1),(\omega_E + \omega_{*n} + \omega_{*T}), \qquad w_p = \texttt{wpfac}.$$

This keeps exact zeros, and with wpfac = 1 it leaves $\omega_E$ bit-for-bit unchanged; the old expression changed it by rounding.

regression/test/pentrc_zero_omega_e.f90 reads docs/examples/regression_solovev_kinetic_example/kinetic.txt. It is run by hand against the built PENTRC objects and is not part of CI. Without the fix it stops with max |omega_E| for wefac = 0: 1.0E-09; with the fix it passes. The Julia GPEC reforms $\omega_E$ without dividing, so it needs no counterpart.

Upstream: PrincetonUniversity#275.

Chris&AI

read_kin replaced every zero omega_E knot by 1e-9 rad/s so that the
wpfac rescaling, which divided by omega_E, would not produce NaN. A run
with wefac = 0 therefore used omega_E = 1e-9 instead of zero. The
rescaling is now the equivalent division-free
welec + (wpfac-1)*(welec+wdian+wdiat), which keeps zeros and leaves
omega_E unchanged for wpfac = 1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant