v0.16.3
Loading...
Searching...
No Matches
EshelbianCore.hpp
Go to the documentation of this file.
1/**
2 * @file EshelbianCore.hpp
3 * @author your name (you@domain.com)
4 * @brief
5 * @version 0.1
6 * @date 2024-12-31
7 *
8 * @copyright Copyright (c) 2024
9 *
10 */
11
13
14 static inline const char *listSolvers[] = {
15 "time_solver",
16 "dynamic_relaxation",
17 "incremental_optimization",
18 "load_factor",
19 "shape_optimization",
20 "test_topological_derivative",
21 "test_incremental_optimization_hessian",
22 "test_incremental_optimization_layout",
23 "test_incremental_optimization_transaction",
24 "test_incremental_optimization_objective_derivative",
25 "test_incremental_optimization_preparation",
26 "test_incremental_optimization_history_transaction",
27 "test_incremental_optimization_tao_failure",
28 "test_incremental_optimization_trust_solve"};
29
49
50 /** Whether `type` is one of the incremental-optimisation test solvers. */
54
55 // That exploits fact that full system is symmetric
56 static inline constexpr enum SymmetrySelector symmetrySelector = SYMMETRIC;
57
58 static inline enum SolverType solverType = TimeSolver;
59 static inline enum RotSelector rotSelector = LARGE_ROT;
60 static inline enum RotSelector gradApproximator = LARGE_ROT;
61 static inline enum StretchSelector stretchSelector = LOG;
62 static inline PetscBool setSingularity = PETSC_FALSE; //< set singularity
63 static inline PetscBool physicalTimeFlg =
64 PETSC_FALSE; //< switch on/off dynamic relaxation
65 static inline PetscBool crackingOn = PETSC_FALSE; //< cracking on
66 static inline PetscBool propagateUnderCompression =
67 PETSC_TRUE; //< allow crack propagation under compression
68 static inline double crackingStartTime = 0; //< time when crack starts to grow
69 static inline double crackingAddTime = 0; //< time to add new crack surface
70 static inline bool noCrackExtension = false; //< flag for no crack extension
71 static inline int nbStepsNoCrackExtension =
72 0; //< number of steps with no crack extension
73 static inline bool potentialCrackArrest =
74 false; //< flag potential crack arrest
75 static inline int nbJIntegralContours =
76 0; //< number of contours for J integral evaluation
77 static inline double finalPhysicalTime =
78 0; //< Maximum step for non-time solver
79 static inline double currentPhysicalTime =
80 0; //< Current step for non-time solver
81 static inline double physicalDt = 0; //< Step size for non-time solver
82 static inline int physicalMaxSteps =
83 20; //< maximum iterations for non-time solver
84 static inline int physicalStepNumber = 0; //< Step number for non-time solver
85 static inline PetscBool physicalH1Update =
86 PETSC_FALSE; //< update H1 space at each non-time solver step
87 static inline PetscBool l2UserBaseScale = PETSC_FALSE; //< scale L2 user base
88 static inline int addCrackMeshsetId = 1000; //< add crack meshset id
89 static inline double griffithEnergy = 1; ///< Griffith energy
90 static inline double crackingRtol = 1e-10; ///< Cracking relative tolerance
91 static inline double crackingAtol = 1e-12; ///< Cracking absolute tolerance
92 static inline enum EnergyReleaseSelector energyReleaseSelector =
93 GRIFFITH_SKELETON; //< energy release selector
94 static inline std::string internalStressTagName =
95 ""; //< internal stress tag name
96 static inline PetscBool internalStressVoigt =
97 PETSC_FALSE; //< internal stress index notation
98 static inline PetscBool interfaceCrack =
99 PETSC_FALSE; //< interface crack tracking
100 static inline PetscBool plasticVolume =
101 PETSC_FALSE; //< restrict plasticity to the plastic volume block
102
103 static inline int interfaceRemoveLevel =
104 0; //< number of levels of elements to remove around interface crack
105 static inline std::string heterogeneousYoungModTagName =
106 ""; //< heterogenous young's modulus
107 static inline std::string meshTransferSourceMeshFileName =
108 ""; //< source mesh file name for projection material tags
109 static inline int meshTransferInterpOrder =
110 1; //< interpolation order for projection material tags
111 static inline PetscBool meshTransferSourceMeshFileSpecified =
112 PETSC_FALSE; //< flag to check if source mesh file is specified for
113 // projection material tags
114 static inline PetscBool meshTransferHybridInterp =
115 PETSC_TRUE; //< flag to use hybrid interpolation for projection material
116 // tags
117 static inline std::vector<std::string>
118 listTagsToProject; // list of tags to project from source mesh to target
119 // mesh
121 DEMKOWICZ_JACOBI_BASE; //< approximation base for broken HDIV stress
122
123 template <FieldApproximationBase HdivBase> struct FieldOrders;
124
125 template <typename Op> MoFEMErrorCode withFieldOrders(Op &&op) const {
129 CHKERR op.template operator()<DEMKOWICZ_JACOBI_BASE>();
130 break;
132 CHKERR op.template operator()<AINSWORTH_LEGENDRE_BASE>();
133 break;
134 default:
136 "Broken HDIV base not implemented");
137 }
139 }
140
141 static inline double maxCrackExtension =
142 50; //< maximum crack extension in one physical step
143
144 static boost::function<double(const double)> f;
145 static boost::function<double(const double)> d_f;
146 static boost::function<double(const double)> dd_f;
147 static boost::function<double(const double)> inv_f;
148 static boost::function<double(const double)> inv_d_f;
149 static boost::function<double(const double)> inv_dd_f;
150
151 static inline constexpr double v_max = 24;
152
153 static double f_log_e_quadratic(const double v) {
154 if (v > v_max) {
155 double e = static_cast<double>(std::exp(v_max));
156 double dv = v - v_max;
157 return 0.5 * e * dv * dv + e * dv + e;
158 } else {
159 return static_cast<double>(std::exp(v));
160 }
161 }
162
163 static double d_f_log_e_quadratic(const double v) {
164 if (v > v_max) {
165 double e = static_cast<double>(std::exp(v_max));
166 double dv = v - v_max;
167 return e * dv + e;
168 } else {
169 return static_cast<double>(std::exp(v));
170 }
171 }
172
173 static double dd_f_log_e_quadratic(const double v) {
174 if (v > v_max) {
175 return static_cast<double>(std::exp(v_max));
176 } else {
177 return static_cast<double>(std::exp(v));
178 }
179 }
180
181 static double inv_f_log_e_quadratic(const double stretch) {
182 const double transition_stretch = std::exp(v_max);
183 if (stretch <= transition_stretch) {
184 return std::log(stretch);
185 }
186 return v_max - 1. + std::sqrt(2. * stretch / transition_stretch - 1.);
187 }
188
189 static double inv_d_f_log_e_quadratic(const double stretch) {
190 const double transition_stretch = std::exp(v_max);
191 if (stretch <= transition_stretch) {
192 return 1. / stretch;
193 }
194 const double root = std::sqrt(2. * stretch / transition_stretch - 1.);
195 return 1. / (transition_stretch * root);
196 }
197
198 static double inv_dd_f_log_e_quadratic(const double stretch) {
199 const double transition_stretch = std::exp(v_max);
200 if (stretch <= transition_stretch) {
201 return -1. / (stretch * stretch);
202 }
203 const double root = std::sqrt(2. * stretch / transition_stretch - 1.);
204 return -1. / (transition_stretch * transition_stretch * root * root * root);
205 }
206
207 static double f_log_e(const double v) { return std::exp(v); }
208 static double d_f_log_e(const double v) { return std::exp(v); }
209 static double dd_f_log_e(const double v) { return std::exp(v); }
210 static double inv_f_log_e(const double v) { return std::log(v); }
211 static double inv_d_f_log_e(const double v) { return 1. / v; }
212 static double inv_dd_f_log_e(const double v) { return -1. / (v * v); }
213
214 static double f_linear(const double v) { return v + 1; }
215 static double d_f_linear(const double) { return 1; }
216 static double dd_f_linear(const double) { return 0; }
217
218 static double inv_f_linear(const double v) { return v - 1; }
219 static double inv_d_f_linear(const double) { return 1; }
220 static double inv_dd_f_linear(const double) { return 0; }
221
222 /**
223 * \brief Getting interface of core database
224 * @param uuid unique ID of interface
225 * @param iface returned pointer to interface
226 * @return error code
227 */
228 MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
229 UnknownInterface **iface) const;
230
232
233 boost::shared_ptr<DataAtIntegrationPts> dataAtPts;
234 boost::shared_ptr<PhysicalEquations> physicalEquations;
235 boost::shared_ptr<AnalyticalExprPython> AnalyticalExprPythonPtr;
236
237 boost::shared_ptr<VolumeElementForcesAndSourcesCore> elasticFeRhs;
238 boost::shared_ptr<VolumeElementForcesAndSourcesCore> elasticFeLhs;
239 boost::shared_ptr<FaceElementForcesAndSourcesCore> elasticBcLhs;
240 boost::shared_ptr<FaceElementForcesAndSourcesCore> elasticBcRhs;
241 boost::shared_ptr<ForcesAndSourcesCore>
242 contactTreeRhs; ///< Make a contact tree
243
244 SmartPetscObj<DM> dM; ///< Coupled problem all fields
245 SmartPetscObj<DM> dmElastic; ///< Elastic problem
246 SmartPetscObj<DM> dmMaterial; ///< Material problem
247 /** TAO control problem: every incremental-optimisation control field. */
248 SmartPetscObj<DM> dmIncrementalOptimization;
249 /** TAO trial control vector on dmIncrementalOptimization. The mechanical
250 * element pipelines read the plastic flow from this vector. */
251 SmartPetscObj<Vec> incrementalTrialControl;
252 /** History projection problem: committed internal variables updated by an
253 * L2 projection after a step is accepted, at present plastic kappa. */
254 SmartPetscObj<DM> dmIncrementalHistory;
255
256 const std::string piolaStress = "P";
257 const std::string spatialL2Disp = "wL2";
258 const std::string spatialH1Disp = "wH1";
259 const std::string materialH1Positions = "XH1";
260 const std::string hybridSpatialDisp = "hybridSpatialDisp";
261 const std::string contactDisp = "contactDisp";
262 const std::string stretchTensor = "u";
263 const std::string logDeviator = "D";
264 const std::string logJacobian = "theta";
265 const std::string auxiliaryLogStress = "Td";
266 const std::string rotAxis = "omega";
267 const std::string bubbleField = "bubble";
268 const std::string plasticFlowField = "plasticFlow";
269 const std::string plasticLatentField = "plasticLatent";
270 const std::string plasticKappaField = "plasticKappa";
271 const std::string plasticHField = "plasticH";
272
273 const std::string elementVolumeName = "EP";
274 const std::string naturalBcElement = "NATURAL_BC";
275 const std::string skinElement = "SKIN";
276 const std::string skeletonElement = "SKELETON";
277 const std::string contactElement = "CONTACT";
278
280 virtual ~EshelbianCore();
281
282 int spaceOrder = 2;
283 int spaceH1Order = -1;
288 double alphaU = 0;
289 double alphaW = 0;
290 double alphaOmega = 0;
292 0; ///< Rotation-gradient shift of the Schur preconditioner.
293 double alphaR = 0;
295 double alphaViscousR = 0;
296 double alphaRho = 0;
297 double alphaTau = 0;
298 double alphaTauLin = 0;
299 double dynamicAtol = 0;
300 double dynamicRtol = 0;
302
303 int contactRefinementLevels = 1; //< refinement levels for contact integration
304 int frontLayers = 3; //< front layers with material element
305 double loadFactor = 1.0; //< load factor
307
308 MoFEMErrorCode getOptions();
309 MoFEMErrorCode applyTestSolverMonitorOptions(TS ts);
311
312 boost::shared_ptr<BcDispVec> bcSpatialDispVecPtr;
313 boost::shared_ptr<BcRotVec> bcSpatialRotationVecPtr;
314 boost::shared_ptr<TractionBcVec> bcSpatialTractionVecPtr;
315 boost::shared_ptr<TractionFreeBc> bcSpatialFreeTractionVecPtr;
316 boost::shared_ptr<NormalDisplacementBcVec> bcSpatialNormalDisplacementVecPtr;
317 boost::shared_ptr<SpringBcVec> bcSpatialSpringVecPtr;
318 boost::shared_ptr<AnalyticalDisplacementBcVec>
320 boost::shared_ptr<AnalyticalTractionBcVec> bcSpatialAnalyticalTractionVecPtr;
321 boost::shared_ptr<PressureBcVec> bcSpatialPressureVecPtr;
322 boost::shared_ptr<ExternalStrainVec> externalStrainVecPtr;
323 double oldCrackArea = 0.;
324 double oldStrainEnergy = 0.;
325 double oldLoadFactor = 1.0;
326 double strainEnergy = 0.;
327 boost::shared_ptr<double> currentCrackAreaPtr;
328
329 std::map<std::string, boost::shared_ptr<ScalingMethod>> timeScaleMap;
330
331 std::string getStringArgumentFromJsonBlockset(const std::string &type_name,
332 const int meshset_id,
333 const std::string &param_name) {
334 const auto string_params =
335 mField.getInterface<JsonConfigManager>()->getStringParamsFromBlockset(
336 type_name, meshset_id);
337 if (const auto it = string_params.find(param_name);
338 it != string_params.end()) {
339 return it->second;
340 }
341 return "";
342 }
343
344 MoFEMErrorCode
345 getStringArgumentFromJsonBlocksets(const std::string &type_name,
346 const std::string &param_name,
347 std::string &param_value) {
349 param_value.clear();
350 for (auto it : mField.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
351 std::regex((boost::format("%s(.*)") % type_name).str()))) {
352 const auto block_param = getStringArgumentFromJsonBlockset(
353 type_name, it->getMeshsetId(), param_name);
354 if (block_param.empty()) {
355 continue;
356 }
357 if (!param_value.empty() && param_value != block_param) {
358 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
359 "JSON %s blocksets specify different '%s' values",
360 type_name.c_str(), param_name.c_str());
361 }
362 param_value = block_param;
363 }
365 }
366
367 template <typename BC>
368 MoFEMErrorCode getBc(boost::shared_ptr<BC> &bc_vec_ptr,
369 const std::string block_name, const int nb_attributes) {
371 for (auto it :
372 mField.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
373
374 (boost::format("%s(.*)") % block_name).str()
375
376 ))
377
378 ) {
379 std::vector<double> block_attributes;
380 CHKERR it->getAttributes(block_attributes);
381 if (block_attributes.size() < static_cast<size_t>(nb_attributes)) {
382 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
383 "In block %s expected %d attributes, but given %ld",
384 it->getName().c_str(), nb_attributes, block_attributes.size());
385 }
386 Range faces;
387 CHKERR it->getMeshsetIdEntitiesByDimension(mField.get_moab(), 2, faces,
388 true);
389 bc_vec_ptr->emplace_back(
390 it->getName(), block_attributes, faces,
391 getStringArgumentFromJsonBlockset(block_name, it->getMeshsetId(),
392 "load_history"));
393 }
395 }
396
397 MoFEMErrorCode getSpatialDispBc();
398
399 inline MoFEMErrorCode getSpatialRotationBc() {
401 bcSpatialRotationVecPtr = boost::make_shared<BcRotVec>();
402 CHKERR getBc(bcSpatialRotationVecPtr, "SPATIAL_ROTATION_BC", 4);
403 CHKERR getBc(bcSpatialRotationVecPtr, "SPATIAL_ROTATION_AXIS_BC", 7);
404
405 for (auto &bc : *bcSpatialRotationVecPtr) {
406 MOFEM_LOG("EP", Sev::inform)
407 << "Found spatial rotation BC on block " << bc.blockName;
408 MOFEM_LOG("EP", Sev::inform) << " with attributes: " << bc.vals;
409 MOFEM_LOG("EP", Sev::inform) << " and rotation angle: " << bc.theta;
410 MOFEM_LOG("EP", Sev::inform) << " and nb of faces: " << bc.faces.size();
411 }
412
413 auto ts_rotation =
414 boost::make_shared<DynamicRelaxationTimeScale>("rotation_history.txt");
415 for (auto &bc : *bcSpatialRotationVecPtr) {
416 if (!bc.loadHistoryFile.empty()) {
417 MOFEM_LOG("EP", Sev::inform)
418 << "Rotation load history from JSON for " << bc.blockName << ": "
419 << bc.loadHistoryFile;
420 timeScaleMap[bc.blockName] =
421 boost::make_shared<DynamicRelaxationTimeScale>(bc.loadHistoryFile);
422 } else {
423 timeScaleMap[bc.blockName] =
424 GetBlockScalingMethod<DynamicRelaxationTimeScale>::get(
425 ts_rotation, "rotation_history", ".txt", bc.blockName);
426 }
427 }
428
430 }
431
432 MoFEMErrorCode getSpatialTractionBc();
433
434 /**
435 * @brief Remove all, but entities where kinematic constrains are applied.
436 *
437 * @param meshset
438 * @param bc_ptr
439 * @param disp_block_set_name
440 * @param rot_block_set_name
441 * @param contact_set_name
442 * @return MoFEMErrorCode
443 */
444 MoFEMErrorCode getTractionFreeBc(const EntityHandle meshset,
445 boost::shared_ptr<TractionFreeBc> &bc_ptr,
446 const std::string contact_set_name);
447
448 inline MoFEMErrorCode
449 getSpatialTractionFreeBc(const EntityHandle meshset = 0) {
451 boost::shared_ptr<TractionFreeBc>(new TractionFreeBc());
452 return getTractionFreeBc(meshset, bcSpatialFreeTractionVecPtr, "CONTACT");
453 }
454
455 MoFEMErrorCode getExternalStrain();
456
457 MoFEMErrorCode createExchangeVectors(Sev sev);
458
459 MoFEMErrorCode resolveDissipationEntities(const EntityHandle meshset = 0);
460 MoFEMErrorCode addFields(const EntityHandle meshset = 0,
461 const bool add_bubble = true);
462 MoFEMErrorCode projectGeometry(const EntityHandle meshset = 0,
463 double time = 0);
464 MoFEMErrorCode projectMaterialTags(const EntityHandle meshset = 0);
465
466 MoFEMErrorCode addVolumeFiniteElement(const EntityHandle meshset = 0,
467 const bool add_bubble = true);
468 MoFEMErrorCode addBoundaryFiniteElement(const EntityHandle meshset = 0);
469 MoFEMErrorCode addDMs(const BitRefLevel bit = BitRefLevel().set(0),
470 const EntityHandle meshset = 0);
471
472 MoFEMErrorCode setBaseVolumeElementOps(
473 const int tag, const bool do_rhs, const bool do_lhs,
474 const bool calc_rates,
475 boost::shared_ptr<VolumeElementForcesAndSourcesCore> fe,
476 const bool add_bubble = true);
477
478 MoFEMErrorCode setVolumeElementOps(
479 const int tag, const bool add_elastic, const bool add_material,
480 boost::shared_ptr<VolumeElementForcesAndSourcesCore> &fe_rhs,
481 boost::shared_ptr<VolumeElementForcesAndSourcesCore> &fe_lhs);
482
483 MoFEMErrorCode
484 pushVolumeA00Ops(boost::shared_ptr<VolumeElementForcesAndSourcesCore> fe_lhs);
485
486 MoFEMErrorCode pushStressGramOps(
487 boost::shared_ptr<VolumeElementForcesAndSourcesCore> fe_lhs);
488
489 MoFEMErrorCode pushPiolaStressGramOps(
490 boost::shared_ptr<VolumeElementForcesAndSourcesCore> fe_lhs);
491
492 MoFEMErrorCode
493 setFaceElementOps(const bool add_elastic, const bool add_material,
494 boost::shared_ptr<FaceElementForcesAndSourcesCore> &fe_rhs,
495 boost::shared_ptr<FaceElementForcesAndSourcesCore> &fe_lhs);
496
497 MoFEMErrorCode setContactElementRhsOps(
498
499 boost::shared_ptr<ForcesAndSourcesCore> &fe_contact_tree
500
501 );
502
503 MoFEMErrorCode setElasticElementOps(const int tag);
504 MoFEMErrorCode setElasticElementToTs(DM dm);
505
506 /** \brief Add debug to model
507 *
508 * That prints information every SNES step
509 */
510 MoFEMErrorCode addDebugModel(TS ts);
511
512 MoFEMErrorCode solveElastic(TS ts, Vec x);
513
514 /**
515 * @brief Solve problem using dynamic relaxation method
516 *
517 * @param ts solver time stepper
518 * @param x solution vector
519 * @param start_step starting step number
520 * @param start_time starting time
521 * @return MoFEMErrorCode
522 */
523 MoFEMErrorCode solveDynamicRelaxation(TS ts, Vec x, int start_step,
524 double start_time);
525
526 /**
527 * @brief Solve the incremental constitutive optimization with TAO
528 *
529 * @param ts
530 * @param x
531 * @return * MoFEMErrorCode
532 */
533 MoFEMErrorCode solveIncrementalOptimizationTAO(TS ts, Vec x, int start_step,
534 double start_time);
535
536protected:
537 MoFEMErrorCode runIncrementalOptimizationTAO(TS ts, Vec x);
538
539public:
540 /**
541 * @brief Solve load factor crack growth problem
542 *
543 * @param ts
544 * @param x
545 * @return * MoFEMErrorCode
546 */
547 MoFEMErrorCode solveLoadFactor(TS ts, Vec x, int start_step,
548 double start_time);
549
550 /**
551 * @brief Solve shape optimisation problem
552 *
553 * @param ts
554 * @param x
555 * @return * MoFEMErrorCode
556 */
557 MoFEMErrorCode solveSchapeOptimisation(TS ts, Vec x, int start_step,
558 double start_time);
559
560 MoFEMErrorCode solveTestTopologicalDerivative(TS ts, Vec x, int start_step,
561 double start_time);
562
563 /** Run the incremental-optimisation test selected by solverType on the
564 * equilibrated mechanical setup; see isIncrementalOptimizationTestSolver. */
565 MoFEMErrorCode solveTestIncrementalOptimization(TS ts, Vec x, int start_step,
566 double start_time);
567
568 MoFEMErrorCode setBlockTagsOnSkin();
569
570 MoFEMErrorCode postProcessRestartMesh(const int tag, const std::string file,
571 std::vector<Tag> tags_to_transfer = {});
572
573 MoFEMErrorCode postProcessResults(const int tag, const std::string file,
574 Vec f_residual = PETSC_NULLPTR,
575 Vec var_vec = PETSC_NULLPTR,
576 Vec gradient = PETSC_NULLPTR,
577 std::vector<Tag> tags_to_transfer = {},
578 TS ts = PETSC_NULLPTR);
580 const int tag, const std::string file, Vec f_residual = PETSC_NULLPTR,
581 std::vector<Tag> tags_to_transfer = {}, TS ts = PETSC_NULLPTR);
582
584 boost::shared_ptr<double> &area_ptr); // calculate crack area
585
587
588 struct SetUpSchur {
589 static boost::shared_ptr<SetUpSchur> createSetUpSchur(
590
591 MoFEM::Interface &m_field, EshelbianCore *ep_core_ptr
592
593 );
594 virtual MoFEMErrorCode setUp(TS) = 0;
595
596 protected:
597 SetUpSchur() = default;
598 };
599
601
602 using TimeScale::TimeScale;
603
604 double getScale(const double time) override {
606 return TimeScale::getScale(EshelbianCore::currentPhysicalTime);
607 else
608 return TimeScale::getScale(time);
609 }
610 };
611
612 MoFEMErrorCode calculateFaceMaterialForce(
613 const int tag, TS ts,
614 SmartPetscObj<Vec> *adjoint_gradient_vector = nullptr);
615 MoFEMErrorCode calculateOrientation(const int tag, bool set_orientation);
616 MoFEMErrorCode setNewFrontCoordinates();
617 MoFEMErrorCode addCrackSurfaces(const bool debug = false);
618 MoFEMErrorCode createCrackSurfaceMeshset();
619
620 boost::shared_ptr<Range> contactFaces;
621 boost::shared_ptr<Range> crackFaces;
622 boost::shared_ptr<Range> frontEdges;
623 boost::shared_ptr<Range> frontAdjEdges;
624 boost::shared_ptr<Range> frontVertices;
625 boost::shared_ptr<Range> skeletonFaces;
626 boost::shared_ptr<Range> maxMovedFaces;
627 boost::shared_ptr<Range> interfaceFaces;
628 boost::shared_ptr<Range> plasticVolumes;
629
630 boost::shared_ptr<ParentFiniteElementAdjacencyFunctionSkeleton<2>>
632
633 BitRefLevel bitAdjParent = BitRefLevel().set(); ///< bit ref level for parent
634 BitRefLevel bitAdjParentMask =
635 BitRefLevel().set(); ///< bit ref level for parent parent
636 BitRefLevel bitAdjEnt = BitRefLevel().set(); ///< bit ref level for parent
637 BitRefLevel bitAdjEntMask =
638 BitRefLevel().set(); ///< bit ref level for parent parent
639
640 SmartPetscObj<Vec> solTSStep;
641 PetscBool loadFactorTSSolveExecuted = PETSC_FALSE;
642
643 CommInterface::EntitiesPetscVector volumeExchange;
644 CommInterface::EntitiesPetscVector faceExchange;
645 CommInterface::EntitiesPetscVector edgeExchange;
646 CommInterface::EntitiesPetscVector vertexExchange;
647
648 std::vector<Tag>
649 listTagsToTransfer; ///< list of tags to transfer to postprocessor
650
651 Mat S = PETSC_NULLPTR; //< Schur complement matrix
652 AO aoS = PETSC_NULLPTR; //< AO for Schur complement matrix
653 SmartPetscObj<IS> crackHybridIs; //< IS for crack hybrid field
654 std::vector<std::string> a00FieldList; //< list of fields for Schur complement
655 std::vector<boost::shared_ptr<Range>>
656 a00RangeList; //< list of ranges for Schur complement
657
658 int nbCrackFaces = 0; //< number of crack faces
659};
660
662 static inline int stress(const int o) { return o; }
663 static inline int bubble(const int o) { return o; }
664 static inline int disp(const int o) { return o - 1; }
665 static inline int rot(const int o) { return o - 1; }
666 static inline int stretch(const int o) { return o; }
667 static inline int logDeviator(const int o) { return stretch(o); }
668 static inline int logJacobian(const int o) { return stretch(o); }
669 static inline int auxiliaryLogStress(const int o) { return stretch(o); }
670 static inline int hybrid(const int o) { return o - 1; }
671};
672
674 static inline int stress(const int o) { return o; }
675 static inline int bubble(const int o) { return o + 1; }
676 static inline int disp(const int o) { return o - 1; }
677 static inline int rot(const int o) { return o; }
678 static inline int stretch(const int o) { return o + 1; }
679 static inline int logDeviator(const int o) { return stretch(o); }
680 static inline int logJacobian(const int o) { return stretch(o); }
681 static inline int auxiliaryLogStress(const int o) { return stretch(o); }
682 static inline int hybrid(const int o) { return o; }
683};
std::string type
SmartPetscObj< Vec > gradient
FieldApproximationBase
approximation base
Definition definitions.h:58
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition definitions.h:60
@ DEMKOWICZ_JACOBI_BASE
Definition definitions.h:66
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
@ MOFEM_NOT_IMPLEMENTED
Definition definitions.h:32
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
static const bool debug
#define MOFEM_LOG(channel, severity)
Log.
auto bit
set bit
const double v
phase velocity of light in medium (cm/ns)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
double getScale(const double time) override
virtual MoFEMErrorCode setUp(TS)=0
static boost::shared_ptr< SetUpSchur > createSetUpSchur(MoFEM::Interface &m_field, EshelbianCore *ep_core_ptr)
SmartPetscObj< Vec > incrementalTrialControl
std::vector< boost::shared_ptr< Range > > a00RangeList
MoFEMErrorCode setElasticElementOps(const int tag)
boost::shared_ptr< ExternalStrainVec > externalStrainVecPtr
static PetscBool physicalH1Update
static enum StretchSelector stretchSelector
boost::shared_ptr< Range > frontAdjEdges
MoFEMErrorCode createCrackSurfaceMeshset()
static int interfaceRemoveLevel
MoFEMErrorCode addBoundaryFiniteElement(const EntityHandle meshset=0)
const std::string skeletonElement
static double inv_dd_f_linear(const double)
static double inv_f_linear(const double v)
MoFEMErrorCode getSpatialRotationBc()
boost::shared_ptr< TractionBcVec > bcSpatialTractionVecPtr
boost::shared_ptr< Range > contactFaces
static double dd_f_log_e_quadratic(const double v)
static double inv_d_f_linear(const double)
double dynamicInitialResidual
static double dd_f_linear(const double)
BitRefLevel bitAdjEnt
bit ref level for parent
static boost::function< double(const double)> inv_dd_f
MoFEM::Interface & mField
static constexpr double v_max
const std::string spatialL2Disp
std::map< std::string, boost::shared_ptr< ScalingMethod > > timeScaleMap
static enum SolverType solverType
MoFEMErrorCode postProcessSkeletonResults(const int tag, const std::string file, Vec f_residual=PETSC_NULLPTR, std::vector< Tag > tags_to_transfer={}, TS ts=PETSC_NULLPTR)
static PetscBool l2UserBaseScale
SmartPetscObj< DM > dM
Coupled problem all fields.
boost::shared_ptr< FaceElementForcesAndSourcesCore > elasticBcRhs
MoFEMErrorCode solveSchapeOptimisation(TS ts, Vec x, int start_step, double start_time)
Solve shape optimisation problem.
SmartPetscObj< IS > crackHybridIs
boost::shared_ptr< Range > plasticVolumes
boost::shared_ptr< TractionFreeBc > bcSpatialFreeTractionVecPtr
static const char * listSolvers[]
const std::string materialH1Positions
static int nbJIntegralContours
static bool noCrackExtension
MoFEMErrorCode applyTestSolverMonitorOptions(TS ts)
MoFEMErrorCode setBlockTagsOnSkin()
std::vector< Tag > listTagsToTransfer
list of tags to transfer to postprocessor
boost::shared_ptr< FaceElementForcesAndSourcesCore > elasticBcLhs
static PetscBool crackingOn
MoFEMErrorCode getTractionFreeBc(const EntityHandle meshset, boost::shared_ptr< TractionFreeBc > &bc_ptr, const std::string contact_set_name)
Remove all, but entities where kinematic constrains are applied.
MoFEMErrorCode applyProjectionSolverMonitorOptions()
static double griffithEnergy
Griffith energy.
boost::shared_ptr< VolumeElementForcesAndSourcesCore > elasticFeRhs
MoFEMErrorCode postProcessRestartMesh(const int tag, const std::string file, std::vector< Tag > tags_to_transfer={})
MoFEMErrorCode pushVolumeA00Ops(boost::shared_ptr< VolumeElementForcesAndSourcesCore > fe_lhs)
const std::string elementVolumeName
static double dd_f_log_e(const double v)
static double d_f_linear(const double)
static enum RotSelector rotSelector
MoFEMErrorCode addDebugModel(TS ts)
Add debug to model.
static enum RotSelector gradApproximator
PetscBool loadFactorTSSolveExecuted
MoFEMErrorCode postProcessResults(const int tag, const std::string file, Vec f_residual=PETSC_NULLPTR, Vec var_vec=PETSC_NULLPTR, Vec gradient=PETSC_NULLPTR, std::vector< Tag > tags_to_transfer={}, TS ts=PETSC_NULLPTR)
MoFEMErrorCode getBc(boost::shared_ptr< BC > &bc_vec_ptr, const std::string block_name, const int nb_attributes)
static double inv_dd_f_log_e_quadratic(const double stretch)
static double physicalDt
static bool isIncrementalOptimizationTestSolver(const SolverType type)
CommInterface::EntitiesPetscVector vertexExchange
static std::vector< std::string > listTagsToProject
boost::shared_ptr< BcRotVec > bcSpatialRotationVecPtr
boost::shared_ptr< Range > maxMovedFaces
static std::string heterogeneousYoungModTagName
const std::string spatialH1Disp
static FieldApproximationBase brokenHdivBase
static double maxCrackExtension
static int physicalMaxSteps
MoFEMErrorCode solveElastic(TS ts, Vec x)
@ TestIncrementalOptimizationTrustSolve
@ TestIncrementalOptimizationLayout
@ TestIncrementalOptimizationHessian
@ TestIncrementalOptimizationHistoryTransaction
@ TestIncrementalOptimizationTaoFailure
@ TestIncrementalOptimizationTransaction
@ TestIncrementalOptimizationObjectiveDerivative
@ TestIncrementalOptimizationPreparation
boost::shared_ptr< NormalDisplacementBcVec > bcSpatialNormalDisplacementVecPtr
static double crackingStartTime
const std::string logDeviator
MoFEMErrorCode getOptions()
MoFEMErrorCode calculateCrackArea(boost::shared_ptr< double > &area_ptr)
const std::string plasticHField
const std::string piolaStress
MoFEMErrorCode setElasticElementToTs(DM dm)
static double inv_d_f_log_e(const double v)
std::string getStringArgumentFromJsonBlockset(const std::string &type_name, const int meshset_id, const std::string &param_name)
static int physicalStepNumber
MoFEMErrorCode gettingNorms()
[Getting norms]
const std::string logJacobian
boost::shared_ptr< Range > interfaceFaces
std::vector< std::string > a00FieldList
MoFEMErrorCode setVolumeElementOps(const int tag, const bool add_elastic, const bool add_material, boost::shared_ptr< VolumeElementForcesAndSourcesCore > &fe_rhs, boost::shared_ptr< VolumeElementForcesAndSourcesCore > &fe_lhs)
static PetscBool physicalTimeFlg
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Getting interface of core database.
const std::string bubbleField
MoFEMErrorCode solveIncrementalOptimizationTAO(TS ts, Vec x, int start_step, double start_time)
Solve the incremental constitutive optimization with TAO.
boost::shared_ptr< AnalyticalDisplacementBcVec > bcSpatialAnalyticalDisplacementVecPtr
const std::string plasticFlowField
SmartPetscObj< DM > dmMaterial
Material problem.
MoFEMErrorCode calculateOrientation(const int tag, bool set_orientation)
MoFEMErrorCode runIncrementalOptimizationTAO(TS ts, Vec x)
boost::shared_ptr< VolumeElementForcesAndSourcesCore > elasticFeLhs
MoFEMErrorCode resolveDissipationEntities(const EntityHandle meshset=0)
MoFEMErrorCode setNewFrontCoordinates()
boost::shared_ptr< ParentFiniteElementAdjacencyFunctionSkeleton< 2 > > parentAdjSkeletonFunctionDim2
MoFEMErrorCode solveTestIncrementalOptimization(TS ts, Vec x, int start_step, double start_time)
static double crackingAddTime
MoFEMErrorCode setFaceElementOps(const bool add_elastic, const bool add_material, boost::shared_ptr< FaceElementForcesAndSourcesCore > &fe_rhs, boost::shared_ptr< FaceElementForcesAndSourcesCore > &fe_lhs)
MoFEMErrorCode projectGeometry(const EntityHandle meshset=0, double time=0)
static double currentPhysicalTime
boost::shared_ptr< AnalyticalExprPython > AnalyticalExprPythonPtr
boost::shared_ptr< SpringBcVec > bcSpatialSpringVecPtr
static constexpr enum SymmetrySelector symmetrySelector
const std::string auxiliaryLogStress
static double crackingAtol
Cracking absolute tolerance.
MoFEMErrorCode projectMaterialTags(const EntityHandle meshset=0)
boost::shared_ptr< Range > skeletonFaces
static double crackingRtol
Cracking relative tolerance.
boost::shared_ptr< PhysicalEquations > physicalEquations
const std::string rotAxis
SmartPetscObj< DM > dmIncrementalHistory
static PetscBool meshTransferHybridInterp
BitRefLevel bitAdjParentMask
bit ref level for parent parent
MoFEMErrorCode solveDynamicRelaxation(TS ts, Vec x, int start_step, double start_time)
Solve problem using dynamic relaxation method.
const std::string contactDisp
static std::string internalStressTagName
CommInterface::EntitiesPetscVector edgeExchange
double alphaOmegaPrec
Rotation-gradient shift of the Schur preconditioner.
static boost::function< double(const double)> f
MoFEMErrorCode solveTestTopologicalDerivative(TS ts, Vec x, int start_step, double start_time)
static int nbStepsNoCrackExtension
boost::shared_ptr< BcDispVec > bcSpatialDispVecPtr
static double finalPhysicalTime
boost::shared_ptr< ForcesAndSourcesCore > contactTreeRhs
Make a contact tree.
const std::string skinElement
static PetscBool internalStressVoigt
MoFEMErrorCode addVolumeFiniteElement(const EntityHandle meshset=0, const bool add_bubble=true)
MoFEMErrorCode getSpatialTractionFreeBc(const EntityHandle meshset=0)
static double inv_dd_f_log_e(const double v)
MoFEMErrorCode getExternalStrain()
MoFEMErrorCode getSpatialTractionBc()
static PetscBool setSingularity
MoFEMErrorCode setBaseVolumeElementOps(const int tag, const bool do_rhs, const bool do_lhs, const bool calc_rates, boost::shared_ptr< VolumeElementForcesAndSourcesCore > fe, const bool add_bubble=true)
static double d_f_log_e(const double v)
boost::shared_ptr< AnalyticalTractionBcVec > bcSpatialAnalyticalTractionVecPtr
static PetscBool plasticVolume
boost::shared_ptr< double > currentCrackAreaPtr
static PetscBool meshTransferSourceMeshFileSpecified
static double f_log_e_quadratic(const double v)
double avgGriffithsEnergy
MoFEMErrorCode addCrackSurfaces(const bool debug=false)
static double inv_f_log_e_quadratic(const double stretch)
MoFEMErrorCode addDMs(const BitRefLevel bit=BitRefLevel().set(0), const EntityHandle meshset=0)
MoFEMErrorCode getSpatialDispBc()
[Getting norms]
BitRefLevel bitAdjParent
bit ref level for parent
MoFEMErrorCode setContactElementRhsOps(boost::shared_ptr< ForcesAndSourcesCore > &fe_contact_tree)
static PetscBool interfaceCrack
MoFEMErrorCode solveLoadFactor(TS ts, Vec x, int start_step, double start_time)
Solve load factor crack growth problem.
MoFEMErrorCode getStringArgumentFromJsonBlocksets(const std::string &type_name, const std::string &param_name, std::string &param_value)
static double d_f_log_e_quadratic(const double v)
CommInterface::EntitiesPetscVector volumeExchange
const std::string naturalBcElement
MoFEMErrorCode calculateFaceMaterialForce(const int tag, TS ts, SmartPetscObj< Vec > *adjoint_gradient_vector=nullptr)
static boost::function< double(const double)> dd_f
static double f_log_e(const double v)
static bool potentialCrackArrest
static int addCrackMeshsetId
static PetscBool propagateUnderCompression
static double inv_f_log_e(const double v)
MoFEMErrorCode createExchangeVectors(Sev sev)
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
boost::shared_ptr< Range > crackFaces
static boost::function< double(const double)> d_f
boost::shared_ptr< Range > frontVertices
static enum EnergyReleaseSelector energyReleaseSelector
static boost::function< double(const double)> inv_d_f
boost::shared_ptr< PressureBcVec > bcSpatialPressureVecPtr
static int meshTransferInterpOrder
const std::string hybridSpatialDisp
SmartPetscObj< Vec > solTSStep
static double inv_d_f_log_e_quadratic(const double stretch)
CommInterface::EntitiesPetscVector faceExchange
SmartPetscObj< DM > dmElastic
Elastic problem.
static std::string meshTransferSourceMeshFileName
const std::string plasticKappaField
boost::shared_ptr< Range > frontEdges
static boost::function< double(const double)> inv_f
const std::string stretchTensor
BitRefLevel bitAdjEntMask
bit ref level for parent parent
static double f_linear(const double v)
SmartPetscObj< DM > dmIncrementalOptimization
MoFEMErrorCode addFields(const EntityHandle meshset=0, const bool add_bubble=true)
const std::string plasticLatentField
MoFEMErrorCode withFieldOrders(Op &&op) const
MoFEMErrorCode pushStressGramOps(boost::shared_ptr< VolumeElementForcesAndSourcesCore > fe_lhs)
const std::string contactElement
MoFEMErrorCode pushPiolaStressGramOps(boost::shared_ptr< VolumeElementForcesAndSourcesCore > fe_lhs)
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
Deprecated interface functions.
base class for all interface classes
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.