Skip to content

Commit

Permalink
Reduce gmres_tol for FFT case
Browse files Browse the repository at this point in the history
  • Loading branch information
isuruf authored and inducer committed Jun 24, 2022
1 parent 9246c58 commit 1337297
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion pytential/qbx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
.. autoclass:: QBXTargetAssociationFailedException
.. autoclass:: DefaultExpansionFactory
.. autoclass:: NonFFTExpansionFactory
"""


Expand All @@ -51,14 +53,22 @@ class DefaultExpansionFactory(DefaultExpansionFactoryBase):
"""A expansion factory to create QBX local, local and multipole expansions
"""
def get_qbx_local_expansion_class(self, kernel):
local_expn_class = self.get_local_expansion_class(kernel)
local_expn_class = DefaultExpansionFactoryBase.get_local_expansion_class(
self, kernel)
from sumpy.expansion.m2l import NonFFTM2LTranslationClassFactory
factory = NonFFTM2LTranslationClassFactory()
m2l_translation = factory.get_m2l_translation_class(kernel,
local_expn_class)()
return partial(local_expn_class, m2l_translation=m2l_translation)


class NonFFTExpansionFactory(DefaultExpansionFactoryBase):
"""A expansion factory to create QBX local, local and multipole expansions
with no FFT for multipole-to-local translations
"""
get_local_expansion_class = DefaultExpansionFactory.get_qbx_local_expansion_class


class _not_provided: # noqa: N801
pass

Expand Down
5 changes: 5 additions & 0 deletions test/extra_int_eq_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class IntegralEquationTestCase:
fmm_backend: str = "sumpy"
fmm_order: Optional[int] = None
fmm_tol: Optional[float] = None
disable_fft: bool = False

# solver
gmres_tol: float = 1.0e-14
Expand Down Expand Up @@ -202,6 +203,10 @@ def get_layer_potential(self, actx, resolution, mesh_order):
else:
fmm_kwargs["fmm_order"] = self.qbx_order + 5

if self.disable_fft:
from pytential.qbx import NonFFTExpansionFactory
fmm_kwargs["expansion_factory"] = NonFFTExpansionFactory()

from pytential.qbx import QBXLayerPotentialSource
return QBXLayerPotentialSource(
pre_density_discr,
Expand Down
7 changes: 6 additions & 1 deletion test/test_scalar_int_eq.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,12 @@ def run_int_eq_test(actx,
bc_type="clamped_plate", side=-1, fmm_backend=None),
inteq.EllipseTestCase(
knl_class_or_helmholtz_k=BiharmonicKernel,
bc_type="clamped_plate", side=-1, fmm_backend="sumpy", fmm_order=15),
bc_type="clamped_plate", side=-1, fmm_backend="sumpy", fmm_order=15,
gmres_tol=1e-9),
inteq.EllipseTestCase(
knl_class_or_helmholtz_k=BiharmonicKernel,
bc_type="clamped_plate", side=-1, fmm_backend="sumpy", fmm_order=15,
disable_fft=True),
]


Expand Down

0 comments on commit 1337297

Please sign in to comment.