Closed georgeholt1 closed 1 year ago
It looks like flux_ion
is a scalar, but is only written on the process that has the 'upper-y' boundary.
[BTW I have no idea how changing the neutral density could affect this error!]
The assumption in squashoutput
is that scalars are things that are the same on all processes, and would be written on all processes, so scalars will be read from (I think) BOUT.dmp.0.nc
. This usually makes sense - e.g. a 'flux to the target' in a 3d tokamak simulation would be needed at up to 4 separate targets so there would be no way to collect those into a single scalar variable.
I suspect a solution requires a change to some code, either boutdata.squashoutput
or SD1D (or both):
the 'best' solution is probably to
ion_flux
a FieldPerp
object in SD1DSAVE_REPEAT(ion_flux);
on all processes, not just the last oneion_flux
is actually needed, call ion_flux.set_index()
to give it a sensible y-index (i.e. a local index in range for that process, I think either a grid cell or boundary cell, but not a guard cell).That should let squashoutput()
(via BoutOutputs
) handle ion_flux
correctly, although the FieldPerp
handling is a tricky special case and not as well tested as scalar/Field2D/Field3D.
squash_output()
an argument like drop_variables
, which would be a list of names that it should just ignore if they are found. I'll make a PR for this - it should be simple...Thanks for the thorough explanation and quickfix!
I tried to run squashoutput
on the simulation output that it previously worked for and this time it threw the above error. It could be intermittent, or I could be making a mistake somewhere.
I sometimes find that calling
squashoutput.squashoutput
fails when I try to call it on SD1D simulation output. This seems to only occur for simulations that ran in parallel. All simulations I've tested on exit gracefully with the creation of a BOUT.stop file.The (truncated) error message is always:
Grepping for
flux_ion
in the dmp.nc files shows it is only present in one of them. However, this also seems to be the case for other similar simulations that don't throw the above error when runningsquashoutput
on them.My exact call to
squashoutput
is:The BOUT.inp file for reproducibility is below. Changing neutral density from 0.0007 to 0.0001 results in a simulation that
squashoutput
works on.