PeriDEM 0.3.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 133 of file materialUtil.cpp.

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

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 23 of file materialUtil.cpp.

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

References util::isGreater(), util::isLess(), and util::io::Msg::str().

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 77 of file materialUtil.cpp.

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

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 189 of file materialUtil.cpp.

193 {
194
195 size_t k = 0;
196 for (size_t j : neighbors[i]) {
197
198 double s = material->getS(nodes[j] - nodes[i], nodes_disp[j] -
199 nodes_disp[i]);
200 double sc = material->getSc((nodes[j] - nodes[i]).length());
201
202 // get fracture state, modify, and set
203 auto fs = fracture->getBondState(i, k);
204 if (!fs && util::isGreater(std::abs(s), sc + 1.0e-10))
205 fs = true;
206 fracture->setBondState(i, k, fs);
207
208 k += 1;
209 }
210}
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: