37 namespace DeltaHamiltonian {
41 assert( cd.
Check() &&
"CoreData not ok in ModifiedGC DeltaHamiltonian");
45 void ModifiedGC::Initialize(
const CoreData& cd)
47 m_mesh = cd.m_mesh.get();
48 const auto& p = cd.m_parameters->get_child(
"cell_mechanics");
50 m_lambda_bend = p.get<
double>(
"lambda_bend");
51 m_lambda_cell_length = p.get<
double>(
"lambda_celllength");
52 m_lambda_length = p.get<
double>(
"lambda_length");
53 m_rp_stiffness = p.get<
double>(
"relative_perimeter_stiffness");
54 m_target_node_distance = p.get<
double>(
"target_node_distance");
62 const auto& nb1 = nb.
GetNb1();
63 const auto& nb2 = nb.
GetNb2();
64 const array<double, 3> now_p = *n;
65 const array<double, 3> mov_p = now_p + move;
66 const array<double, 3> nb1_p = *nb1;
67 const array<double, 3> nb2_p = *nb2;
68 const auto& owningWalls = m_mesh->GetNodeOwningWalls(n);
70 if (!cell->IsBoundaryPolygon()) {
75 const auto del_area = 0.5 * ((mov_p[0] - now_p[0]) * (nb1_p[1] - nb2_p[1])
76 + (mov_p[1] - now_p[1]) * (nb2_p[0] - nb1_p[0]));
77 const auto old_area = cell->
GetArea();
78 const auto tar_area = cell->GetTargetArea();
79 const auto old_fact = (old_area - tar_area) / old_area;
80 const auto new_fact = (old_area - del_area - tar_area) / (old_area - del_area);
82 dh += 1000 * (new_fact * new_fact - old_fact * old_fact);
87 const auto old1 = Norm(now_p - nb1_p) - m_target_node_distance;
88 const auto old2 = Norm(now_p - nb2_p) - m_target_node_distance;
89 const auto new1 = Norm(mov_p - nb1_p) - m_target_node_distance;
90 const auto new2 = Norm(mov_p - nb2_p) - m_target_node_distance;
92 const bool at_b = n->IsAtBoundary();
93 double w1 = (at_b && nb1->IsAtBoundary()) ? m_rp_stiffness : 1.0;
94 double w2 = (at_b && nb2->IsAtBoundary()) ? m_rp_stiffness : 1.0;
96 for (
auto& wall : owningWalls) {
97 if (wall->GetC1() == cell || wall->GetC2() == cell) {
98 const auto w = wall->GetStrength();
99 const auto n1 = wall->GetN1();
100 const auto n2 = wall->GetN2();
102 if ( ((n1 == n) && (n2 == nb1)) || ((n2 == n) && (n1 == nb1)) ) {
103 w1 = (at_b && nb1->IsAtBoundary()) ? m_rp_stiffness * w : w;
105 if ( ((n1 == n) && (n2 == nb2)) || ((n2 == n) && (n1 == nb2)) ) {
106 w2 = (at_b && nb2->IsAtBoundary()) ? m_rp_stiffness * w : w;
111 dh += m_lambda_length * (w1 * (new1 * new1 - old1 * old1) + w2 * (new2 * new2 - old2 * old2));
Core data with mesh, parameters, random engine and time data.
A cell contains walls and nodes.
Cell * GetCell() const
Return the cell of this Neighbor pair.
Core data used during model execution.
Combo header for circular iterator.
Interface for NeighborNodes.
Interface for DeltaHamiltonian::ModifiedGC.
Interface/Implementation for GeoData.
Namespace for components of the Default model group.
Node * GetNb1() const
Return first node of this Neighbor pair.
Structure of neighboring nodes: two neighboring nodes from standpoint of a given cell with an orderin...
Node * GetNb2() const
Return second node of this Neighbor pair.
double GetArea() const
Return the area of the cell.
bool Check() const
Verify all pointers non-null.