Skip to content

A script for calculating non-Maxwellianity#255

Merged
alhom merged 17 commits intofmihpc:masterfrom
vetarvus:non-maxwellianity
Aug 20, 2024
Merged

A script for calculating non-Maxwellianity#255
alhom merged 17 commits intofmihpc:masterfrom
vetarvus:non-maxwellianity

Conversation

@vetarvus
Copy link
Copy Markdown
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
Copy Markdown
Member

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
Copy Markdown
Member

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:

Comment thread pyCalculations/non_maxwellianity.py Outdated
@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