Skip to content

Round root box size to a power of 2 - #78

Open
tristangdwl wants to merge 1 commit into
flatironinstitute:masterfrom
tristangdwl:exact-rescaling
Open

tristangdwl wants to merge 1 commit into
flatironinstitute:masterfrom
tristangdwl:exact-rescaling

Conversation

@tristangdwl

Copy link
Copy Markdown
Contributor

The rounding incurred when normalizing the root box leads to rounding errors in the point positions, which leads to large rounding errors for targets close to sources because the kernel blows up.

This change sets b0 = scale(1.0d0, exponent(boxsize(0))) to be a power of 2, so that the normalization is exact.

I also added a near-coincident test to test_lfmm3d_scale.f and test_hfmm3d_scale.f: 2000 charges and dipoles on a sphere in a box of size about 2.6, with targets 1e-10 off the surface. The errors were:

before after
Laplace, rel. l2 error (pot+grad) 2.2e-6 6e-28
Helmholtz, rel. l2 error (pot+grad) 2.3e-6 7e-28

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.

1 participant