CardiacElectroMechProbRegularGeom.hpp
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
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef CARDIACELECTROMECHPROBREGULARGEOM_HPP_
00037 #define CARDIACELECTROMECHPROBREGULARGEOM_HPP_
00038
00039 #include "CardiacElectroMechanicsProblem.hpp"
00040
00052 template<unsigned DIM>
00053 class CardiacElectroMechProbRegularGeom : public CardiacElectroMechanicsProblem<DIM>
00054 {
00055 public:
00056
00070 CardiacElectroMechProbRegularGeom(CompressibilityType compressibilityType,
00071 double width,
00072 unsigned numMechanicsElementsEachDir,
00073 unsigned numElectricsElementsEachDir,
00074 AbstractCardiacCellFactory<DIM>* pCellFactory,
00075 ContractionModelName contractionModel,
00076 double mechanicsSolveTimestep,
00077 double contractionModelOdeTimeStep,
00078 std::string outputDirectory = "")
00079 : CardiacElectroMechanicsProblem<DIM,1>(compressibilityType,
00080 MONODOMAIN,
00081 NULL, NULL,
00082 pCellFactory,
00083 NULL,
00084 outputDirectory)
00085 {
00086 assert(DIM==2);
00087
00088 assert(width > 0.0);
00089 assert(numMechanicsElementsEachDir > 0);
00090 assert(numElectricsElementsEachDir > 0);
00091
00092
00093 this->mpElectricsMesh = new TetrahedralMesh<DIM,DIM>();
00094
00095 this->mpElectricsMesh->ConstructRegularSlabMesh(width/numElectricsElementsEachDir, width, width);
00096
00097
00098 this->mpMechanicsMesh = new QuadraticMesh<DIM>(width/numMechanicsElementsEachDir, width, width);
00099 LOG(2, "Width of meshes is " << width);
00100 LOG(2, "Num nodes in electrical and mechanical meshes are: " << this->mpElectricsMesh->GetNumNodes() << ", " << this->mpMechanicsMesh->GetNumNodes() << "\n");
00101
00102 this->mpProblemDefinition = new ElectroMechanicsProblemDefinition<DIM>(*(this->mpMechanicsMesh));
00103
00104
00105 std::vector<unsigned> fixed_nodes;
00106 for(unsigned i=0; i<this->mpMechanicsMesh->GetNumNodes(); i++)
00107 {
00108 if( fabs(this->mpMechanicsMesh->GetNode(i)->rGetLocation()[0])<1e-6)
00109 {
00110 fixed_nodes.push_back(i);
00111 }
00112 }
00113 this->mpProblemDefinition->SetZeroDisplacementNodes(fixed_nodes);
00114
00115 LOG(2, "Fixed the " << fixed_nodes.size() << " nodes on x=0");
00116
00117 this->mpProblemDefinition->SetUseDefaultCardiacMaterialLaw(compressibilityType);
00118 this->mpProblemDefinition->SetContractionModel(contractionModel,contractionModelOdeTimeStep);
00119 this->mpProblemDefinition->SetMechanicsSolveTimestep(mechanicsSolveTimestep);
00120 }
00121
00122 ~CardiacElectroMechProbRegularGeom()
00123 {
00124 delete this->mpElectricsMesh;
00125 delete this->mpMechanicsMesh;
00126 delete this->mpProblemDefinition;
00127 }
00128 };
00129
00130 #endif