VPTissue Reference Manual
cell2cell_transport/SmithPhyllotaxis.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include "SmithPhyllotaxis.h"
21 
22 #include "bio/Cell.h"
23 #include "bio/Wall.h"
24 #include "bio/ReduceCellWalls.h"
25 
26 namespace SimPT_Default {
27 namespace CellToCellTransport {
28 
29 using namespace std;
30 using namespace boost::property_tree;
31 
33 {
34  Initialize(cd);
35 }
36 
38 {
39  // Keep a reference to core data
40  m_cd = cd;
41 
42  // Assign parameters from core data to this model
43  const auto& p = m_cd.m_parameters->get_child("smith_phyllotaxis");
44  m_D = p.get<double>("D");
45  m_T = p.get<double>("T");
46  m_k_T = p.get<double>("k_T");
47  m_c = p.get<double>("c");
48 }
49 
50 void SmithPhyllotaxis::operator()(Wall* w, double* dchem_c1, double* dchem_c2)
51 {
52  // Since we're looping over walls and not over cells special care needs to
53  // be taken to ensure the cell indices are consistent with cell-based
54  // equations "on paper".
55  //
56  // By convention, for the current wall, "cell 1" is i and "cell 2" is j.
57  Cell * C_i = w->GetC1();
58  Cell * C_j = w->GetC2();
59 
60  // There is no transport between a cell and the boundary polygon
61  if (!(C_i->IsBoundaryPolygon() || C_j->IsBoundaryPolygon())) {
62  // Shorthand notations for neighboring cell's chemicals ...
63  const double IAA_i = C_i->GetChemical(0);
64  const double IAA_j = C_j->GetChemical(0);
65  const double PIN_i = C_i->GetChemical(1);
66  const double PIN_j = C_j->GetChemical(1);
67  // ... and for other common factors
68  const double l_ij = w->GetLength();
69  const double V_i = C_i->GetArea();
70  const double V_j = C_j->GetArea();
71 
72  // IAA diffusion (passive flux) between neighboring cells
73  // (Note that: diff_i_to_j = -diff_j_to_i)
74  const double diff_j_to_i = l_ij * m_D * (IAA_j - IAA_i);
75  dchem_c1[0] += diff_j_to_i / V_i; // dIAA/dt in cell i
76  dchem_c2[0] -= diff_j_to_i / V_j; // dIAA/dt in cell j
77 
78  // Returns one term of: \sum_{b \in N(a)} l_ab * exp(c * IAA_b)
79  // When used as func in ReduceCellWalls, the entire sum is calculated.
80  function<double(Cell *, Cell *, Wall *)> P_ab_denom_term = \
81  [this](Cell * C_a, Cell * C_b, Wall * W_ab)->double {
82  // Make sure neither of the cells is the boundary polygon
83  // (technically speaking C_a won't be the boundary since it's
84  // already checked above. Double checking can do no harm though)
85  if (!(C_a->IsBoundaryPolygon() || C_b->IsBoundaryPolygon())) {
86  const double IAA_b = C_b->GetChemical(0);
87  const double l_ab = W_ab->GetLength();
88  return l_ab * exp(m_c * IAA_b);
89  } else {
90  return 0.0;
91  }
92  };
93 
94  // IAA active transport (PIN1 mediated) over the current wall
95  // (Note that: actr_i_to_j = -actr_j_to_i)
96  const double P_ij = PIN_i * l_ij * exp(m_c * IAA_j) / ReduceCellWalls(C_i, P_ab_denom_term);
97  const double P_ji = PIN_j * l_ij * exp(m_c * IAA_i) / ReduceCellWalls(C_j, P_ab_denom_term);
98  const double actr_j_to_i = P_ji * IAA_j * IAA_j / (1.0 + m_k_T * IAA_i * IAA_i) \
99  - P_ij * IAA_i * IAA_i / (1.0 + m_k_T * IAA_j * IAA_j);
100  dchem_c1[0] += m_T * actr_j_to_i / V_i; // dIAA/dt in cell i
101  dchem_c2[0] -= m_T * actr_j_to_i / V_j; // dIAA/dt in cell j
102  }
103 }
104 
105 } // namespace
106 } // namespace
107 
Core data with mesh, parameters, random engine and time data.
Definition: CoreData.h:38
STL namespace.
A cell contains walls and nodes.
Definition: Cell.h:48
CellToCellTransport for SmithPhyllotaxis model.
R ReduceCellWalls(Cell *cell, std::function< R(Cell *, Cell *, Wall *)> f)
Traverse walls of cell and apply functor.
void Initialize(const CoreData &cd)
Initialize or re-initialize.
void operator()(Wall *w, double *dchem_c1, double *dchem_c2)
Execute.
Namespace for components of the Default model group.
Interface for Cell.
double GetLength() const
Returns (and calculates, if length marked as dirty) the length along all nodes.
Definition: Wall.cpp:97
Interface/Implementation for ReduceCellWalls.
double GetArea() const
Return the area of the cell.
Definition: Cell.cpp:178
A cell wall, runs between cell corner points and consists of wall elements.
Definition: Wall.h:48
Interface for Wall.