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