From 0a52c78b62197b8dbed47ea6166388f7e3f7e71c Mon Sep 17 00:00:00 2001 From: Randy LeVeque Date: Tue, 24 Jul 2018 17:47:44 -0700 Subject: [PATCH 1/4] for clarity don't redefine clawdata attributes in setplot_abl.py --- examples/acoustics_2d_radial/setplot_abl.py | 22 ++++++++++----------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/examples/acoustics_2d_radial/setplot_abl.py b/examples/acoustics_2d_radial/setplot_abl.py index 486b063..2ae5cd6 100644 --- a/examples/acoustics_2d_radial/setplot_abl.py +++ b/examples/acoustics_2d_radial/setplot_abl.py @@ -41,10 +41,10 @@ def setplot(plotdata=None): abldata.read(plotdata.outdir + '/abl.data', force=True) clawdata = ClawData() clawdata.read(plotdata.outdir + '/claw.data', force=True) - clawdata.lower[0] += abldata.depth_lower[0] - clawdata.upper[0] -= abldata.depth_upper[0] - clawdata.lower[1] += abldata.depth_lower[1] - clawdata.upper[1] -= abldata.depth_upper[1] + x1 = clawdata.lower[0] + abldata.depth_lower[0] + x2 = clawdata.upper[0] - abldata.depth_upper[0] + y1 = clawdata.lower[1] + abldata.depth_lower[1] + y2 = clawdata.upper[1] - abldata.depth_upper[1] plotdata.clearfigures() # clear any old figures,axes,items data @@ -72,10 +72,8 @@ def setplot(plotdata=None): def plot_original_domain(current_data): from matplotlib.pyplot import gca ax = gca() - x = [clawdata.lower[0], clawdata.upper[0], clawdata.upper[0], \ - clawdata.lower[0], clawdata.lower[0]] - y = [clawdata.lower[1], clawdata.lower[1], clawdata.upper[1], \ - clawdata.upper[1], clawdata.lower[1]] + x = [x1,x2,x2,x1,x1] + y = [y1,y1,y2,y2,y1] ax.plot(x, y, '--k') plotaxes.afteraxes = plot_original_domain @@ -102,10 +100,10 @@ def p_vs_r(current_data): x = current_data.x y = current_data.y r = sqrt(x**2 + y**2) - r = masked_where(x < clawdata.lower[0], r) - r = masked_where(x > clawdata.upper[0], r) - r = masked_where(y < clawdata.lower[1], r) - r = masked_where(y > clawdata.upper[1], r) + r = masked_where(x < x1, r) + r = masked_where(x > x2, r) + r = masked_where(y < y1, r) + r = masked_where(y > y2, r) q = current_data.q p = MaskedArray(q[0,:,:], mask=r.mask) return r,p From 5f7a38f761fcb149f42b36542b547f6267f068f2 Mon Sep 17 00:00:00 2001 From: Randy LeVeque Date: Tue, 24 Jul 2018 17:49:18 -0700 Subject: [PATCH 2/4] added text to plot of ABL --- examples/acoustics_2d_radial/setplot_abl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/acoustics_2d_radial/setplot_abl.py b/examples/acoustics_2d_radial/setplot_abl.py index 2ae5cd6..8aeb65c 100644 --- a/examples/acoustics_2d_radial/setplot_abl.py +++ b/examples/acoustics_2d_radial/setplot_abl.py @@ -70,11 +70,12 @@ def setplot(plotdata=None): plotitem.add_colorbar = True def plot_original_domain(current_data): - from matplotlib.pyplot import gca + from matplotlib.pyplot import gca, text ax = gca() x = [x1,x2,x2,x1,x1] y = [y1,y1,y2,y2,y1] ax.plot(x, y, '--k') + text(-0.6,1.05,'Absorbing Boundary Layer') plotaxes.afteraxes = plot_original_domain From 87f7745be277574b9a1270f293b9eeeefad1ad34 Mon Sep 17 00:00:00 2001 From: Randy LeVeque Date: Tue, 24 Jul 2018 17:53:39 -0700 Subject: [PATCH 3/4] modify legend for scatter plot --- examples/acoustics_2d_radial/setplot_abl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/acoustics_2d_radial/setplot_abl.py b/examples/acoustics_2d_radial/setplot_abl.py index 8aeb65c..18ceea0 100644 --- a/examples/acoustics_2d_radial/setplot_abl.py +++ b/examples/acoustics_2d_radial/setplot_abl.py @@ -126,7 +126,7 @@ def p_vs_r(current_data): def make_legend(current_data): import matplotlib.pyplot as plt - plt.legend(('2d data', '1d reference solution')) + plt.legend(('2d data (interior only)', '1d reference solution')) plotaxes.afteraxes = make_legend From 74df71c25a8dd68537e1fafa3e6fd9baf7f04be3 Mon Sep 17 00:00:00 2001 From: Randy LeVeque Date: Tue, 24 Jul 2018 17:58:19 -0700 Subject: [PATCH 4/4] started adding info on ABL to README --- examples/acoustics_2d_radial/README.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/examples/acoustics_2d_radial/README.rst b/examples/acoustics_2d_radial/README.rst index ff8878a..c5cc8b2 100644 --- a/examples/acoustics_2d_radial/README.rst +++ b/examples/acoustics_2d_radial/README.rst @@ -10,3 +10,21 @@ compute the "true solution" and then setplot.py contains code to produce a scatter plot of the computed 2d pressure vs. distance from origin and compare with the 1d solution. +Extrapolation BCs +------------------ + +The code is set up to use extrapolation boundary conditions at all +boundaries. This does a reasonably good job of providing non-reflecting +boundaries, but there are some artifacts visible at later times. + +Absorbing boundary layer +------------------------ + +New cababilities have been added to Clawpack 5.5.0 to allow extending the +computational domain with an aborbing boundary layer that does a better job +of eliminating artificial reflections. [Add more discussion.] + +To try this version:: + + make all -f Makefile_abl +