wiki:ControllingRefinement

Version 20 (modified by ehansen, 13 years ago) ( diff )

Controlling Refinement in AstroBEAR 2.0

Overview

Refinement is triggered by various sections of code evaluating various refinement criteria described below. To mark cell i,j,k for refinement, each routine sets Info%ErrFlag(i,j,k)=1. If a cell is marked for refinement by more then one routine there is no problem since it will still be refined. Setting Info%ErrFlag(i,j,k)=0 however, is generally not a good idea since another flagging routine may have previously marked the cell for refinement with good reason.

After all of the cells in a given parent info have been potentially marked for refinement, the subroutine NewSubGrids in data_info_ops.f90 groups the flagged cells into rectangular patches so that every cell is within a patch and that no patch has a filling ratio less then the DesiredFillRatio for that level set in global.data. Having a DesiredFillRatio of 1.0 will effectively limit refinement to only cells marked for refinement however the MinimumGridSize also set in global.data may limit the actual desired fill ratios. Having many small grids is generally not as efficient as having a few larger grids even if they comprise more cells and so a desired fill ratio of 1.0 does not usually give the best performance. Values of .7 to .9 are recommended for optimal performance.

Fill Ratio = .7 Fill Ratio = .9 Fill Ratio = 1.0

Additionally one can increase the minimum grid size to reduce the prevalence of long slender grids. Below we increased the minimum refined patch to be 4 parent cells. (This results in actual child grids that are at least 8x8)

After the new patches are determined, the distribution algorithm may split these patches to accommodate load balancing. For example running on 3 processors we get

Fill Ratio = .7 Fill Ratio = .9 Fill Ratio = 1.0

Field Gradient Refinement

AstroBEAR 2.0 comes with the ability to refine on field gradients. For each fluid variable, AstroBEAR checks if…

and marks cell i+1 and cell i for refinement. This is essentially . The is for the current grid resolution and results in coarser levels being more sensitive to fluid gradients for a given tolerance. The values of tol is found by multiplying the qTolerance for the level with the refineVariableFactor for the fluid variable and MinScale is dependent on which field you are considering.

Changing qTolerance and DesiredFillRatios

The most direct and quickest way to change refinement is to change the qTolerance and DesiredFillRatios arrays which are both located in the global.data file. Each element of these arrays is specific to that level. For example, the first element is for the root level, the next element is for the 1st level of refinement, and so on. qTolerance effectively sets how large a gradient must be in order for those two cells to be refined. Higher qTolerance —> less refinement. DesiredFillRatios affects the way astrobear lays down grids or patches for refinement. For example, if the DesiredFillRatio is 0.7, then the AMR will lay down patches so that at least 70% of each patch contains cells marked for refinement. As a result of this process, you will often get cells being refined which were not initially marked for refinement. In general, lower DesiredFillRatios —> more refinement. Note that changing these arrays is very problem specific.

Below are snapshots of the mesh for a simulation of the Rayleigh-Taylor Instability. You are looking at the peak of the interface at t = 4.0 with 2 levels of AMR. In the first snapshot there is improper nesting. More refinement at the root level and/or less at the 1st level would fix this.

qTolerance = (0.2, 0.2) DesiredFillRatios = (0.7, 0.7) qTolerance = (0.01, 0.3) DesiredFillRatios = (0.7, 0.7)

Jeans Criteria

When Self Gravity is turned on, refinement is flagged based on the Jeans criterion

ProblemSetErrFlag

Users can manually set error flags based on any other criteria (position, etc…) in their problem module

Particles

Sink Particles have a buffer array that triggers refinement within a certain distance of a particle.

Visualizing Error Flags

You can plot the value of Info%ErrFlag by turning on lOutputErrFlag in process.data

Attachments (13)

Note: See TracWiki for help on using the wiki.