# GfsAdapt

### From Gerris

GfsAdapt is the base class for all the objects used to adapt the resolution dynamically.

The syntax in parameter files is:

[ GfsEvent ] { minlevel = 3 maxlevel = 10 mincells = 100 maxcells = 100000 cmax = 1e-2 weight = 1 cfactor = 2 c = Cost }

with

`minlevel`

- The minimum number of refinement levels (default is 0).
`maxlevel`

- The maximum number of refinement levels (default is infinity).
`mincells`

- The minimum number of cells in the simulation (default is 0).
`maxcells`

- The maximum number of cells in the simulation. If this number is reached, the algorithm optimizes the distribution of the cells so that the maximum cost over all the cells is minimized (default is infinity).
`cmax`

- The maximum cell cost allowed. If the number of cells is smaller than the maximum allowed and the cost of a cell is larger than this value, the cell will be refined.
`weight`

- When combining several criteria, the algorithm will weight the cost of each by this value in order to compute the total cost (default is 1).
`cfactor`

- Cells will be coarsened only if their cost is smaller than
`cmax/cfactor`

(default is 4).

When specifying several different **GfsAdapt** objects in the same parameter file, the behaviour depends on whether `maxcells`

is specified or not:

*If*`maxcells`

is specified- A global cost function is constructed by weighing each of the cost functions with their respective
`weight`

parameter and is used to perform a global optimisation of the cells distribution respecting the constraint on the total number of cells. A global maximum cost parameter is constructed by taking the minimum of all the`cmax`

parameters. The`cfactor`

parameter is ignored in this case. *else*- Cells are refined whenever they violate either of the refinement criteria specified by each
**GfsAdapt**object, and coarsened whenever the verify the coarsening criteria (`cost < cmax/cfactor`

) of all the**GfsAdapt**objects. The`weight`

parameter is ignored in this case.