62 std::shared_ptr<BoundaryConditionsContainer<DIM,DIM,1> > p_bcc = ConstructBoundaryConditionsContainer(rCellPopulation);
64 this->UpdateCellPdeElementMap(rCellPopulation);
68 this->SetUpSourceTermsForAveragedSourcePde(this->mpFeMesh, &this->mCellPdeElementMap);
77 double current_time = p_simulation_time->
GetTime();
79 solver.
SetTimes(current_time,current_time + dt);
84 Vec previous_solution = this->mSolution;
85 if (mMoveSolutionWithCells)
88 previous_solution = InterpolateSolutionFromCellMovement(rCellPopulation);
94 this->mSolution = solver.
Solve();
98 this->UpdateCellData(rCellPopulation);
101 if (mMoveSolutionWithCells)
110 mOldCellLocations.clear();
112 cell_iter != rCellPopulation.
End();
126 SetupInitialSolutionVector(rCellPopulation);
129 this->UpdateAtEndOfOutputTimeStep(rCellPopulation);
132 if (mMoveSolutionWithCells)
141 mOldCellLocations.clear();
143 cell_iter != rCellPopulation.
End();
167 double initial_condition = rCellPopulation.
Begin()->GetCellData()->GetItem(this->mDependentVariableName);
170 cell_iter != rCellPopulation.
End();
173 double initial_condition_at_cell = cell_iter->GetCellData()->GetItem(this->mDependentVariableName);
175 assert(fabs(initial_condition_at_cell - initial_condition)<1e-12);
192 double max_radius = 0.0;
194 cell_iter != rCellPopulation.
End();
199 double radius = norm_2(r_position_of_cell.
rGetLocation());
201 if (max_radius < radius)
208 std::vector<Node<DIM>*> temp_nodes;
209 std::vector<c_vector<double,DIM>> cell_displacements;
210 unsigned cell_index = 0;
212 cell_iter != rCellPopulation.
End();
219 if (mOldCellLocations.find(*cell_iter) != mOldCellLocations.end())
222 c_vector<double,DIM> displacement = position_of_cell - mOldCellLocations[*cell_iter];
224 cell_displacements.push_back(displacement);
225 temp_nodes.push_back(
new Node<DIM>(cell_index, position_of_cell));
232 this->GenerateAndReturnFeMesh(this->mpMeshCuboid,this->mStepSize,p_deformed_mesh);
235 node_iter != p_deformed_mesh->GetNodeIteratorEnd();
238 c_vector<double, DIM> node_location = node_iter->rGetLocation();
241 c_vector<double, DIM> new_node_location = node_location;
243 if (norm_2(node_location) <= max_radius)
254 c_vector<double,DIM> interpolated_cell_displacement = zero_vector<double>(DIM);
255 for (
unsigned i=0; i<DIM+1; i++)
257 const c_vector<double,DIM>& nodal_value = cell_displacements[p_element->
GetNodeGlobalIndex(i)];
258 interpolated_cell_displacement += nodal_value * weights(i);
260 new_node_location = node_location + interpolated_cell_displacement;
261 node_iter->rGetModifiableLocation() = new_node_location;
272 node_iter != this->mpFeMesh->GetNodeIteratorEnd();
275 unsigned node_index = node_iter->GetIndex();
280 std::set<unsigned> elements_to_check = node_iter->rGetContainingElementIndices();
283 unsigned elem_index = p_deformed_mesh->GetContainingElementIndex(node_location,
false, elements_to_check);
287 c_vector<double,DIM+1> weights;
291 double solution_at_node = 0.0;
292 for (
unsigned i=0; i<DIM+1; i++)
295 solution_at_node += nodal_value * weights(i);
325 delete p_deformed_mesh;
327 return interpolated_solution;
void OutputSimulationModifierParameters(out_stream &rParamsFile) override
void SetupSolve(AbstractCellPopulation< DIM, DIM > &rCellPopulation, std::string outputDirectory) override
void SetupInitialSolutionVector(AbstractCellPopulation< DIM, DIM > &rCellPopulation)
virtual std::shared_ptr< BoundaryConditionsContainer< DIM, DIM, 1 > > ConstructBoundaryConditionsContainer(AbstractCellPopulation< DIM, DIM > &rCellPopulation)
void UpdateAtEndOfTimeStep(AbstractCellPopulation< DIM, DIM > &rCellPopulation) override
bool GetMoveSolutionWithCells() const
void SetupSolve(AbstractCellPopulation< DIM, DIM > &rCellPopulation, std::string outputDirectory) override
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)
void OutputSimulationModifierParameters(out_stream &rParamsFile) override
void SetMoveSolutionWithCells(bool moveSolutionWithCells)
Vec InterpolateSolutionFromCellMovement(AbstractCellPopulation< DIM, DIM > &rCellPopulation)