36 #include "CryptProjectionForce.hpp"
37 #include "MeshBasedCellPopulation.hpp"
38 #include "WntConcentration.hpp"
43 mIncludeWntChemotaxis(false),
44 mWntChemotaxisStrength(100.0)
58 c_vector<double, 2> node_location_2d;
59 c_vector<double, 3> node_location_3d;
63 cell_iter != rCellPopulation.
End();
72 node_location_3d[0] = node_location_2d[0];
73 node_location_3d[1] = node_location_2d[1];
93 assert(wntChemotaxisStrength >= 0.0);
108 return mA*pow(norm_2(rNodeLocation),
mB);
113 return mA*
mB*pow(norm_2(rNodeLocation), (
mB - 1.0));
121 assert(nodeAGlobalIndex != nodeBGlobalIndex);
124 c_vector<double,2> node_a_location_2d = rCellPopulation.
GetNode(nodeAGlobalIndex)->rGetLocation();
125 c_vector<double,2> node_b_location_2d = rCellPopulation.
GetNode(nodeBGlobalIndex)->rGetLocation();
133 double distance_between_nodes = norm_2(unit_difference);
134 assert(distance_between_nodes > 0);
135 assert(!std::isnan(distance_between_nodes));
137 unit_difference /= distance_between_nodes;
146 return zero_vector<double>(2);
152 double rest_length = 1.0;
157 double ageA = p_cell_A->GetAge();
158 double ageB = p_cell_B->GetAge();
160 assert(!std::isnan(ageA));
161 assert(!std::isnan(ageB));
173 std::pair<CellPtr,CellPtr> cell_pair = p_static_cast_cell_population->
CreateCellPair(p_cell_A, p_cell_B);
186 double a_rest_length = rest_length*0.5;
187 double b_rest_length = a_rest_length;
193 if (p_cell_A->HasApoptosisBegun())
195 double time_until_death_a = p_cell_A->GetTimeUntilDeath();
196 a_rest_length = a_rest_length * time_until_death_a / p_cell_A->GetApoptosisTime();
198 if (p_cell_B->HasApoptosisBegun())
200 double time_until_death_b = p_cell_B->GetTimeUntilDeath();
201 b_rest_length = b_rest_length * time_until_death_b / p_cell_B->GetApoptosisTime();
204 rest_length = a_rest_length + b_rest_length;
207 assert(rest_length <= 1.0+1e-12);
209 bool is_closer_than_rest_length =
true;
211 if (distance_between_nodes - rest_length > 0)
213 is_closer_than_rest_length =
false;
220 double multiplication_factor = 1.0;
224 c_vector<double,3> force_between_nodes = multiplication_factor * this->
GetMeinekeSpringStiffness() * unit_difference * (distance_between_nodes - rest_length);
227 c_vector<double,3> outward_normal_unit_vector;
230 double theta_B = atan2(node_b_location_2d[1], node_b_location_2d[0]);
231 double normalization_factor = sqrt(1 + dfdr*dfdr);
233 outward_normal_unit_vector[0] = dfdr*cos(theta_B)/normalization_factor;
234 outward_normal_unit_vector[1] = dfdr*sin(theta_B)/normalization_factor;
235 outward_normal_unit_vector[2] = -1.0/normalization_factor;
238 c_vector<double,2> projected_force_between_nodes_2d;
239 double force_dot_normal = inner_prod(force_between_nodes, outward_normal_unit_vector);
241 for (
unsigned i=0; i<2; i++)
243 projected_force_between_nodes_2d[i] = force_between_nodes[i]
244 - force_dot_normal*outward_normal_unit_vector[i]
245 + force_dot_normal*outward_normal_unit_vector[2];
248 return projected_force_between_nodes_2d;
259 EXCEPTION(
"CryptProjectionForce is to be used with a subclass of MeshBasedCellPopulation only");
265 spring_iterator != p_static_cast_cell_population->
SpringsEnd();
268 unsigned nodeA_global_index = spring_iterator.GetNodeA()->GetIndex();
269 unsigned nodeB_global_index = spring_iterator.GetNodeB()->GetIndex();
272 c_vector<double, 2> negative_force = -1.0 * force;
273 spring_iterator.GetNodeB()->AddAppliedForceContribution(negative_force);
274 spring_iterator.GetNodeA()->AddAppliedForceContribution(force);
282 cell_iter != rCellPopulation.
End();
290 rCellPopulation.
GetNode(index)->AddAppliedForceContribution(wnt_chemotactic_force);
298 *rParamsFile <<
"\t\t\t<A>" <<
mA <<
"</A>\n";
299 *rParamsFile <<
"\t\t\t<B>" <<
mB <<
"</B>\n";
300 *rParamsFile <<
"\t\t\t<IncludeWntChemotaxis>" <<
mIncludeWntChemotaxis <<
"</IncludeWntChemotaxis>\n";
301 *rParamsFile <<
"\t\t\t<WntChemotaxisStrength>" <<
mWntChemotaxisStrength <<
"</WntChemotaxisStrength>\n";
virtual Node< SPACE_DIM > * GetNode(unsigned index)=0
SpringIterator SpringsEnd()
void UnmarkSpring(std::pair< CellPtr, CellPtr > &rCellPair)
SpringIterator SpringsBegin()
double GetWntChemotaxisStrength()
virtual CellPtr GetCellUsingLocationIndex(unsigned index)
void SetWntChemotaxis(bool includeWntChemotaxis)
unsigned GetLocationIndexUsingCell(CellPtr pCell)
bool mIncludeWntChemotaxis
#define EXCEPTION(message)
static SimulationTime * Instance()
double CalculateCryptSurfaceDerivativeAtPoint(const c_vector< double, 2 > &rNodeLocation)
double GetCryptProjectionParameterB()
double GetTimeStep() const
std::pair< CellPtr, CellPtr > CreateCellPair(CellPtr pCell1, CellPtr pCell2)
double mMechanicsCutOffLength
double GetMeinekeSpringStiffness()
double CalculateCryptSurfaceHeightAtPoint(const c_vector< double, 2 > &rNodeLocation)
void UpdateNode3dLocationMap(AbstractCellPopulation< 2 > &rCellPopulation)
static WntConcentration * Instance()
c_vector< double, 2 > CalculateForceBetweenNodes(unsigned nodeAGlobalIndex, unsigned nodeBGlobalIndex, AbstractCellPopulation< 2 > &rCellPopulation)
c_vector< double, DIM > GetWntGradient(c_vector< double, DIM > &rLocation)
bool IsMarkedSpring(const std::pair< CellPtr, CellPtr > &rCellPair)
virtual c_vector< double, SPACE_DIM > GetLocationOfCellCentre(CellPtr pCell)=0
std::map< unsigned, c_vector< double, 3 > > mNode3dLocationMap
void OutputForceParameters(out_stream &rParamsFile)
virtual double VariableSpringConstantMultiplicationFactor(unsigned nodeAGlobalIndex, unsigned nodeBGlobalIndex, AbstractCellPopulation< ELEMENT_DIM, ELEMENT_DIM > &rCellPopulation, bool isCloserThanRestLength)
virtual void OutputForceParameters(out_stream &rParamsFile)
void AddForceContribution(AbstractCellPopulation< 2 > &rCellPopulation)
void SetWntChemotaxisStrength(double wntChemotaxisStrength)
double mMeinekeDivisionRestingSpringLength
#define CHASTE_CLASS_EXPORT(T)
double GetCryptProjectionParameterA()
double mWntChemotaxisStrength
double mMeinekeSpringGrowthDuration