v0.14.0
memcheck_leak.cpp
Go to the documentation of this file.
1 /* This file is part of MoFEM.
2  * MoFEM is free software: you can redistribute it and/or modify it under
3  * the terms of the GNU Lesser General Public License as published by the
4  * Free Software Foundation, either version 3 of the License, or (at your
5  * option) any later version.
6  *
7  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
8  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  * License for more details.
11  *
12  * You should have received a copy of the GNU Lesser General Public
13  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
14 
15 #ifdef WITH_TETGEN
16 
17 #include <tetgen.h>
18 #ifdef REAL
19 #undef REAL
20 #endif
21 
22 #endif
23 
24 #include <MoFEM.hpp>
25 using namespace MoFEM;
26 #include <BasicFiniteElements.hpp>
27 #include <Mortar.hpp>
28 #include <NeoHookean.hpp>
29 #include <Hooke.hpp>
30 
31 #define BOOST_UBLAS_NDEBUG 1
32 
33 #include <CrackFrontElement.hpp>
34 #include <ComplexConstArea.hpp>
35 #include <MWLS.hpp>
36 #include <GriffithForceElement.hpp>
37 
38 #include <VolumeLengthQuality.hpp>
39 #include <CrackPropagation.hpp>
40 #include <CPSolvers.hpp>
41 #include <CPMeshCut.hpp>
42 #include <AnalyticalFun.hpp>
43 
44 static char help[] = "Calculate crack release energy and crack propagation"
45  "\n\n";
46 
47 using namespace FractureMechanics;
48 
49 bool CrackPropagation::debug = false;
50 
51 bool CrackPropagation::parallelReadAndBroadcast =
52  false; ///< That is unstable development, for
53  ///< some meshses (propably generated by
54  ///< cubit) this is not working. Error can
55  ///< be attributed to bug in MOAB.
56 
57 int main(int argc, char *argv[]) {
58 
59  const char param_file[] = "param_file.petsc";
60  MoFEM::Core::Initialize(&argc, &argv, param_file, help);
61 
62  std::vector<boost::weak_ptr<RefEntity>> v_ref_entity;
63  std::vector<boost::weak_ptr<RefElement>> v_ref_element;
64  std::vector<boost::weak_ptr<Field>> v_field;
65  boost::weak_ptr<DofEntity> arc_dof;
66  boost::weak_ptr<MWLSApprox> mwls_approx;
67  std::vector<boost::weak_ptr<FEMethod>> vec_fe;
68  std::vector<boost::weak_ptr<NonlinearElasticElement>> v_elastic_ele_str;
69 
70  try {
71 
72  PetscBool flg = PETSC_FALSE;
73  CHKERR PetscOptionsGetBool(PETSC_NULL, "", "-debug", &flg, PETSC_NULL);
74  if (flg == PETSC_TRUE)
76 
77  char mesh_file_name[255];
78  CHKERR PetscOptionsGetString(PETSC_NULL, "", "-my_file", mesh_file_name,
79  255, &flg);
80 
81  moab::Core mb_instance;
82  moab::Interface &moab = mb_instance;
83 
84  // Read mesh file
85  if (flg) {
86  const char *option;
87  option = "";
88  CHKERR moab.load_file(mesh_file_name, 0, option);
89  }
90 
91  // Create mofem database
93  MoFEM::Core core(moab, PETSC_COMM_WORLD, VERBOSE);
94  MoFEM::Interface &m_field = core;
95 
96  auto core_log = logging::core::get();
97  core_log->add_sink(
99  LogManager::setLog("MEMCHECK");
100  MOFEM_LOG_TAG("MEMCHECK", "memcheck");
101 
103  auto set_log_attr = [&](auto c) {
105  };
106  set_log_attr("MEMCHECK");
107  MOFEM_LOG_C("MEMCHECK", Sev::inform, "### Input parameter: -my_file %s",
109 
110  // Create data structure for crack propagation
111  CrackPropagation cp(m_field, 3, 2);
112 
114  MOFEM_LOG("MEMCHECK", Sev::inform)
115  << "File version " << cp.fileVersion.strVersion();
116 
117  // Configure meshes
118  CHKERR cp.getOptions();
119  // Register MOFEM discrete data managers
120  {
121  DMType dm_name = "MOFEM";
122  CHKERR DMRegister_MoFEM(dm_name);
123  }
124 
125  auto add_bits = [&]() {
128  ->addToDatabaseBitRefLevelByType(MBTET, BitRefLevel().set(),
129  BitRefLevel().set());
131  };
132  CHKERR add_bits();
133 
134  std::vector<int> surface_ids;
135  surface_ids.push_back(cp.getInterface<CPMeshCut>()->getSkinOfTheBodyId());
136  std::vector<std::string> fe_surf_proj_list;
137  fe_surf_proj_list.push_back("SURFACE");
138 
139  // create bit levels, fields and finite elements structures in database
140  if (cp.doCutMesh) {
141 
142  if (string(mesh_file_name).compare(0, 8, "restart_") == 0) {
143 
144  // restart code from file
145  CHKERR m_field.build_field("LAMBDA_ARC_LENGTH");
146  CHKERR m_field.build_finite_elements("ARC_LENGTH");
147 
148  Range ents;
150  ->getAllEntitiesNotInDatabase(ents);
151  Range meshsets;
152  CHKERR moab.get_entities_by_type(0, MBENTITYSET, meshsets, false);
153  for (auto m : meshsets)
154  CHKERR moab.remove_entities(m, ents);
155  CHKERR moab.delete_entities(ents);
156 
157  auto first_number_string = [](std::string const &str) {
158  std::size_t const n = str.find_first_of("0123456789");
159  if (n != std::string::npos) {
160  std::size_t const m = str.find_first_not_of("0123456789", n);
161  return str.substr(n, m != std::string::npos ? m - n : m);
162  }
163  return std::string();
164  };
165  std::string str_number =
166  first_number_string(std::string(mesh_file_name));
167 
168  if (!str_number.empty())
169  cp.startStep = atoi(str_number.c_str()) + 1;
170 
171  string cutting_surface_name =
172  "cutting_surface_" +
173  boost::lexical_cast<std::string>(cp.startStep) + ".vtk";
174 
175  if (m_field.get_comm_rank() == 0)
176  CHKERR cp.getInterface<CPMeshCut>()->rebuildCrackSurface(
177  cp.crackAccelerationFactor, cutting_surface_name, VERBOSE,
179  else
180  CHKERR cp.getInterface<CPMeshCut>()->rebuildCrackSurface(
182 
183  CHKERR cp.getInterface<CPMeshCut>()->refineMesh(
184  nullptr, false, QUIET, CrackPropagation::debug);
185 
186  } else {
187 
188  string cutting_surface_name =
189  "cutting_surface_" +
190  boost::lexical_cast<std::string>(cp.startStep) + ".vtk";
191 
192  if (!cp.getInterface<CPMeshCut>()->getCutSurfMeshName().empty())
193  CHKERR cp.getInterface<CPMeshCut>()->setCutSurfaceFromFile();
194  CHKERR cp.getInterface<CPMeshCut>()->copySurface(cutting_surface_name);
195  Range vol;
196  CHKERR moab.get_entities_by_type(0, MBTET, vol, false);
197  CHKERR cp.getInterface<CPMeshCut>()->refineMesh(
198  &vol, true, QUIET, CrackPropagation::debug);
199  }
200 
201  CHKERR cp.getInterface<CPMeshCut>()->cutRefineAndSplit(
203 
204  } else {
205 
206  Range vol;
207  CHKERR moab.get_entities_by_type(0, MBTET, vol, false);
208  BitRefLevel bit0 = cp.mapBitLevel["mesh_cut"];
209  CHKERR m_field.getInterface<BitRefManager>()->setBitRefLevel(
210  vol, bit0.set(BITREFLEVEL_SIZE - 1), true, CrackPropagation::debug);
211  CHKERR cp.getInterface<CPMeshCut>()->refineAndSplit(
213  }
214 
215  CHKERR cp.createProblemDataStructures(surface_ids, QUIET,
217 
218  if (cp.propagateCrack == PETSC_TRUE) {
219 
220  // set inital coordinates
223  if (cp.addSingularity == PETSC_TRUE)
224  CHKERR cp.setSingularDofs("SPATIAL_POSITION");
225 
226  SmartPetscObj<DM> dm_elastic;
227  SmartPetscObj<DM> dm_eigen_elastic;
228  SmartPetscObj<DM> dm_material;
229  SmartPetscObj<DM> dm_crack_propagation;
230  SmartPetscObj<DM> dm_material_forces;
231  SmartPetscObj<DM> dm_surface_projection;
232  SmartPetscObj<DM> dm_crack_srf_area;
233  CHKERR cp.createDMs(dm_elastic, dm_eigen_elastic, dm_material,
234  dm_crack_propagation, dm_material_forces,
235  dm_surface_projection, dm_crack_srf_area, surface_ids,
236  fe_surf_proj_list);
239 
241  if (cp.addSingularity == PETSC_TRUE) {
242  CHKERR cp.setSingularDofs("SPATIAL_POSITION");
243  }
244  if (string(mesh_file_name).compare(0, 8, "restart_") == 0)
245  cp.getLoadScale() = cp.getArcCtx()->getFieldData();
246 
247  if (cp.solveEigenStressProblem) {
248  MOFEM_LOG("MEMCHECK", Sev::verbose) << "Solve Eigen ELASTIC problem";
249  CHKERR cp.getInterface<CPSolvers>()->solveElastic(
250  dm_eigen_elastic, cp.getEigenArcCtx()->x0, 1);
251  CHKERR cp.postProcessDM(dm_eigen_elastic, -2, "ELASTIC", true);
252  }
253 
254  MOFEM_LOG("MEMCHECK", Sev::verbose) << "Solve ELASTIC problem";
255  CHKERR cp.getInterface<CPSolvers>()->solveElastic(
256  dm_elastic, cp.getArcCtx()->x0, cp.getLoadScale());
257  CHKERR cp.postProcessDM(dm_elastic, -1, "ELASTIC", true);
258 
259  // set finite element instances and user data operators on instances
260  CHKERR cp.assembleElasticDM(VERBOSE, false);
261  CHKERR cp.assembleMaterialForcesDM(PETSC_NULL);
262  CHKERR cp.assembleSmootherForcesDM(PETSC_NULL, surface_ids, VERBOSE,
263  false);
264  CHKERR cp.assembleCouplingForcesDM(PETSC_NULL, VERBOSE, false);
265 
266  CHKERR cp.calculateElasticEnergy(dm_elastic);
267  CHKERR cp.getInterface<CPSolvers>()->calculateGc(
268  dm_material_forces, dm_surface_projection, dm_crack_srf_area,
269  surface_ids);
270 
271  if (cp.doCutMesh == PETSC_TRUE) {
272  CHKERR cp.getInterface<CPSolvers>()->solveCutMesh(
273  dm_crack_propagation, dm_elastic, dm_eigen_elastic, dm_material,
274  dm_material_forces, dm_surface_projection, dm_crack_srf_area,
275  surface_ids, CrackPropagation::debug);
276  } else {
277  CHKERR cp.getInterface<CPSolvers>()->solvePropagation(
278  dm_crack_propagation, dm_elastic, dm_material, dm_material_forces,
279  dm_surface_projection, dm_crack_srf_area, surface_ids);
280  }
281 
282  } else {
283 
284  // set inital coordinates
287  if (cp.addSingularity == PETSC_TRUE)
288  CHKERR cp.setSingularDofs("SPATIAL_POSITION");
289 
290  SmartPetscObj<DM> dm_elastic;
291  SmartPetscObj<DM> dm_eigen_elastic;
292  SmartPetscObj<DM> dm_material;
293  SmartPetscObj<DM> dm_crack_propagation;
294  SmartPetscObj<DM> dm_material_forces;
295  SmartPetscObj<DM> dm_surface_projection;
296  SmartPetscObj<DM> dm_crack_srf_area;
297  CHKERR cp.createDMs(dm_elastic, dm_eigen_elastic, dm_material,
298  dm_crack_propagation, dm_material_forces,
299  dm_surface_projection, dm_crack_srf_area, surface_ids,
300  fe_surf_proj_list);
301 
302  SmartPetscObj<DM> dm_bc;
303  if (m_field.getInterface<MeshsetsManager>()->checkMeshset(
304  "ANALITICAL_DISP"))
305  CHKERR cp.createBcDM(dm_bc, "BC_PROBLEM",
306  cp.mapBitLevel["spatial_domain"],
307  BitRefLevel().set());
308 
309  if (cp.solveEigenStressProblem) {
310  MOFEM_LOG("MEMCHECK", Sev::verbose) << "Solve Eigen ELASTIC problem";
311  CHKERR cp.getInterface<CPSolvers>()->solveElastic(
312  dm_eigen_elastic, cp.getEigenArcCtx()->x0, 1);
313  CHKERR cp.postProcessDM(dm_eigen_elastic, -2, "ELASTIC", true);
314  }
315 
316  // set finite element instances and user data operators on instances
317  MOFEM_LOG("MEMCHECK", Sev::verbose) << "Solve ELASTIC problem";
318  CHKERR cp.getInterface<CPSolvers>()->solveElastic(
319  dm_elastic, cp.getArcCtx()->x0, cp.getLoadScale());
320 
321  // set finite element instances and user data operators on instances
322  CHKERR cp.assembleElasticDM(VERBOSE, false);
323  CHKERR cp.assembleMaterialForcesDM(PETSC_NULL);
324  if (cp.doCutMesh)
325  CHKERR cp.assembleSmootherForcesDM(PETSC_NULL, surface_ids, VERBOSE,
326  false);
327 
328  CHKERR cp.getInterface<CPSolvers>()->calculateGc(
329  dm_material_forces, dm_surface_projection, dm_crack_srf_area,
330  surface_ids);
331  CHKERR cp.calculateElasticEnergy(dm_elastic);
332 
333  // post-processing
334  CHKERR cp.postProcessDM(dm_elastic, 0, "ELASTIC", true);
335  // set vector values from field data
336  CHKERR cp.savePositionsOnCrackFrontDM(dm_elastic, PETSC_NULL, 2, false);
337  CHKERR cp.writeCrackFont(cp.mapBitLevel["spatial_domain"], 0);
338 
339  // Run tests
341 
342  auto refined_ents_ptr = m_field.get_ref_ents();
343  v_ref_entity.reserve(refined_ents_ptr->size());
344  for (auto e : *refined_ents_ptr)
345  v_ref_entity.emplace_back(e);
346 
347  auto refined_finite_elements_ptr = m_field.get_ref_finite_elements();
348  v_ref_element.reserve(refined_finite_elements_ptr->size());
349  for (auto e : *refined_finite_elements_ptr)
350  v_ref_element.emplace_back(e);
351 
352  auto fields_ptr = m_field.get_fields();
353  v_field.reserve(fields_ptr->size());
354  for (auto e : *fields_ptr)
355  v_field.emplace_back(e);
356 
357  arc_dof = cp.arcLengthDof;
358  mwls_approx = cp.mwlsApprox;
359  v_elastic_ele_str.emplace_back(cp.elasticFe);
360  v_elastic_ele_str.emplace_back(cp.materialFe);
361  vec_fe.emplace_back(cp.feLhs);
362  vec_fe.emplace_back(cp.feRhs);
363  vec_fe.emplace_back(cp.feMaterialRhs);
364  vec_fe.emplace_back(cp.feMaterialLhs);
365  vec_fe.emplace_back(cp.feEnergy);
366  vec_fe.emplace_back(cp.feCouplingElasticLhs);
367  vec_fe.emplace_back(cp.feCouplingMaterialLhs);
368  vec_fe.emplace_back(cp.feSmootherRhs);
369  vec_fe.emplace_back(cp.feSmootherLhs);
370  vec_fe.emplace_back(cp.feGriffithForceRhs);
371  vec_fe.emplace_back(cp.feGriffithConstrainsDelta);
372  vec_fe.emplace_back(cp.feGriffithConstrainsRhs);
373  vec_fe.emplace_back(cp.feGriffithConstrainsLhs);
374  vec_fe.emplace_back(cp.feSpringLhsPtr);
375  vec_fe.emplace_back(cp.feSpringRhsPtr);
376  vec_fe.emplace_back(cp.feRhsSimpleContact);
377  vec_fe.emplace_back(cp.feLhsSimpleContact);
378  vec_fe.emplace_back(cp.feMaterialAnaliticalTraction);
379  }
380  }
381  CATCH_ERRORS;
382 
383  if (auto a = arc_dof.lock()) {
384  MOFEM_LOG("MEMCHECK", Sev::error)
385  << "cp.arcLengthDof.use_count() " << a.use_count();
386  SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA, "cyclic shared pointer");
387  }
388 
389  for (auto v : vec_fe)
390  if (auto a = v.lock()) {
391  MOFEM_LOG("MEMCHECK", Sev::error) << "fe " << a.use_count();
392  SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA, "cyclic shared pointer");
393  }
394 
395  for (auto v : v_elastic_ele_str)
396  if (auto a = v.lock()) {
397  MOFEM_LOG("MEMCHECK", Sev::error)
398  << "elastic structure " << a.use_count();
399  SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA, "cyclic shared pointer");
400  }
401 
402  if (auto a = mwls_approx.lock()) {
403  MOFEM_LOG("MEMCHECK", Sev::error)
404  << "cp.mwlsApprox.use_count() " << a.use_count();
405  SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA, "cyclic shared pointer");
406  }
407 
408  for (auto e : v_ref_entity) {
409  if (auto a = e.lock()) {
410  MOFEM_LOG("MEMCHECK", Sev::error) << "v_ref_entity " << a.use_count();
411  SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA, "cyclic shared pointer");
412  }
413  }
414 
415  for (auto e : v_ref_element) {
416  if (auto a = e.lock()) {
417  MOFEM_LOG("MEMCHECK", Sev::error) << "v_ref_element " << a.use_count();
418  SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA, "cyclic shared pointer");
419  }
420  }
421 
422  for (auto e : v_field) {
423  if (auto a = e.lock()) {
424  MOFEM_LOG("MEMCHECK", Sev::error) << "v_field " << a.use_count();
425  SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA, "cyclic shared pointer");
426  }
427  }
428 
430  return 0;
431 }
help
static char help[]
Definition: memcheck_leak.cpp:44
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Definition: UnknownInterface.hpp:93
FractureMechanics::CrackPropagation::feGriffithConstrainsLhs
boost::shared_ptr< GriffithForceElement::MyTriangleFEConstrains > feGriffithConstrainsLhs
Definition: CrackPropagation.hpp:1144
FractureMechanics::CrackPropagation::writeCrackFont
MoFEMErrorCode writeCrackFont(const BitRefLevel &bit, const int step)
Definition: CrackPropagation.cpp:8093
FractureMechanics::CrackPropagation::tetsingReleaseEnergyCalculation
MoFEMErrorCode tetsingReleaseEnergyCalculation()
This is run with ctest.
Definition: CrackPropagation.cpp:929
FractureMechanics::CrackPropagation::createBcDM
MoFEMErrorCode createBcDM(SmartPetscObj< DM > &dm, const std::string prb_name, const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set())
Create problem to calculate boundary conditions.
Definition: CrackPropagation.cpp:3625
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
FractureMechanics::CrackPropagation::feLhs
boost::shared_ptr< CrackFrontElement > feLhs
Integrate elastic FE.
Definition: CrackPropagation.hpp:1065
FractureMechanics::CrackPropagation::feMaterialAnaliticalTraction
boost::shared_ptr< NeumannForcesSurface::MyTriangleFE > feMaterialAnaliticalTraction
Surface elment to calculate tractions in material space.
Definition: CrackPropagation.hpp:1080
NOISY
@ NOISY
Definition: definitions.h:224
MoFEM::Version::strVersion
std::string strVersion()
Definition: UnknownInterface.hpp:24
FractureMechanics::CrackPropagation::mapBitLevel
std::map< std::string, BitRefLevel > mapBitLevel
Definition: CrackPropagation.hpp:180
MWLS.hpp
FractureMechanics::CrackPropagation::feGriffithConstrainsRhs
boost::shared_ptr< GriffithForceElement::MyTriangleFEConstrains > feGriffithConstrainsRhs
Definition: CrackPropagation.hpp:1142
Mortar.hpp
FractureMechanics::CrackPropagation::feMaterialLhs
boost::shared_ptr< CrackFrontElement > feMaterialLhs
Integrate material stresses, assemble matrix.
Definition: CrackPropagation.hpp:1070
FractureMechanics::CrackPropagation::setSingularDofs
MoFEMErrorCode setSingularDofs(const string field_name, const int verb=QUIET)
set singular dofs (on edges adjacent to crack front) from geometry
Definition: CrackPropagation.cpp:9334
FractureMechanics::CrackPropagation::solveEigenStressProblem
PetscBool solveEigenStressProblem
Solve eigen problem.
Definition: CrackPropagation.hpp:163
FractureMechanics::CrackPropagation::getArcCtx
boost::shared_ptr< ArcLengthCtx > & getArcCtx()
Definition: CrackPropagation.hpp:907
FractureMechanics::CrackPropagation::assembleCouplingForcesDM
MoFEMErrorCode assembleCouplingForcesDM(DM dm, const int verb=QUIET, const bool debug=false)
assemble coupling element instances
Definition: CrackPropagation.cpp:6178
MoFEM::CoreInterface::get_comm_rank
virtual int get_comm_rank() const =0
FractureMechanics::CrackPropagation::feGriffithForceRhs
boost::shared_ptr< GriffithForceElement::MyTriangleFE > feGriffithForceRhs
Definition: CrackPropagation.hpp:1137
MOFEM_LOG_ATTRIBUTES
#define MOFEM_LOG_ATTRIBUTES(channel, bit)
Add attributes to channel.
Definition: LogManager.hpp:296
MoFEM::MeshsetsManager::brodcastMeshsets
static bool brodcastMeshsets
Definition: MeshsetsManager.hpp:881
MoFEM.hpp
MoFEM::UnknownInterface::getFileVersion
static MoFEMErrorCode getFileVersion(moab::Interface &moab, Version &version)
Get database major version.
Definition: UnknownInterface.cpp:16
BasicFiniteElements.hpp
MoFEM::CoreTmp< 0 >::Finalize
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:112
FractureMechanics::CrackPropagation::getEigenArcCtx
boost::shared_ptr< ArcLengthCtx > & getEigenArcCtx()
Definition: CrackPropagation.hpp:908
FractureMechanics::CrackPropagation::setSpatialPositionFromCoords
MoFEMErrorCode setSpatialPositionFromCoords()
set spatial field from nodes
Definition: CrackPropagation.cpp:9330
MoFEM::LogManager::createSink
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
Definition: LogManager.cpp:298
FractureMechanics::CPMeshCut
Definition: CPMeshCut.hpp:24
FractureMechanics::CrackPropagation::feEnergy
boost::shared_ptr< CrackFrontElement > feEnergy
Integrate energy.
Definition: CrackPropagation.hpp:1071
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:2010
main
int main(int argc, char *argv[])
Definition: memcheck_leak.cpp:57
MOFEM_LOG_FUNCTION
#define MOFEM_LOG_FUNCTION()
Set scope.
Definition: LogManager.hpp:325
CPSolvers.hpp
Solvers for crack propagation.
CPMeshCut.hpp
c
const double c
speed of light (cm/ns)
Definition: initial_diffusion.cpp:39
FractureMechanics::CPMeshCut::getCutSurfMeshName
const std::string & getCutSurfMeshName() const
Definition: CPMeshCut.hpp:157
MoFEM::LogManager::BitLineID
@ BitLineID
Definition: LogManager.hpp:48
MoFEM::LogManager::BitScope
@ BitScope
Definition: LogManager.hpp:49
FractureMechanics::CrackPropagation::setMaterialPositionFromCoords
MoFEMErrorCode setMaterialPositionFromCoords()
set material field from nodes
Definition: CrackPropagation.cpp:9326
VERBOSE
@ VERBOSE
Definition: definitions.h:222
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
a
constexpr double a
Definition: approx_sphere.cpp:30
MoFEM::CoreInterface::build_finite_elements
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
FractureMechanics::CrackPropagation::arcLengthDof
boost::shared_ptr< DofEntity > arcLengthDof
Definition: CrackPropagation.hpp:902
MOFEM_LOG_C
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:311
Hooke.hpp
Implementation of linear elastic material.
FractureMechanics::CrackPropagation::assembleSmootherForcesDM
MoFEMErrorCode assembleSmootherForcesDM(DM dm, const std::vector< int > ids, const int verb=QUIET, const bool debug=false)
create smoothing element instance
Definition: CrackPropagation.cpp:5975
MoFEM::LogManager::getStrmWorld
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
Definition: LogManager.cpp:344
MoFEM::DMRegister_MoFEM
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition: DMMoFEM.cpp:43
FractureMechanics::CrackPropagation::doCutMesh
PetscBool doCutMesh
Definition: CrackPropagation.hpp:1327
FractureMechanics::CrackPropagation::feSpringLhsPtr
boost::shared_ptr< FaceElementForcesAndSourcesCore > feSpringLhsPtr
Definition: CrackPropagation.hpp:1149
FractureMechanics::CrackPropagation::fileVersion
Version fileVersion
Definition: CrackPropagation.hpp:86
FractureMechanics::CrackPropagation::feCouplingElasticLhs
boost::shared_ptr< CrackFrontElement > feCouplingElasticLhs
FE instance to assemble coupling terms.
Definition: CrackPropagation.hpp:1107
MOFEM_LOG_TAG
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:339
FractureMechanics::CrackPropagation::propagateCrack
PetscBool propagateCrack
If true crack propagation is calculated.
Definition: CrackPropagation.hpp:119
CrackFrontElement.hpp
FractureMechanics::CrackPropagation::assembleElasticDM
MoFEMErrorCode assembleElasticDM(const std::string mwls_stress_tag_name, const int verb=QUIET, const bool debug=false)
create elastic finite element instance for spatial assembly
Definition: CrackPropagation.cpp:3795
FractureMechanics::CrackPropagation::calculateElasticEnergy
MoFEMErrorCode calculateElasticEnergy(DM dm, const std::string msg="")
assemble elastic part of matrix, by running elastic finite element instance
Definition: CrackPropagation.cpp:7280
FractureMechanics::CrackPropagation::crackAccelerationFactor
double crackAccelerationFactor
Definition: CrackPropagation.hpp:1328
debug
static const bool debug
Definition: dm_create_subdm.cpp:12
FractureMechanics::CrackPropagation::postProcessDM
MoFEMErrorCode postProcessDM(DM dm, const int step, const std::string fe_name, const bool approx_internal_stress)
post-process results for elastic solution
Definition: CrackPropagation.cpp:9010
FractureMechanics::CPMeshCut::getSkinOfTheBodyId
int getSkinOfTheBodyId() const
Definition: CPMeshCut.hpp:167
FractureMechanics::CrackPropagation::feRhs
boost::shared_ptr< CrackFrontElement > feRhs
Integrate elastic FE.
Definition: CrackPropagation.hpp:1066
FractureMechanics::CrackPropagation::feSmootherLhs
boost::shared_ptr< Smoother::MyVolumeFE > feSmootherLhs
Integrate smoothing operators.
Definition: CrackPropagation.hpp:1115
mesh_file_name
char mesh_file_name[255]
Definition: mesh_smoothing.cpp:22
convert.n
n
Definition: convert.py:82
MoFEM::CoreInterface::get_fields
virtual const Field_multiIndex * get_fields() const =0
Get the fields object.
FractureMechanics::CrackPropagation::savePositionsOnCrackFrontDM
MoFEMErrorCode savePositionsOnCrackFrontDM(DM dm, Vec q, const int verb=QUIET, const bool debug=false)
Definition: CrackPropagation.cpp:8064
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
Range
FractureMechanics::CrackPropagation::feGriffithConstrainsDelta
boost::shared_ptr< GriffithForceElement::MyTriangleFEConstrainsDelta > feGriffithConstrainsDelta
Definition: CrackPropagation.hpp:1140
MoFEM::CoreTmp< 0 >::Initialize
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition: Core.cpp:72
FractureMechanics::CrackPropagation::feSpringRhsPtr
boost::shared_ptr< FaceElementForcesAndSourcesCore > feSpringRhsPtr
Definition: CrackPropagation.hpp:1150
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
FractureMechanics::CPSolvers
Definition: CPSolvers.hpp:28
CATCH_ERRORS
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:385
AnalyticalFun.hpp
MoFEM::Core
CoreTmp< 0 > Core
Definition: Core.hpp:1148
FractureMechanics::CrackPropagation::elasticFe
boost::shared_ptr< NonlinearElasticElement > elasticFe
Definition: CrackPropagation.hpp:1063
FractureMechanics::CrackPropagation::feMaterialRhs
boost::shared_ptr< CrackFrontElement > feMaterialRhs
Integrate material stresses, assemble vector.
Definition: CrackPropagation.hpp:1068
BITREFLEVEL_SIZE
#define BITREFLEVEL_SIZE
max number of refinements
Definition: definitions.h:232
FractureMechanics::CrackPropagation
Definition: CrackPropagation.hpp:77
FractureMechanics::CrackPropagation::getLoadScale
double & getLoadScale()
Definition: CrackPropagation.hpp:210
FractureMechanics::CrackPropagation::assembleMaterialForcesDM
MoFEMErrorCode assembleMaterialForcesDM(DM dm, const int verb=QUIET, const bool debug=false)
create material element instance
Definition: CrackPropagation.cpp:5531
MoFEM::CoreInterface::get_ref_ents
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
MoFEM::CoreInterface::get_ref_finite_elements
virtual const RefElement_multiIndex * get_ref_finite_elements() const =0
Get the ref finite elements object.
ComplexConstArea.hpp
MoFEM::PetscOptionsGetString
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
Definition: DeprecatedPetsc.hpp:172
MoFEM::MeshsetsManager
Interface for managing meshsets containing materials and boundary conditions.
Definition: MeshsetsManager.hpp:104
FractureMechanics::CrackPropagation::feRhsSimpleContact
boost::shared_ptr< SimpleContactProblem::SimpleContactElement > feRhsSimpleContact
Definition: CrackPropagation.hpp:1270
FractureMechanics::CrackPropagation::feCouplingMaterialLhs
boost::shared_ptr< CrackFrontElement > feCouplingMaterialLhs
FE instance to assemble coupling terms.
Definition: CrackPropagation.hpp:1109
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
MoFEM::BitRefManager
Managing BitRefLevels.
Definition: BitRefManager.hpp:21
CrackPropagation.hpp
Main class for crack propagation.
MoFEM::Types::BitRefLevel
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:40
MoFEM::CoreInterface::build_field
virtual MoFEMErrorCode build_field(const std::string field_name, int verb=DEFAULT_VERBOSITY)=0
build field by name
QUIET
@ QUIET
Definition: definitions.h:221
MoFEM::LogManager::setLog
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
Definition: LogManager.cpp:389
MoFEM::SmartPetscObj< DM >
NeoHookean.hpp
Implementation of Neo-Hookean elastic material.
FractureMechanics::CrackPropagation::feLhsSimpleContact
boost::shared_ptr< SimpleContactProblem::SimpleContactElement > feLhsSimpleContact
Definition: CrackPropagation.hpp:1272
FractureMechanics::CrackPropagation::createDMs
MoFEMErrorCode createDMs(SmartPetscObj< DM > &dm_elastic, SmartPetscObj< DM > &dm_eigen_elastic, SmartPetscObj< DM > &dm_material, SmartPetscObj< DM > &dm_crack_propagation, SmartPetscObj< DM > &dm_material_forces, SmartPetscObj< DM > &dm_surface_projection, SmartPetscObj< DM > &dm_crack_srf_area, std::vector< int > surface_ids, std::vector< std::string > fe_surf_proj_list)
Crate DMs for all problems and sub problems.
Definition: CrackPropagation.cpp:9571
MoFEM::MeshsetsManager::checkMeshset
bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const
check for CUBIT Id and CUBIT type
Definition: MeshsetsManager.cpp:360
GriffithForceElement.hpp
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
FractureMechanics::CrackPropagation::materialFe
boost::shared_ptr< NonlinearElasticElement > materialFe
Definition: CrackPropagation.hpp:1064
FractureMechanics::CrackPropagation::mwlsApprox
boost::shared_ptr< MWLSApprox > mwlsApprox
Definition: CrackPropagation.hpp:1077
FractureMechanics::CrackPropagation::getOptions
MoFEMErrorCode getOptions()
Get options form command line.
Definition: CrackPropagation.cpp:588
FractureMechanics::CrackPropagation::createProblemDataStructures
MoFEMErrorCode createProblemDataStructures(const std::vector< int > surface_ids, const int verb=QUIET, const bool debug=false)
Construct problem data structures.
Definition: CrackPropagation.cpp:9525
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
MOFEM_INVALID_DATA
@ MOFEM_INVALID_DATA
Definition: definitions.h:36
FractureMechanics
Definition: AnalyticalFun.hpp:15
FractureMechanics::CrackPropagation::addSingularity
PetscBool addSingularity
Definition: CrackPropagation.hpp:122
FractureMechanics::CrackPropagation::startStep
int startStep
Definition: CrackPropagation.hpp:168
MoFEM::PetscOptionsGetBool
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
Definition: DeprecatedPetsc.hpp:182
FractureMechanics::CrackPropagation::feSmootherRhs
boost::shared_ptr< Smoother::MyVolumeFE > feSmootherRhs
Integrate smoothing operators.
Definition: CrackPropagation.hpp:1113