ASPECT
aspect::MaterialModel::MaterialUtilities Namespace Reference

Lookup

PhaseUtilities

## Classes

class  PhaseFunction

struct  PhaseFunctionInputs

## Enumerations

enum  CompositionalAveragingOperation { harmonic, arithmetic, geometric, maximum_composition }

## Functions

std::vector< double > compute_volumes_from_masses (const std::vector< double > &masses, const std::vector< double > &densities, const bool return_as_fraction)

CompositionalAveragingOperation parse_compositional_averaging_operation (const std::string &parameter_name, const ParameterHandler &prm)

double average_value (const std::vector< double > &volume_fractions, const std::vector< double > &parameter_values, const CompositionalAveragingOperation &average_type)

template<int dim>
void fill_averaged_equation_of_state_outputs (const EquationOfStateOutputs< dim > &eos_outputs, const std::vector< double > &mass_fractions, const std::vector< double > &volume_fractions, const unsigned int i, MaterialModelOutputs< dim > &out)

double phase_average_value (const std::vector< double > &phase_function_values, const std::vector< unsigned int > &n_phases_per_composition, const std::vector< double > &parameter_values, const unsigned int composition, const PhaseUtilities::PhaseAveragingOperation operation=PhaseUtilities::arithmetic)

## Detailed Description

A namespace in which we define utility functions that might be used in many different places in the material model to prevent code duplication.

## § CompositionalAveragingOperation

For multicomponent material models: Enumeration for selecting which averaging scheme to use when averaging the properties of different compositional fields. Select between harmonic, arithmetic, geometric, and maximum_composition. The max composition scheme simply uses the viscosity of whichever field has the highest volume fraction.

Enumerator
harmonic
arithmetic
geometric
maximum_composition

Definition at line 317 of file utilities.h.

## § compute_composition_fractions()

 std::vector aspect::MaterialModel::MaterialUtilities::compute_composition_fractions ( const std::vector< double > & compositional_fields, const ComponentMask & field_mask = ComponentMask() )

For multicomponent material models: Given a vector of compositional field values of length N, this function returns a vector of fractions of length N+1, corresponding to the fraction of a background material'' as the first entry, and fractions for each of the input fields as the following entries. The returned vector will sum to one. If the sum of the compositional_fields is greater than one, we assume that there is no background field (i.e., that field value is zero). Otherwise, the difference between the sum of the compositional fields and 1.0 is assumed to be the amount of the background field. Optionally, one can input a component mask that determines which of the compositional fields to use during the computation (e.g. because some fields contain unrelated quantities (like strain, porosity, or trace elements). By default, all fields are included. This function makes no assumptions about the units of the compositional field values; for example, they could correspond to mass or volume fractions.

## § compute_volume_fractions()

 DEAL_II_DEPRECATED std::vector aspect::MaterialModel::MaterialUtilities::compute_volume_fractions ( const std::vector< double > & compositional_fields, const ComponentMask & field_mask = ComponentMask() )

See compute_composition_fractions() for the documentation of this function.

Deprecated:

## § compute_volumes_from_masses()

 std::vector aspect::MaterialModel::MaterialUtilities::compute_volumes_from_masses ( const std::vector< double > & masses, const std::vector< double > & densities, const bool return_as_fraction )

Given a vector of component masses, and another of the corresponding densities, calculate the volumes of each component. If return_as_fraction is true, the returned vector will sum to one. If the input vectors have a length of one, the returned volume fraction is one.

## § parse_compositional_averaging_operation()

 CompositionalAveragingOperation aspect::MaterialModel::MaterialUtilities::parse_compositional_averaging_operation ( const std::string & parameter_name, const ParameterHandler & prm )

Read the compositional averaging operation from the parameter file, using the parameter name given in parameter_name, and return the enum that corresponds to this operation.

## § average_value()

 double aspect::MaterialModel::MaterialUtilities::average_value ( const std::vector< double > & volume_fractions, const std::vector< double > & parameter_values, const CompositionalAveragingOperation & average_type )

For multicomponent material models: Material models compute output quantities such as the viscosity, the density, etc. For some models, these values depend strongly on the composition, and more than one compositional field might have nonzero values at a given quadrature point. This means that properties have to be averaged based on the fractions of each compositional field present. This function performs this type of averaging. The averaging is based on the choice in average_type. Averaging is conducted over the compositional fields given in volume_fractions. This means that volume_fractions and parameter_values have to have the same size, which would typically be the number of compositional fields used in the simulation (with the potential addition of a background field, in case the composition does not add up to 1). However, one might not want to average over all fields, as in some cases compositional fields do not represent a rock type, but other tracked quantities like the finite strain, so the implementation is independent of the number of entries in volume_fractions.

## § fill_averaged_equation_of_state_outputs()

template<int dim>
 void aspect::MaterialModel::MaterialUtilities::fill_averaged_equation_of_state_outputs ( const EquationOfStateOutputs< dim > & eos_outputs, const std::vector< double > & mass_fractions, const std::vector< double > & volume_fractions, const unsigned int i, MaterialModelOutputs< dim > & out )

This function computes averages of multicomponent thermodynamic properties that are stored in a vector of EquationOfStateOutputs. Each eos_outputs contains the thermodynamic properties for all materials at a given evaluation point. The averaged properties are: density, isothermal compressibility, thermal_expansivity, the specific entropy derivatives with respect to pressure and temperature and the specific heat capacity. The first three of these properties are averaged by volume fraction, and the second three (the specific properties) are averaged by mass fraction. These averages are used to fill the corresponding attributes of a MaterialModelOutputs object.

## § phase_average_value()

 double aspect::MaterialModel::MaterialUtilities::phase_average_value ( const std::vector< double > & phase_function_values, const std::vector< unsigned int > & n_phases_per_composition, const std::vector< double > & parameter_values, const unsigned int composition, const PhaseUtilities::PhaseAveragingOperation operation = PhaseUtilities::arithmetic )

Material models compute output quantities such as the viscosity, the density, etc. For some models, these values may depend on the phase in addition to the composition, and more than one phase field might have nonzero values at a given quadrature point. This means that properties for each composition have to be averaged based on the fractions of each phase field present. This function performs this type of averaging. The averaging is based on the choice in operation. Averaging is conducted over the phase functions given in phase_function_values, with parameter_values containing values of all individual phases. Unlike the average_value function defined for compositions, averaging in this function is calculated based on phase functions and the change of variables on the trajectory of phase boundaries. Thus on a single phase boundary, values of variables change gradually from one phase to the other. The values of the phase function used to average the properties varies between 0 and 1.