Skip to content

Commit 824ab3e

Browse files
committed
Fix derivative taking in line Taylor
1 parent e1f66f0 commit 824ab3e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

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
@@ -107,12 +107,12 @@ def _expand(self, sac, avec, bvec, rscale, isrc):
107107
def _evaluate(self, sac, avec, bvec, rscale, expansion_nr, coefficients):
108108
from sumpy.expansion.local import LineTaylorLocalExpansion
109109
tgt_knl = self.target_kernels[expansion_nr]
110-
if isinstance(tgt_knl, LineTaylorLocalExpansion):
110+
if isinstance(self.expansion, LineTaylorLocalExpansion):
111111
# In LineTaylorLocalExpansion.evaluate, we can't run
112112
# postprocess_at_target because the coefficients are assigned
113113
# symbols and postprocess with a derivative will make them zero.
114114
# Instead run postprocess here before the coefficients are assigned.
115-
coefficients = [tgt_knl.postprocess_at_target(coeff, bvec) for
115+
coefficients = [tgt_knl.postprocess_at_target(coeff, avec) for
116116
coeff in coefficients]
117117

118118
assigned_coeffs = [

0 commit comments

Comments
 (0)