53 auto old_node_locations = this->SaveCurrentNodeLocations();
56 this->ImposeBoundaryConditions(old_node_locations);
57 old_node_locations = this->SaveCurrentNodeLocations();
60 auto k1 = this->ComputeForcesIncludingDamping();
64 for (
auto node_iter = this->mpCellPopulation->rGetMesh().GetNodeIteratorBegin();
65 node_iter != this->mpCellPopulation->rGetMesh().GetNodeIteratorEnd();
68 c_vector<double, SPACE_DIM> new_location = node_iter->rGetLocation() + (dt/2.0) * k1[index];
69 this->SafeNodePositionUpdate(node_iter->GetIndex(), new_location);
71 this->ImposeBoundaryConditions(old_node_locations);
74 auto k2 = this->ComputeForcesIncludingDamping();
78 for (
auto node_iter = this->mpCellPopulation->rGetMesh().GetNodeIteratorBegin();
79 node_iter != this->mpCellPopulation->rGetMesh().GetNodeIteratorEnd();
82 c_vector<double, SPACE_DIM> old_location = old_node_locations.find(&(*node_iter))->second;
83 c_vector<double, SPACE_DIM> new_location = old_location + (dt/2.0) * k2[index];
84 this->SafeNodePositionUpdate(node_iter->GetIndex(), new_location);
86 this->ImposeBoundaryConditions(old_node_locations);
89 auto k3 = this->ComputeForcesIncludingDamping();
93 for (
auto node_iter = this->mpCellPopulation->rGetMesh().GetNodeIteratorBegin();
94 node_iter != this->mpCellPopulation->rGetMesh().GetNodeIteratorEnd();
97 c_vector<double, SPACE_DIM> old_location = old_node_locations.find(&(*node_iter))->second;
98 c_vector<double, SPACE_DIM> new_location = old_location + dt * k3[index];
99 this->SafeNodePositionUpdate(node_iter->GetIndex(), new_location);
101 this->ImposeBoundaryConditions(old_node_locations);
104 auto k4 = this->ComputeForcesIncludingDamping();
108 for (
auto node_iter = this->mpCellPopulation->rGetMesh().GetNodeIteratorBegin();
109 node_iter != this->mpCellPopulation->rGetMesh().GetNodeIteratorEnd();
110 ++node_iter, ++index)
112 c_vector<double, SPACE_DIM> effective_force = (k1[index] + 2.0*k2[index] + 2.0*k3[index] + k4[index]) / 6.0;
113 c_vector<double, SPACE_DIM> old_location = old_node_locations.find(&(*node_iter))->second;
114 c_vector<double, SPACE_DIM> displacement = dt * effective_force;
116 this->DetectStepSizeExceptions(node_iter->GetIndex(), displacement, dt);
118 c_vector<double, SPACE_DIM> new_location = old_location + displacement;
119 this->SafeNodePositionUpdate(node_iter->GetIndex(), new_location);