Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
ImmersedBoundarySimulationModifier< DIM > Class Template Reference

#include <ImmersedBoundarySimulationModifier.hpp>

+ Inheritance diagram for ImmersedBoundarySimulationModifier< DIM >:
+ Collaboration diagram for ImmersedBoundarySimulationModifier< DIM >:

Public Member Functions

 ImmersedBoundarySimulationModifier ()
 
virtual ~ImmersedBoundarySimulationModifier ()=default
 
virtual void UpdateAtEndOfTimeStep (AbstractCellPopulation< DIM, DIM > &rCellPopulation)
 
virtual void SetupSolve (AbstractCellPopulation< DIM, DIM > &rCellPopulation, std::string outputDirectory)
 
void OutputSimulationModifierParameters (out_stream &rParamsFile)
 
void SetNodeNeighbourUpdateFrequency (unsigned newFrequency)
 
unsigned GetNodeNeighbourUpdateFrequency ()
 
void AddImmersedBoundaryForce (boost::shared_ptr< AbstractImmersedBoundaryForce< DIM > > pForce)
 
void AddNormalNoise () const
 
bool GetZeroFieldSums () const
 
void SetZeroFieldSums (bool zeroFieldSums)
 
void SetReynoldsNumber (double reynoldsNumber)
 
double GetReynoldsNumber ()
 
bool GetAdditiveNormalNoise () const
 
void SetAdditiveNormalNoise (bool additiveNormalNoise)
 
double GetNoiseStrength () const
 
void SetNoiseStrength (double noiseStrength)
 
unsigned GetNoiseSkip () const
 
void SetNoiseSkip (unsigned noiseSkip)
 
double GetNoiseLengthScale () const
 
void SetNoiseLengthScale (double noiseLengthScale)
 
- Public Member Functions inherited from AbstractCellBasedSimulationModifier< DIM, DIM >
 AbstractCellBasedSimulationModifier ()
 
virtual ~AbstractCellBasedSimulationModifier ()
 
virtual void UpdateAtEndOfTimeStep (AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > &rCellPopulation)=0
 
virtual void UpdateAtEndOfOutputTimeStep (AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > &rCellPopulation)
 
virtual void SetupSolve (AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > &rCellPopulation, std::string outputDirectory)=0
 
virtual void UpdateAtEndOfSolve (AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > &rCellPopulation)
 
void OutputSimulationModifierInfo (out_stream &rParamsFile)
 
- Public Member Functions inherited from Identifiable
virtual ~Identifiable ()
 
std::string GetIdentifier () const
 

Private Member Functions

template<class Archive >
void serialize (Archive &archive, const unsigned int version)
 
void UpdateFluidVelocityGrids (AbstractCellPopulation< DIM, DIM > &rCellPopulation)
 
void SetupConstantMemberVariables (AbstractCellPopulation< DIM, DIM > &rCellPopulation)
 
void ClearForcesAndSources ()
 
void RecalculateAverageNodeSpacings ()
 
void AddImmersedBoundaryForceContributions ()
 
void PropagateForcesToFluidGrid ()
 
void PropagateFluidSourcesToGrid ()
 
void SolveNavierStokesSpectral ()
 
double Delta1D (double dist, double spacing)
 
void Upwind2d (const multi_array< double, 3 > &rInput, multi_array< double, 3 > &rOutput)
 
void CalculateSourceGradients (const multi_array< double, 3 > &rRhs, multi_array< double, 3 > &rGradients)
 
void ZeroFieldSums (multi_array< double, 3 > &rField)
 

Private Attributes

ImmersedBoundaryMesh< DIM, DIM > * mpMesh
 
ImmersedBoundaryCellPopulation< DIM > * mpCellPopulation
 
unsigned mNodeNeighbourUpdateFrequency
 
double mGridSpacingX
 
double mGridSpacingY
 
double mFftNorm
 
bool mAdditiveNormalNoise
 
double mNoiseStrength
 
unsigned mNoiseSkip
 
double mNoiseLengthScale
 
bool mZeroFieldSums
 
std::unique_ptr< ObsoleteBoxCollection< DIM > > mpBoxCollection
 
std::vector< std::pair< Node< DIM > *, Node< DIM > * > > mNodePairs
 
std::map< unsigned, std::set< unsigned > > mNodeNeighbours
 
double mReynoldsNumber
 
std::complex< doublemI
 
std::vector< boost::shared_ptr< AbstractImmersedBoundaryForce< DIM > > > mForceCollection
 
std::unique_ptr< ImmersedBoundary2dArrays< DIM > > mpArrays
 
std::unique_ptr< ImmersedBoundaryFftInterface< DIM > > mpFftInterface
 
std::unique_ptr< UniformGridRandomFieldGenerator< DIM > > mpRandomField
 

Friends

class TestImmersedBoundarySimulationModifier
 
class boost::serialization::access
 

Detailed Description

template<unsigned DIM>
class ImmersedBoundarySimulationModifier< DIM >

A modifier class which at each simulation time step implements the immersed boundary algorithm similar to Rejniak et al (2004). A computational model of the mechanics of growth of the villous trophoblast bilayer. Bull. Math. Biol. 66:199–232. doi:10.1016/j.bulm.2003.06.001.

Definition at line 64 of file ImmersedBoundarySimulationModifier.hpp.

Constructor & Destructor Documentation

◆ ImmersedBoundarySimulationModifier()

Default constructor.

Definition at line 45 of file ImmersedBoundarySimulationModifier.cpp.

◆ ~ImmersedBoundarySimulationModifier()

template<unsigned DIM>
virtual ImmersedBoundarySimulationModifier< DIM >::~ImmersedBoundarySimulationModifier ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ AddImmersedBoundaryForce()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::AddImmersedBoundaryForce ( boost::shared_ptr< AbstractImmersedBoundaryForce< DIM > >  pForce)

Add an immersed boundary force to be used in this modifier.

Parameters
pForcepointer to a force law

Definition at line 797 of file ImmersedBoundarySimulationModifier.cpp.

◆ AddImmersedBoundaryForceContributions()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::AddImmersedBoundaryForceContributions ( )
private

Loops over each immersed boundary force and invokes AddImmersedBoundaryForceContribution()

Definition at line 295 of file ImmersedBoundarySimulationModifier.cpp.

◆ AddNormalNoise()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::AddNormalNoise ( ) const

Add the random noise as generated by mpRandomField

Definition at line 804 of file ImmersedBoundarySimulationModifier.cpp.

References SimulationTime::Instance().

◆ CalculateSourceGradients()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::CalculateSourceGradients ( const multi_array< double, 3 > &  rRhs,
multi_array< double, 3 > &  rGradients 
)
private

Calculates the vector of central differences of the fluid source grid

Parameters
rRhsconst reference to rhs grids which contain the fluid source strengths
rGradientsreference to grids storing the graidents

Definition at line 755 of file ImmersedBoundarySimulationModifier.cpp.

◆ ClearForcesAndSources()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::ClearForcesAndSources ( )
private

Helper method for UpdateFluidVelocityGrids() Ensures force applied to each node is reset to zero Ensures fluid force grids and source grid are reset

Definition at line 234 of file ImmersedBoundarySimulationModifier.cpp.

◆ Delta1D()

template<unsigned DIM>
double ImmersedBoundarySimulationModifier< DIM >::Delta1D ( double  dist,
double  spacing 
)
private

Helper method for PropagateForcesToFluidGrid() Calculates the discrete delta approximation based on distance and grid spacing

Parameters
distabsolute 1-D distance between boundary-node and fluid-node
spacingthe grid spacing
Returns
computed Delta1D value

Definition at line 696 of file ImmersedBoundarySimulationModifier.cpp.

◆ GetAdditiveNormalNoise()

template<unsigned DIM>
bool ImmersedBoundarySimulationModifier< DIM >::GetAdditiveNormalNoise ( ) const
Returns
mAdditiveNormalNoise

Definition at line 855 of file ImmersedBoundarySimulationModifier.cpp.

◆ GetNodeNeighbourUpdateFrequency()

template<unsigned DIM>
unsigned ImmersedBoundarySimulationModifier< DIM >::GetNodeNeighbourUpdateFrequency ( )
Returns
the current number of time steps after which node neighbours are re-calculated

Definition at line 791 of file ImmersedBoundarySimulationModifier.cpp.

◆ GetNoiseLengthScale()

template<unsigned DIM>
double ImmersedBoundarySimulationModifier< DIM >::GetNoiseLengthScale ( ) const
Returns
mNoiseLengthScale

Definition at line 893 of file ImmersedBoundarySimulationModifier.cpp.

◆ GetNoiseSkip()

template<unsigned DIM>
unsigned ImmersedBoundarySimulationModifier< DIM >::GetNoiseSkip ( ) const
Returns
mNoiseSkip

Definition at line 881 of file ImmersedBoundarySimulationModifier.cpp.

◆ GetNoiseStrength()

template<unsigned DIM>
double ImmersedBoundarySimulationModifier< DIM >::GetNoiseStrength ( ) const
Returns
mNoiseStrength

Definition at line 868 of file ImmersedBoundarySimulationModifier.cpp.

◆ GetReynoldsNumber()

template<unsigned DIM>
double ImmersedBoundarySimulationModifier< DIM >::GetReynoldsNumber ( )
Returns
mReynoldsNumber

Definition at line 849 of file ImmersedBoundarySimulationModifier.cpp.

◆ GetZeroFieldSums()

template<unsigned int DIM>
bool ImmersedBoundarySimulationModifier< DIM >::GetZeroFieldSums ( ) const
Returns
mZeroFieldSums

Definition at line 906 of file ImmersedBoundarySimulationModifier.cpp.

◆ OutputSimulationModifierParameters()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::OutputSimulationModifierParameters ( out_stream &  rParamsFile)
virtual

Overridden OutputSimulationModifierParameters() method. Output any simulation modifier parameters to file.

Parameters
rParamsFilethe file stream to which the parameters are output

Implements AbstractCellBasedSimulationModifier< DIM, DIM >.

Definition at line 97 of file ImmersedBoundarySimulationModifier.cpp.

References AbstractCellBasedSimulationModifier< ELEMENT_DIM, SPACE_DIM >::OutputSimulationModifierParameters().

◆ PropagateFluidSourcesToGrid()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::PropagateFluidSourcesToGrid ( )
private

Helper method for UpdateFluidVelocityGrids() Propagates fluid sources to grid

Definition at line 434 of file ImmersedBoundarySimulationModifier.cpp.

References NEVER_REACHED.

◆ PropagateForcesToFluidGrid()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::PropagateForcesToFluidGrid ( )
private

Helper method for UpdateFluidVelocityGrids() Propagates elastic forces to fluid grid

Definition at line 307 of file ImmersedBoundarySimulationModifier.cpp.

References NEVER_REACHED, Node< SPACE_DIM >::rGetAppliedForce(), and Node< SPACE_DIM >::rGetLocation().

◆ RecalculateAverageNodeSpacings()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::RecalculateAverageNodeSpacings ( )
private

Helper method for UpdateFluidVelocityGrids() Recalculate the average node spacings for elements and laminas. This is performed at each timestep so as to cache the values for safe reuse without re-calculation by force classes and other methods.

Definition at line 277 of file ImmersedBoundarySimulationModifier.cpp.

◆ serialize()

template<unsigned DIM>
template<class Archive >
void ImmersedBoundarySimulationModifier< DIM >::serialize ( Archive &  archive,
const unsigned int  version 
)
inlineprivate

Boost Serialization method for archiving/checkpointing. Archives the object and its member variables.

Parameters
archiveThe boost archive.
versionThe current version of this class.

Definition at line 81 of file ImmersedBoundarySimulationModifier.hpp.

◆ SetAdditiveNormalNoise()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::SetAdditiveNormalNoise ( bool  additiveNormalNoise)
Parameters
additiveNormalNoisewhether to include additive normal noise

Definition at line 861 of file ImmersedBoundarySimulationModifier.cpp.

◆ SetNodeNeighbourUpdateFrequency()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::SetNodeNeighbourUpdateFrequency ( unsigned  newFrequency)
Parameters
newFrequencythe new number of time steps after which node neighbours are re-calculated

Definition at line 783 of file ImmersedBoundarySimulationModifier.cpp.

◆ SetNoiseLengthScale()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::SetNoiseLengthScale ( double  noiseLengthScale)
Parameters
noiseLengthScalethe new value of mNoiseLengthScale

Definition at line 899 of file ImmersedBoundarySimulationModifier.cpp.

◆ SetNoiseSkip()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::SetNoiseSkip ( unsigned  noiseSkip)
Parameters
noiseSkipthe new value of mNoiseSkip

Definition at line 887 of file ImmersedBoundarySimulationModifier.cpp.

◆ SetNoiseStrength()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::SetNoiseStrength ( double  noiseStrength)
Parameters
noiseStrengththe new value of mNoiseStrength

Definition at line 874 of file ImmersedBoundarySimulationModifier.cpp.

◆ SetReynoldsNumber()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::SetReynoldsNumber ( double  reynoldsNumber)
Parameters
reynoldsNumberthe new Reynolds number

Definition at line 841 of file ImmersedBoundarySimulationModifier.cpp.

◆ SetupConstantMemberVariables()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::SetupConstantMemberVariables ( AbstractCellPopulation< DIM, DIM > &  rCellPopulation)
private

Helper method for SetupSolve() Sets up all variables which need not change throughout the simulation

Parameters
rCellPopulationreference to the cell population

Definition at line 129 of file ImmersedBoundarySimulationModifier.cpp.

References EXCEPTION, SimulationTime::GetTimeStep(), SimulationTime::Instance(), and NEVER_REACHED.

◆ SetupSolve()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::SetupSolve ( AbstractCellPopulation< DIM, DIM > &  rCellPopulation,
std::string  outputDirectory 
)
virtual

Overridden SetupSolve() method.

Specify what to do in the simulation before the start of the time loop.

Parameters
rCellPopulationreference to the cell population
outputDirectorythe output directory, relative to where Chaste output is stored

Definition at line 82 of file ImmersedBoundarySimulationModifier.cpp.

◆ SetZeroFieldSums()

template<unsigned int DIM>
void ImmersedBoundarySimulationModifier< DIM >::SetZeroFieldSums ( bool  zeroFieldSums)
Parameters
zeroFieldSumsthe new value of mZeroFieldSums

Definition at line 912 of file ImmersedBoundarySimulationModifier.cpp.

◆ SolveNavierStokesSpectral()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::SolveNavierStokesSpectral ( )
private

Helper method for UpdateFluidVelocityGrids() Updates fluid velocity grids by solving Navier-Stokes

Definition at line 522 of file ImmersedBoundarySimulationModifier.cpp.

References SimulationTime::GetTimeStep(), and SimulationTime::Instance().

◆ UpdateAtEndOfTimeStep()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::UpdateAtEndOfTimeStep ( AbstractCellPopulation< DIM, DIM > &  rCellPopulation)
virtual

Overridden UpdateAtEndOfTimeStep() method.

Specify what to do in the simulation at the end of each time step.

Parameters
rCellPopulationreference to the cell population

Definition at line 68 of file ImmersedBoundarySimulationModifier.cpp.

References SimulationTime::Instance().

◆ UpdateFluidVelocityGrids()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::UpdateFluidVelocityGrids ( AbstractCellPopulation< DIM, DIM > &  rCellPopulation)
private

Helper method to calculate elastic forces, propagate these to the fluid grid and solve Navier-Stokes to update the fluid velocity grids

Parameters
rCellPopulationreference to the cell population

Definition at line 105 of file ImmersedBoundarySimulationModifier.cpp.

◆ Upwind2d()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::Upwind2d ( const multi_array< double, 3 > &  rInput,
multi_array< double, 3 > &  rOutput 
)
private

Calculates upwind difference of fluid velocity grids

Parameters
rInputconst reference to input grids
rOutputreference to output grids

Definition at line 704 of file ImmersedBoundarySimulationModifier.cpp.

◆ ZeroFieldSums()

template<unsigned DIM>
void ImmersedBoundarySimulationModifier< DIM >::ZeroFieldSums ( multi_array< double, 3 > &  rField)
private

Remove any bias in field sums.

Parameters
rFielda reference to the field over which the field sums will be zeroed

Definition at line 657 of file ImmersedBoundarySimulationModifier.cpp.

Friends And Related Symbol Documentation

◆ boost::serialization::access

template<unsigned DIM>
friend class boost::serialization::access
friend

Needed for serialization.

Definition at line 72 of file ImmersedBoundarySimulationModifier.hpp.

◆ TestImmersedBoundarySimulationModifier

template<unsigned DIM>
friend class TestImmersedBoundarySimulationModifier
friend

To allow tests to directly access solver methods

Definition at line 69 of file ImmersedBoundarySimulationModifier.hpp.

Member Data Documentation

◆ mAdditiveNormalNoise

template<unsigned DIM>
bool ImmersedBoundarySimulationModifier< DIM >::mAdditiveNormalNoise
private

Whether to apply additive normal noise to the fluid force grids

Definition at line 105 of file ImmersedBoundarySimulationModifier.hpp.

◆ mFftNorm

template<unsigned DIM>
double ImmersedBoundarySimulationModifier< DIM >::mFftNorm
private

Normalising constant needed for FFT

Definition at line 102 of file ImmersedBoundarySimulationModifier.hpp.

◆ mForceCollection

template<unsigned DIM>
std::vector<boost::shared_ptr<AbstractImmersedBoundaryForce<DIM> > > ImmersedBoundarySimulationModifier< DIM >::mForceCollection
private

A list of force laws to determine the force applied to each node

Definition at line 142 of file ImmersedBoundarySimulationModifier.hpp.

◆ mGridSpacingX

template<unsigned DIM>
double ImmersedBoundarySimulationModifier< DIM >::mGridSpacingX
private

Number of grid points in the x direction

Definition at line 96 of file ImmersedBoundarySimulationModifier.hpp.

◆ mGridSpacingY

template<unsigned DIM>
double ImmersedBoundarySimulationModifier< DIM >::mGridSpacingY
private

Number of grid points in the y direction

Definition at line 99 of file ImmersedBoundarySimulationModifier.hpp.

◆ mI

template<unsigned DIM>
std::complex<double> ImmersedBoundarySimulationModifier< DIM >::mI
private

Imaginary unit.

Definition at line 139 of file ImmersedBoundarySimulationModifier.hpp.

◆ mNodeNeighbours

template<unsigned DIM>
std::map<unsigned, std::set<unsigned> > ImmersedBoundarySimulationModifier< DIM >::mNodeNeighbours
private

A map between node indices and a set of their possible neighbours, used calculating cell-cell interactions

Definition at line 129 of file ImmersedBoundarySimulationModifier.hpp.

◆ mNodeNeighbourUpdateFrequency

template<unsigned DIM>
unsigned ImmersedBoundarySimulationModifier< DIM >::mNodeNeighbourUpdateFrequency
private

How often we calculate which cells are neighbours

Definition at line 93 of file ImmersedBoundarySimulationModifier.hpp.

◆ mNodePairs

template<unsigned DIM>
std::vector<std::pair<Node<DIM>*, Node<DIM>*> > ImmersedBoundarySimulationModifier< DIM >::mNodePairs
private

A vector of pairs of pointers to nodes, representing all possible node-node interactions

Definition at line 126 of file ImmersedBoundarySimulationModifier.hpp.

◆ mNoiseLengthScale

template<unsigned DIM>
double ImmersedBoundarySimulationModifier< DIM >::mNoiseLengthScale
private

The length scale on which the Gaussian noise is correlated

Definition at line 117 of file ImmersedBoundarySimulationModifier.hpp.

◆ mNoiseSkip

template<unsigned DIM>
unsigned ImmersedBoundarySimulationModifier< DIM >::mNoiseSkip
private

A random field big enough to have a grid point for every fluid mesh point is likely too big to generate. mNoiseSkip is the sampling ratio such that ever mNoiseSkip^DIM sub-region takes the same noise value

Definition at line 114 of file ImmersedBoundarySimulationModifier.hpp.

◆ mNoiseStrength

template<unsigned DIM>
double ImmersedBoundarySimulationModifier< DIM >::mNoiseStrength
private

The strength of the normal noise to be added to the force grids

Definition at line 108 of file ImmersedBoundarySimulationModifier.hpp.

◆ mpArrays

template<unsigned DIM>
std::unique_ptr<ImmersedBoundary2dArrays<DIM> > ImmersedBoundarySimulationModifier< DIM >::mpArrays
private

An owning pointer to structure storing all necessary arrays

Definition at line 145 of file ImmersedBoundarySimulationModifier.hpp.

◆ mpBoxCollection

template<unsigned DIM>
std::unique_ptr<ObsoleteBoxCollection<DIM> > ImmersedBoundarySimulationModifier< DIM >::mpBoxCollection
private

An owning pointer to a box collection for efficiently keeping track of node neighbours

Definition at line 123 of file ImmersedBoundarySimulationModifier.hpp.

◆ mpCellPopulation

template<unsigned DIM>
ImmersedBoundaryCellPopulation<DIM>* ImmersedBoundarySimulationModifier< DIM >::mpCellPopulation
private

Non-owning pointer to the immersed boundary cell population

Definition at line 90 of file ImmersedBoundarySimulationModifier.hpp.

◆ mpFftInterface

template<unsigned DIM>
std::unique_ptr<ImmersedBoundaryFftInterface<DIM> > ImmersedBoundarySimulationModifier< DIM >::mpFftInterface
private

An owning pointer to the interface that handles discrete Fourier transforms

Definition at line 148 of file ImmersedBoundarySimulationModifier.hpp.

◆ mpMesh

template<unsigned DIM>
ImmersedBoundaryMesh<DIM,DIM>* ImmersedBoundarySimulationModifier< DIM >::mpMesh
private

Non-owning pointer to the immersed boundary mesh

Definition at line 87 of file ImmersedBoundarySimulationModifier.hpp.

◆ mpRandomField

template<unsigned DIM>
std::unique_ptr<UniformGridRandomFieldGenerator<DIM> > ImmersedBoundarySimulationModifier< DIM >::mpRandomField
private

An owning pointer to a uniform grid random field generator, for adding noise if required

Definition at line 151 of file ImmersedBoundarySimulationModifier.hpp.

◆ mReynoldsNumber

template<unsigned DIM>
double ImmersedBoundarySimulationModifier< DIM >::mReynoldsNumber
private

The fluid Reynolds number.

Initialised to 1e-4 in the constructor.

Definition at line 136 of file ImmersedBoundarySimulationModifier.hpp.

◆ mZeroFieldSums

template<unsigned DIM>
bool ImmersedBoundarySimulationModifier< DIM >::mZeroFieldSums
private

Whether to zero out the force and velocity fields to remove systematic drift

Definition at line 120 of file ImmersedBoundarySimulationModifier.hpp.


The documentation for this class was generated from the following files: