-
Notifications
You must be signed in to change notification settings - Fork 7
/
bc.html
316 lines (303 loc) · 16 KB
/
bc.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<title>Boundary conditions — Clawpack 5.11.x documentation</title>
<link rel="stylesheet" href="_static/base.css" type="text/css" />
<link rel="stylesheet" href="_static/layout.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/flasky.css" />
<link rel="stylesheet" type="text/css" href="_static/graphviz.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<link rel="shortcut icon" href="_static/clawicon.ico"/>
<link rel="author" title="About these documents" href="about.html" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Output data sytles and formats" href="output_styles.html" />
<link rel="prev" title="Sample setrun.py module for classic Clawpack" href="setrun_sample.html" />
</head><body>
<div id="main-wrapper" class="sphinx">
<div id="header-wrapper">
<section id="header">
<!-- <h1><a href="http://clawpack.org/">Clawpack</a></h1> -->
<h1><a href="http://clawpack.org/">Clawpack-5</a></h1>
<nav>
<ul>
<li>
<a href="contents.html">Docs</a>
</li>
<li>
<a href="installing.html">Install</a>
</li>
<li>
<a class="" href="http://clawpack.org/gallery/index.html">Gallery</a>
</li>
<li>
<a href="about.html">Citation</a>
</li>
<li>
<a class="active" href="http://github.com/clawpack">GitHub</a>
</li>
<li>
<a class="" href="community.html">Community</a>
</li>
<li>
<a class="" href="developers.html">Contribute</a>
</li>
</ul>
</nav>
</section>
<div class="decoration"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="output_styles.html" title="Output data sytles and formats"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="setrun_sample.html" title="Sample setrun.py module for classic Clawpack"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="contents.html">Clawpack 5.11.x documentation</a> »</li>
<li class="nav-item nav-item-this"><a href="">Boundary conditions</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="boundary-conditions">
<span id="bc"></span><h1>Boundary conditions<a class="headerlink" href="#boundary-conditions" title="Permalink to this heading">¶</a></h1>
<p>Boundary conditions are imposed each time step by filling ghost cells
adjacent to the edge of each grid patch. See Chapter 4 of <a class="reference internal" href="biblio.html#leveque-fvmhp" id="id1"><span>[LeVeque-FVMHP]</span></a>
for more details.</p>
<p>Boundary conditions are set by the library routines:</p>
<ul class="simple">
<li><p><cite>$CLAW/classic/src/Nd/bcN.f</cite> for the classic code (N = 1, 2, 3).</p></li>
<li><p><cite>$CLAW/amrclaw/src/Nd/bcNamr.f</cite> for the amrclaw code (N = 2, 3).</p></li>
</ul>
<p>Several standard choices of boundary condition procedures are provided in
these routines, and can be
selected at each boundary by setting the input parameters <cite>bc_lower</cite> and
<cite>bc_upper</cite> in each dimension (see <a class="reference internal" href="setrun.html#setrun"><span class="std std-ref">Specifying classic run-time parameters in setrun.py</span></a>) to one of the following:</p>
<ul>
<li><p>1 or ‘extrap’ : extrapolation (non-reflecting outflow)</p>
<p>In this case values from the grid cell adjacent to the boundary
are copied into all ghost cells moving in the direction normal to
the boundary. This gives a fairly good approximation to a
non-reflecting or outgoing boundary condition that lets waves pass
out of the boundary without reflection, particularly in one space
dimension. In more than one direction this is not perfect for waves
that hit the boundary at an oblique angle.</p>
</li>
<li><p>2 or ‘periodic’ : periodic boundary conditions</p>
<p>In this case ghost cell values are set by copying from interior
cells at the opposite boundary so that periodic boundary conditions
are perfectly imposed. Normally periodic boundary conditions would
be imposed by setting this value for both <cite>bc_lower</cite> and <cite>bc_upper</cite>
in some dimension, but this is not required.</p>
</li>
<li><p>3 or ‘wall’ : solid wall boundary conditions are imposed
for systems where the second component of <cite>q</cite> is the <cite>x</cite> velocity
or momentum in one dimension (and where the third component
of <cite>q</cite> is also the <cite>y</cite> velocity/momentum in more dimensions,
etc.) This is true, for example, if the acoustics equations
are solved with components <cite>q = (p, u, v)</cite> or shallow water
equations with <cite>q = (h, hu, hv)</cite>.</p>
<p>In this case the normal velocity/momentum at a wall is
reflected about the boundary (copied to a ghost cell from
the cell equally far from the boundary on the interior side)
while all other components are extrapolated.</p>
<p>Reflecting boundary conditions can also often be used on a line of
symmetry of a solution in order to reduce the computational domain
to be only half of the physical domain.</p>
<p>Note that this option does not work on a mapped grid…
<strong>Add pointer to modified version</strong></p>
</li>
</ul>
<p>If none of the above boundary conditions are desired, the user can modify
the subroutine <cite>bcN</cite> so that setting the appropriate component of <cite>bc_lower</cite>
or <cite>bc_upper</cite> to 0 will execute code added by the user. In this case it is
best to put the modified version of <cite>bcN.f</cite> in the application directory and
modify the <cite>Makefile</cite> to point to the modified version.
See <a class="reference internal" href="#bc-user"><span class="std std-ref">User-defined boundary conditions</span></a> below.</p>
<section id="boundary-conditions-for-adaptive-refinement">
<span id="bc-amr"></span><h2>Boundary conditions for adaptive refinement<a class="headerlink" href="#boundary-conditions-for-adaptive-refinement" title="Permalink to this heading">¶</a></h2>
<p>When AMR is used, any interior patch edges (not at a domain boundary) are
filled automatically each time step, either by copying from adjacent
patches at the same level or by interpolating (in both space and
time) from coarser levels if needed.</p>
<p>The user must still specify boundary conditions at the edges of the
computational domain. The same set of choices for standard boundary
conditions as described above are implemented in the library routine
<cite>bcNamr.f</cite>, and so specifying these boundary conditions requires no change
to <cite>setrun.py</cite> when going from Classic Clawpack to AMRClaw. However, if
special boundary conditions have been implemented in a custom version of
<cite>bcN.f</cite> then the same procedure for setting ghost cells will have to be
implemented in a custom version of <cite>bcNamr.f</cite>. This routine is slightly
more complicated than the single-grid Classic version, since one must always
check whether each ghost cell lies outside the computational domain (in
which case the custom boundary condition procedure must be applied) or lies
within the domain (in which case ghost cell values are automatically set by
the AMR code and the user <cite>bcNamr</cite> routine should leave these values
alone.</p>
</section>
<section id="boundary-conditions-for-geoclaw">
<span id="bc-geoclaw"></span><h2>Boundary conditions for GeoClaw<a class="headerlink" href="#boundary-conditions-for-geoclaw" title="Permalink to this heading">¶</a></h2>
<p>For tsunami modeling or other geophysical flows over topography the
computational domain has artificial boundaries that are placed sufficiently
far from the region of interest that any flow or waves leaving the domain
can be ignored and there should be no incoming waves. Extrapolation
boundary conditions are then appropriate. If the ocean is truncated at some
point then these generally have been found to give very small spurious
reflection of outgoing tsunami waves. Extroplation boundary conditions can
also be used on dry land (where the depth <cite>h</cite> is zero).</p>
<p>In some cases reflecting boundary conditions might be more appropriate,
e.g. along the walls of a wave tank.</p>
<p>The library routine <cite>$CLAW/geoclaw/src/2d/shallow/bc2amr.f</cite> is modified from
the <cite>amrclaw</cite> version only by extrapolating the depth at the boundaries
into ghost cells.</p>
</section>
<section id="boundary-conditions-for-clamshell-grids-on-the-sphere">
<span id="bc-sphere"></span><h2>Boundary conditions for clamshell grids on the sphere<a class="headerlink" href="#boundary-conditions-for-clamshell-grids-on-the-sphere" title="Permalink to this heading">¶</a></h2>
<p>In 2D AMRClaw and GeoClaw, an additional option is available for <cite>bc_lower</cite>
and <cite>bc_upper</cite> that is implemented in the library routines:</p>
<ul>
<li><p>4 or ‘sphere’ : sphere boundary conditions</p>
<p>Must set <cite>bc_lower[0:2] = bc_upper[0:2] = 4</cite> (i.e. at all 4 boundaries)</p>
<p>These boundary conditions are similar to periodic boundary conditions,
but for the clamshell grid introduced in <span id="id2">[CalhounHelzelLeVeque]</span>
for solving problems on the sphere using a single logically rectangular
grid. This is best envisioned by folding a rectangular piece of paper
in half, gluing the edges together, and inflating to a sphere. See the
animations on the <a class="reference external" href="?">website for the original paper</a>
See also <span id="id3">[BergerCalhounHelzelLeVeque]</span> for further examples.</p>
</li>
</ul>
</section>
<section id="user-defined-boundary-conditions">
<span id="bc-user"></span><h2>User-defined boundary conditions<a class="headerlink" href="#user-defined-boundary-conditions" title="Permalink to this heading">¶</a></h2>
<p>If none of the boundary conditions described above is suitable at one or
more boundaries of the domain, then you will have to modify the library
routine to implement the desired boundary condition.
See Chapter 4 of <a class="reference internal" href="biblio.html#leveque-fvmhp" id="id4"><span>[LeVeque-FVMHP]</span></a> for hints on how to specify the ghost cell
values each time step.</p>
<p>Suppose you need to specify different boundary conditions at the boundary
<cite>xlower</cite>, for example. Then in <cite>setrun.py</cite> you should set
<cite>bc_lower[0] = 0</cite> and modify the library boundary condition routine to
insert your desired boundary conditions at the point indicated in the code,
where it says:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">c</span> <span class="c1"># user-specified boundary conditions go here in place of error output</span>
</pre></div>
</div>
<p>in the section marked <cite>left boundary</cite>. The details of how this is done
differ a bit between the classic and AMR codes and also depend on the number
of space dimensions. Examine the way other boundary conditions are
implemented and follow the model in your own code.</p>
<p>TODO: Give some hints on how things work in AMR code – must check which ghost
cells extend outside the physical domain and which are filled automatically
from adjacent grid patches or by interpolation from coarser patches if they
are interior to the domain.</p>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p><a href="http://clawpack.org/">
<img class="logo" src= "_static/clawlogo.jpg" alt="Logo"/>
</a>
<h2>Version 5.11.x</h2>
</p>
<div>
<h3><a href="contents.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Boundary conditions</a><ul>
<li><a class="reference internal" href="#boundary-conditions-for-adaptive-refinement">Boundary conditions for adaptive refinement</a></li>
<li><a class="reference internal" href="#boundary-conditions-for-geoclaw">Boundary conditions for GeoClaw</a></li>
<li><a class="reference internal" href="#boundary-conditions-for-clamshell-grids-on-the-sphere">Boundary conditions for clamshell grids on the sphere</a></li>
<li><a class="reference internal" href="#user-defined-boundary-conditions">User-defined boundary conditions</a></li>
</ul>
</li>
</ul>
</div><h3>Related Topics</h3>
<ul>
<li><a href="contents.html">Documentation overview</a><ul>
<li>Previous: <a href="setrun_sample.html" title="previous chapter">Sample <cite>setrun.py</cite> module for classic Clawpack</a></li>
<li>Next: <a href="output_styles.html" title="next chapter">Output data sytles and formats</a></li>
</ul></li>
</ul>
<div class="widget navlinks">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/bc.rst.txt"
rel="nofollow"
target="_blank">Source .rst</a></li>
<li><a href="https://github.com/clawpack/doc/blob/dev/doc/bc.rst"
rel="nofollow"
target="_blank">Source on GitHub</a></li>
<li><a href="https://github.com/clawpack/doc/commits/dev/doc/bc.rst"
rel="nofollow"
target="_blank">History</a></li>
<li><a href="https://github.com/clawpack/doc/edit/dev/doc/bc.rst"
rel="nofollow"
target="_blank">Suggest Edits</a></li>
<li><a href="https://github.com/clawpack/doc/issues/new/choose"
rel="nofollow"
target="_blank">Raise an Issue</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
<h4>Latest Version</h4>
<ul>
<li><a href="./dev/bc.html">dev</a></li>
<li><a href="bc.html">v5.11.x</a></li>
</ul>
<h4>Older Versions</h4>
<ul>
<li><a href="./v5.10.x/bc.html">v5.10.x</a></li>
<li><a href="./v5.7.x/bc.html">v5.7.x</a></li>
<li><a href="./v5.8.x/bc.html">v5.8.x</a></li>
<li><a href="./v5.9.x/bc.html">v5.9.x</a></li>
</ul>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
© Copyright CC-BY 2024, The Clawpack Development Team.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-44811544-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>