v0.15.5
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
EshelbianMonitor Struct Reference
Inheritance diagram for EshelbianMonitor:
[legend]
Collaboration diagram for EshelbianMonitor:
[legend]

Public Types

using Ele = ForcesAndSourcesCore
 
using VolEle = VolumeElementForcesAndSourcesCore
 
using VolOp = VolumeElementForcesAndSourcesCore::UserDataOperator
 
using SetPtsData = FieldEvaluatorInterface::SetPtsData
 
using PtsHashMap = std::map< std::string, std::array< double, 3 > >
 
using FaceSideEle = PipelineManager::ElementsAndOpsByDim< SPACE_DIM >::FaceSideEle
 

Public Member Functions

 EshelbianMonitor (EshelbianCore &ep)
 
virtual ~EshelbianMonitor ()
 
MoFEMErrorCode preProcess ()
 
MoFEMErrorCode operator() ()
 
MoFEMErrorCode postProcess ()
 

Public Attributes

EshelbianCoreeP
 
boost::shared_ptr< SetPtsDatadataFieldEval
 
boost::shared_ptr< VolElevolPostProcEnergy
 
boost::shared_ptr< doublegEnergy
 
PtsHashMap ptsHashMap
 
PetscBool writeRestart = PETSC_FALSE
 

Detailed Description

Definition at line 6 of file EshelbianMonitor.cpp.

Member Typedef Documentation

◆ Ele

Definition at line 8 of file EshelbianMonitor.cpp.

◆ FaceSideEle

using EshelbianMonitor::FaceSideEle = PipelineManager::ElementsAndOpsByDim<SPACE_DIM>::FaceSideEle

Definition at line 13 of file EshelbianMonitor.cpp.

◆ PtsHashMap

using EshelbianMonitor::PtsHashMap = std::map<std::string, std::array<double, 3> >

Definition at line 12 of file EshelbianMonitor.cpp.

◆ SetPtsData

using EshelbianMonitor::SetPtsData = FieldEvaluatorInterface::SetPtsData

Definition at line 11 of file EshelbianMonitor.cpp.

◆ VolEle

using EshelbianMonitor::VolEle = VolumeElementForcesAndSourcesCore

Definition at line 9 of file EshelbianMonitor.cpp.

◆ VolOp

using EshelbianMonitor::VolOp = VolumeElementForcesAndSourcesCore::UserDataOperator

Definition at line 10 of file EshelbianMonitor.cpp.

Constructor & Destructor Documentation

◆ EshelbianMonitor()

EshelbianMonitor::EshelbianMonitor ( EshelbianCore ep)
inline

Definition at line 23 of file EshelbianMonitor.cpp.

24 : eP(ep), dataFieldEval(ep.mField.getInterface<FieldEvaluatorInterface>()
25 ->getData<VolEle>()),
26 volPostProcEnergy(new VolEle(ep.mField)), gEnergy(new double) {
28 ep.mField.getInterface<FieldEvaluatorInterface>()->buildTree<SPACE_DIM>(
29 dataFieldEval, "EP"),
30 "build field evaluator tree");
31
32 auto no_rule = [](int, int, int) { return -1; };
33
34 auto set_element_for_field_eval = [&]() {
36 boost::shared_ptr<Ele> vol_ele(dataFieldEval->feMethodPtr);
37 vol_ele->getRuleHook = no_rule;
38 vol_ele->getUserPolynomialBase() =
39 boost::make_shared<CGGUserPolynomialBase>();
40 EshelbianPlasticity::AddHOOps<SPACE_DIM, SPACE_DIM, SPACE_DIM>::add(
41 vol_ele->getOpPtrVector(), {HDIV, H1, L2}, eP.materialH1Positions,
42 ep.frontAdjEdges);
43
44 auto piola_scale_ptr = boost::make_shared<double>(1.0);
45 vol_ele->getOpPtrVector().push_back(
46 eP.physicalEquations->returnOpSetScale(piola_scale_ptr,
48 vol_ele->getOpPtrVector().push_back(new OpCalculateHVecTensorField<3, 3>(
49 eP.piolaStress, eP.dataAtPts->getApproxPAtPts(), piola_scale_ptr));
50 vol_ele->getOpPtrVector().push_back(
51 new OpCalculateHTensorTensorField<3, 3>(
52 eP.bubbleField, eP.dataAtPts->getApproxPAtPts(), piola_scale_ptr,
53 SmartPetscObj<Vec>(), MBMAXTYPE));
55 vol_ele->getOpPtrVector().push_back(
56 eP.physicalEquations->returnOpCalculateStretchFromStress(
58 } else {
59 vol_ele->getOpPtrVector().push_back(
60 new OpCalculateTensor2SymmetricFieldValues<3>(
61 eP.stretchTensor, eP.dataAtPts->getLogStretchTensorAtPts(),
62 MBTET));
63 }
64 vol_ele->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
65 eP.rotAxis, eP.dataAtPts->getRotAxisAtPts(), MBTET));
66 vol_ele->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
67 eP.rotAxis, eP.dataAtPts->getRotAxis0AtPts(), eP.solTSStep, MBTET));
68 vol_ele->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
69 eP.spatialL2Disp, eP.dataAtPts->getSmallWL2AtPts(), MBTET));
70
71 // H1 displacements
72 vol_ele->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
73 eP.spatialH1Disp, eP.dataAtPts->getSmallWH1AtPts()));
74 vol_ele->getOpPtrVector().push_back(
75 new OpCalculateVectorFieldGradient<3, 3>(
76 eP.spatialH1Disp, eP.dataAtPts->getSmallWGradH1AtPts()));
77
78 vol_ele->getOpPtrVector().push_back(
81 };
82
83 auto set_element_for_post_process_energy = [&]() {
85
86 CHKERR eP.setBaseVolumeElementOps(1, false, false, false,
88
89 if (auto op = eP.physicalEquations->returnOpCalculateEnergy(eP.dataAtPts,
90 gEnergy)) {
91
92 if (eP.noStretch ||
94 // We have to use actual strains to evaluate J integral and energy,
95 // in this case. Note actual stresses, and actual energy can only
96 // drive crack growth
97
98 // Note: Calling this bellow we overwrite the stretch calculation
99 // from setBaseVolumeElementOps
100
101 volPostProcEnergy->getOpPtrVector().push_back(
102 eP.physicalEquations->returnOpCalculateStretchFromStress(
104 }
105
106 volPostProcEnergy->getOpPtrVector().push_back(op);
107 }
108
110 };
111
112 auto reads_post_proc_data = [](PtsHashMap &pts_hash_map) {
114 std::ifstream file(
115 "points.txt"); // Open the file with the name "data.txt"
116
117 if (!file.is_open()) {
119 }
120
121 std::string line;
122
123 while (std::getline(file, line)) {
124 std::istringstream iss(line);
125 std::string col1;
126 double col2, col3, col4;
127
128 if (iss >> col1 >> col2 >> col3 >> col4) {
129 MOFEM_LOG("EP", Sev::verbose) << "Read: " << col1 << ", " << col2
130 << ", " << col3 << ", " << col4;
131 pts_hash_map[col1] = {col2, col3, col4};
132 } else {
133 MOFEM_LOG("EP", Sev::error) << "Error parsing line: " << line;
134 }
135 }
136
137 file.close(); // Close the file
139 };
140
141 CHK_THROW_MESSAGE(set_element_for_field_eval(), "set element for field");
142 CHK_THROW_MESSAGE(set_element_for_post_process_energy(),
143 "set element for post energy");
144
145 PetscBool test_cook_flg = PETSC_FALSE;
146 CHK_THROW_MESSAGE(PetscOptionsGetBool(PETSC_NULLPTR, "", "-test_cook_pts",
147 &test_cook_flg, PETSC_NULLPTR),
148 "get post proc points");
149 if (test_cook_flg) {
150 ptsHashMap["Point A"] = {48., 60., 4.999};
151 ptsHashMap["Point B"] = {48. / 2., 44. + (60. - 44.) / 2., 0.};
152 ptsHashMap["Point C"] = {48. / 2., (44. - 0.) / 2., 0.};
153 }
154
155 PetscInt atom_test = 0;
156
157 CHKERR PetscOptionsGetInt(PETSC_NULLPTR, "", "-atom_test", &atom_test,
158 PETSC_NULLPTR);
159 if (atom_test == 14) {
160 // Points for atom test 14: check external strain
161 ptsHashMap["Point (2.5, 0., 0.)"] = {2.5, 0, 0.};
162 }
163 CHK_MOAB_THROW(reads_post_proc_data(ptsHashMap), "read post proc points");
164
165 CHK_THROW_MESSAGE(PetscOptionsGetBool(PETSC_NULLPTR, "", "-write_restart",
166 &writeRestart, PETSC_NULLPTR),
167 "get write restart option");
168
169 MOFEM_LOG("EP", Sev::inform)
170 << "EshelbianMonitor writeRestart " << writeRestart
171 ? " true"
172 : " false";
173 }
constexpr int SPACE_DIM
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MOFEM_LOG(channel, severity)
Log.
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
boost::shared_ptr< Range > frontAdjEdges
MoFEM::Interface & mField
const std::string spatialL2Disp
const std::string materialH1Positions
MoFEMErrorCode setBaseVolumeElementOps(const int tag, const bool do_rhs, const bool do_lhs, const bool calc_rates, boost::shared_ptr< VolumeElementForcesAndSourcesCore > fe)
const std::string spatialH1Disp
static enum MaterialModel materialModel
const std::string piolaStress
const std::string bubbleField
static PetscBool noStretch
boost::shared_ptr< PhysicalEquations > physicalEquations
const std::string rotAxis
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
SmartPetscObj< Vec > solTSStep
const std::string stretchTensor
boost::shared_ptr< double > gEnergy
boost::shared_ptr< VolEle > volPostProcEnergy
boost::shared_ptr< SetPtsData > dataFieldEval
EshelbianCore & eP
std::map< std::string, std::array< double, 3 > > PtsHashMap
VolumeElementForcesAndSourcesCore VolEle
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
int atom_test
Atom test.
Definition plastic.cpp:121

◆ ~EshelbianMonitor()

virtual EshelbianMonitor::~EshelbianMonitor ( )
inlinevirtual

Definition at line 175 of file EshelbianMonitor.cpp.

175{}

Member Function Documentation

◆ operator()()

MoFEMErrorCode EshelbianMonitor::operator() ( )
inline

Definition at line 179 of file EshelbianMonitor.cpp.

179{ return 0; }

◆ postProcess()

MoFEMErrorCode EshelbianMonitor::postProcess ( )
inline

Definition at line 181 of file EshelbianMonitor.cpp.

181 {
183
184 MOFEM_LOG("EP", Sev::inform) << "Monitor postProcess";
185
186 auto get_step = [](auto ts_step) {
187 std::ostringstream ss;
188 ss << boost::str(boost::format("%d") % static_cast<int>(ts_step));
189 std::string s = ss.str();
190 return s;
191 };
192
193 auto calculate_reaction_forces = [&]() {
195
196 // Get boundary faces marked in blocks name "SPATIAL_DISP_...".
197 auto get_ents_on_mesh_skin = [&]() {
198 std::map<std::string, Range> boundary_entities_vec;
199
200 auto get_block_vec_impl = [&](auto block_name) {
201 return eP.mField.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
202 std::regex(
203
204 (boost::format("%s(.*)") % block_name).str()
205
206 ));
207 };
208
209 auto add_blockset_ents_impl = [&](auto &&vec) {
211 for (auto it : vec) {
212 Range boundary_entities;
213 CHKERR it->getMeshsetIdEntitiesByDimension(eP.mField.get_moab(), 2,
214 boundary_entities, true);
215 std::string meshset_name = it->getName();
216 boundary_entities_vec[meshset_name] = boundary_entities;
217 boundary_entities.clear();
218 }
220 };
221
222 for (auto block_name : {"SPATIAL_DISP", "FIX", "CONTACT",
223 "SPATIAL_ROTATION", "NORMAL_DISPLACEMENT"}) {
225 add_blockset_ents_impl(get_block_vec_impl(block_name)),
226 "add blockset entities");
227 }
228
229 return boundary_entities_vec;
230 };
231
232 auto boundary_entities_vec = get_ents_on_mesh_skin();
233
234 std::vector<std::tuple<std::string, Range, std::array<double, 6>>>
235 reactionForces;
236 for (const auto &pair : boundary_entities_vec) {
237 reactionForces.push_back(std::make_tuple(
238 pair.first, pair.second,
239 std::array<double, 6>{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}));
240 }
241
242 auto integration_rule_face = [](int, int, int approx_order) {
243 return 2 * approx_order + 1;
244 };
245 auto face_fe =
246 boost::make_shared<FaceElementForcesAndSourcesCore>(eP.mField);
247 auto no_rule = [](int, int, int) { return -1; };
248 face_fe->getRuleHook = integration_rule_face;
249 CHKERR
250 EshelbianPlasticity::AddHOOps<SPACE_DIM - 1, SPACE_DIM, SPACE_DIM>::add(
251 face_fe->getOpPtrVector(), {L2}, eP.materialH1Positions,
253
254 auto op_side =
255 new OpLoopSide<FaceSideEle>(eP.mField, "EP", SPACE_DIM, Sev::noisy);
256 face_fe->getOpPtrVector().push_back(op_side);
257 auto side_fe_ptr = op_side->getSideFEPtr();
258 auto base_ptr =
259 boost::make_shared<EshelbianPlasticity::CGGUserPolynomialBase>();
260 side_fe_ptr->getUserPolynomialBase() = base_ptr;
261 CHKERR
262 EshelbianPlasticity::AddHOOps<SPACE_DIM, SPACE_DIM, SPACE_DIM>::add(
263 side_fe_ptr->getOpPtrVector(), {H1, HDIV, L2}, eP.materialH1Positions,
265 auto piola_scale_ptr = boost::make_shared<double>(1.0);
266 side_fe_ptr->getOpPtrVector().push_back(
267 eP.physicalEquations->returnOpSetScale(piola_scale_ptr,
269 side_fe_ptr->getOpPtrVector().push_back(
270 new OpCalculateHVecTensorField<SPACE_DIM, SPACE_DIM>(
271 eP.piolaStress, eP.dataAtPts->getApproxPAtPts(),
272 piola_scale_ptr));
273 side_fe_ptr->getOpPtrVector().push_back(
274 new OpCalculateHTensorTensorField<3, 3>(
275 eP.bubbleField, eP.dataAtPts->getApproxPAtPts(), MBMAXTYPE));
276 side_fe_ptr->getOpPtrVector().push_back(
278 side_fe_ptr->getOpPtrVector().push_back(
279 new OpCalculateVectorFieldValues<3>(
280 eP.spatialL2Disp, eP.dataAtPts->getSmallWL2AtPts(), MBTET));
281 for (auto &[name, ents, reaction_vec] : reactionForces) {
282 face_fe->getOpPtrVector().push_back(new OpCalculateReactionForces(
283 eP.dataAtPts, name, ents, reaction_vec));
284 }
285
286 CHKERR eP.mField.loop_finite_elements(problemPtr->getName(),
287 eP.skinElement, *face_fe);
288
289 for (auto &[name, ents, reaction_vec] : reactionForces) {
290 std::array<double, 6> block_reaction_force{0.0, 0.0, 0.0,
291 0.0, 0.0, 0.0};
292
293 MPI_Allreduce(reaction_vec.data(), &block_reaction_force, 6, MPI_DOUBLE,
294 MPI_SUM, eP.mField.get_comm());
295
296 for (auto &force : block_reaction_force) {
297 if (std::abs(force) < 1e-12) {
298 force = 0.0;
299 }
300 }
301 MOFEM_LOG_C("EP", Sev::inform,
302 "Step %d time %3.4g Block %s Reaction force [%3.6e, "
303 "%3.6e, %3.6e]",
304 ts_step, ts_t, name.c_str(), block_reaction_force[0],
305 block_reaction_force[1], block_reaction_force[2]);
306 MOFEM_LOG_C("EP", Sev::inform,
307 "Step %d time %3.4g Block %s Moment [%3.6e, %3.6e, %3.6e]",
308 ts_step, ts_t, name.c_str(), block_reaction_force[3],
309 block_reaction_force[4], block_reaction_force[5]);
310 }
312 };
313
314 auto save_restart_file = [&]() {
316
317 if (writeRestart && ts_u) {
318 PetscViewer viewer;
319 CHKERR PetscViewerBinaryOpen(
320 PETSC_COMM_WORLD, ("restart_" + get_step(ts_step) + ".dat").c_str(),
321 FILE_MODE_WRITE, &viewer);
322 CHKERR PetscViewerBinarySetSkipInfo(viewer, PETSC_TRUE);
323 CHKERR VecView(ts_u, viewer);
324 CHKERR PetscViewerDestroy(&viewer);
325 }
327 };
328
329 auto post_process_skin = [&]() {
332 1, "out_sol_elastic_" + get_step(ts_step) + ".h5m", PETSC_NULLPTR,
333 PETSC_NULLPTR, {}, ts);
335 };
336
337 auto post_process_material_forces = [&]() {
339 // Function to get material force tags
342 };
343
344 auto post_process_skeleton_results = [&]() {
346 auto get_material_force_tags = [&]() {
347 auto &moab = eP.mField.get_moab();
348 std::vector<Tag> tag(2);
349 CHK_MOAB_THROW(moab.tag_get_handle("MaterialForce", tag[0]),
350 "can't get tag");
351 CHK_MOAB_THROW(moab.tag_get_handle("FacePressure", tag[1]),
352 "can't get tag");
353 return tag;
354 };
355 // Post-process skeleton elements
356 bool post_process_skeleton = true;
357#ifndef NDEBUG
358 post_process_skeleton = true;
359#endif
360 if (post_process_skeleton) {
362 1, "out_skeleton_" + get_step(ts_step) + ".h5m", PETSC_NULLPTR,
363 get_material_force_tags());
364 }
366 };
367
368 auto calculate_energy = [&]() {
370 // Loop boundary elements with traction boundary conditions
371 *gEnergy = 0;
372 TetPolynomialBase::switchCacheBaseOn<HDIV>({volPostProcEnergy.get()});
373 CHKERR eP.mField.loop_finite_elements(problemPtr->getName(), "EP",
375 TetPolynomialBase::switchCacheBaseOff<HDIV>({volPostProcEnergy.get()});
376
377 double body_energy = 0;
378 MPI_Allreduce(gEnergy.get(), &body_energy, 1, MPI_DOUBLE, MPI_SUM,
379 eP.mField.get_comm());
381 auto crack_area_ptr = boost::make_shared<double>(0.0);
382 CHKERR eP.calculateCrackArea(crack_area_ptr);
383 MOFEM_LOG_C("EP", Sev::inform,
384 "Step %d time %3.4g strain energy %3.6e crack "
385 "area %3.6e",
386 ts_step, ts_t, body_energy, *crack_area_ptr);
387 if (eP.mField.get_comm_rank() == 0) {
388 auto crack_faces = *eP.crackFaces;
389 if (crack_faces.empty()) {
390 crack_faces = *eP.frontEdges;
391 }
394 (boost::format("crack_faces_step_%d.vtk") % ts_step).str(),
395 crack_faces);
398 (boost::format("front_edges_step_%d.vtk") % ts_step).str(),
399 *eP.frontEdges);
400 }
401
402 } else {
403 MOFEM_LOG_C("EP", Sev::inform, "Step %d time %3.4g strain energy %3.6e",
404 ts_step, ts_t, body_energy);
405 }
407 };
408
409 auto post_proc_at_points = [&](std::array<double, 3> point,
410 std::string str) {
412
413 dataFieldEval->setEvalPoints(point.data(), point.size() / 3);
414
415 struct OpPrint : public VolOp {
416
417 EshelbianCore &eP;
418 std::array<double, 3> point;
419 std::string str;
420
421 OpPrint(EshelbianCore &ep, std::array<double, 3> &point,
422 std::string &str)
423 : VolOp(ep.spatialL2Disp, VolOp::OPROW), eP(ep), point(point),
424 str(str) {}
425
426 MoFEMErrorCode doWork(int side, EntityType type,
427 EntitiesFieldData::EntData &data) {
429 if (type == MBTET) {
430 if (getGaussPts().size2()) {
431
432 auto t_h = getFTensor2FromMat<3, 3>(eP.dataAtPts->hAtPts);
433 auto t_approx_P =
434 getFTensor2FromMat<3, 3>(eP.dataAtPts->approxPAtPts);
435
436 FTensor::Index<'i', 3> i;
437 FTensor::Index<'j', 3> j;
438 FTensor::Index<'k', 3> k;
439 const double jac = determinantTensor3by3(t_h);
441 t_cauchy(i, j) = (1. / jac) * (t_approx_P(i, k) * t_h(j, k));
442
443 auto add = [&]() {
444 std::ostringstream s;
445 s << str << " elem " << getFEEntityHandle() << " ";
446 return s.str();
447 };
448
449 auto print_tensor = [](auto &t) {
450 std::ostringstream s;
451 s << t;
452 return s.str();
453 };
454
455 std::ostringstream print;
456 MOFEM_LOG("EPSYNC", Sev::inform)
457 << add() << "comm rank " << eP.mField.get_comm_rank();
458 MOFEM_LOG("EPSYNC", Sev::inform)
459 << add() << "point " << getVectorAdaptor(point.data(), 3);
460 MOFEM_LOG("EPSYNC", Sev::inform)
461 << add() << "coords at gauss pts " << getCoordsAtGaussPts();
462 MOFEM_LOG("EPSYNC", Sev::inform)
463 << add() << "w " << eP.dataAtPts->wL2AtPts;
464 MOFEM_LOG("EPSYNC", Sev::inform)
465 << add() << "Piola " << eP.dataAtPts->approxPAtPts;
466 MOFEM_LOG("EPSYNC", Sev::inform)
467 << add() << "Cauchy " << print_tensor(t_cauchy);
468 }
469 }
471 }
472 };
473
474 if (auto fe_ptr = dataFieldEval->feMethodPtr) {
475
476 fe_ptr->getOpPtrVector().push_back(new OpPrint(eP, point, str));
477 CHKERR eP.mField.getInterface<FieldEvaluatorInterface>()
478 ->evalFEAtThePoint<SPACE_DIM>(
479 point.data(), 1e-12, problemPtr->getName(), "EP", dataFieldEval,
481 MF_EXIST, QUIET);
482 fe_ptr->getOpPtrVector().pop_back();
483 }
484
486 };
487
488 auto check_external_strain = [&](std::array<double, 3> point,
489 std::string str, PetscInt atom_test) {
491
492 dataFieldEval->setEvalPoints(point.data(), point.size() / 3);
493 auto vec = createVectorMPI(eP.mField.get_comm(), 1, 1);
494 eP.dataAtPts->wL2AtPts.resize(0, 0, false);
495
496 if (auto fe_ptr = dataFieldEval->feMethodPtr) {
497 CHKERR eP.mField.getInterface<FieldEvaluatorInterface>()
498 ->evalFEAtThePoint<SPACE_DIM>(
499 point.data(), 1e-12, problemPtr->getName(), "EP", dataFieldEval,
501 MF_EXIST, QUIET);
502 }
503 if (eP.dataAtPts->wL2AtPts.size2() == 0) {
504 VecSetValue(vec, 0, 0.0, ADD_VALUES);
505 } else if (eP.dataAtPts->wL2AtPts.size2() == 1) {
506 auto add = [&]() {
507 std::ostringstream s;
508 s << str << " elem " << getFEEntityHandle() << " ";
509 return s.str();
510 };
511 MOFEM_LOG("EPSYNC", Sev::inform)
512 << add() << "comm rank " << eP.mField.get_comm_rank();
513 MOFEM_LOG("EPSYNC", Sev::inform)
514 << add() << "point " << getVectorAdaptor(point.data(), 3);
515 MOFEM_LOG("EPSYNC", Sev::inform)
516 << add() << "w " << eP.dataAtPts->wL2AtPts;
517 double disp_at_point = eP.dataAtPts->wL2AtPts(0);
518 VecSetValue(vec, 0, disp_at_point, ADD_VALUES);
519 }
520
522 if (ts_t > 0.0) {
523 CHKERR VecAssemblyBegin(vec);
524 CHKERR VecAssemblyEnd(vec);
525 double error;
526 PetscInt idx = 0;
527 if (eP.mField.get_comm_rank() == 0) {
528 CHKERR VecGetValues(vec, 1, &idx, &error);
529 }
530 MPI_Bcast(&error, 1, MPI_DOUBLE, 0, PETSC_COMM_WORLD);
531 // Check if the displacement is correct for the applied external
532 // strain For the bar problem, we expect a displacement of 0.25 at
533 // point A
534 if (std::abs(error - 0.25) > 1e-5) {
535 SETERRQ(PETSC_COMM_WORLD, MOFEM_ATOM_TEST_INVALID,
536 "Atom test %d failed: wrong displacement.", atom_test);
537 }
538 }
540 };
541
542 CHKERR save_restart_file();
543 CHKERR calculate_reaction_forces();
544 CHKERR calculate_energy();
545
546 CHKERR post_process_material_forces();
547 CHKERR post_process_skin();
548 CHKERR post_process_skeleton_results();
549
550 PetscInt atom_test = 0;
551 CHKERR PetscOptionsGetInt(PETSC_NULLPTR, "", "-atom_test", &atom_test,
552 PETSC_NULLPTR);
553
554 if (atom_test == 14) {
555 // Points for external strain
556 for (auto &pts : ptsHashMap) {
557 CHKERR check_external_strain(pts.second, pts.first, atom_test);
558 }
559 } else {
560 // Points for Cook beam
561 for (auto &pts : ptsHashMap) {
562 CHKERR post_proc_at_points(pts.second, pts.first);
564 }
565 }
566
568 }
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
#define MOFEM_LOG_C(channel, severity, format,...)
@ QUIET
@ MF_EXIST
@ MOFEM_ATOM_TEST_INVALID
Definition definitions.h:40
virtual MoFEMErrorCode loop_finite_elements(const std::string problem_name, const std::string &fe_name, FEMethod &method, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)=0
Make a loop over finite elements.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
auto getVectorAdaptor(T1 ptr, const size_t n)
Get Vector adaptor.
Definition Templates.hpp:31
auto createVectorMPI(MPI_Comm comm, PetscInt n, PetscInt N)
Create MPI Vector.
MoFEMErrorCode determinantTensor3by3(T1 &t, T2 &det)
Calculate determinant 3 by 3.
constexpr double t
plate stiffness
Definition plate.cpp:58
static constexpr int approx_order
MoFEMErrorCode postProcessResults(const int tag, const std::string file, Vec f_residual=PETSC_NULLPTR, Vec var_vec=PETSC_NULLPTR, std::vector< Tag > tags_to_transfer={}, TS ts=PETSC_NULLPTR)
static PetscBool crackingOn
MoFEMErrorCode calculateFaceMaterialForce(const int tag, TS ts)
MoFEMErrorCode calculateCrackArea(boost::shared_ptr< double > area_ptr)
MoFEMErrorCode postProcessSkeletonResults(const int tag, const std::string file, Vec f_residual=PETSC_NULLPTR, std::vector< Tag > tags_to_transfer={})
const std::string skinElement
boost::shared_ptr< Range > crackFaces
boost::shared_ptr< Range > frontEdges
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
virtual int get_comm_rank() const =0
auto save_range

◆ preProcess()

MoFEMErrorCode EshelbianMonitor::preProcess ( )
inline

Definition at line 177 of file EshelbianMonitor.cpp.

177{ return 0; }

Member Data Documentation

◆ dataFieldEval

boost::shared_ptr<SetPtsData> EshelbianMonitor::dataFieldEval

Definition at line 17 of file EshelbianMonitor.cpp.

◆ eP

EshelbianCore& EshelbianMonitor::eP

Definition at line 16 of file EshelbianMonitor.cpp.

◆ gEnergy

boost::shared_ptr<double> EshelbianMonitor::gEnergy

Definition at line 19 of file EshelbianMonitor.cpp.

◆ ptsHashMap

PtsHashMap EshelbianMonitor::ptsHashMap

Definition at line 20 of file EshelbianMonitor.cpp.

◆ volPostProcEnergy

boost::shared_ptr<VolEle> EshelbianMonitor::volPostProcEnergy

Definition at line 18 of file EshelbianMonitor.cpp.

◆ writeRestart

PetscBool EshelbianMonitor::writeRestart = PETSC_FALSE

Definition at line 21 of file EshelbianMonitor.cpp.


The documentation for this struct was generated from the following file: