@@ -437,22 +437,32 @@ namespace aspect
437437 * JxW;
438438
439439 if (enable_prescribed_dilation)
440- data.local_rhs (i) += (
441- // RHS of - (div u,q) = - (R,q)
442- - pressure_scaling
443- * prescribed_dilation->dilation [q]
444- * scratch.phi_p [i]
445- ) * JxW;
440+ {
441+ const unsigned int index_direction=fe.system_to_component_index (i).first ;
442+ // Only want the velocity components and not the pressure one (which is the last one), so add 1
443+ if (introspection.is_stokes_component (index_direction+1 ))
444+ data.local_rhs (i) += (
445+ // RHS of - (div u,q) = - (R,q)
446+ - pressure_scaling
447+ * prescribed_dilation->dilation [index_direction][q]
448+ * scratch.phi_p [i]
449+ ) * JxW;
450+ }
446451
447452 // Only assemble this term if we are running incompressible, otherwise this term
448453 // is already included on the LHS of the equation.
449454 if (enable_prescribed_dilation && !material_model_is_compressible)
450- data.local_rhs (i) += (
451- // RHS of momentum eqn: - \int 2/3 eta R, div v
452- - 2.0 / 3.0 * eta
453- * prescribed_dilation->dilation [q]
454- * scratch.div_phi_u [i]
455- ) * JxW;
455+ {
456+ const unsigned int index_direction=fe.system_to_component_index (i).first ;
457+ // Only want the velocity components and not the pressure one (which is the last one), so add 1
458+ if (introspection.is_stokes_component (index_direction+1 ))
459+ data.local_rhs (i) += (
460+ // RHS of momentum eqn: - \int 2/3 eta R, div v
461+ - 2.0 / 3.0 * eta
462+ * prescribed_dilation->dilation [index_direction][q]
463+ * scratch.div_phi_u [i]
464+ ) * JxW;
465+ }
456466 }
457467
458468 // and then the matrix, if necessary
@@ -623,7 +633,7 @@ namespace aspect
623633
624634 Assert (!this ->get_parameters ().enable_prescribed_dilation
625635 ||
626- outputs.template get_additional_output_object <MaterialModel::PrescribedPlasticDilation<dim>>()->dilation .size ()
636+ outputs.template get_additional_output_object <MaterialModel::PrescribedPlasticDilation<dim>>()->dilation [ 0 ] .size ()
627637 == n_points, ExcInternalError ());
628638
629639 if (this ->get_newton_handler ().parameters .newton_derivative_scaling_factor != 0 )
0 commit comments