diff --git a/dune/elasticity/materials/mooneyrivlinmaterial.hh b/dune/elasticity/materials/mooneyrivlinmaterial.hh index beeeeb6b274da437d04448cb114d785ca0b9e53d..05ecb976b754f86a9d1e05fa1a0e9704b63d827c 100644 --- a/dune/elasticity/materials/mooneyrivlinmaterial.hh +++ b/dune/elasticity/materials/mooneyrivlinmaterial.hh @@ -90,15 +90,15 @@ public: //! Evaluate the strain energy field_type energy(std::shared_ptr<GridFunction> displace) const { - ctype energy=0; - const auto& leafView = this->basis().getGridView().grid().leafGridView(); + field_type energy=0; + const auto& leafView = this->basis().getGridView(); for (const auto& e : elements(leafView)) { // TODO Get proper quadrature rule // get quadrature rule (should depend on k?) const int order = (e.type().isSimplex()) ? 5 : 5*dim; - const auto& quad = QuadratureRuleCache<ctype, dim>::rule(e.type(), order, 0); + const auto& quad = QuadratureRuleCache<field_type, dim>::rule(e.type(), order, 0); const auto& geometry = e.geometry(); @@ -109,7 +109,7 @@ public: auto integrationElement = geometry.integrationElement(quadPos); // evaluate displacement gradient at the quadrature point - typename BasisGridFunction<Basis,VectorType>::DerivativeType localConfGrad; + typename BasisGridFunction<Basis, typename Base::VectorType>::DerivativeType localConfGrad; if (displace->isDefinedOn(e)) displace->evaluateDerivativeLocal(e, quadPos, localConfGrad); diff --git a/dune/elasticity/materials/neohookeanmaterial.hh b/dune/elasticity/materials/neohookeanmaterial.hh index c6acac5b94f585d57bbe0e683f9ffa3377c2d224..29a23042eea1011dc97dbacb4a85e88eafa484b9 100644 --- a/dune/elasticity/materials/neohookeanmaterial.hh +++ b/dune/elasticity/materials/neohookeanmaterial.hh @@ -107,11 +107,8 @@ public: // loop over quadrature points for (const auto& pt : quad) { - // get quadrature point const auto& quadPos = pt.position(); - - // get integration factor - const ctype integrationElement = geometry.integrationElement(quadPos); + const auto integrationElement = geometry.integrationElement(quadPos); // evaluate displacement gradient at the quadrature point typename BasisGridFunction<Basis, typename Base::VectorType>::DerivativeType localDispGrad; @@ -119,21 +116,17 @@ public: if (displace->isDefinedOn(e)) displace->evaluateDerivativeLocal(e, quadPos, localDispGrad); else - displace->evaluateDerivative(geometry.global(quadPos), localDispGrad); - - SymmetricTensor<dim,ReturnType> strain; - Dune::Elasticity::strain(localDispGrad,strain); + displace->evaluateDerivative(geometry.global(quadPos),localDispGrad); - // the trace + auto strain = Dune::Elasticity::strain(localDispGrad); auto trE = strain.trace(); // turn displacement gradient into deformation gradient Dune::MatrixVector::addToDiagonal(localDispGrad, 1.0); // evaluate the derminante of the deformation gradient - const ReturnType J = localDispGrad.determinant(); - - ctype z = pt.weight()*integrationElement; + auto J = localDispGrad.determinant(); + auto z = pt.weight()*integrationElement; #ifdef LAURSEN energy += z*(0.25*lambda_*(J*J-1)-(lambda_*0.5+mu_)*std::log(J)+mu_*trE); @@ -142,7 +135,6 @@ public: #endif } } - return energy; }