36#include "CellwiseSourceEllipticPde.hpp"
40 const double constantSourceCoefficient,
41 const double linearSourceCoefficient,
42 const double diffusionCoefficient,
43 const bool scaleByCellVolume)
44 : mrCellPopulation(rCellPopulation),
45 mConstantSourceCoefficient(constantSourceCoefficient),
46 mLinearSourceCoefficient(linearSourceCoefficient),
47 mDiffusionCoefficient(diffusionCoefficient),
48 mScaleByCellVolume(scaleByCellVolume)
55 return mrCellPopulation;
61 return mConstantSourceCoefficient;
67 return mLinearSourceCoefficient;
73 return mDiffusionCoefficient;
79 return mScaleByCellVolume;
99 double linear_source_coefficient = 0.0;
101 if (mLinearSourceCoefficient != 0.0)
103 if (mrCellPopulation.IsPdeNodeAssociatedWithNonApoptoticCell(rNode.
GetIndex()))
105 double cell_volume = 1.0;
108 if (mScaleByCellVolume)
110 CellPtr p_cell = mrCellPopulation.GetCellUsingLocationIndex(rNode.
GetIndex());
111 cell_volume = mrCellPopulation.GetVolumeOfCell(p_cell);
113 if (cell_volume <1e-6)
115 EXCEPTION(
"The volume of one of the cells is " << cell_volume <<
116 " and you are scaling by cell volume. Either turn scaling off or use"
117 " a cell model with non zero areas (i.e. a Bounded Voronoi Tesselation model).");
120 linear_source_coefficient = mLinearSourceCoefficient/cell_volume;
124 return linear_source_coefficient;
127template<
unsigned DIM>
130 double constant_source_coefficient = 0.0;
132 if (mConstantSourceCoefficient != 0.0)
134 if (mrCellPopulation.IsPdeNodeAssociatedWithNonApoptoticCell(rNode.
GetIndex()))
136 double cell_volume = 1.0;
139 if (mScaleByCellVolume)
141 CellPtr p_cell = mrCellPopulation.GetCellUsingLocationIndex(rNode.
GetIndex());
142 cell_volume = mrCellPopulation.GetVolumeOfCell(p_cell);
143 if (cell_volume <1e-6)
145 EXCEPTION(
"The volume of one of the cells is " << cell_volume <<
146 " and you are scaling by cell volume. Either turn scaling off or use"
147 " a cell model with non zero areas (i.e. a Bounded Voronoi Tesselation model).");
150 constant_source_coefficient = mConstantSourceCoefficient/cell_volume;
154 return constant_source_coefficient;
157template<
unsigned DIM>
160 return mDiffusionCoefficient*identity_matrix<double>(DIM);
#define EXCEPTION(message)
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
double GetLinearCoefficient() const
const AbstractCellPopulation< DIM > & rGetCellPopulation() const
double ComputeConstantInUSourceTermAtNode(const Node< DIM > &rNode) override
double GetDiffusionCoefficient() const
double GetConstantCoefficient() const
double ComputeConstantInUSourceTerm(const ChastePoint< DIM > &rX, Element< DIM, DIM > *pElement) override
double ComputeLinearInUCoeffInSourceTerm(const ChastePoint< DIM > &rX, Element< DIM, DIM > *pElement) override
c_matrix< double, DIM, DIM > ComputeDiffusionTerm(const ChastePoint< DIM > &rX) override
double ComputeLinearInUCoeffInSourceTermAtNode(const Node< DIM > &rNode) override
CellwiseSourceEllipticPde(AbstractCellPopulation< DIM, DIM > &rCellPopulation, double constantSourceCoefficient=0.0, double linearSourceCoefficient=0.0, double diffusionCoefficient=1.0, bool scaleByCellVolume=false)
bool GetScaleByCellVolume() const
unsigned GetIndex() const