36#include "ImmersedBoundaryMorseMembraneForce.hpp"
38template <
unsigned DIM>
41 mElementWellDepth(1e6),
42 mElementRestLength(0.5),
43 mLaminaWellDepth(1e6),
44 mLaminaRestLength(0.5),
49template <
unsigned DIM>
54template <
unsigned DIM>
67 CalculateForcesOnElement(*elem_it, rCellPopulation, intrinsic_spacing_squared);
75 CalculateForcesOnElement(*lam_it, rCellPopulation, intrinsic_spacing_squared);
78 if (this->mAdditiveNormalNoise)
80 this->AddNormalNoiseToNodes(rCellPopulation);
84template <
unsigned DIM>
85template <
unsigned ELEMENT_DIM>
89 double intrinsicSpacingSquared)
92 unsigned elem_idx = rElement.
GetIndex();
96 std::vector<c_vector<double, DIM> > force_to_next(num_nodes);
111 double node_spacing = 0.0;
112 double well_depth = 0.0;
113 double rest_length = 0.0;
114 double well_width = mWellWidth;
117 if (ELEMENT_DIM < DIM)
121 well_depth = mLaminaWellDepth * intrinsicSpacingSquared / (node_spacing * node_spacing);
122 rest_length = mLaminaRestLength * node_spacing;
123 well_width *= node_spacing;
129 well_depth = mElementWellDepth * intrinsicSpacingSquared / (node_spacing * node_spacing);
130 rest_length = mElementRestLength * node_spacing;
131 well_width *= node_spacing;
135 for (
unsigned node_idx = 0; node_idx < num_nodes; node_idx++)
138 unsigned next_idx = (node_idx + 1) % num_nodes;
143 double normed_dist = norm_2(force_to_next[node_idx]);
145 double morse_exp = exp((rest_length - normed_dist) / well_width);
146 force_to_next[node_idx] *= 2.0 * well_width * well_depth * morse_exp * (1.0 - morse_exp) / normed_dist;
150 for (
unsigned node_idx = 0; node_idx < num_nodes; node_idx++)
153 unsigned prev_idx = (node_idx + num_nodes - 1) % num_nodes;
155 c_vector<double, DIM> aggregate_force = force_to_next[node_idx] - force_to_next[prev_idx];
158 rElement.
GetNode(node_idx)->AddAppliedForceContribution(aggregate_force);
162template <
unsigned DIM>
164 out_stream& rParamsFile)
166 *rParamsFile <<
"\t\t\t<ElementWellDepth>" << mElementWellDepth <<
"</ElementWellDepth>\n";
167 *rParamsFile <<
"\t\t\t<ElementRestLength>" << mElementRestLength <<
"</ElementRestLength>\n";
168 *rParamsFile <<
"\t\t\t<LaminaWellDepth>" << mLaminaWellDepth <<
"</LaminaWellDepth>\n";
169 *rParamsFile <<
"\t\t\t<LaminaRestLength>" << mLaminaRestLength <<
"</LaminaRestLength>\n";
170 *rParamsFile <<
"\t\t\t<WellWidth>" << mWellWidth <<
"</WellWidth>\n";
176template <
unsigned DIM>
179 return mElementWellDepth;
182template <
unsigned DIM>
184 double elementWellDepth)
186 mElementWellDepth = elementWellDepth;
189template <
unsigned DIM>
192 return mElementRestLength;
195template <
unsigned DIM>
197 double elementRestLength)
199 mElementRestLength = elementRestLength;
202template <
unsigned DIM>
205 return mLaminaWellDepth;
208template <
unsigned DIM>
210 double laminaWellDepth)
212 mLaminaWellDepth = laminaWellDepth;
215template <
unsigned DIM>
218 return mLaminaRestLength;
221template <
unsigned DIM>
223 double laminaRestLength)
225 mLaminaRestLength = laminaRestLength;
228template <
unsigned DIM>
234template <
unsigned DIM>
237 mWellWidth = wellWidth;
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
Node< SPACE_DIM > * GetNode(unsigned localIndex) const
double GetNodeLocation(unsigned localIndex, unsigned dimension) const
unsigned GetNumNodes() const
unsigned GetIndex() const
virtual void OutputImmersedBoundaryForceParameters(out_stream &rParamsFile)=0
double GetIntrinsicSpacing() const
ImmersedBoundaryMesh< DIM, DIM > & rGetMesh()
ImmersedBoundaryElementIterator GetElementIteratorEnd()
ImmersedBoundaryLaminaIterator GetLaminaIteratorBegin(bool skipDeletedLaminas=true)
ImmersedBoundaryElementIterator GetElementIteratorBegin(bool skipDeletedElements=true)
ImmersedBoundaryLaminaIterator GetLaminaIteratorEnd()
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)
void CalculateForcesOnElement(ImmersedBoundaryElement< ELEMENT_DIM, DIM > &rElement, ImmersedBoundaryCellPopulation< DIM > &rCellPopulation, double intrinsicSpacingSquared)
double GetElementRestLength() const
void SetWellWidth(double wellWidth)
double GetLaminaRestLength() const
void SetLaminaRestLength(double laminaRestLength)
void SetElementWellDepth(double elementWellDepth)
void OutputImmersedBoundaryForceParameters(out_stream &rParamsFile)
void AddImmersedBoundaryForceContribution(std::vector< std::pair< Node< DIM > *, Node< DIM > * > > &rNodePairs, ImmersedBoundaryCellPopulation< DIM > &rCellPopulation)
void SetElementRestLength(double elementRestLength)
double GetWellWidth() const
double GetLaminaWellDepth() const
void SetLaminaWellDepth(double laminaWellDepth)
ImmersedBoundaryMorseMembraneForce()
virtual ~ImmersedBoundaryMorseMembraneForce()
double GetElementWellDepth() const