@@ -61,7 +61,6 @@ namespace aspect
6161 {
6262 // Use the porosity to compute the cohesion and friction angle
6363 // The porosity is computed in the MaterialModel::MaterialModelInputs
64- // and is available as in.porosity[i]
6564 const unsigned int porosity_idx = this ->introspection ().compositional_index_for_name (" porosity" );
6665 plasticity_parameters.first *= std::max ((max_porosities_for_cohesion_prefactors[volume_fraction_index] - in.composition [i][porosity_idx]) / max_porosities_for_cohesion_prefactors[volume_fraction_index], 0.0 );
6766 plasticity_parameters.second *= std::max ((max_porosities_for_friction_angle_prefactors[volume_fraction_index] - in.composition [i][porosity_idx]) / max_porosities_for_friction_angle_prefactors[volume_fraction_index], 0.0 );
@@ -72,7 +71,7 @@ namespace aspect
7271 }
7372 case function:
7473 {
75- // Use a given function input per composition to get the friction angle
74+ // Use a given function input per composition to get the prefactors
7675 Utilities::NaturalCoordinate<dim> point =
7776 this ->get_geometry_model ().cartesian_to_other_coordinates (position, coordinate_system_prefactor_function);
7877
@@ -83,7 +82,7 @@ namespace aspect
8382 else
8483 prefactor_function->set_time (this ->get_time ());
8584
86- // determine the friction angle based on position and composition
85+ // determine the prefactors based on position and composition
8786 // The volume_fraction_index is based on the number of chemical compositional fields.
8887 // However, this plugin reads a function for every compositional field, regardless of
8988 // its type. Therefore we have to get the correct index.
@@ -96,6 +95,7 @@ namespace aspect
9695 double prefactor_from_function =
9796 prefactor_function->value (Utilities::convert_array_to_point<dim>(point.get_coordinates ()),index);
9897
98+ // Multiply the cohesion and the friction angle by the prefactor.
9999 plasticity_parameters.first *= prefactor_from_function;
100100 plasticity_parameters.second *= prefactor_from_function * constants::degree_to_radians;
101101
@@ -110,14 +110,14 @@ namespace aspect
110110 CompositionalPlasticityPrefactors<dim>::declare_parameters (ParameterHandler &prm)
111111 {
112112 prm.declare_entry (" Maximum porosity for cohesion prefactor" , " 1.0" ,
113- Patterns::List (Patterns::Double (0 . , 1.0 )),
113+ Patterns::List (Patterns::Double (std::numeric_limits< double >:: epsilon () , 1.0 )),
114114 " List of the maximum porosity value for calculating the prefactor for the cohesion. "
115115 " entered as a volume fraction. If chosen to be 0.1 (10 percent porosity), the "
116116 " cohesion will be linearly reduced from its default value when the model porosity is 0"
117117 " to a maximum reduction when the model porosity is 0.1. Units: none." );
118118
119119 prm.declare_entry (" Maximum porosity for friction angle prefactor" , " 1.0" ,
120- Patterns::List (Patterns::Double (0 . , 1.0 )),
120+ Patterns::List (Patterns::Double (std::numeric_limits< double >:: epsilon () , 1.0 )),
121121 " List of the maximum porosity value for calculating the prefactor for the friction "
122122 " angle, entered as a volume fraction. If chosen to be 0.1 (10 percent porosity), the "
123123 " friction angle will be linearly reduced from its default value when the model porosity is 0"
@@ -149,12 +149,14 @@ namespace aspect
149149 CompositionalPlasticityPrefactors<dim>::parse_parameters (ParameterHandler &prm)
150150 {
151151
152- // if friction is specified as a function
153152 const unsigned int n_fields = this ->n_compositional_fields () + 1 ;
154153 if (prm.get (" Plasticity prefactor scheme" ) == " none" )
155154 prefactor_mechanism = none;
156- if (prm.get (" Plasticity prefactor scheme" ) == " porosity" )
155+ else if (prm.get (" Plasticity prefactor scheme" ) == " porosity" )
157156 {
157+ AssertThrow (this ->introspection ().compositional_name_exists (" porosity" ),
158+ ExcMessage (" The 'porosity' Plasticity prefactor scheme work only if "
159+ " is a compositional field called porosity." ));
158160 prefactor_mechanism = porosity;
159161
160162 // Retrieve the list of chemical names
@@ -178,7 +180,7 @@ namespace aspect
178180 minimum_friction_angles = Utilities::MapParsing::parse_map_to_double_array (prm.get (" Minimum friction angles" ),
179181 options);
180182 }
181- if (prm.get (" Plasticity prefactor scheme" ) == " function" )
183+ else if (prm.get (" Plasticity prefactor scheme" ) == " function" )
182184 {
183185 prefactor_mechanism = function;
184186 prm.enter_subsection (" Prefactor function" );
@@ -201,6 +203,8 @@ namespace aspect
201203 }
202204 prm.leave_subsection ();
203205 }
206+ else
207+ AssertThrow (false , ExcMessage (" Not a valid plasticity prefactor scheme" ));
204208 }
205209 }
206210 }
0 commit comments