BioDynaMo  v1.05.120-25dc9790
euler_depletion_grid.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 //
3 // Copyright (C) 2021 CERN & University of Surrey for the benefit of the
4 // BioDynaMo collaboration. All Rights Reserved.
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // See the LICENSE file distributed with this work for details.
10 // See the NOTICE file distributed with this work for additional information
11 // regarding copyright ownership.
12 //
13 // -----------------------------------------------------------------------------
14 
15 #ifndef CORE_DIFFUSION_EULER_DEPLETION_GRID_H_
16 #define CORE_DIFFUSION_EULER_DEPLETION_GRID_H_
17 
18 #include <utility>
21 
22 namespace bdm {
23 
34 class EulerDepletionGrid : public EulerGrid {
35  public:
36  EulerDepletionGrid() = default;
37  EulerDepletionGrid(int substance_id, std::string substance_name, real_t dc,
38  real_t mu, int resolution = 10,
39  std::vector<real_t> binding_coefficients = {},
40  std::vector<int> binding_substances = {})
41  : EulerGrid(substance_id, std::move(substance_name), dc, mu, resolution),
42  binding_coefficients_(std::move(binding_coefficients)),
43  binding_substances_(std::move(binding_substances)) {}
44 
48  void DiffuseWithClosedEdge(real_t dt) override;
52  void DiffuseWithOpenEdge(real_t dt) override;
56  void DiffuseWithDirichlet(real_t dt) override;
60  void DiffuseWithNeumann(real_t dt) override;
64  void DiffuseWithPeriodic(real_t dt) override;
65 
66  // To avoid missing substances or coefficients, name of the sub and binding
67  // coefficient must be set at the same time
68 
73  void SetBindingSubstance(int bnd_sub, real_t bnd_coeff) {
74  binding_substances_.push_back(bnd_sub);
75  binding_coefficients_.push_back(bnd_coeff);
76  }
77 
79  std::vector<int> GetBindingSubstances() const { return binding_substances_; }
81  std::vector<real_t> GetBindingCoefficients() const {
82  return binding_coefficients_;
83  }
84 
85  private:
90  void ApplyDepletion(real_t dt);
91 
94  std::vector<real_t> binding_coefficients_ = {};
96  std::vector<int> binding_substances_ = {};
97 
99 };
100 
101 } // namespace bdm
102 
103 #endif // CORE_DIFFUSION_EULER_DEPLETION_GRID_H_
bdm::EulerDepletionGrid::DiffuseWithOpenEdge
void DiffuseWithOpenEdge(real_t dt) override
Definition: euler_depletion_grid.cc:70
bdm::EulerGrid::EulerGrid
EulerGrid()=default
bdm::EulerDepletionGrid::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={})
Definition: euler_depletion_grid.h:37
bdm::EulerDepletionGrid::binding_substances_
std::vector< int > binding_substances_
Vector of binding substances.
Definition: euler_depletion_grid.h:96
bdm
Definition: agent.cc:39
bdm::EulerDepletionGrid::binding_coefficients_
std::vector< real_t > binding_coefficients_
Definition: euler_depletion_grid.h:94
bdm::real_t
double real_t
Definition: real_t.h:21
bdm::EulerDepletionGrid::GetBindingSubstances
std::vector< int > GetBindingSubstances() const
Get the vector of binding substances (vector of IDs)
Definition: euler_depletion_grid.h:79
bdm::EulerDepletionGrid::DiffuseWithNeumann
void DiffuseWithNeumann(real_t dt) override
Definition: euler_depletion_grid.cc:84
bdm::EulerDepletionGrid::DiffuseWithClosedEdge
void DiffuseWithClosedEdge(real_t dt) override
Definition: euler_depletion_grid.cc:63
bdm::EulerDepletionGrid::ApplyDepletion
void ApplyDepletion(real_t dt)
Depletes the substance according to binding_substances_ and binding_coefficients_....
Definition: euler_depletion_grid.cc:21
diffusion_grid.h
bdm::EulerDepletionGrid::BDM_CLASS_DEF_OVERRIDE
BDM_CLASS_DEF_OVERRIDE(EulerDepletionGrid, 1)
bdm::EulerDepletionGrid
Continuum model for the 3D diffusion equation with exponential decay and substance depletion .
Definition: euler_depletion_grid.h:34
bdm::EulerDepletionGrid::DiffuseWithPeriodic
void DiffuseWithPeriodic(real_t dt) override
Definition: euler_depletion_grid.cc:91
bdm::EulerDepletionGrid::EulerDepletionGrid
EulerDepletionGrid()=default
bdm::EulerDepletionGrid::DiffuseWithDirichlet
void DiffuseWithDirichlet(real_t dt) override
Definition: euler_depletion_grid.cc:77
euler_grid.h
bdm::EulerDepletionGrid::SetBindingSubstance
void SetBindingSubstance(int bnd_sub, real_t bnd_coeff)
Sets a binding substance and coefficient for the substance.
Definition: euler_depletion_grid.h:73
bdm::EulerDepletionGrid::GetBindingCoefficients
std::vector< real_t > GetBindingCoefficients() const
Get the vector of binding coefficients (vector of coefficients)
Definition: euler_depletion_grid.h:81
bdm::EulerGrid
Continuum model for the 3D heat equation with exponential decay .
Definition: euler_grid.h:43