Commit 5df2ae7a authored by akbib's avatar akbib Committed by akbib@FU-BERLIN.DE
Browse files

change the structure of the localogdenassembler and ogdenassembler:

localogdenassembler is now derived from localassembler.hh and
ogdenassembler is now derived from operatorassembler.hh
 

[[Imported from SVN: r10471]]
parent b5f0bcab
......@@ -7,7 +7,8 @@
#include <dune/istl/matrixindexset.hh>
#include <dune/istl/matrix.hh>
#include <dune/disc/operators/localstiffness.hh>
#include <dune/ag-common/assemblers/localassembler.hh>
#include <dune/ag-common/assemblers/operatorassembler.hh>
/**
* @brief compute local stiffness matrix for the Ogden elasticity operator
......@@ -28,35 +29,31 @@
All the numbering is with respect to the reference element and the
Lagrange shape functions
\tparam GridView a DUNE grid view type
\tparam RT type used for return values
\tparam GridType a DUNE grid type
\tparam TiralLocalFE a local finite element of the trial space
\tparam AnsatzLocalFE a local finite element of the trial space
*/
template<class GridView, class RT>
template <class GridType, class TrialLocalFE, class AnsatzLocalFE>
class OgdenMaterialLocalStiffness
: public Dune::LocalStiffness<GridView,RT,GridView::dimension>
:public LocalAssembler < GridType, TrialLocalFE, AnsatzLocalFE, Dune::FieldMatrix<double,GridType::dimension,GridType::dimension> >
{
// grid types
typedef typename GridView::Grid::ctype DT;
typedef typename GridView::template Codim<0>::Entity Entity;
// some other sizes
enum {dim=GridView::dimension};
//! The engineers' way of writing a symmetric second-order tensor
typedef Dune::FieldVector<double, (dim+1)*dim/2> SymmTensor;
public:
// define the number of components of your system, this is used outside
// to allocate the correct size of (dense) blocks with a FieldMatrix
enum {m=dim};
// types for matrics, vectors and boundary conditions
typedef Dune::FieldMatrix<RT,m,m> MBlockType; // one entry in the stiffness matrix
typedef Dune::FieldVector<RT,m> VBlockType; // one entry in the global vectors
typedef Dune::array<Dune::BoundaryConditions::Flags,m> BCBlockType; // componentwise boundary conditions
// /////////////////////////////////
// The material parameters
// /////////////////////////////////
public:
typedef typename Dune::FieldMatrix<double,GridType::dimension,GridType::dimension> T;
typedef typename LocalAssembler < GridType, TrialLocalFE, AnsatzLocalFE, T >::ElementPointer ElementPointer;
typedef typename LocalAssembler < GridType, TrialLocalFE, AnsatzLocalFE,T >::BoolMatrix BoolMatrix;
typedef typename LocalAssembler < GridType, TrialLocalFE, AnsatzLocalFE,T >::LocalMatrix LocalMatrix;
// some other sizes
enum {dim=GridType::dimension};
// define the number of components of your system, this is used outside
// to allocate the correct size of (dense) blocks with a FieldMatrix
enum {m=dim};
// /////////////////////////////////
// The material parameters
// /////////////////////////////////
/** \brief Material constants */
double lambda_;
......@@ -82,32 +79,28 @@
d_ = d;
}
//! assemble local stiffness matrix for given element and order
/*! On exit the following things have been done:
- The stiffness matrix for the given entity and polynomial degree has been assembled and is
accessible with the mat() method.
- The boundary conditions have been evaluated and are accessible with the bc() method
- The right hand side has been assembled. It contains either the value of the essential boundary
condition or the assembled source term and neumann boundary condition. It is accessible via the rhs() method.
@param[in] e a codim 0 entity reference
\param[in] localSolution Current local solution, because this is a nonlinear assembler
@param[in] k order of Lagrange basis
*/
void assemble (const Entity& e,
const Dune::BlockVector<Dune::FieldVector<double, dim> >& localSolution,
int k=1);
/** \todo Remove this once this methods is not in base class LocalStiffness anymore */
void assemble (const Entity& e, int k=1)
void indices(const ElementPointer& element, BoolMatrix& isNonZero, const TrialLocalFE& tFE, const AnsatzLocalFE& aFE) const
{
isNonZero = true;
}
void assemble(const ElementPointer& element,
const Dune::BlockVector<Dune::FieldVector<double,dim> >& localSolution,
LocalMatrix& localMatrix,
const TrialLocalFE& tFE, const AnsatzLocalFE& aFE) const
{
DUNE_THROW(Dune::NotImplemented, "!");
}
//! should allow to assemble boundary conditions only
void assembleBoundaryCondition (const Entity& e, int k=1)
{
}
Dune::BlockVector<Dune::FieldVector<double,dim>> dummy;
dummy=0;
assemble(element,localSolution,localMatrix,dummy,tFE,aFE);
}
//this method is used by the OgdenAssembler to assemble the matrix and the right hand side
void assemble(const ElementPointer& element,
const Dune::BlockVector<Dune::FieldVector<double,dim> >& localSolution,
LocalMatrix& localMatrix, Dune::BlockVector<Dune::FieldVector<double,dim>>& localRhs,
const TrialLocalFE& tFE, const AnsatzLocalFE& aFE) const;
};
......@@ -117,14 +110,17 @@ namespace Dune
/** \brief The FEM operator for elasticity with an Ogden material
*/
template <class GridType>
class OgdenAssembler {
typedef typename GridType::template Codim<0>::Entity EntityType;
typedef typename GridType::template Codim<0>::LevelIterator ElementIterator;
template <class TrialBasis, class AnsatzBasis>
class OgdenAssembler :
public OperatorAssembler<TrialBasis,AnsatzBasis>
{
public:
typedef typename TrialBasis::GridView GridView;
typedef typename GridView::template Codim<0>::Iterator ElementIterator;
//! The grid's dimension
enum { dim = GridType::dimension };
//! The grid's dimension
enum { dim = GridView::dimension };
enum { elementOrder = 1 };
......@@ -133,18 +129,7 @@ namespace Dune
//!
typedef FieldMatrix<double, dim, dim> MatrixBlock;
//!
typedef FieldVector<double, (dim+1)*dim/2> SymmTensor;
public:
/** \todo Does actually belong into the base class */
BCRSMatrix<MatrixBlock>* matrix_;
/** \todo Does actually belong into the base class */
const GridType* grid_;
/** \brief Material constants */
double lambda_;
double mu_;
......@@ -153,27 +138,14 @@ namespace Dune
double d_;
//! ???
OgdenAssembler() :
grid_(NULL), matrix_(NULL)
{
d_ = 1e5;
lambda_ = 144230;
mu_ = 96153;
}
//! ???
OgdenAssembler(const GridType& grid) :
grid_(&grid), matrix_(NULL)
{
d_ = 1e5;
lambda_ = 144230;
mu_ = 96153;
}
~OgdenAssembler() {
delete(matrix_);
}
OgdenAssembler(const TrialBasis& tBasis, const AnsatzBasis& aBasis) :
OperatorAssembler<TrialBasis,AnsatzBasis>(tBasis,aBasis)
{
d_ = 1e5;
lambda_ = 144230;
mu_ = 96153;
}
/** \brief Set the material parameters
\param E Young's modulus
\param nu Poisson ratio
......@@ -182,27 +154,20 @@ namespace Dune
lambda_ = E*nu / ((1+nu)*(1-2*nu));
mu_ = E / (2*(1+nu));
}
//! Returns the actual matrix if it is assembled
const BCRSMatrix<FieldMatrix<double, dim, dim> >* getMatrix() const {
return this->matrix_;
}
void getNeighborsPerVertex(MatrixIndexSet& nb) const;
/** \brief Assemble the tangent stiffness matrix and the right hand side
*/
void assembleMatrix(const BlockVector<FieldVector<double, dim> >& sol,
BlockVector<FieldVector<double, dim> >& rhs);
/** \brief Compute the element tangent stiffness matrix */
void assembleProblem(BCRSMatrix<FieldMatrix<double,dim,dim>>& globalMatrix,
const BlockVector<FieldVector<double, dim> >& sol,
BlockVector<FieldVector<double, dim> >& rhs);
/* Not implemented and not used?
/** \brief Compute the element tangent stiffness matrix /
template <class MatrixType>
void getLocalMatrix( EntityType &entity,
const BlockVector<FieldVector<double, dim> >& localSolution,
const int matSize, MatrixType& mat,
BlockVector<FieldVector<double, dim> >& localRhs) const;
*/
/** \brief Compute the Ogden energy of a deformation state */
double computeEnergy(const BlockVector<FieldVector<double, dim> >& sol) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment