Changes between Version 29 and Version 30 of ControllingRefinement
- Timestamp:
- 07/23/12 12:41:20 (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ControllingRefinement
v29 v30 2 2 = Controlling Refinement in AstroBEAR 2.0 = 3 3 == Overview == 4 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.5 4 6 After all of the cells in a given parent info have been potentially marked for refinement, the subroutine NewSubGrids in [source:'Scrambler (Development)/data/data_info_ops.f90' 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 [GlobalDataExplained global.data]. Having a !DesiredFillRatio of 1.0 will effectively limit refinement to only cells marked for refinement however the !MinimumGridSize also set in [GlobalDataExplained 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. 5 Refinement of grids is controlled by RefinementObjects or by setting {{{Info%ErrFlag(i,j,k)=1}}} in the Problem modules subroutine {{{ProblemSetErrFlag(Info)}}}. 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. 7 6 8 || Fill Ratio = .7 || Fill Ratio = .9 || Fill Ratio = 1.0 || 9 || [[Image(ErrFlag1_7.png, width=513)]] || [[Image(ErrFlag1_9.png, width=513)]] || [[Image(ErrFlag1_10.png, width=513)]] || 7 After all of the cells in a given parent info have been potentially marked for refinement, the subroutine NewSubGrids in [source:'Scrambler (Development)/data/data_info_ops.f90' data_info_ops.f90] groups the flagged cells into rectangular patches so that every cell is within a patch. 10 8 11 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) 9 * The previous version of the code (which is also used if lUseOriginalNewSubGrids = .true. in global.data) then split and shrunk grids so that no patch had a filling ratio less then the !DesiredFillRatio for that level set in [GlobalDataExplained global.data]. Having a !DesiredFillRatio of 1.0 will effectively limit refinement to only cells marked for refinement however the !MinimumGridSize also set in [GlobalDataExplained 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. 12 10 13 || [[Image(ErrFlag1_10_4.png, width=513)]] 11 || Fill Ratio = .7 || Fill Ratio = .9 || Fill Ratio = 1.0 || 12 || [[Image(ErrFlag1_7.png, width=513)]] || [[Image(ErrFlag1_9.png, width=513)]] || [[Image(ErrFlag1_10.png, width=513)]] || 13 14 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) 15 16 || [[Image(ErrFlag1_10_4.png, width=513)]] 17 18 19 * The newer default version (lUseOriginalNewSubGrids = .false.) uses an improved algorithm that takes into consideration the additional cost of smaller grids. It splits and shrinks but stops when doing so will create more overall work. The !DesiredFillRatio and !MinimumGridSize are ignored. 20 21 14 22 15 23 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 … … 76 84 77 85 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 == Field Gradient Refinement ==113 AstroBEAR 2.0 comes with the ability to refine on field gradients. For each fluid variable, AstroBEAR checks if...114 115 [[latex($\frac{|q_{i+1}-q_{i}|}{\max \left({\frac{|q_{i+1}|+|q_{i}|}{2},\mbox{MinScale}} \right)} > \mbox{tol}$)]]116 117 and marks cell {{{i+1}}} and cell {{{i}}} for refinement. This is essentially [[latex($\Delta x \left | \frac{\partial log(|q|)}{\partial x} \right |$)]]. The [[latex($\Delta x$)]] 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. !MinScale is dependent on which field you are considering and is given in the following table:118 || Field || !MinScale ||119 || rho || 0.0 ||120 || Pressure || 0.0 ||121 || Tracer fields || [[latex($\rho$)]] ||122 || Bx, By, Bz || [[latex($\sqrt{\rho}c_s$)]]123 || Px, Py, Pz || [[latex($\rho c_s$)]]124 125 Note that strong adiabatic shocks will typically be resolved by a few [[latex($n$)]] cells depending on the method (PPM, PLM, etc...) and will be refined for density when [[latex($\mbox{tol} < \frac{(4-1)/n}{\frac{4+1}{2}} = \frac{3}{2.5n}= \frac{1.2}{n}$)]]. For PPM or PLM this requires tolerances < .3 or so to resolve grid aligned adiabatic shocks based on density gradients. To resolve non-grid aligned shocks tolerances closer to .1 should be used. ALso note that the pressure jumps will typically be much larger (of order [[latex($M^2$)]]) so pressure gradients will trigger refinement when [[latex($M > \sqrt{n\mbox{tol}}$)]].126 127 Also note that the momentum refinement is not Galilean invariant. But then again, neither is the numerical diffusion...128 129 130 86 === Changing qTolerance and !DesiredFillRatios === 131 87 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.