36 #include "AveragedSourceParabolicPde.hpp"
37 #include "ApoptoticCellProperty.hpp"
39 template<
unsigned DIM>
41 double duDtCoefficient,
42 double diffusionCoefficient,
43 double sourceCoefficient)
44 : mrCellPopulation(rCellPopulation),
45 mDuDtCoefficient(duDtCoefficient),
46 mDiffusionCoefficient(diffusionCoefficient),
47 mSourceCoefficient(sourceCoefficient)
51 template<
unsigned DIM>
54 return mrCellPopulation;
57 template<
unsigned DIM>
62 for (
unsigned elem_index=0; elem_index<mCellDensityOnCoarseElements.size(); elem_index++)
64 mCellDensityOnCoarseElements[elem_index] = 0.0;
69 cell_iter != mrCellPopulation.End();
72 unsigned elem_index = 0;
73 const ChastePoint<DIM>& r_position_of_cell = mrCellPopulation.GetLocationOfCellCentre(*cell_iter);
75 if (pCellPdeElementMap !=
nullptr)
77 elem_index = (*pCellPdeElementMap)[*cell_iter];
85 bool cell_is_apoptotic = cell_iter->template HasCellProperty<ApoptoticCellProperty>();
87 if (!cell_is_apoptotic)
89 mCellDensityOnCoarseElements[elem_index] += 1.0;
94 c_matrix<double, DIM, DIM> jacobian;
96 for (
unsigned elem_index=0; elem_index<mCellDensityOnCoarseElements.size(); elem_index++)
98 rCoarseMesh.
GetElement(elem_index)->CalculateJacobian(jacobian, det);
99 mCellDensityOnCoarseElements[elem_index] /= rCoarseMesh.
GetElement(elem_index)->GetVolume(det);
103 template<
unsigned DIM>
106 return mDuDtCoefficient;
109 template<
unsigned DIM>
112 assert(!mCellDensityOnCoarseElements.empty());
113 double coefficient = mSourceCoefficient * mCellDensityOnCoarseElements[pElement->
GetIndex()];
116 return coefficient*u;
120 template<
unsigned DIM>
128 template<
unsigned DIM>
131 return mDiffusionCoefficient*identity_matrix<double>(DIM);
134 template<
unsigned DIM>
137 return this->mCellDensityOnCoarseElements[elementIndex];
virtual double ComputeSourceTerm(const ChastePoint< DIM > &rX, double u, Element< DIM, DIM > *pElement=NULL)
double GetUptakeRateForElement(unsigned elementIndex)
virtual unsigned GetNumElements() const
Element< ELEMENT_DIM, SPACE_DIM > * GetElement(unsigned index) const
virtual c_matrix< double, DIM, DIM > ComputeDiffusionTerm(const ChastePoint< DIM > &rX, Element< DIM, DIM > *pElement=NULL)
virtual void SetupSourceTerms(TetrahedralMesh< DIM, DIM > &rCoarseMesh, std::map< CellPtr, unsigned > *pCellPdeElementMap=nullptr)
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
const AbstractCellPopulation< DIM > & rGetCellPopulation() const
virtual double ComputeSourceTermAtNode(const Node< DIM > &rNode, double u)
unsigned GetContainingElementIndex(const ChastePoint< SPACE_DIM > &rTestPoint, bool strict=false, std::set< unsigned > testElements=std::set< unsigned >(), bool onlyTryWithTestElements=false)
AveragedSourceParabolicPde(AbstractCellPopulation< DIM, DIM > &rCellPopulation, double duDtCoefficient=1.0, double diffusionCoefficient=1.0, double sourceCoefficient=0.0)
virtual double ComputeDuDtCoefficientFunction(const ChastePoint< DIM > &rX)
unsigned GetIndex() const