 ASPECT
aspect::MaterialModel::MaterialAveraging Namespace Reference

## Enumerations

enum  AveragingOperation {
none, arithmetic_average, harmonic_average, geometric_average,
pick_largest, project_to_Q1, log_average, harmonic_average_only_viscosity,
geometric_average_only_viscosity, project_to_Q1_only_viscosity
}

## Functions

std::string get_averaging_operation_names ()

AveragingOperation parse_averaging_operation_name (const std::string &s)

template<int dim>
void average (const AveragingOperation operation, const typename DoFHandler< dim >::active_cell_iterator &cell, const Quadrature< dim > &quadrature_formula, const Mapping< dim > &mapping, MaterialModelOutputs< dim > &values_out)

void average_property (const AveragingOperation operation, const FullMatrix< double > &projection_matrix, const FullMatrix< double > &expansion_matrix, std::vector< double > &values_out)

## Detailed Description

A namespace in which we define how material model outputs should be averaged on each cell.

Material models compute output quantities such as the viscosity, the density, etc, based on pressures, temperatures, composition, and location at every quadrature point. For some models, these values vary drastically from quadrature point to quadrature point, and this creates difficulties both for the stability of the discretization as well as for the linear solvers. Some of this can be ameliorated by averaging values on every cell, although this of course reduces the ideal convergence order. This namespace defines the means to achieve such averaging.

## § AveragingOperation

An enum to define what kind of averaging operations are implemented. These are:

• No averaging, i.e., leave the values as they were provided by the material model.
• Arithmetic averaging: Set the values of each output quantity at every quadrature point to

$\bar x = \frac 1Q \sum_{q=1}^Q x_q$

where $$x_q$$ are the values at the $$Q$$ quadrature points.
• Harmonic averaging: Set the values of each output quantity at every quadrature point to

$\bar x = \left(\frac 1Q \sum_{q=1}^Q \frac{1}{x_q}\right)^{-1}$

where $$x_q$$ are the values at the $$Q$$ quadrature points.
• Geometric averaging: Set the values of each output quantity at every quadrature point to

$\bar x = \left(\prod_{q=1}^Q x_q\right)^{1/Q}$

where $$x_q$$ are the values at the $$Q$$ quadrature points.
• Pick largest: Set the values of each output quantity at every quadrature point to

$\bar x = \max_{1\le q\le Q} x_q$

where $$x_q$$ are the values at the $$Q$$ quadrature points.
• Project to $$Q_1$$: This operation takes the values at the quadrature points and computes the best bi- or trilinear approximation for them. In other words, it projects the values into the $$Q_1$$ finite element space. It then re-evaluate this projection at the quadrature points.
• Log average: Set the values of each output quantity at every quadrature point to

$\bar x = {10}^{\frac 1Q \sum_{q=1}^Q \log_{10} x_q}$

where $$x_q$$ are the values at the $$Q$$ quadrature points.
• Harmonic average only viscosity, Geometric average only viscosity and project to Q1 only viscosity: Like harmonic averaging, geometric averaging and project to Q1, but only applied to the viscosity.
Enumerator
none
arithmetic_average
harmonic_average
geometric_average
pick_largest
project_to_Q1
log_average
harmonic_average_only_viscosity
geometric_average_only_viscosity
project_to_Q1_only_viscosity

Definition at line 693 of file interface.h.

## § get_averaging_operation_names()

 std::string aspect::MaterialModel::MaterialAveraging::get_averaging_operation_names ( )

Return a string that represents the various averaging options laid out above and that can be used in the declaration of an input parameter. The options are separated by "|" so that they can be used in a ::Patterns::Selection argument.

## § parse_averaging_operation_name()

 AveragingOperation aspect::MaterialModel::MaterialAveraging::parse_averaging_operation_name ( const std::string & s )

Parse a string representing one of the options returned by get_averaging_operation_names(), and return the corresponding AveragingOperation value.

## § average()

template<int dim>
 void aspect::MaterialModel::MaterialAveraging::average ( const AveragingOperation operation, const typename DoFHandler< dim >::active_cell_iterator & cell, const Quadrature< dim > & quadrature_formula, const Mapping< dim > & mapping, MaterialModelOutputs< dim > & values_out )

Given the averaging operation, a description of where the quadrature points are located on the given cell, and a mapping, perform this operation on all elements of the values structure.

## § average_property()

 void aspect::MaterialModel::MaterialAveraging::average_property ( const AveragingOperation operation, const FullMatrix< double > & projection_matrix, const FullMatrix< double > & expansion_matrix, std::vector< double > & values_out )

Do the requested averaging operation for one array. The projection matrix argument is only used if the operation chosen is project_to_Q1