This is joint work with Zhen Tao and Arezou Ghesmati.
<br>
(Lei Qiao, 2015/04/19)
</li>
+
+ <li> New: The VectorTools::integrate_difference() function can now
+ also compute the $H_\text{div}$ seminorm, using the
+ VectorTools::NormType::Hdiv_seminorm argument.
+ <br>
+ (Zhen Tao, Arezou Ghesmati, Wolfgang Bangerth, 2015/04/17)
+ </li>
<li> New: TrilinosWrappers::BlockSparseMatrix now has member functions
TrilinosWrappers::BlockSparseMatrix::domain_paritioner() and
vector of the underlying block Epetra_Map.
<br>
(Matthias Maier, 2015/04/08)
-
</li>
<li> Fixed: The class SymmetricTensor<2,dim> is now usable also for dim>3.
* #L2_norm of the gradient.
*/
H1_seminorm,
+ /**
+ * #L2_norm of the divergence of a vector field
+ */
+ Hdiv_seminorm,
/**
* The square of this norm is the square of the #L2_norm plus the square
* of the #H1_seminorm.
* formula only evaluates the two solutions at these particular points,
* choosing this quadrature formula may indicate an error far smaller than
* it actually is.
- * @param[in] norm The norm $X$ shown above that should be computed.
+ * @param[in] norm The norm $X$ shown above that should be computed. If
+ * the norm is NormType::Hdiv_seminorm, then the finite element on which this
+ * function is called needs to have at least dim vector components,
+ * and the divergence will be computed on the first div components.
+ * This works, for example, on the finite elements used for the
+ * mixed Laplace (step-20) and the Stokes equations (step-22).
* @param[in] weight The additional argument @p weight allows to evaluate
* weighted norms. The weight function may be scalar, establishing a
* spatially variable weight in the domain for all components equally. This
diff = std::sqrt(diff);
break;
+ case Hdiv_seminorm:
+ for (unsigned int q=0; q<n_q_points; ++q)
+ {
+ Assert (n_components >= dim,
+ ExcMessage ("You can only ask for the Hdiv norm for a finite element "
+ "with at least 'dim' components. In that case, this function "
+ "will take the divergence of the first 'dim' components."));
+ double sum = 0;
+ // take the trace of the derivatives, square it, multiply it
+ // with the weight function
+ for (unsigned int k=0; k<dim; ++k)
+ sum += (data.psi_grads[q][k][k] * data.psi_grads[q][k][k]) *
+ data.weight_vectors[q](k);
+ diff += sum * fe_values.JxW(q);
+ }
+ diff = std::sqrt(diff);
+ break;
+
case W1infty_seminorm:
case W1infty_norm:
{
case L2_norm:
case H1_seminorm:
case H1_norm:
+ case Hdiv_seminorm:
exponent = 2.;
break;
switch (norm)
{
case H1_seminorm:
+ case Hdiv_seminorm:
case W1p_seminorm:
case W1infty_seminorm:
update_flags |= UpdateFlags (update_gradients);