BioDynaMo  v1.05.120-25dc9790
Public Member Functions | Private Member Functions | List of all members
bdm::EulerGrid Class Reference

Continuum model for the 3D heat equation with exponential decay $ \partial_t u = \nabla D \nabla u - \mu u $. More...

#include <euler_grid.h>

Inheritance diagram for bdm::EulerGrid:
[legend]
Collaboration diagram for bdm::EulerGrid:
[legend]

Public Member Functions

 EulerGrid ()=default
 
 EulerGrid (int substance_id, std::string substance_name, real_t dc, real_t mu, int resolution=10)
 
void DiffuseWithClosedEdge (real_t dt) override
 
void DiffuseWithOpenEdge (real_t dt) override
 
void DiffuseWithDirichlet (real_t dt) override
 
void DiffuseWithNeumann (real_t dt) override
 
void DiffuseWithPeriodic (real_t dt) override
 
- Public Member Functions inherited from bdm::DiffusionGrid
 DiffusionGrid ()=default
 
 DiffusionGrid (const TRootIOCtor *)
 
 DiffusionGrid (int substance_id, const std::string &substance_name, real_t dc, real_t mu, int resolution=10)
 
 ~DiffusionGrid () override=default
 
 DiffusionGrid (const DiffusionGrid &)=delete
 
DiffusionGridoperator= (const DiffusionGrid &)=delete
 
 DiffusionGrid (DiffusionGrid &&)=delete
 
DiffusionGridoperator= (DiffusionGrid &&)=delete
 
void Initialize () override
 
void Update () override
 
void Step (real_t dt) override
 
void Diffuse (real_t dt)
 
void CalculateGradient ()
 
void RunInitializers ()
 
void ChangeConcentrationBy (const Real3 &position, real_t amount, InteractionMode mode=InteractionMode::kAdditive, bool scale_with_resolution=false)
 
void ChangeConcentrationBy (size_t idx, real_t amount, InteractionMode mode=InteractionMode::kAdditive, bool scale_with_resolution=false)
 See ChangeConcentrationBy(const Real3&, real_t, InteractionMode, bool). More...
 
real_t GetValue (const Real3 &position) const override
 Get the value of the scalar field at specified position. More...
 
real_t GetConcentration (const Real3 &position) const
 
real_t GetConcentration (const size_t idx) const
 Get the concentration at specified index. More...
 
Real3 GetGradient (const Real3 &position) const override
 
virtual void GetGradient (const Real3 &position, Real3 *gradient, bool normalize=true) const
 
std::array< uint32_t, 3 > GetBoxCoordinates (const Real3 &position) const
 Get the coordinates of the box at the specified position. More...
 
std::array< uint32_t, 3 > GetBoxCoordinates (const size_t idx) const
 
size_t GetBoxIndex (const std::array< uint32_t, 3 > &box_coord) const
 Calculates the box index at specified box coordinates. More...
 
size_t GetBoxIndex (const Real3 &position) const
 Calculates the box index of the substance at specified position. More...
 
std::array< size_t, 6 > GetNeighboringBoxes (size_t index) const
 
std::array< size_t, 6 > GetNeighboringBoxes (size_t index, const std::array< uint32_t, 3 > &box_coord) const
 
void SetDecayConstant (real_t mu)
 
real_t GetLastTimestep () const
 Return the last timestep dt that was used to run Diffuse(dt) More...
 
void SetUpperThreshold (real_t t)
 
real_t GetUpperThreshold () const
 
void SetLowerThreshold (real_t t)
 
real_t GetLowerThreshold () const
 
const real_tGetAllConcentrations () const
 
const real_tGetAllGradients () const
 
std::array< size_t, 3 > GetNumBoxesArray () const
 
size_t GetNumBoxes () const
 
real_t GetBoxLength () const
 
int GetSubstanceId () const
 
const std::string & GetSubstanceName () const
 
real_t GetDecayConstant () const
 
const int32_t * GetDimensionsPtr () const
 
std::array< int32_t, 6 > GetDimensions () const
 
std::array< int32_t, 3 > GetGridSize () const
 
const std::array< real_t, 7 > & GetDiffusionCoefficients () const
 
size_t GetResolution () const
 
real_t GetBoxVolume () const
 
template<typename F >
void AddInitializer (F function)
 
bool IsFixedSubstance ()
 Return if a substance is stationary, e.g. (mu == 0 && dc == 0) More...
 
void SetBoundaryCondition (std::unique_ptr< BoundaryCondition > bc)
 Set the boundary condition, takes ownership of the object. More...
 
BoundaryConditionGetBoundaryCondition () const
 Returns the boundary condition. Does not transfer ownership. More...
 
void SetBoundaryConditionType (BoundaryConditionType bc_type)
 Sets boundary condition type. More...
 
BoundaryConditionType GetBoundaryConditionType () const
 Returns the BoundaryConditionType, see BoundaryConditionType More...
 
void PrintInfo (std::ostream &out=std::cout)
 Print information about the Diffusion Grid. More...
 
void PrintInfoWithInitialization ()
 Print the information after initialization. More...
 
bool IsInitialized () const
 Returns if the grid has been initialized. More...
 
void TurnOffGradientCalculation ()
 
- Public Member Functions inherited from bdm::ScalarField
 ScalarField ()=default
 
 ScalarField (const TRootIOCtor *)
 
 ~ScalarField () override=default
 
 BDM_CLASS_DEF_OVERRIDE (ScalarField, 1)
 
- Public Member Functions inherited from bdm::Continuum
 Continuum ()=default
 
 Continuum (const TRootIOCtor *)
 
virtual ~Continuum ()=default
 
void IntegrateTimeAsynchronously (real_t dt)
 
int GetContinuumId () const
 Returns the ID of the continuum. More...
 
void SetContinuumId (int id)
 Sets the ID of the continuum. More...
 
const std::string & GetContinuumName () const
 Returns the name of the continuum. More...
 
void SetContinuumName (const std::string &name)
 Sets the name of the continuum. More...
 
real_t GetSimulatedTime () const
 Returns the time simulated by the continuum. More...
 
void SetTimeStep (real_t dt)
 
real_t GetTimeStep () const
 Returns the time step for the continuum. More...
 

Private Member Functions

 BDM_CLASS_DEF_OVERRIDE (EulerGrid, 1)
 

Detailed Description

Continuum model for the 3D heat equation with exponential decay $ \partial_t u = \nabla D \nabla u - \mu u $.

We use a forward in time and central in space finite difference method for modelling (FTCS). This method, however, is not iherently stable and thus we must impose a stability condition. $ \frac{D \Delta t}{\Delta x^2} < \frac{1}{6} $. The error of this method scaling linearly with time (forward difference of first-order) and quadratic with the spatial discretization (central difference of second-order). The method derives its name, Euler, from the time step length of the integration.

Further information:

Definition at line 43 of file euler_grid.h.

Constructor & Destructor Documentation

◆ EulerGrid() [1/2]

bdm::EulerGrid::EulerGrid ( )
default

◆ EulerGrid() [2/2]

bdm::EulerGrid::EulerGrid ( int  substance_id,
std::string  substance_name,
real_t  dc,
real_t  mu,
int  resolution = 10 
)
inline

Definition at line 46 of file euler_grid.h.

Member Function Documentation

◆ BDM_CLASS_DEF_OVERRIDE()

bdm::EulerGrid::BDM_CLASS_DEF_OVERRIDE ( EulerGrid  ,
 
)
private

◆ DiffuseWithClosedEdge()

void bdm::EulerGrid::DiffuseWithClosedEdge ( real_t  dt)
overridevirtual

Implements bdm::DiffusionGrid.

Definition at line 21 of file euler_grid.cc.

◆ DiffuseWithDirichlet()

void bdm::EulerGrid::DiffuseWithDirichlet ( real_t  dt)
overridevirtual

Compute the diffusion of the substance with Dirichlet boundary conditions ( u = const on the boundary) for a given time step dt.

Implements bdm::DiffusionGrid.

Definition at line 157 of file euler_grid.cc.

◆ DiffuseWithNeumann()

void bdm::EulerGrid::DiffuseWithNeumann ( real_t  dt)
overridevirtual

Compute the diffusion of the substance with Neumann boundary conditions (du/dn = const on the boundary) for a given time step dt.

Implements bdm::DiffusionGrid.

Definition at line 213 of file euler_grid.cc.

◆ DiffuseWithOpenEdge()

void bdm::EulerGrid::DiffuseWithOpenEdge ( real_t  dt)
overridevirtual

Implements bdm::DiffusionGrid.

Definition at line 69 of file euler_grid.cc.

◆ DiffuseWithPeriodic()

void bdm::EulerGrid::DiffuseWithPeriodic ( real_t  dt)
overridevirtual

Compute the diffusion of the substance with Periodic boundary conditions (u_{-1} = {u_N-1}, u_{N} = u_{0}) for a given time step dt.

Implements bdm::DiffusionGrid.

Definition at line 304 of file euler_grid.cc.


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