Skip to content

Commit 4a52f96

Browse files
committed
add asymline expansion for the AxisTargetDerivative
1 parent 294aa61 commit 4a52f96

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

sumpy/qbx.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,30 @@ def _expand(self, sac, avec, bvec, rscale, isrc):
9696
conv = PymbolicToSympyMapper()
9797
strengths = [conv(self.get_strength_or_not(isrc, idx))
9898
for idx in range(len(self.source_kernels))]
99+
99100
coefficients = self.expansion.coefficients_from_source_vec(
100101
self.source_kernels, avec, bvec, rscale=rscale, weights=strengths,
101102
sac=sac)
102103

103104
return coefficients
104105

105106
def _evaluate(self, sac, avec, bvec, rscale, expansion_nr, coefficients):
106-
from sumpy.expansion.local import LineTaylorLocalExpansion
107+
from sumpy.expansion.local import LineTaylorLocalExpansion, AsymLineTaylorLocalExpansion
107108
tgt_knl = self.target_kernels[expansion_nr]
108-
if isinstance(tgt_knl, LineTaylorLocalExpansion):
109+
if isinstance(self.expansion, LineTaylorLocalExpansion):
109110
# In LineTaylorLocalExpansion.evaluate, we can't run
110111
# postprocess_at_target because the coefficients are assigned
111112
# symbols and postprocess with a derivative will make them zero.
112113
# Instead run postprocess here before the coefficients are assigned.
113-
coefficients = [tgt_knl.postprocess_at_target(coeff, bvec) for
114+
coefficients = [tgt_knl.postprocess_at_target(coeff, avec) for
115+
coeff in coefficients]
116+
117+
if isinstance(self.expansion, AsymLineTaylorLocalExpansion):
118+
# In LineTaylorLocalExpansion.evaluate, we can't run
119+
# postprocess_at_target because the coefficients are assigned
120+
# symbols and postprocess with a derivative will make them zero.
121+
# Instead run postprocess here before the coefficients are assigned.
122+
coefficients = [tgt_knl.postprocess_at_target(coeff, avec) for
114123
coeff in coefficients]
115124

116125
assigned_coeffs = [
@@ -512,7 +521,6 @@ def find_jump_term(kernel, arg_provider):
512521
AxisTargetDerivative,
513522
DerivativeBase,
514523
DirectionalSourceDerivative,
515-
DirectionalTargetDerivative,
516524
)
517525

518526
tgt_derivatives = []
@@ -522,9 +530,6 @@ def find_jump_term(kernel, arg_provider):
522530
if isinstance(kernel, AxisTargetDerivative):
523531
tgt_derivatives.append(kernel.axis)
524532
kernel = kernel.kernel
525-
elif isinstance(kernel, DirectionalTargetDerivative):
526-
tgt_derivatives.append(kernel.dir_vec_name)
527-
kernel = kernel.kernel
528533
elif isinstance(kernel, AxisSourceDerivative):
529534
src_derivatives.append(kernel.axis)
530535
kernel = kernel.kernel

0 commit comments

Comments
 (0)