36 #include "ParabolicBoxDomainPdeModifier.hpp"
37 #include "SimpleLinearParabolicSolver.hpp"
39 template<
unsigned DIM>
42 bool isNeumannBoundaryCondition,
48 isNeumannBoundaryCondition,
55 template<
unsigned DIM>
60 template<
unsigned DIM>
64 std::shared_ptr<BoundaryConditionsContainer<DIM,DIM,1> > p_bcc = ConstructBoundaryConditionsContainer(rCellPopulation);
66 this->UpdateCellPdeElementMap(rCellPopulation);
70 this->SetUpSourceTermsForAveragedSourcePde(this->mpFeMesh, &this->mCellPdeElementMap);
79 double current_time = p_simulation_time->GetTime();
80 double dt = p_simulation_time->GetTimeStep();
81 solver.
SetTimes(current_time,current_time + dt);
82 solver.SetTimeStep(dt);
85 Vec previous_solution = this->mSolution;
86 solver.SetInitialCondition(previous_solution);
90 this->mSolution = solver.Solve();
92 this->UpdateCellData(rCellPopulation);
95 template<
unsigned DIM>
101 SetupInitialSolutionVector(rCellPopulation);
104 this->UpdateAtEndOfOutputTimeStep(rCellPopulation);
107 template<
unsigned DIM>
112 if (!this->mSetBcsOnBoxBoundary)
114 EXCEPTION(
"Boundary conditions cannot yet be set on the cell population boundary for a ParabolicBoxDomainPdeModifier");
118 if (this->IsNeumannBoundaryCondition())
122 elem_iter != this->mpFeMesh->GetBoundaryElementIteratorEnd();
125 p_bcc->AddNeumannBoundaryCondition(*elem_iter, this->mpBoundaryCondition.get());
132 node_iter != this->mpFeMesh->GetBoundaryNodeIteratorEnd();
135 p_bcc->AddDirichletBoundaryCondition(*node_iter, this->mpBoundaryCondition.get());
143 template<
unsigned DIM>
149 double initial_condition = rCellPopulation.
Begin()->GetCellData()->GetItem(this->mDependentVariableName);
152 cell_iter != rCellPopulation.
End();
155 double initial_condition_at_cell = cell_iter->GetCellData()->GetItem(this->mDependentVariableName);
157 assert(fabs(initial_condition_at_cell - initial_condition)<1e-12);
164 template<
unsigned DIM>
virtual void SetupSolve(AbstractCellPopulation< DIM, DIM > &rCellPopulation, std::string outputDirectory)
ParabolicBoxDomainPdeModifier(boost::shared_ptr< AbstractLinearPde< DIM, DIM > > pPde=boost::shared_ptr< AbstractLinearPde< DIM, DIM > >(), boost::shared_ptr< AbstractBoundaryCondition< DIM > > pBoundaryCondition=boost::shared_ptr< AbstractBoundaryCondition< DIM > >(), bool isNeumannBoundaryCondition=true, boost::shared_ptr< ChasteCuboid< DIM > > pMeshCuboid=boost::shared_ptr< ChasteCuboid< DIM > >(), double stepSize=1.0, Vec solution=nullptr)
BoundaryElementIterator GetBoundaryElementIteratorBegin() const
virtual void UpdateAtEndOfTimeStep(AbstractCellPopulation< DIM, DIM > &rCellPopulation)
void SetupInitialSolutionVector(AbstractCellPopulation< DIM, DIM > &rCellPopulation)
#define EXCEPTION(message)
static SimulationTime * Instance()
void OutputSimulationModifierParameters(out_stream &rParamsFile)
BoundaryNodeIterator GetBoundaryNodeIteratorBegin() const
virtual ~ParabolicBoxDomainPdeModifier()
void OutputSimulationModifierParameters(out_stream &rParamsFile)
void SetTimes(double tStart, double tEnd)
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
virtual std::shared_ptr< BoundaryConditionsContainer< DIM, DIM, 1 > > ConstructBoundaryConditionsContainer(AbstractCellPopulation< DIM, DIM > &rCellPopulation)
virtual void SetupSolve(AbstractCellPopulation< DIM, DIM > &rCellPopulation, std::string outputDirectory)