36 #include "VesselBasedDiscreteSource.hpp" 37 #include "AbstractCellPopulation.hpp" 38 #include "VesselNetwork.hpp" 39 #include "GeometryTools.hpp" 40 #include "Element.hpp" 42 template<
unsigned DIM>
45 mVesselPermeability(0.0*
unit::metre_per_second),
46 mReferenceConcentration(0.0*
unit::mole_per_metre_cubed),
47 mReferenceHaematocrit(1.0)
52 template<
unsigned DIM>
58 template<
unsigned DIM>
65 template<
unsigned DIM>
70 EXCEPTION(
"A mesh is required for this type of source");
72 std::vector<units::quantity<unit::concentration_flow_rate> > values(this->
mpMesh->GetNumElements(), 0.0*unit::mole_per_metre_cubed_per_second);
73 std::vector<std::vector<boost::shared_ptr<VesselSegment<DIM> > > > element_segment_map = this->
mpMesh->GetElementSegmentMap();
75 for(
unsigned idx=0; idx<element_segment_map.size(); idx++)
77 if(element_segment_map[idx].size()>0)
80 Element<DIM, DIM>* p_element = this->
mpMesh->GetElement(idx);
81 std::vector<DimensionalChastePoint<DIM> > element_vertices(4);
82 double determinant = 0.0;
83 c_matrix<double, DIM, DIM> jacobian;
84 p_element->CalculateJacobian(jacobian, determinant);
85 units::quantity<unit::volume> element_volume = p_element->GetVolume(determinant) * units::pow<3>(this->
mpMesh->GetReferenceLengthScale());
86 if(p_element->GetNumNodes() != 4)
88 EXCEPTION(
"Vessel mesh mapping only supported for linear tetrahedral elements.");
90 for (
unsigned jdx = 0; jdx < 4; jdx++)
95 for (
unsigned jdx = 0; jdx < element_segment_map[idx].size(); jdx++)
98 units::quantity<unit::length> length_in_box = LengthOfLineInTetra<DIM>(element_segment_map[idx][jdx]->GetNode(0)->rGetLocation(),
99 element_segment_map[idx][jdx]->GetNode(1)->rGetLocation(), element_vertices);
101 units::quantity<unit::area> surface_area = 2.0*M_PI*element_segment_map[idx][jdx]->GetRadius()*length_in_box;
103 double haematocrit_Ratio = element_segment_map[idx][jdx]->GetFlowProperties()->GetHaematocrit()/
mReferenceHaematocrit;
112 template<
unsigned DIM>
117 EXCEPTION(
"A mesh is required for this type of source");
119 std::vector<units::quantity<unit::rate> > values(this->
mpMesh->GetNumElements(), 0.0*unit::per_second);
120 std::vector<std::vector<boost::shared_ptr<VesselSegment<DIM> > > > element_segment_map = this->
mpMesh->GetElementSegmentMap();
122 for(
unsigned idx=0; idx<element_segment_map.size(); idx++)
124 if(element_segment_map[idx].size()>0)
127 Element<DIM, DIM>* p_element = this->
mpMesh->GetElement(idx);
128 std::vector<DimensionalChastePoint<DIM> > element_vertices(4);
129 double determinant = 0.0;
130 c_matrix<double, DIM, DIM> jacobian;
131 p_element->CalculateJacobian(jacobian, determinant);
132 units::quantity<unit::volume> element_volume = p_element->GetVolume(determinant) * units::pow<3>(this->
mpMesh->GetReferenceLengthScale());
133 if(p_element->GetNumNodes() != 4)
135 EXCEPTION(
"Vessel mesh mapping only supported for linear tetrahedral elements.");
137 for (
unsigned jdx = 0; jdx < 4; jdx++)
142 for (
unsigned jdx = 0; jdx < element_segment_map[idx].size(); jdx++)
144 units::quantity<unit::length> length_in_box = LengthOfLineInTetra<DIM>(element_segment_map[idx][jdx]->GetNode(0)->rGetLocation(),
145 element_segment_map[idx][jdx]->GetNode(1)->rGetLocation(), element_vertices);
147 units::quantity<unit::area> surface_area = 2.0*M_PI*element_segment_map[idx][jdx]->GetRadius()*length_in_box;
148 double haematocrit = element_segment_map[idx][jdx]->GetFlowProperties()->GetHaematocrit();
160 template<
unsigned DIM>
163 std::vector<units::quantity<unit::concentration_flow_rate> > values(this->
mpRegularGrid->GetNumberOfPoints(), 0.0*unit::mole_per_metre_cubed_per_second);
164 std::vector<std::vector<boost::shared_ptr<VesselSegment<DIM> > > > point_segment_map = this->
mpRegularGrid->GetPointSegmentMap();
165 units::quantity<unit::length> grid_spacing = this->
mpRegularGrid->GetSpacing();
166 units::quantity<unit::volume> grid_volume = units::pow<3>(grid_spacing);
167 for(
unsigned idx=0; idx<point_segment_map.size(); idx++)
169 for (
unsigned jdx = 0; jdx < point_segment_map[idx].size(); jdx++)
171 units::quantity<unit::length> length_in_box = LengthOfLineInBox<DIM>(point_segment_map[idx][jdx]->GetNode(0)->rGetLocation(),
172 point_segment_map[idx][jdx]->GetNode(1)->rGetLocation(),
173 this->
mpRegularGrid->GetLocationOf1dIndex(idx), grid_spacing);
175 units::quantity<unit::area> surface_area = 2.0*M_PI*point_segment_map[idx][jdx]->GetRadius()*length_in_box;
177 double haematocrit_ratio = point_segment_map[idx][jdx]->GetFlowProperties()->GetHaematocrit()/
mReferenceHaematocrit;
184 template<
unsigned DIM>
187 std::vector<units::quantity<unit::rate> > values(this->
mpRegularGrid->GetNumberOfPoints(), 0.0*unit::per_second);
188 std::vector<std::vector<boost::shared_ptr<VesselSegment<DIM> > > > point_segment_map = this->
mpRegularGrid->GetPointSegmentMap(
false);
189 units::quantity<unit::length> grid_spacing = this->
mpRegularGrid->GetSpacing();
190 units::quantity<unit::volume> grid_volume = units::pow<3>(grid_spacing);
191 for(
unsigned idx=0; idx<point_segment_map.size(); idx++)
193 for (
unsigned jdx = 0; jdx < point_segment_map[idx].size(); jdx++)
195 units::quantity<unit::length> length_in_box = LengthOfLineInBox<DIM>(point_segment_map[idx][jdx]->GetNode(0)->rGetLocation(),
196 point_segment_map[idx][jdx]->GetNode(1)->rGetLocation(),
197 this->
mpRegularGrid->GetLocationOf1dIndex(idx), grid_spacing);
199 units::quantity<unit::area> surface_area = 2.0*M_PI*point_segment_map[idx][jdx]->GetRadius()*length_in_box;
200 double haematocrit = point_segment_map[idx][jdx]->GetFlowProperties()->GetHaematocrit();
210 template<
unsigned DIM>
216 template<
unsigned DIM>
222 template<
unsigned DIM>
units::quantity< unit::membrane_permeability > mVesselPermeability
void SetVesselPermeability(units::quantity< unit::membrane_permeability > value)
VesselBasedDiscreteSource()
boost::shared_ptr< RegularGrid< DIM > > mpRegularGrid
std::vector< units::quantity< unit::concentration_flow_rate > > GetConstantInURegularGridValues()
void SetReferenceHaematocrit(units::quantity< unit::dimensionless > value)
virtual ~VesselBasedDiscreteSource()
units::quantity< unit::dimensionless > mReferenceHaematocrit
static boost::shared_ptr< VesselBasedDiscreteSource< DIM > > Create()
units::quantity< unit::concentration > mReferenceConcentration
std::vector< units::quantity< unit::rate > > GetLinearInUMeshValues()
std::vector< units::quantity< unit::concentration_flow_rate > > GetConstantInUMeshValues()
boost::shared_ptr< DiscreteContinuumMesh< DIM, DIM > > mpMesh
std::vector< units::quantity< unit::rate > > GetLinearInURegularGridValues()
void SetReferenceConcentration(units::quantity< unit::concentration > value)