15#include <boost/math/constants/constants.hpp>
41 : mField(m_field), piolaStress(
"P"), eshelbyStress(
"S"), spatialDisp(
"w"),
42 materialDisp(
"W"), streachTensor(
"u"), rotAxis(
"omega"),
43 materialGradient(
"G"), tauField(
"TAU"), lambdaField(
"LAMBDA"),
44 bubbleField(
"BUBBLE"), elementVolumeName(
"EP"),
45 naturalBcElement(
"NATURAL_BC"), essentialBcElement(
"ESSENTIAL_BC") {
48 CHKERRABORT(PETSC_COMM_WORLD,
ierr);
55 CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"Eshelbian plasticity",
59 CHKERR PetscOptionsInt(
"-space_order",
"approximation oder for space",
"",
62 CHKERR PetscOptionsInt(
"-material_order",
"approximation oder for material",
66 CHKERR PetscOptionsScalar(
"-viscosity_alpha_u",
"viscosity",
"",
alphaU,
70 CHKERR PetscOptionsScalar(
"-viscosity_alpha_w",
"viscosity",
"",
alphaW,
74 CHKERR PetscOptionsScalar(
"-density_alpha_rho",
"density",
"",
alphaRho,
78 CHKERR PetscOptionsScalar(
"-preconditioner_eps",
"preconditioner_eps",
"",
81 ierr = PetscOptionsEnd();
93 CHKERR skin.find_skin(0, tets,
false, tets_skin_part);
97 CHKERR pcomm->filter_pstatus(tets_skin_part,
98 PSTATUS_SHARED | PSTATUS_MULTISHARED,
99 PSTATUS_NOT, -1, &tets_skin);
101 auto subtract_faces_where_displacements_are_applied =
102 [&](
const std::string disp_block_set_name) {
105 if (it->getName().compare(0, disp_block_set_name.length(),
106 disp_block_set_name) == 0) {
110 tets_skin = subtract(tets_skin, faces);
115 CHKERR subtract_faces_where_displacements_are_applied(
"SPATIAL_DISP_BC");
116 CHKERR subtract_faces_where_displacements_are_applied(
"SPATIAL_ROTATION_BC");
117 CHKERR subtract_faces_where_displacements_are_applied(
"SPATIAL_TRACTION_BC");
121 moab::Interface::UNION);
122 Range faces_not_on_the_skin = subtract(faces, tets_skin);
124 auto add_hdiv_field = [&](
const std::string
field_name,
const int order,
136 auto add_hdiv_rt_field = [&](
const std::string
field_name,
const int order,
147 auto add_l2_field = [
this, meshset](
const std::string
field_name,
157 auto add_h1_field = [
this, meshset](
const std::string
field_name,
170 auto add_bubble_field = [
this, meshset](
const std::string
field_name,
177 auto field_order_table =
178 const_cast<Field *
>(field_ptr)->getFieldOrderTable();
179 auto get_cgg_bubble_order_zero = [](
int p) {
return 0; };
180 auto get_cgg_bubble_order_tet = [](
int p) {
183 field_order_table[MBVERTEX] = get_cgg_bubble_order_zero;
184 field_order_table[MBEDGE] = get_cgg_bubble_order_zero;
185 field_order_table[MBTRI] = get_cgg_bubble_order_zero;
186 field_order_table[MBTET] = get_cgg_bubble_order_tet;
220 auto add_field_to_fe = [
this](
const std::string fe,
257 auto bc_elements_add_to_range = [&](
const std::string disp_block_set_name,
261 if (it->getName().compare(0, disp_block_set_name.length(),
262 disp_block_set_name) == 0) {
273 auto add_field_to_fe = [
this](
const std::string fe,
282 Range natural_bc_elements;
283 CHKERR bc_elements_add_to_range(
"SPATIAL_DISP_BC", natural_bc_elements);
284 CHKERR bc_elements_add_to_range(
"SPATIAL_ROTATION_BC", natural_bc_elements);
285 Range essentail_bc_elements;
286 CHKERR bc_elements_add_to_range(
"SPATIAL_TRACTION_BC", essentail_bc_elements);
324 auto remove_dofs_on_essential_spatial_stress_boundary =
325 [&](
const std::string prb_name) {
327 for (
int d : {0, 1, 2})
333 CHKERR remove_dofs_on_essential_spatial_stress_boundary(
"ESHELBY_PLASTICITY");
354 "ELASTIC_PROBLEM_STREACH_SCHUR");
370 "ELASTIC_PROBLEM_BUBBLE_SCHUR");
385 "ELASTIC_PROBLEM_OMEGA_SCHUR");
399 "ELASTIC_PROBLEM_SPATIAL_DISP_SCHUR");
412 PetscSection section;
417 CHKERR PetscSectionDestroy(§ion);
424 : blockName(name), faces(faces) {
425 vals.resize(3,
false);
426 flags.resize(3,
false);
427 for (
int ii = 0; ii != 3; ++ii) {
429 flags[ii] =
static_cast<int>(attr[ii + 3]);
434 : blockName(name), faces(faces) {
435 vals.resize(3,
false);
436 for (
int ii = 0; ii != 3; ++ii) {
444 : blockName(name), faces(faces) {
445 vals.resize(3,
false);
446 flags.resize(3,
false);
447 for (
int ii = 0; ii != 3; ++ii) {
449 flags[ii] =
static_cast<int>(attr[ii + 3]);
455 boost::shared_ptr<TractionFreeBc> &bc_ptr,
456 const std::string disp_block_set_name,
457 const std::string rot_block_set_name) {
461 Range tets_skin_part;
463 CHKERR skin.find_skin(0, tets,
false, tets_skin_part);
464 ParallelComm *pcomm =
467 CHKERR pcomm->filter_pstatus(tets_skin_part,
468 PSTATUS_SHARED | PSTATUS_MULTISHARED,
469 PSTATUS_NOT, -1, &tets_skin);
472 for (
int dd = 0; dd != 3; ++dd)
473 (*bc_ptr)[dd] = tets_skin;
476 if (it->getName().compare(0, disp_block_set_name.length(),
477 disp_block_set_name) == 0) {
478 std::vector<double> block_attributes;
479 CHKERR it->getAttributes(block_attributes);
480 if (block_attributes.size() != 6) {
482 "In block %s six attributes are required for given BC "
483 "blockset (3 values + "
485 it->getName().c_str(), block_attributes.size());
490 if (block_attributes[3] != 0)
491 (*bc_ptr)[0] = subtract((*bc_ptr)[0], faces);
492 if (block_attributes[4] != 0)
493 (*bc_ptr)[1] = subtract((*bc_ptr)[1], faces);
494 if (block_attributes[5] != 0)
495 (*bc_ptr)[2] = subtract((*bc_ptr)[2], faces);
497 if (it->getName().compare(0, rot_block_set_name.length(),
498 rot_block_set_name) == 0) {
502 (*bc_ptr)[0] = subtract((*bc_ptr)[0], faces);
503 (*bc_ptr)[1] = subtract((*bc_ptr)[1], faces);
504 (*bc_ptr)[2] = subtract((*bc_ptr)[2], faces);
533 return 2 * (p_data + 1);
555 boost::shared_ptr<BaseFunctionCtx> ctx_ptr) {
560 int nb_gauss_pts = pts.size2();
565 if (pts.size1() < 3) {
567 "Wrong dimension of pts, should be at least 3 rows with "
593 "Wrong base, should be USER_BASE");
599 const int order = data.dataOnEntities[MBTET][0].getOrder();
601 const int nb_gauss_pts = pts.size2();
605 shapeFun.resize(nb_gauss_pts, 4,
false);
607 &pts(2, 0), nb_gauss_pts);
609 double diff_shape_fun[12];
615 phi.resize(nb_gauss_pts, 9 * nb_base_functions,
false);
631 const int tag,
const bool do_rhs,
const bool do_lhs,
634 fe = boost::make_shared<EpElement<VolumeElementForcesAndSourcesCore>>(
mField);
636 fe->getUserPolynomialBase() =
674 fe->getOpPtrVector().push_back(
681 if (std::abs(
alphaRho) > std::numeric_limits<double>::epsilon()) {
687 fe->getOpPtrVector().push_back(
698 const int tag,
const bool add_elastic,
const bool add_material,
708 fe_rhs->getOpPtrVector().push_back(
710 fe_rhs->getOpPtrVector().push_back(
712 fe_rhs->getOpPtrVector().push_back(
714 fe_rhs->getOpPtrVector().push_back(
716 fe_rhs->getOpPtrVector().push_back(
718 fe_rhs->getOpPtrVector().push_back(
729 fe_lhs->getOpPtrVector().push_back(
742 fe_lhs->getOpPtrVector().push_back(
756 fe_lhs->getOpPtrVector().push_back(
760 dataAtPts->ooMatPtr = boost::make_shared<MatrixDouble>();
761 fe_lhs->getOpPtrVector().push_back(
763 if (
alphaW < std::numeric_limits<double>::epsilon() &&
764 alphaRho < std::numeric_limits<double>::epsilon()) {
765 dataAtPts->wwMatPtr = boost::make_shared<MatrixDouble>();
766 fe_lhs->getOpPtrVector().push_back(
771 fe_lhs->getOpPtrVector().push_back(
782 const bool add_elastic,
const bool add_material,
788 boost::make_shared<EpElement<FaceElementForcesAndSourcesCore>>(
mField);
790 boost::make_shared<EpElement<FaceElementForcesAndSourcesCore>>(
mField);
796 fe_rhs->getOpPtrVector().push_back(
798 fe_lhs->getOpPtrVector().push_back(
802 fe_rhs->getOpPtrVector().push_back(
804 fe_rhs->getOpPtrVector().push_back(
821 boost::shared_ptr<FEMethod> null;
822 boost::shared_ptr<EpElement<FeTractionBc>> spatial_traction_bc(
826 if (std::abs(
alphaRho) > std::numeric_limits<double>::epsilon()) {
834 spatial_traction_bc);
849 spatial_traction_bc);
862 boost::shared_ptr<TsCtx>
ts_ctx;
865 if (std::abs(
alphaRho) > std::numeric_limits<double>::epsilon()) {
866 CHKERR TSSetI2Function(ts,
f, PETSC_NULL, PETSC_NULL);
867 CHKERR TSSetI2Jacobian(ts,
m,
m, PETSC_NULL, PETSC_NULL);
869 CHKERR TSSetIFunction(ts,
f, PETSC_NULL, PETSC_NULL);
870 CHKERR TSSetIJacobian(ts,
m,
m, PETSC_NULL, PETSC_NULL);
878 for (
auto &fe : list)
880 fe_cast->addStreachSchurMatrix(S, aoS);
889 for (
auto &fe : list)
890 if (
auto fe_cast =
dynamic_cast<EpElementBase *
>(fe.getSharedPtr().get()))
891 fe_cast->addStreachSchurMatrix(S, aoS);
900 for (
auto &fe : list)
902 fe_cast->addBubbleSchurMatrix(S, aoS);
911 for (
auto &fe : list)
912 if (
auto fe_cast =
dynamic_cast<EpElementBase *
>(fe.getSharedPtr().get()))
913 fe_cast->addBubbleSchurMatrix(S, aoS);
922 for (
auto &fe : list)
924 fe_cast->addSpatialDispStressSchurMatrix(S, aoS);
933 for (
auto &fe : list)
934 if (
auto fe_cast =
dynamic_cast<EpElementBase *
>(fe.getSharedPtr().get()))
935 fe_cast->addSpatialDispStressSchurMatrix(S, aoS);
944 for (
auto &fe : list)
946 fe_cast->addOmegaSchurMatrix(S, aoS);
955 for (
auto &fe : list)
956 if (
auto fe_cast =
dynamic_cast<EpElementBase *
>(fe.getSharedPtr().get()))
957 fe_cast->addOmegaSchurMatrix(S, ao);
1002 &schur_spatial_disp_prb_ptr);
1003 if (
auto spatial_disp_data =
1016 "Problem does not have sub-problem data");
1020 "Problem does not have sub-problem data");
1024 "Problem does not have sub-problem data");
1028 "Problem does not have sub-problem data");
1038 boost::shared_ptr<SetPtsData> dataFieldEval;
1039 boost::shared_ptr<VolEle> volPostProcEnergy;
1040 boost::shared_ptr<double> gEnergy;
1046 volPostProcEnergy(
new VolEle(ep.
mField)), gEnergy(
new double) {
1048 dataFieldEval,
"EP");
1049 CHKERRABORT(PETSC_COMM_WORLD,
ierr);
1051 auto no_rule = [](int, int, int) {
return -1; };
1053 auto set_element_for_field_eval = [&]() {
1054 boost::shared_ptr<Ele> vol_ele(dataFieldEval->feMethodPtr.lock());
1055 vol_ele->getRuleHook = no_rule;
1056 vol_ele->getUserPolynomialBase() =
1060 vol_ele->getOpPtrVector().push_back(
1063 vol_ele->getOpPtrVector().push_back(
1066 vol_ele->getOpPtrVector().push_back(
1072 vol_ele->getOpPtrVector().push_back(
1077 vol_ele->getOpPtrVector().push_back(
1082 auto set_element_for_post_process = [&]() {
1083 volPostProcEnergy->getRuleHook =
VolRule();
1084 volPostProcEnergy->getUserPolynomialBase() =
1086 volPostProcEnergy->getOpPtrVector().push_back(
new OpL2Transform());
1088 volPostProcEnergy->getOpPtrVector().push_back(
1091 volPostProcEnergy->getOpPtrVector().push_back(
1094 volPostProcEnergy->getOpPtrVector().push_back(
1098 volPostProcEnergy->getOpPtrVector().push_back(
1101 volPostProcEnergy->getOpPtrVector().push_back(
1104 volPostProcEnergy->getOpPtrVector().push_back(
1107 volPostProcEnergy->getOpPtrVector().push_back(
1110 volPostProcEnergy->getOpPtrVector().push_back(
1114 set_element_for_field_eval();
1115 set_element_for_post_process();
1133 auto get_step = [](
auto ts_step) {
1134 std::ostringstream ss;
1135 ss << boost::str(boost::format(
"%d") %
static_cast<int>(ts_step));
1136 std::string s = ss.str();
1141 CHKERR PetscViewerBinaryOpen(
1142 PETSC_COMM_WORLD, (
"restart_" + get_step(ts_step) +
".dat").c_str(),
1143 FILE_MODE_WRITE, &viewer);
1144 CHKERR VecView(ts_u, viewer);
1145 CHKERR PetscViewerDestroy(&viewer);
1153 *volPostProcEnergy);
1156 MPI_Allreduce(gEnergy.get(), &body_energy, 1, MPI_DOUBLE, MPI_SUM,
1158 MOFEM_LOG_C(
"EP", Sev::inform,
"Step %d time %3.4g strain energy %3.6e",
1159 ts_step, ts_t, body_energy);
1161 auto post_proc_at_points = [&](std::array<double, 3> point,
1165 dataFieldEval->setEvalPoints(point.data(), point.size() / 3);
1167 struct OpPrint :
public VolOp {
1170 std::array<double, 3> point;
1179 DataForcesAndSourcesCore::EntData &data) {
1181 if (type == MBTET) {
1182 if (getGaussPts().size2()) {
1184 auto t_h = getFTensor2FromMat<3, 3>(eP.
dataAtPts->hAtPts);
1186 getFTensor2FromMat<3, 3>(eP.
dataAtPts->approxPAtPts);
1193 t_cauchy(
i,
j) = (1. / jac) * (t_approx_P(
i,
k) * t_h(
j,
k));
1196 std::ostringstream s;
1197 s << str <<
" elem " << getFEEntityHandle() <<
" ";
1201 auto print_tensor = [](
auto &
t) {
1202 std::ostringstream s;
1207 std::ostringstream print;
1213 << add() <<
"coords at gauss pts " << getCoordsAtGaussPts();
1215 << add() <<
"w " << eP.
dataAtPts->wAtPts;
1217 << add() <<
"Piola " << eP.
dataAtPts->approxPAtPts;
1219 << add() <<
"Cauchy " << print_tensor(t_cauchy);
1226 if (
auto fe_ptr = dataFieldEval->feMethodPtr.lock()) {
1228 fe_ptr->getOpPtrVector().push_back(
new OpPrint(eP, point, str));
1230 ->evalFEAtThePoint3D(
1231 point.data(), 1e-12, problemPtr->getName(),
"EP",
1234 fe_ptr->getOpPtrVector().pop_back();
1241 std::array<double, 3> pointA = {48., 60., 5.};
1242 CHKERR post_proc_at_points(pointA,
"Point A");
1245 std::array<double, 3> pointB = {48. / 2., 44. + (60. - 44.) / 2., 0.};
1246 CHKERR post_proc_at_points(pointB,
"Point B");
1249 std::array<double, 3> pointC = {48. / 2., (44. - 0.) / 2., 0.};
1250 CHKERR post_proc_at_points(pointC,
"Point C");
1257 boost::shared_ptr<FEMethod> monitor_ptr(
new Monitor(*
this));
1261 CHKERR TSAppendOptionsPrefix(ts,
"elastic_");
1262 CHKERR TSSetFromOptions(ts);
1272 CHKERR TSGetSNES(ts, &snes);
1274 PetscViewerAndFormat *vf;
1275 CHKERR PetscViewerAndFormatCreate(PETSC_VIEWER_STDOUT_WORLD,
1276 PETSC_VIEWER_DEFAULT, &vf);
1279 (
MoFEMErrorCode(*)(SNES, PetscInt, PetscReal,
void *))SNESMonitorFields,
1282 PetscSection section;
1285 CHKERR PetscSectionGetNumFields(section, &num_fields);
1286 for (
int ff = 0; ff != num_fields; ff++) {
1294 CHKERR VecGhostUpdateBegin(x, INSERT_VALUES, SCATTER_FORWARD);
1295 CHKERR VecGhostUpdateEnd(x, INSERT_VALUES, SCATTER_FORWARD);
1302 CHKERR SNESGetKSP(snes, &ksp);
1304 CHKERR KSPGetPC(ksp, &pc);
1305 PetscBool is_uu_field_split;
1306 PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_uu_field_split);
1307 if (is_uu_field_split) {
1315 map<std::string, IS> is_map;
1316 for (
int ff = 0; ff != num_fields; ff++) {
1332 CHKERR uu_data->getRowIs(&is_map[
"E_IS_SUU"]);
1335 CHKERR PCFieldSplitSetIS(pc, NULL, is_map[
"E_IS_SUU"]);
1337 CHKERR PCFieldSplitSetSchurPre(pc, PC_FIELDSPLIT_SCHUR_PRE_USER,
1343 CHKERR PCFieldSplitGetSubKSP(pc, &
n, &uu_ksp);
1345 CHKERR KSPGetPC(uu_ksp[1], &bubble_pc);
1346 PetscBool is_bubble_field_split;
1347 PetscObjectTypeCompare((PetscObject)bubble_pc, PCFIELDSPLIT,
1348 &is_bubble_field_split);
1349 if (is_bubble_field_split) {
1355 CHKERR bubble_data->getRowIs(&is_map[
"E_IS_BUBBLE"]);
1358 CHKERR uu_data->getRowMap(&uu_ao);
1362 CHKERR PCFieldSplitSetIS(bubble_pc, NULL, is_map[
"E_IS_BUBBLE"]);
1363 CHKERR PCFieldSplitSetSchurPre(
1364 bubble_pc, PC_FIELDSPLIT_SCHUR_PRE_USER,
schurAssembly->SBubble);
1366 CHKERR PCSetUp(bubble_pc);
1369 CHKERR PCFieldSplitGetSubKSP(bubble_pc, &bubble_n, &bubble_ksp);
1371 CHKERR KSPGetPC(bubble_ksp[1], &omega_pc);
1372 PetscBool is_omega_field_split;
1373 PetscObjectTypeCompare((PetscObject)omega_pc, PCFIELDSPLIT,
1374 &is_omega_field_split);
1376 if (is_omega_field_split) {
1383 CHKERR bubble_data->getRowMap(&bubble_ao);
1387 CHKERR omega_data->getRowIs(&is_map[
"E_IS_OMEGA"]);
1390 CHKERR PCFieldSplitSetIS(omega_pc, NULL, is_map[
"E_IS_OMEGA"]);
1391 CHKERR PCFieldSplitSetSchurPre(omega_pc,
1392 PC_FIELDSPLIT_SCHUR_PRE_USER,
1395 CHKERR PCSetUp(omega_pc);
1398 CHKERR PCFieldSplitGetSubKSP(omega_pc, &omega_n, &omega_ksp);
1400 CHKERR KSPGetPC(omega_ksp[1], &w_pc);
1401 PetscBool is_w_field_split;
1402 PetscObjectTypeCompare((PetscObject)w_pc, PCFIELDSPLIT,
1404 if (is_w_field_split) {
1412 CHKERR omega_data->getRowMap(&omega_ao);
1417 CHKERR w_data->getRowIs(&is_map[
"E_IS_W"]);
1420 CHKERR PCFieldSplitSetIS(w_pc, NULL, is_map[
"E_IS_W"]);
1421 CHKERR PCFieldSplitSetSchurPre(
1424 CHKERR AODestroy(&omega_ao);
1428 CHKERR PetscFree(omega_ksp);
1431 CHKERR PetscFree(bubble_ksp);
1432 CHKERR AODestroy(&uu_ao);
1435 CHKERR PetscFree(uu_ksp);
1437 for (
auto &
m : is_map)
1442 if (std::abs(
alphaRho) > std::numeric_limits<double>::epsilon()) {
1444 CHKERR VecDuplicate(x, &xx);
1445 CHKERR VecZeroEntries(xx);
1446 CHKERR TS2SetSolution(ts, x, xx);
1449 CHKERR TSSetSolution(ts, x);
1452 CHKERR TSSolve(ts, PETSC_NULL);
1455 int lin_solver_iterations;
1456 CHKERR SNESGetLinearSolveIterations(snes, &lin_solver_iterations);
1458 <<
"Number of linear solver iterations " << lin_solver_iterations;
1460 PetscBool test_cook_flg = PETSC_FALSE;
1464 if (lin_solver_iterations != 2)
1466 "Expected number of iterations is different than expected");
1472 const std::string file) {
1481 post_proc.getUserPolynomialBase() =
1490 post_proc.getOpPtrVector().push_back(
1501 post_proc.getOpPtrVector().push_back(
Implementation of tonsorial bubble base div(v) = 0.
#define NBVOLUMETET_CCG_BUBBLE(P)
Bubble function for CGG H div space.
Eshelbian plasticity interface.
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
#define MOFEM_LOG_C(channel, severity, format,...)
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
@ USER_BASE
user implemented approximation base
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ L2
field with C-1 continuity
@ HDIV
field with continuous normal traction
#define MYPCOMM_INDEX
default communicator number PCOMM
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
@ MOFEM_ATOM_TEST_INVALID
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
FTensor::Index< 'n', SPACE_DIM > n
FTensor::Index< 'm', SPACE_DIM > m
PetscErrorCode DMMoFEMSetIsPartitioned(DM dm, PetscBool is_partitioned)
PetscErrorCode DMMoFEMCreateSubDM(DM subdm, DM dm, const char problem_name[])
Must be called by user to set Sub DM MoFEM data structures.
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
PetscErrorCode DMMoFEMSetSquareProblem(DM dm, PetscBool square_problem)
set squared problem
PetscErrorCode DMMoFEMTSSetIFunction(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set TS implicit function evaluation function
PetscErrorCode DMMoFEMCreateMoFEM(DM dm, MoFEM::Interface *m_field_ptr, const char problem_name[], const MoFEM::BitRefLevel bit_level, const MoFEM::BitRefLevel bit_mask=MoFEM::BitRefLevel().set())
Must be called by user to set MoFEM data structures.
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
PetscErrorCode DMMoFEMGetProblemPtr(DM dm, const MoFEM::Problem **problem_ptr)
Get pointer to problem data structure.
PetscErrorCode DMMoFEMAddSubFieldRow(DM dm, const char field_name[])
PetscErrorCode DMCreateMatrix_MoFEM(DM dm, Mat *M)
PetscErrorCode DMMoFEMGetTsCtx(DM dm, MoFEM::TsCtx **ts_ctx)
get MoFEM::TsCtx data structure
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
PetscErrorCode DMMoFEMTSSetIJacobian(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS Jacobian evaluation function
PetscErrorCode DMMoFEMTSSetI2Jacobian(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS Jacobian evaluation function
PetscErrorCode DMMoFEMTSSetI2Function(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS implicit function evaluation function
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
virtual MoFEMErrorCode modify_finite_element_add_field_col(const std::string &fe_name, const std::string name_row)=0
set field col which finite element use
virtual MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle entities, const EntityType type, const std::string &name, const bool recursive=true)=0
add entities to finite element
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_filed)=0
set finite element field data
virtual MoFEMErrorCode modify_finite_element_add_field_row(const std::string &fe_name, const std::string name_row)=0
set field row which finite element use
virtual const Field * get_field_structure(const std::string &name, enum MoFEMTypes bh=MF_EXIST) const =0
get field structure
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
virtual MoFEMErrorCode set_field_order(const EntityHandle meshset, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)=0
Set order approximation of the entities in the field.
virtual MoFEMErrorCode add_ents_to_field_by_type(const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)=0
Add entities to field meshset.
MoFEMErrorCode writeFile(const std::string file_name, const char *file_type="MOAB", const char *file_options="PARALLEL=WRITE_PART")
wrote results in (MOAB) format, use "file_name.h5m"
#define MOFEM_LOG(channel, severity)
Log.
virtual MoFEMErrorCode loop_finite_elements(const std::string problem_name, const std::string &fe_name, FEMethod &method, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)=0
Make a loop over finite elements.
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
MoFEMErrorCode removeDofsOnEntities(const std::string problem_name, const std::string field_name, const Range ents, const int lo_coeff=0, const int hi_coeff=MAX_DOFS_ON_ENTITY, const int lo_order=0, const int hi_order=100, int verb=VERBOSE, const bool debug=false)
Remove DOFs from problem.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
DataForcesAndSourcesCore::EntData EntData
MoFEMErrorCode CGG_BubbleBase_MBTET(const int p, const double *N, const double *diffN, FTensor::Tensor2< FTensor::PackPtr< double *, 9 >, 3, 3 > &phi, const int gdim)
Calculate CGGT tonsorial bubble base.
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
implementation of Data Operators for Forces and Sources
auto getVectorAdaptor(T1 ptr, const size_t n)
Get Vector adaptor.
PetscErrorCode TsMonitorSet(TS ts, PetscInt step, PetscReal t, Vec u, void *ctx)
Set monitor for TS solver.
PetscErrorCode DMMoFEMSetDestroyProblem(DM dm, PetscBool destroy_problem)
DEPRECATED typedef EntitiesFieldData DataForcesAndSourcesCore
auto createSmartDM(MPI_Comm comm, const std::string dm_type_name)
Creates smart DM object.
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
static auto determinantTensor3by3(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
constexpr double t
plate stiffness
constexpr auto field_name
BcDisp(std::string name, std::vector< double > &attr, Range &faces)
BcRot(std::string name, std::vector< double > &attr, Range &faces)
MoFEMErrorCode getValueHdivForCGGBubble(MatrixDouble &pts)
MoFEMErrorCode getValue(MatrixDouble &pts, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
EntPolynomialBaseCtx * cTx
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, BaseFunctionUnknownInterface **iface) const
MoFEMErrorCode setUpTSElastic(TS ts, Mat m, Vec f)
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Getting interface of core database.
const std::string eshelbyStress
SmartPetscObj< DM > dmElasticSchurBubble
Sub problem of dmElastic Schur.
MoFEMErrorCode postProcessResults(const int tag, const std::string file)
MoFEMErrorCode addBoundaryFiniteElement(const EntityHandle meshset=0)
boost::shared_ptr< EpElement< VolumeElementForcesAndSourcesCore > > elasticFeLhs
SmartPetscObj< DM > dmElasticSchurStreach
Sub problem of dmElastic Schur.
const std::string piolaStress
MoFEMErrorCode addDMs(const BitRefLevel bit=BitRefLevel().set(0))
MoFEMErrorCode setGenericFaceElementOps(const bool add_elastic, const bool add_material, boost::shared_ptr< EpElement< FaceElementForcesAndSourcesCore > > &fe_rhs, boost::shared_ptr< EpElement< FaceElementForcesAndSourcesCore > > &fe_lhs)
boost::shared_ptr< EpElement< FaceElementForcesAndSourcesCore > > elasticBcRhs
MoFEMErrorCode setElasticElementOps(const int tag)
MoFEMErrorCode getTractionFreeBc(const EntityHandle meshset, boost::shared_ptr< TractionFreeBc > &bc_ptr, const std::string disp_block_set_name, const std::string rot_block_set_name)
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
const std::string essentialBcElement
const std::string bubbleField
MoFEMErrorCode setGenericVolumeElementOps(const int tag, const bool add_elastic, const bool add_material, boost::shared_ptr< EpElement< VolumeElementForcesAndSourcesCore > > &fe_rhs, boost::shared_ptr< EpElement< VolumeElementForcesAndSourcesCore > > &fe_lhs)
SmartPetscObj< DM > dmElasticSchurOmega
Sub problem of dmElastic Schur.
boost::shared_ptr< BcRotVec > bcSpatialRotationVecPtr
SmartPetscObj< DM > dmElasticSchurSpatialDisp
Sub problem of dmElastic Schur.
EshelbianCore(MoFEM::Interface &m_field)
SmartPetscObj< DM > dM
Coupled problem all fields.
MoFEMErrorCode solveElastic(TS ts, Vec x)
MoFEMErrorCode addVolumeFiniteElement(const EntityHandle meshset=0)
MoFEMErrorCode setBaseVolumeElementOps(const int tag, const bool do_rhs, const bool do_lhs, boost::shared_ptr< EpElement< VolumeElementForcesAndSourcesCore > > &fe)
SmartPetscObj< DM > dmElastic
Elastic problem.
boost::shared_ptr< EpFEMethod > schurAssembly
boost::shared_ptr< BcDispVec > bcSpatialDispVecPtr
boost::shared_ptr< PhysicalEquations > physicalEquations
boost::shared_ptr< EpElement< VolumeElementForcesAndSourcesCore > > elasticFeRhs
boost::shared_ptr< TractionFreeBc > bcSpatialFreeTraction
const std::string spatialDisp
boost::shared_ptr< TractionBcVec > bcSpatialTraction
MoFEMErrorCode addFields(const EntityHandle meshset=0)
const std::string naturalBcElement
const std::string streachTensor
MoFEMErrorCode getOptions()
const std::string rotAxis
boost::shared_ptr< EpElement< FaceElementForcesAndSourcesCore > > elasticBcLhs
MoFEMErrorCode setElasticElementToTs(DM dm)
const std::string elementVolumeName
const std::string materialGradient
MoFEM::Interface & mField
int operator()(int p_row, int p_col, int p_data) const
virtual MoFEMErrorCode evaluateRhs(EntData &data)=0
virtual MoFEMErrorCode evaluateLhs(EntData &data)=0
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
TractionBc(std::string name, std::vector< double > &attr, Range &faces)
Set integration rule on element.
int operator()(int p_row, int p_col, int p_data) const
Base class if inherited used to calculate base functions.
virtual moab::Interface & get_moab()=0
virtual bool check_finite_element(const std::string &name) const =0
Check if finite element is in database.
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
virtual MPI_Comm & get_comm() const =0
virtual MoFEMErrorCode add_field(const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add field.
virtual int get_comm_rank() const =0
Deprecated interface functions.
Class used to pass element data to calculate base functions on tet,triangle,edge.
const FieldApproximationBase bAse
structure for User Loop Methods on finite elements
Field evaluator interface.
boost::shared_ptr< SPD > getData(const double *ptr=nullptr, const int nb_eval_points=0, const double eps=1e-12, VERBOSITY_LEVELS verb=QUIET)
Get the Data object.
Provide data structure for (tensor) field approximation.
@ OPROW
operator doWork function is executed on FE rows
structure to get information form mofem into EntitiesFieldData
Section manager is used to create indexes and sections.
Calculate tenor field using tensor base, i.e. Hdiv/Hcurl.
Calculate divergence of tonsorial field using vectorial base.
Calculate tenor field using vectorial base, i.e. Hdiv/Hcurl.
Get values at integration pts for tensor filed rank 2, i.e. matrix field.
Calculate symmetric tensor field rates ant integratio pts.
Calculate symmetric tensor field values at integration pts.
Approximate field values for given petsc vector.
Get values at integration pts for tensor filed rank 1, i.e. vector field.
keeps basic data about problem
boost::shared_ptr< SubProblemData > subProblemData
Problem manager is used to build and partition problems.
intrusive_ptr for managing petsc objects
FEMethodsSequence loopsIJacobian
FEMethodsSequence & getLoopsMonitor()
Get the loops to do Monitor object.
BasicMethodsSequence preProcessIJacobian
BasicMethodsSequence postProcessIJacobian
base class for all interface classes
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
Volume finite element base.
std::vector< EntityHandle > mapGaussPts
moab::Interface & postProcMesh
MoFEMErrorCode generateReferenceElementMesh()
Generate reference mesh on single element.
VolEle::UserDataOperator VolOp
VolumeElementForcesAndSourcesCore VolEle