4848 HelmholtzKernel ,
4949 BiharmonicKernel ,
5050 StokesletKernel ,
51+ HeatKernel ,
5152 AxisTargetDerivative ,
5253 DirectionalSourceDerivative )
5354
@@ -278,6 +279,8 @@ def test_p2e2p(actx_factory, base_knl, expn_class, order, with_source_derivative
278279 extra_kwargs ["k" ] = 0.2
279280 if isinstance (base_knl , StokesletKernel ):
280281 extra_kwargs ["mu" ] = 0.2
282+ if isinstance (base_knl , HeatKernel ):
283+ extra_kwargs ["alpha" ] = 1.0
281284
282285 if with_source_derivative :
283286 knl = DirectionalSourceDerivative (base_knl , "dir_vec" )
@@ -306,12 +309,21 @@ def test_p2e2p(actx_factory, base_knl, expn_class, order, with_source_derivative
306309 h_values = [1 / 2 , 1 / 3 , 1 / 5 ]
307310
308311 rng = np .random .default_rng (19 )
309- center = np .array ([2 , 1 , 0 ][:knl .dim ], np .float64 )
310- sources = actx .from_numpy (
311- 0.7 * (- 0.5 + rng .random ((knl .dim , nsources ), dtype = np .float64 ))
312- + center [:, np .newaxis ])
312+
313+ if isinstance (base_knl , HeatKernel ):
314+ # Setup sources so that there are no negative time intervals
315+ center = np .array ([0 , 0 , 0 , 0.5 ][- knl .dim :], np .float64 )
316+ sources = (- 0.5 + rng .random ((knl .dim , nsources ), dtype = np .float64 )
317+ + center [:, np .newaxis ])
318+ loc_center = np .array ([0.0 , 0.0 , 0.0 , 6.0 ][- knl .dim :]) + center
319+ else :
320+ center = np .array ([2 , 1 , 0 ][- knl .dim :], np .float64 )
321+ sources = 0.7 * (- 0.5 + rng .random ((knl .dim , nsources ), dtype = np .float64 )
322+ + center [:, np .newaxis ])
323+ loc_center = np .array ([5.5 , 0.0 , 0.0 ][- knl .dim :]) + center
313324
314325 strengths = actx .from_numpy (np .ones (nsources , dtype = np .float64 ) / nsources )
326+ sources = actx .from_numpy (sources )
315327
316328 source_boxes = actx .from_numpy (np .array ([0 ], dtype = np .int32 ))
317329 box_source_starts = actx .from_numpy (np .array ([0 ], dtype = np .int32 ))
@@ -328,15 +340,12 @@ def test_p2e2p(actx_factory, base_knl, expn_class, order, with_source_derivative
328340
329341 for h in h_values :
330342 if issubclass (expn_class , LocalExpansionBase ):
331- loc_center = np .array ([5.5 , 0.0 , 0.0 ][:knl .dim ]) + center
332343 centers = np .array (loc_center , dtype = np .float64 ).reshape (knl .dim , 1 )
333344 fp = FieldPlotter (loc_center , extent = h , npoints = res )
334345 else :
335- eval_center = np .array ([1 / h , 0.0 , 0.0 ][: knl .dim ]) + center
346+ eval_center = np .array ([0.0 , 0.0 , 0.0 , 1 / h ][ - knl .dim : ]) + center
336347 fp = FieldPlotter (eval_center , extent = 0.1 , npoints = res )
337- centers = (np .array ([0.0 , 0.0 , 0.0 ][:knl .dim ],
338- dtype = np .float64 ).reshape (knl .dim , 1 )
339- + center [:, np .newaxis ])
348+ centers = center [:, np .newaxis ]
340349
341350 centers = actx .from_numpy (centers )
342351 targets = actx .from_numpy (make_obj_array (fp .points ))
@@ -434,7 +443,10 @@ def test_p2e2p(actx_factory, base_knl, expn_class, order, with_source_derivative
434443 if issubclass (expn_class , LocalExpansionBase ):
435444 tgt_order_grad = tgt_order - 1
436445 slack = 0.7
437- grad_slack = 0.5
446+ if isinstance (base_knl , HeatKernel ):
447+ grad_slack = 0.8
448+ else :
449+ grad_slack = 0.5
438450 else :
439451 tgt_order_grad = tgt_order + 1
440452
@@ -445,6 +457,10 @@ def test_p2e2p(actx_factory, base_knl, expn_class, order, with_source_derivative
445457 slack += 1
446458 grad_slack += 1
447459
460+ if isinstance (base_knl , HeatKernel ):
461+ slack += 0.5
462+ grad_slack += 1.5
463+
448464 if isinstance (knl , DirectionalSourceDerivative ):
449465 slack += 1
450466 grad_slack += 2
0 commit comments