Skip to content

Commit 34e1395

Browse files
committed
Fix derivative taking in line Taylor
1 parent 16620ff commit 34e1395

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

sumpy/expansion/local.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,12 @@ def coefficients_from_source(self, kernel, avec, bvec, rscale, sac=None):
149149

150150
def evaluate(self, tgt_kernel, coeffs, bvec, rscale, sac=None):
151151
# no point in heeding rscale here--just ignore it
152-
return sym.Add(*(
153-
coeffs[self.get_storage_index(i)] / math.factorial(i)
154-
for i in self.get_coefficient_identifiers()))
152+
153+
# NOTE: We can't meaningfully apply target derivatives here.
154+
# Instead, this is handled in LayerPotentialBase._evaluate.
155+
return sym.Add(*(
156+
coeffs[self.get_storage_index(i)] / math.factorial(i)
157+
for i in self.get_coefficient_identifiers()))
155158

156159
def translate_from(self, src_expansion, src_coeff_exprs, src_rscale,
157160
dvec, tgt_rscale, sac=None, m2l_translation_classes_dependent_data=None):

sumpy/qbx.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ def _expand(self, sac, avec, bvec, rscale, isrc):
105105
def _evaluate(self, sac, avec, bvec, rscale, expansion_nr, coefficients):
106106
from sumpy.expansion.local import LineTaylorLocalExpansion
107107
tgt_knl = self.target_kernels[expansion_nr]
108-
if isinstance(tgt_knl, LineTaylorLocalExpansion):
108+
if isinstance(self.expansion, LineTaylorLocalExpansion):
109109
# In LineTaylorLocalExpansion.evaluate, we can't run
110110
# postprocess_at_target because the coefficients are assigned
111111
# symbols and postprocess with a derivative will make them zero.
112112
# Instead run postprocess here before the coefficients are assigned.
113-
coefficients = [tgt_knl.postprocess_at_target(coeff, bvec) for
113+
coefficients = [tgt_knl.postprocess_at_target(coeff, avec) for
114114
coeff in coefficients]
115115

116116
assigned_coeffs = [

0 commit comments

Comments
 (0)