Skip to content

Uninitialized data written to wout: potvac cos half and am/ai/ac_aux_f #10

Description

@CharlesCNorton

Two sets of arrays reach the wout without ever being assigned.

potvac. vacmod.f90:176 allocates potvac(2*mnpd) for every run. For lasym = F, vacmod0.f90:66 sets mnpd2 = mnpd, and the solve at vacuum.f90:139 fills the first mnpd entries only. wrout.f90:330 and 442 define and write the whole array, and freeb_data.f90:149 reads potvac(mn0+mnpd) as potcos. On input.cth_like_free_bdy (VMEC++ test data, with mgrid_cth_like.nc) the written array has 126 entries; entries 64 to 126 are heap contents, nine of them above 1e100 (2.6e111, 1.5e279, ...) in one run and zero in another. The 2017 VMEC2000 8.52 source allocates the same size (allocate_nunv.f:27).

am_aux_f, ai_aux_f, ac_aux_f. vmec_input.f90:359-361 defaults the three _aux_s arrays to -1; the _aux_f arrays (vmec_input.f90:52-56) have no default and are written by wrout.f90:722 and the neighbouring lines. Built with -finit-real=snan, all 1001 entries of each are NaN in the wout; a release build writes whatever static memory holds.

potvac = 0 after the allocation and am_aux_f = 0; ai_aux_f = 0; ac_aux_f = 0 beside the _aux_s defaults make both deterministic.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions