36 #include "CryptProjectionForce.hpp"
37 #include "MeshBasedCellPopulation.hpp"
38 #include "WntConcentration.hpp"
40 #include "StemCellProliferativeType.hpp"
44 mIncludeWntChemotaxis(false),
45 mWntChemotaxisStrength(100.0)
59 c_vector<double, 2> node_location_2d;
60 c_vector<double, 3> node_location_3d;
64 cell_iter != rCellPopulation.
End();
73 node_location_3d[0] = node_location_2d[0];
74 node_location_3d[1] = node_location_2d[1];
94 assert(wntChemotaxisStrength >= 0.0);
109 return mA*pow(norm_2(rNodeLocation),
mB);
114 return mA*
mB*pow(norm_2(rNodeLocation), (
mB - 1.0));
122 assert(nodeAGlobalIndex != nodeBGlobalIndex);
125 c_vector<double,2> node_a_location_2d = rCellPopulation.
GetNode(nodeAGlobalIndex)->rGetLocation();
126 c_vector<double,2> node_b_location_2d = rCellPopulation.
GetNode(nodeBGlobalIndex)->rGetLocation();
134 double distance_between_nodes = norm_2(unit_difference);
135 assert(distance_between_nodes > 0);
136 assert(!std::isnan(distance_between_nodes));
138 unit_difference /= distance_between_nodes;
147 return zero_vector<double>(2);
153 double rest_length = 1.0;
158 double ageA = p_cell_A->GetAge();
159 double ageB = p_cell_B->GetAge();
161 assert(!std::isnan(ageA));
162 assert(!std::isnan(ageB));
174 std::pair<CellPtr,CellPtr> cell_pair = p_static_cast_cell_population->
CreateCellPair(p_cell_A, p_cell_B);
187 double a_rest_length = rest_length*0.5;
188 double b_rest_length = a_rest_length;
194 if (p_cell_A->HasApoptosisBegun())
196 double time_until_death_a = p_cell_A->GetTimeUntilDeath();
197 a_rest_length = a_rest_length * time_until_death_a / p_cell_A->GetApoptosisTime();
199 if (p_cell_B->HasApoptosisBegun())
201 double time_until_death_b = p_cell_B->GetTimeUntilDeath();
202 b_rest_length = b_rest_length * time_until_death_b / p_cell_B->GetApoptosisTime();
205 rest_length = a_rest_length + b_rest_length;
208 assert(rest_length <= 1.0+1e-12);
210 bool is_closer_than_rest_length =
true;
212 if (distance_between_nodes - rest_length > 0)
214 is_closer_than_rest_length =
false;
221 double multiplication_factor = 1.0;
225 c_vector<double,3> force_between_nodes = multiplication_factor * this->
GetMeinekeSpringStiffness() * unit_difference * (distance_between_nodes - rest_length);
228 c_vector<double,3> outward_normal_unit_vector;
231 double theta_B = atan2(node_b_location_2d[1], node_b_location_2d[0]);
232 double normalization_factor = sqrt(1 + dfdr*dfdr);
234 outward_normal_unit_vector[0] = dfdr*cos(theta_B)/normalization_factor;
235 outward_normal_unit_vector[1] = dfdr*sin(theta_B)/normalization_factor;
236 outward_normal_unit_vector[2] = -1.0/normalization_factor;
239 c_vector<double,2> projected_force_between_nodes_2d;
240 double force_dot_normal = inner_prod(force_between_nodes, outward_normal_unit_vector);
242 for (
unsigned i=0; i<2; i++)
244 projected_force_between_nodes_2d[i] = force_between_nodes[i]
245 - force_dot_normal*outward_normal_unit_vector[i]
246 + force_dot_normal*outward_normal_unit_vector[2];
249 return projected_force_between_nodes_2d;
260 EXCEPTION(
"CryptProjectionForce is to be used with a subclass of MeshBasedCellPopulation only");
266 spring_iterator != p_static_cast_cell_population->
SpringsEnd();
269 unsigned nodeA_global_index = spring_iterator.GetNodeA()->GetIndex();
270 unsigned nodeB_global_index = spring_iterator.GetNodeB()->GetIndex();
273 c_vector<double, 2> negative_force = -1.0 * force;
274 spring_iterator.GetNodeB()->AddAppliedForceContribution(negative_force);
275 spring_iterator.GetNodeA()->AddAppliedForceContribution(force);
283 cell_iter != rCellPopulation.
End();
291 rCellPopulation.
GetNode(index)->AddAppliedForceContribution(wnt_chemotactic_force);
299 *rParamsFile <<
"\t\t\t<A>" <<
mA <<
"</A>\n";
300 *rParamsFile <<
"\t\t\t<B>" <<
mB <<
"</B>\n";
301 *rParamsFile <<
"\t\t\t<IncludeWntChemotaxis>" <<
mIncludeWntChemotaxis <<
"</IncludeWntChemotaxis>\n";
302 *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