36 #include "PopulationTestingForce.hpp"
38 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
41 mWithPositionDependence(hasPositionDependence)
45 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
48 for (
unsigned i=0; i<rCellPopulation.
GetNumNodes(); i++)
50 c_vector<double, SPACE_DIM> force;
52 for (
unsigned j=0; j<SPACE_DIM; j++)
54 if (mWithPositionDependence)
56 force[j] = (j+1)*i*0.01*rCellPopulation.
GetNode(i)->rGetLocation()[j];
60 force[j] = (j+1)*i*0.01;
63 rCellPopulation.
GetNode(i)->ClearAppliedForce();
64 rCellPopulation.
GetNode(i)->AddAppliedForceContribution(force);
68 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
71 c_vector<double, SPACE_DIM>& oldLocation,
74 c_vector<double, SPACE_DIM> result;
75 for (
unsigned j = 0; j < SPACE_DIM; j++)
77 if (mWithPositionDependence)
79 result[j] = oldLocation[j] + dt * (j+1)*0.01*nodeIndex * oldLocation[j] / damping;
83 result[j] = oldLocation[j] + dt * (j+1)*0.01*nodeIndex/damping;
89 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
92 c_vector<double, SPACE_DIM>& oldLocation,
95 c_vector<double, SPACE_DIM> result;
96 for (
unsigned j = 0; j < SPACE_DIM; j++)
98 double k1 = (j+1)*0.01*nodeIndex * oldLocation[j] / damping;
99 double k2 = (j+1)*0.01*nodeIndex * (oldLocation[j] + (dt/2.0)*k1) / damping;
100 double k3 = (j+1)*0.01*nodeIndex * (oldLocation[j] + (dt/2.0)*k2) / damping;
101 double k4 = (j+1)*0.01*nodeIndex * (oldLocation[j] + dt*k3) / damping;
102 result[j] = oldLocation[j] + (1.0/6.0)*dt*(k1 + 2*k2 + 2*k3 + k4);
107 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
110 c_vector<double, SPACE_DIM>& oldLocation,
113 c_vector<double, SPACE_DIM> result;
114 for (
unsigned j = 0; j < SPACE_DIM; j++)
116 result[j] = oldLocation[j] * (1 + 0.5*dt*0.01*(j+1)*nodeIndex / damping) / (1 - 0.5*dt*0.01*(j+1)*nodeIndex / damping);
121 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
124 c_vector<double, SPACE_DIM>& oldLocation,
127 c_vector<double, SPACE_DIM> result;
128 for (
unsigned j = 0; j < SPACE_DIM; j++)
130 result[j] = oldLocation[j] / (1 - dt*0.01*(j+1)*nodeIndex/damping);
135 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
virtual Node< SPACE_DIM > * GetNode(unsigned index)=0
c_vector< double, SPACE_DIM > GetExpectedOneStepLocationRK4(unsigned nodeIndex, double damping, c_vector< double, SPACE_DIM > &oldLocation, double dt)
virtual void OutputForceParameters(out_stream &rParamsFile)
PopulationTestingForce(bool hasPositionDependence=true)
c_vector< double, SPACE_DIM > GetExpectedOneStepLocationAM2(unsigned nodeIndex, double damping, c_vector< double, SPACE_DIM > &oldLocation, double dt)
c_vector< double, SPACE_DIM > GetExpectedOneStepLocationBE(unsigned nodeIndex, double damping, c_vector< double, SPACE_DIM > &oldLocation, double dt)
#define EXPORT_TEMPLATE_CLASS_ALL_DIMS(CLASS)
void AddForceContribution(AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > &rCellPopulation)
c_vector< double, SPACE_DIM > GetExpectedOneStepLocationFE(unsigned nodeIndex, double damping, c_vector< double, SPACE_DIM > &oldLocation, double dt)
virtual unsigned GetNumNodes()=0