From 837a2e118289e01b685696ddb5191589d81afd4d Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 3 Sep 2017 00:20:42 -0500 Subject: [PATCH 1/3] FMMlib: Actually use QBX order (not FMM order) for FMM expansions (Closes #69 on gitlab) --- pytential/qbx/fmmlib.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pytential/qbx/fmmlib.py b/pytential/qbx/fmmlib.py index 9f1d3240..de6fcdaa 100644 --- a/pytential/qbx/fmmlib.py +++ b/pytential/qbx/fmmlib.py @@ -409,7 +409,6 @@ class QBXFMMLibExpansionWrangler(FMMLibExpansionWrangler): nsources_starts=info.center_source_starts, center=info.centers, - nterms=self.nterms, ier=ier, expn=expn.T, @@ -543,8 +542,6 @@ class QBXFMMLibExpansionWrangler(FMMLibExpansionWrangler): locloc = self.get_translation_routine("%ddlocloc") for isrc_level in range(geo_data.tree().nlevels): - local_order = self.level_orders[isrc_level] - lev_box_start, lev_box_stop = self.tree.level_start_box_nrs[ isrc_level:isrc_level+2] target_level_start_ibox, target_locals_view = \ @@ -582,7 +579,7 @@ class QBXFMMLibExpansionWrangler(FMMLibExpansionWrangler): rscale2=qbx_radii[tgt_icenter], center2=tgt_center, - nterms2=local_order, + nterms2=self.qbx_order, **kwargs)[..., 0].T -- GitLab From 3a0a409f64cf4beb7c3e76b591bbb9bf80651f6c Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 3 Sep 2017 18:47:47 -0500 Subject: [PATCH 2/3] Make L2QBXL use the expansion view --- pytential/qbx/fmmlib.py | 7 ++++--- test/test_layer_pot_identity.py | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pytential/qbx/fmmlib.py b/pytential/qbx/fmmlib.py index de6fcdaa..c44f8081 100644 --- a/pytential/qbx/fmmlib.py +++ b/pytential/qbx/fmmlib.py @@ -544,9 +544,9 @@ class QBXFMMLibExpansionWrangler(FMMLibExpansionWrangler): for isrc_level in range(geo_data.tree().nlevels): lev_box_start, lev_box_stop = self.tree.level_start_box_nrs[ isrc_level:isrc_level+2] - target_level_start_ibox, target_locals_view = \ + locals_level_start_ibox, locals_view = \ self.local_expansions_view(local_exps, isrc_level) - assert target_level_start_ibox == lev_box_start + assert locals_level_start_ibox == lev_box_start kwargs = {} kwargs.update(self.kernel_kwargs) @@ -575,7 +575,8 @@ class QBXFMMLibExpansionWrangler(FMMLibExpansionWrangler): tmp_loc_exp = locloc( rscale1=level_to_rscale(self.tree, isrc_level), center1=src_center, - expn1=local_exps[src_ibox].T, + expn1=locals_view[ + src_ibox - locals_level_start_ibox].T, rscale2=qbx_radii[tgt_icenter], center2=tgt_center, diff --git a/test/test_layer_pot_identity.py b/test/test_layer_pot_identity.py index e8044d39..fe001342 100644 --- a/test/test_layer_pot_identity.py +++ b/test/test_layer_pot_identity.py @@ -176,10 +176,10 @@ class StarfishGreenTest(StaticTestCase): expr = GreenExpr() geometry = StarfishGeometry() k = 0 - qbx_order = 3 - fmm_order = 6 + qbx_order = 5 + fmm_order = 15 - resolutions = [30, 50, 70] + resolutions = [30, 50] _expansion_stick_out_factor = 0.5 -- GitLab From 87059a1ed3524f441b791eb8f3f2f5ac4cd0de7e Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 3 Sep 2017 18:49:27 -0500 Subject: [PATCH 3/3] Use qbx_exps terminology in fmmlib interface where appropriate --- pytential/qbx/fmmlib.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pytential/qbx/fmmlib.py b/pytential/qbx/fmmlib.py index c44f8081..f0021cce 100644 --- a/pytential/qbx/fmmlib.py +++ b/pytential/qbx/fmmlib.py @@ -360,10 +360,10 @@ class QBXFMMLibExpansionWrangler(FMMLibExpansionWrangler): def form_global_qbx_locals(self, src_weights): geo_data = self.geo_data - local_exps = self.qbx_local_expansion_zeros() + qbx_exps = self.qbx_local_expansion_zeros() if len(geo_data.global_qbx_centers()) == 0: - return local_exps + return qbx_exps formta_imany = self.get_routine("%ddformta" + self.dp_suffix, suffix="_imany") @@ -418,16 +418,16 @@ class QBXFMMLibExpansionWrangler(FMMLibExpansionWrangler): if np.any(ier != 0): raise RuntimeError("formta returned an error") - local_exps[geo_data.global_qbx_centers()] = expn.T + qbx_exps[geo_data.global_qbx_centers()] = expn.T - return local_exps + return qbx_exps # }}} # {{{ m2qbxl def translate_box_multipoles_to_qbx_local(self, multipole_exps): - local_exps = self.qbx_local_expansion_zeros() + qbx_exps = self.qbx_local_expansion_zeros() geo_data = self.geo_data qbx_center_to_target_box = geo_data.qbx_center_to_target_box() @@ -436,7 +436,7 @@ class QBXFMMLibExpansionWrangler(FMMLibExpansionWrangler): ngqbx_centers = len(geo_data.global_qbx_centers()) if ngqbx_centers == 0: - return local_exps + return qbx_exps mploc = self.get_translation_routine("%ddmploc", vec_suffix="_imany") @@ -522,9 +522,9 @@ class QBXFMMLibExpansionWrangler(FMMLibExpansionWrangler): if ier.any(): raise RuntimeError("m2qbxl failed") - local_exps[geo_data.global_qbx_centers()] += expn2 + qbx_exps[geo_data.global_qbx_centers()] += expn2 - return local_exps + return qbx_exps # }}} -- GitLab