Reference documentation for deal.II version GIT acb749f4f5 20240221 16:10:02+00:00

#include <deal.II/numerics/time_dependent.h>
Public Types  
using  CorrectionRelaxations = std::vector< std::vector< std::pair< unsigned int, double > > > 
Public Member Functions  
RefinementFlags (const unsigned int max_refinement_level=0, const unsigned int first_sweep_with_correction=0, const unsigned int min_cells_for_correction=0, const double cell_number_corridor_top=(1<< dim), const double cell_number_corridor_bottom=1, const CorrectionRelaxations &correction_relaxations=CorrectionRelaxations(), const unsigned int cell_number_correction_steps=0, const bool mirror_flags_to_previous_grid=false, const bool adapt_grids=false)  
Static Public Member Functions  
static ::ExceptionBase &  ExcInvalidValue (double arg1) 
Public Attributes  
const unsigned int  max_refinement_level 
const unsigned int  first_sweep_with_correction 
const unsigned int  min_cells_for_correction 
const double  cell_number_corridor_top 
const double  cell_number_corridor_bottom 
const std::vector< std::vector< std::pair< unsigned int, double > > >  correction_relaxations 
const unsigned int  cell_number_correction_steps 
const bool  mirror_flags_to_previous_grid 
const bool  adapt_grids 
Static Public Attributes  
static CorrectionRelaxations  default_correction_relaxations 
This structure is used to tell the TimeStepBase_Tria() class how grids should be refined. Before we explain all the different variables, fist some terminology:
max_refinement_level:
Cut the refinement of cells at a given level. This flag does not influence the flagging of cells, so not more cells on the coarser levels are flagged than usual. Rather, the flags are all set, but when it comes to the actual refinement, the maximum refinement level is truncated.
This option is only really useful when you want to compare global refinement with adaptive refinement when you don't want the latter to refine more than the global refinement.
first_sweep_with_correction:
When using cell number correction as defined above, it may be worth while to start with this only in later sweeps, not already in the first one. If this variable is zero, then start with the first sweep, else with a higher one. The rationale for only starting later is that we do not want to block the development of grids at the beginning and only impose restrictions in the sweeps where we start to be interested in the actual results of the computations.
min_cells_for_correction:
If we want a more free process of grid development, we may want to impose less rules for grids with few cells also. This variable sets a lower bound for the cell number of grids where corrections are to be performed.
cell_number_corridor_top:
Fraction of the number of cells by which the number of cells of one grid may be higher than that on the previous grid. Common values are 10 per cent (i.e. 0.1). The naming of the variable results from the goal to define a target corridor for the number of cells after refinement has taken place.
cell_number_corridor_bottom:
Fraction of the number of cells by which the number of cells of one grid may be lower than that on the previous grid. Common values are 5 per cent (i.e. 0.05). Usually this number will be smaller than cell_number_corridor_top
since an increase of the number of cells is not harmful (though it increases the numerical amount of work needed to solve the problem) while a sharp decrease may reduce the accuracy of the final result even if the time steps computed before the decrease were computed to high accuracy.
Note however, that if you compute the dual problem as well, then the time direction is reversed, so the two values defining the cell number corridor should be about equal.
correction_relaxations:
This is a list of pairs of number with the following meaning: just as for min_cells_for_correction
, it may be worth while to reduce the requirements upon grids if the have few cells. The present variable stores a list of cell numbers along with some values which tell us that the cell number corridor should be enlarged by a certain factor. For example, if this list was ((100 5) (200 3) (500 2))
, this would mean that for grids with a cell number below 100, the cell_number_corridor_*
variables are to be multiplied by 5 before they are applied, for cell numbers below 200 they are to be multiplied by 3, and so on.
correction_relaxations
is actually a vector of such list. Each entry in this vector denotes the relaxation rules for one sweep. The last entry defines the relaxation rules for all following sweeps. This scheme is adopted to allow for stricter corrections in later sweeps while the relaxations may be more generous in the first sweeps.
There is a static variable default_correction_relaxations
which you can use as a default value. It is an empty list and thus defines no relaxations.
cell_number_correction_steps:
Usually, if you want the number of cells to be corrected, the target corridor for the cell number is computed and some additional cells are flagged or flags are removed. But since the cell number resulting after flagging and deflagging can not be easily computed, it will usually not be within the corridor. We therefore need to iteratively get to our goal. Usually, three or four iterations are needed, but using this variable, you can reduce the allowed number of iterations; breaking the loop after two iterations yields good results regularly. Setting the variable to zero will result in no correction steps at all.
mirror_flags_to_previous_grid:
If a cell on the present grid is flagged for refinement, also flag the corresponding cell on the previous grid. This is useful if, for example, error indicators are computed for spacetime cells, but are stored for the second grid only. Now, since the first grid has the same contributions to the indicators as the second, it may be useful to flag both if necessary. This is done if the present variable is set.
adapt_grids:
adapt the present grid to the previous one in the sense defined above. What is actually done here is the following: if going from the previous to the present grid would result in double refinement or double coarsening of some cells, then we try to flag these cells for refinement or coarsening such as to avoid the double step. Obviously, more than double refinement of coarsening is also caught.
Grid adaption can try to avoid such changes between two grids, but it can never promise that they don't occur. This is because the next grid may change the present one, but then again there may be jumps in refinement level between the present and the previous one; this could only be avoided by looping iteratively through all grids, back and forth, until nothing changes anymore, which is obviously impossible if there are many time steps with very large grids.
Definition at line 1129 of file time_dependent.h.
using TimeStepBase_Tria_Flags::RefinementFlags< dim >::CorrectionRelaxations = std::vector<std::vector<std::pair<unsigned int, double> >> 
Typedef of a data type describing some relaxations of the correction process. See the general description of this class for more information.
Definition at line 1136 of file time_dependent.h.
TimeStepBase_Tria_Flags::RefinementFlags< dim >::RefinementFlags  (  const unsigned int  max_refinement_level = 0 , 
const unsigned int  first_sweep_with_correction = 0 , 

const unsigned int  min_cells_for_correction = 0 , 

const double  cell_number_corridor_top = (1 << dim) , 

const double  cell_number_corridor_bottom = 1 , 

const CorrectionRelaxations &  correction_relaxations = CorrectionRelaxations() , 

const unsigned int  cell_number_correction_steps = 0 , 

const bool  mirror_flags_to_previous_grid = false , 

const bool  adapt_grids = false 

) 
Constructor. The default values are chosen such that almost no restriction on the mesh refinement is imposed.
Definition at line 1199 of file time_dependent.cc.

static 
Default values for the relaxations: no relaxations.
Definition at line 1142 of file time_dependent.h.
const unsigned int TimeStepBase_Tria_Flags::RefinementFlags< dim >::max_refinement_level 
Maximum level of a cell in the triangulation of a time level. If it is set to zero, then no limit is imposed on the number of refinements a coarse grid cell may undergo. Usually, this field is used, if for some reason you want to limit refinement in an adaptive process, for example to avoid overly large numbers of cells or to compare with grids which have a certain number of refinements.
Definition at line 1167 of file time_dependent.h.
const unsigned int TimeStepBase_Tria_Flags::RefinementFlags< dim >::first_sweep_with_correction 
First sweep to perform cell number correction steps on; for sweeps before, cells are only flagged and no numbercorrection to previous grids is performed.
Definition at line 1174 of file time_dependent.h.
const unsigned int TimeStepBase_Tria_Flags::RefinementFlags< dim >::min_cells_for_correction 
Apply cell number correction with the previous time level only if there are more than this number of cells.
Definition at line 1181 of file time_dependent.h.
const double TimeStepBase_Tria_Flags::RefinementFlags< dim >::cell_number_corridor_top 
Fraction by which the number of cells on a time level may differ from the number on the previous time level (first: top deviation, second: bottom deviation).
Definition at line 1188 of file time_dependent.h.
const double TimeStepBase_Tria_Flags::RefinementFlags< dim >::cell_number_corridor_bottom 
Definition at line 1193 of file time_dependent.h.
const std::vector<std::vector<std::pair<unsigned int, double> > > TimeStepBase_Tria_Flags::RefinementFlags< dim >::correction_relaxations 
List of relaxations to the correction step.
Definition at line 1199 of file time_dependent.h.
const unsigned int TimeStepBase_Tria_Flags::RefinementFlags< dim >::cell_number_correction_steps 
Number of iterations to be performed to adjust the number of cells on a time level to those on the previous one. Zero means: do no such iteration.
Definition at line 1206 of file time_dependent.h.
const bool TimeStepBase_Tria_Flags::RefinementFlags< dim >::mirror_flags_to_previous_grid 
Flag all cells which are flagged on this timestep for refinement on the previous one also. This is useful in case the error indicator was computed by integration over timespace cells, but are now associated to a grid on a discrete time level. Since the error contribution comes from both grids, however, it is appropriate to refine both grids.
Since the previous grid does not mirror the flags to the one before it, this does not lead to an almost infinite growth of cell numbers. You should use this flag with cell number correction switched on only, however.
Mirroring is done after cell number correction is done, but before grid adaption, so the cell number on this grid is not noticeably influenced by the cells flagged additionally on the previous grid.
Definition at line 1224 of file time_dependent.h.
const bool TimeStepBase_Tria_Flags::RefinementFlags< dim >::adapt_grids 
Adapt this grid to the previous one.
Definition at line 1229 of file time_dependent.h.