@@ -232,7 +232,7 @@ def test_recurrence_laplace_2d_ellipse():
232232 err = []
233233 for n_p in range (200 , 1001 , 200 ):
234234 sources , centers , normals , density , jacobs , radius = _create_ellipse (n_p )
235- strengths = density * jacobs
235+ strengths = jacobs * density * ( 2 * np . pi / n_p )
236236 exp_res = recurrence_qbx_lp (sources , centers , normals ,
237237 strengths , radius , laplace2d ,
238238 g_x_y , 2 , p )
@@ -261,7 +261,7 @@ def test_recurrence_helmholtz_2d_ellipse():
261261 err = []
262262 for n_p in range (200 , 1001 , 200 ):
263263 sources , centers , normals , density , jacobs , radius = _create_ellipse (n_p )
264- strengths = density * jacobs
264+ strengths = jacobs * density * ( 2 * np . pi / n_p )
265265 exp_res = recurrence_qbx_lp (sources , centers , normals , strengths ,
266266 radius , helmholtz2d , g_x_y , 2 , p )
267267 qbx_res = _qbx_lp_general (hknl2d , sources , sources ,
@@ -285,7 +285,7 @@ def _construct_laplace_axis_2d(orders, resolutions):
285285 err_per_order = []
286286 for n_p in resolutions :
287287 sources , centers , normals , density , jacobs , radius = _create_ellipse (n_p )
288- strengths = density * jacobs
288+ strengths = jacobs * density * ( 2 * np . pi / n_p )
289289 exp_res = recurrence_qbx_lp (sources , centers , normals ,
290290 strengths , radius , laplace2d ,
291291 g_x_y , 2 , p )
@@ -298,6 +298,21 @@ def _construct_laplace_axis_2d(orders, resolutions):
298298
299299 return err
300300
301+
302+ def give_true_sol (n_p , a = 2 , n = 10 ):
303+ n = 10
304+ r = 1 / a
305+ mu_n = 1 / (2 * n ) * (1 + ((1 - r )/ (1 + r ))** n )
306+
307+ phi = sp .symbols ("phi" )
308+ jacob = sp .sqrt (a ** 2 * sp .sin (phi )** 2 + sp .cos (phi )** 2 )
309+
310+ t = np .linspace (0 , 2 * np .pi , n_p , endpoint = False )
311+ true_sol = mu_n * sp .lambdify (phi , jacob )(t ) * density
312+
313+ return true_sol
314+
315+
301316def plot ():
302317 import matplotlib .pyplot as plt
303318 orders = [6 , 7 , 8 , 9 ]
@@ -307,10 +322,8 @@ def plot():
307322 fig , ax = plt .subplots (figsize = (6 , 6 ))
308323 ax .set_yscale ("log" )
309324
310- orders_fake = [12 , 14 , 16 , 18 ]
311-
312325 for i in range (len (orders )):
313- ax .scatter (9.68845 / np .array (resolutions ), np .array (err_mat [i ]), label = "$p_{QBX}$=" + str (orders_fake [i ]))
326+ ax .scatter (9.68845 / np .array (resolutions ), np .array (err_mat [i ]), label = "$p_{QBX}$=" + str (orders [i ]))
314327 ax .set_xlabel ("Mesh Resolution ($h$)" )
315328 ax .set_ylabel ("Relative Error ($L_{\infty}$)" )
316329 plt .suptitle ("Laplace 2D: Ellipse SLP Boundary Evaluation Error $(u_{qbxrec}-u_{qbx})/u_{qbx}$" )
0 commit comments