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