Docsity

Adaptive Mesh Refinement: A Technique for Efficiently Simulating Complex Systems, Study notes of Astronomy

Toggle sidebar
bg1
Adaptive mesh overview
Ideally we would cover the Universe with a uniform mesh:
●Numerical diffusivity/resistivity constant
●Properties mathematically simple
●Easy to parallelize (domain decomposition)
But this would be a colossal waste of resources!
For explicit hydro schemes in 3D,
Storage ∝ N3
Cost ∝ N4
If we wanted to resolve interstellar distances in
a cosmological volume, we would need
We would need 1028 bytes per variable... a computer requiring 1 ns to update each
zone would take 3×1029 yr for one timestep! And most of it would be voids...
L~1 Gpc
~1 pc
}
⇒N~109
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14

Partial preview of the text

Download Adaptive Mesh Refinement: A Technique for Efficiently Simulating Complex Systems and more Study notes Astronomy in PDF only on Docsity!

Adaptive mesh overview

Ideally we would cover the Universe with a uniform mesh: ● (^) Numerical diffusivity/resistivity constant ● (^) Properties mathematically simple ● (^) Easy to parallelize (domain decomposition) But this would be a colossal waste of resources! For explicit hydro schemes in 3D, Storage ∝ N 3 Cost ∝ N 4 If we wanted to resolve interstellar distances in a cosmological volume, we would need We would need 10 28 bytes per variable... a computer requiring 1 ns to update each zone would take 3× 10 29 yr for one timestep! And most of it would be voids...

L~ 1 Gpc

~ 1 pc }

⇒ N ~ 10

9

Adaptive mesh overview – 2

Clearly we need a way to concentrate resources where interesting things are happening. We need – ● (^) More sophisticated bookkeeping ● (^) Operators to transfer information between grids ● (^) A way to determine where to concentrate resources

Nonuniform meshes

Use when region to be refined is known and static Advantages: ● (^) Simple to implement – no extra bookkeeping Disadvantages: ● (^) Must derive difference expressions for nonconstant zone spacing ● (^) Still somewhat wasteful (grid stretches in regions of no interest) ● (^) Must limit change in zone spacing to at most 5 10% Example: COSMOS (Ricker et al. 2000)

Lagrangian meshes

Mesh is tied to the fluid – stretches when it expands, squeezes when it contracts Advantages: ● (^) Constant mass resolution ● (^) Sharp resolution of contacts Disadvantages: ● (^) Grid stretching causes numerical dissipation to be very different in one direction than in others ● (^) Grid tangling in 2/3D rotational flows Usually used only in 1D (e.g., 1D stellar evolution codes)

Arbitrary Lagrangian Eulerian (ALE)

Mesh is allowed to move arbitrarily with respect to fluid – can be Lagrangian where flow is irrotational and Eulerian where mesh distortion would be a problem Application to stellar evolution: DJEHUTY code (D. Dearborn et al., LLNL)

Nested grids

Static meshes with different resolutions – usually best when region to be refined doesn't move Meshes evolve independently; fine grids take boundary conditions by interpolation from coarser grids Sometimes interaction is one way, ie. coarse  fine, but not fine  coarse This is only justifiable if no matter escapes from fine grid region (and, preferably, inflow is supersonic)

Adaptive mesh refinement – 2

 Each block contains n d zones in d dimensions  Blocks stored in 2 d tree data structure  (^) Factor of 2 refinement per level  (^) Blocks assigned indices via space filling curve 1 3 4 5 2 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 10 (^611) 12 18 Refinement Level 5 1 3 4 15 16 17 13 20 14 19 8 9 2 7 21

PARAMESH (MacNeice et al. 2000)

Adaptive mesh refinement – 3

When implementing AMR on a parallel computer, commonly one uses a space filling curve to assign a 1D ordering to the 2D/3D blocks on different levels of refinement Once blocks are ordered, the list can be divided up evenly among processors: Blocks can also be weighted by the work needed to update them Space filling curves tend to preserve locality – nearby blocks tend to have adjacent indices Example: Morton curve used by FLASH (Fryxell et al. 2000) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2021 22 23 24 25 26 27 28 29 30 (^31 ) 33 34 35 (^36 ) 1 – 9 10 – 18 19 – 27 28 – 37 Proc 0 Proc 1 (^) Proc 2 Proc 3

Intermission

Initializing AMR calculations (non cosmological)

Different from initializing a uniform mesh: ● (^) Multiple blocks or patches of zones ● (^) Don't know block structure in advance (depends on solution!) Initialization is done one block/patch at a time.

  1. We start by initializing the coarsest block.
  2. Decide where to refine; create new blocks.
  3. Redistribute blocks among processors if necessary.
  4. Initialize solution on the new blocks (rather than interpolating from coarse blocks as during the run).
  5. Go to 2; if no new blocks required, we are done. Be careful – desired features may not be resolvable on the coarsest mesh, so expected refinements might not occur. ● (^) Use subzone averaging to make coarse zones reflect correct zone averages ● (^) Force refinement in regions where initial conditions contain fine features - • - • Zone center values on coarse mesh do not fall within disk – so coarse mesh looks uniform and isn't refined Zone averages catch part of disk and lead to further refinement

Level i

Level i+

i

= R

i i+

i+

g

i

= D

i

i

i+

= P

i i+

i

g

i+

= D

i+

i+

Copy

Adaptive mesh refinement – 6

3. Update mesh refinement. a) For each block, compute a figure of merit that will determine whether the block should be refined or derefined (“refinement marking”) b) For each block: i) If it is to be refined, create child blocks and set their solution information by interpolating from the parent ii) If it is to be derefined, restrict solution information to its parent block, then free up the memory allocated to the block to be derefined c) Compute block indices using space filling curve d) Redistribute blocks by communication among processors so that all processors have about the same amount of work to do during the next step

Adaptive mesh refinement – 7

Magnitude of density Used to capture peaks in gravitational problems. Refine blocks to different levels depending on the ratio of their maximum densities to some reference density. Truncation error estimate Use Richardson extrapolation of solution on coarser grids to estimate mesh spacing required for a given level of error. Physical criteria Keep instabilities resolved by computing local critical wavelengths  crit and asking whether  crit <  x. Example : Truelove et al. (1997) criterion for Jeans unstable fluid:

log 

x

reference density refine at least once if  max in this interval { 2x 3x 4x 5x log  x log   x0.25 J

J ≡c s (^) 

G   1 / 2

14 levels of refinement: 65, 2