36#include "ImmersedBoundaryLinearInteractionForce.hpp"
37#include "ImmersedBoundaryEnumerations.hpp"
39template <
unsigned DIM>
44 mLaminaSpringConstMult(1.0),
45 mLaminaRestLengthMult(1.0)
54template <
unsigned DIM>
59 for (
unsigned pair = 0; pair < rNodePairs.size(); ++pair)
67 Node<DIM>* p_node_a = rNodePairs[pair].first;
68 Node<DIM>* p_node_b = rNodePairs[pair].second;
72 double normed_dist = norm_2(vec_a2b);
78 bool a_lamina = p_node_a->
GetRegion() == LAMINA_REGION;
79 bool b_lamina = p_node_b->
GetRegion() == LAMINA_REGION;
90 double elem_spacing = 0.5 * (node_a_elem_spacing + node_b_elem_spacing);
92 double eff_spring_const = mSpringConst * elem_spacing / rCellPopulation.
GetIntrinsicSpacing();
95 if (a_lamina || b_lamina)
97 eff_spring_const *= mLaminaSpringConstMult;
98 eff_rest_length *= mLaminaRestLengthMult;
107 vec_a2b *= eff_spring_const * (normed_dist - eff_rest_length) / normed_dist;
109 c_vector<double, DIM> force_a2b = vec_a2b * (elem_spacing / node_a_elem_spacing);
112 c_vector<double, DIM> force_b2a = vec_a2b * (-1.0 * elem_spacing / node_b_elem_spacing);
118 if (this->mAdditiveNormalNoise)
120 this->AddNormalNoiseToNodes(rCellPopulation);
125template<
unsigned DIM>
127 out_stream& rParamsFile)
129 *rParamsFile <<
"\t\t\t<SpringConstant>" << mSpringConst <<
"</SpringConstant>\n";
130 *rParamsFile <<
"\t\t\t<RestLength>" << mRestLength <<
"</RestLength>\n";
131 *rParamsFile <<
"\t\t\t<LaminaSpringConstMult>" << mLaminaSpringConstMult <<
"</LaminaSpringConstMult>\n";
132 *rParamsFile <<
"\t\t\t<LaminaRestLengthMult>" << mLaminaRestLengthMult <<
"</LaminaRestLengthMult>\n";
138template<
unsigned DIM>
144template<
unsigned DIM>
148 mSpringConst = springConst;
151template<
unsigned DIM>
157template<
unsigned DIM>
160 mRestLength = restLength;
163template<
unsigned DIM>
166 return mLaminaSpringConstMult;
169template<
unsigned DIM>
171 double laminaSpringConstMult)
173 mLaminaSpringConstMult = laminaSpringConstMult;
176template<
unsigned DIM>
179 return mLaminaRestLengthMult;
182template<
unsigned DIM>
184 double laminaRestLengthMult)
186 mLaminaRestLengthMult = laminaRestLengthMult;
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
virtual void OutputImmersedBoundaryForceParameters(out_stream &rParamsFile)=0
double GetIntrinsicSpacing() const
double GetInteractionDistance() const
ImmersedBoundaryMesh< DIM, DIM > & rGetMesh()
void SetLaminaSpringConstMult(double laminaSpringConstMult)
void SetRestLength(double restLength)
void AddImmersedBoundaryForceContribution(std::vector< std::pair< Node< DIM > *, Node< DIM > * > > &rNodePairs, ImmersedBoundaryCellPopulation< DIM > &rCellPopulation)
void SetSpringConst(double springConst)
double GetLaminaRestLengthMult() const
void OutputImmersedBoundaryForceParameters(out_stream &rParamsFile)
double GetLaminaSpringConstMult() const
double GetSpringConst() const
virtual ~ImmersedBoundaryLinearInteractionForce()
ImmersedBoundaryLinearInteractionForce()
void SetLaminaRestLengthMult(double laminaRestLengthMult)
double GetRestLength() const
bool NodesInDifferentElementOrLamina(Node< SPACE_DIM > *pNodeA, Node< SPACE_DIM > *pNodeB)
double GetAverageNodeSpacingOfElement(unsigned index, bool recalculate=true)
double GetAverageNodeSpacingOfLamina(unsigned index, bool recalculate=true)
c_vector< double, SPACE_DIM > GetVectorFromAtoB(const c_vector< double, SPACE_DIM > &rLocation1, const c_vector< double, SPACE_DIM > &rLocation2)
ContainingElementIterator ContainingElementsBegin() const
const c_vector< double, SPACE_DIM > & rGetLocation() const
void AddAppliedForceContribution(const c_vector< double, SPACE_DIM > &rForceContribution)
unsigned GetRegion() const