![]() |
Reference documentation for deal.II version 9.5.1
|
Namespaces | |
namespace | internal |
Functions | |
template<int dim, class InputVector , int spacedim> | |
void | approximate_gradient (const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const InputVector &solution, Vector< float > &derivative_norm, const unsigned int component=0) |
template<int dim, class InputVector , int spacedim> | |
void | approximate_gradient (const DoFHandler< dim, spacedim > &dof, const InputVector &solution, Vector< float > &derivative_norm, const unsigned int component=0) |
template<int dim, class InputVector , int spacedim> | |
void | approximate_second_derivative (const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const InputVector &solution, Vector< float > &derivative_norm, const unsigned int component=0) |
template<int dim, class InputVector , int spacedim> | |
void | approximate_second_derivative (const DoFHandler< dim, spacedim > &dof, const InputVector &solution, Vector< float > &derivative_norm, const unsigned int component=0) |
template<int dim, int spacedim, class InputVector , int order> | |
void | approximate_derivative_tensor (const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const InputVector &solution, const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell, Tensor< order, dim > &derivative, const unsigned int component=0) |
template<int dim, int spacedim, class InputVector , int order> | |
void | approximate_derivative_tensor (const DoFHandler< dim, spacedim > &dof, const InputVector &solution, const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell, Tensor< order, dim > &derivative, const unsigned int component=0) |
template<int dim, int order> | |
double | derivative_norm (const Tensor< order, dim > &derivative) |
static ::ExceptionBase & | ExcVectorLengthVsNActiveCells (int arg1, int arg2) |
static ::ExceptionBase & | ExcInsufficientDirections () |
This namespace provides functions that compute a cell-wise approximation of the norm of a derivative of a finite element field by taking difference quotients between neighboring cells. This is a rather simple but efficient form to get an error indicator, since it can be computed with relatively little numerical effort and yet gives a reasonable approximation.
The way the difference quotients are computed on cell
Thus, if the matrix approximate_gradient
function of this class is the
The computation of this quantity must fail if a cell has only neighbors for which the direction vectors
As can easily be verified, this can only happen on very coarse grids, when some cells and all their neighbors have not been refined even once. You should therefore only call the functions of this class if all cells are at least once refined. In practice this is not much of a restriction.
Similar to the reasoning above, approximations to higher derivatives can be computed in a similar fashion. For example, the tensor of second derivatives is approximated by the formula
The returned value on each cell is the spectral norm of the approximated tensor of second derivatives, i.e. the largest eigenvalue by absolute value. This equals the largest curvature of the finite element field at each cell, and the spectral norm is the matrix norm associated to the
Even higher than the second derivative can be obtained along the same lines as exposed above.
If you would like to base a refinement criterion upon these approximation of the derivatives, you will have to scale the results of this class by an appropriate power of the mesh width. For example, since
Likewise, for the second derivative, one should choose a power of the mesh size
The formulae for the computation of approximations to the gradient and to the tensor of second derivatives shown above are very much alike. The basic difference is that in one case the finite difference quotient is a scalar, while in the other case it is a vector. For higher derivatives, this would be a tensor of even higher rank. We then have to form the outer product of this difference quotient with the distance vector Gradient
and SecondDerivative
) and the main algorithm is simply passed one or the other data types and asks them to perform the order dependent operations. The main framework that is independent of this, such as finding all active neighbors, or setting up the matrix approximate
.
Due to this way of operation, the class may be easily extended for higher order derivatives than are presently implemented. Basically, only an additional class along the lines of the derivative descriptor classes Gradient
and SecondDerivative
has to be implemented, with the respective alias and functions replaced by the appropriate analogues for the derivative that is to be approximated.
void DerivativeApproximation::approximate_gradient | ( | const Mapping< dim, spacedim > & | mapping, |
const DoFHandler< dim, spacedim > & | dof, | ||
const InputVector & | solution, | ||
Vector< float > & | derivative_norm, | ||
const unsigned int | component = 0 ) |
This function is used to obtain an approximation of the gradient. Pass it the DoF handler object that describes the finite element field, a nodal value vector, and receive the cell-wise Euclidean norm of the approximated gradient.
The last parameter denotes the solution component, for which the gradient is to be computed. It defaults to the first component. For scalar elements, this is the only valid choice; for vector-valued ones, any component between zero and the number of vector components can be given here.
In a parallel computation the solution
vector needs to contain the locally relevant unknowns.
Definition at line 1018 of file derivative_approximation.cc.
void DerivativeApproximation::approximate_gradient | ( | const DoFHandler< dim, spacedim > & | dof, |
const InputVector & | solution, | ||
Vector< float > & | derivative_norm, | ||
const unsigned int | component = 0 ) |
Call the function above with mapping=MappingQ<dim>(1)
.
Definition at line 1031 of file derivative_approximation.cc.
void DerivativeApproximation::approximate_second_derivative | ( | const Mapping< dim, spacedim > & | mapping, |
const DoFHandler< dim, spacedim > & | dof, | ||
const InputVector & | solution, | ||
Vector< float > & | derivative_norm, | ||
const unsigned int | component = 0 ) |
This function is the analogue to the one above, computing finite difference approximations of the tensor of second derivatives. Pass it the DoF handler object that describes the finite element field, a nodal value vector, and receive the cell-wise spectral norm of the approximated tensor of second derivatives. The spectral norm is the matrix norm associated to the
The last parameter denotes the solution component, for which the gradient is to be computed. It defaults to the first component. For scalar elements, this is the only valid choice; for vector-valued ones, any component between zero and the number of vector components can be given here.
In a parallel computation the solution
vector needs to contain the locally relevant unknowns.
Definition at line 1051 of file derivative_approximation.cc.
void DerivativeApproximation::approximate_second_derivative | ( | const DoFHandler< dim, spacedim > & | dof, |
const InputVector & | solution, | ||
Vector< float > & | derivative_norm, | ||
const unsigned int | component = 0 ) |
Call the function above with mapping=MappingQ<dim>(1)
.
Definition at line 1064 of file derivative_approximation.cc.
void DerivativeApproximation::approximate_derivative_tensor | ( | const Mapping< dim, spacedim > & | mapping, |
const DoFHandler< dim, spacedim > & | dof, | ||
const InputVector & | solution, | ||
const typename DoFHandler< dim, spacedim >::active_cell_iterator & | cell, | ||
Tensor< order, dim > & | derivative, | ||
const unsigned int | component = 0 ) |
This function calculates the order
-th order approximate derivative and returns the full tensor for a single cell.
The last parameter denotes the solution component, for which the gradient is to be computed. It defaults to the first component. For scalar elements, this is the only valid choice; for vector-valued ones, any component between zero and the number of vector components can be given here.
In a parallel computation the solution
vector needs to contain the locally relevant unknowns.
Definition at line 1084 of file derivative_approximation.cc.
void DerivativeApproximation::approximate_derivative_tensor | ( | const DoFHandler< dim, spacedim > & | dof, |
const InputVector & | solution, | ||
const typename DoFHandler< dim, spacedim >::active_cell_iterator & | cell, | ||
Tensor< order, dim > & | derivative, | ||
const unsigned int | component = 0 ) |
Same as above, with mapping=MappingQ<dim>(1)
.
Definition at line 1106 of file derivative_approximation.cc.
double DerivativeApproximation::derivative_norm | ( | const Tensor< order, dim > & | derivative | ) |
Return the norm of the derivative.
Definition at line 1133 of file derivative_approximation.cc.