ContinuumMechanicsProblemDefinition.hpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2011
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 
00029 #ifndef CONTINUUMMECHANICSPROBLEMDEFINITION_HPP_
00030 #define CONTINUUMMECHANICSPROBLEMDEFINITION_HPP_
00031 
00032 #include "QuadraticMesh.hpp"
00033 #include "UblasCustomFunctions.hpp"
00034 #include "AbstractIncompressibleMaterialLaw.hpp"
00035 #include "AbstractCompressibleMaterialLaw.hpp"
00036 #include "CompressibilityType.hpp"
00037 
00038 
00042 typedef enum BodyForceType_
00043 {
00044     CONSTANT_BODY_FORCE,
00045     FUNCTIONAL_BODY_FORCE
00046 } BodyForceType;
00047 
00051 typedef enum TractionBoundaryConditionType_
00052 {
00053     NO_TRACTIONS,
00054     ELEMENTWISE_TRACTION,
00055     FUNCTIONAL_TRACTION,
00056     PRESSURE_ON_DEFORMED
00057 } TractionBoundaryConditionType;
00058 
00059 
00065 template<unsigned DIM>
00066 class ContinuumMechanicsProblemDefinition
00067 {
00068 public:
00071     static const double FREE; // set to DBL_MAX
00072 
00073 protected:
00075     QuadraticMesh<DIM>& mrMesh;
00076 
00078     double mDensity;
00079 
00081     // body force
00083 
00085     BodyForceType mBodyForceType;
00086 
00088     c_vector<double,DIM> mConstantBodyForce;
00089 
00091     c_vector<double,DIM> (*mpBodyForceFunction)(c_vector<double,DIM>& rX, double t);
00092 
00094     // tractions
00096 
00098     TractionBoundaryConditionType mTractionBoundaryConditionType;
00099 
00101     std::vector<BoundaryElement<DIM-1,DIM>*> mTractionBoundaryElements;
00102 
00104     std::vector<c_vector<double,DIM> > mElementwiseTractions;
00105 
00108     double mNormalPressure;
00109 
00111     c_vector<double,DIM> (*mpTractionBoundaryConditionFunction)(c_vector<double,DIM>& rX, double t);
00112 
00114     // Dirichlet boundary conditions
00116 
00120     std::vector<unsigned> mDirichletNodes;
00121 
00123     std::vector<c_vector<double,DIM> > mDirichletNodeValues;
00124 
00125 
00126 public:
00131     ContinuumMechanicsProblemDefinition(QuadraticMesh<DIM>& rMesh);
00132 
00134     virtual ~ContinuumMechanicsProblemDefinition()
00135     {
00136     }
00137 
00138 
00143     void SetDensity(double density);
00144 
00148     double GetDensity();
00149 
00154     void SetZeroDirichletNodes(std::vector<unsigned>& rZeroDirichletNodes);
00155 
00156     // No method here for setting non-zero Dirichlet BCs - these are in the subclasses..
00157 
00161     std::vector<unsigned>& rGetDirichletNodes();
00162 
00166     std::vector<c_vector<double,DIM> >& rGetDirichletNodeValues();
00167 
00168 
00173     void SetBodyForce(c_vector<double,DIM> bodyForce);
00174 
00179     void SetBodyForce(c_vector<double,DIM> (*pFunction)(c_vector<double,DIM>& rX, double t));
00180 
00189     c_vector<double,DIM> GetBodyForce(c_vector<double,DIM>& rX, double t = 0.0);
00190 
00194     BodyForceType GetBodyForceType();
00195 
00199     c_vector<double,DIM> GetConstantBodyForce();
00200 
00207     c_vector<double,DIM> EvaluateBodyForceFunction(c_vector<double,DIM>& rX, double t);
00208 
00212     TractionBoundaryConditionType GetTractionBoundaryConditionType();
00213 
00220     void SetTractionBoundaryConditions(std::vector<BoundaryElement<DIM-1,DIM>*>& rTractionBoundaryElements,
00221                                        std::vector<c_vector<double,DIM> >& rElementwiseTractions);
00222 
00230     void SetTractionBoundaryConditions(std::vector<BoundaryElement<DIM-1,DIM>*> rTractionBoundaryElements,
00231                                        c_vector<double,DIM> (*pFunction)(c_vector<double,DIM>& rX, double t));
00232 
00240     void SetApplyNormalPressureOnDeformedSurface(std::vector<BoundaryElement<DIM-1,DIM>*> rTractionBoundaryElements,
00241                                                  double normalPressure);
00242 
00246     std::vector<BoundaryElement<DIM-1,DIM>*>& rGetTractionBoundaryElements();
00247 
00253     std::vector<c_vector<double,DIM> >& rGetElementwiseTractions();
00254 
00260     double GetNormalPressure();
00261 
00262 
00269     c_vector<double,DIM> EvaluateTractionFunction(c_vector<double,DIM>& rX, double t);
00270 
00275     virtual void Validate();
00276 };
00277 
00278 
00279 #endif // CONTINUUMMECHANICSPROBLEMDEFINITION_HPP_
Generated on Thu Dec 22 13:00:05 2011 for Chaste by  doxygen 1.6.3