Introduction to Block-Structured Adaptive Mesh Refinement (AMR) Ann - - PowerPoint PPT Presentation

introduction to block structured adaptive mesh refinement
SMART_READER_LITE
LIVE PREVIEW

Introduction to Block-Structured Adaptive Mesh Refinement (AMR) Ann - - PowerPoint PPT Presentation

Introduction to Block-Structured Adaptive Mesh Refinement (AMR) Ann S. Almgren Center for Computational Sciences and Engineering (Building 50A) Lawrence Berkeley National Laboratory asalmgren@lbl.gov Almgren p. 1/25 Types of Refinement


slide-1
SLIDE 1

Introduction to Block-Structured Adaptive Mesh Refinement (AMR)

Ann S. Almgren Center for Computational Sciences and Engineering (Building 50A) Lawrence Berkeley National Laboratory asalmgren@lbl.gov

Almgren – p. 1/25

slide-2
SLIDE 2

Types of Refinement

AMR approaches Unstructured Mesh distortion Point-wise structured refinement Block structured

Almgren – p. 2/25

slide-3
SLIDE 3

Types of Refinement

AMR approaches Unstructured Mesh distortion Point-wise structured refinement Block structured

Almgren – p. 3/25

slide-4
SLIDE 4

Types of Refinement

AMR approaches Unstructured Mesh distortion Point-wise structured refinement Block structured

Almgren – p. 4/25

slide-5
SLIDE 5

Types of Refinement

AMR approaches Unstructured Mesh distortion Point-wise structured refinement Block structured

Almgren – p. 5/25

slide-6
SLIDE 6

Types of Refinement

AMR approaches Unstructured Mesh distortion Point-wise structured refinement Block structured

Almgren – p. 6/25

slide-7
SLIDE 7

Types of Refinement

AMR approaches Unstructured Mesh distortion Point-wise structured refinement Block structured

Almgren – p. 7/25

slide-8
SLIDE 8

Types of Refinement

AMR approaches Unstructured Mesh distortion Point-wise structured refinement Block structured

Almgren – p. 8/25

slide-9
SLIDE 9

Types of Refinement

AMR approaches Unstructured Mesh distortion Point-wise structured refinement Block structured

Almgren – p. 9/25

slide-10
SLIDE 10

Types of Refinement

AMR approaches Unstructured Mesh distortion Point-wise structured refinement Block structured

Almgren – p. 10/25

slide-11
SLIDE 11

Types of Refinement

AMR approaches Unstructured Mesh distortion Point-wise structured refinement Block structured

Almgren – p. 11/25

slide-12
SLIDE 12

AMR for Conservation Laws

Consider the 2-D hyperbolic conservation law

Ut + Fx + Gy = 0

where

F = F(U), G = G(U)

Basic discretization: Finite volume approach with cell-centered data Flux-based representation of conservation law Explicit in time update

Un+1 − Un ∆t = Fn+ 1

2

i−1 /

2,j − Fn+ 1 2

i+1 /

2,j

∆x + Gn+ 1

2

i,j−1 /

2 − Gn+ 1 2

i,j+1 /

2

∆y

Numerical fluxes computed from data at tn in neighborhood of edge

Almgren – p. 12/25

slide-13
SLIDE 13

Basic Structured Grid AMR Ideas

Cover regions requiring high resolution with finer grids Use (higher-order upwind) methodology for regular grids to integrate solution Need to know how to generate the grid hierarchy – initially – every time you regrid how to integrate the solution forward in time Integration of data on a patch Synchronization of levels Original references: 2-D: Berger and Colella, JCP 1989 3-D: Bell,Berger,Saltzman and Welcome, JCP 1994

Almgren – p. 13/25

slide-14
SLIDE 14

AMR: To Subcycle or Not To Subcycle?

Should we refine in time as well as space? Yes – subcyle in time (CASTRO, Enzo)

∆tc = r∆tf

Maintain CFL (accuracy of advection scheme) across levels Reduce total number of cells advanced No – don’t subcycle (FLASH, RAGE)

∆tc = ∆tf

Compute time step every fine grid time Simpler synchronization algorithm Simpler software framework

Almgren – p. 14/25

slide-15
SLIDE 15

AMR: Subcycling in Time?

Suppose we have N cells at each level and L levels with factor 2 refinement.To reach time T: With L = 4: Subcycling: must advance

N + 2N + 4N + 8N = 15N cell-steps

No subcycling: must advance

4 · 8N = 32N cell-steps

Type Ia Supernova

With 2 total levels there is a factor of 4/3 more work with no subcycling. With 3 total levels there is a factor of 12/7 more work with no subcycling. With 4 levels ... 32/15 ... With L levels ... ?? (Note that answer changes if N not constant over levels.)

Almgren – p. 15/25

slide-16
SLIDE 16

Building the initial grid hierarchy

Fill data at level 0 Estimate where refinement is needed and buffer Group cells into patches according to a prescribed “grid efficiency” and refine ⇒ B1, ..., Bn (Berger and Rigoustos, 1991) Repeat for next level and adjust for proper nesting

slide-17
SLIDE 17

Building the initial grid hierarchy

Fill data at level 0 Estimate where refinement is needed and buffer Group cells into patches according to a prescribed “grid efficiency” and refine ⇒ B1, ..., Bn (Berger and Rigoustos, 1991) Repeat for next level and adjust for proper nesting

slide-18
SLIDE 18

Building the initial grid hierarchy

Fill data at level 0 Estimate where refinement is needed and buffer Group cells into patches according to a prescribed “grid efficiency” and refine ⇒ B1, ..., Bn (Berger and Rigoustos, 1991) Repeat for next level and adjust for proper nesting

slide-19
SLIDE 19

Building the initial grid hierarchy

Fill data at level 0 Estimate where refinement is needed and buffer Group cells into patches according to a prescribed “grid efficiency” and refine ⇒ B1, ..., Bn (Berger and Rigoustos, 1991) Repeat for next level and adjust for proper nesting

slide-20
SLIDE 20

Building the initial grid hierarchy

Fill data at level 0 Estimate where refinement is needed and buffer Group cells into patches according to a prescribed “grid efficiency” and refine ⇒ B1, ..., Bn (Berger and Rigoustos, 1991) Repeat for next level and adjust for proper nesting

slide-21
SLIDE 21

Building the initial grid hierarchy

Fill data at level 0 Estimate where refinement is needed and buffer Group cells into patches according to a prescribed “grid efficiency” and refine ⇒ B1, ..., Bn (Berger and Rigoustos, 1991) Repeat for next level and adjust for proper nesting Efficiency = 0.5 Efficiency = 0.7 Efficiency = 0.9

Almgren – p. 16/25

slide-22
SLIDE 22

Adaptive integration algorithm

Consider two levels, coarse and fine, with refinement ratio r

∆xf = ∆xc/r , ∆tf = ∆tc/r,

To integrate Advance coarse grids in time tc → tc + ∆tc Advance fine grids in time r times Synchronize coarse and fine data Extend recursively to arbitrary number of refinement levels.

Almgren – p. 17/25

slide-23
SLIDE 23

Adaptive integration algorithm

Consider two levels, coarse and fine, with refinement ratio r

∆xf = ∆xc/r , ∆tf = ∆tc/r,

To integrate Advance coarse grids in time tc → tc + ∆tc Advance fine grids in time r times Synchronize coarse and fine data Extend recursively to arbitrary number of refinement levels.

Level 0

Almgren – p. 17/25

slide-24
SLIDE 24

Adaptive integration algorithm

Consider two levels, coarse and fine, with refinement ratio r

∆xf = ∆xc/r , ∆tf = ∆tc/r,

To integrate Advance coarse grids in time tc → tc + ∆tc Advance fine grids in time r times Synchronize coarse and fine data Extend recursively to arbitrary number of refinement levels.

Level 0 Level 1

Almgren – p. 17/25

slide-25
SLIDE 25

Adaptive integration algorithm

Consider two levels, coarse and fine, with refinement ratio r

∆xf = ∆xc/r , ∆tf = ∆tc/r,

To integrate Advance coarse grids in time tc → tc + ∆tc Advance fine grids in time r times Synchronize coarse and fine data Extend recursively to arbitrary number of refinement levels.

Level 0 Level 1 Level 2

Almgren – p. 17/25

slide-26
SLIDE 26

Adaptive integration algorithm

Consider two levels, coarse and fine, with refinement ratio r

∆xf = ∆xc/r , ∆tf = ∆tc/r,

To integrate Advance coarse grids in time tc → tc + ∆tc Advance fine grids in time r times Synchronize coarse and fine data Extend recursively to arbitrary number of refinement levels.

Level 0 Level 1 Level 2

Almgren – p. 17/25

slide-27
SLIDE 27

Adaptive integration algorithm

Consider two levels, coarse and fine, with refinement ratio r

∆xf = ∆xc/r , ∆tf = ∆tc/r,

To integrate Advance coarse grids in time tc → tc + ∆tc Advance fine grids in time r times Synchronize coarse and fine data Extend recursively to arbitrary number of refinement levels.

Level 0 Level 1 Level 2

sync

Almgren – p. 17/25

slide-28
SLIDE 28

Adaptive integration algorithm

Consider two levels, coarse and fine, with refinement ratio r

∆xf = ∆xc/r , ∆tf = ∆tc/r,

To integrate Advance coarse grids in time tc → tc + ∆tc Advance fine grids in time r times Synchronize coarse and fine data Extend recursively to arbitrary number of refinement levels.

Level 0 Level 1 Level 2

sync

Almgren – p. 17/25

slide-29
SLIDE 29

Adaptive integration algorithm

Consider two levels, coarse and fine, with refinement ratio r

∆xf = ∆xc/r , ∆tf = ∆tc/r,

To integrate Advance coarse grids in time tc → tc + ∆tc Advance fine grids in time r times Synchronize coarse and fine data Extend recursively to arbitrary number of refinement levels.

Level 0 Level 1 Level 2

sync

Almgren – p. 17/25

slide-30
SLIDE 30

Adaptive integration algorithm

Consider two levels, coarse and fine, with refinement ratio r

∆xf = ∆xc/r , ∆tf = ∆tc/r,

To integrate Advance coarse grids in time tc → tc + ∆tc Advance fine grids in time r times Synchronize coarse and fine data Extend recursively to arbitrary number of refinement levels.

Level 0 Level 1 Level 2

sync

Almgren – p. 17/25

slide-31
SLIDE 31

Adaptive integration algorithm

Consider two levels, coarse and fine, with refinement ratio r

∆xf = ∆xc/r , ∆tf = ∆tc/r,

To integrate Advance coarse grids in time tc → tc + ∆tc Advance fine grids in time r times Synchronize coarse and fine data Extend recursively to arbitrary number of refinement levels.

Level 0 Level 1 Level 2

sync sync

Almgren – p. 17/25

slide-32
SLIDE 32

Adaptive integration algorithm

Consider two levels, coarse and fine, with refinement ratio r

∆xf = ∆xc/r , ∆tf = ∆tc/r,

To integrate Advance coarse grids in time tc → tc + ∆tc Advance fine grids in time r times Synchronize coarse and fine data Extend recursively to arbitrary number of refinement levels.

Level 0 Level 1 Level 2

sync sync sync

Almgren – p. 17/25

slide-33
SLIDE 33

Integrating on grid patch

How do you integrate a patch of data at level ? Obtain boundary data needed to call integrator on uniform grid of data. Assume explicit scheme with stencil width sd Enlarge patch by sd cells in each direction and fill with data using – Physical boundary conditions – Other patches at the same level – Coarse grid data (fillpatch) Advance grid in time t → t + ∆t

Fine-Fine Physical BC Coarse-Fine

Almgren – p. 18/25

slide-34
SLIDE 34

FillPatch Operation

To fill fine grid “ghost cells” at t+k∆tf,

k = 0, ..., r−1, using coarse grid data

Define coarse patch needed for interpolation Fill coarse patch at time t and t + ∆tc Time-interpolate data on coarse patch to time t+k∆tf Interpolate coarse data to fine patch

Almgren – p. 19/25

slide-35
SLIDE 35

Synchronization

After coarse grid time step and the subcycled advance of fine data, we have

Uc at tn+1

c

Uf at tn+1

c

However, Uc and Uf are not consistent Coarse data is not necessarily equal to the average of the fine grid data “over” it. Scheme violates conservation because of inconsistent fluxes at coarse-fine interface

slide-36
SLIDE 36

Synchronization

After coarse grid time step and the subcycled advance of fine data, we have

Uc at tn+1

c

Uf at tn+1

c

However, Uc and Uf are not consistent Coarse data is not necessarily equal to the average of the fine grid data “over” it. Scheme violates conservation because of inconsistent fluxes at coarse-fine interface

Almgren – p. 20/25

slide-37
SLIDE 37

Synchronization

After coarse grid time step and the subcycled advance of fine data, we have

Uc at tn+1

c

Uf at tn+1

c

However, Uc and Uf are not consistent Coarse data is not necessarily equal to the average of the fine grid data “over” it. Scheme violates conservation because of inconsistent fluxes at coarse-fine interface

Almgren – p. 20/25

slide-38
SLIDE 38

Synchronization

After coarse grid time step and the subcycled advance of fine data, we have

Uc at tn+1

c

Uf at tn+1

c

However, Uc and Uf are not consistent Coarse data is not necessarily equal to the average of the fine grid data “over” it. Scheme violates conservation because of inconsistent fluxes at coarse-fine interface

Almgren – p. 20/25

slide-39
SLIDE 39

Synchronization

After coarse grid time step and the subcycled advance of fine data, we have

Uc at tn+1

c

Uf at tn+1

c

However, Uc and Uf are not consistent Coarse data is not necessarily equal to the average of the fine grid data “over” it. Scheme violates conservation because of inconsistent fluxes at coarse-fine interface

Almgren – p. 20/25

slide-40
SLIDE 40

Synchronization

After coarse grid time step and the subcycled advance of fine data, we have

Uc at tn+1

c

Uf at tn+1

c

However, Uc and Uf are not consistent Coarse data is not necessarily equal to the average of the fine grid data “over” it. Scheme violates conservation because of inconsistent fluxes at coarse-fine interface

Almgren – p. 20/25

slide-41
SLIDE 41

Synchronization (p2)

How do we address these problems with the solution? Average down the fine grid data onto all underlying coarse cells

Uc = 1 rd

  • Uf

Reflux at coarse-fine interfaces

∆xc∆ycUc = ∆xc∆ycUc − ∆tcAcFc +

  • ∆tfAfFf

Almgren – p. 21/25

slide-42
SLIDE 42

Regridding

Compute “error” at each cell : if “too big” then flag cell for refinement Richardson extrapolation Coarsen data on a patch at tn−1 and advance by 2∆t Advance data at tn by ∆t and coarsen Difference of these two solutions is proportional to error Functions of solution (e.g., vorticity) Geometric considerations Compute refined patches as initially Fill newly refined regions using conservative interpolation from coarse grid

Almgren – p. 22/25

slide-43
SLIDE 43

Regridding

Compute “error” at each cell : if “too big” then flag cell for refinement Richardson extrapolation Coarsen data on a patch at tn−1 and advance by 2∆t Advance data at tn by ∆t and coarsen Difference of these two solutions is proportional to error Functions of solution (e.g., vorticity) Geometric considerations Compute refined patches as initially Fill newly refined regions using conservative interpolation from coarse grid

Almgren – p. 22/25

slide-44
SLIDE 44

Regridding

Compute “error” at each cell : if “too big” then flag cell for refinement Richardson extrapolation Coarsen data on a patch at tn−1 and advance by 2∆t Advance data at tn by ∆t and coarsen Difference of these two solutions is proportional to error Functions of solution (e.g., vorticity) Geometric considerations Compute refined patches as initially Fill newly refined regions using conservative interpolation from coarse grid

Almgren – p. 22/25

slide-45
SLIDE 45

Regridding

Compute “error” at each cell : if “too big” then flag cell for refinement Richardson extrapolation Coarsen data on a patch at tn−1 and advance by 2∆t Advance data at tn by ∆t and coarsen Difference of these two solutions is proportional to error Functions of solution (e.g., vorticity) Geometric considerations Compute refined patches as initially Fill newly refined regions using conservative interpolation from coarse grid

Almgren – p. 22/25

slide-46
SLIDE 46

Regridding

Compute “error” at each cell : if “too big” then flag cell for refinement Richardson extrapolation Coarsen data on a patch at tn−1 and advance by 2∆t Advance data at tn by ∆t and coarsen Difference of these two solutions is proportional to error Functions of solution (e.g., vorticity) Geometric considerations Compute refined patches as initially Fill newly refined regions using conservative interpolation from coarse grid

Almgren – p. 22/25

slide-47
SLIDE 47

Summary of Algorithm

Hyperbolic AMR

For n = 1, ..., Nfinal Advance(0,tn

0 )

Advance (,t) If (time to regrid) then Regrid() FillPatch(,t) Integrate(,t,∆t) If (<finest) then For isub = 1, ..., r Advance(+1, t+(isub−1)∆t

+ 1)

Average down(,t+∆t) Reflux(,t+∆t) End If Regrid(): generate new grids at levels +1 and higher FillPatch(,t): fill patch of data at level and time t Integrate(,t,∆t): Advance data at level from t to t+∆t, averaging and storing fluxes at

boundaries of level grids if > 0 and level cells at boundary of + 1

Average down(,t): average (in space) level +1 data at time t to level Reflux(,t): Add (time- and space-averaged) refluxing corrections to

level cells at time t adjacent to level +1 grids

Almgren – p. 23/25

slide-48
SLIDE 48

Review of Data Operations

Single-level operations Fill a patch with data from same-level grids Fill data using physical boundary conditions Interpolate data in time Add corrections from stored fluxes at same resolution Integrate patch of data in time Find union of rectangles that contain a set of tagged points Multi-level operations Map regions between different levels of refinement Interpolate : coarse → fine Average : fine → coarse Store fluxes from fine grid boundaries at coarse resolution

Almgren – p. 24/25

slide-49
SLIDE 49

Parallel Issues for AMR

Issues are primarily Data distribution – obvious idea is distributing grids to processors – Gridding strategy depends on approach to parallelization Pure MPI Hybrid: MPI + OpenMP – Size of grids depends on memory usage, parallelization strategy and additional physics (e.g. Poisson solve for self-gravity) Dynamic load balancing – Need good work estimate – Data locality Parallel in space, serial in time ... We will talk more about these next week

Almgren – p. 25/25