-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible bug in a5.markergen.generate method #78
Comments
In tutorials there is this plot which is obtained in the same way as the buggy plot you posted, but the one in the tutorials seem fine. https://ascot4fusion.github.io/ascot5/_images/tutorials_markergen_13_0.png This makes me think that the bug is actually in the BBNBI distribution output. Did you plot the distribution you get from |
Just to clarify: even if BBNBI distribution is broken, the result (i.e. marker output) seems fine, so it is likely that only the diagnostics is broken and nothing is wrong in the physics. |
I managed to reproduce this. The BBNBI distribution is ok, so the bug is somewhere within the markergen. |
Ok, it does not appear to be a bug, but an artefact produced by having a too coarse (ppar, pperp) grid. @Antonjvv what where your distribution settings in the options? I used 100 x 200 grid for (ppar,pperp) and that produced tolerable results. Eventually we will have implement (ekin,pitch) grid fro BBNBI and Ascot. |
Thanks @miekkasarki ! My (ppar, pperp) grid is 200x100, with ppar from negative to positive np.sqrt(2m_a const["elementary charge"][0]E); with E=100keV, and pperp is from 0 to np.sqrt(2m_a* const["elementary charge"][0]*E). I notice the markers from markergen have a grid cell like structure, could this be due to the ppar, pperp grid? |
Yeah, that's unfortunately from the grid. We will have to implement (energy,pitch) distributions directly in Ascot's C-kernel (so that BBNBI and AFSI output can be in these coordinates) to make better use of the marker generator tool. |
@miekkasarki I'm having an issue with the function a5.markergen.rhoto5d(), after running an AFSI simulation for a 3-D stellarator case (via a5.afsi.thermal() function), I can generate well the markers (alpha-particles) only when running this on a Mac (Sonoma 14.5) but every time I try to run it on a linux machine it crashes with the error "Segmentation fault (core dumped)", I've tried three different linux systems all with the same result. Any chance this is related to this issue? is there any way to diagnose what could be going wrong? |
@lcarbajal-t1e I'll make a new issue from this as it could be stellarator-specific. |
When generating markers for ascot (from a bbnbi results distribution) using a5.markergen.generate as follows:
nmrk = 4000
anum = 1
znum = 1
mass = 1.007unyt.amu
charge = 1.0unyt.e
dist = a5_run_tcv.data.active.getdist("5d")
dist.integrate(charge=np.s_[:], time=np.s_[:])
mrk = a5_run_tcv.markergen.generate(nmrk, mass, charge, anum, znum
plt.scatter(mrk["pitch"], mrk["energy"])
The markers pitch and energy distribution appears to be changed from the bbnbi5 result markers:
mrk = a5_run_tcv.data.active.getstate_markers("gc")
plt.scatter(mrk["pitch"], mrk["energy"])
The text was updated successfully, but these errors were encountered: