From bd9b581f9f564e771eebe7538dbe392f79b7ebab Mon Sep 17 00:00:00 2001 From: Jonathan Youett <youett@math.fu-berlin.de> Date: Wed, 10 Oct 2018 10:49:40 +0200 Subject: [PATCH] Minor cleanup --- .../materials/mooneyrivlinmaterial.hh | 8 ++++---- .../elasticity/materials/neohookeanmaterial.hh | 18 +++++------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/dune/elasticity/materials/mooneyrivlinmaterial.hh b/dune/elasticity/materials/mooneyrivlinmaterial.hh index beeeeb6..05ecb97 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 c6acac5..29a2304 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; } -- GitLab