Summary
The four complex scalar field-function variables written by gpout_pmodb have a one-point-short RESHAPE extent. Their NetCDF poloidal dimension contains mthsurf+1 points (theta=0...1), but lines 2991--3002 reshape the source arrays to (/mstep,mthsurf,2/). The result corrupts the complex value at theta=0 and leaves the periodic endpoint as fill.
Affected variables:
b_eul_fun
b_lag_fun
Bdivxi_perp_fun
Bkappaxi_perp_fun
The adjacent normal-field writer correctly uses (/mstep,mthsurf+1,2/) at lines 3635--3638.
Reproduction
Revision: 19b43523684d3336856462608d1ac56f6ed5f308.
I built GPEC with GNU Fortran, OpenBLAS, and system netCDF, ran the repository's regression_solovev_kinetic_example, and replaced its coil drive by one explicitly complex boundary harmonic:
coil_flag = .false.
harmonic_flag = .true.
cosmn(2) = 1e-4
sinmn(2) = 2e-4
I ran the same DCON solution twice with (ip_direction,bt_direction)=(positive,positive) and (positive,negative), giving NetCDF helicity=+1 and -1. The internal b_lag spectra are bitwise identical. For theta_dcon indices 1--63, every field-function value obeys the source's expected -helicity imaginary-part map exactly. At index 0, however, both runs contain the same complex value rather than conjugates; its imaginary part is identically copied from its real part. At index 64 (theta_dcon=1) both components are fill.
Representative b_lag_fun(theta=0,psi index 100) values:
helicity=+1: 1.6715577267257276e-4 + 1.6715577267257276e-4 i
helicity=-1: 1.6715577267257276e-4 + 1.6715577267257276e-4 i
At an interior point the expected map works:
helicity=+1: 1.5994490543356555e-4 + 1.4473644169856975e-4 i
helicity=-1: 1.5994490543356555e-4 - 1.4473644169856975e-4 i
Cause
The arrays eulbparfout, lagbparfout, divxprpfout, and curvfout have the periodic 0:mthsurf poloidal extent. The NetCDF theta coordinate also has mthsurf+1 entries. The four writes nevertheless use:
so the concatenated real/imaginary source is split at the wrong offset and supplied with one missing poloidal plane.
Expected
Use (/mstep,mthsurf+1,2/), add a complex nonzero-sine regression, and assert:
- both components at
theta=0 are correct;
- the periodic endpoint equals
theta=0;
- reversing helicity reverses only the packed imaginary component for the same native solution.
Scope
This is an output serialization defect in the four pmodb field-function variables. The Fourier-space b_eul, b_lag, Bdivxi_perp, and Bkappaxi_perp variables are not affected. No production source was changed during this audit.
Summary
The four complex scalar field-function variables written by
gpout_pmodbhave a one-point-shortRESHAPEextent. Their NetCDF poloidal dimension containsmthsurf+1points (theta=0...1), but lines 2991--3002 reshape the source arrays to(/mstep,mthsurf,2/). The result corrupts the complex value attheta=0and leaves the periodic endpoint as fill.Affected variables:
b_eul_funb_lag_funBdivxi_perp_funBkappaxi_perp_funThe adjacent normal-field writer correctly uses
(/mstep,mthsurf+1,2/)at lines 3635--3638.Reproduction
Revision:
19b43523684d3336856462608d1ac56f6ed5f308.I built GPEC with GNU Fortran, OpenBLAS, and system netCDF, ran the repository's
regression_solovev_kinetic_example, and replaced its coil drive by one explicitly complex boundary harmonic:I ran the same DCON solution twice with
(ip_direction,bt_direction)=(positive,positive)and(positive,negative), giving NetCDFhelicity=+1and-1. The internalb_lagspectra are bitwise identical. Fortheta_dconindices 1--63, every field-function value obeys the source's expected-helicityimaginary-part map exactly. At index 0, however, both runs contain the same complex value rather than conjugates; its imaginary part is identically copied from its real part. At index 64 (theta_dcon=1) both components are fill.Representative
b_lag_fun(theta=0,psi index 100)values:At an interior point the expected map works:
Cause
The arrays
eulbparfout,lagbparfout,divxprpfout, andcurvfouthave the periodic0:mthsurfpoloidal extent. The NetCDF theta coordinate also hasmthsurf+1entries. The four writes nevertheless use:so the concatenated real/imaginary source is split at the wrong offset and supplied with one missing poloidal plane.
Expected
Use
(/mstep,mthsurf+1,2/), add a complex nonzero-sine regression, and assert:theta=0are correct;theta=0;Scope
This is an output serialization defect in the four
pmodbfield-function variables. The Fourier-spaceb_eul,b_lag,Bdivxi_perp, andBkappaxi_perpvariables are not affected. No production source was changed during this audit.