maroba / multipoles

A Python package for multipole expansions of electrostatic or gravitational potentials
MIT License
39 stars 10 forks source link

Weird Harmonic Artifacts #16

Open levi2234 opened 10 months ago

levi2234 commented 10 months ago

Discussed in https://github.com/maroba/multipoles/discussions/15

Originally posted by **levi2234** December 5, 2023 # Astrometric Halo Merger artifacts While applying the Multipole Expansion on a set of 2 Gaussian distributed clusters I encountered a weird artifact dependent on the value of L_min. When the Gaussian cluster has a separation of multiple cluster standard deviations a deep potential well occurs exactly between the two clusters. As the clusters move inward this well resolves itself. I would like to know if this is a problem that should be adressed or if it is expected behaviour. If it is the latter I think I must look to some other solution. To sketch the problem I have included a video mock collision for multiple modes for both haloes and single points. As a reference I have also included an discrete example of what I would expect the potential field to look like. https://github.com/maroba/multipoles/assets/10477282/a5ee3c48-465b-467e-87e8-debfa4ce312b https://github.com/maroba/multipoles/assets/10477282/5c164b2c-2fb8-4d91-8852-160a6dc24bf0 https://github.com/maroba/multipoles/assets/10477282/ceaabf90-dd88-43d7-a2cd-8b41a6ad9a6f https://github.com/maroba/multipoles/assets/10477282/eb1d6dda-bb18-4234-9d53-ade6ce59c26f https://github.com/maroba/multipoles/assets/10477282/eeaf7bed-82ba-4644-80eb-66352083f55a https://github.com/maroba/multipoles/assets/10477282/2cb24dc2-fc6e-4d00-99f1-79a6933af570 https://github.com/maroba/multipoles/assets/10477282/1de9ca0d-ec53-4418-98bd-81f69114b06f https://github.com/maroba/multipoles/assets/10477282/3301181b-c524-4a89-bf99-2486de6f7115 https://github.com/maroba/multipoles/assets/10477282/9f604064-ce9e-49e8-b05f-9bd4c3291344
maroba commented 10 months ago

@levi2234 Can you share the code so that I can take a closer look at the issue? Thanks!

levi2234 commented 10 months ago

@levi2234 Can you share the code so that I can take a closer look at the issue? Thanks!

Yes Definitely,

Here is the exact code used to create the above images

EvolutionMultipole.zip

maroba commented 10 months ago

@levi2234 Ok, I see what the problem is. You treat the two separated Gaussian lumps as a one combined distribution, which means that the region between the lumps is actually inside the combined charge distribution. But the multipole expansion you are doing is an exterior expansion, so the solution between the lumps must be far off from the true solution. What you could do is calculate the multipole expansion for each of the lumps separately and then add the solutions. However, convergence would be quite bad because the two lumps are rather close together. Remember that the actual use case for the multipole expansion (at least numerically) is to get a good approximation for the far field solutions. In your case, your domain is a mixture of interior region and near-field exterior region, so here I would probably try solve the Poisson equation by some iterative grid method instead of using multipoles...