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

Fs Grid data interpolation #164

Merged
merged 12 commits into from
Aug 22, 2022
Merged

Conversation

kstppd
Copy link
Contributor

@kstppd kstppd commented Feb 13, 2022

This implements a trilinear interpolation routine for FsGrid data and tries to resolve issue #136 .
Boundaries are handled the following way:

  • If a point is outside of a non periodic domain NaN is returned. My thought proccess here is that maybe we have some SC orbit and that goes out of our domain during some part of it. Then we would not want to discard all the orbit but only part of it. Hence the NaN returned there.
  • If a point is outside of a periodic domain then the neighbor is only given if the point is one cell away of the periodic dimension. Otherwise a NaN is returned. (here we could fold over the point back into the domain like particles in PIC but not sure what you think)
  • If a point is inside the domain but one of its neighbors cannot be located then a NaN is returned. Here we could revert to a nearest neighbor approach.

Have tested this with 2D runs, AMR on/off 3D runs, periodic dimensions , scalar and vector variables.

Example of interpolation in an AMR test run :
interpolated

@kstppd
Copy link
Contributor Author

kstppd commented Feb 13, 2022

Maybe @markusbattarbee @ursg @ykempf can have a look at this.

Copy link
Contributor

@markusbattarbee markusbattarbee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional comments on how output should be handled:

If a point is outside of a non periodic domain: Return None(s). We don't have data there, let's use None. 

If a point is outside of a periodic domain: just use modulo. 2D particle pusher particles can travel quite far in the out-of-plane direction so let's retain compatibility with that.

If a point is inside the domain but one of its neighbors cannot be located: indeed keep a is, return a NaN is returned. We don't want to hide errors in finding/interpolating data!

Also, I would recommend returning a numpy array instead of a list.

Copy link
Contributor

@markusbattarbee markusbattarbee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last fix for periodicity please! :)

@markusbattarbee markusbattarbee merged commit 90353a8 into fmihpc:master Aug 22, 2022
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