13#ifndef EXECUTABLE_DIMENSION
14 #define EXECUTABLE_DIMENSION 3
18 #define SCHUR_ASSEMBLE 0
26#ifdef ENABLE_PYTHON_BINDING
27 #include <boost/python.hpp>
28 #include <boost/python/def.hpp>
29 #include <boost/python/numpy.hpp>
30namespace bp = boost::python;
31namespace np = boost::python::numpy;
38 IntegrationType::GAUSS;
73 IT>::OpBaseTimesVector<1, SPACE_DIM, SPACE_DIM>;
143#ifdef ENABLE_PYTHON_BINDING
144 boost::shared_ptr<SDFPython> sdfPythonPtr;
188 enum bases { AINSWORTH, DEMKOWICZ, LASBASETOPT };
189 const char *list_bases[LASBASETOPT] = {
"ainsworth",
"demkowicz"};
190 PetscInt choice_base_value = AINSWORTH;
192 LASBASETOPT, &choice_base_value, PETSC_NULLPTR);
195 switch (choice_base_value) {
199 <<
"Set AINSWORTH_LEGENDRE_BASE for displacements";
204 <<
"Set DEMKOWICZ_JACOBI_BASE for displacements";
224 auto get_skin = [&]() {
229 CHKERR skin.find_skin(0, body_ents,
false, skin_ents);
233 auto filter_blocks = [&](
auto skin) {
234 bool is_contact_block =
false;
239 (boost::format(
"%s(.*)") %
"CONTACT").str()
248 <<
"Find contact block set: " <<
m->getName();
249 auto meshset =
m->getMeshset();
250 Range contact_meshset_range;
252 meshset,
SPACE_DIM - 1, contact_meshset_range,
true);
255 contact_meshset_range);
256 contact_range.merge(contact_meshset_range);
258 if (is_contact_block) {
260 <<
"Nb entities in contact surface: " << contact_range.size();
262 skin = intersect(skin, contact_range);
267 auto filter_true_skin = [&](
auto skin) {
269 ParallelComm *pcomm =
271 CHKERR pcomm->filter_pstatus(skin, PSTATUS_SHARED | PSTATUS_MULTISHARED,
272 PSTATUS_NOT, -1, &boundary_ents);
273 return boundary_ents;
276 auto boundary_ents = filter_true_skin(filter_blocks(get_skin()));
284 moab::Interface::UNION);
293 auto project_ho_geometry = [&]() {
298 PetscBool project_geometry = PETSC_TRUE;
300 &project_geometry, PETSC_NULLPTR);
301 if (project_geometry) {
302 CHKERR project_ho_geometry();
314 PetscBool use_mfront = PETSC_FALSE;
339 <<
"Selected material model: Hooke (small strain)";
342 <<
"Selected material model: Hencky (finite strain)";
347 MOFEM_LOG(
"CONTACT", Sev::inform) <<
"Using MFront for material model";
358 PetscBool use_scale = PETSC_FALSE;
372#ifdef ENABLE_PYTHON_BINDING
373 auto file_exists = [](std::string myfile) {
374 std::ifstream file(myfile.c_str());
380 char sdf_file_name[255] =
"sdf.py";
381 PetscBool has_sdf_file_option = PETSC_FALSE;
383 sdf_file_name, 255, &has_sdf_file_option);
384 if (!has_sdf_file_option) {
386 const auto contact_surface_script =
388 if (!contact_surface_script.empty()) {
389 std::strcpy(sdf_file_name, contact_surface_script.c_str());
391 <<
"Using Python script 'contact_surface' from JSON config: "
396 if (file_exists(sdf_file_name)) {
397 MOFEM_LOG(
"CONTACT", Sev::inform) << sdf_file_name <<
" file found";
398 sdfPythonPtr = boost::make_shared<SDFPython>();
399 CHKERR sdfPythonPtr->sdfInit(sdf_file_name);
400 sdfPythonWeakPtr = sdfPythonPtr;
402 MOFEM_LOG(
"CONTACT", Sev::warning) << sdf_file_name <<
" file NOT found";
409 "Use executable contact_2d with axisymmetric model");
413 "Axisymmetric model is only available with MFront (set "
416 MOFEM_LOG(
"CONTACT", Sev::inform) <<
"Using axisymmetric model";
421 MOFEM_LOG(
"CONTACT", Sev::inform) <<
"Using plane strain model";
457 for (
auto f : {
"U",
"SIGMA"}) {
458 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
459 "REMOVE_X",
f, 0, 0);
460 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
461 "REMOVE_Y",
f, 1, 1);
462 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
463 "REMOVE_Z",
f, 2, 2);
464 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
465 "REMOVE_ALL",
f, 0, 3);
468 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"FIX_X",
469 "SIGMA", 0, 0,
false,
true);
470 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"FIX_Y",
471 "SIGMA", 1, 1,
false,
true);
472 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"FIX_Z",
473 "SIGMA", 2, 2,
false,
true);
474 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"FIX_ALL",
475 "SIGMA", 0, 3,
false,
true);
476 CHKERR bc_mng->removeBlockDOFsOnEntities(
477 simple->getProblemName(),
"NO_CONTACT",
"SIGMA", 0, 3,
false,
true);
482 simple->getProblemName(),
"U");
493 auto time_scale = boost::make_shared<ScaledTimeScale>();
494 auto body_force_time_scale =
495 boost::make_shared<ScaledTimeScale>(
"body_force_hist.txt");
497 auto integration_rule_vol = [](int, int,
int approx_order) {
500 auto integration_rule_boundary = [](int, int,
int approx_order) {
504 auto add_domain_base_ops = [&](
auto &pip) {
511 auto add_domain_ops_lhs = [&](
auto &pip) {
521 auto fe_domain_lhs = pip_mng->getDomainLhsFE();
523 auto get_inertia_and_mass_damping =
525 return (
rho *
scale) * fe_domain_lhs->ts_aa +
528 pip.push_back(
new OpMass(
"U",
"U", get_inertia_and_mass_damping));
532 auto fe_domain_lhs = pip_mng->getDomainLhsFE();
534 auto get_inertia_and_mass_damping =
538 pip.push_back(
new OpMass(
"U",
"U", get_inertia_and_mass_damping));
543 CHKERR HookeOps::opFactoryDomainLhs<SPACE_DIM, AT, IT, DomainEleOp>(
544 mField, pip,
"U",
"MAT_ELASTIC", Sev::verbose,
scale);
546 CHKERR HenckyOps::opFactoryDomainLhs<SPACE_DIM, AT, IT, DomainEleOp>(
547 mField, pip,
"U",
"MAT_ELASTIC", Sev::verbose,
scale);
556 auto add_domain_ops_rhs = [&](
auto &pip) {
560 pip,
mField,
"U", {body_force_time_scale}, Sev::inform);
569 auto mat_acceleration = boost::make_shared<MatrixDouble>();
571 "U", mat_acceleration));
573 new OpInertiaForce(
"U", mat_acceleration, [](
double,
double,
double) {
580 auto mat_velocity = boost::make_shared<MatrixDouble>();
584 new OpInertiaForce(
"U", mat_velocity, [](
double,
double,
double) {
591 CHKERR HookeOps::opFactoryDomainRhs<SPACE_DIM, AT, IT, DomainEleOp>(
592 mField, pip,
"U",
"MAT_ELASTIC", Sev::inform, 1,
scale);
594 CHKERR HenckyOps::opFactoryDomainRhs<SPACE_DIM, AT, IT, DomainEleOp>(
595 mField, pip,
"U",
"MAT_ELASTIC", Sev::inform,
scale);
601 CHKERR ContactOps::opFactoryDomainRhs<SPACE_DIM, AT, IT, DomainEleOp>(
607 auto add_boundary_base_ops = [&](
auto &pip) {
617 auto add_boundary_ops_lhs = [&](
auto &pip) {
627 pip,
mField,
"U", Sev::inform);
632 auto fe_boundary_lhs = pip_mng->getBoundaryLhsFE();
637 [
this, fe_boundary_lhs](
double,
double,
double) {
646 ContactOps::opFactoryBoundaryLhs<SPACE_DIM, AT, GAUSS, BoundaryEleOp>(
650 mField, pip,
simple->getDomainFEName(),
"SIGMA",
"U",
"GEOMETRY",
656 auto add_boundary_ops_rhs = [&](
auto &pip) {
666 pip,
mField,
"U", {time_scale}, Sev::inform);
669 auto u_disp = boost::make_shared<MatrixDouble>();
670 auto dot_u_disp = boost::make_shared<MatrixDouble>();
675 new OpSpringRhs(
"U", u_disp, [
this](
double,
double,
double) {
679 new OpSpringRhs(
"U", dot_u_disp, [
this](
double,
double,
double) {
685 ContactOps::opFactoryBoundaryRhs<SPACE_DIM, AT, GAUSS, BoundaryEleOp>(
691 CHKERR add_domain_base_ops(pip_mng->getOpDomainLhsPipeline());
692 CHKERR add_domain_base_ops(pip_mng->getOpDomainRhsPipeline());
693 CHKERR add_domain_ops_lhs(pip_mng->getOpDomainLhsPipeline());
694 CHKERR add_domain_ops_rhs(pip_mng->getOpDomainRhsPipeline());
696 CHKERR add_boundary_base_ops(pip_mng->getOpBoundaryLhsPipeline());
697 CHKERR add_boundary_base_ops(pip_mng->getOpBoundaryRhsPipeline());
698 CHKERR add_boundary_ops_lhs(pip_mng->getOpBoundaryLhsPipeline());
699 CHKERR add_boundary_ops_rhs(pip_mng->getOpBoundaryRhsPipeline());
703 integration_rule_vol,
"U");
705 integration_rule_vol,
simple->getDomainFEName(),
"U",
order);
708 CHKERR pip_mng->setDomainRhsIntegrationRule(integration_rule_vol);
709 CHKERR pip_mng->setDomainLhsIntegrationRule(integration_rule_vol);
710 CHKERR pip_mng->setBoundaryRhsIntegrationRule(integration_rule_boundary);
711 CHKERR pip_mng->setBoundaryLhsIntegrationRule(integration_rule_boundary);
719 static boost::shared_ptr<SetUpSchur>
734 auto set_section_monitor = [&](
auto solver) {
737 CHKERR TSGetSNES(solver, &snes);
738 PetscViewerAndFormat *vf;
739 CHKERR PetscViewerAndFormatCreate(PETSC_VIEWER_STDOUT_WORLD,
740 PETSC_VIEWER_DEFAULT, &vf);
744 void *))SNESMonitorFields,
749 auto scatter_create = [&](
auto D,
auto coeff) {
751 CHKERR is_manager->isCreateProblemFieldAndRank(
simple->getProblemName(),
752 ROW,
"U", coeff, coeff, is);
754 CHKERR ISGetLocalSize(is, &loc_size);
758 CHKERR VecScatterCreate(
D, is,
v, PETSC_NULLPTR, &scatter);
763 auto set_time_monitor = [&](
auto dm,
auto solver) {
766 boost::shared_ptr<ForcesAndSourcesCore> null;
772 auto set_essential_bc = [&]() {
776 auto pre_proc_ptr = boost::make_shared<FEMethod>();
777 auto post_proc_rhs_ptr = boost::make_shared<FEMethod>();
778 auto post_proc_lhs_ptr = boost::make_shared<FEMethod>();
781 auto time_scale = boost::make_shared<TimeScale>();
783 auto get_bc_hook_rhs = [&]() {
785 {time_scale},
false);
788 pre_proc_ptr->preProcessHook = get_bc_hook_rhs();
790 auto get_post_proc_hook_rhs = [&]() {
792 mField, post_proc_rhs_ptr, 1.);
794 auto get_post_proc_hook_lhs = [&]() {
796 mField, post_proc_lhs_ptr, 1.);
798 post_proc_rhs_ptr->postProcessHook = get_post_proc_hook_rhs();
800 ts_ctx_ptr->getPreProcessIFunction().push_front(pre_proc_ptr);
801 ts_ctx_ptr->getPreProcessIJacobian().push_front(pre_proc_ptr);
802 ts_ctx_ptr->getPostProcessIFunction().push_back(post_proc_rhs_ptr);
803 post_proc_lhs_ptr->postProcessHook = get_post_proc_hook_lhs();
804 ts_ctx_ptr->getPostProcessIJacobian().push_back(post_proc_lhs_ptr);
809 auto set_schur_pc = [&](
auto solver) {
810 boost::shared_ptr<SetUpSchur> schur_ptr;
811 if (
AT == AssemblyType::BLOCK_SCHUR) {
819 auto dm =
simple->getDM();
831 CHKERR set_essential_bc();
836 auto solver = pip_mng->createTSIM();
837 CHKERR TSSetFromOptions(solver);
840 CHKERR TSSetIJacobian(solver,
B,
B, PETSC_NULLPTR, PETSC_NULLPTR);
841 auto schur_pc_ptr = set_schur_pc(solver);
844 CHKERR set_section_monitor(solver);
845 CHKERR set_time_monitor(dm, solver);
846 CHKERR TSSetSolution(solver,
D);
848 CHKERR TSSolve(solver, NULL);
850 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
851 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
854 auto solver = pip_mng->createTSIM2();
855 CHKERR TSSetFromOptions(solver);
858 CHKERR TSSetI2Jacobian(solver,
B,
B, PETSC_NULLPTR, PETSC_NULLPTR);
859 auto schur_pc_ptr = set_schur_pc(solver);
863 CHKERR set_section_monitor(solver);
864 CHKERR set_time_monitor(dm, solver);
865 CHKERR TS2SetSolution(solver,
D, DD);
867 CHKERR TSSolve(solver, NULL);
869 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
870 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
901 auto add_case = [&](
int number,
const std::string &
name,
double hertz_force,
902 double fem_force,
double tol_force,
903 double analytical_active_area,
double tol_area,
905 return testing->addTestCommandLine(
907 [
testing, hertz_force, fem_force, tol_force, analytical_active_area,
908 tol_area, fem_active_area =
t[
AREA_ACTIVE], pressure_check]() {
911 "Hertz contact force", fem_force, hertz_force, {0., tol_force});
913 "contact active area", fem_active_area, analytical_active_area,
921 CHKERR add_case(1,
"hertz plane stress", 3.927,
t[
TY], 1e-3, 1.0, 3e-2);
922 CHKERR add_case(2,
"hertz plane strain", 4.675,
t[
TY], 1e-3, 1.0, 3e-2,
923 [dm, &m_field =
mField]() {
926 "hertz plane strain pressure norm")(dm.get());
928 CHKERR add_case(3,
"hertz 3d", 3.968,
t[
TZ], 2e-3, M_PI / 4, 0.2);
929 CHKERR add_case(4,
"hertz axisymmetric flat", 15.873,
t[
TY], 5e-3, M_PI, 0.2);
930 CHKERR add_case(5,
"hertz axisymmetric sphere", 15.873,
t[
TY], 5e-3, M_PI,
931 3e-2, [dm, &m_field =
mField]() {
934 "hertz axisymmetric pressure norm")(dm.get());
936 CHKERR add_case(6,
"wavy 2d", 0.374,
t[
TY], 1e-3, 1.0, 3e-2);
937 CHKERR add_case(7,
"wavy 3d", 0.5289,
t[
TZ], 1e-3, 1.0, 3e-2);
949int main(
int argc,
char *argv[]) {
951#ifdef ENABLE_PYTHON_BINDING
957 const char param_file[] =
"param_file.petsc";
961 auto core_log = logging::core::get();
970 DMType dm_name =
"DMMOFEM";
972 DMType dm_name_mg =
"DMMOFEM_MG";
977 moab::Core mb_instance;
978 moab::Interface &moab = mb_instance;
1002#ifdef ENABLE_PYTHON_BINDING
1003 if (Py_FinalizeEx() < 0) {
1038 CHKERR TSGetSNES(solver, &snes);
1046 PetscBool is_pcfs = PETSC_FALSE;
1047 PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
1050 MOFEM_LOG(
"CONTACT", Sev::inform) <<
"Setup Schur pc";
1055 "It is expected that Schur matrix is not allocated. This is "
1056 "possible only if PC is set up twice");
1068 CHKERR TSGetDM(solver, &solver_dm);
1069 CHKERR DMSetMatType(solver_dm, MATSHELL);
1076 auto swap_assemble = [](TS ts, PetscReal
t, Vec u, Vec u_t, PetscReal
a,
1077 Mat
A, Mat
B,
void *ctx) {
1080 CHKERR TSSetIJacobian(solver,
A, P, swap_assemble, ts_ctx_ptr.get());
1082 auto swap_assemble = [](TS ts, PetscReal
t, Vec u, Vec u_t, Vec utt,
1083 PetscReal
a, PetscReal aa, Mat
A, Mat
B,
1087 CHKERR TSSetI2Jacobian(solver,
A, P, swap_assemble, ts_ctx_ptr.get());
1098 MOFEM_LOG(
"CONTACT", Sev::inform) <<
"No Schur PC";
1111 auto create_dm = [&](
const char *
name,
const char *
field_name,
auto dm_type) {
1113 auto create_dm_imp = [&]() {
1125 "Error in creating schurDM. It is possible that schurDM is "
1133 schurDM = create_dm(
"SCHUR",
"U",
"DMMOFEM_MG");
1134 blockDM = create_dm(
"BLOCK",
"SIGMA",
"DMMOFEM");
1136 if constexpr (
AT == AssemblyType::BLOCK_SCHUR) {
1138 auto get_nested_mat_data = [&](
auto schur_dm,
auto block_dm) {
1144 simple->getDomainFEName(),
1148 {
"U",
"U"}, {
"SIGMA",
"U"}, {
"U",
"SIGMA"}, {
"SIGMA",
"SIGMA"}
1156 {schur_dm, block_dm}, block_mat_data,
1158 {
"SIGMA"}, {
nullptr}, true
1168 "Only BLOCK_SCHUR is implemented");
1177 double eps_stab = 1e-4;
1183 using OpMassStab = B::OpMass<3, SPACE_DIM * SPACE_DIM>;
1193 pip->getOpBoundaryLhsPipeline().push_back(
1194 new OpMassStab(
"SIGMA",
"SIGMA",
1195 [eps_stab](
double,
double,
double) {
return eps_stab; }));
1196 pip->getOpBoundaryLhsPipeline().push_back(
1204 pip->getOpDomainLhsPipeline().push_back(
1210 auto pre_proc_schur_lhs_ptr = boost::make_shared<FEMethod>();
1211 auto post_proc_schur_lhs_ptr = boost::make_shared<FEMethod>();
1213 pre_proc_schur_lhs_ptr->preProcessHook = [
this]() {
1216 MOFEM_LOG(
"CONTACT", Sev::verbose) <<
"Lhs Assemble Begin";
1220 post_proc_schur_lhs_ptr->postProcessHook = [
this, ao_up,
1221 post_proc_schur_lhs_ptr]() {
1223 MOFEM_LOG(
"CONTACT", Sev::verbose) <<
"Lhs Assemble End";
1224 [[maybe_unused]]
auto print_mat_norm = [
this](
auto a, std::string prefix) {
1227 CHKERR MatNorm(
a, NORM_FROBENIUS, &nrm);
1228 MOFEM_LOG(
"CONTACT", Sev::noisy) << prefix <<
" norm = " << nrm;
1231 CHKERR MatAssemblyBegin(
S, MAT_FINAL_ASSEMBLY);
1232 CHKERR MatAssemblyEnd(
S, MAT_FINAL_ASSEMBLY);
1234 mField, post_proc_schur_lhs_ptr, 1,
S, ao_up)();
1236 CHKERR print_mat_norm(
S,
"S");
1238 MOFEM_LOG(
"CONTACT", Sev::verbose) <<
"Lhs Assemble Finish";
1243 ts_ctx_ptr->getPreProcessIJacobian().push_front(pre_proc_schur_lhs_ptr);
1244 ts_ctx_ptr->getPostProcessIJacobian().push_back(post_proc_schur_lhs_ptr);
1252 CHKERR PCFieldSplitSetIS(pc, NULL, block_is);
1253 CHKERR PCFieldSplitSetSchurPre(pc, PC_FIELDSPLIT_SCHUR_PRE_USER,
S);
1260 CHKERR PCFieldSplitSchurGetSubKSP(pc, PETSC_NULLPTR, &subksp);
1261 auto get_pc = [](
auto ksp) {
1268 auto set_pc_p_mg = [](
auto dm,
auto pc,
auto S) {
1271 PetscBool same = PETSC_FALSE;
1272 PetscObjectTypeCompare((PetscObject)pc, PCMG, &same);
1276 CHKERR PCSetFromOptions(pc);
1281 auto set_pc_ksp = [&](
auto dm,
auto pc,
auto S) {
1283 PetscBool same = PETSC_FALSE;
1284 PetscObjectTypeCompare((PetscObject)pc, PCKSP, &same);
1286 CHKERR PCSetFromOptions(pc);
1288 CHKERR PCKSPGetKSP(pc, &inner_ksp);
1289 CHKERR KSPSetFromOptions(inner_ksp);
1291 CHKERR KSPGetPC(inner_ksp, &inner_pc);
1292 CHKERR PCSetFromOptions(inner_pc);
1293 CHKERR set_pc_p_mg(dm, inner_pc,
S);
1301 CHKERR PetscFree(subksp);
1305boost::shared_ptr<SetUpSchur>
1307 return boost::shared_ptr<SetUpSchur>(
new SetUpSchurImpl(m_field));
Implementation of Hookes operator Hookes for linear elastic problems in MoFEM.
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
void simple(double P1[], double P2[], double P3[], double c[], const int N)
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
ElementsAndOps< SPACE_DIM >::BoundaryEle BoundaryEle
#define CATCH_ERRORS
Catch errors.
FieldApproximationBase
approximation base
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
FieldSpace
approximation spaces
@ HCURL
field with continuous tangents
@ 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 CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesVector< 1, SPACE_DIM, SPACE_DIM > OpInertiaForce
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 DMMoFEMAddSubFieldRow(DM dm, const char field_name[])
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode, RowColData rc=RowColData::COL)
set local (or ghosted) vector values on mesh for partition only
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
MoFEMErrorCode DMRegister_MGViaApproxOrders(const char sname[])
Register DM for Multi-Grid via approximation orders.
auto createDMVector(DM dm, RowColData rc=RowColData::COL)
Get smart vector from DM.
PetscErrorCode DMMoFEMAddSubFieldCol(DM dm, const char field_name[])
auto createDMMatrix(DM dm)
Get smart matrix from DM.
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
virtual MoFEMErrorCode loop_dofs(const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)=0
Make a loop over dofs.
FTensor::Index< 'i', SPACE_DIM > i
const double v
phase velocity of light in medium (cm/ns)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
PetscErrorCode DMMoFEMTSSetMonitor(DM dm, TS ts, 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 Monitor To TS solver.
PetscErrorCode TsSetIJacobian(TS ts, PetscReal t, Vec u, Vec u_t, PetscReal a, Mat A, Mat B, void *ctx)
Set function evaluating jacobian in TS solver.
auto getDMTsCtx(DM dm)
Get TS context data structure used by DM.
OpSchurAssembleBase * createOpSchurAssembleEnd(std::vector< std::string > fields_name, std::vector< boost::shared_ptr< Range > > field_ents, SmartPetscObj< AO > ao, SmartPetscObj< Mat > schur, bool sym_schur, bool symm_op)
Construct a new Op Schur Assemble End object.
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
MoFEMErrorCode setSchurA00MatSolvePC(SmartPetscObj< PC > pc)
Set PC for A00 block.
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
PetscErrorCode PetscOptionsGetScalar(PetscOptions *, const char pre[], const char name[], PetscScalar *dval, PetscBool *set)
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
boost::shared_ptr< PCMGSetUpViaApproxOrdersCtx > createPCMGSetUpViaApproxOrdersCtx(DM dm, Mat A, bool use_shell_mat)
createPCMGSetUpViaApproxOrdersCtx
auto getDMSubData(DM dm)
Get sub problem data structure.
boost::shared_ptr< MFrontInterface > createMFrontInterface(MoFEM::Interface &m_field, ModelHypothesis mh, AssemblyType at)
create mfront interface
PetscErrorCode TsSetI2Jacobian(TS ts, PetscReal t, Vec u, Vec u_t, Vec u_tt, PetscReal a, PetscReal aa, Mat A, Mat B, void *ctx)
Calculation Jacobian for second order PDE in time.
MoFEMErrorCode PCMGSetUpViaApproxOrders(PC pc, boost::shared_ptr< PCMGSetUpViaApproxOrdersCtx > ctx, int verb)
Function build MG structure.
@ AXISYMMETRICAL
Axisymmetrical model hypothesis.
@ PLANESTRAIN
Plane strain model hypothesis.
@ TRIDIMENSIONAL
3D model hypothesis.
boost::shared_ptr< BlockStructure > createBlockMatStructure(DM dm, SchurFEOpsFEandFields schur_fe_op_vec)
Create block matrix structure.
boost::shared_ptr< NestSchurData > createSchurNestedMatrixStruture(std::pair< SmartPetscObj< DM >, SmartPetscObj< DM > > dms, boost::shared_ptr< BlockStructure > block_mat_data_ptr, std::vector< std::string > fields_names, std::vector< boost::shared_ptr< Range > > field_ents, bool add_preconditioner_block)
Create structure of nested matrix [A11 A10; A01 A00].
auto createAOMappingIS(IS isapp, IS ispetsc)
Creates an application mapping using two index sets.
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
MoFEMErrorCode DMMoFEMSetNestSchurData(DM dm, boost::shared_ptr< NestSchurData >)
auto createDMNestSchurMat(DM dm)
auto createDM(MPI_Comm comm, const std::string dm_type_name)
Creates smart DM object.
OpSchurAssembleBase * createOpSchurAssembleBegin()
auto createDMBlockMat(DM dm)
PetscBool is_quasi_static
ElementsAndOps< SPACE_DIM >::SideEle SideEle
constexpr FieldSpace CONTACT_SPACE
constexpr double t
plate stiffness
constexpr auto field_name
static constexpr int approx_order
constexpr int SPACE_DIM
[Define dimension]
constexpr AssemblyType A
[Define dimension]
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, SPACE_DIM > OpMass
[Only used with Hooke equation (linear material model)]
FTensor::Index< 'm', 3 > m
Add operators pushing bases from local to physical configuration.
Boundary condition manager for finite element problem setup.
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
virtual int get_comm_rank() const =0
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Deprecated interface functions.
Definition of the displacement bc data structure.
Data on single entity (This is passed as argument to DataOperator::doWork)
Class (Function) to enforce essential constrains on the left hand side diagonal.
Class (Function) to enforce essential constrains on the right hand side diagonal.
Class (Function) to enforce essential constrains.
Section manager is used to create indexes and sections.
std::string getPythonScriptByKey(const std::string &key) const
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
Interface for managing meshsets containing materials and boundary conditions.
Approximate field values for given petsc vector.
Specialization for MatrixDouble vector field values calculation.
Template struct for dimension-specific finite element types.
PipelineManager interface.
Projection of edge entities with one mid-node on hierarchical basis.
Simple interface for fast problem set-up.
MoFEMErrorCode getOptions()
get options
MoFEMErrorCode getDM(DM *dm)
Get DM.
intrusive_ptr for managing petsc objects
std::function< MoFEMErrorCode()> TestHook
Force scale operator for reading two columns.
double getScale(const double time)
Get scaling at a given time.
TimeScale(std::string file_name="", bool error_if_file_not_given=false, ScalingFun def_scaling_fun=[](double time) { return time;})
TimeScale constructor.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
MoFEMErrorCode createSubDM()
MoFEMErrorCode setDiagonalPC(PC pc)
SetUpSchurImpl(MoFEM::Interface &m_field)
SmartPetscObj< DM > schurDM
MoFEMErrorCode setUp(SmartPetscObj< KSP >)
SmartPetscObj< DM > blockDM
virtual ~SetUpSchurImpl()
MoFEMErrorCode setPC(PC pc)
MoFEMErrorCode setOperator()
MoFEM::Interface & mField
[Push operators to pipeline]
static boost::shared_ptr< SetUpSchur > createSetUpSchur(MoFEM::Interface &m_field)
virtual MoFEMErrorCode setUp(SmartPetscObj< TS > solver)=0
static boost::shared_ptr< SetUpSchur > createSetUpSchur(MoFEM::Interface &m_field)
constexpr AssemblyType AT