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

Spectral interpolation bugfix #128

Open
wants to merge 39 commits into
base: psidm
Choose a base branch
from

Conversation

KunkelAlexander
Copy link
Collaborator

@KunkelAlexander KunkelAlexander commented Aug 25, 2024

XY interpolation and fix bug in spectral interpolation

XY Interpolation

  • After careful experimentation, I decided that interpolating x = dens * cos(S/N) and y = dens * sin(S/N) is not a good idea since these fields are less well-behaved than the real and imaginary part of the wave function around the vortex
  • I propose to interpolate the density and phase by default and switch back to the real and imaginary part around the vortex
  • The switching is controlled by the repurposed runtime parameter SPEC_INT_VORTEX_THRESHOLD: If the laplacian of the phase field exceed this threshold, we interpolate the real and imaginary part

Runtime parameter

  • In addition, the ghost boundary size of the spectral refinement algorithm is now a runtime parameter SPEC_INT_GHOST_BOUNDARY. A large ghost boundary increases interpolation accuracy but can negatively affect performance.

Bug

  • The pull request also fixes a bug of the spectral interpolation routine: A simple bug with wrong variable assignment .

@KunkelAlexander KunkelAlexander marked this pull request as draft August 25, 2024 12:26
@KunkelAlexander KunkelAlexander marked this pull request as ready for review August 25, 2024 20:36
@KunkelAlexander
Copy link
Collaborator Author

KunkelAlexander commented Aug 25, 2024

@hyschive One thing that I still need to check is how to handle monotonicity: I know that monotonic interpolation introduces spurious oscillations for FDM which is why I never thought about how to properly enforce it in the spectral interpolation code. When interpolation density & phase, I manually check for negative densities and set them to 0. When interpolating RE/IM and if CONSERVE_MASS is on, DENS is interpolated separately and RE/IM are rescaled. But in this case, the spectral interpolation can introduce negative densities which cause the simulation to fail. I guess it would be possible to just carry order the monotonicity check from the quartic interpolation code and enable it when interpolating RE/IM and other fields that cannot become negative (like the density for the Poisson solver). What do you think?

@hyschive
Copy link
Owner

hyschive commented Sep 9, 2024

@KunkelAlexander Sorry for missing your message above. I agree with your suggestion. Do you prefer to apply the monotonic constraint everywhere or only for cells with negative values?

@hyschive hyschive self-requested a review September 9, 2024 04:52
@hyschive hyschive self-assigned this Sep 9, 2024
@hyschive hyschive added the psidm Wave dark matter label Sep 9, 2024
@KunkelAlexander
Copy link
Collaborator Author

@hyschive I am sorry for missing your message. Personally, I would prefer only applying the constraint to cells with negative values. Do you think that is okay?

@hyschive
Copy link
Owner

@hyschive I am sorry for missing your message. Personally, I would prefer only applying the constraint to cells with negative values. Do you think that is okay?

@KunkelAlexander Agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
psidm Wave dark matter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants