13#ifndef EXECUTABLE_DIMENSION
14 #define EXECUTABLE_DIMENSION 3
18 #define SCHUR_ASSEMBLE 0
31 IntegrationType::GAUSS;
66 IT>::OpBaseTimesVector<1, SPACE_DIM, SPACE_DIM>;
136#ifdef ENABLE_PYTHON_BINDING
137 boost::shared_ptr<SDFPython> sdfPythonPtr;
181 enum bases { AINSWORTH, DEMKOWICZ, LASBASETOPT };
182 const char *list_bases[LASBASETOPT] = {
"ainsworth",
"demkowicz"};
183 PetscInt choice_base_value = AINSWORTH;
185 LASBASETOPT, &choice_base_value, PETSC_NULLPTR);
188 switch (choice_base_value) {
192 <<
"Set AINSWORTH_LEGENDRE_BASE for displacements";
197 <<
"Set DEMKOWICZ_JACOBI_BASE for displacements";
217 auto get_skin = [&]() {
222 CHKERR skin.find_skin(0, body_ents,
false, skin_ents);
226 auto filter_blocks = [&](
auto skin) {
227 bool is_contact_block =
false;
232 (boost::format(
"%s(.*)") %
"CONTACT").str()
241 <<
"Find contact block set: " <<
m->getName();
242 auto meshset =
m->getMeshset();
243 Range contact_meshset_range;
245 meshset,
SPACE_DIM - 1, contact_meshset_range,
true);
248 contact_meshset_range);
249 contact_range.merge(contact_meshset_range);
251 if (is_contact_block) {
253 <<
"Nb entities in contact surface: " << contact_range.size();
255 skin = intersect(
skin, contact_range);
260 auto filter_true_skin = [&](
auto skin) {
262 ParallelComm *pcomm =
264 CHKERR pcomm->filter_pstatus(
skin, PSTATUS_SHARED | PSTATUS_MULTISHARED,
265 PSTATUS_NOT, -1, &boundary_ents);
266 return boundary_ents;
269 auto boundary_ents = filter_true_skin(filter_blocks(get_skin()));
277 moab::Interface::UNION);
286 auto project_ho_geometry = [&]() {
291 PetscBool project_geometry = PETSC_TRUE;
293 &project_geometry, PETSC_NULLPTR);
294 if (project_geometry) {
295 CHKERR project_ho_geometry();
307 PetscBool use_mfront = PETSC_FALSE;
332 <<
"Selected material model: Hooke (small strain)";
335 <<
"Selected material model: Hencky (finite strain)";
340 MOFEM_LOG(
"CONTACT", Sev::inform) <<
"Using MFront for material model";
351 PetscBool use_scale = PETSC_FALSE;
365#ifdef ENABLE_PYTHON_BINDING
366 auto file_exists = [](std::string myfile) {
367 std::ifstream file(myfile.c_str());
373 char sdf_file_name[255] =
"sdf.py";
374 PetscBool has_sdf_file_option = PETSC_FALSE;
376 sdf_file_name, 255, &has_sdf_file_option);
377 if (!has_sdf_file_option) {
379 const auto contact_surface_script =
381 if (!contact_surface_script.empty()) {
382 std::strcpy(sdf_file_name, contact_surface_script.c_str());
384 <<
"Using Python script 'contact_surface' from JSON config: "
389 if (file_exists(sdf_file_name)) {
390 MOFEM_LOG(
"CONTACT", Sev::inform) << sdf_file_name <<
" file found";
391 sdfPythonPtr = boost::make_shared<SDFPython>();
392 CHKERR sdfPythonPtr->sdfInit(sdf_file_name);
393 CHKERR sdfPythonPtr->requireDerivatives();
394 sdfPythonWeakPtr = sdfPythonPtr;
396 MOFEM_LOG(
"CONTACT", Sev::warning) << sdf_file_name <<
" file NOT found";
403 "Use executable contact_2d with axisymmetric model");
407 "Axisymmetric model is only available with MFront (set "
410 MOFEM_LOG(
"CONTACT", Sev::inform) <<
"Using axisymmetric model";
415 MOFEM_LOG(
"CONTACT", Sev::inform) <<
"Using plane strain model";
451 for (
auto f : {
"U",
"SIGMA"}) {
452 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
453 "REMOVE_X",
f, 0, 0);
454 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
455 "REMOVE_Y",
f, 1, 1);
456 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
457 "REMOVE_Z",
f, 2, 2);
458 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
459 "REMOVE_ALL",
f, 0, 3);
462 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"FIX_X",
463 "SIGMA", 0, 0,
false,
true);
464 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"FIX_Y",
465 "SIGMA", 1, 1,
false,
true);
466 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"FIX_Z",
467 "SIGMA", 2, 2,
false,
true);
468 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"FIX_ALL",
469 "SIGMA", 0, 3,
false,
true);
470 CHKERR bc_mng->removeBlockDOFsOnEntities(
471 simple->getProblemName(),
"NO_CONTACT",
"SIGMA", 0, 3,
false,
true);
476 simple->getProblemName(),
"U");
487 auto time_scale = boost::make_shared<ScaledTimeScale>();
488 auto body_force_time_scale =
489 boost::make_shared<ScaledTimeScale>(
"body_force_hist.txt");
491 auto integration_rule_vol = [](int, int,
int approx_order) {
494 auto integration_rule_boundary = [](int, int,
int approx_order) {
498 auto add_domain_base_ops = [&](
auto &pip) {
505 auto add_domain_ops_lhs = [&](
auto &pip) {
515 auto fe_domain_lhs = pip_mng->getDomainLhsFE();
517 auto get_inertia_and_mass_damping =
519 return (
rho *
scale) * fe_domain_lhs->ts_aa +
522 pip.push_back(
new OpMass(
"U",
"U", get_inertia_and_mass_damping));
526 auto fe_domain_lhs = pip_mng->getDomainLhsFE();
528 auto get_inertia_and_mass_damping =
532 pip.push_back(
new OpMass(
"U",
"U", get_inertia_and_mass_damping));
537 CHKERR HookeOps::opFactoryDomainLhs<SPACE_DIM, AT, IT, DomainEleOp>(
538 mField, pip,
"U",
"MAT_ELASTIC", Sev::verbose,
scale);
540 CHKERR HenckyOps::opFactoryDomainLhs<SPACE_DIM, AT, IT, DomainEleOp>(
541 mField, pip,
"U",
"MAT_ELASTIC", Sev::verbose,
scale);
550 auto add_domain_ops_rhs = [&](
auto &pip) {
554 pip,
mField,
"U", {body_force_time_scale}, Sev::inform);
563 auto mat_acceleration = boost::make_shared<MatrixDouble>();
565 "U", mat_acceleration));
567 new OpInertiaForce(
"U", mat_acceleration, [](
double,
double,
double) {
574 auto mat_velocity = boost::make_shared<MatrixDouble>();
578 new OpInertiaForce(
"U", mat_velocity, [](
double,
double,
double) {
585 CHKERR HookeOps::opFactoryDomainRhs<SPACE_DIM, AT, IT, DomainEleOp>(
586 mField, pip,
"U",
"MAT_ELASTIC", Sev::inform, 1,
scale);
588 CHKERR HenckyOps::opFactoryDomainRhs<SPACE_DIM, AT, IT, DomainEleOp>(
589 mField, pip,
"U",
"MAT_ELASTIC", Sev::inform,
scale);
595 CHKERR ContactOps::opFactoryDomainRhs<SPACE_DIM, AT, IT, DomainEleOp>(
601 auto add_boundary_base_ops = [&](
auto &pip) {
611 auto add_boundary_ops_lhs = [&](
auto &pip) {
621 pip,
mField,
"U", Sev::inform);
626 auto fe_boundary_lhs = pip_mng->getBoundaryLhsFE();
631 [
this, fe_boundary_lhs](
double,
double,
double) {
640 ContactOps::opFactoryBoundaryLhs<SPACE_DIM, AT, GAUSS, BoundaryEleOp>(
644 mField, pip,
simple->getDomainFEName(),
"SIGMA",
"U",
"GEOMETRY",
650 auto add_boundary_ops_rhs = [&](
auto &pip) {
660 pip,
mField,
"U", {time_scale}, Sev::inform);
663 auto u_disp = boost::make_shared<MatrixDouble>();
664 auto dot_u_disp = boost::make_shared<MatrixDouble>();
669 new OpSpringRhs(
"U", u_disp, [
this](
double,
double,
double) {
673 new OpSpringRhs(
"U", dot_u_disp, [
this](
double,
double,
double) {
679 ContactOps::opFactoryBoundaryRhs<SPACE_DIM, AT, GAUSS, BoundaryEleOp>(
685 CHKERR add_domain_base_ops(pip_mng->getOpDomainLhsPipeline());
686 CHKERR add_domain_base_ops(pip_mng->getOpDomainRhsPipeline());
687 CHKERR add_domain_ops_lhs(pip_mng->getOpDomainLhsPipeline());
688 CHKERR add_domain_ops_rhs(pip_mng->getOpDomainRhsPipeline());
690 CHKERR add_boundary_base_ops(pip_mng->getOpBoundaryLhsPipeline());
691 CHKERR add_boundary_base_ops(pip_mng->getOpBoundaryRhsPipeline());
692 CHKERR add_boundary_ops_lhs(pip_mng->getOpBoundaryLhsPipeline());
693 CHKERR add_boundary_ops_rhs(pip_mng->getOpBoundaryRhsPipeline());
697 integration_rule_vol,
"U");
699 integration_rule_vol,
simple->getDomainFEName(),
"U",
order);
702 CHKERR pip_mng->setDomainRhsIntegrationRule(integration_rule_vol);
703 CHKERR pip_mng->setDomainLhsIntegrationRule(integration_rule_vol);
704 CHKERR pip_mng->setBoundaryRhsIntegrationRule(integration_rule_boundary);
705 CHKERR pip_mng->setBoundaryLhsIntegrationRule(integration_rule_boundary);
713 static boost::shared_ptr<SetUpSchur>
728 auto set_section_monitor = [&](
auto solver) {
731 CHKERR TSGetSNES(solver, &snes);
732 PetscViewerAndFormat *vf;
733 CHKERR PetscViewerAndFormatCreate(PETSC_VIEWER_STDOUT_WORLD,
734 PETSC_VIEWER_DEFAULT, &vf);
738 void *))SNESMonitorFields,
743 auto scatter_create = [&](
auto D,
auto coeff) {
745 CHKERR is_manager->isCreateProblemFieldAndRank(
simple->getProblemName(),
746 ROW,
"U", coeff, coeff, is);
748 CHKERR ISGetLocalSize(is, &loc_size);
752 CHKERR VecScatterCreate(
D, is,
v, PETSC_NULLPTR, &scatter);
757 auto set_time_monitor = [&](
auto dm,
auto solver) {
760 boost::shared_ptr<ForcesAndSourcesCore> null;
766 auto set_essential_bc = [&]() {
770 auto pre_proc_ptr = boost::make_shared<FEMethod>();
771 auto post_proc_rhs_ptr = boost::make_shared<FEMethod>();
772 auto post_proc_lhs_ptr = boost::make_shared<FEMethod>();
775 auto time_scale = boost::make_shared<TimeScale>();
777 auto get_bc_hook_rhs = [&]() {
779 {time_scale},
false);
782 pre_proc_ptr->preProcessHook = get_bc_hook_rhs();
784 auto get_post_proc_hook_rhs = [&]() {
786 mField, post_proc_rhs_ptr, 1.);
788 auto get_post_proc_hook_lhs = [&]() {
790 mField, post_proc_lhs_ptr, 1.);
792 post_proc_rhs_ptr->postProcessHook = get_post_proc_hook_rhs();
794 ts_ctx_ptr->getPreProcessIFunction().push_front(pre_proc_ptr);
795 ts_ctx_ptr->getPreProcessIJacobian().push_front(pre_proc_ptr);
796 ts_ctx_ptr->getPostProcessIFunction().push_back(post_proc_rhs_ptr);
797 post_proc_lhs_ptr->postProcessHook = get_post_proc_hook_lhs();
798 ts_ctx_ptr->getPostProcessIJacobian().push_back(post_proc_lhs_ptr);
803 auto set_schur_pc = [&](
auto solver) {
804 boost::shared_ptr<SetUpSchur> schur_ptr;
805 if (
AT == AssemblyType::BLOCK_SCHUR) {
813 auto dm =
simple->getDM();
825 CHKERR set_essential_bc();
830 auto solver = pip_mng->createTSIM();
831 CHKERR TSSetFromOptions(solver);
834 CHKERR TSSetIJacobian(solver,
B,
B, PETSC_NULLPTR, PETSC_NULLPTR);
835 auto schur_pc_ptr = set_schur_pc(solver);
838 CHKERR set_section_monitor(solver);
839 CHKERR set_time_monitor(dm, solver);
840 CHKERR TSSetSolution(solver,
D);
842 CHKERR TSSolve(solver, NULL);
844 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
845 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
848 auto solver = pip_mng->createTSIM2();
849 CHKERR TSSetFromOptions(solver);
852 CHKERR TSSetI2Jacobian(solver,
B,
B, PETSC_NULLPTR, PETSC_NULLPTR);
853 auto schur_pc_ptr = set_schur_pc(solver);
857 CHKERR set_section_monitor(solver);
858 CHKERR set_time_monitor(dm, solver);
859 CHKERR TS2SetSolution(solver,
D, DD);
861 CHKERR TSSolve(solver, NULL);
863 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
864 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
895 auto add_case = [&](
int number,
const std::string &
name,
double hertz_force,
896 double fem_force,
double tol_force,
897 double analytical_active_area,
double tol_area,
899 return testing->addTestCommandLine(
901 [
testing, hertz_force, fem_force, tol_force, analytical_active_area,
902 tol_area, fem_active_area =
t[
AREA_ACTIVE], pressure_check]() {
905 "Hertz contact force", fem_force, hertz_force, {0., tol_force});
907 "contact active area", fem_active_area, analytical_active_area,
915 CHKERR add_case(1,
"hertz plane stress", 3.927,
t[
TY], 1e-3, 1.0, 3e-2);
916 CHKERR add_case(2,
"hertz plane strain", 4.675,
t[
TY], 1e-3, 1.0, 3e-2,
917 [dm, &m_field =
mField]() {
920 "hertz plane strain pressure norm")(dm.get());
922 CHKERR add_case(3,
"hertz 3d", 3.968,
t[
TZ], 2e-3, M_PI / 4, 0.2);
923 CHKERR add_case(4,
"hertz axisymmetric flat", 15.873,
t[
TY], 5e-3, M_PI, 0.2);
924 CHKERR add_case(5,
"hertz axisymmetric sphere", 15.873,
t[
TY], 5e-3, M_PI,
925 3e-2, [dm, &m_field =
mField]() {
928 "hertz axisymmetric pressure norm")(dm.get());
930 CHKERR add_case(6,
"wavy 2d", 0.374,
t[
TY], 1e-3, 1.0, 3e-2);
931 CHKERR add_case(7,
"wavy 3d", 0.5289,
t[
TZ], 1e-3, 1.0, 3e-2);
943int main(
int argc,
char *argv[]) {
946 const char param_file[] =
"param_file.petsc";
950 auto core_log = logging::core::get();
957#ifdef ENABLE_PYTHON_BINDING
962 DMType dm_name =
"DMMOFEM";
964 DMType dm_name_mg =
"DMMOFEM_MG";
969 moab::Core mb_instance;
970 moab::Interface &moab = mb_instance;
992#ifdef ENABLE_PYTHON_BINDING
1027 CHKERR TSGetSNES(solver, &snes);
1035 PetscBool is_pcfs = PETSC_FALSE;
1036 PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
1039 MOFEM_LOG(
"CONTACT", Sev::inform) <<
"Setup Schur pc";
1044 "It is expected that Schur matrix is not allocated. This is "
1045 "possible only if PC is set up twice");
1057 CHKERR TSGetDM(solver, &solver_dm);
1058 CHKERR DMSetMatType(solver_dm, MATSHELL);
1065 auto swap_assemble = [](TS ts, PetscReal
t, Vec u, Vec u_t, PetscReal
a,
1066 Mat
A, Mat
B,
void *ctx) {
1069 CHKERR TSSetIJacobian(solver,
A, P, swap_assemble, ts_ctx_ptr.get());
1071 auto swap_assemble = [](TS ts, PetscReal
t, Vec u, Vec u_t, Vec utt,
1072 PetscReal
a, PetscReal aa, Mat
A, Mat
B,
1076 CHKERR TSSetI2Jacobian(solver,
A, P, swap_assemble, ts_ctx_ptr.get());
1087 MOFEM_LOG(
"CONTACT", Sev::inform) <<
"No Schur PC";
1100 auto create_dm = [&](
const char *
name,
const char *
field_name,
auto dm_type) {
1102 auto create_dm_imp = [&]() {
1114 "Error in creating schurDM. It is possible that schurDM is "
1122 schurDM = create_dm(
"SCHUR",
"U",
"DMMOFEM_MG");
1123 blockDM = create_dm(
"BLOCK",
"SIGMA",
"DMMOFEM");
1125 if constexpr (
AT == AssemblyType::BLOCK_SCHUR) {
1127 auto get_nested_mat_data = [&](
auto schur_dm,
auto block_dm) {
1133 simple->getDomainFEName(),
1137 {
"U",
"U"}, {
"SIGMA",
"U"}, {
"U",
"SIGMA"}, {
"SIGMA",
"SIGMA"}
1145 {schur_dm, block_dm}, block_mat_data,
1147 {
"SIGMA"}, {
nullptr}, true
1157 "Only BLOCK_SCHUR is implemented");
1166 double eps_stab = 1e-4;
1172 using OpMassStab = B::OpMass<3, SPACE_DIM * SPACE_DIM>;
1182 pip->getOpBoundaryLhsPipeline().push_back(
1183 new OpMassStab(
"SIGMA",
"SIGMA",
1184 [eps_stab](
double,
double,
double) {
return eps_stab; }));
1185 pip->getOpBoundaryLhsPipeline().push_back(
1193 pip->getOpDomainLhsPipeline().push_back(
1199 auto pre_proc_schur_lhs_ptr = boost::make_shared<FEMethod>();
1200 auto post_proc_schur_lhs_ptr = boost::make_shared<FEMethod>();
1202 pre_proc_schur_lhs_ptr->preProcessHook = [
this]() {
1205 MOFEM_LOG(
"CONTACT", Sev::verbose) <<
"Lhs Assemble Begin";
1209 post_proc_schur_lhs_ptr->postProcessHook = [
this, ao_up,
1210 post_proc_schur_lhs_ptr]() {
1212 MOFEM_LOG(
"CONTACT", Sev::verbose) <<
"Lhs Assemble End";
1213 [[maybe_unused]]
auto print_mat_norm = [
this](
auto a, std::string prefix) {
1216 CHKERR MatNorm(
a, NORM_FROBENIUS, &nrm);
1217 MOFEM_LOG(
"CONTACT", Sev::noisy) << prefix <<
" norm = " << nrm;
1220 CHKERR MatAssemblyBegin(
S, MAT_FINAL_ASSEMBLY);
1221 CHKERR MatAssemblyEnd(
S, MAT_FINAL_ASSEMBLY);
1223 mField, post_proc_schur_lhs_ptr, 1,
S, ao_up)();
1225 CHKERR print_mat_norm(
S,
"S");
1227 MOFEM_LOG(
"CONTACT", Sev::verbose) <<
"Lhs Assemble Finish";
1232 ts_ctx_ptr->getPreProcessIJacobian().push_front(pre_proc_schur_lhs_ptr);
1233 ts_ctx_ptr->getPostProcessIJacobian().push_back(post_proc_schur_lhs_ptr);
1241 CHKERR PCFieldSplitSetIS(pc, NULL, block_is);
1242 CHKERR PCFieldSplitSetSchurPre(pc, PC_FIELDSPLIT_SCHUR_PRE_USER,
S);
1249 CHKERR PCFieldSplitSchurGetSubKSP(pc, PETSC_NULLPTR, &subksp);
1250 auto get_pc = [](
auto ksp) {
1257 auto set_pc_p_mg = [](
auto dm,
auto pc,
auto S) {
1260 PetscBool same = PETSC_FALSE;
1261 PetscObjectTypeCompare((PetscObject)pc, PCMG, &same);
1265 CHKERR PCSetFromOptions(pc);
1270 auto set_pc_ksp = [&](
auto dm,
auto pc,
auto S) {
1272 PetscBool same = PETSC_FALSE;
1273 PetscObjectTypeCompare((PetscObject)pc, PCKSP, &same);
1275 CHKERR PCSetFromOptions(pc);
1277 CHKERR PCKSPGetKSP(pc, &inner_ksp);
1278 CHKERR KSPSetFromOptions(inner_ksp);
1280 CHKERR KSPGetPC(inner_ksp, &inner_pc);
1281 CHKERR PCSetFromOptions(inner_pc);
1282 CHKERR set_pc_p_mg(dm, inner_pc,
S);
1290 CHKERR PetscFree(subksp);
1294boost::shared_ptr<SetUpSchur>
1296 return boost::shared_ptr<SetUpSchur>(
new SetUpSchurImpl(m_field));
Vec t
Removal: the ring edge.
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 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.
static MoFEMErrorCode initialise()
static MoFEMErrorCode finalise()
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