Skip to content
Snippets Groups Projects
Commit 56079287 authored by Oliver Sander's avatar Oliver Sander
Browse files

Remove obsolete implementation of NeoHookean material

parent f803dcd2
No related branches found
No related tags found
No related merge requests found
...@@ -35,148 +35,6 @@ ...@@ -35,148 +35,6 @@
* - \f$J\f$ the determinant of the deformation gradient * - \f$J\f$ the determinant of the deformation gradient
* - \f$\lambda\f$,\f$\mu\f$ material parameters (first lame and shear modulus) * - \f$\lambda\f$,\f$\mu\f$ material parameters (first lame and shear modulus)
*/ */
template <class Basis>
class NeoHookeanMaterial : public Material<Basis>
{
public:
typedef Material<Basis> Base;
typedef typename Base::GridType GridType;
typedef typename Base::GlobalBasis GlobalBasis;
typedef typename Base::Lfe Lfe;
typedef typename Base::LocalLinearization LocalLinearization;
typedef typename Base::LocalHessian LocalHessian;
typedef typename Base::VectorType VectorType;
typedef typename Base::GridFunction GridFunction;
typedef typename Base::ReturnType ReturnType;
private:
using Base::dim;
typedef typename GridType::ctype ctype;
typedef NeoHookeFunctionalAssembler<GridType,Lfe> NeoLinearization;
typedef NeoHookeOperatorAssembler<GridType, Lfe, Lfe> NeoHessian;
typedef typename GridType::template Codim<0>::Geometry::LocalCoordinate LocalCoordinate;
typedef typename GridType::template Codim<0>::LeafIterator ElementIterator;
public:
NeoHookeanMaterial() :
lambda_(1.0),
mu_(0.3)
{}
NeoHookeanMaterial(const Basis& basis, ReturnType E, ReturnType nu) :
Base(basis)
{
lambda_ = E*nu / ((1+nu)*(1-2*nu));
mu_ = E / (2*(1+nu));
localLinearization_ = std::shared_ptr<NeoLinearization>(new NeoLinearization(lambda_,mu_));
localHessian_ = std::shared_ptr<NeoHessian>(new NeoHessian(lambda_,mu_));
}
void setup(ReturnType E, ReturnType nu, const Basis& basis)
{
lambda_ = E*nu / ((1+nu)*(1-2*nu));
mu_ = E / (2*(1+nu));
localLinearization_ = std::shared_ptr<NeoLinearization>(new NeoLinearization(lambda_,mu_));
localHessian_ = std::shared_ptr<NeoHessian>(new NeoHessian(lambda_,mu_));
this->basis_ = &basis;
}
//! Evaluate the strain energy
ReturnType energy(std::shared_ptr<GridFunction> displace)
{
ReturnType energy=0;
const GridType& grid = this->basis().getGridView().grid();
ElementIterator eIt = grid.template leafbegin<0>();
ElementIterator eItEnd = grid.template leafend<0>();
for (;eIt != eItEnd; ++eIt) {
// TODO Get proper quadrature rule
// get quadrature rule
const int order = (eIt->type().isSimplex()) ? 4 : 4*dim;
const Dune::template QuadratureRule<ctype, dim>& quad = QuadratureRuleCache<ctype, dim>::rule(eIt->type(),order,0);
// loop over quadrature points
for (size_t pt=0; pt < quad.size(); ++pt) {
// get quadrature point
const LocalCoordinate& quadPos = quad[pt].position();
// get integration factor
const ctype integrationElement = eIt->geometry().integrationElement(quadPos);
// evaluate displacement gradient at the quadrature point
typename BasisGridFunction<Basis,VectorType>::DerivativeType localDispGrad;
if (displace->isDefinedOn(*eIt))
displace->evaluateDerivativeLocal(*eIt, quadPos, localDispGrad);
else
displace->evaluateDerivative(eIt->geometry().global(quadPos),localDispGrad);
SymmetricTensor<dim> strain;
Dune::Elasticity::computeNonlinearStrain(localDispGrad,strain);
// the trace
ReturnType trE(0);
for (int i=0; i<dim; i++)
trE += strain(i,i);
// turn displacement gradient into deformation gradient
for (int i=0;i<dim;i++)
localDispGrad[i][i] += 1;
// evaluate the derminante of the deformation gradient
const ReturnType J = localDispGrad.determinant();
ctype z = quad[pt].weight()*integrationElement;
#ifdef LAURSEN
energy += z*(0.25*lambda_*(J*J-1)-(lambda_*0.5+mu_)*std::log(J)+mu_*trE);
#else
energy += z*(0.5*lambda_*(J-1)*(J-1)-2*mu_*std::log(J)+mu_*trE);
#endif
}
}
return energy;
}
//! Return the local assembler of the first derivative of the strain energy
LocalLinearization& firstDerivative(std::shared_ptr<GridFunction> displace) {
localLinearization_->setConfiguration(displace);
return *localLinearization_;
}
//! Return the local assembler of the second derivative of the strain energy
LocalHessian& secondDerivative(std::shared_ptr<GridFunction> displace) {
localHessian_->setConfiguration(displace);
return *localHessian_;
}
private:
//! First derivative of the strain energy
std::shared_ptr<NeoLinearization> localLinearization_;
//! Second derivative of the strain energy
std::shared_ptr<NeoHessian> localHessian_;
//! First Lame constant
ReturnType lambda_;
//! Second Lame constant
ReturnType mu_;
};
//! Local energy for a geometric exact St. Venant--Kirchhoff material
template <class GridType, class LocalFiniteElement> template <class GridType, class LocalFiniteElement>
class LocalNeoHookeanEnergy : public Adolc::LocalEnergy<GridType, LocalFiniteElement,GridType::dimension> class LocalNeoHookeanEnergy : public Adolc::LocalEnergy<GridType, LocalFiniteElement,GridType::dimension>
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment