00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef NONLINEARELASTICITYSOLVER_HPP_
00029 #define NONLINEARELASTICITYSOLVER_HPP_
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00043
00044 #include "AbstractNonlinearElasticitySolver.hpp"
00045
00046
00047 #include "QuadraticMesh.hpp"
00048 #include "GaussianQuadratureRule.hpp"
00049
00060 template<size_t DIM>
00061 class NonlinearElasticitySolver : public AbstractNonlinearElasticitySolver<DIM>
00062 {
00063 friend class TestNonlinearElasticitySolver;
00064
00065 protected:
00066
00068 static const size_t NUM_VERTICES_PER_ELEMENT = DIM+1;
00070 static const size_t NUM_NODES_PER_ELEMENT = (DIM+1)*(DIM+2)/2;
00072 static const size_t STENCIL_SIZE = DIM*NUM_NODES_PER_ELEMENT + NUM_VERTICES_PER_ELEMENT;
00074 static const size_t NUM_NODES_PER_BOUNDARY_ELEMENT = DIM*(DIM+1)/2;
00076 static const size_t BOUNDARY_STENCIL_SIZE = DIM*NUM_NODES_PER_BOUNDARY_ELEMENT + DIM;
00077
00082 QuadraticMesh<DIM>* mpQuadMesh;
00083
00085 std::vector<BoundaryElement<DIM-1,DIM>*> mBoundaryElements;
00086
00088 GaussianQuadratureRule<DIM>* mpQuadratureRule;
00089
00091 GaussianQuadratureRule<DIM-1>* mpBoundaryQuadratureRule;
00092
00110 virtual void AssembleOnElement(Element<DIM, DIM>& rElement,
00111 c_matrix<double, STENCIL_SIZE, STENCIL_SIZE >& rAElem,
00112 c_matrix<double, STENCIL_SIZE, STENCIL_SIZE >& rAElemPrecond,
00113 c_vector<double, STENCIL_SIZE>& rBElem,
00114 bool assembleResidual,
00115 bool assembleJacobian);
00116
00133 virtual void AssembleOnBoundaryElement(BoundaryElement<DIM-1, DIM>& rBoundaryElement,
00134 c_matrix<double, BOUNDARY_STENCIL_SIZE, BOUNDARY_STENCIL_SIZE>& rAelem,
00135 c_vector<double, BOUNDARY_STENCIL_SIZE>& rBelem,
00136 c_vector<double, DIM>& rTraction,
00137 bool assembleResidual,
00138 bool assembleJacobian);
00139
00156 void FormInitialGuess();
00157
00167 void AssembleSystem(bool assembleResidual, bool assembleJacobian);
00168
00174 void Initialise(std::vector<c_vector<double,DIM> >* pFixedNodeLocations);
00175
00180 void AllocateMatrixMemory();
00181
00200 virtual void ComputeStressAndStressDerivative(AbstractIncompressibleMaterialLaw<DIM>* pMaterialLaw,
00201 c_matrix<double,DIM,DIM>& rC,
00202 c_matrix<double,DIM,DIM>& rInvC,
00203 double pressure,
00204 unsigned elementIndex,
00205 unsigned currentQuadPointGlobalIndex,
00206 c_matrix<double,DIM,DIM>& rT,
00207 FourthOrderTensor<DIM,DIM,DIM,DIM>& rDTdE,
00208 bool computeDTdE);
00209
00210 public:
00211
00225 NonlinearElasticitySolver(QuadraticMesh<DIM>* pQuadMesh,
00226 AbstractIncompressibleMaterialLaw<DIM>* pMaterialLaw,
00227 c_vector<double,DIM> bodyForce,
00228 double density,
00229 std::string outputDirectory,
00230 std::vector<unsigned>& fixedNodes,
00231 std::vector<c_vector<double,DIM> >* pFixedNodeLocations = NULL);
00232
00244 NonlinearElasticitySolver(QuadraticMesh<DIM>* pQuadMesh,
00245 std::vector<AbstractIncompressibleMaterialLaw<DIM>*>& rMaterialLaws,
00246 c_vector<double,DIM> bodyForce,
00247 double density,
00248 std::string outputDirectory,
00249 std::vector<unsigned>& fixedNodes,
00250 std::vector<c_vector<double,DIM> >* pFixedNodeLocations = NULL);
00251
00253 ~NonlinearElasticitySolver();
00254
00263 void SetSurfaceTractionBoundaryConditions(std::vector<BoundaryElement<DIM-1,DIM>*>& rBoundaryElements,
00264 std::vector<c_vector<double,DIM> >& rSurfaceTractions);
00265
00273 void SetFunctionalTractionBoundaryCondition(std::vector<BoundaryElement<DIM-1,DIM>*> rBoundaryElements,
00274 c_vector<double,DIM> (*pFunction)(c_vector<double,DIM>&));
00275
00276
00280 std::vector<double>& rGetPressures();
00281
00285 std::vector<c_vector<double,DIM> >& rGetDeformedPosition();
00286 };
00287
00288 #endif