From 8743f4b4e9e1b696c0bae21f13eff3d443d4cf6a Mon Sep 17 00:00:00 2001 From: kanschat Date: Thu, 9 Aug 2012 17:44:04 +0000 Subject: [PATCH] Add residuals git-svn-id: https://svn.dealii.org/trunk@25832 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/deal.II/integrators/divergence.h | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/deal.II/include/deal.II/integrators/divergence.h b/deal.II/include/deal.II/integrators/divergence.h index 8734fff170..70128a4f92 100644 --- a/deal.II/include/deal.II/integrators/divergence.h +++ b/deal.II/include/deal.II/integrators/divergence.h @@ -102,6 +102,40 @@ namespace LocalIntegrators } } } + +/** + * The residual of the divergence operator in strong form. + * \f[ + * \int_Z v\nabla \cdot \mathbf u \,dx + * \f] + * This is the strong divergence operator and the trial + * space should be at least Hdiv. The test functions + * may be discontinuous. + * + * The function cell_matrix() is the Frechet derivative of this function with respect + * to the test functions. + */ + template + void cell_residual( + Vector& result, + const FEValuesBase& fetest, + const VectorSlice > > >& input, + const double factor = 1.) + { + AssertDimension(fetest.get_fe().n_components(), 1); + AssertVectorVectorDimension(input, dim, fetest.n_quadrature_points); + const unsigned int t_dofs = fetest.dofs_per_cell; + Assert (result.size() == t_dofs, ExcDimensionMismatch(result.size(), t_dofs)); + + for (unsigned k=0;kH1. The test functions + * may be discontinuous. + * + * The function cell_residual() is the Frechet derivative of this function with respect to the test functions. + */ + template + void gradient_residual( + Vector& result, + const FEValuesBase& fetest, + const std::vector >& input, + const double factor = 1.) + { + AssertDimension(fetest.get_fe().n_components(), dim); + AssertDimension(input.size(), fetest.n_quadrature_points); + const unsigned int t_dofs = fetest.dofs_per_cell; + Assert (result.size() == t_dofs, ExcDimensionMismatch(result.size(), t_dofs)); + + for (unsigned k=0;k