diff --git a/dune/elasticity/common/elasticityhelpers.hh b/dune/elasticity/common/elasticityhelpers.hh index 49c2e1b4b9f6b01020ac44880e6619a881329332..c5357b69e6466818cc71123f3692960f6b7d8faa 100644 --- a/dune/elasticity/common/elasticityhelpers.hh +++ b/dune/elasticity/common/elasticityhelpers.hh @@ -9,6 +9,61 @@ namespace Dune { namespace Elasticity { + /** \brief Compute nonlinear strain tensor from a displacement gradient. + * + * \param grad The gradient of the direction in which the linearisation is computed. + * \param strain The tensor to store the strain in. + */ + template <int dim> + void computeNonlinearStrain(const Dune::FieldMatrix<double, dim, dim>& grad, SymmetricTensor<dim>& strain) { + strain = 0; + for (int i=0; i<dim ; ++i) { + strain(i,i) +=grad[i][i]; + + for (int k=0;k<dim;++k) + strain(i,i) += 0.5*grad[k][i]*grad[k][i]; + + for (int j=i+1; j<dim; ++j) { + strain(i,j) += 0.5*(grad[i][j] + grad[j][i]); + for (int k=0;k<dim;++k) + strain(i,j) += 0.5*grad[k][i]*grad[k][j]; + } + } + } + + /** \brief Compute linearised strain at the identity from a given displacement gradient. + * + * \param grad The gradient of the direction in which the linearisation is computed. + * \param strain The tensor to store the strain in. + */ + template <int dim> + void computeLinearisedStrain(const Dune::FieldMatrix<double, dim, dim>& grad, SymmetricTensor<dim>& strain) { + for (int i=0; i<dim ; ++i) + { + strain(i,i) = grad[i][i]; + for (int j=i+1; j<dim; ++j) + strain(i,j) = 0.5*(grad[i][j] + grad[j][i]); + } + } + + + /** \brief Compute linearised strain at a prescribed configuration in the direction of a given displacement gradient. + * + * \param grad The gradient of the direction in which the linearisation is computed. + * \param conf The deformation gradient(!) of the configuration at which the linearisation is evaluated. + * \param strain The tensor to store the strain in. + */ + template <int dim> + void computeLinearisedStrain(const Dune::FieldMatrix<double, dim, dim>& grad, const Dune::FieldMatrix<double, dim, dim>& conf, + SymmetricTensor<dim>& strain) { + strain = 0; + for (int i=0;i<dim; i++) + for (int j=i;j<dim;j++) + for (int k=0;k<dim;k++) + strain(i,j)+= grad[k][i]*conf[k][j]+conf[k][i]*grad[k][j]; + strain *= 0.5; + } + /** \brief The penalty term \f$ \Gamma \f$ */ double Gamma(double x) { return x*x - std::log(x);