36#include "CellwiseSourceParabolicPde.hpp"
40 const double constantSourceCoefficient,
41 const double linearSourceCoefficient,
42 const double diffusionCoefficient,
43 const double duDtCoefficient,
44 const bool scaleByCellVolume)
45 : mrCellPopulation(rCellPopulation),
46 mConstantSourceCoefficient(constantSourceCoefficient),
47 mLinearSourceCoefficient(linearSourceCoefficient),
48 mDiffusionCoefficient(diffusionCoefficient),
49 mDuDtCoefficient(duDtCoefficient),
50 mScaleByCellVolume(scaleByCellVolume)
57 return mrCellPopulation;
63 return mConstantSourceCoefficient;
69 return mLinearSourceCoefficient;
75 return mDiffusionCoefficient;
81 return mDuDtCoefficient;
87 return mScaleByCellVolume;
93 return mDuDtCoefficient;
104template<
unsigned DIM>
107 double source_term = 0.0;
109 if (mConstantSourceCoefficient != 0.0 || mLinearSourceCoefficient != 0.0)
111 if (mrCellPopulation.IsPdeNodeAssociatedWithNonApoptoticCell(rNode.
GetIndex()))
114 double cell_volume = 1.0;
117 if (mScaleByCellVolume)
119 CellPtr p_cell = mrCellPopulation.GetCellUsingLocationIndex(rNode.
GetIndex());
120 cell_volume = mrCellPopulation.GetVolumeOfCell(p_cell);
122 if (cell_volume <1e-6)
124 EXCEPTION(
"The volume of one of the cells is " << cell_volume <<
125 " and you are scaling by cell volume. Either turn scaling off or use"
126 " a cell model with non zero areas (i.e. a Bounded Voronoi Tesselation model).");
131 source_term = (mLinearSourceCoefficient * u + mConstantSourceCoefficient)/cell_volume;
139template<
unsigned DIM>
142 return mDiffusionCoefficient*identity_matrix<double>(DIM);
#define EXCEPTION(message)
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
CellwiseSourceParabolicPde(AbstractCellPopulation< DIM, DIM > &rCellPopulation, double constantSourceCoefficient=0.0, double linearSourceCoefficient=0.0, double diffusionCoefficient=1.0, double duDtCoefficient=1.0, bool scaleByCellVolume=false)
double ComputeDuDtCoefficientFunction(const ChastePoint< DIM > &rX) override
double GetDuDtCoefficient() const
bool GetScaleByCellVolume() const
const AbstractCellPopulation< DIM > & rGetCellPopulation() const
double ComputeSourceTerm(const ChastePoint< DIM > &rX, double u, Element< DIM, DIM > *pElement) override
double GetConstantCoefficient() const
c_matrix< double, DIM, DIM > ComputeDiffusionTerm(const ChastePoint< DIM > &rX, Element< DIM, DIM > *pElement=nullptr) override
double ComputeSourceTermAtNode(const Node< DIM > &rNode, double u) override
double GetLinearCoefficient() const
double GetDiffusionCoefficient() const
unsigned GetIndex() const