NonlinearElasticityAssembler.hpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2009
00004 
00005 University of Oxford means the Chancellor, Masters and Scholars of the
00006 University of Oxford, having an administrative office at Wellington
00007 Square, Oxford OX1 2JD, UK.
00008 
00009 This file is part of Chaste.
00010 
00011 Chaste is free software: you can redistribute it and/or modify it
00012 under the terms of the GNU Lesser General Public License as published
00013 by the Free Software Foundation, either version 2.1 of the License, or
00014 (at your option) any later version.
00015 
00016 Chaste is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00019 License for more details. The offer of Chaste under the terms of the
00020 License is subject to the License being interpreted in accordance with
00021 English Law and subject to any action against the University of Oxford
00022 being under the jurisdiction of the English Courts.
00023 
00024 You should have received a copy of the GNU Lesser General Public License
00025 along with Chaste. If not, see <http://www.gnu.org/licenses/>.
00026 
00027 */
00028 #ifndef NONLINEARELASTICITYASSEMBLER_HPP_
00029 #define NONLINEARELASTICITYASSEMBLER_HPP_
00030 
00031 /* 
00032  * NOTE ON COMPILATION ERRORS:
00033  * 
00034  * This file won't compile with Intel icpc version 9.1.039, with error message: 
00035  * "Terminate with:
00036   (0): internal error: backend signals"
00037  *
00038  * Try recompiling with icpc version 10.0.025.
00039  */
00040  
00041 
00042 //todos:
00043 //factor out Dof handling?
00044 
00045 #include "AbstractNonlinearElasticityAssembler.hpp"
00046 //#include "LinearBasisFunction.hpp"
00047 //#include "QuadraticBasisFunction.hpp"
00048 #include "QuadraticMesh.hpp"
00049 #include "GaussianQuadratureRule.hpp"
00050 
00061 template<size_t DIM>
00062 class NonlinearElasticityAssembler : public AbstractNonlinearElasticityAssembler<DIM>
00063 {
00064     friend class TestNonlinearElasticityAssembler;
00065     
00066 protected:
00067     static const size_t NUM_VERTICES_PER_ELEMENT = DIM+1;
00068     static const size_t NUM_NODES_PER_ELEMENT = (DIM+1)*(DIM+2)/2; // assuming quadratic
00069     static const size_t STENCIL_SIZE = DIM*NUM_NODES_PER_ELEMENT + NUM_VERTICES_PER_ELEMENT; 
00070     static const size_t NUM_NODES_PER_BOUNDARY_ELEMENT = DIM*(DIM+1)/2;
00071     static const size_t BOUNDARY_STENCIL_SIZE = DIM*NUM_NODES_PER_BOUNDARY_ELEMENT + DIM; 
00072 
00077     QuadraticMesh<DIM>* mpQuadMesh;
00078 
00079 
00081     std::vector<BoundaryElement<DIM-1,DIM>*> mBoundaryElements;
00082 
00083     GaussianQuadratureRule<DIM>* mpQuadratureRule;
00084     GaussianQuadratureRule<DIM-1>* mpBoundaryQuadratureRule;
00085     
00091     virtual void AssembleOnElement(Element<DIM, DIM>& rElement,
00092                                    c_matrix<double, STENCIL_SIZE, STENCIL_SIZE >& rAElem,
00093                                    c_matrix<double, STENCIL_SIZE, STENCIL_SIZE >& rAElemPrecond,
00094                                    c_vector<double, STENCIL_SIZE>& rBElem,
00095                                    bool assembleResidual,
00096                                    bool assembleJacobian);
00097     
00103     virtual void AssembleOnBoundaryElement(BoundaryElement<DIM-1,DIM>& rBoundaryElement,
00104                                            c_matrix<double,BOUNDARY_STENCIL_SIZE,BOUNDARY_STENCIL_SIZE>& rAelem,
00105                                            c_vector<double,BOUNDARY_STENCIL_SIZE>& rBelem,
00106                                            c_vector<double,DIM>& rTraction,
00107                                            bool assembleResidual,
00108                                            bool assembleJacobian);
00109 
00126     void FormInitialGuess();
00127 
00134     void AssembleSystem(bool assembleResidual, bool assembleJacobian);
00135 
00136 
00137     void Initialise(std::vector<c_vector<double,DIM> >* pFixedNodeLocations);
00138 
00139 public:
00145     NonlinearElasticityAssembler(QuadraticMesh<DIM>* pQuadMesh,
00146                                  AbstractIncompressibleMaterialLaw<DIM>* pMaterialLaw,
00147                                  c_vector<double,DIM> bodyForce,
00148                                  double density,
00149                                  std::string outputDirectory,
00150                                  std::vector<unsigned>& fixedNodes,
00151                                  std::vector<c_vector<double,DIM> >* pFixedNodeLocations = NULL);
00152     
00154     NonlinearElasticityAssembler(QuadraticMesh<DIM>* pQuadMesh,
00155                                  std::vector<AbstractIncompressibleMaterialLaw<DIM>*>& rMaterialLaws,
00156                                  c_vector<double,DIM> bodyForce,
00157                                  double density,
00158                                  std::string outputDirectory,
00159                                  std::vector<unsigned>& fixedNodes,
00160                                  std::vector<c_vector<double,DIM> >* pFixedNodeLocations = NULL);
00161 
00163     ~NonlinearElasticityAssembler();
00164     
00170     void SetSurfaceTractionBoundaryConditions(std::vector<BoundaryElement<DIM-1,DIM>*>& rBoundaryElements,
00171                                               std::vector<c_vector<double,DIM> >& rSurfaceTractions);
00172 
00177     void SetFunctionalTractionBoundaryCondition(std::vector<BoundaryElement<DIM-1,DIM>*> rBoundaryElements,
00178                                                 c_vector<double,DIM> (*pFunction)(c_vector<double,DIM>&));
00179     
00180     std::vector<double>& rGetPressures();
00181     
00185     std::vector<c_vector<double,DIM> >& rGetDeformedPosition();
00186 };
00187 
00188 #endif /*NONLINEARELASTICITYASSEMBLER_HPP_*/

Generated on Wed Mar 18 12:51:56 2009 for Chaste by  doxygen 1.5.5