-
Notifications
You must be signed in to change notification settings - Fork 7
/
amr_strategy.html
309 lines (297 loc) · 16 KB
/
amr_strategy.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>AMR refinement strategy — Clawpack 5.0.0rc-alpha documentation</title>
<link rel="stylesheet" href="_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/base.css" type="text/css" />
<link rel="stylesheet" href="_static/layout.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '5.0.0rc-alpha',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="shortcut icon" href="_static/clawicon.ico"/>
<link rel="author" title="About these documents" href="about.html" />
<link rel="top" title="Clawpack 5.0.0rc-alpha documentation" href="index.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>
<nav>
<ul>
<li>
<a href="toc_condensed.html">Docs</a>
</li>
<li>
<a href="installing.html">Install</a>
</li>
<li>
<a class="" href="galleries.html">Gallery</a>
</li>
<li>
<a class="active" href="https://groups.google.com/forum/#!forum/claw-users">Support</a>
</li>
<li>
<a class="active" href="http://github.com/organizations/clawpack">Source</a>
</li>
<li>
<a class="" href="developers.html">Develop</a>
</li>
</ul>
</nav>
</section>
<div class="decoration"></div>
</div>
<div class="related">
<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><a href="contents.html">Clawpack 5.0.0rc-alpha documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="amr-refinement-strategy">
<span id="amr-strategy"></span><h1>AMR refinement strategy<a class="headerlink" href="#amr-refinement-strategy" title="Permalink to this headline">¶</a></h1>
<p>The basic adaptive refinment strategy used in <a class="reference internal" href="amrclaw.html#amrclaw"><em>AMRClaw Software</em></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"><em>Specifying AMRClaw run-time parameters in setrun.py</em></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 <em class="xref std std-ref">cfl</em>), 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 class="first">In each time step on the Level 1 grid(s), the values in all grid cells
(including those covered by finer grids) is 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 <em>$CLAW/amrclaw/Nd/lib/bcNamr.f</em> (where <em>N</em> is the number of
space dimensions).</p>
</li>
<li><p class="first">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"><em>Ghost cells and boundary conditions for AMR</em></a>.</p>
</li>
<li><p class="first">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 class="first">The updating just described can lead to a change in the total mass
calculated on the Level 1 grid. In order to restore global conseravtion,
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-Colella-Oliger</em> adaptive
refinement, after the papers of Berger and Oliger <a class="reference internal" href="biblio.html#bergeroliger84">[BergerOliger84]</a> and
<a class="reference internal" href="biblio.html#bergercolella89">[BergerColella89]</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">[BergerLeVeque98]</a>.</p>
<div class="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 headline">¶</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>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.</li>
<li>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.</li>
<li>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>$CLAW/amrclaw/Nd/lib/bcNamr.f</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.</li>
</ul>
</div></blockquote>
<p>For many standard boundary conditions it is not necessary for the user to do
anything beyond setting the <em>mthbc</em> parameters in <em>setrun.py</em> (see
<a class="reference internal" href="setrun.html#setrun"><em>Specifying classic run-time parameters in setrun.py</em></a>). Only if some element of <em>mthbc</em> is 0 (indicating
user-specified boundary conditions) 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/clawpack/Nd/lib/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>
</div>
<div class="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 headline">¶</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>Flagging cells that need refinement according to some criteria.</li>
<li>Clustering the flagged cells into rectangular patches that will form the
new set of grids at the next higher level.</li>
<li>Creating the new grids and initializing the values of <em>q</em> and also any
<em>aux</em> arrays for each new grid.</li>
</ol>
</div></blockquote>
<p>Clustering is done using and algorithm developed by Berger and Rigoutsis
<a class="reference internal" href="biblio.html#bergerrigoutsis91">[BergerRigoutsis91]</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>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.</li>
<li>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.</li>
</ul>
</div></blockquote>
<p>A parameter <em>cutoff</em> can be specified (see <a class="reference internal" href="setrun_amrclaw.html#setrun-amrclaw"><em>Specifying AMRClaw run-time parameters in setrun.py</em></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>At points where there was already a Level k+1 grid present, this value is
copied over.</li>
<li>At points where there was not previously a Level k+1 grid, bilinear
interpolation is performed based on the Level k grids (if the exist at
this point, if not even coarser grids are used – <strong>True?</strong>).</li>
</ul>
</div></blockquote>
</div>
<div class="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 headline">¶</a></h2>
<p>The user can control the criteria used for flagging cells for refinement.</p>
<p>The default procedure is to ... (explain <em>tolsp</em> parameter).</p>
<p>To be continued... describe library routines <em>allowflag.f</em> and
<em>flag2refine.f</em> and how to modify them. (But first these should be cleaned
up and regions added to AMRClaw versions!)</p>
</div>
<div class="section" id="specifying-amr-regions">
<span id="regions"></span><h2>Specifying AMR regions<a class="headerlink" href="#specifying-amr-regions" title="Permalink to this headline">¶</a></h2>
<p>In addition to specifying a tolerance or other criteria for flagging
individual cells as described above, it is possible to specify regions of
the domain so that all points in the region, over some
time interval also specified, will be refined to at least some level
<em>minlevel</em> and at most some level <em>maxlevel</em>.</p>
<p><strong>Note:</strong> This is currently available only in <a class="reference internal" href="geoclaw.html#geoclaw"><em>GeoClaw</em></a> but should be
carried over to AMRClaw.</p>
<p>This can be automatically specified via parameters set in <em>setrun.py</em> (see
<a class="reference internal" href="setrun_geoclaw.html#setrun-regions"><em>AMR refinement region parameters</em></a>).</p>
<p>To determine whether a grid cell lies in one of the regions specified, the
center of the grid cell is used. If a mapped grid is being used, the limits
for the regions should be in terms of the computational grid coordinates,
not the physical coordinates.</p>
<p>If a cell center lies in more than one specified region, then the
cell will definitely be flagged for refinement at level k (meaning it should
be covered by a Level k+1 grid) if <em>k+1 <= minlevel</em> for any of the regions,
regardless of whether the general flagging criteria hold or not.
This means the smallest of the various <em>minlevel</em> parameters for any region
covering this point will take effect. Conversely it will definitely <strong>not</strong>
be flagged for refinement if <em>k+1 > maxlevel</em> for <strong>all</strong> regions that cover
this point. This means the largest of the various <em>maxlevel</em> parameters for
any region covering this point will take effect.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="contents.html">
<img class="logo" src="_static/clawlogo.jpg" alt="Logo"/>
</a></p>
<h3><a href="contents.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">AMR refinement strategy</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="#specifying-amr-regions">Specifying AMR regions</a></li>
</ul>
</li>
</ul>
<h3>Related Topics</h3>
<ul>
<li><a href="contents.html">Documentation overview</a><ul>
</ul></li>
</ul>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/amr_strategy.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
© Copyright 2013, The Clawpack Development Team.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
</html>