At revision aaf720d475df6616935a56ea5914a68df10575d0, read_kin replaces every exactly zero electric-frequency knot by 1e-9 before applying the total-rotation scaling:
|
! manipulation of rotation variables |
|
welec(:) = wefac*kin%fs(:,5) ! direct manipulation of omegae |
|
! note dividing by zero makes a nan that then ruins the whole spline |
|
warning_printed = .false. |
|
do i=0,nkin |
|
if(welec(i) == 0) then |
|
welec(i) = 1e-9 |
|
if(.not. warning_printed)then |
|
print *, " ! WARNING ! Modifying omega_ExB = 0 to 1e-9 to avoid nans" |
|
warning_printed = .true. |
|
end if |
|
end if |
|
end do |
|
if(wefac/=1.0 .and. verbose) print('(a55,es10.2e3)'),' -> applying direct manipulation of omegaE by factor ',wefac |
|
wdian =-twopi*kin%fs(:,3)*kin%fs1(:,1)/(e*zi*chi1*kin%fs(:,1)) |
|
wdiat =-twopi*kin%fs1(:,3)/(e*zi*chi1) |
|
wpefac= (wpfac*(welec+wdian+wdiat) - (wdian+wdiat))/welec |
|
welec = wpefac*welec ! indirect manipulation of rotation |
|
kin%fs(:,5)=welec |
This makes an intended exact control nonzero. In particular, with wefac=0 and wpfac=1, every output knot becomes 1e-9 rad/s rather than zero. The modified profile is then stored in kin(:,5), so the PENTRC resonance operator receives the artificial frequency.
The division can be eliminated algebraically. With D = wdian + wdiat, lines 269-270 simplify exactly to
welec_new = wpfac * (welec + D) - D
for nonzero welec, and this expression is well defined at welec=0. It preserves all existing nonzero behavior while allowing exact zeros.
Suggested regression gates:
wefac=0, wpfac=1 gives bitwise/exact zero at every knot;
- arbitrary nonzero
welec matches the old two-line expression;
welec=0 and arbitrary wpfac gives wpfac*D-D without NaN;
- the written
omega_E profile and resonance input contain the same exact value.
The 1e-9 workaround was introduced in e403a232 to prevent NaNs caused by the avoidable division. This report concerns the altered physical control, not spline interpolation.
At revision
aaf720d475df6616935a56ea5914a68df10575d0,read_kinreplaces every exactly zero electric-frequency knot by1e-9before applying the total-rotation scaling:GPEC/pentrc/inputs.f90
Lines 253 to 271 in aaf720d
This makes an intended exact control nonzero. In particular, with
wefac=0andwpfac=1, every output knot becomes1e-9 rad/srather than zero. The modified profile is then stored inkin(:,5), so the PENTRC resonance operator receives the artificial frequency.The division can be eliminated algebraically. With
D = wdian + wdiat, lines 269-270 simplify exactly tofor nonzero
welec, and this expression is well defined atwelec=0. It preserves all existing nonzero behavior while allowing exact zeros.Suggested regression gates:
wefac=0, wpfac=1gives bitwise/exact zero at every knot;welecmatches the old two-line expression;welec=0and arbitrarywpfacgiveswpfac*D-Dwithout NaN;omega_Eprofile and resonance input contain the same exact value.The
1e-9workaround was introduced ine403a232to prevent NaNs caused by the avoidable division. This report concerns the altered physical control, not spline interpolation.