VPTissue Reference Manual
hamiltonian/Maxwell.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 "Maxwell.h"
21 
22 #include "HHelper.h"
23 #include "bio/Cell.h"
24 #include "sim/CoreData.h"
25 
26 #include <cassert>
27 
28 using namespace std;
29 using namespace boost::property_tree;
30 using namespace SimPT_Sim;
31 
32 namespace SimPT_Default {
33 namespace Hamiltonian {
34 
35 Maxwell::Maxwell(const CoreData& cd)
36 {
37  assert( cd.Check() && "CoreData not ok in Maxwell Hamiltonian");
38  Initialize(cd);
39 }
40 
41 void Maxwell::Initialize(const CoreData& cd)
42 {
43  const auto& p = cd.m_parameters->get_child("cell_mechanics");
44 
45  m_elastic_modulus = p.get<double>("elastic_modulus");
46  m_lambda_bend = p.get<double>("lambda_bend");
47  m_lambda_cell_length = p.get<double>("lambda_celllength");
48  m_lambda_length = p.get<double>("lambda_length");
49  m_rp_stiffness = p.get<double>("relative_perimeter_stiffness");
50  m_target_node_distance = p.get<double>("target_node_distance");
51 }
52 
53 double Maxwell::operator()(Cell* cell)
54 {
55  double h = 0.0;
56 
57  if (!cell->IsBoundaryPolygon()) {
58 
59  // --------------------------------------------------------------------------------------------
60  // Cell pressure:
61  // --------------------------------------------------------------------------------------------
62  h += -cell->GetSolute() * log(cell->GetArea());
63 
64  // --------------------------------------------------------------------------------------------
65  // Elastic wall:
66  // --------------------------------------------------------------------------------------------
67  h += m_elastic_modulus * HHelper::ElasticWallTerm(cell, m_rp_stiffness);
68 
69  // --------------------------------------------------------------------------------------------
70  // Edge length:
71  // --------------------------------------------------------------------------------------------
72  if (abs(m_lambda_length) > 1.0e-7) {
73  h += m_lambda_length
74  * HHelper::EdgeTerm(cell, m_rp_stiffness, m_target_node_distance);
75  }
76 
77  // --------------------------------------------------------------------------------------------
78  // Cell length constraint:
79  // --------------------------------------------------------------------------------------------
80  if (abs(m_lambda_cell_length) > 1.0e-7) {
81  h += m_lambda_cell_length * HHelper::CellLengthTerm(cell);
82  }
83  }
84 
85  // --------------------------------------------------------------------------------------------
86  // Vertex bending constraint
87  // --------------------------------------------------------------------------------------------
88  if (abs(m_lambda_bend) > 1.0e-7) {
89  h += m_lambda_bend * HHelper::BendingTerm(cell);
90  }
91 
92  return h;
93 }
94 
95 } // namespace
96 } // namespace
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
Core data used during model execution.
Interface/Implementation for Hamiltonian::HHelper.
Namespace for components of the Default model group.
Namespace for the core simulator.
Interface for Cell.
Interface for Hamiltonian Maxwell component.
double GetArea() const
Return the area of the cell.
Definition: Cell.cpp:178
bool Check() const
Verify all pointers non-null.
Definition: CoreData.h:53