|
| v0.14.0
|
Go to the documentation of this file.
25 using namespace MoFEM;
31 #define BOOST_UBLAS_NDEBUG 1
37 #include <VolumeLengthQuality.hpp>
43 static char help[] =
"Calculate crack release energy and crack propagation"
50 bool CrackPropagation::parallelReadAndBroadcast =
56 int main(
int argc,
char *argv[]) {
58 const char param_file[] =
"param_file.petsc";
64 PetscBool flg = PETSC_FALSE;
66 if (flg == PETSC_TRUE)
71 PetscBool flg = PETSC_FALSE;
74 if (flg == PETSC_TRUE)
75 CrackPropagation::parallelReadAndBroadcast =
true;
78 PetscBool flg = PETSC_FALSE;
83 const char *tan_list[] = {
"tangent_internal_stress",
"density_tangent",
86 PetscBool isTangentTest;
88 LASTTAN, &choice_test, &isTangentTest);
92 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
94 boost::make_shared<WrapMPIComm>(PETSC_COMM_WORLD,
false);
96 pcomm =
new ParallelComm(&moab, moab_comm_wrap->get_comm());
98 if (pcomm->size() == 1 || !CrackPropagation::parallelReadAndBroadcast) {
100 const char *option =
"";
104 if (pcomm->rank() == 0) {
109 ParallelComm *pcomm =
112 pcomm =
new ParallelComm(&moab_read, moab_comm_wrap->get_comm());
114 const char *option =
"";
117 CHKERR moab_read.get_entities_by_handle(0, ents,
false);
118 CHKERR moab_read.get_entities_by_type(0, MBENTITYSET, ents,
false);
136 auto core_log = logging::core::get();
141 MOFEM_LOG_C(
"CP", Sev::inform,
"### Input parameter: -my_file %s",
157 DMType dm_name =
"MOFEM";
161 auto add_bits_tets = [&]() {
164 ->addToDatabaseBitRefLevelByType(MBTET,
BitRefLevel().set(),
173 "mesh_after_cut_and_broadcast_" +
174 boost::lexical_cast<std::string>(m_field.
get_comm_rank()) +
".vtk";
175 CHKERR moab.write_file(fn.c_str(),
"VTK",
"");
179 auto first_number_string = [](std::string
const &str) {
180 std::size_t
const n = str.find_first_of(
"0123456789");
181 if (
n != std::string::npos) {
182 std::size_t
const m = str.find_first_not_of(
"0123456789",
n);
183 return str.substr(
n,
m != std::string::npos ?
m -
n :
m);
185 return std::string();
187 std::string str_number = first_number_string(std::string(
mesh_file_name));
189 if (!str_number.empty())
190 cp.
startStep = atoi(str_number.c_str()) + 1;
200 ->getAllEntitiesNotInDatabase(ents);
202 CHKERR m_field.
get_moab().get_entities_by_type(0, MBENTITYSET, meshsets,
204 for (
auto m : meshsets)
208 string cutting_surface_name =
210 boost::lexical_cast<std::string>(cp.
startStep) +
".vtk";
225 string cutting_surface_name =
227 boost::lexical_cast<std::string>(cp.
startStep) +
".vtk";
233 CHKERR moab.get_entities_by_type(0, MBTET, vol,
false);
244 CHKERR moab.get_entities_by_type(0, MBTET, vol,
false);
268 std::vector<int> surface_ids;
270 std::vector<std::string> fe_surf_proj_list;
271 fe_surf_proj_list.push_back(
"SURFACE");
278 MOFEM_LOG(
"CP", Sev::verbose) <<
"Testing tangent variant";
295 dm_crack_propagation, dm_material_forces,
296 dm_surface_projection, dm_crack_srf_area, surface_ids,
312 switch (choice_test) {
331 MOFEM_LOG(
"CP", Sev::verbose) <<
"Crack propagation variant is used";
347 dm_crack_propagation, dm_material_forces,
348 dm_surface_projection, dm_crack_srf_area, surface_ids,
360 MOFEM_LOG(
"CPSolverSync", Sev::noisy) <<
"Lambda factor " << load_factor;
363 MOFEM_LOG(
"CP", Sev::verbose) <<
"Solve Eigen ELASTIC problem";
368 MOFEM_LOG(
"CP", Sev::noisy) <<
"Solve ELASTIC problem";
374 dm_elastic, cp.
getArcCtx()->x0, load_factor);
386 dm_material_forces, dm_surface_projection, dm_crack_srf_area,
390 MOFEM_LOG(
"CP", Sev::verbose) <<
"Propagate crack and cut mesh";
392 dm_crack_propagation, dm_elastic, dm_eigen_elastic, dm_material,
393 dm_material_forces, dm_surface_projection, dm_crack_srf_area,
396 MOFEM_LOG(
"CP", Sev::verbose) <<
"Propagate crack (not cut mesh)";
398 dm_crack_propagation, dm_elastic, dm_material, dm_material_forces,
399 dm_surface_projection, dm_crack_srf_area, surface_ids);
404 MOFEM_LOG(
"CP", Sev::verbose) <<
"Do not propagate crack";
420 dm_crack_propagation, dm_material_forces,
421 dm_surface_projection, dm_crack_srf_area, surface_ids,
433 MOFEM_LOG(
"CP", Sev::verbose) <<
"Solve Eigen ELASTIC problem";
439 MOFEM_LOG(
"CP", Sev::noisy) <<
"Solve ELASTIC problem";
451 dm_material_forces, dm_surface_projection, dm_crack_srf_area,
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
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.
#define MYPCOMM_INDEX
default communicator number PCOMM
virtual MPI_Comm & get_comm() const =0
std::map< std::string, BitRefLevel > mapBitLevel
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 broadcast_entities(moab::Interface &moab, moab::Interface &moab_tmp, const int from_proc, Range &entities, const bool adjacencies, const bool tags)
MoFEMErrorCode assembleCouplingForcesDM(DM dm, const int verb=QUIET, const bool debug=false)
assemble coupling element instances
virtual int get_comm_rank() const =0
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.
Deprecated interface functions.
DeprecatedCoreInterface Interface
Solvers for crack propagation.
const std::string & getCutSurfMeshName() const
MoFEMErrorCode setMaterialPositionFromCoords()
set material field from nodes
#define CHKERR
Inline error check.
virtual moab::Interface & get_moab()=0
implementation of Data Operators for Forces and Sources
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
#define MOFEM_LOG_C(channel, severity, format,...)
Implementation of linear elastic material.
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
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.
int main(int argc, char *argv[])
MoFEMErrorCode clean_pcomms(moab::Interface &moab, boost::shared_ptr< WrapMPIComm > moab_comm_wrap)
#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
MoFEMErrorCode savePositionsOnCrackFrontDM(DM dm, Vec q, const int verb=QUIET, const bool debug=false)
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
#define MOFEM_LOG(channel, severity)
Log.
boost::shared_ptr< WrapMPIComm > moabCommWorld
#define CATCH_ERRORS
Catch errors.
#define BITREFLEVEL_SIZE
max number of refinements
MoFEMErrorCode testJacobians(const BitRefLevel bit, const BitRefLevel mask, tangent_tests test)
test LHS Jacobians
MoFEMErrorCode assembleMaterialForcesDM(DM dm, const int verb=QUIET, const bool debug=false)
create material element instance
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.
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
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.
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()
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 ...
PetscBool doElasticWithoutCrack
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)