Skip to content
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

A script for calculating non-Maxwellianity #255

Merged
merged 17 commits into from
Aug 20, 2024

Conversation

vetarvus
Copy link
Contributor

@vetarvus vetarvus commented Aug 7, 2024

A pyCalculations script to calculate the non-Maxwellianity of a VDF, which has been previously available as a Vlasiator datareducer.

The output was tested using a 2D Kelvin-Helmholtz run from Tarvus et al. 2024.
Difference between the Vlasiator datareducer and this script is of the order of 1E-4 (significant values are typically > 1E-2).

@alhom
Copy link
Contributor

alhom commented Aug 7, 2024

Great to get this in as well!

But, comments:

  • please remove all the .pyc files from the PR.
  • We could wrap this with a datareducer, to get direct plotting support (even if it will be slow to plot). Gotta check the VDF reducers, not exactly sure if those worked straight out of the box. Let's see if that is easy to do, and if yes, let's add that. Otherwise we'll include the routine and defer the reducer to an issue.

@alhom
Copy link
Contributor

alhom commented Aug 8, 2024

More comments!

Difference between the Vlasiator datareducer and this script is of the order of 1E-4 (significant values are typically > 1E-2).

It would be nice to understand this discrepancy. It might be from this hard-coded threshold, so please check if syncing that with your test case fixes it:

threshold = 1e-21
distribution[distribution<threshold] = 0

Worth adding a kword for the threshold, and a sensible default threshold value (or no threshold as default?).
Vlasiator reducer just loops over everything with no threshold, no?
https://github.com/fmihpc/vlasiator/blame/62ac639d96eba005b66ba589bd69c2093663db92/datareduction/datareductionoperator.cpp#L2005
Edit: Threshold kword added with default of 0

Suggest adding a feature to calculate the non-maxwellianity for nearest existing VDF, using get_cellid_with_vdf (

def get_cellid_with_vdf(self, coords, pop = 'proton'):
) as in plot_vdf (
cidNearestVspace = vlsvReader.get_cellid_with_vdf(np.array([xReq[ii],yReq[ii],zReq[ii]]), pop=pop) # deprecated getNearestCellWithVspace(). needs testing
)

Multipop-Vspace reducers needs to be implemented for the reducer to work with modern data. Would you Vertti like to have a go at it? If not, we'll defer.

if reducer.useVspace:

@alhom alhom merged commit f0beea0 into fmihpc:master Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants