|
| v0.14.0
|
Go to the documentation of this file.
25 using namespace MoFEM;
31 #define BOOST_UBLAS_NDEBUG 1
38 #include <VolumeLengthQuality.hpp>
44 static char help[] =
"Calculate crack release energy and crack propagation"
51 bool CrackPropagation::parallelReadAndBroadcast =
57 int main(
int argc,
char *argv[]) {
59 const char param_file[] =
"param_file.petsc";
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;
72 PetscBool flg = PETSC_FALSE;
74 if (flg == PETSC_TRUE)
96 auto core_log = logging::core::get();
103 auto set_log_attr = [&](
auto c) {
106 set_log_attr(
"MEMCHECK");
107 MOFEM_LOG_C(
"MEMCHECK", Sev::inform,
"### Input parameter: -my_file %s",
121 DMType dm_name =
"MOFEM";
125 auto add_bits = [&]() {
128 ->addToDatabaseBitRefLevelByType(MBTET,
BitRefLevel().set(),
134 std::vector<int> surface_ids;
136 std::vector<std::string> fe_surf_proj_list;
137 fe_surf_proj_list.push_back(
"SURFACE");
150 ->getAllEntitiesNotInDatabase(ents);
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);
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);
163 return std::string();
165 std::string str_number =
168 if (!str_number.empty())
169 cp.
startStep = atoi(str_number.c_str()) + 1;
171 string cutting_surface_name =
173 boost::lexical_cast<std::string>(cp.
startStep) +
".vtk";
188 string cutting_surface_name =
190 boost::lexical_cast<std::string>(cp.
startStep) +
".vtk";
196 CHKERR moab.get_entities_by_type(0, MBTET, vol,
false);
207 CHKERR moab.get_entities_by_type(0, MBTET, vol,
false);
234 dm_crack_propagation, dm_material_forces,
235 dm_surface_projection, dm_crack_srf_area, surface_ids,
248 MOFEM_LOG(
"MEMCHECK", Sev::verbose) <<
"Solve Eigen ELASTIC problem";
254 MOFEM_LOG(
"MEMCHECK", Sev::verbose) <<
"Solve ELASTIC problem";
268 dm_material_forces, dm_surface_projection, dm_crack_srf_area,
273 dm_crack_propagation, dm_elastic, dm_eigen_elastic, dm_material,
274 dm_material_forces, dm_surface_projection, dm_crack_srf_area,
278 dm_crack_propagation, dm_elastic, dm_material, dm_material_forces,
279 dm_surface_projection, dm_crack_srf_area, surface_ids);
298 dm_crack_propagation, dm_material_forces,
299 dm_surface_projection, dm_crack_srf_area, surface_ids,
310 MOFEM_LOG(
"MEMCHECK", Sev::verbose) <<
"Solve Eigen ELASTIC problem";
317 MOFEM_LOG(
"MEMCHECK", Sev::verbose) <<
"Solve ELASTIC problem";
329 dm_material_forces, dm_surface_projection, dm_crack_srf_area,
343 v_ref_entity.reserve(refined_ents_ptr->size());
344 for (
auto e : *refined_ents_ptr)
345 v_ref_entity.emplace_back(e);
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);
353 v_field.reserve(fields_ptr->size());
354 for (
auto e : *fields_ptr)
355 v_field.emplace_back(e);
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);
383 if (
auto a = arc_dof.lock()) {
385 <<
"cp.arcLengthDof.use_count() " <<
a.use_count();
389 for (
auto v : vec_fe)
390 if (
auto a =
v.lock()) {
391 MOFEM_LOG(
"MEMCHECK", Sev::error) <<
"fe " <<
a.use_count();
395 for (
auto v : v_elastic_ele_str)
396 if (
auto a =
v.lock()) {
398 <<
"elastic structure " <<
a.use_count();
402 if (
auto a = mwls_approx.lock()) {
404 <<
"cp.mwlsApprox.use_count() " <<
a.use_count();
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();
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();
422 for (
auto e : v_field) {
423 if (
auto a = e.lock()) {
424 MOFEM_LOG(
"MEMCHECK", Sev::error) <<
"v_field " <<
a.use_count();
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
boost::shared_ptr< GriffithForceElement::MyTriangleFEConstrains > feGriffithConstrainsLhs
MoFEMErrorCode writeCrackFont(const BitRefLevel &bit, const int step)
MoFEMErrorCode tetsingReleaseEnergyCalculation()
This is run with ctest.
MoFEMErrorCode createBcDM(SmartPetscObj< DM > &dm, const std::string prb_name, const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set())
Create problem to calculate boundary conditions.
boost::shared_ptr< CrackFrontElement > feLhs
Integrate elastic FE.
boost::shared_ptr< NeumannForcesSurface::MyTriangleFE > feMaterialAnaliticalTraction
Surface elment to calculate tractions in material space.
std::map< std::string, BitRefLevel > mapBitLevel
boost::shared_ptr< GriffithForceElement::MyTriangleFEConstrains > feGriffithConstrainsRhs
boost::shared_ptr< CrackFrontElement > feMaterialLhs
Integrate material stresses, assemble matrix.
MoFEMErrorCode setSingularDofs(const string field_name, const int verb=QUIET)
set singular dofs (on edges adjacent to crack front) from geometry
PetscBool solveEigenStressProblem
Solve eigen problem.
boost::shared_ptr< ArcLengthCtx > & getArcCtx()
MoFEMErrorCode assembleCouplingForcesDM(DM dm, const int verb=QUIET, const bool debug=false)
assemble coupling element instances
virtual int get_comm_rank() const =0
boost::shared_ptr< GriffithForceElement::MyTriangleFE > feGriffithForceRhs
#define MOFEM_LOG_ATTRIBUTES(channel, bit)
Add attributes to channel.
static bool brodcastMeshsets
static MoFEMErrorCode getFileVersion(moab::Interface &moab, Version &version)
Get database major version.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
boost::shared_ptr< ArcLengthCtx > & getEigenArcCtx()
MoFEMErrorCode setSpatialPositionFromCoords()
set spatial field from nodes
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
boost::shared_ptr< CrackFrontElement > feEnergy
Integrate energy.
Deprecated interface functions.
DeprecatedCoreInterface Interface
int main(int argc, char *argv[])
#define MOFEM_LOG_FUNCTION()
Set scope.
Solvers for crack propagation.
const double c
speed of light (cm/ns)
const std::string & getCutSurfMeshName() const
MoFEMErrorCode setMaterialPositionFromCoords()
set material field from nodes
#define CHKERR
Inline error check.
implementation of Data Operators for Forces and Sources
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
boost::shared_ptr< DofEntity > arcLengthDof
#define MOFEM_LOG_C(channel, severity, format,...)
Implementation of linear elastic material.
MoFEMErrorCode assembleSmootherForcesDM(DM dm, const std::vector< int > ids, const int verb=QUIET, const bool debug=false)
create smoothing element instance
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
boost::shared_ptr< FaceElementForcesAndSourcesCore > feSpringLhsPtr
boost::shared_ptr< CrackFrontElement > feCouplingElasticLhs
FE instance to assemble coupling terms.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
PetscBool propagateCrack
If true crack propagation is calculated.
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
MoFEMErrorCode calculateElasticEnergy(DM dm, const std::string msg="")
assemble elastic part of matrix, by running elastic finite element instance
double crackAccelerationFactor
MoFEMErrorCode postProcessDM(DM dm, const int step, const std::string fe_name, const bool approx_internal_stress)
post-process results for elastic solution
int getSkinOfTheBodyId() const
boost::shared_ptr< CrackFrontElement > feRhs
Integrate elastic FE.
boost::shared_ptr< Smoother::MyVolumeFE > feSmootherLhs
Integrate smoothing operators.
virtual const Field_multiIndex * get_fields() const =0
Get the fields object.
MoFEMErrorCode savePositionsOnCrackFrontDM(DM dm, Vec q, const int verb=QUIET, const bool debug=false)
const double v
phase velocity of light in medium (cm/ns)
boost::shared_ptr< GriffithForceElement::MyTriangleFEConstrainsDelta > feGriffithConstrainsDelta
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
boost::shared_ptr< FaceElementForcesAndSourcesCore > feSpringRhsPtr
#define MOFEM_LOG(channel, severity)
Log.
#define CATCH_ERRORS
Catch errors.
boost::shared_ptr< NonlinearElasticElement > elasticFe
boost::shared_ptr< CrackFrontElement > feMaterialRhs
Integrate material stresses, assemble vector.
#define BITREFLEVEL_SIZE
max number of refinements
MoFEMErrorCode assembleMaterialForcesDM(DM dm, const int verb=QUIET, const bool debug=false)
create material element instance
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
virtual const RefElement_multiIndex * get_ref_finite_elements() const =0
Get the ref finite elements object.
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
Interface for managing meshsets containing materials and boundary conditions.
boost::shared_ptr< SimpleContactProblem::SimpleContactElement > feRhsSimpleContact
boost::shared_ptr< CrackFrontElement > feCouplingMaterialLhs
FE instance to assemble coupling terms.
FTensor::Index< 'm', 3 > m
Main class for crack propagation.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
virtual MoFEMErrorCode build_field(const std::string field_name, int verb=DEFAULT_VERBOSITY)=0
build field by name
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
Implementation of Neo-Hookean elastic material.
boost::shared_ptr< SimpleContactProblem::SimpleContactElement > feLhsSimpleContact
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.
bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const
check for CUBIT Id and CUBIT type
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
boost::shared_ptr< NonlinearElasticElement > materialFe
boost::shared_ptr< MWLSApprox > mwlsApprox
MoFEMErrorCode getOptions()
Get options form command line.
MoFEMErrorCode createProblemDataStructures(const std::vector< int > surface_ids, const int verb=QUIET, const bool debug=false)
Construct problem data structures.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
boost::shared_ptr< Smoother::MyVolumeFE > feSmootherRhs
Integrate smoothing operators.