142 {
144
145
146 auto get_ents_on_mesh_skin = [&]() {
147 std::map<std::string, Range> boundary_entities_vec;
148
149 auto get_block_vec_impl = [&](auto block_name) {
151 std::regex(
152
153 (boost::format("%s(.*)") % block_name).str()
154
155 ));
156 };
157
158 auto add_blockset_ents_impl = [&](auto &&vec) {
160 for (auto it : vec) {
161 Range boundary_entities;
163 boundary_entities, true);
164 std::string meshset_name = it->getName();
165 boundary_entities_vec[meshset_name] = boundary_entities;
166 boundary_entities.clear();
167 }
169 };
170
171 for (auto block_name :
172 {"SPATIAL_DISP", "FIX", "CONTACT", "SPATIAL_ROTATION",
173 "NORMAL_DISPLACEMENT", "ANALYTICAL_DISPLACEMENT", "SPRING_BC"}) {
175 "add blockset entities");
176 }
177
178 return boundary_entities_vec;
179 };
180
181 auto boundary_entities_vec = get_ents_on_mesh_skin();
182
183 std::vector<std::tuple<std::string, Range, std::array<double, 6>>>
184 reactionForces;
185 for (const auto &pair : boundary_entities_vec) {
186 reactionForces.push_back(
187 std::make_tuple(pair.first, pair.second,
188 std::array<double, 6>{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}));
189 }
190
193 };
194 auto face_fe = boost::make_shared<FaceElementForcesAndSourcesCore>(
eP.
mField);
195 auto no_rule = [](
int,
int,
int) {
return -1; };
196 face_fe->getRuleHook = integration_rule_face;
198 EshelbianPlasticity::AddHOOps<SPACE_DIM - 1, SPACE_DIM, SPACE_DIM>::add(
201
202 auto op_side =
204 face_fe->getOpPtrVector().push_back(op_side);
205 auto side_fe_ptr = op_side->getSideFEPtr();
206 auto base_ptr =
207 boost::make_shared<EshelbianPlasticity::CGGUserPolynomialBase>();
208 side_fe_ptr->getUserPolynomialBase() = base_ptr;
210 EshelbianPlasticity::AddHOOps<SPACE_DIM, SPACE_DIM, SPACE_DIM>::add(
213 auto piola_scale_ptr = boost::make_shared<double>(1.0);
214 side_fe_ptr->getOpPtrVector().push_back(
215 new OpCalculateHVecTensorField<SPACE_DIM, SPACE_DIM>(
217 constexpr bool add_bubble_field = false;
218 if (add_bubble_field) {
219 side_fe_ptr->getOpPtrVector().push_back(
220 new OpCalculateHTensorTensorField<3, 3>(
222 }
223 side_fe_ptr->getOpPtrVector().push_back(
225 side_fe_ptr->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
227 for (auto &[name, ents, reaction_vec] : reactionForces) {
228 face_fe->getOpPtrVector().push_back(
230 }
231
233 *face_fe);
234
235 for (auto &[name, ents, reaction_vec] : reactionForces) {
236 std::array<double, 6> block_reaction_force{0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
237
238 MPI_Allreduce(reaction_vec.data(), &block_reaction_force, 6, MPI_DOUBLE,
240
241 for (auto &force : block_reaction_force) {
242 if (std::abs(force) < 1e-12) {
243 force = 0.0;
244 }
245 }
246
249 "Step %d time %3.4g Block %s Reaction force [%3.6e, "
250 "%3.6e, %3.6e]",
251 ts_step, ts_t, name.c_str(), block_reaction_force[0],
252 block_reaction_force[1], block_reaction_force[2]);
254 "Step %d time %3.4g Block %s Moment [%3.6e, %3.6e, %3.6e]",
255 ts_step, ts_t, name.c_str(), block_reaction_force[3],
256 block_reaction_force[4], block_reaction_force[5]);
257 }
259};
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