41 double constantSourceCoefficient,
42 double linearSourceCoefficient,
43 double diffusionCoefficient,
44 double duDtCoefficient,
45 bool scaleByCellVolume)
46 : mrCellPopulation(rCellPopulation),
47 mConstantSourceCoefficient(constantSourceCoefficient),
48 mLinearSourceCoefficient(linearSourceCoefficient),
49 mDiffusionCoefficient(diffusionCoefficient),
50 mDuDtCoefficient(duDtCoefficient),
51 mScaleByCellVolume(scaleByCellVolume)
96 for (
double & mCellDensityOnCoarseElement : mCellDensityOnCoarseElements)
98 mCellDensityOnCoarseElement = 0.0;
103 cell_iter != mrCellPopulation.End();
106 unsigned elem_index = 0;
107 const ChastePoint<DIM>& r_position_of_cell = mrCellPopulation.GetLocationOfCellCentre(*cell_iter);
109 if (pCellPdeElementMap !=
nullptr)
111 elem_index = (*pCellPdeElementMap)[*cell_iter];
119 bool cell_is_apoptotic = cell_iter->template HasCellProperty<ApoptoticCellProperty>();
121 if (!cell_is_apoptotic)
123 double cell_weight = 1.0;
125 if (mScaleByCellVolume)
128 cell_weight = mrCellPopulation.GetVolumeOfCell(*cell_iter);
130 if (cell_weight <1e-6)
132 EXCEPTION(
"The volume of one of the cells is " << cell_weight <<
133 " and you are scaling by cell volume. Either turn scaling off or use"
134 " a cell model with non zero areas (i.e. a Bounded Voronoi Tesselation model).");
138 mCellDensityOnCoarseElements[elem_index] += cell_weight;
143 c_matrix<double, DIM, DIM> jacobian;
145 for (
unsigned elem_index=0; elem_index<mCellDensityOnCoarseElements.size(); elem_index++)
147 rCoarseMesh.
GetElement(elem_index)->CalculateJacobian(jacobian, det);
148 mCellDensityOnCoarseElements[elem_index] /= rCoarseMesh.
GetElement(elem_index)->GetVolume(det);
AveragedSourceParabolicPde(AbstractCellPopulation< DIM, DIM > &rCellPopulation, double constantSourceCoefficient=0.0, double linearSourceCoefficient=0.0, double diffusionCoefficient=1.0, double duDtCoefficient=1.0, bool scaleByCellVolume=false)