|
| v0.14.0
|
Definition at line 169 of file contact.cpp.
◆ Contact()
◆ bC()
[Create common data]
[Boundary condition]
Definition at line 502 of file contact.cpp.
507 for (
auto f : {
"U",
"SIGMA"}) {
508 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
509 "REMOVE_X",
f, 0, 0);
510 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
511 "REMOVE_Y",
f, 1, 1);
512 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
513 "REMOVE_Z",
f, 2, 2);
514 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
515 "REMOVE_ALL",
f, 0, 3);
518 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"FIX_X",
519 "SIGMA", 0, 0,
false,
true);
520 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"FIX_Y",
521 "SIGMA", 1, 1,
false,
true);
522 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"FIX_Z",
523 "SIGMA", 2, 2,
false,
true);
524 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"FIX_ALL",
525 "SIGMA", 0, 3,
false,
true);
526 CHKERR bc_mng->removeBlockDOFsOnEntities(
527 simple->getProblemName(),
"NO_CONTACT",
"SIGMA", 0, 3,
false,
true);
532 simple->getProblemName(),
"U");
◆ checkResults()
[Solve]
[Check]
Definition at line 911 of file contact.cpp.
916 double hertz_tract = 158.73;
918 if (fabs(t_ptr[1] - hertz_tract) / hertz_tract >
tol) {
920 "atom test %d diverged! %3.4e != %3.4e",
atom_test, t_ptr[1],
◆ createCommonData()
[Set up problem]
[Create common data]
Definition at line 432 of file contact.cpp.
435 auto get_options = [&]() {
456 MOFEM_LOG(
"CONTACT", Sev::inform) <<
"Using MFront for material model";
468 PetscBool use_scale = PETSC_FALSE;
488 char sdf_file_name[255];
490 sdf_file_name, 255, PETSC_NULL);
492 sdfPythonPtr = boost::make_shared<SDFPython>();
493 CHKERR sdfPythonPtr->sdfInit(sdf_file_name);
494 sdfPythonWeakPtr = sdfPythonPtr;
◆ OPs()
[Boundary condition]
[Push operators to pip]
[Only used for dynamics]
[Only used for dynamics]
[Only used for dynamics]
[Only used for dynamics]
[Operators used for contact]
[Operators used for contact]
[Operators used for contact]
[Operators used for contact]
Definition at line 539 of file contact.cpp.
544 auto time_scale = boost::make_shared<ScaledTimeScale>();
545 auto body_force_time_scale =
546 boost::make_shared<ScaledTimeScale>(
"body_force_hist.txt");
555 auto add_domain_base_ops = [&](
auto &pip) {
562 auto henky_common_data_ptr = boost::make_shared<HenckyOps::CommonData>();
563 henky_common_data_ptr->matDPtr = boost::make_shared<MatrixDouble>();
564 henky_common_data_ptr->matGradPtr = boost::make_shared<MatrixDouble>();
566 auto add_domain_ops_lhs = [&](
auto &pip) {
576 auto fe_domain_lhs = pip_mng->getDomainLhsFE();
578 auto get_inertia_and_mass_damping =
580 return (
rho *
scale) * fe_domain_lhs->ts_aa +
583 pip.push_back(
new OpMass(
"U",
"U", get_inertia_and_mass_damping));
587 auto fe_domain_lhs = pip_mng->getDomainLhsFE();
589 auto get_inertia_and_mass_damping =
593 pip.push_back(
new OpMass(
"U",
"U", get_inertia_and_mass_damping));
598 CHKERR HenckyOps::opFactoryDomainLhs<SPACE_DIM, AT, IT, DomainEleOp>(
599 mField, pip,
"U",
"MAT_ELASTIC", Sev::verbose,
scale);
605 auto add_domain_ops_rhs = [&](
auto &pip) {
609 pip,
mField,
"U", {body_force_time_scale}, Sev::inform);
613 AT>::LinearForm<IT>::OpBaseTimesVector<1,
SPACE_DIM, 1>;
618 auto mat_acceleration = boost::make_shared<MatrixDouble>();
620 "U", mat_acceleration));
622 new OpInertiaForce(
"U", mat_acceleration, [](
double,
double,
double) {
630 auto mat_velocity = boost::make_shared<MatrixDouble>();
634 new OpInertiaForce(
"U", mat_velocity, [](
double,
double,
double) {
640 CHKERR HenckyOps::opFactoryDomainRhs<SPACE_DIM, AT, IT, DomainEleOp>(
641 mField, pip,
"U",
"MAT_ELASTIC", Sev::inform,
scale);
644 CHKERR ContactOps::opFactoryDomainRhs<SPACE_DIM, AT, IT, DomainEleOp>(
650 auto add_boundary_base_ops = [&](
auto &pip) {
660 auto add_boundary_ops_lhs = [&](
auto &pip) {
670 pip,
mField,
"U", Sev::inform);
675 auto fe_boundary_lhs = pip_mng->getBoundaryLhsFE();
680 [
this, fe_boundary_lhs](
double,
double,
double) {
689 ContactOps::opFactoryBoundaryLhs<SPACE_DIM, AT, GAUSS, BoundaryEleOp>(
693 mField, pip,
simple->getDomainFEName(),
"SIGMA",
"U",
"GEOMETRY",
699 auto add_boundary_ops_rhs = [&](
auto &pip) {
704 AT>::LinearForm<IT>::OpBaseTimesVector<1,
SPACE_DIM, 1>;
709 pip,
mField,
"U", {time_scale}, Sev::inform);
712 auto u_disp = boost::make_shared<MatrixDouble>();
713 auto dot_u_disp = boost::make_shared<MatrixDouble>();
718 new OpSpringRhs(
"U", u_disp, [
this](
double,
double,
double) {
722 new OpSpringRhs(
"U", dot_u_disp, [
this](
double,
double,
double) {
728 ContactOps::opFactoryBoundaryRhs<SPACE_DIM, AT, GAUSS, BoundaryEleOp>(
734 CHKERR add_domain_base_ops(pip_mng->getOpDomainLhsPipeline());
735 CHKERR add_domain_base_ops(pip_mng->getOpDomainRhsPipeline());
736 CHKERR add_domain_ops_lhs(pip_mng->getOpDomainLhsPipeline());
737 CHKERR add_domain_ops_rhs(pip_mng->getOpDomainRhsPipeline());
739 CHKERR add_boundary_base_ops(pip_mng->getOpBoundaryLhsPipeline());
740 CHKERR add_boundary_base_ops(pip_mng->getOpBoundaryRhsPipeline());
741 CHKERR add_boundary_ops_lhs(pip_mng->getOpBoundaryLhsPipeline());
742 CHKERR add_boundary_ops_rhs(pip_mng->getOpBoundaryRhsPipeline());
754 CHKERR pip_mng->setDomainRhsIntegrationRule(integration_rule_vol);
755 CHKERR pip_mng->setDomainLhsIntegrationRule(integration_rule_vol);
756 CHKERR pip_mng->setBoundaryRhsIntegrationRule(integration_rule_boundary);
757 CHKERR pip_mng->setBoundaryLhsIntegrationRule(integration_rule_boundary);
◆ runProblem()
◆ setupProblem()
[Run problem]
[Set up problem]
< blocs interation is collective, so that is set irrespective if there are entities in given rank or not in the block
Definition at line 218 of file contact.cpp.
221 PetscBool use_mfront = PETSC_FALSE;
241 enum bases { AINSWORTH, DEMKOWICZ, LASBASETOPT };
242 const char *list_bases[LASBASETOPT] = {
"ainsworth",
"demkowicz"};
243 PetscInt choice_base_value = AINSWORTH;
245 LASBASETOPT, &choice_base_value, PETSC_NULL);
248 switch (choice_base_value) {
252 <<
"Set AINSWORTH_LEGENDRE_BASE for displacements";
257 <<
"Set DEMKOWICZ_JACOBI_BASE for displacements";
277 auto get_skin = [&]() {
282 CHKERR skin.find_skin(0, body_ents,
false, skin_ents);
286 auto filter_blocks = [&](
auto skin) {
287 bool is_contact_block =
false;
292 (boost::format(
"%s(.*)") %
"CONTACT").str()
301 <<
"Find contact block set: " <<
m->getName();
302 auto meshset =
m->getMeshset();
303 Range contact_meshset_range;
305 meshset,
SPACE_DIM - 1, contact_meshset_range,
true);
308 contact_meshset_range);
309 contact_range.merge(contact_meshset_range);
311 if (is_contact_block) {
313 <<
"Nb entities in contact surface: " << contact_range.size();
315 skin = intersect(skin, contact_range);
320 auto filter_true_skin = [&](
auto skin) {
322 ParallelComm *pcomm =
324 CHKERR pcomm->filter_pstatus(skin, PSTATUS_SHARED | PSTATUS_MULTISHARED,
325 PSTATUS_NOT, -1, &boundary_ents);
326 return boundary_ents;
329 auto boundary_ents = filter_true_skin(filter_blocks(get_skin()));
332 CHKERR simple->setFieldOrder(
"SIGMA", sigma_order, &boundary_ents);
338 moab::Interface::UNION);
340 ho_ents = boundary_ents;
350 "Use executable contact_2d with axisymmetric model");
354 "Axisymmetric model is only available with MFront (set "
357 MOFEM_LOG(
"CONTACT", Sev::inform) <<
"Using axisymmetric model";
362 MOFEM_LOG(
"CONTACT", Sev::inform) <<
"Using plane strain model";
369 #ifndef WITH_MODULE_MFRONT_INTERFACE
372 "MFrontInterface module was not found while use_mfront was set to 1");
376 "MFrontInterface module is not compatible with Schur assembly");
380 boost::make_shared<MFrontMoFEMInterface<TRIDIMENSIONAL>>(
385 boost::make_shared<MFrontMoFEMInterface<AXISYMMETRICAL>>(
388 mfrontInterface = boost::make_shared<MFrontMoFEMInterface<PLANESTRAIN>>(
409 auto dm =
simple->getDM();
416 auto project_ho_geometry = [&]() {
421 PetscBool project_geometry = PETSC_TRUE;
423 &project_geometry, PETSC_NULL);
424 if (project_geometry){
425 CHKERR project_ho_geometry();
◆ tsSolve()
Definition at line 773 of file contact.cpp.
780 auto set_section_monitor = [&](
auto solver) {
783 CHKERR TSGetSNES(solver, &snes);
784 PetscViewerAndFormat *vf;
785 CHKERR PetscViewerAndFormatCreate(PETSC_VIEWER_STDOUT_WORLD,
786 PETSC_VIEWER_DEFAULT, &vf);
789 (
MoFEMErrorCode(*)(SNES, PetscInt, PetscReal,
void *))SNESMonitorFields,
794 auto scatter_create = [&](
auto D,
auto coeff) {
796 CHKERR is_manager->isCreateProblemFieldAndRank(
simple->getProblemName(),
797 ROW,
"U", coeff, coeff, is);
799 CHKERR ISGetLocalSize(is, &loc_size);
803 CHKERR VecScatterCreate(
D, is,
v, PETSC_NULL, &scatter);
808 auto set_time_monitor = [&](
auto dm,
auto solver) {
811 boost::shared_ptr<ForcesAndSourcesCore>
null;
817 auto set_essential_bc = [&]() {
821 auto pre_proc_ptr = boost::make_shared<FEMethod>();
822 auto post_proc_rhs_ptr = boost::make_shared<FEMethod>();
823 auto post_proc_lhs_ptr = boost::make_shared<FEMethod>();
826 auto time_scale = boost::make_shared<TimeScale>();
828 auto get_bc_hook_rhs = [&]() {
830 {time_scale},
false);
833 pre_proc_ptr->preProcessHook = get_bc_hook_rhs();
835 auto get_post_proc_hook_rhs = [&]() {
837 mField, post_proc_rhs_ptr, 1.);
839 auto get_post_proc_hook_lhs = [&]() {
841 mField, post_proc_lhs_ptr, 1.);
843 post_proc_rhs_ptr->postProcessHook = get_post_proc_hook_rhs();
845 ts_ctx_ptr->getPreProcessIFunction().push_front(pre_proc_ptr);
846 ts_ctx_ptr->getPreProcessIJacobian().push_front(pre_proc_ptr);
847 ts_ctx_ptr->getPostProcessIFunction().push_back(post_proc_rhs_ptr);
849 post_proc_lhs_ptr->postProcessHook = get_post_proc_hook_lhs();
850 ts_ctx_ptr->getPostProcessIJacobian().push_back(post_proc_lhs_ptr);
855 auto set_schur_pc = [&](
auto solver) {
856 boost::shared_ptr<SetUpSchur> schur_ptr;
864 auto dm =
simple->getDM();
876 CHKERR set_essential_bc();
879 auto solver = pip_mng->createTSIM();
880 CHKERR TSSetFromOptions(solver);
883 auto schur_pc_ptr = set_schur_pc(solver);
885 CHKERR set_section_monitor(solver);
886 CHKERR set_time_monitor(dm, solver);
887 CHKERR TSSetSolution(solver,
D);
889 CHKERR TSSolve(solver, NULL);
891 auto solver = pip_mng->createTSIM2();
892 CHKERR TSSetFromOptions(solver);
894 auto dm =
simple->getDM();
897 auto schur_pc_ptr = set_schur_pc(solver);
899 CHKERR set_section_monitor(solver);
900 CHKERR set_time_monitor(dm, solver);
901 CHKERR TS2SetSolution(solver,
D, DD);
903 CHKERR TSSolve(solver, NULL);
◆ mField
◆ mfrontInterface
◆ monitorPtr
boost::shared_ptr<Monitor> Contact::monitorPtr |
|
private |
◆ uXScatter
◆ uYScatter
◆ uZScatter
The documentation for this struct was generated from the following file:
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
#define MYPCOMM_INDEX
default communicator number PCOMM
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.
Specialization for DisplacementCubitBcData.
virtual MPI_Comm & get_comm() const =0
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Get values at integration pts for tensor filed rank 1, i.e. vector field.
virtual int get_comm_rank() const =0
Specialization for DisplacementCubitBcData.
PipelineManager interface.
Definition of the displacement bc data structure.
Projection of edge entities with one mid-node on hierarchical basis.
Simple interface for fast problem set-up.
static boost::shared_ptr< SetUpSchur > createSetUpSchur(MoFEM::Interface &m_field, SmartPetscObj< DM > sub_dm, SmartPetscObj< IS > field_split_it, SmartPetscObj< AO > ao_map)
Create data structure for handling Schur complement.
static constexpr int approx_order
Approximate field values for given petsc vector.
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesVector< 1, SPACE_DIM, 1 > OpInertiaForce
#define CHKERR
Inline error check.
auto createDMVector(DM dm)
Get smart vector from DM.
Specialization for DisplacementCubitBcData.
virtual moab::Interface & get_moab()=0
Section manager is used to create indexes and sections.
Simple interface for fast problem set-up.
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, SPACE_DIM > OpMass
[Only used with Hooke equation (linear material model)]
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
void simple(double P1[], double P2[], double P3[], double c[], const int N)
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
Add operators pushing bases from local to physical configuration.
const double v
phase velocity of light in medium (cm/ns)
#define MOFEM_LOG(channel, severity)
Log.
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
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.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
const FTensor::Tensor2< T, Dim, Dim > Vec
@ MOFEM_DATA_INCONSISTENCY
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)
FieldApproximationBase
approximation base
const double D
diffusivity
FTensor::Index< 'm', 3 > m
@ MOFEM_ATOM_TEST_INVALID
PetscErrorCode PetscOptionsGetScalar(PetscOptions *, const char pre[], const char name[], PetscScalar *dval, PetscBool *set)
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ HDIV
field with continuous normal traction
auto getDMTsCtx(DM dm)
Get TS context data structure used by DM.
#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)