BioDynaMo  v1.05.119-a4ff3934
Public Member Functions | Private Member Functions | Private Attributes | List of all members
bdm::EulerDepletionGrid Class Reference

Continuum model for the 3D diffusion equation with exponential decay and substance depletion $ \partial_t u = \nabla D \nabla u - \mu u - \mu' v u $. More...

#include <euler_depletion_grid.h>

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

Public Member Functions

 EulerDepletionGrid ()=default
 
 EulerDepletionGrid (int substance_id, std::string substance_name, real_t dc, real_t mu, int resolution=10, std::vector< real_t > binding_coefficients={}, std::vector< int > binding_substances={})
 
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
 
void SetBindingSubstance (int bnd_sub, real_t bnd_coeff)
 Sets a binding substance and coefficient for the substance. More...
 
std::vector< int > GetBindingSubstances () const
 Get the vector of binding substances (vector of IDs) More...
 
std::vector< real_tGetBindingCoefficients () const
 Get the vector of binding coefficients (vector of coefficients) More...
 
- Public Member Functions inherited from bdm::EulerGrid
 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

void ApplyDepletion (real_t dt)
 Depletes the substance according to binding_substances_ and binding_coefficients_. Iterates over all grid points and calculates the new concentration according to the depletion. See class description. More...
 
 BDM_CLASS_DEF_OVERRIDE (EulerDepletionGrid, 1)
 

Private Attributes

std::vector< real_tbinding_coefficients_ = {}
 
std::vector< int > binding_substances_ = {}
 Vector of binding substances. More...
 

Detailed Description

Continuum model for the 3D diffusion equation with exponential decay and substance depletion $ \partial_t u = \nabla D \nabla u - \mu u - \mu' v u $.

For a single depleting substance with concentration c' and binding coefficient mu_' the FCTS method leads to the following relation: c2_[c] = c1_[c] * (1 - (mu_ + c'1_[c] * mu_') * dt) + (d * dt * ibl2) * (c1_[c - 1] - 2 * c1_[c] + c1_[c + 1] + c1_[s] - 2 * c1_[c] + c1_[n] + c1_[b] - 2 * c1_[c] + c1_[t])

Definition at line 34 of file euler_depletion_grid.h.

Constructor & Destructor Documentation

◆ EulerDepletionGrid() [1/2]

bdm::EulerDepletionGrid::EulerDepletionGrid ( )
default

◆ EulerDepletionGrid() [2/2]

bdm::EulerDepletionGrid::EulerDepletionGrid ( int  substance_id,
std::string  substance_name,
real_t  dc,
real_t  mu,
int  resolution = 10,
std::vector< real_t binding_coefficients = {},
std::vector< int >  binding_substances = {} 
)
inline

Definition at line 37 of file euler_depletion_grid.h.

Member Function Documentation

◆ ApplyDepletion()

void bdm::EulerDepletionGrid::ApplyDepletion ( real_t  dt)
private

Depletes the substance according to binding_substances_ and binding_coefficients_. Iterates over all grid points and calculates the new concentration according to the depletion. See class description.

Parameters
dtTime step

Definition at line 21 of file euler_depletion_grid.cc.

◆ BDM_CLASS_DEF_OVERRIDE()

bdm::EulerDepletionGrid::BDM_CLASS_DEF_OVERRIDE ( EulerDepletionGrid  ,
 
)
private

◆ DiffuseWithClosedEdge()

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

Simulates the Diffusion with EulerGrid::DiffuseWithClosedEdge and subsequently depletes the substance according to binding_substances_ and binding_coefficients_. See ApplyDepletion for details.

Implements bdm::DiffusionGrid.

Definition at line 63 of file euler_depletion_grid.cc.

◆ DiffuseWithDirichlet()

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

Simulates the Diffusion with EulerGrid::DiffuseWithDirichlet and subsequently depletes the substance according to binding_substances_ and binding_coefficients_. See ApplyDepletion for details.

Implements bdm::DiffusionGrid.

Definition at line 77 of file euler_depletion_grid.cc.

◆ DiffuseWithNeumann()

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

Simulates the Diffusion with EulerGrid::DiffuseWithNeumann and subsequently depletes the substance according to binding_substances_ and binding_coefficients_. See ApplyDepletion for details.

Implements bdm::DiffusionGrid.

Definition at line 84 of file euler_depletion_grid.cc.

◆ DiffuseWithOpenEdge()

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

Simulates the Diffusion with EulerGrid::DiffuseWithOpenEdge and subsequently depletes the substance according to binding_substances_ and binding_coefficients_. See ApplyDepletion for details.

Implements bdm::DiffusionGrid.

Definition at line 70 of file euler_depletion_grid.cc.

◆ DiffuseWithPeriodic()

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

Simulates the Diffusion with EulerGrid::DiffuseWithPeriodic and subsequently depletes the substance according to binding_substances_ and binding_coefficients_. See ApplyDepletion for details.

Implements bdm::DiffusionGrid.

Definition at line 91 of file euler_depletion_grid.cc.

◆ GetBindingCoefficients()

std::vector<real_t> bdm::EulerDepletionGrid::GetBindingCoefficients ( ) const
inline

Get the vector of binding coefficients (vector of coefficients)

Definition at line 81 of file euler_depletion_grid.h.

◆ GetBindingSubstances()

std::vector<int> bdm::EulerDepletionGrid::GetBindingSubstances ( ) const
inline

Get the vector of binding substances (vector of IDs)

Definition at line 79 of file euler_depletion_grid.h.

◆ SetBindingSubstance()

void bdm::EulerDepletionGrid::SetBindingSubstance ( int  bnd_sub,
real_t  bnd_coeff 
)
inline

Sets a binding substance and coefficient for the substance.

Parameters
bnd_subID of the binding substance
bnd_coeffBinding coefficient that determines the rate of depletion

Definition at line 73 of file euler_depletion_grid.h.

Member Data Documentation

◆ binding_coefficients_

std::vector<real_t> bdm::EulerDepletionGrid::binding_coefficients_ = {}
private

Vector of binding coefficients for each binding substance. All coefficients should be positive.

Definition at line 94 of file euler_depletion_grid.h.

◆ binding_substances_

std::vector<int> bdm::EulerDepletionGrid::binding_substances_ = {}
private

Vector of binding substances.

Definition at line 96 of file euler_depletion_grid.h.


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