#include <CellBasedSimulationWithPdes.hpp>
Public Member Functions | |
CellBasedSimulationWithPdes (AbstractCellPopulation< DIM > &rCellPopulation, std::vector< PdeAndBoundaryConditions< DIM > * > pdeAndBcCollection=std::vector< PdeAndBoundaryConditions< DIM > * >(), bool deleteCellPopulationAndForceCollection=false, bool initialiseCells=true) | |
~CellBasedSimulationWithPdes () | |
void | SetPdeAndBcCollection (std::vector< PdeAndBoundaryConditions< DIM > * > pdeAndBcCollection) |
Vec | GetCurrentPdeSolution (unsigned pdeIndex) |
void | SetWriteAverageRadialPdeSolution (unsigned numRadialIntervals=10, bool writeDailyResults=false) |
void | UseCoarsePdeMesh (double coarseGrainScaleFactor=10.0) |
void | OutputSimulationParameters (out_stream &rParamsFile) |
template<> | |
void | CreateCoarsePdeMesh (double coarseGrainScaleFactor) |
Private Member Functions | |
template<class Archive> | |
void | serialize (Archive &archive, const unsigned int version) |
void | SetupSolve () |
void | SetupWritePdeSolution () |
void | WritePdeSolution (double time) |
void | WriteAverageRadialPdeSolution (double time, unsigned numIntervals) |
void | SolvePde () |
void | SolvePdeUsingCoarseMesh () |
unsigned | FindCoarseElementContainingCell (CellPtr pCell) |
void | PostSolve () |
void | AfterSolve () |
void | CreateCoarsePdeMesh (double coarseGrainScaleFactor) |
void | InitialiseCoarsePdeMesh () |
void | WriteVisualizerSetupFile () |
Private Attributes | |
std::vector < PdeAndBoundaryConditions < DIM > * > | mPdeAndBcCollection |
out_stream | mpVizPdeSolutionResultsFile |
out_stream | mpAverageRadialPdeSolutionResultsFile |
bool | mWriteAverageRadialPdeSolution |
bool | mWriteDailyAverageRadialPdeSolution |
unsigned | mNumRadialIntervals |
TetrahedralMesh< DIM, DIM > * | mpCoarsePdeMesh |
std::map< CellPtr, unsigned > | mCellPdeElementMap |
Friends | |
class | TestCellBasedSimulationWithPdes |
class | boost::serialization::access |
Definition at line 48 of file CellBasedSimulationWithPdes.hpp.
CellBasedSimulationWithPdes< DIM >::CellBasedSimulationWithPdes | ( | AbstractCellPopulation< DIM > & | rCellPopulation, | |
std::vector< PdeAndBoundaryConditions< DIM > * > | pdeAndBcCollection = std::vector<PdeAndBoundaryConditions<DIM>*>() , |
|||
bool | deleteCellPopulationAndForceCollection = false , |
|||
bool | initialiseCells = true | |||
) | [inline] |
Constructor.
rCellPopulation | A cell population object | |
pdeAndBcCollection | A vector of pointers to PdeAndBoundaryConditions objects (defaults to an empty vector0 | |
deleteCellPopulationAndForceCollection | Whether to delete the cell population on destruction to free up memory | |
initialiseCells | Whether to initialise cells (set to false when loading from an archive) |
Definition at line 42 of file CellBasedSimulationWithPdes.cpp.
References CellBasedSimulation< DIM >::mrCellPopulation.
CellBasedSimulationWithPdes< DIM >::~CellBasedSimulationWithPdes | ( | ) | [inline] |
Destructor.
Free any memory allocated by the constructor. This frees the current PDE solution, if it exists.
Definition at line 63 of file CellBasedSimulationWithPdes.cpp.
References CellBasedSimulationWithPdes< DIM >::mpCoarsePdeMesh.
void CellBasedSimulationWithPdes< DIM >::serialize | ( | Archive & | archive, | |
const unsigned int | version | |||
) | [inline, private] |
Archive the member variables.
Serialization of singleton objects must be done with care. Before the object is serialized via a pointer, it *MUST* be serialized directly, or an assertion will trip when a second instance of the class is created on de-serialization.
archive | the archive | |
version | the current version of this class |
Reimplemented from CellBasedSimulation< DIM >.
Definition at line 57 of file CellBasedSimulationWithPdes.hpp.
References CellBasedSimulationWithPdes< DIM >::mCellPdeElementMap, CellBasedSimulationWithPdes< DIM >::mNumRadialIntervals, CellBasedSimulationWithPdes< DIM >::mWriteAverageRadialPdeSolution, and CellBasedSimulationWithPdes< DIM >::mWriteDailyAverageRadialPdeSolution.
void CellBasedSimulationWithPdes< DIM >::SetupSolve | ( | ) | [inline, private, virtual] |
Overridden SetupSolve() method.
Reimplemented from CellBasedSimulation< DIM >.
Definition at line 102 of file CellBasedSimulationWithPdes.cpp.
References SimulationTime::GetTime(), CellBasedSimulationWithPdes< DIM >::InitialiseCoarsePdeMesh(), SimulationTime::Instance(), CellBasedSimulationWithPdes< DIM >::mpCoarsePdeMesh, CellBasedSimulation< DIM >::mrCellPopulation, CellBasedSimulationWithPdes< DIM >::SetupWritePdeSolution(), and CellBasedSimulationWithPdes< DIM >::WritePdeSolution().
void CellBasedSimulationWithPdes< DIM >::SetupWritePdeSolution | ( | ) | [inline, private] |
Set up the PDE solution writer.
Definition at line 118 of file CellBasedSimulationWithPdes.cpp.
References PetscTools::AmMaster(), CellBasedSimulationWithPdes< DIM >::mpAverageRadialPdeSolutionResultsFile, CellBasedSimulationWithPdes< DIM >::mpVizPdeSolutionResultsFile, CellBasedSimulation< DIM >::mpVizSetupFile, CellBasedSimulation< DIM >::mSimulationOutputDirectory, CellBasedSimulationWithPdes< DIM >::mWriteAverageRadialPdeSolution, and OutputFileHandler::OpenOutputFile().
Referenced by CellBasedSimulationWithPdes< DIM >::SetupSolve().
void CellBasedSimulationWithPdes< DIM >::WritePdeSolution | ( | double | time | ) | [inline, private] |
Write the PDE solution to file at a specified time.
time | The time at which to record the PDE solution |
Definition at line 588 of file CellBasedSimulationWithPdes.cpp.
References PetscTools::AmMaster(), CellwiseData< DIM >::GetValue(), CellwiseData< DIM >::Instance(), and CellBasedSimulation< DIM >::mrCellPopulation.
Referenced by CellBasedSimulationWithPdes< DIM >::PostSolve(), and CellBasedSimulationWithPdes< DIM >::SetupSolve().
void CellBasedSimulationWithPdes< DIM >::WriteAverageRadialPdeSolution | ( | double | time, | |
unsigned | numIntervals | |||
) | [inline, private] |
Write the average radial PDE solution to file at a specified time.
time | The time at which to record the average radial PDE solution | |
numIntervals | The number of radial intervals in which the average PDE solution is calculated |
Definition at line 626 of file CellBasedSimulationWithPdes.cpp.
References CellwiseData< DIM >::GetValue(), CellwiseData< DIM >::Instance(), and CellBasedSimulation< DIM >::mrCellPopulation.
Referenced by CellBasedSimulationWithPdes< DIM >::AfterSolve(), and CellBasedSimulationWithPdes< DIM >::PostSolve().
void CellBasedSimulationWithPdes< DIM >::SolvePde | ( | ) | [inline, private] |
Solve the PDE.
Definition at line 253 of file CellBasedSimulationWithPdes.cpp.
References BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::AddDirichletBoundaryCondition(), BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::AddNeumannBoundaryCondition(), PdeAndBoundaryConditions< DIM >::DestroySolution(), PdeAndBoundaryConditions< DIM >::GetBoundaryCondition(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetBoundaryElementIteratorBegin(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetBoundaryElementIteratorEnd(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetBoundaryNodeIteratorBegin(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetBoundaryNodeIteratorEnd(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), PdeAndBoundaryConditions< DIM >::GetPde(), PdeAndBoundaryConditions< DIM >::GetSolution(), CellwiseData< DIM >::Instance(), PdeAndBoundaryConditions< DIM >::IsNeumannBoundaryCondition(), CellBasedSimulationWithPdes< DIM >::mpCoarsePdeMesh, CellBasedSimulationWithPdes< DIM >::mPdeAndBcCollection, CellBasedSimulation< DIM >::mrCellPopulation, CellwiseData< DIM >::ReallocateMemory(), PdeAndBoundaryConditions< DIM >::SetSolution(), CellwiseData< DIM >::SetValue(), and CellBasedSimulationWithPdes< DIM >::SolvePdeUsingCoarseMesh().
Referenced by CellBasedSimulationWithPdes< DIM >::PostSolve().
void CellBasedSimulationWithPdes< DIM >::SolvePdeUsingCoarseMesh | ( | ) | [inline, private] |
Solve the PDE on a coarse mesh.
Definition at line 354 of file CellBasedSimulationWithPdes.cpp.
References BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::AddDirichletBoundaryCondition(), Element< ELEMENT_DIM, SPACE_DIM >::CalculateInterpolationWeights(), PdeAndBoundaryConditions< DIM >::DestroySolution(), EXCEPTION, CellBasedSimulationWithPdes< DIM >::FindCoarseElementContainingCell(), PdeAndBoundaryConditions< DIM >::GetBoundaryCondition(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetNumElements(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), PdeAndBoundaryConditions< DIM >::GetPde(), PdeAndBoundaryConditions< DIM >::GetSolution(), CellwiseData< DIM >::Instance(), PdeAndBoundaryConditions< DIM >::IsNeumannBoundaryCondition(), CellBasedSimulationWithPdes< DIM >::mCellPdeElementMap, CellBasedSimulationWithPdes< DIM >::mpCoarsePdeMesh, CellBasedSimulationWithPdes< DIM >::mPdeAndBcCollection, CellBasedSimulation< DIM >::mrCellPopulation, CellwiseData< DIM >::ReallocateMemory(), PdeAndBoundaryConditions< DIM >::SetSolution(), PdeAndBoundaryConditions< DIM >::SetUpSourceTermsForAveragedSourcePde(), and CellwiseData< DIM >::SetValue().
Referenced by CellBasedSimulationWithPdes< DIM >::SolvePde().
unsigned CellBasedSimulationWithPdes< DIM >::FindCoarseElementContainingCell | ( | CellPtr | pCell | ) | [inline, private] |
Find the index of the coarse mesh element containing a given cell.
pCell | the cell |
Definition at line 520 of file CellBasedSimulationWithPdes.cpp.
References TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetContainingElementIndex(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), CellBasedSimulationWithPdes< DIM >::mCellPdeElementMap, CellBasedSimulationWithPdes< DIM >::mpCoarsePdeMesh, and CellBasedSimulation< DIM >::mrCellPopulation.
Referenced by CellBasedSimulationWithPdes< DIM >::SolvePdeUsingCoarseMesh().
void CellBasedSimulationWithPdes< DIM >::PostSolve | ( | ) | [inline, private, virtual] |
Overridden PostSolve() method.
Reimplemented from CellBasedSimulation< DIM >.
Definition at line 554 of file CellBasedSimulationWithPdes.cpp.
References SimulationTime::GetTime(), SimulationTime::GetTimeStep(), SimulationTime::GetTimeStepsElapsed(), SimulationTime::Instance(), CellBasedSimulationWithPdes< DIM >::mNumRadialIntervals, CellBasedSimulation< DIM >::mSamplingTimestepMultiple, CellBasedSimulationWithPdes< DIM >::mWriteDailyAverageRadialPdeSolution, CellBasedSimulationWithPdes< DIM >::SolvePde(), CellBasedSimulationWithPdes< DIM >::WriteAverageRadialPdeSolution(), and CellBasedSimulationWithPdes< DIM >::WritePdeSolution().
void CellBasedSimulationWithPdes< DIM >::AfterSolve | ( | ) | [inline, private, virtual] |
Overridden AfterSolve() method.
Reimplemented from CellBasedSimulation< DIM >.
Definition at line 234 of file CellBasedSimulationWithPdes.cpp.
References PetscTools::AmMaster(), SimulationTime::Instance(), CellBasedSimulationWithPdes< DIM >::mNumRadialIntervals, CellBasedSimulationWithPdes< DIM >::mpAverageRadialPdeSolutionResultsFile, CellBasedSimulationWithPdes< DIM >::mpVizPdeSolutionResultsFile, CellBasedSimulation< DIM >::mrCellPopulation, CellBasedSimulationWithPdes< DIM >::mWriteAverageRadialPdeSolution, and CellBasedSimulationWithPdes< DIM >::WriteAverageRadialPdeSolution().
void CellBasedSimulationWithPdes< DIM >::CreateCoarsePdeMesh | ( | double | coarseGrainScaleFactor | ) | [inline, private] |
Create a coarse mesh on which to solve the PDE.
coarseGrainScaleFactor | the ratio of the width of the coarse PDE mesh to the initial width of the cell population |
Definition at line 145 of file CellBasedSimulationWithPdes.cpp.
References EXCEPTION.
Referenced by CellBasedSimulationWithPdes< DIM >::UseCoarsePdeMesh().
void CellBasedSimulationWithPdes< DIM >::InitialiseCoarsePdeMesh | ( | ) | [inline, private] |
Initialise the std::map mCellPdeElementMap.
Definition at line 218 of file CellBasedSimulationWithPdes.cpp.
References TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetContainingElementIndex(), CellBasedSimulationWithPdes< DIM >::mCellPdeElementMap, CellBasedSimulationWithPdes< DIM >::mpCoarsePdeMesh, and CellBasedSimulation< DIM >::mrCellPopulation.
Referenced by CellBasedSimulationWithPdes< DIM >::SetupSolve().
void CellBasedSimulationWithPdes< DIM >::WriteVisualizerSetupFile | ( | ) | [inline, private, virtual] |
Overridden WriteVisualizerSetupFile() method.
Writes out special information about the mesh to the visualizer.
Reimplemented from CellBasedSimulation< DIM >.
Definition at line 89 of file CellBasedSimulationWithPdes.cpp.
References CellBasedSimulation< DIM >::mForceCollection, and CellBasedSimulation< DIM >::mpVizSetupFile.
void CellBasedSimulationWithPdes< DIM >::SetPdeAndBcCollection | ( | std::vector< PdeAndBoundaryConditions< DIM > * > | pdeAndBcCollection | ) | [inline] |
A small hack until we fully archive this class - needed to set the PDE after loading a simulation from an archive.
pdeAndBcCollection | A vector of pointers to PdeAndBoundaryConditions objects |
Definition at line 72 of file CellBasedSimulationWithPdes.cpp.
References CellBasedSimulationWithPdes< DIM >::mPdeAndBcCollection.
Vec CellBasedSimulationWithPdes< DIM >::GetCurrentPdeSolution | ( | unsigned | pdeIndex | ) | [inline] |
Get the current solution to the PDE problem.
pdeIndex | The index of the PDE in the vector mPdeAndBcCollection |
Definition at line 78 of file CellBasedSimulationWithPdes.cpp.
References CellBasedSimulationWithPdes< DIM >::mPdeAndBcCollection.
void CellBasedSimulationWithPdes< DIM >::SetWriteAverageRadialPdeSolution | ( | unsigned | numRadialIntervals = 10 , |
|
bool | writeDailyResults = false | |||
) | [inline] |
Write the final (and optionally also the daily) average radial PDE solution to file.
numRadialIntervals | The number of radial intervals in which the average PDE solution is calculated (defaults to 10) | |
writeDailyResults | Whether to record the average radial PDE solution at the end of each day of the simulation (defaults to false) |
Definition at line 618 of file CellBasedSimulationWithPdes.cpp.
References CellBasedSimulationWithPdes< DIM >::mNumRadialIntervals, CellBasedSimulationWithPdes< DIM >::mWriteAverageRadialPdeSolution, and CellBasedSimulationWithPdes< DIM >::mWriteDailyAverageRadialPdeSolution.
void CellBasedSimulationWithPdes< DIM >::UseCoarsePdeMesh | ( | double | coarseGrainScaleFactor = 10.0 |
) | [inline] |
Solve the PDE problem on a coarse mesh.
coarseGrainScaleFactor | the ratio of the width of the coarse PDE mesh to the initial width of the cell population (defaults to 10.0) |
Definition at line 133 of file CellBasedSimulationWithPdes.cpp.
References CellBasedSimulationWithPdes< DIM >::CreateCoarsePdeMesh(), and CellBasedSimulationWithPdes< DIM >::mPdeAndBcCollection.
void CellBasedSimulationWithPdes< DIM >::OutputSimulationParameters | ( | out_stream & | rParamsFile | ) | [inline, virtual] |
Outputs simulation parameters to file
As this method is pure virtual, it must be overridden in subclasses.
rParamsFile | the file stream to which the parameters are output |
Reimplemented from CellBasedSimulation< DIM >.
Definition at line 694 of file CellBasedSimulationWithPdes.cpp.
References CellBasedSimulationWithPdes< DIM >::mWriteAverageRadialPdeSolution, CellBasedSimulationWithPdes< DIM >::mWriteDailyAverageRadialPdeSolution, and CellBasedSimulation< DIM >::OutputSimulationParameters().
void CellBasedSimulationWithPdes< 2 >::CreateCoarsePdeMesh | ( | double | coarseGrainScaleFactor | ) | [inline] |
The CreateCoarsePdeMesh method is currently only implemented in 2D, hence there are two definitions to this method (one templated and one not).
coarseGrainScaleFactor | the ratio of the width of the coarse PDE mesh to the initial width of the cell population |
Definition at line 157 of file CellBasedSimulationWithPdes.cpp.
References TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::ConstructFromMeshReader(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), CellBasedSimulationWithPdes< DIM >::mpCoarsePdeMesh, CellBasedSimulation< DIM >::mrCellPopulation, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::Scale(), and AbstractMesh< ELEMENT_DIM, SPACE_DIM >::Translate().
friend class boost::serialization::access [friend] |
Needed for serialization.
Reimplemented from CellBasedSimulation< DIM >.
Definition at line 55 of file CellBasedSimulationWithPdes.hpp.
std::vector<PdeAndBoundaryConditions<DIM>*> CellBasedSimulationWithPdes< DIM >::mPdeAndBcCollection [private] |
Vector of pointers to linear elliptic PDE objects with additional boundary condition information.
Definition at line 72 of file CellBasedSimulationWithPdes.hpp.
Referenced by CellBasedSimulationWithPdes< DIM >::GetCurrentPdeSolution(), CellBasedSimulationWithPdes< DIM >::SetPdeAndBcCollection(), CellBasedSimulationWithPdes< DIM >::SolvePde(), CellBasedSimulationWithPdes< DIM >::SolvePdeUsingCoarseMesh(), and CellBasedSimulationWithPdes< DIM >::UseCoarsePdeMesh().
out_stream CellBasedSimulationWithPdes< DIM >::mpVizPdeSolutionResultsFile [private] |
File that the values of the PDE solution are written out to.
Definition at line 77 of file CellBasedSimulationWithPdes.hpp.
Referenced by CellBasedSimulationWithPdes< DIM >::AfterSolve(), and CellBasedSimulationWithPdes< DIM >::SetupWritePdeSolution().
out_stream CellBasedSimulationWithPdes< DIM >::mpAverageRadialPdeSolutionResultsFile [private] |
File that the average radial PDE solution is written out to.
Definition at line 82 of file CellBasedSimulationWithPdes.hpp.
Referenced by CellBasedSimulationWithPdes< DIM >::AfterSolve(), and CellBasedSimulationWithPdes< DIM >::SetupWritePdeSolution().
bool CellBasedSimulationWithPdes< DIM >::mWriteAverageRadialPdeSolution [private] |
Whether to write to file the average radial PDE solution.
Definition at line 87 of file CellBasedSimulationWithPdes.hpp.
Referenced by CellBasedSimulationWithPdes< DIM >::AfterSolve(), CellBasedSimulationWithPdes< DIM >::OutputSimulationParameters(), CellBasedSimulationWithPdes< DIM >::serialize(), CellBasedSimulationWithPdes< DIM >::SetupWritePdeSolution(), and CellBasedSimulationWithPdes< DIM >::SetWriteAverageRadialPdeSolution().
bool CellBasedSimulationWithPdes< DIM >::mWriteDailyAverageRadialPdeSolution [private] |
Whether to write the average radial PDE solution DAILY.
Definition at line 92 of file CellBasedSimulationWithPdes.hpp.
Referenced by CellBasedSimulationWithPdes< DIM >::OutputSimulationParameters(), CellBasedSimulationWithPdes< DIM >::PostSolve(), CellBasedSimulationWithPdes< DIM >::serialize(), and CellBasedSimulationWithPdes< DIM >::SetWriteAverageRadialPdeSolution().
unsigned CellBasedSimulationWithPdes< DIM >::mNumRadialIntervals [private] |
Number of radial 'bins' used to calculate the average radial PDE solution.
Definition at line 98 of file CellBasedSimulationWithPdes.hpp.
Referenced by CellBasedSimulationWithPdes< DIM >::AfterSolve(), CellBasedSimulationWithPdes< DIM >::PostSolve(), CellBasedSimulationWithPdes< DIM >::serialize(), and CellBasedSimulationWithPdes< DIM >::SetWriteAverageRadialPdeSolution().
TetrahedralMesh<DIM,DIM>* CellBasedSimulationWithPdes< DIM >::mpCoarsePdeMesh [private] |
Coarse mesh on which to solve the PDE.
Definition at line 103 of file CellBasedSimulationWithPdes.hpp.
Referenced by CellBasedSimulationWithPdes< DIM >::CreateCoarsePdeMesh(), CellBasedSimulationWithPdes< DIM >::FindCoarseElementContainingCell(), CellBasedSimulationWithPdes< DIM >::InitialiseCoarsePdeMesh(), CellBasedSimulationWithPdes< DIM >::SetupSolve(), CellBasedSimulationWithPdes< DIM >::SolvePde(), CellBasedSimulationWithPdes< DIM >::SolvePdeUsingCoarseMesh(), and CellBasedSimulationWithPdes< DIM >::~CellBasedSimulationWithPdes().
std::map<CellPtr, unsigned> CellBasedSimulationWithPdes< DIM >::mCellPdeElementMap [private] |
Map between cells and the elements of the coarse PDE mesh containing them.
Definition at line 108 of file CellBasedSimulationWithPdes.hpp.
Referenced by CellBasedSimulationWithPdes< DIM >::FindCoarseElementContainingCell(), CellBasedSimulationWithPdes< DIM >::InitialiseCoarsePdeMesh(), CellBasedSimulationWithPdes< DIM >::serialize(), and CellBasedSimulationWithPdes< DIM >::SolvePdeUsingCoarseMesh().