Viscosity

Contents

rhea_viscosity.h
rhea_viscosity_param_derivative.h


rhea_viscosity.h [source]

Defines

RHEA_VISCOSITY_NEUTRAL_VALUE (1.0)

RHEA_VISCOSITY

Viscosity modeling mantle convection.

Typedefs

typedef struct rhea_viscosity_options rhea_viscosity_options_t
typedef void (*rhea_viscosity_compute_fn_t)(ymir_vec_t *viscosity, ymir_vec_t *proj_scal, ymir_vec_t *marker, ymir_vec_t *temperature, ymir_vec_t *weakzone, ymir_vec_t *velocity, void *data)

Computes a custom viscosity. Callback function for viscosity computation.

Param viscosity:

[out] Viscosity (Gauss quadrature nodes)

Param proj_scal:

[out] Scaling for rank-1 fourth-order tensor (Gauss quadrature nodes, may be NULL)

Param marker:

[out] Marker for different physics in the effective viscosity (Gauss quadrature nodes, may be NULL)

Param temperature:

[in] Temperature (GLL nodes, may be NULL)

Param weakzone:

[in] Weak zone factor (Gauss nodes, may be NULL)

Param velocity:

[in] Velocity (GLL nodes, may be NULL)

Param opt:

[in] Viscosity options

Param data:

[in] User data

Enums

enum rhea_viscosity_t

Values:

enumerator RHEA_VISCOSITY_LINEAR
enumerator RHEA_VISCOSITY_NONLINEAR
enum rhea_viscosity_linear_t

Values:

enumerator RHEA_VISCOSITY_LINEAR_CONST
enumerator RHEA_VISCOSITY_LINEAR_TEMPREVERSE
enumerator RHEA_VISCOSITY_LINEAR_ARRHENIUS
enum rhea_viscosity_nonlinear_t

Values:

enumerator RHEA_VISCOSITY_NONLINEAR_SRW
enumerator RHEA_VISCOSITY_NONLINEAR_YLD
enumerator RHEA_VISCOSITY_NONLINEAR_SRW_YLD
enum rhea_viscosity_nonlinear_init_t

Values:

enumerator RHEA_VISCOSITY_NONLINEAR_INIT_DEFAULT
enumerator RHEA_VISCOSITY_NONLINEAR_INIT_LIN
enumerator RHEA_VISCOSITY_NONLINEAR_INIT_LIN_RESCALE_UM
enum rhea_viscosity_model_t

Values:

enumerator RHEA_VISCOSITY_MODEL_UWYL_LCUT_UCUT
enumerator RHEA_VISCOSITY_MODEL_UWYL_LADD_UCUT
enumerator RHEA_VISCOSITY_MODEL_UWYL_LADD_USHIFT
enumerator RHEA_VISCOSITY_MODEL_UWYL_LADD_USMOOTH

Functions

void rhea_viscosity_add_options(ymir_options_t *opt_sup)

Defines options and adds them as sub-options.

void rhea_viscosity_process_options(rhea_viscosity_options_t *opt, rhea_domain_options_t *domain_options, rhea_temperature_options_t *temp_options)

Processes options and stores them.

double rhea_viscosity_get_dim_Pas(rhea_viscosity_options_t *opt)

Gets the scaling factor to convert nondimensional viscosity to the corresponding dimensional quantity. Unit: [Pa*s]

double rhea_viscosity_scaling_get_dim(const double arrhenius_activation_energy, rhea_viscosity_options_t *opt)

Gets the scaling factor to convert a nondimensional viscosity scaling factor (prefactor) to the corresponding dimensional quantity. Unit: N/A

ymir_vec_t *rhea_viscosity_new(ymir_mesh_t *ymir_mesh)

Creates a new viscosity vector.

void rhea_viscosity_destroy(ymir_vec_t *viscosity)

Destroys a viscosity vector.

void rhea_viscosity_convert_to_dimensional_Pas(ymir_vec_t *viscosity, rhea_viscosity_options_t *opt)

Converts entries of a nondimensional viscosity vector into dimensional values. Unit: [Pa*s]

int rhea_viscosity_check_vec_type(ymir_vec_t *vec)

Checks whether a vector is of the right type.

int rhea_viscosity_is_valid(ymir_vec_t *vec)

Checks entries of a vector.

ymir_vec_t *rhea_viscosity_surface_new(ymir_mesh_t *ymir_mesh)

Creates a new viscosity vector at surface.

void rhea_viscosity_surface_destroy(ymir_vec_t *visc_surf)

Destroys a viscosity vector at surface.

int rhea_viscosity_surface_check_vec_type(ymir_vec_t *vec)

Checks whether a vector is of the right type.

int rhea_viscosity_surface_is_valid(ymir_vec_t *vec)

Checks entries of a vector.

ymir_vec_t *rhea_viscosity_surface_new_from_vol(ymir_vec_t *visc_vol)

Creates a new viscosity vector at surface with values interpolated from a viscosity volume vector.

void rhea_viscosity_surface_interpolate(ymir_vec_t *visc_surf, ymir_vec_t *visc_vol, const double visc_surf_min, const double visc_surf_max)

Interpolates viscosity from volume to surface.

void rhea_viscosity_compute(ymir_vec_t *viscosity, ymir_vec_t *proj_scal, ymir_vec_t *marker, ymir_vec_t *temperature, ymir_vec_t *weakzone, ymir_vec_t *velocity, void *data)

Computes the viscosity.

Parameters:
  • viscosity[out] Viscosity (Gauss quadrature nodes)

  • proj_scal[out] Scaling for rank-1 fourth-order tensor (Gauss quadrature nodes, may be NULL)

  • marker[out] Marker for different physics in the effective viscosity (Gauss quadrature nodes, may be NULL)

  • temperature[in] Temperature (GLL nodes, may be NULL)

  • weakzone[in] Weak zone factor (Gauss nodes, may be NULL)

  • velocity[in] Velocity (GLL nodes, may be NULL)

  • opt[in] Viscosity options

  • data[in] User data

void rhea_viscosity_compute_nonlinear_init(ymir_vec_t *viscosity, ymir_vec_t *proj_scal, ymir_vec_t *marker, ymir_vec_t *temperature, ymir_vec_t *weakzone, void *data)

Computes the viscosity to initialize a nonlinear solver with zero velocity.

Parameters:
  • viscosity[out] Viscosity (Gauss quadrature nodes)

  • proj_scal[out] Scaling for rank-1 fourth-order tensor (Gauss quadrature nodes, may be NULL)

  • marker[out] Marker for different physics in the effective viscosity (Gauss quadrature nodes, may be NULL)

  • temperature[in] Temperature (GLL nodes, may be NULL)

  • weakzone[in] Weak zone factor (Gauss nodes, may be NULL)

  • opt[in] Viscosity options

void rhea_viscosity_compute_elem (double *_sc_restrict visc_elem, double *_sc_restrict proj_scal_elem, double *_sc_restrict marker_elem, const double *_sc_restrict temp_elem, const double *_sc_restrict weak_elem, const double *_sc_restrict strt_sqrt_2inv_elem, const double *_sc_restrict x, const double *_sc_restrict y, const double *_sc_restrict z, const int n_nodes, const int *_sc_restrict Vmask, rhea_viscosity_options_t *opt)

Computes the viscosity of one element.

void rhea_viscosity_compute_nonlinear_init_elem (double *_sc_restrict visc_elem, double *_sc_restrict proj_scal_elem, double *_sc_restrict marker_elem, const double *_sc_restrict temp_elem, const double *_sc_restrict weak_elem, const double *_sc_restrict x, const double *_sc_restrict y, const double *_sc_restrict z, const int n_nodes, const int *_sc_restrict Vmask, rhea_viscosity_options_t *opt)
int rhea_viscosity_restrict_min(rhea_viscosity_options_t *opt)

Returns whether restriction to min/max viscosity bound is active.

int rhea_viscosity_restrict_max(rhea_viscosity_options_t *opt)
double rhea_viscosity_get_scaling(rhea_viscosity_options_t *opt, const int is_in_upper_mantle, const int restrict_min)

Gets the scaling factor.

int rhea_viscosity_has_arrhenius(rhea_viscosity_options_t *opt)

Returns whether temperature dependence via Arrhenius relationship is enabled.

double rhea_viscosity_get_arrhenius_activation_energy(rhea_viscosity_options_t *opt, const int is_in_upper_mantle)

Gets the activation energy for the Arrhenius relationship.

int rhea_viscosity_has_strain_rate_weakening(rhea_viscosity_options_t *opt)

Returns whether strain rate weakening physics are enabled.

double rhea_viscosity_get_stress_exp(rhea_viscosity_options_t *opt, const int is_in_upper_mantle)

Gets the exponent for the sqrt of the 2nd invariant of the strain rate tensor: n is the stress exponent, 1/n is the strain rate weakening exponent.

double rhea_viscosity_get_strain_rate_weakening_exp(rhea_viscosity_options_t *opt, const int is_in_upper_mantle)
int rhea_viscosity_has_yielding(rhea_viscosity_options_t *opt)

Returns whether yielding physics are enabled.

double rhea_viscosity_get_yield_strength(rhea_viscosity_options_t *opt)

Gets the yield strength.

int rhea_viscosity_has_nonlinear_projector_regularization(rhea_viscosity_options_t *opt)

Returns whether regularization for the projector of the nonlinear viscosity is enabled.

double rhea_viscosity_get_nonlinear_projector_regularization(rhea_viscosity_options_t *opt)

Gets the regularization value for the projector of the nonlinear viscosity.

double rhea_viscosity_get_visc_shift(rhea_viscosity_options_t *opt)

Returns the value by which the whole viscosity is shifted.

double rhea_viscosity_get_visc_shift_proj(rhea_viscosity_options_t *opt)

Returns the value by which the projection part of the (linearized) viscosity coefficient is shifted.

double *rhea_viscosity_get_elem_gauss(sc_dmatrix_t *visc_el_mat, ymir_vec_t *visc_vec, const ymir_locidx_t elid)

Gets the viscosity of one element at Gauss nodes.

void rhea_viscosity_set_elem_gauss(ymir_vec_t *visc_vec, sc_dmatrix_t *visc_el_mat, const ymir_locidx_t elid)

Sets the viscosity of one element at Gauss nodes.

double *rhea_viscosity_proj_scal_get_elem_gauss(sc_dmatrix_t *proj_scal_el_mat, ymir_vec_t *proj_scal_vec, const ymir_locidx_t elid)

Gets the rank-1 4th-order tensor of one element at Gauss nodes.

void rhea_viscosity_proj_scal_set_elem_gauss(ymir_vec_t *proj_scal_vec, sc_dmatrix_t *proj_scal_el_mat, const ymir_locidx_t elid)

Sets the rank-1 4th-order tensor of one element at Gauss nodes.

double *rhea_viscosity_marker_get_elem_gauss(sc_dmatrix_t *marker_el_mat, ymir_vec_t *marker_vec, const ymir_locidx_t elid)

Gets a marker of one element at Gauss nodes.

void rhea_viscosity_marker_set_elem_gauss(ymir_vec_t *marker_vec, sc_dmatrix_t *marker_el_mat, const ymir_locidx_t elid)

Sets a marker of one element at Gauss nodes.

void rhea_viscosity_marker_filter_min(ymir_vec_t *vec, ymir_vec_t *marker, const int invert_filter)

Filters a vector where the min/max viscosity bound is active, otherwise sets the values at nodes away from min/max bound to zero.

void rhea_viscosity_marker_filter_max(ymir_vec_t *vec, ymir_vec_t *marker, const int invert_filter)
void rhea_viscosity_marker_filter_yielding(ymir_vec_t *vec, ymir_vec_t *marker, const int invert_filter)

Filters a vector where yielding occurs, and otherwise sets the values at nodes without yielding to zero.

void rhea_viscosity_marker_get_volume(double *vol_min, double *vol_max, double *vol_yielding, ymir_vec_t *marker)

Computes the total volume where each marker is active.

void rhea_viscosity_marker_get_bounds_volume(double *vol_min, double *vol_max, ymir_vec_t *marker)

Computes the volume where bounds are active.

double rhea_viscosity_marker_get_yielding_volume(ymir_vec_t *yielding_marker)

Computes the volume where yielding is active.

void rhea_viscosity_filter_separate(ymir_vec_t *filter, const double threshold)

Separates the entries of a filter vector into binary values: 1 if above threshold 0 if below threshold or equal

double rhea_viscosity_filter_compute_volume(ymir_vec_t *filter)

Computes the volume of a filter. A filter is understood as a vector with ones where the filter is active and zeros otherwise.

void rhea_viscosity_stats_filter_upper_mantle(ymir_vec_t *filter, rhea_domain_options_t *domain_options)

Sets a filter for the upper/lower mantle.

void rhea_viscosity_stats_filter_lower_mantle(ymir_vec_t *filter, rhea_domain_options_t *domain_options)
void rhea_viscosity_stats_filter_lithosphere(ymir_vec_t *filter, ymir_vec_t *viscosity, rhea_viscosity_options_t *opt, double threshold)

Sets a filter that is active at high (i.e., lithospheric) viscosity values.

void rhea_viscosity_stats_filter_lithosphere_surf(ymir_vec_t *filter_surf, ymir_vec_t *viscosity_vol, rhea_viscosity_options_t *opt, double threshold)
void rhea_viscosity_stats_filter_asthenosphere(ymir_vec_t *filter, ymir_vec_t *viscosity, rhea_viscosity_options_t *opt, double threshold)

Sets a filter in the upper mantle that is active away from the lithospere.

void rhea_viscosity_stats_get_global(double *min_Pas, double *max_Pas, double *mean_Pas, ymir_vec_t *viscosity, rhea_viscosity_options_t *opt)

Computes global viscosity statistics.

void rhea_viscosity_stats_get_regional(double *upper_mantle_mean_Pas, double *lower_mantle_mean_Pas, double *lith_mean_Pas, double *asth_mean_Pas, ymir_vec_t *viscosity, rhea_viscosity_options_t *opt)
double rhea_viscosity_stats_get_lithosphere_volume(ymir_vec_t *viscosity, rhea_viscosity_options_t *opt)

Computes the (approx.) volume of the lithosphere.

double rhea_viscosity_stats_get_asthenosphere_volume(ymir_vec_t *viscosity, rhea_viscosity_options_t *opt)

Computes the (approx.) volume of the asthenosphere.

struct rhea_viscosity_options

Public Members

rhea_viscosity_t type
rhea_viscosity_linear_t type_linear
rhea_viscosity_nonlinear_t type_nonlinear
rhea_viscosity_nonlinear_init_t type_nonlinear_init
rhea_viscosity_model_t model
double representative_Pas
double min
double max
double max_smoothness_param
double upper_mantle_scaling
double lower_mantle_scaling
double upper_mantle_arrhenius_activation_energy
double lower_mantle_arrhenius_activation_energy
double stress_exponent
double yield_strength
double nonlinear_projector_regularization
rhea_domain_options_t *domain_options
rhea_temperature_options_t *temp_options

rhea_viscosity_param_derivative.h [source]

Enums

enum rhea_viscosity_param_derivative_t

RHEA_VISCOSITY_PARAM_DERIVATIVE

Viscosity modeling mantle convection.

Values:

enumerator RHEA_VISCOSITY_PARAM_DERIVATIVE_NONE
enumerator RHEA_VISCOSITY_PARAM_DERIVATIVE_MIN
enumerator RHEA_VISCOSITY_PARAM_DERIVATIVE_MAX
enumerator RHEA_VISCOSITY_PARAM_DERIVATIVE_UPPER_MANTLE_SCALING
enumerator RHEA_VISCOSITY_PARAM_DERIVATIVE_UPPER_MANTLE_ACTIVATION_ENERGY
enumerator RHEA_VISCOSITY_PARAM_DERIVATIVE_LOWER_MANTLE_SCALING
enumerator RHEA_VISCOSITY_PARAM_DERIVATIVE_LOWER_MANTLE_ACTIVATION_ENERGY
enumerator RHEA_VISCOSITY_PARAM_DERIVATIVE_STRESS_EXPONENT
enumerator RHEA_VISCOSITY_PARAM_DERIVATIVE_YIELD_STRENGTH
enumerator RHEA_VISCOSITY_PARAM_DERIVATIVE_WEAK_THICKNESS
enumerator RHEA_VISCOSITY_PARAM_DERIVATIVE_WEAK_THICKNESS_CONST
enumerator RHEA_VISCOSITY_PARAM_DERIVATIVE_WEAK_FACTOR_INTERIOR

Functions

void rhea_viscosity_param_derivative(ymir_vec_t *derivative, rhea_viscosity_param_derivative_t derivative_type, ymir_vec_t *viscosity, ymir_vec_t *marker, ymir_vec_t *temperature, ymir_vec_t *weakzone, ymir_vec_t *velocity, rhea_viscosity_options_t *visc_options)

Computes a derivative of the viscosity w.r.t. the parameter that is specified by derivative_type.

void rhea_viscosity_param_derivative_weakzone(ymir_vec_t *derivative, rhea_viscosity_param_derivative_t derivative_type, rhea_weakzone_label_t weak_label, ymir_vec_t *viscosity, ymir_vec_t *marker, ymir_vec_t *weakzone, rhea_weakzone_options_t *weak_options, rhea_viscosity_options_t *visc_options)

Computes a derivative of the viscosity w.r.t. the weak zone parameter that is specified by derivative_type and the weak zone label weak_label.