PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
anonymous_namespace{materialUtil.cpp} Namespace Reference

Functions

double computeStateMxI (size_t i, const std::vector< util::Point > &nodes, const std::vector< double > &nodal_vol, const std::vector< std::vector< size_t > > &neighbors, const std::vector< std::vector< float > > &neighbors_sq_dist, const double &mesh_size, const material::Material *material)
 
double computeStateThetaxI (size_t i, const std::vector< util::Point > &nodes, const std::vector< util::Point > &nodes_disp, const std::vector< double > &nodal_vol, const std::vector< std::vector< size_t > > &neighbors, const std::vector< std::vector< float > > &neighbors_sq_dist, const double &mesh_size, const material::Material *material, const geometry::Fracture *fracture, const std::vector< double > &mx)
 
double computeHydrostaticStrainI (size_t i, const std::vector< util::Point > &nodes, const std::vector< util::Point > &nodes_disp, const std::vector< double > &nodal_vol, const std::vector< std::vector< size_t > > &neighbors, const std::vector< std::vector< float > > &neighbors_sq_dist, const double &mesh_size, const material::Material *material, const geometry::Fracture *fracture, size_t dim)
 
void updateBondFractureDataI (size_t i, const std::vector< util::Point > &nodes, const std::vector< std::vector< size_t > > &neighbors, const std::vector< util::Point > &nodes_disp, const material::Material *material, geometry::Fracture *fracture)
 

Function Documentation

◆ computeHydrostaticStrainI()

double anonymous_namespace{materialUtil.cpp}::computeHydrostaticStrainI ( size_t  i,
const std::vector< util::Point > &  nodes,
const std::vector< util::Point > &  nodes_disp,
const std::vector< double > &  nodal_vol,
const std::vector< std::vector< size_t > > &  neighbors,
const std::vector< std::vector< float > > &  neighbors_sq_dist,
const double &  mesh_size,
const material::Material material,
const geometry::Fracture fracture,
size_t  dim 
)

Definition at line 130 of file materialUtil.cpp.

138 {
139
140 double horizon = material->getHorizon();
141 const auto &xi = nodes[i];
142 const auto &ui = nodes_disp[i];
143 double theta = 0.;
144
145 // upper and lower bound for volume correction
146 auto check_up = horizon + 0.5 * mesh_size;
147 auto check_low = horizon - 0.5 * mesh_size;
148
149 // get volume of ball
150 double vol_ball = std::pow(horizon, 2) * M_PI;
151 if (dim == 3)
152 vol_ball *= horizon * 4. / 3.;
153
154 size_t k = 0;
155 for (size_t j : neighbors[i]) {
156
157 const auto &xj = nodes[j];
158 const auto &uj = nodes_disp[j];
159 double rji = (xj - xi).length();
160 //double rji = std::sqrt(neighbors_sq_dist[i][k]);
161
162 if (util::isGreater(rji, horizon) or j == i)
163 continue;
164
165 // get corrected volume of node j
166 auto volj = nodal_vol[j];
167
168 if (util::isGreater(rji, check_low))
169 volj *= (check_up - rji) / mesh_size;
170
171 // get bond state
172 double bond_state = fracture->getBondState(i, k) ? 0. : 1.;
173
174 // get bond strain
175 double Sji = material->getS(xj - xi, uj - ui);
176
177 theta += bond_state * rji * Sji *
178 material->getInfFn(rji) * volj / vol_ball;
179
180 k += 1;
181 }
182
183 return theta;
184}
bool getBondState(const std::size_t &i, const std::size_t &j) const
Read bond state.
Definition fracture.cpp:64
bool isGreater(const double &a, const double &b)
Returns true if a > b.
Definition function.cpp:15

References geometry::Fracture::getBondState(), and util::isGreater().

Referenced by material::computeHydrostaticStrain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ computeStateMxI()

double anonymous_namespace{materialUtil.cpp}::computeStateMxI ( size_t  i,
const std::vector< util::Point > &  nodes,
const std::vector< double > &  nodal_vol,
const std::vector< std::vector< size_t > > &  neighbors,
const std::vector< std::vector< float > > &  neighbors_sq_dist,
const double &  mesh_size,
const material::Material material 
)

Definition at line 21 of file materialUtil.cpp.

26 {
27
28 double horizon = material->getHorizon();
29 const auto &xi = nodes[i];
30 double m = 0.;
31
32 // upper and lower bound for volume correction
33 auto check_up = horizon + 0.5 * mesh_size;
34 auto check_low = horizon - 0.5 * mesh_size;
35
36 size_t k = 0;
37 for (size_t j : neighbors[i]) {
38
39 const auto &xj = nodes[j];
40 double rji = (xj - xi).length();
41 //double rji = std::sqrt(neighbors_sq_dist[i][k]);
42
43 if (util::isGreater(rji, horizon)) // or j == i) <-- check! For weighted volume, we don't want to skip the node itself
44 continue;
45
46 // get corrected volume of node j
47 auto volj = nodal_vol[j];
48
49 if (util::isGreater(rji, check_low))
50 volj *= (check_up - rji) / mesh_size;
51
52 m += std::pow(rji, 2) * material->getInfFn(rji) * volj;
53
54 k++;
55 }
56
57 if (util::isLess(m, 1.0E-18)) {
58 std::ostringstream oss;
59 oss << "Error: Weighted nodal volume = " << m
60 << " should not be too close to zero.\n";
61
62 oss << "Mesh size = " << mesh_size << "\n";
63 oss << "J = " << material->getInfFn(0.5 * horizon) << "\n";
64 oss << "weighted volume (times 1.0e10) = " << m*1.e+10 << "\n";
65 oss << "nodal coord = " << xi.printStr() << "\n";
66 oss << material->printStr(0, 0);
67
68 std::cout << oss.str();
69
70 exit(1);
71 }
72 return m;
73}
bool isLess(const double &a, const double &b)
Returns true if a < b.
Definition function.cpp:20

References util::isGreater(), and util::isLess().

Referenced by material::computeStateMx().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ computeStateThetaxI()

double anonymous_namespace{materialUtil.cpp}::computeStateThetaxI ( size_t  i,
const std::vector< util::Point > &  nodes,
const std::vector< util::Point > &  nodes_disp,
const std::vector< double > &  nodal_vol,
const std::vector< std::vector< size_t > > &  neighbors,
const std::vector< std::vector< float > > &  neighbors_sq_dist,
const double &  mesh_size,
const material::Material material,
const geometry::Fracture fracture,
const std::vector< double > &  mx 
)

Definition at line 75 of file materialUtil.cpp.

83 {
84
85 double horizon = material->getHorizon();
86 const auto &xi = nodes[i];
87 const auto &ui = nodes_disp[i];
88 double m = mx[i];
89 double theta = 0.;
90
91 // upper and lower bound for volume correction
92 auto check_up = horizon + 0.5 * mesh_size;
93 auto check_low = horizon - 0.5 * mesh_size;
94
95 size_t k = 0;
96 for (size_t j : neighbors[i]) {
97
98 const auto &xj = nodes[j];
99 const auto &uj = nodes_disp[j];
100 double rji = (xj - xi).length();
101 //double rji = std::sqrt(neighbors_sq_dist[i][k]); // distance in
102 // reference configuration
103
104 if (util::isGreater(rji, horizon) or j == i)
105 continue;
106
107 // get corrected volume of node j
108 auto volj = nodal_vol[j];
109
110 if (util::isGreater(rji, check_low))
111 volj *= (check_up - rji) / mesh_size;
112
113 // get bond state
114 double bond_state = fracture->getBondState(i, k) ? 0. : 1.;
115
116 // get change in bond length
117 auto yi = xi + ui;
118 auto yj = xj + uj;
119 double change_length = (yj - yi).length() - rji;
120
121 theta += bond_state * rji * change_length *
122 material->getInfFn(rji) * volj;
123
124 k += 1;
125 }
126
127 return 3. * theta / m;
128}

References geometry::Fracture::getBondState(), and util::isGreater().

Referenced by material::computeStateThetax().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateBondFractureDataI()

void anonymous_namespace{materialUtil.cpp}::updateBondFractureDataI ( size_t  i,
const std::vector< util::Point > &  nodes,
const std::vector< std::vector< size_t > > &  neighbors,
const std::vector< util::Point > &  nodes_disp,
const material::Material material,
geometry::Fracture fracture 
)

Definition at line 186 of file materialUtil.cpp.

190 {
191
192 size_t k = 0;
193 for (size_t j : neighbors[i]) {
194
195 double s = material->getS(nodes[j] - nodes[i], nodes_disp[j] -
196 nodes_disp[i]);
197 double sc = material->getSc((nodes[j] - nodes[i]).length());
198
199 // get fracture state, modify, and set
200 auto fs = fracture->getBondState(i, k);
201 if (!fs && util::isGreater(std::abs(s), sc + 1.0e-10))
202 fs = true;
203 fracture->setBondState(i, k, fs);
204
205 k += 1;
206 }
207}
void setBondState(const std::size_t &i, const std::size_t &j, const bool &state)
Sets the bond state.
Definition fracture.cpp:51

References geometry::Fracture::getBondState(), util::isGreater(), and geometry::Fracture::setBondState().

Referenced by material::updateBondFractureData().

Here is the call graph for this function:
Here is the caller graph for this function: