36 #include "NagaiHondaForce.hpp"
38 template<
unsigned DIM>
41 mNagaiHondaDeformationEnergyParameter(100.0),
42 mNagaiHondaMembraneSurfaceEnergyParameter(10.0),
43 mNagaiHondaCellCellAdhesionEnergyParameter(0.5),
47 mNagaiHondaCellBoundaryAdhesionEnergyParameter(1.0)
51 template<
unsigned DIM>
56 template<
unsigned DIM>
62 EXCEPTION(
"NagaiHondaForce is to be used with a VertexBasedCellPopulation only");
67 unsigned num_nodes = p_cell_population->
GetNumNodes();
71 std::vector<double> element_areas(num_elements);
72 std::vector<double> element_perimeters(num_elements);
73 std::vector<double> target_areas(num_elements);
78 unsigned elem_index = elem_iter->GetIndex();
87 target_areas[elem_index] = p_cell_population->
GetCellUsingLocationIndex(elem_index)->GetCellData()->GetItem(
"target area");
91 EXCEPTION(
"You need to add an AbstractTargetAreaModifier to the simulation in order to use NagaiHondaForce");
96 for (
unsigned node_index=0; node_index<num_nodes; node_index++)
112 c_vector<double, DIM> deformation_contribution = zero_vector<double>(DIM);
113 c_vector<double, DIM> membrane_surface_tension_contribution = zero_vector<double>(DIM);
114 c_vector<double, DIM> adhesion_contribution = zero_vector<double>(DIM);
117 std::set<unsigned> containing_elem_indices = p_cell_population->
GetNode(node_index)->rGetContainingElementIndices();
120 for (std::set<unsigned>::iterator iter = containing_elem_indices.begin();
121 iter != containing_elem_indices.end();
126 unsigned elem_index = p_element->
GetIndex();
127 unsigned num_nodes_elem = p_element->
GetNumNodes();
134 deformation_contribution -= 2*GetNagaiHondaDeformationEnergyParameter()*(element_areas[elem_index] - target_areas[elem_index])*element_area_gradient;
137 unsigned previous_node_local_index = (num_nodes_elem+local_index-1)%num_nodes_elem;
140 unsigned next_node_local_index = (local_index+1)%num_nodes_elem;
144 double previous_edge_adhesion_parameter = GetAdhesionParameter(p_previous_node, p_this_node, *p_cell_population);
145 double next_edge_adhesion_parameter = GetAdhesionParameter(p_this_node, p_next_node, *p_cell_population);
152 adhesion_contribution -= previous_edge_adhesion_parameter*previous_edge_gradient + next_edge_adhesion_parameter*next_edge_gradient;
155 c_vector<double, DIM> element_perimeter_gradient = previous_edge_gradient + next_edge_gradient;
156 double cell_target_perimeter = 2*sqrt(M_PI*target_areas[elem_index]);
157 membrane_surface_tension_contribution -= 2*GetNagaiHondaMembraneSurfaceEnergyParameter()*(element_perimeters[elem_index] - cell_target_perimeter)*element_perimeter_gradient;
160 c_vector<double, DIM> force_on_node = deformation_contribution + membrane_surface_tension_contribution + adhesion_contribution;
161 p_cell_population->
GetNode(node_index)->AddAppliedForceContribution(force_on_node);
165 template<
unsigned DIM>
173 std::set<unsigned> shared_elements;
174 std::set_intersection(elements_containing_nodeA.begin(),
175 elements_containing_nodeA.end(),
176 elements_containing_nodeB.begin(),
177 elements_containing_nodeB.end(),
178 std::inserter(shared_elements, shared_elements.begin()));
181 assert(!shared_elements.empty());
183 double adhesion_parameter = GetNagaiHondaCellCellAdhesionEnergyParameter();
186 if (shared_elements.size() == 1)
188 adhesion_parameter = GetNagaiHondaCellBoundaryAdhesionEnergyParameter();
191 return adhesion_parameter;
194 template<
unsigned DIM>
197 return mNagaiHondaDeformationEnergyParameter;
200 template<
unsigned DIM>
203 return mNagaiHondaMembraneSurfaceEnergyParameter;
206 template<
unsigned DIM>
209 return mNagaiHondaCellCellAdhesionEnergyParameter;
212 template<
unsigned DIM>
215 return mNagaiHondaCellBoundaryAdhesionEnergyParameter;
218 template<
unsigned DIM>
221 mNagaiHondaDeformationEnergyParameter = deformationEnergyParameter;
224 template<
unsigned DIM>
227 mNagaiHondaMembraneSurfaceEnergyParameter = membraneSurfaceEnergyParameter;
230 template<
unsigned DIM>
233 mNagaiHondaCellCellAdhesionEnergyParameter = cellCellAdhesionEnergyParameter;
236 template<
unsigned DIM>
239 mNagaiHondaCellBoundaryAdhesionEnergyParameter = cellBoundaryAdhesionEnergyParameter;
242 template<
unsigned DIM>
245 *rParamsFile <<
"\t\t\t<NagaiHondaDeformationEnergyParameter>" << mNagaiHondaDeformationEnergyParameter <<
"</NagaiHondaDeformationEnergyParameter>\n";
246 *rParamsFile <<
"\t\t\t<NagaiHondaMembraneSurfaceEnergyParameter>" << mNagaiHondaMembraneSurfaceEnergyParameter <<
"</NagaiHondaMembraneSurfaceEnergyParameter>\n";
247 *rParamsFile <<
"\t\t\t<NagaiHondaCellCellAdhesionEnergyParameter>" << mNagaiHondaCellCellAdhesionEnergyParameter <<
"</NagaiHondaCellCellAdhesionEnergyParameter>\n";
248 *rParamsFile <<
"\t\t\t<NagaiHondaCellBoundaryAdhesionEnergyParameter>" << mNagaiHondaCellBoundaryAdhesionEnergyParameter <<
"</NagaiHondaCellBoundaryAdhesionEnergyParameter>\n";
virtual CellPtr GetCellUsingLocationIndex(unsigned index)
unsigned GetNumElements()
#define EXCEPTION(message)
std::set< unsigned > & rGetContainingElementIndices()
c_vector< double, SPACE_DIM > GetNextEdgeGradientOfElementAtNode(VertexElement< ELEMENT_DIM, SPACE_DIM > *pElement, unsigned localIndex)
double GetNagaiHondaMembraneSurfaceEnergyParameter()
void SetNagaiHondaMembraneSurfaceEnergyParameter(double nagaiHondaMembraneSurfaceEnergyParameter)
Node< SPACE_DIM > * GetNode(unsigned localIndex) const
MutableVertexMesh< DIM, DIM > & rGetMesh()
VertexElementIterator GetElementIteratorBegin(bool skipDeletedElements=true)
void SetNagaiHondaCellBoundaryAdhesionEnergyParameter(double nagaiHondaCellBoundaryAdhesionEnergyParameter)
void OutputForceParameters(out_stream &rParamsFile)
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
Node< DIM > * GetNode(unsigned index)
unsigned GetNumNodes() const
void SetNagaiHondaDeformationEnergyParameter(double nagaiHondaDeformationEnergyParameter)
virtual ~NagaiHondaForce()
virtual double GetVolumeOfElement(unsigned index)
void SetNagaiHondaCellCellAdhesionEnergyParameter(double nagaiHondaCellCellAdhesionEnergyEnergyParameter)
double GetNagaiHondaCellCellAdhesionEnergyParameter()
unsigned GetIndex() const
double GetNagaiHondaCellBoundaryAdhesionEnergyParameter()
double GetNagaiHondaDeformationEnergyParameter()
c_vector< double, SPACE_DIM > GetAreaGradientOfElementAtNode(VertexElement< ELEMENT_DIM, SPACE_DIM > *pElement, unsigned localIndex)
unsigned GetNodeLocalIndex(unsigned globalIndex) const
virtual double GetAdhesionParameter(Node< DIM > *pNodeA, Node< DIM > *pNodeB, VertexBasedCellPopulation< DIM > &rVertexCellPopulation)
VertexElementIterator GetElementIteratorEnd()
virtual double GetSurfaceAreaOfElement(unsigned index)
VertexElement< DIM, DIM > * GetElement(unsigned elementIndex)
virtual void AddForceContribution(AbstractCellPopulation< DIM > &rCellPopulation)
virtual void OutputForceParameters(out_stream &rParamsFile)=0