CellBasedPdeHandler< DIM > Class Template Reference

#include <CellBasedPdeHandler.hpp>

Inherits Identifiable.

Inherited by CellBasedPdeHandlerOnCuboid< DIM >.

Collaboration diagram for CellBasedPdeHandler< DIM >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CellBasedPdeHandler (AbstractCellPopulation< DIM > *pCellPopulation, bool deleteMemberPointersInDestructor=false)
virtual ~CellBasedPdeHandler ()
const AbstractCellPopulation
< DIM > * 
GetCellPopulation () const
TetrahedralMesh< DIM, DIM > * GetCoarsePdeMesh ()
void OpenResultsFiles (std::string outputDirectory)
void CloseResultsFiles ()
bool GetWriteAverageRadialPdeSolution ()
bool GetWriteDailyAverageRadialPdeSolution ()
void UpdateCellPdeElementMap ()
bool GetImposeBcsOnCoarseBoundary ()
unsigned GetNumRadialIntervals ()
virtual void SolvePdeAndWriteResultsToFile (unsigned samplingTimestepMultiple)
virtual std::auto_ptr
< BoundaryConditionsContainer
< DIM, DIM, 1 > > 
ConstructBoundaryConditionsContainer (PdeAndBoundaryConditions< DIM > *pPdeAndBc, TetrahedralMesh< DIM, DIM > *pMesh)
double GetPdeSolutionAtPoint (const c_vector< double, DIM > &rPoint, const std::string &rVariable)
unsigned FindCoarseElementContainingCell (CellPtr pCell)
virtual Vec GetPdeSolution (const std::string &rName="")
void SetWriteAverageRadialPdeSolution (const std::string &rName, unsigned numRadialIntervals=10, bool writeDailyResults=false)
void SetImposeBcsOnCoarseBoundary (bool setBcsOnCoarseBoundary)
virtual void UseCoarsePdeMesh (double stepSize, ChasteCuboid< DIM > meshCuboid, bool centreOnCellPopulation=false)
void AddPdeAndBc (PdeAndBoundaryConditions< DIM > *pPdeAndBc)
virtual void OutputParameters (out_stream &rParamsFile)

Protected Member Functions

void InitialiseCellPdeElementMap ()
virtual void WritePdeSolution (double time)
void WriteAverageRadialPdeSolution (double time)
bool PdeSolveNeedsCoarseMesh ()

Protected Attributes

AbstractCellPopulation< DIM > * mpCellPopulation
std::vector
< PdeAndBoundaryConditions
< DIM > * > 
mPdeAndBcCollection
std::string mDirPath
out_stream mpVizPdeSolutionResultsFile
out_stream mpAverageRadialPdeSolutionResultsFile
bool mWriteAverageRadialPdeSolution
bool mWriteDailyAverageRadialPdeSolution
std::string mAverageRadialSolutionVariableName
bool mSetBcsOnCoarseBoundary
unsigned mNumRadialIntervals
TetrahedralMesh< DIM, DIM > * mpCoarsePdeMesh
std::map< CellPtr, unsignedmCellPdeElementMap
bool mDeleteMemberPointersInDestructor

Private Member Functions

template<class Archive >
void serialize (Archive &archive, const unsigned int version)

Friends

class TestCellBasedPdeHandler
class TestOffLatticeSimulationWithPdes
class TestOnLatticeSimulationWithPdes
class boost::serialization::access

Detailed Description

template<unsigned DIM>
class CellBasedPdeHandler< DIM >

A helper class, containing code for handling the numerical solution of one or more PDEs (using the finite element method) associated with a cell-based simulation object.

By letting AbstractCellBasedSimulation have a pointer to an object of this type as a member variable, we separate out all PDE-related functionality into this class, and thus obviate the need for specialized cell-based simulation subclasses.

Definition at line 60 of file CellBasedPdeHandler.hpp.


Constructor & Destructor Documentation

template<unsigned DIM>
CellBasedPdeHandler< DIM >::CellBasedPdeHandler ( AbstractCellPopulation< DIM > *  pCellPopulation,
bool  deleteMemberPointersInDestructor = false 
) [inline]

Constructor.

Parameters:
pCellPopulation pointer to a cell population
deleteMemberPointersInDestructor whether to delete member pointers in the destructor (defaults to false)

Todo:
change to exceptions (#1891)

Definition at line 48 of file CellBasedPdeHandler.cpp.

References AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::GetNumRealCells(), and CellBasedPdeHandler< DIM >::mpCellPopulation.

template<unsigned DIM>
CellBasedPdeHandler< DIM >::~CellBasedPdeHandler (  )  [inline, virtual]

Member Function Documentation

template<unsigned DIM>
void CellBasedPdeHandler< DIM >::AddPdeAndBc ( PdeAndBoundaryConditions< DIM > *  pPdeAndBc  )  [inline]

Pass a PDE and associated boundary conditions to the simulation.

Parameters:
pPdeAndBc a pointer to a PdeAndBoundaryConditions object

Definition at line 99 of file CellBasedPdeHandler.cpp.

References EXCEPTION, CellBasedPdeHandler< DIM >::mPdeAndBcCollection, and PdeAndBoundaryConditions< DIM >::rGetDependentVariableName().

template<unsigned DIM>
void CellBasedPdeHandler< DIM >::CloseResultsFiles (  )  [inline]
template<unsigned DIM>
std::auto_ptr< BoundaryConditionsContainer< DIM, DIM, 1 > > CellBasedPdeHandler< DIM >::ConstructBoundaryConditionsContainer ( PdeAndBoundaryConditions< DIM > *  pPdeAndBc,
TetrahedralMesh< DIM, DIM > *  pMesh 
) [inline, virtual]
template<unsigned DIM>
unsigned CellBasedPdeHandler< DIM >::FindCoarseElementContainingCell ( CellPtr  pCell  )  [inline]
template<unsigned DIM>
const AbstractCellPopulation< DIM > * CellBasedPdeHandler< DIM >::GetCellPopulation (  )  const [inline]

Get a pointer to the cell population.

Returns:
a const pointer to mpCellPopulation

Definition at line 87 of file CellBasedPdeHandler.cpp.

References CellBasedPdeHandler< DIM >::mpCellPopulation.

template<unsigned DIM>
TetrahedralMesh< DIM, DIM > * CellBasedPdeHandler< DIM >::GetCoarsePdeMesh (  )  [inline]
Returns:
mpCoarsePdeMesh

Definition at line 93 of file CellBasedPdeHandler.cpp.

References CellBasedPdeHandler< DIM >::mpCoarsePdeMesh.

template<unsigned DIM>
bool CellBasedPdeHandler< DIM >::GetImposeBcsOnCoarseBoundary (  )  [inline]
Returns:
mSetBcsOnCoarseBoundary

Definition at line 815 of file CellBasedPdeHandler.cpp.

References CellBasedPdeHandler< DIM >::mSetBcsOnCoarseBoundary.

template<unsigned DIM>
unsigned CellBasedPdeHandler< DIM >::GetNumRadialIntervals (  )  [inline]
Returns:
mNumRadialIntervals

Definition at line 821 of file CellBasedPdeHandler.cpp.

References CellBasedPdeHandler< DIM >::mNumRadialIntervals.

template<unsigned DIM>
Vec CellBasedPdeHandler< DIM >::GetPdeSolution ( const std::string &  rName = ""  )  [inline, virtual]
Returns:
the solution to the PDE at this time step.
Parameters:
rName The name of the dependent variable for the PDE in the vector mPdeAndBcCollection. This defaults to an empty string in the case there is only one PDE.

Definition at line 116 of file CellBasedPdeHandler.cpp.

References EXCEPTION, and CellBasedPdeHandler< DIM >::mPdeAndBcCollection.

template<unsigned DIM>
double CellBasedPdeHandler< DIM >::GetPdeSolutionAtPoint ( const c_vector< double, DIM > &  rPoint,
const std::string &  rVariable 
) [inline]
template<unsigned DIM>
bool CellBasedPdeHandler< DIM >::GetWriteAverageRadialPdeSolution (  )  [inline]
Returns:
mWriteAverageRadialPdeSolution

Definition at line 803 of file CellBasedPdeHandler.cpp.

References CellBasedPdeHandler< DIM >::mWriteAverageRadialPdeSolution.

template<unsigned DIM>
bool CellBasedPdeHandler< DIM >::GetWriteDailyAverageRadialPdeSolution (  )  [inline]
Returns:
mWriteDailyAverageRadialPdeSolution

Definition at line 809 of file CellBasedPdeHandler.cpp.

References CellBasedPdeHandler< DIM >::mWriteDailyAverageRadialPdeSolution.

template<unsigned DIM>
void CellBasedPdeHandler< DIM >::InitialiseCellPdeElementMap (  )  [inline, protected]
template<unsigned DIM>
void CellBasedPdeHandler< DIM >::OpenResultsFiles ( std::string  outputDirectory  )  [inline]
template<unsigned DIM>
void CellBasedPdeHandler< DIM >::OutputParameters ( out_stream &  rParamsFile  )  [inline, virtual]
template<unsigned DIM>
bool CellBasedPdeHandler< DIM >::PdeSolveNeedsCoarseMesh (  )  [inline, protected]
Returns:
Whether the population being used requires the use of separate `coarse` mesh to solve PDEs

Definition at line 840 of file CellBasedPdeHandler.cpp.

References CellBasedPdeHandler< DIM >::mpCellPopulation.

Referenced by CellBasedPdeHandler< DIM >::OpenResultsFiles().

template<unsigned DIM>
template<class Archive >
void CellBasedPdeHandler< DIM >::serialize ( Archive &  archive,
const unsigned int  version 
) [inline, private]

Archive the member variables.

Parameters:
archive the archive
version the current version of this class

Reimplemented in CellBasedPdeHandlerOnCuboid< DIM >.

Definition at line 78 of file CellBasedPdeHandler.hpp.

template<unsigned DIM>
void CellBasedPdeHandler< DIM >::SetImposeBcsOnCoarseBoundary ( bool  setBcsOnCoarseBoundary  )  [inline]

Impose the PDE boundary conditions on the edge of the cell population when using the coarse mesh. The default option is to impose the condition on the boundary of the coarse mesh.

Parameters:
setBcsOnCoarseBoundary whether to impose the BCs on the edge of the cell population

Definition at line 679 of file CellBasedPdeHandler.cpp.

References CellBasedPdeHandler< DIM >::mSetBcsOnCoarseBoundary.

template<unsigned DIM>
void CellBasedPdeHandler< DIM >::SetWriteAverageRadialPdeSolution ( const std::string &  rName,
unsigned  numRadialIntervals = 10,
bool  writeDailyResults = false 
) [inline]

Write the final (and optionally also the daily) average radial PDE solution to file.

Parameters:
rName The name of the quantity that we are averaging.
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 670 of file CellBasedPdeHandler.cpp.

References CellBasedPdeHandler< DIM >::mAverageRadialSolutionVariableName, CellBasedPdeHandler< DIM >::mNumRadialIntervals, CellBasedPdeHandler< DIM >::mWriteAverageRadialPdeSolution, and CellBasedPdeHandler< DIM >::mWriteDailyAverageRadialPdeSolution.

template<unsigned DIM>
void CellBasedPdeHandler< DIM >::SolvePdeAndWriteResultsToFile ( unsigned  samplingTimestepMultiple  )  [inline, virtual]

Solve the PDE and write the solution to file.

Parameters:
samplingTimestepMultiple the ratio of the number of actual timesteps to the number of timesteps at which results are written to file.

Todo:
enable the coarse PDE mesh to change size, e.g. for a growing domain (#630/#1891)
Todo:
enable this in the case where a coarse PDE mesh is used
Todo:
Worry about round-off errors (#1891)

Definition at line 308 of file CellBasedPdeHandler.cpp.

References AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::Begin(), Element< ELEMENT_DIM, SPACE_DIM >::CalculateInterpolationWeights(), CellBasedPdeHandler< DIM >::ConstructBoundaryConditionsContainer(), PetscTools::Destroy(), PdeAndBoundaryConditions< DIM >::DestroySolution(), AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::End(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::GetLocationIndexUsingCell(), AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::GetLocationOfCellCentre(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), PdeAndBoundaryConditions< DIM >::GetPde(), PdeAndBoundaryConditions< DIM >::GetSolution(), SimulationTime::GetTime(), SimulationTime::GetTimeStep(), SimulationTime::GetTimeStepsElapsed(), PdeAndBoundaryConditions< DIM >::HasAveragedSourcePde(), SimulationTime::Instance(), CellBasedPdeHandler< DIM >::mCellPdeElementMap, CellBasedPdeHandler< DIM >::mpCellPopulation, CellBasedPdeHandler< DIM >::mpCoarsePdeMesh, CellBasedPdeHandler< DIM >::mPdeAndBcCollection, CellBasedPdeHandler< DIM >::mWriteDailyAverageRadialPdeSolution, PdeAndBoundaryConditions< DIM >::SetSolution(), PdeAndBoundaryConditions< DIM >::SetUpSourceTermsForAveragedSourcePde(), AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::Update(), CellBasedPdeHandler< DIM >::UpdateCellPdeElementMap(), CellBasedPdeHandler< DIM >::WriteAverageRadialPdeSolution(), and CellBasedPdeHandler< DIM >::WritePdeSolution().

Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::Solve().

template<unsigned DIM>
void CellBasedPdeHandler< DIM >::UpdateCellPdeElementMap (  )  [inline]
template<unsigned DIM>
void CellBasedPdeHandler< DIM >::UseCoarsePdeMesh ( double  stepSize,
ChasteCuboid< DIM >  meshCuboid,
bool  centreOnCellPopulation = false 
) [inline, virtual]
template<unsigned DIM>
void CellBasedPdeHandler< DIM >::WriteAverageRadialPdeSolution ( double  time  )  [inline, protected]

Write the average radial PDE solution to file at a specified time.

Outputs a line of space-separated values of the form: [time] [radius interval 0] [average solution 0] [radius interval 1] [average solution 1] ...

Parameters:
time The time at which to record the average radial PDE solution

Definition at line 685 of file CellBasedPdeHandler.cpp.

References AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::Begin(), AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::End(), AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::GetCentroidOfCellPopulation(), AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::GetLocationOfCellCentre(), CellBasedPdeHandler< DIM >::mAverageRadialSolutionVariableName, CellBasedPdeHandler< DIM >::mNumRadialIntervals, and CellBasedPdeHandler< DIM >::mpCellPopulation.

Referenced by CellBasedPdeHandler< DIM >::CloseResultsFiles(), and CellBasedPdeHandler< DIM >::SolvePdeAndWriteResultsToFile().

template<unsigned DIM>
void CellBasedPdeHandler< DIM >::WritePdeSolution ( double  time  )  [inline, protected, virtual]

Friends And Related Function Documentation

template<unsigned DIM>
friend class boost::serialization::access [friend]

Needed for serialization.

Reimplemented in CellBasedPdeHandlerOnCuboid< DIM >.

Definition at line 70 of file CellBasedPdeHandler.hpp.


Member Data Documentation

template<unsigned DIM>
std::string CellBasedPdeHandler< DIM >::mAverageRadialSolutionVariableName [protected]
template<unsigned DIM>
std::map<CellPtr, unsigned> CellBasedPdeHandler< DIM >::mCellPdeElementMap [protected]
template<unsigned DIM>
bool CellBasedPdeHandler< DIM >::mDeleteMemberPointersInDestructor [protected]

Whether to delete member pointers in the destructor. Used in archiving.

Definition at line 130 of file CellBasedPdeHandler.hpp.

Referenced by CellBasedPdeHandler< DIM >::~CellBasedPdeHandler().

template<unsigned DIM>
std::string CellBasedPdeHandler< DIM >::mDirPath [protected]

A cache of where the results are going (used for VTK writer).

Definition at line 97 of file CellBasedPdeHandler.hpp.

Referenced by CellBasedPdeHandler< DIM >::OpenResultsFiles(), and CellBasedPdeHandler< DIM >::WritePdeSolution().

template<unsigned DIM>
unsigned CellBasedPdeHandler< DIM >::mNumRadialIntervals [protected]
template<unsigned DIM>
out_stream CellBasedPdeHandler< DIM >::mpAverageRadialPdeSolutionResultsFile [protected]

File that the average radial PDE solution is written out to.

Definition at line 103 of file CellBasedPdeHandler.hpp.

Referenced by CellBasedPdeHandler< DIM >::CloseResultsFiles(), and CellBasedPdeHandler< DIM >::OpenResultsFiles().

template<unsigned DIM>
AbstractCellPopulation<DIM>* CellBasedPdeHandler< DIM >::mpCellPopulation [protected]
template<unsigned DIM>
TetrahedralMesh<DIM,DIM>* CellBasedPdeHandler< DIM >::mpCoarsePdeMesh [protected]
template<unsigned DIM>
std::vector<PdeAndBoundaryConditions<DIM>*> CellBasedPdeHandler< DIM >::mPdeAndBcCollection [protected]
template<unsigned DIM>
out_stream CellBasedPdeHandler< DIM >::mpVizPdeSolutionResultsFile [protected]

File that the values of the PDE solution are written out to.

Definition at line 100 of file CellBasedPdeHandler.hpp.

Referenced by CellBasedPdeHandler< DIM >::CloseResultsFiles(), and CellBasedPdeHandler< DIM >::OpenResultsFiles().

template<unsigned DIM>
bool CellBasedPdeHandler< DIM >::mSetBcsOnCoarseBoundary [protected]
template<unsigned DIM>
bool CellBasedPdeHandler< DIM >::mWriteAverageRadialPdeSolution [protected]
template<unsigned DIM>
bool CellBasedPdeHandler< DIM >::mWriteDailyAverageRadialPdeSolution [protected]

The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.2