From 7e0489428d287ccd787546624bb9fa1db0e52cf9 Mon Sep 17 00:00:00 2001 From: Daniel Arndt <daniel.arndt@iwr.uni-heidelberg.de> Date: Sun, 12 May 2019 18:17:28 +0200 Subject: [PATCH] Revert #8082 This reverts commit f6c96c520478d963cd9ebb6f4877d59e3ddb8b01. --- include/deal.II/base/symmetric_tensor.h | 76 ++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 3 deletions(-) diff --git a/include/deal.II/base/symmetric_tensor.h b/include/deal.II/base/symmetric_tensor.h index ed2b550596..f164142472 100644 --- a/include/deal.II/base/symmetric_tensor.h +++ b/include/deal.II/base/symmetric_tensor.h @@ -31,15 +31,15 @@ DEAL_II_NAMESPACE_OPEN template <int rank, int dim, typename Number = double> class SymmetricTensor; -template <int dim, typename Number = double> +template <int dim, typename Number> SymmetricTensor<2, dim, Number> unit_symmetric_tensor(); -template <int dim, typename Number = double> +template <int dim, typename Number> SymmetricTensor<4, dim, Number> deviator_tensor(); -template <int dim, typename Number = double> +template <int dim, typename Number> SymmetricTensor<4, dim, Number> identity_tensor(); @@ -3310,6 +3310,23 @@ unit_symmetric_tensor() +/** + * Return a unit symmetric tensor of rank 2, i.e., the dim-by-dim identity + * matrix. This specialization of the function uses <code>double</code> as the + * data type for the elements. + * + * @relatesalso SymmetricTensor + * @author Wolfgang Bangerth, 2005 + */ +template <int dim> +inline SymmetricTensor<2, dim> +unit_symmetric_tensor() +{ + return unit_symmetric_tensor<dim, double>(); +} + + + /** * Return the tensor of rank 4 that, when multiplied by a symmetric rank 2 * tensor <tt>t</tt> returns the deviator $\textrm{dev}\ t$. It is the @@ -3351,6 +3368,29 @@ deviator_tensor() +/** + * Return the tensor of rank 4 that, when multiplied by a symmetric rank 2 + * tensor <tt>t</tt> returns the deviator <tt>dev t</tt>. It is the operator + * representation of the linear deviator operator. + * + * For every tensor <tt>t</tt>, there holds the identity + * <tt>deviator(t)==deviator_tensor<dim>()*t</tt>, up to numerical + * round-off. The reason this operator representation is provided is that one + * sometimes needs to invert operators like <tt>identity_tensor<dim>() + + * delta_t*deviator_tensor<dim>()</tt> or similar. + * + * @relatesalso SymmetricTensor + * @author Wolfgang Bangerth, 2005 + */ +template <int dim> +inline SymmetricTensor<4, dim> +deviator_tensor() +{ + return deviator_tensor<dim, double>(); +} + + + /** * Return the fourth-order symmetric identity tensor which maps symmetric * second-order tensors to themselves. @@ -3399,6 +3439,36 @@ identity_tensor() +/** + * Return the tensor of rank 4 that, when multiplied by a symmetric rank 2 + * tensor <tt>t</tt> returns the deviator <tt>dev t</tt>. It is the operator + * representation of the linear deviator operator. + * + * Note that this tensor, even though it is the identity, has a somewhat funny + * form, and in particular does not only consist of zeros and ones. For + * example, for <tt>dim=2</tt>, the identity tensor has all zero entries + * except for <tt>id[0][0][0][0]=id[1][1][1][1]=1</tt> and + * <tt>id[0][1][0][1]=id[0][1][1][0]=id[1][0][0][1]=id[1][0][1][0]=1/2</tt>. + * To see why this factor of 1/2 is necessary, consider computing <tt>A=Id . + * B</tt>. For the element <tt>a_01</tt> we have <tt>a_01=id_0100 b_00 + + * id_0111 b_11 + id_0101 b_01 + id_0110 b_10</tt>. On the other hand, we need + * to have <tt>a_01=b_01</tt>, and symmetry implies <tt>b_01=b_10</tt>, + * leading to <tt>a_01=(id_0101+id_0110) b_01</tt>, or, again by symmetry, + * <tt>id_0101=id_0110=1/2</tt>. Similar considerations hold for the three- + * dimensional case. + * + * @relatesalso SymmetricTensor + * @author Wolfgang Bangerth, 2005 + */ +template <int dim> +inline SymmetricTensor<4, dim> +identity_tensor() +{ + return identity_tensor<dim, double>(); +} + + + /** * Invert a symmetric rank-2 tensor. * -- 2.39.5