260 likes | 474 Views
Adaptive mesh refinement in astrophysical simulations. Dmitry Shapovalov, Johns Hopkins University, March 2004. Outline. Multiscale problems in astrophysics How to treat them? Possible solutions Adaptive mesh refinement How it works? Algorithm Estimates of effectiveness.
E N D
Adaptive mesh refinement in astrophysical simulations Dmitry Shapovalov, Johns Hopkins University, March 2004
Outline • Multiscale problems in astrophysics • How to treat them? Possible solutions • Adaptive mesh refinement • How it works? Algorithm • Estimates of effectiveness
Galaxies on their passage through cluster gas NGC 4522(Kenney & Koopmann, 1999)
2D hydrodynamical simulation TICM = 5x107K nICM = 10-3 cm-3 Mdisk = 1010 M0 Grid - 5122 points, run time ~ 2 days at HLRN IBM p690
Self gravitation and cooling let clumps grow and stabilize (Kenney & Koopman, 1999) ; (Lohmann, 2000)
Structuring of the interface between hot and cool gas due to the heat conduction Grid resolution: 1 pc structures formed by heat conduction are not sufficiently resolved
Wind- and radiation-driven HII region of a heavy star Mstar = 60M nICM = 200cm-3 The stellar wind produces Vishniac instability Ionizing radiation enhances finger-like structures (T.Freyer, 2002)
Increase in resolution • Nonlinear coordinates • Nested grids • Adaptive mesh refinement
Heavier portion of a fluid is on top of a lighter portion (Rayleigh-Taylor instability). 2D compressible gas dynamic simulation (J.Dreher)
Start: coarse grid (level 0); initial conditions on it. Refinement criterion is ok regridding: - marking interesting points, - generating new grids (level 1), - filling them with data. Integrating both levels until the resolution again becomes insufficient. Filling the new grids with data from the previous level and from same resolution grids. Communicating the boundary conditions. Recursive repetition.
The timestep on a given level : procedure integratelevel do singlestep on level (t t+ dt)better boundary on level (from neighboring fine grids) if next level exists, then default boundary on next level (interpolation from prev. level)do r times (r - refinement factor)integratenext level(t t+ dt/r)updateof level(with data from finer grids)checkcriterion on level
Regridding of a given level:procedure regriddinglevel for all gridson level mark critical points and append them to a list cover the critical points with rectangles («saw up») nestingrectangles into their parents and assign parents and neighbors fill the new rectangles with default data if old level of same resolution existed before regridding, then better data on new level from old level if finer level existed before regridding, then regriddingof new level
procedure saw uprectangles for all rectangles calculate and variance in x- and y-direction if variance in x> variance in y, then apply cut dimon rectangle in x-direction else apply cut dimon rectangle in y-direction if no cut found and efficiency insufficient, then half rectangle in longer direction append resulting rectangles to temporary list saw up of temporary list of rectangles if temporary list is not empty, then replace actual rectangle by temporary list
procedure cut dim of rectangle in direction dim determine best cut in direction dim and return two rectangles loop over the two rectangles cut in other direction if costs are smaller than those of actual rectangle, then replace actual rectangle by list compare costs of new list (of 2-4 rectangles) with those of original rectangle and return cheapest
Physics is separated from refinement and data handling - criterion for marking «interesting» points - initial conditions - boundary conditions on level 0 - timestep on a grid of any level
Singular current sheets in incompressible MHD flows2D simulation with AMR (R.Grauer)
Initially 256x256 points, eff. AMR size 4096x4096 points Statistics for the simulation with r = 2 Statistics for the simulation with r = 4
Comparison of different refinement factors - low memory consumption (dynamical allocation of data fields) - only 8% of total time spent for pure AMR subroutines (checking, regridding, boundary and update communications)