From: Wolfgang Bangerth Date: Sat, 18 Apr 2015 02:33:52 +0000 (-0500) Subject: Also enable computing the H_div seminorm. X-Git-Tag: v8.3.0-rc1~233^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16f19226bfcdfb1bd3abcc52318168ace8042050;p=dealii.git Also enable computing the H_div seminorm. This is joint work with Zhen Tao and Arezou Ghesmati. --- diff --git a/doc/news/changes.h b/doc/news/changes.h index 9d05c3c281..b955d28707 100644 --- a/doc/news/changes.h +++ b/doc/news/changes.h @@ -473,6 +473,13 @@ inconvenience this causes.
(Lei Qiao, 2015/04/19) + +
  • New: The VectorTools::integrate_difference() function can now + also compute the $H_\text{div}$ seminorm, using the + VectorTools::NormType::Hdiv_seminorm argument. +
    + (Zhen Tao, Arezou Ghesmati, Wolfgang Bangerth, 2015/04/17) +
  • New: TrilinosWrappers::BlockSparseMatrix now has member functions TrilinosWrappers::BlockSparseMatrix::domain_paritioner() and @@ -480,7 +487,6 @@ inconvenience this causes. vector of the underlying block Epetra_Map.
    (Matthias Maier, 2015/04/08) -
  • Fixed: The class SymmetricTensor<2,dim> is now usable also for dim>3. diff --git a/include/deal.II/numerics/vector_tools.h b/include/deal.II/numerics/vector_tools.h index 77c8958e71..a35cbd384a 100644 --- a/include/deal.II/numerics/vector_tools.h +++ b/include/deal.II/numerics/vector_tools.h @@ -355,6 +355,10 @@ namespace VectorTools * #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. @@ -1802,7 +1806,12 @@ namespace VectorTools * 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 --git a/include/deal.II/numerics/vector_tools.templates.h b/include/deal.II/numerics/vector_tools.templates.h index 919cd6db2e..77e7605a48 100644 --- a/include/deal.II/numerics/vector_tools.templates.h +++ b/include/deal.II/numerics/vector_tools.templates.h @@ -6278,6 +6278,24 @@ namespace VectorTools diff = std::sqrt(diff); break; + case Hdiv_seminorm: + for (unsigned int q=0; q= 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