#include <AdvectionCaUpdateRule.hpp>
Inherits AbstractCaUpdateRule< DIM >.
Public Member Functions | |
AdvectionCaUpdateRule (unsigned advectionDirection, double advectionSpeed) | |
AdvectionCaUpdateRule () | |
~AdvectionCaUpdateRule () | |
unsigned | GetNewLocationOfCell (unsigned currentLocationIndex, CaBasedCellPopulation< DIM > &rCellPopulation, double dt) |
unsigned | GetAdvectionDirection () |
double | GetAdvectionSpeed () |
void | OutputUpdateRuleParameters (out_stream &rParamsFile) |
Private Member Functions | |
template<class Archive > | |
void | serialize (Archive &archive, const unsigned int version) |
Private Attributes | |
unsigned | mAdvectionDirection |
double | mAdvectionSpeed |
Friends | |
class | boost::serialization::access |
An update rule class to model uniform steady advection. This class is currently implemented in 2D only.
The constructor must be passed an unsigned that corresponds to one of the eight possible flow directions in 2D (N, NW, W,SW, S, SE, E, NE) and a double that gives the speed of the flow. At each time step, a uniform random number r_i is generated for each cell i that has a free neighbour in the direction of the imposed flow; if r_i < s*dt, where s denotes the flow speed and dt denotes the time step, then the cell is moved. This ensures that the mean speed of an advected cell is equal to the flow speed, independent of the time step used.
Definition at line 52 of file AdvectionCaUpdateRule.hpp.
AdvectionCaUpdateRule< DIM >::AdvectionCaUpdateRule | ( | unsigned | advectionDirection, | |
double | advectionSpeed | |||
) | [inline] |
Constructor.
advectionDirection | the direction of the flow (must take one of the values 0 to 7 inclusive) | |
advectionSpeed | the speed of the flow |
Definition at line 34 of file AdvectionCaUpdateRule.cpp.
AdvectionCaUpdateRule< DIM >::AdvectionCaUpdateRule | ( | ) | [inline] |
Alternative constructor, for use in archiving.
Definition at line 42 of file AdvectionCaUpdateRule.cpp.
AdvectionCaUpdateRule< DIM >::~AdvectionCaUpdateRule | ( | ) | [inline] |
Destructor.
Definition at line 48 of file AdvectionCaUpdateRule.cpp.
unsigned AdvectionCaUpdateRule< DIM >::GetAdvectionDirection | ( | ) | [inline] |
Definition at line 168 of file AdvectionCaUpdateRule.cpp.
References AdvectionCaUpdateRule< DIM >::mAdvectionDirection.
double AdvectionCaUpdateRule< DIM >::GetAdvectionSpeed | ( | ) | [inline] |
Definition at line 174 of file AdvectionCaUpdateRule.cpp.
References AdvectionCaUpdateRule< DIM >::mAdvectionSpeed.
unsigned AdvectionCaUpdateRule< DIM >::GetNewLocationOfCell | ( | unsigned | currentLocationIndex, | |
CaBasedCellPopulation< DIM > & | rCellPopulation, | |||
double | dt | |||
) | [inline, virtual] |
Overridden GetNewLocationOfCell() method.
This moves the cell in the prescribed direction mAdvectionDirection to its nearest neighbour if this is free, with a probability that scales to ensure that the average speed is mAdvectionSpeed.
currentLocationIndex | the current location index of a cell | |
rCellPopulation | reference to the cell population | |
dt | timestep of the simulation to calculate probability of movement in current timestep |
For now this is accepting an unsigned flow input. Ultimately we want to have this accepting a std::vector<unsigned> so a flow field can be read in.
Implements AbstractCaUpdateRule< DIM >.
Definition at line 58 of file AdvectionCaUpdateRule.cpp.
References EXCEPTION, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetWidth(), RandomNumberGenerator::Instance(), CaBasedCellPopulation< DIM >::IsEmptySite(), AdvectionCaUpdateRule< DIM >::mAdvectionDirection, AdvectionCaUpdateRule< DIM >::mAdvectionSpeed, NEVER_REACHED, and CaBasedCellPopulation< DIM >::rGetMesh().
void AdvectionCaUpdateRule< DIM >::OutputUpdateRuleParameters | ( | out_stream & | rParamsFile | ) | [inline, virtual] |
Overridden OutputUpdateRuleParameters() method.
rParamsFile | the file stream to which the parameters are output |
Implements AbstractCaUpdateRule< DIM >.
Definition at line 180 of file AdvectionCaUpdateRule.cpp.
References AdvectionCaUpdateRule< DIM >::mAdvectionDirection, and AdvectionCaUpdateRule< DIM >::mAdvectionSpeed.
void AdvectionCaUpdateRule< DIM >::serialize | ( | Archive & | archive, | |
const unsigned int | version | |||
) | [inline, private] |
Serialize the object and its member variables.
archive | the archive | |
version | the current version of this class |
Reimplemented from AbstractCaUpdateRule< DIM >.
Definition at line 77 of file AdvectionCaUpdateRule.hpp.
References AdvectionCaUpdateRule< DIM >::mAdvectionDirection, and AdvectionCaUpdateRule< DIM >::mAdvectionSpeed.
friend class boost::serialization::access [friend] |
Needed for serialization.
Reimplemented from AbstractCaUpdateRule< DIM >.
Definition at line 69 of file AdvectionCaUpdateRule.hpp.
unsigned AdvectionCaUpdateRule< DIM >::mAdvectionDirection [private] |
Unsigned that describes the direction of the flow. We use the following convention to encode direction: 0=N, 1=NW, 2=W, 3=SW, 4=S, 5=SE, 6=E, 7=NE.
Definition at line 61 of file AdvectionCaUpdateRule.hpp.
Referenced by AdvectionCaUpdateRule< DIM >::GetAdvectionDirection(), AdvectionCaUpdateRule< DIM >::GetNewLocationOfCell(), AdvectionCaUpdateRule< DIM >::OutputUpdateRuleParameters(), and AdvectionCaUpdateRule< DIM >::serialize().
double AdvectionCaUpdateRule< DIM >::mAdvectionSpeed [private] |
The speed of the flow.
Definition at line 66 of file AdvectionCaUpdateRule.hpp.
Referenced by AdvectionCaUpdateRule< DIM >::GetAdvectionSpeed(), AdvectionCaUpdateRule< DIM >::GetNewLocationOfCell(), AdvectionCaUpdateRule< DIM >::OutputUpdateRuleParameters(), and AdvectionCaUpdateRule< DIM >::serialize().