-
Notifications
You must be signed in to change notification settings - Fork 7
/
amr_algorithm.html
336 lines (323 loc) · 17.4 KB
/
amr_algorithm.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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<!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>Adaptive mesh refinement (AMR) algorithms — 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="AMR refinement criteria" href="refinement.html" />
<link rel="prev" title="Sample setrun.py module for AMRClaw" href="setrun_amrclaw_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="refinement.html" title="AMR refinement criteria"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="setrun_amrclaw_sample.html" title="Sample setrun.py module for AMRClaw"
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-1"><a href="amrclaw.html" accesskey="U">AMRClaw Description and Detailed Contents</a> »</li>
<li class="nav-item nav-item-this"><a href="">Adaptive mesh refinement (AMR) algorithms</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="adaptive-mesh-refinement-amr-algorithms">
<span id="amr-algorithm"></span><h1>Adaptive mesh refinement (AMR) algorithms<a class="headerlink" href="#adaptive-mesh-refinement-amr-algorithms" title="Permalink to this heading">¶</a></h1>
<p>The basic adaptive refinment strategy used in <a class="reference internal" href="amrclaw.html#amrclaw"><span class="std std-ref">AMRClaw Description and Detailed Contents</span></a> is
to refine on logically rectangular patches. A single Level 1 grid covers
the entire domain (usually — if it is too large it may be split into
multiple Level 1 grids). Some rectangular portions of this grid are covered
by Level 2 grids refined by some refinement factor <em>R</em> in each direction
(anisotropic refinement is now allowed too — see <a class="reference internal" href="setrun_amrclaw.html#setrun-amrclaw"><span class="std std-ref">Specifying AMRClaw run-time parameters in setrun.py</span></a>).
Regions of each Level 2 grid may be covered by Level 3 grids, that are
further refined (perhaps with a different refinement ratio). And so on.</p>
<p>For the hyperbolic solvers in Clawpack the time step is limited by the
Courant number (see Section <span class="xref std std-ref">cfl</span>), and so if the spatial resolution is
refined by a factor of <em>R</em> in each direction then the time step will
generally have to be reduced by a factor <em>R</em> as well.</p>
<p>The AMR code thus proceeds as follows:</p>
<blockquote>
<div><ul>
<li><p>In each time step on the Level 1 grid(s), the values in all grid cells
(including those covered by finer grids) are advanced one time step.
Before this time step is taken, ghost cells around the boundary of the
full computational domain are filled based on the boundary conditions
specified in the library routine <em>bcNamr.f</em> (where <em>N</em> is the number of
space dimensions). Check the <em>Makefile</em> of an application to see where
this file can be found.</p></li>
<li><p>After a step on the Level 1 grid, <em>R</em> time steps must be taken on each
Level 2 grid, where <em>R</em> denotes the desired refinement ratio in
time from Level 1 to Level 2.</p>
<p>For each of these time step, ghost cell
values must be filled in around all boundaries of each Level 2 grid.
This procedure is defined below in <a class="reference internal" href="#amr-bc"><span class="std std-ref">Ghost cells and boundary conditions for AMR</span></a>.</p>
</li>
<li><p>After taking <em>R</em> steps on Level 2 grids, values on the Level 1 grid are
updated to be consistent with the Level 2 grids. Any cell on Level 1
that is covered by a Level 2 grid has its <em>q</em> value replaced by the
average of all the Level 2 grid cells lying within this cell. This gives
a cell average that should be a better approximation to the true cell
average than the original value.</p></li>
<li><p>The updating just described can lead to a change in the total mass
calculated on the Level 1 grid. In order to restore global conservation,
it is necessary to do a conservation fix up. (To be described…)</p></li>
</ul>
</div></blockquote>
<p>This style of AMR is often called <em>Berger-Oliger-Colella</em> adaptive
refinement, after the papers of Berger and Oliger <a class="reference internal" href="biblio.html#bergeroliger84" id="id1"><span>[BergerOliger84]</span></a> and
<a class="reference internal" href="biblio.html#bergercolella89" id="id2"><span>[BergerColella89]</span></a>.</p>
<p>The Fortran code in <a class="reference external" href="claw/amrclaw">$CLAW/amrclaw</a> is based on code
originally written by Marsha Berger for gas dynamics, and merged in Clawpack
in the early days of Clawpack development by MJB and RJL. The algorithms
used in AMRClaw are described more fully in <a class="reference internal" href="biblio.html#bergerleveque98" id="id3"><span>[BergerLeVeque98]</span></a>.</p>
<section id="ghost-cells-and-boundary-conditions-for-amr">
<span id="amr-bc"></span><h2>Ghost cells and boundary conditions for AMR<a class="headerlink" href="#ghost-cells-and-boundary-conditions-for-amr" title="Permalink to this heading">¶</a></h2>
<p>Consider a Level <em>k > 1</em> grid for which we need ghost cells all around the
boundary at the start of each time step on this level. The same procedure
is used at other levels.</p>
<blockquote>
<div><ul class="simple">
<li><p>Some Level k grids will be adjacent to other Level k grids and so any
ghost cell that is equivalent to a Level k cell on some other grid has
values copied from this this grid.</p></li>
<li><p>Some ghost cells will be in the interior of the full computational domain
but in regions where there is no adjacent Level k grid. There will be
a Level k-1 grid covering that region, however. In this case the ghost
cells are obtained by space-time interpolation from values on the Level
k-1 grid.</p></li>
<li><p>Some ghost cells will lie outside the full computational domain, where
the boundary of the Level k grid lies along the boundary of the full
domain. For these cells the subroutine <em>bcNamr</em>
(where <em>N</em> is the number of space dimensions) is used to fill ghost cell
values with the proper user-specified boundary conditions, unless
periodic boundary conditions are specified (see below).</p></li>
</ul>
</div></blockquote>
<p>For many standard boundary conditions it is not necessary for the user to do
anything beyond setting appropriate parameters in <em>setrun.py</em> (see
<a class="reference internal" href="setrun.html#setrun"><span class="std std-ref">Specifying classic run-time parameters in setrun.py</span></a>). Only if user-specified boundary conditions are
specified is it necessary to modify the library
routine <em>bcNamr.f</em> (after copying to your application directory so as not to
damage the library version, and modifying the <em>Makefile</em> to point to the new
version).</p>
<p>There some differences between the <em>bcNamr.f</em> routine and the <em>bcN.f</em>
routine used for the single-grid classic Clawpack routines (which are found in
<em>$CLAW/classic/src/Nd/bcN.f</em>). In particular, it is necessary to check
whether a ghost cell actually lies outside the full computational domain
and only set ghost cell values for those that do. It should be clear how to
do this from the library version of the routine.</p>
<p>If <strong>periodic boundary
conditions</strong> are specified, this is handled by the AMRClaw software along
with all internal boundaries, rather than in <em>bcNamr.f</em>. With AMR it is not
so easy to apply periodic boundary conditions as it is in the case of a
single grid, since it is necessary to determine whether there is a grid at
the same refinement level at the opposite side of the domain to copy ghost
cell values from, and if so which grid and what index corresponds to the
desired location.</p>
</section>
<section id="choosing-and-initializing-finer-grids">
<span id="amr-cluster-fill"></span><h2>Choosing and initializing finer grids<a class="headerlink" href="#choosing-and-initializing-finer-grids" title="Permalink to this heading">¶</a></h2>
<p>Every few time steps on the coarsest level it is generally necessary to
revise modify the regions of refinement at all levels, for example to follow
a propagating shock wave. This is done by</p>
<blockquote>
<div><ol class="arabic simple">
<li><p>Flagging cells that need refinement according to some criteria.</p></li>
<li><p>Clustering the flagged cells into rectangular patches that will form the
new set of grids at the next higher level.</p></li>
<li><p>Creating the new grids and initializing the values of <em>q</em> and also any
<em>aux</em> arrays for each new grid.</p></li>
</ol>
</div></blockquote>
<p>Clustering is done using and algorithm developed by Berger and Rigoutsis
<a class="reference internal" href="biblio.html#bergerrigoutsis91" id="id4"><span>[BergerRigoutsis91]</span></a> that finds a nonoverlapping set of rectangles that
cover all flagged points and balances the following conflicting goals:</p>
<blockquote>
<div><ul class="simple">
<li><p>Cover as few points as possible that are not flagged,
to reduce the number of grid cells that must be advanced in each time
step.</p></li>
<li><p>Create as few new grids as possible, to minimize the overhead associated
with filling ghost cells and doing the conservation fix-up around edges
of grids.</p></li>
</ul>
</div></blockquote>
<p>A parameter <em>cutoff</em> can be specified (see <a class="reference internal" href="setrun_amrclaw.html#setrun-amrclaw"><span class="std std-ref">Specifying AMRClaw run-time parameters in setrun.py</span></a>) to control
clustering. The algorithm will choose the grids in such a way that at least
this fraction of all the grid points in all the new grids will be in cells
that were flagged as needing refinement. Usually <em>cutoff = 0.7</em> is used, so
at least 70% of all grid cells in a computation are in regions where they
are really needed.</p>
<p>Initializing the new grids at Level k+1 is done as follows:</p>
<blockquote>
<div><ul class="simple">
<li><p>At points where there was already a Level k+1 grid present, this value is
copied over.</p></li>
<li><p>At points where there was not previously a Level k+1 grid, bilinear
interpolation is performed based on the Level k grids.</p></li>
</ul>
</div></blockquote>
</section>
<section id="flagging-cells-for-refinement">
<span id="amr-flag"></span><h2>Flagging cells for refinement<a class="headerlink" href="#flagging-cells-for-refinement" title="Permalink to this heading">¶</a></h2>
<p>The user can control the criteria used for flagging cells for refinement.</p>
<p>See <a class="reference internal" href="refinement.html#refinement"><span class="std std-ref">AMR refinement criteria</span></a> for details.</p>
</section>
<section id="for-more-details">
<h2>For more details<a class="headerlink" href="#for-more-details" title="Permalink to this heading">¶</a></h2>
<p>See</p>
<ul class="simple">
<li><p><a class="reference internal" href="amrclaw_doxygen.html#amrclaw-doxygen"><span class="std std-ref">Doxygen documentation of AMRClaw</span></a>.</p></li>
<li><p><a class="reference internal" href="amrclaw_flowcharts.html#amrclaw-flowcharts"><span class="std std-ref">AMRClaw Flowcharts</span></a>.</p></li>
</ul>
</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="#">Adaptive mesh refinement (AMR) algorithms</a><ul>
<li><a class="reference internal" href="#ghost-cells-and-boundary-conditions-for-amr">Ghost cells and boundary conditions for AMR</a></li>
<li><a class="reference internal" href="#choosing-and-initializing-finer-grids">Choosing and initializing finer grids</a></li>
<li><a class="reference internal" href="#flagging-cells-for-refinement">Flagging cells for refinement</a></li>
<li><a class="reference internal" href="#for-more-details">For more details</a></li>
</ul>
</li>
</ul>
</div><h3>Related Topics</h3>
<ul>
<li><a href="contents.html">Documentation overview</a><ul>
<li><a href="amrclaw.html">AMRClaw Description and Detailed Contents</a><ul>
<li>Previous: <a href="setrun_amrclaw_sample.html" title="previous chapter">Sample <cite>setrun.py</cite> module for AMRClaw</a></li>
<li>Next: <a href="refinement.html" title="next chapter">AMR refinement criteria</a></li>
</ul></li>
</ul></li>
</ul>
<div class="widget navlinks">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/amr_algorithm.rst.txt"
rel="nofollow"
target="_blank">Source .rst</a></li>
<li><a href="https://github.com/clawpack/doc/blob/dev/doc/amr_algorithm.rst"
rel="nofollow"
target="_blank">Source on GitHub</a></li>
<li><a href="https://github.com/clawpack/doc/commits/dev/doc/amr_algorithm.rst"
rel="nofollow"
target="_blank">History</a></li>
<li><a href="https://github.com/clawpack/doc/edit/dev/doc/amr_algorithm.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/amr_algorithm.html">dev</a></li>
<li><a href="amr_algorithm.html">v5.11.x</a></li>
</ul>
<h4>Older Versions</h4>
<ul>
<li><a href="./v5.10.x/amr_algorithm.html">v5.10.x</a></li>
<li><a href="./v5.7.x/amr_algorithm.html">v5.7.x</a></li>
<li><a href="./v5.8.x/amr_algorithm.html">v5.8.x</a></li>
<li><a href="./v5.9.x/amr_algorithm.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>