Skip to content

Commit ce0448f

Browse files
authored
Merge pull request #1 from rjleveque/absorbing_layer
Absorbing layer updates
2 parents 32681eb + 74df71c commit ce0448f

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

examples/acoustics_2d_radial/README.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,21 @@ compute the "true solution" and then setplot.py contains code to produce a
1010
scatter plot of the computed 2d pressure vs. distance from origin and compare
1111
with the 1d solution.
1212

13+
Extrapolation BCs
14+
------------------
15+
16+
The code is set up to use extrapolation boundary conditions at all
17+
boundaries. This does a reasonably good job of providing non-reflecting
18+
boundaries, but there are some artifacts visible at later times.
19+
20+
Absorbing boundary layer
21+
------------------------
22+
23+
New cababilities have been added to Clawpack 5.5.0 to allow extending the
24+
computational domain with an aborbing boundary layer that does a better job
25+
of eliminating artificial reflections. [Add more discussion.]
26+
27+
To try this version::
28+
29+
make all -f Makefile_abl
30+

examples/acoustics_2d_radial/setplot_abl.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ def setplot(plotdata=None):
4141
abldata.read(plotdata.outdir + '/abl.data', force=True)
4242
clawdata = ClawData()
4343
clawdata.read(plotdata.outdir + '/claw.data', force=True)
44-
clawdata.lower[0] += abldata.depth_lower[0]
45-
clawdata.upper[0] -= abldata.depth_upper[0]
46-
clawdata.lower[1] += abldata.depth_lower[1]
47-
clawdata.upper[1] -= abldata.depth_upper[1]
44+
x1 = clawdata.lower[0] + abldata.depth_lower[0]
45+
x2 = clawdata.upper[0] - abldata.depth_upper[0]
46+
y1 = clawdata.lower[1] + abldata.depth_lower[1]
47+
y2 = clawdata.upper[1] - abldata.depth_upper[1]
4848

4949
plotdata.clearfigures() # clear any old figures,axes,items data
5050

@@ -70,13 +70,12 @@ def setplot(plotdata=None):
7070
plotitem.add_colorbar = True
7171

7272
def plot_original_domain(current_data):
73-
from matplotlib.pyplot import gca
73+
from matplotlib.pyplot import gca, text
7474
ax = gca()
75-
x = [clawdata.lower[0], clawdata.upper[0], clawdata.upper[0], \
76-
clawdata.lower[0], clawdata.lower[0]]
77-
y = [clawdata.lower[1], clawdata.lower[1], clawdata.upper[1], \
78-
clawdata.upper[1], clawdata.lower[1]]
75+
x = [x1,x2,x2,x1,x1]
76+
y = [y1,y1,y2,y2,y1]
7977
ax.plot(x, y, '--k')
78+
text(-0.6,1.05,'Absorbing Boundary Layer')
8079

8180
plotaxes.afteraxes = plot_original_domain
8281

@@ -102,10 +101,10 @@ def p_vs_r(current_data):
102101
x = current_data.x
103102
y = current_data.y
104103
r = sqrt(x**2 + y**2)
105-
r = masked_where(x < clawdata.lower[0], r)
106-
r = masked_where(x > clawdata.upper[0], r)
107-
r = masked_where(y < clawdata.lower[1], r)
108-
r = masked_where(y > clawdata.upper[1], r)
104+
r = masked_where(x < x1, r)
105+
r = masked_where(x > x2, r)
106+
r = masked_where(y < y1, r)
107+
r = masked_where(y > y2, r)
109108
q = current_data.q
110109
p = MaskedArray(q[0,:,:], mask=r.mask)
111110
return r,p
@@ -127,7 +126,7 @@ def p_vs_r(current_data):
127126

128127
def make_legend(current_data):
129128
import matplotlib.pyplot as plt
130-
plt.legend(('2d data', '1d reference solution'))
129+
plt.legend(('2d data (interior only)', '1d reference solution'))
131130

132131
plotaxes.afteraxes = make_legend
133132

0 commit comments

Comments
 (0)