Skip to content
Snippets Groups Projects
Commit 44b471bd authored by akbib's avatar akbib Committed by akbib
Browse files

The displacement at which the nonlinear strain energy is linearized is now stored as a raw pointer.

[[Imported from SVN: r12655]]
parent 052647c1
Branches
Tags
No related merge requests found
......@@ -36,10 +36,11 @@ class GeomNonlinLinearizedStVenantAssembler
static const int dim = GridType::dimension;
typedef typename GridType::ctype ctype;
typedef VirtualGridFunction<GridType, Dune::FieldVector<ctype,GridType::dimension> > GridFunction;
typedef Dune::VirtualFunction<Dune::FieldVector<ctype,dim>, Dune::FieldVector<ctype,dim> > Function;
typedef VirtualGridFunction<GridType, Dune::FieldVector<ctype,dim> > GridFunction;
public:
typedef typename Dune::FieldMatrix<ctype,GridType::dimension,GridType::dimension> T;
typedef typename Dune::FieldMatrix<ctype,dim,dim> T;
typedef typename LocalOperatorAssembler < GridType, TrialLocalFE, AnsatzLocalFE, T >::Element Element;
typedef typename LocalOperatorAssembler < GridType, TrialLocalFE, AnsatzLocalFE,T >::BoolMatrix BoolMatrix;
......@@ -47,7 +48,7 @@ public:
GeomNonlinLinearizedStVenantAssembler(double E, double nu,const Dune::shared_ptr<GridFunction> configuration):
E_(E), nu_(nu), configuration_(configuration)
E_(E), nu_(nu), configuration_(configuration.get())
{}
GeomNonlinLinearizedStVenantAssembler(double E, double nu):
......@@ -163,15 +164,16 @@ public:
}
}
}
}
/** \brief Set new configuration to be assembled at. Needed e.g. during Newton iteration.*/
void setConfiguration(Dune::shared_ptr<GridFunction> newConfig) {
configuration_ = newConfig;
void setConfiguration(Function* newConfig) {
configuration_ = dynamic_cast<GridFunction*>(newConfig);
if (!configuration_)
DUNE_THROW(Dune::Exception,"In [GeomNonlinLinearizedStVenantAssembler]: You need to provide a GridFunction describing the displacement!");
}
private:
protected:
/** \brief Young's modulus */
double E_;
......@@ -179,7 +181,7 @@ private:
double nu_;
/** \brief The configuration at which the linearized operator is evaluated.*/
Dune::shared_ptr<GridFunction> configuration_;
GridFunction* configuration_;
/** \brief Compute nonlinear strain tensor from the deformation gradient. */
void computeStrain(const Dune::FieldMatrix<ctype, dim, dim>& grad, SymmetricTensor<dim>& strain) const {
......
......@@ -34,19 +34,20 @@ class GeomNonlinElasticityFunctionalAssembler :
typedef LocalFunctionalAssembler<GridType, TrialLocalFE, T> Base;
public:
using typename Base::Element;
using typename Base::LocalVector;
typedef typename Base::Element Element;
typedef typename Base::LocalVector LocalVector;
typedef Dune::VirtualFunction<T, T> Function;
typedef VirtualGridFunction<GridType, T> GridFunction;
//! Create assembler for grid
GeomNonlinElasticityFunctionalAssembler(ctype E,ctype nu, const Dune::shared_ptr<GridFunction> configuration) :
E_(E), nu_(nu),
configuration_(configuration)
configuration_(configuration.get())
{}
//! Create assembler for grid
GeomNonlinElasticityFunctionalAssembler(ctype E, ctype nu) :
E_(E), nu_(nu)
E_(E), nu_(nu), configuration_(NULL)
{}
void assemble(const Element& element, LocalVector& localVector, const TrialLocalFE& tFE) const
......@@ -94,7 +95,6 @@ public:
// transform gradients
gradients[i] = 0.0;
invJacobian.umv(referenceGradients[i][0], gradients[i]);
}
// evaluate the displacement gradients of the configuration at the quadrature point
......@@ -146,11 +146,14 @@ public:
}
/** \brief Set new configuration. In Newton iterations this needs to be assembled more than one time.*/
void setConfiguration(Dune::shared_ptr<GridFunction> newConfig) {
configuration_ = newConfig;
void setConfiguration(Function* newConfig) {
configuration_ = dynamic_cast<GridFunction*>(newConfig);
if (!configuration_)
DUNE_THROW(Dune::Exception,"In [GeomNonlinStVenantFunctionalAssembler]: GridFunction cast failed!");
}
private:
protected:
/** \brief Young's modulus */
ctype E_;
......@@ -158,7 +161,7 @@ private:
ctype nu_;
/** \brief The configuration at which the functional is evaluated.*/
Dune::shared_ptr<GridFunction> configuration_;
GridFunction* configuration_;
/** \brief Compute nonlinear strain tensor from the deformation gradient. */
void computeStrain(const Dune::FieldMatrix<ctype, dim, dim>& grad, SymmetricTensor<dim>& strain) const {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment