146 {
148
149
150 auto get_ents_on_mesh_skin = [&]() {
151 std::map<std::string, Range> boundary_entities_vec;
152
153 auto get_block_vec_impl = [&](auto block_name) {
155 std::regex(
156
157 (boost::format("%s(.*)") % block_name).str()
158
159 ));
160 };
161
162 auto add_blockset_ents_impl = [&](auto &&vec) {
164 for (auto it : vec) {
165 Range boundary_entities;
167 boundary_entities, true);
168 std::string meshset_name = it->getName();
169 boundary_entities_vec[meshset_name] = boundary_entities;
170 boundary_entities.clear();
171 }
173 };
174
175 for (auto block_name :
176 {"SPATIAL_DISP", "FIX", "CONTACT", "SPATIAL_ROTATION",
177 "NORMAL_DISPLACEMENT", "ANALYTICAL_DISPLACEMENT", "SPRING_BC"}) {
179 "add blockset entities");
180 }
181
182 return boundary_entities_vec;
183 };
184
185 auto boundary_entities_vec = get_ents_on_mesh_skin();
186
187 std::vector<std::tuple<std::string, Range, std::array<double, 6>>>
188 reactionForces;
189 for (const auto &pair : boundary_entities_vec) {
190 reactionForces.push_back(
191 std::make_tuple(pair.first, pair.second,
192 std::array<double, 6>{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}));
193 }
194
197 };
198 auto face_fe = boost::make_shared<FaceElementForcesAndSourcesCore>(
eP.
mField);
199 auto no_rule = [](
int,
int,
int) {
return -1; };
200 face_fe->getRuleHook = integration_rule_face;
202 EshelbianPlasticity::AddHOOps<SPACE_DIM - 1, SPACE_DIM, SPACE_DIM>::add(
205
206 auto op_side =
208 face_fe->getOpPtrVector().push_back(op_side);
209 auto side_fe_ptr = op_side->getSideFEPtr();
210 auto base_ptr =
211 boost::make_shared<EshelbianPlasticity::CGGUserPolynomialBase>();
212 side_fe_ptr->getUserPolynomialBase() = base_ptr;
214 EshelbianPlasticity::AddHOOps<SPACE_DIM, SPACE_DIM, SPACE_DIM>::add(
217 auto piola_scale_ptr = boost::make_shared<double>(1.0);
218 side_fe_ptr->getOpPtrVector().push_back(
219 new OpCalculateHVecTensorField<SPACE_DIM, SPACE_DIM>(
221 constexpr bool add_bubble_field = false;
222 if (add_bubble_field) {
223 side_fe_ptr->getOpPtrVector().push_back(
224 new OpCalculateHTensorTensorField<3, 3>(
226 }
227 side_fe_ptr->getOpPtrVector().push_back(
229 side_fe_ptr->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
231 for (auto &[name, ents, reaction_vec] : reactionForces) {
232 face_fe->getOpPtrVector().push_back(
234 }
235
237 *face_fe);
238
239 for (auto &[name, ents, reaction_vec] : reactionForces) {
240 std::array<double, 6> block_reaction_force{0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
241
242 MPI_Allreduce(reaction_vec.data(), &block_reaction_force, 6, MPI_DOUBLE,
244
245 for (auto &force : block_reaction_force) {
246 if (std::abs(force) < 1e-12) {
247 force = 0.0;
248 }
249 }
250
253 "Step %d time %3.4g Block %s Reaction force [%3.6e, "
254 "%3.6e, %3.6e]",
255 ts_step, ts_t, name.c_str(), block_reaction_force[0],
256 block_reaction_force[1], block_reaction_force[2]);
258 "Step %d time %3.4g Block %s Moment [%3.6e, %3.6e, %3.6e]",
259 ts_step, ts_t, name.c_str(), block_reaction_force[3],
260 block_reaction_force[4], block_reaction_force[5]);
261 }
263};
static constexpr int approx_order
boost::shared_ptr< Range > frontAdjEdges
const std::string spatialL2Disp
const std::string materialH1Positions
const std::string piolaStress
const std::string bubbleField
const std::string skinElement
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
std::map< std::string, std::array< double, 6 > > reactionForcesMap