15 constexpr double third = boost::math::constants::third<double>();
16 return (t_stress(0, 0) + t_stress(1, 1));
20 return (t_stress(0, 0) + t_stress(1, 1) + t_stress(2, 2));
65 GAUSS>::OpBaseTimesVector<1, SPACE_DIM, 0>;
79 IntegrationType::GAUSS>::OpBaseTimesVector<1, SPACE_DIM * SPACE_DIM, 1>;
102template <
int DIM_0,
int DIM_1>
105 boost::shared_ptr<MatrixDouble> def_grad_stab_ptr,
106 boost::shared_ptr<MatrixDouble> def_grad_dot_ptr,
107 double tau_F_ptr,
double xi_F_ptr,
108 boost::shared_ptr<MatrixDouble> grad_x_ptr,
109 boost::shared_ptr<MatrixDouble> grad_vel_ptr)
116 DataForcesAndSourcesCore::EntData &data) {
123 const size_t nb_gauss_pts = getGaussPts().size2();
129 auto t_F = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
defGradPtr);
130 auto t_Fstab = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
defGradStabPtr);
131 auto t_F_dot = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
defGradDotPtr);
136 auto t_gradx = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
gradxPtr);
137 auto t_gradVel = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
gradVelPtr);
139 for (
auto gg = 0; gg != nb_gauss_pts; ++gg) {
141 t_Fstab(
i,
j) = t_F(
i,
j) + tau_F * (t_gradVel(
i,
j) - t_F_dot(
i,
j)) +
142 xi_F * (t_gradx(
i,
j) - t_F(
i,
j));
166template <
int DIM_0,
int DIM_1>
170 boost::shared_ptr<MatrixDouble> first_piola_ptr,
171 boost::shared_ptr<MatrixDouble> def_grad_ptr)
178 DataForcesAndSourcesCore::EntData &data) {
189 const size_t nb_gauss_pts = getGaussPts().size2();
196 auto t_P = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
firstPiolaPtr);
197 auto t_F = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
defGradPtr);
198 const double two_o_three = 2. / 3.;
199 const double trace_t_dk = DIM_0;
200 for (
auto gg = 0; gg != nb_gauss_pts; ++gg) {
204 two_o_three * trace_t_dk *
t_kd(
i,
j)) +
227 boost::shared_ptr<MatrixDouble> reference_pos_ptr,
228 boost::shared_ptr<MatrixDouble> u_ptr)
230 xPtr(spatial_pos_ptr),
XPtr(reference_pos_ptr),
uPtr(u_ptr) {}
233 DataForcesAndSourcesCore::EntData &data) {
239 const size_t nb_gauss_pts = getGaussPts().size2();
241 uPtr->resize(DIM, nb_gauss_pts,
false);
245 auto t_x = getFTensor1FromMat<DIM>(*
xPtr);
246 auto t_X = getFTensor1FromMat<DIM>(*
XPtr);
247 auto t_u = getFTensor1FromMat<DIM>(*
uPtr);
248 for (
auto gg = 0; gg != nb_gauss_pts; ++gg) {
250 t_u(
i) = t_x(
i) - t_X(
i);
260 boost::shared_ptr<MatrixDouble>
xPtr;
261 boost::shared_ptr<MatrixDouble>
XPtr;
262 boost::shared_ptr<MatrixDouble>
uPtr;
265template <
int DIM_0,
int DIM_1>
269 double shear_modulus,
double bulk_modulus,
double m_u,
270 double lambda_lamme, boost::shared_ptr<MatrixDouble> first_piola_ptr,
271 boost::shared_ptr<MatrixDouble> def_grad_ptr,
272 boost::shared_ptr<MatrixDouble> inv_def_grad_ptr,
273 boost::shared_ptr<VectorDouble> det)
280 DataForcesAndSourcesCore::EntData &data) {
292 const size_t nb_gauss_pts = getGaussPts().size2();
299 auto t_P = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
firstPiolaPtr);
300 auto t_F = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
defGradPtr);
301 auto t_inv_F = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
invDefGradPtr);
302 auto t_det = getFTensor0FromVec<1>(*
dEt);
303 const double two_o_three = 2. / 3.;
304 const double one_o_three = 1. / 3.;
307 for (
auto gg = 0; gg != nb_gauss_pts; ++gg) {
311 t_P(
i,
j) = bulk_mod * (t_det - 1.) * t_det * t_inv_F(
j,
i);
314 shear_mod * pow(t_det, two_o_three) *
315 (t_F(
i,
j) - one_o_three * (t_F(
l,
k) * t_F(
l,
k)) * t_inv_F(
j,
i));
334 boost::shared_ptr<VectorDouble>
dEt;
337template <
int DIM_0,
int DIM_1>
341 boost::shared_ptr<MatrixDouble> def_grad_ptr,
342 boost::shared_ptr<MatrixDouble> grad_tensor_ptr)
347 DataForcesAndSourcesCore::EntData &data) {
357 const size_t nb_gauss_pts = getGaussPts().size2();
360 defGradPtr->resize(DIM_0 * DIM_1, nb_gauss_pts,
false);
364 auto t_F = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
defGradPtr);
365 auto t_H = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
gradTensorPtr);
366 for (
auto gg = 0; gg != nb_gauss_pts; ++gg) {
399 PetscInt stageindex, Vec *Y);
438 double getScale(
const double time) {
return 0.001 * sin(0.1 * time); };
443 double getScale(
const double time) {
return 0.001; };
476 enum bases { AINSWORTH, DEMKOWICZ, LASBASETOPT };
477 const char *list_bases[LASBASETOPT] = {
"ainsworth",
"demkowicz"};
478 PetscInt choice_base_value = AINSWORTH;
480 LASBASETOPT, &choice_base_value, PETSC_NULLPTR);
483 switch (choice_base_value) {
487 <<
"Set AINSWORTH_LEGENDRE_BASE for displacements";
492 <<
"Set DEMKOWICZ_JACOBI_BASE for displacements";
519 auto project_ho_geometry = [&]() {
528 CHKERR project_ho_geometry();
541 auto time_scale = boost::make_shared<TimeScale>();
543 PetscBool sin_time_function = PETSC_FALSE;
545 &sin_time_function, PETSC_NULLPTR);
547 if (sin_time_function)
548 time_scale = boost::make_shared<DynamicFirstOrderConsSinusTimeScale>();
550 time_scale = boost::make_shared<DynamicFirstOrderConsConstantTimeScale>();
552 pipeline_mng->getBoundaryExplicitRhsFE().reset();
554 pipeline_mng->getOpBoundaryExplicitRhsPipeline(), {NOSPACE},
"GEOMETRY");
557 pipeline_mng->getOpBoundaryExplicitRhsPipeline(),
mField,
"V",
558 {time_scale},
"FORCE",
"PRESSURE", Sev::inform);
568 simple->getProblemName(),
"V");
570 auto get_pre_proc_hook = [&]() {
572 mField, pipeline_mng->getDomainExplicitRhsFE(), {time_scale});
574 pipeline_mng->getDomainExplicitRhsFE()->preProcessHook = get_pre_proc_hook();
581 PetscInt stageindex, Vec *Y) {
585 auto &m_field = ptr->fsRawPtr->mField;
587 auto fb = m_field.getInterface<
FieldBlas>();
591 CHKERR TSGetTime(ts, &time);
593 Vec *stage_solutions;
595 CHKERR TSGetStages(ts, &num_stages, &stage_solutions);
596 PetscPrintf(PETSC_COMM_WORLD,
"Check timestep %d time %e dt %e\n",
597 num_stages, time,
dt);
599 const double inv_num_step = (
double)num_stages;
600 CHKERR fb->fieldCopy(1.,
"x_1",
"x_2");
601 CHKERR fb->fieldAxpy(
dt,
"V",
"x_2");
602 CHKERR fb->fieldCopy(1.,
"x_2",
"x_1");
604 CHKERR fb->fieldCopy(-inv_num_step /
dt,
"F_0",
"F_dot");
605 CHKERR fb->fieldAxpy(inv_num_step /
dt,
"F",
"F_dot");
606 CHKERR fb->fieldCopy(1.,
"F",
"F_0");
618 CHKERR TSGetTime(ts, &time);
630 CHKERR TSGetTime(ts, &time);
632 CHKERR TSGetStepNumber(ts, &step_num);
650 auto get_time_scale = [
this](
const double time) {
651 return sin(time *
omega * M_PI);
654 auto apply_rhs = [&](
auto &pip) {
661 auto mat_v_grad_ptr = boost::make_shared<MatrixDouble>();
663 "V", mat_v_grad_ptr));
665 auto gravity_vector_ptr = boost::make_shared<MatrixDouble>();
666 gravity_vector_ptr->resize(
SPACE_DIM, 1);
667 auto set_body_force = [&]() {
670 auto t_force = getFTensor1FromMat<SPACE_DIM, 0>(*gravity_vector_ptr);
671 double unit_weight = 0.;
676 t_force(1) = -unit_weight;
678 t_force(2) = unit_weight;
684 pip.push_back(
new OpBodyForce(
"V", gravity_vector_ptr,
685 [](
double,
double,
double) {
return 1.; }));
688 auto mat_H_tensor_ptr = boost::make_shared<MatrixDouble>();
690 "F", mat_H_tensor_ptr));
707 auto mat_dot_F_tensor_ptr = boost::make_shared<MatrixDouble>();
709 "F_dot", mat_dot_F_tensor_ptr));
712 auto mat_x_grad_ptr = boost::make_shared<MatrixDouble>();
714 "x_2", mat_x_grad_ptr));
716 auto mat_F_tensor_ptr = boost::make_shared<MatrixDouble>();
718 mat_F_tensor_ptr, mat_H_tensor_ptr));
720 auto mat_F_stab_ptr = boost::make_shared<MatrixDouble>();
722 mat_F_tensor_ptr, mat_F_stab_ptr, mat_dot_F_tensor_ptr, tau, xi,
723 mat_x_grad_ptr, mat_v_grad_ptr));
725 PetscBool is_linear_elasticity = PETSC_TRUE;
727 &is_linear_elasticity, PETSC_NULLPTR);
729 auto mat_P_stab_ptr = boost::make_shared<MatrixDouble>();
730 if (is_linear_elasticity) {
735 auto inv_F = boost::make_shared<MatrixDouble>();
736 auto det_ptr = boost::make_shared<VectorDouble>();
744 mat_F_stab_ptr, inv_F, det_ptr));
754 CHKERR apply_rhs(pipeline_mng->getOpDomainExplicitRhsPipeline());
775 boost::shared_ptr<PostProcEle> post_proc,
776 boost::shared_ptr<PostProcFaceEle> post_proc_bdry,
777 boost::shared_ptr<MatrixDouble> velocity_field_ptr,
778 boost::shared_ptr<MatrixDouble> x2_field_ptr,
779 boost::shared_ptr<MatrixDouble> geometry_field_ptr,
780 std::array<double, 3> pass_field_eval_coords,
781 boost::shared_ptr<SetPtsData> pass_field_eval_data)
793 ->evalFEAtThePoint<SPACE_DIM>(
800 auto t_x2_field = getFTensor1FromMat<SPACE_DIM>(*
x2FieldPtr);
803 double u_x = t_x2_field(0) - t_geom(0);
804 double u_y = t_x2_field(1) - t_geom(1);
805 double u_z = t_x2_field(2) - t_geom(2);
808 <<
"Velocities x: " << t_vel(0) <<
" y: " << t_vel(1)
809 <<
" z: " << t_vel(2) <<
"\n";
810 MOFEM_LOG(
"SYNC", Sev::inform) <<
"Displacement x: " << u_x
811 <<
" y: " << u_y <<
" z: " << u_z <<
"\n";
815 std::regex((boost::format(
"%s(.*)") %
"Data_Vertex").str()))) {
819 auto print_vets = [](boost::shared_ptr<FieldEntity> ent_ptr) {
821 if (!(ent_ptr->getPStatus() & PSTATUS_NOT_OWNED)) {
823 <<
"Velocities: " << ent_ptr->getEntFieldData()[0] <<
" "
824 << ent_ptr->getEntFieldData()[1] <<
" "
825 << ent_ptr->getEntFieldData()[2] <<
"\n";
830 print_vets,
"V", &ents);
834 PetscBool print_volume = PETSC_FALSE;
838 PetscBool print_skin = PETSC_FALSE;
850 "out_step_" + boost::lexical_cast<std::string>(
ts_step) +
".h5m");
856 "out_boundary_" + boost::lexical_cast<std::string>(
ts_step) +
880 auto dm =
simple->getDM();
882 auto calculate_stress_ops = [&](
auto &pip) {
885 auto v_ptr = boost::make_shared<MatrixDouble>();
887 auto X_ptr = boost::make_shared<MatrixDouble>();
891 auto x_ptr = boost::make_shared<MatrixDouble>();
895 auto mat_H_tensor_ptr = boost::make_shared<MatrixDouble>();
897 "F", mat_H_tensor_ptr));
899 auto u_ptr = boost::make_shared<MatrixDouble>();
903 auto mat_F_ptr = boost::make_shared<MatrixDouble>();
905 mat_F_ptr, mat_H_tensor_ptr));
907 PetscBool is_linear_elasticity = PETSC_TRUE;
909 &is_linear_elasticity, PETSC_NULLPTR);
911 auto mat_P_ptr = boost::make_shared<MatrixDouble>();
912 if (is_linear_elasticity) {
917 auto inv_F = boost::make_shared<MatrixDouble>();
918 auto det_ptr = boost::make_shared<VectorDouble>();
924 mat_F_ptr, inv_F, det_ptr));
927 auto mat_v_grad_ptr = boost::make_shared<MatrixDouble>();
929 "V", mat_v_grad_ptr));
931 return boost::make_tuple(v_ptr, X_ptr, x_ptr, mat_P_ptr, mat_F_ptr, u_ptr);
934 auto post_proc_boundary = [&]() {
935 auto boundary_post_proc_fe = boost::make_shared<PostProcFaceEle>(
mField);
938 boundary_post_proc_fe->getOpPtrVector(), {},
"GEOMETRY");
942 auto [boundary_v_ptr, boundary_X_ptr, boundary_x_ptr, boundary_mat_P_ptr,
943 boundary_mat_F_ptr, boundary_u_ptr] =
944 calculate_stress_ops(op_loop_side->getOpPtrVector());
945 boundary_post_proc_fe->getOpPtrVector().push_back(op_loop_side);
949 boundary_post_proc_fe->getOpPtrVector().push_back(
953 boundary_post_proc_fe->getPostProcMesh(),
954 boundary_post_proc_fe->getMapGaussPts(),
959 {
"GEOMETRY", boundary_X_ptr},
960 {
"x", boundary_x_ptr},
961 {
"U", boundary_u_ptr}},
964 {
"F", boundary_mat_F_ptr}},
971 return boundary_post_proc_fe;
985 auto ts_pre_post_proc = boost::make_shared<TSPrePostProc>();
991 boost::shared_ptr<DomainEle> vol_mass_ele(
new DomainEle(mField));
1001 vol_mass_ele->getOpPtrVector().push_back(
new OpMassV(
"V",
"V", get_rho));
1002 vol_mass_ele->getOpPtrVector().push_back(
new OpMassF(
"F",
"F"));
1005 CHKERR MatAssemblyBegin(M, MAT_FINAL_ASSEMBLY);
1006 CHKERR MatAssemblyEnd(M, MAT_FINAL_ASSEMBLY);
1009 CHKERR MatGetRowSum(M, lumpVec);
1011 CHKERR MatZeroEntries(M);
1012 CHKERR MatDiagonalSet(M, lumpVec, INSERT_VALUES);
1017 CHKERR KSPSetOperators(ksp, M, M);
1018 CHKERR KSPSetFromOptions(ksp);
1021 auto solve_boundary_for_g = [&]() {
1023 if (*(pipeline_mng->getBoundaryExplicitRhsFE()->vecAssembleSwitch)) {
1025 CHKERR VecGhostUpdateBegin(pipeline_mng->getBoundaryExplicitRhsFE()->ts_F,
1026 ADD_VALUES, SCATTER_REVERSE);
1027 CHKERR VecGhostUpdateEnd(pipeline_mng->getBoundaryExplicitRhsFE()->ts_F,
1028 ADD_VALUES, SCATTER_REVERSE);
1029 CHKERR VecAssemblyBegin(pipeline_mng->getBoundaryExplicitRhsFE()->ts_F);
1030 CHKERR VecAssemblyEnd(pipeline_mng->getBoundaryExplicitRhsFE()->ts_F);
1031 *(pipeline_mng->getBoundaryExplicitRhsFE()->vecAssembleSwitch) =
false;
1035 CHKERR KSPSolve(ksp, pipeline_mng->getBoundaryExplicitRhsFE()->ts_F,
D);
1036 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
1037 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
1038 CHKERR VecCopy(
D, pipeline_mng->getBoundaryExplicitRhsFE()->ts_F);
1044 pipeline_mng->getBoundaryExplicitRhsFE()->postProcessHook =
1045 solve_boundary_for_g;
1048 ts = pipeline_mng->createTSEX(dm);
1051 PetscBool field_eval_flag = PETSC_TRUE;
1052 boost::shared_ptr<MatrixDouble> velocity_field_ptr;
1053 boost::shared_ptr<MatrixDouble> geometry_field_ptr;
1054 boost::shared_ptr<MatrixDouble> spatial_position_field_ptr;
1055 boost::shared_ptr<SetPtsData> field_eval_data;
1057 std::array<double, 3> field_eval_coords = {0.5, 0.5, 5.};
1060 field_eval_coords.data(), &dim,
1063 if (field_eval_flag) {
1067 field_eval_data,
simple->getDomainFEName());
1069 field_eval_data->setEvalPoints(field_eval_coords.data(), 1);
1071 auto no_rule = [](
int,
int,
int) {
return -1; };
1073 auto fe_ptr = field_eval_data->feMethodPtr.lock();
1074 fe_ptr->getRuleHook = no_rule;
1075 velocity_field_ptr = boost::make_shared<MatrixDouble>();
1076 geometry_field_ptr = boost::make_shared<MatrixDouble>();
1077 spatial_position_field_ptr = boost::make_shared<MatrixDouble>();
1078 fe_ptr->getOpPtrVector().push_back(
1080 fe_ptr->getOpPtrVector().push_back(
1082 geometry_field_ptr));
1083 fe_ptr->getOpPtrVector().push_back(
1085 "x_2", spatial_position_field_ptr));
1088 auto post_proc_domain = [&]() {
1089 auto post_proc_fe_vol = boost::make_shared<PostProcEle>(mField);
1093 auto [boundary_v_ptr, boundary_X_ptr, boundary_x_ptr, boundary_mat_P_ptr,
1094 boundary_mat_F_ptr, boundary_u_ptr] =
1095 calculate_stress_ops(post_proc_fe_vol->getOpPtrVector());
1097 post_proc_fe_vol->getOpPtrVector().push_back(
1101 post_proc_fe_vol->getPostProcMesh(),
1102 post_proc_fe_vol->getMapGaussPts(),
1106 {{
"V", boundary_v_ptr},
1107 {
"GEOMETRY", boundary_X_ptr},
1108 {
"x", boundary_x_ptr},
1109 {
"U", boundary_u_ptr}},
1111 {{
"FIRST_PIOLA", boundary_mat_P_ptr}, {
"F", boundary_mat_F_ptr}},
1118 return post_proc_fe_vol;
1121 boost::shared_ptr<FEMethod> null_fe;
1122 auto monitor_ptr = boost::make_shared<Monitor>(
1124 post_proc_boundary(), velocity_field_ptr, spatial_position_field_ptr,
1125 geometry_field_ptr, field_eval_coords, field_eval_data);
1128 null_fe, monitor_ptr);
1132 CHKERR TSSetExactFinalTime(ts, TS_EXACTFINALTIME_MATCHSTEP);
1137 CHKERR TSSetSolution(ts, T);
1138 CHKERR TSSetFromOptions(ts);
1144 boost::shared_ptr<ForcesAndSourcesCore> null;
1147 ptr->fsRawPtr =
this;
1149 CHKERR TSSolve(ts, NULL);
1150 CHKERR TSGetTime(ts, &ftime);
1160 PetscBool test_flg = PETSC_FALSE;
1168 CHKERR VecNorm(T, NORM_2, &nrm2);
1169 MOFEM_LOG(
"EXAMPLE", Sev::inform) <<
"Regression norm " << nrm2;
1170 constexpr double regression_value = 0.0194561;
1171 if (fabs(nrm2 - regression_value) > 1e-2)
1173 "Regression test failed; wrong norm value.");
1191 const char param_file[] =
"param_file.petsc";
1195 auto core_log = logging::core::get();
1204 DMType dm_name =
"DMMOFEM";
1209 moab::Core mb_instance;
1210 moab::Interface &moab = mb_instance;
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
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 MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_ATOM_TEST_INVALID
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
PostProcEleByDim< SPACE_DIM >::PostProcEleDomain PostProcEleDomain
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, SPACE_DIM > OpMassV
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, SPACE_DIM *SPACE_DIM > OpMassF
static boost::weak_ptr< TSPrePostProc > tsPrePostProc
static char help[]
[Check]
FormsIntegrators< DomainEleOp >::Assembly< AssemblyType::PETSC >::LinearForm< IntegrationType::GAUSS >::OpBaseTimesVector< 1, SPACE_DIM *SPACE_DIM, 1 > OpRhsTestPiola
constexpr double poisson_ratio
constexpr double omega
Save field DOFS on vertices/tags.
PostProcEleByDim< SPACE_DIM >::PostProcEleBdy PostProcEleBdy
PipelineManager::ElementsAndOpsByDim< SPACE_DIM >::DomainEle DomainEle
double trace(FTensor::Tensor2< T, 2, 2 > &t_stress)
FormsIntegrators< DomainEleOp >::Assembly< AssemblyType::PETSC >::LinearForm< IntegrationType::GAUSS >::OpGradTimesTensor< 1, SPACE_DIM, SPACE_DIM > OpGradTimesPiola
FormsIntegrators< DomainEleOp >::Assembly< AssemblyType::PETSC >::LinearForm< IntegrationType::GAUSS >::OpGradTimesTensor< 1, SPACE_DIM, SPACE_DIM > OpGradTimesTensor2
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesVector< 1, SPACE_DIM, 1 > OpInertiaForce
constexpr double young_modulus
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
PetscErrorCode DMCreateMatrix_MoFEM(DM dm, Mat *M)
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
auto createDMVector(DM dm)
Get smart vector 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
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
auto createKSP(MPI_Comm comm)
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 PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetReal(PetscOptions *, const char pre[], const char name[], PetscReal *dval, PetscBool *set)
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
PetscErrorCode PetscOptionsGetRealArray(PetscOptions *, const char pre[], const char name[], PetscReal dval[], PetscInt *nmax, PetscBool *set)
MoFEM::OpBrokenTopoBase GAUSS
Gaussian quadrature integration.
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
FTensor::Index< 'M', 3 > M
FormsIntegrators< DomainEleOp >::Assembly< A >::LinearForm< I >::OpGradTimesTensor< 1, FIELD_DIM, SPACE_DIM > OpGradTimesTensor
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
static constexpr int approx_order
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, SPACE_DIM > OpMass
[Only used with Hooke equation (linear material model)]
FTensor::Index< 'm', 3 > m
SmartPetscObj< Mat > M
Mass matrix.
SmartPetscObj< KSP > ksp
Linear solver.
double getScale(const double time)
Get scaling at given time.
double getScale(const double time)
Get scaling at given time.
MoFEMErrorCode boundaryCondition()
[Set up problem]
MoFEMErrorCode assembleSystem()
[Push operators to pipeline]
MoFEMErrorCode readMesh()
[Run problem]
FieldApproximationBase base
Choice of finite element basis functions
MoFEMErrorCode checkResults()
[Postprocess results]
MoFEMErrorCode solveSystem()
[Solve]
Example(MoFEM::Interface &m_field)
MoFEMErrorCode runProblem()
MoFEM::Interface & mField
Reference to MoFEM interface.
MoFEMErrorCode setupProblem()
MoFEMErrorCode outputResults()
[Solve]
double getScale(const double time)
Get scaling at given time.
Add operators pushing bases from local to physical configuration.
boost::weak_ptr< CacheTuple > getCacheWeakPtr() const
Get the cache weak pointer object.
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.
Structure for user loop methods on finite elements.
Field evaluator interface.
SetIntegrationPtsMethodData SetPtsData
structure to get information from mofem into EntitiesFieldData
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.
Get values at integration pts for tensor field rank 2, i.e. matrix field.
Get field gradients at integration pts for scalar field rank 0, i.e. vector field.
Specialization for double precision vector field values calculation.
Operator for inverting matrices at integration points.
Element used to execute operators on side of the element.
Post post-proc data at points from hash maps.
std::map< std::string, boost::shared_ptr< MatrixDouble > > DataMapMat
std::map< std::string, boost::shared_ptr< VectorDouble > > DataMapVec
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
intrusive_ptr for managing petsc objects
PetscInt ts_step
Current time step number.
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.
[Push operators to pipeline]
boost::shared_ptr< PostProcFaceEle > postProcBdy
std::array< double, 3 > fieldEvalCoords
MoFEM::Interface & mField
Monitor(SmartPetscObj< DM > dm, MoFEM::Interface &m_field, boost::shared_ptr< PostProcEle > post_proc, boost::shared_ptr< PostProcFaceEle > post_proc_bdry, boost::shared_ptr< MatrixDouble > velocity_field_ptr, boost::shared_ptr< MatrixDouble > x2_field_ptr, boost::shared_ptr< MatrixDouble > geometry_field_ptr, std::array< double, 3 > pass_field_eval_coords, boost::shared_ptr< SetPtsData > pass_field_eval_data)
boost::shared_ptr< MatrixDouble > geometryFieldPtr
MoFEMErrorCode postProcess()
Post-processing function executed at loop completion.
boost::shared_ptr< MatrixDouble > velocityFieldPtr
boost::shared_ptr< SetPtsData > fieldEvalData
boost::shared_ptr< MatrixDouble > x2FieldPtr
boost::shared_ptr< PostProcEle > postProc
boost::shared_ptr< MatrixDouble > XPtr
boost::shared_ptr< MatrixDouble > uPtr
MoFEMErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
OpCalculateDisplacement(boost::shared_ptr< MatrixDouble > spatial_pos_ptr, boost::shared_ptr< MatrixDouble > reference_pos_ptr, boost::shared_ptr< MatrixDouble > u_ptr)
boost::shared_ptr< MatrixDouble > xPtr
boost::shared_ptr< MatrixDouble > gradxPtr
MoFEMErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
OpCalculateFStab(boost::shared_ptr< MatrixDouble > def_grad_ptr, boost::shared_ptr< MatrixDouble > def_grad_stab_ptr, boost::shared_ptr< MatrixDouble > def_grad_dot_ptr, double tau_F_ptr, double xi_F_ptr, boost::shared_ptr< MatrixDouble > grad_x_ptr, boost::shared_ptr< MatrixDouble > grad_vel_ptr)
boost::shared_ptr< MatrixDouble > defGradStabPtr
boost::shared_ptr< MatrixDouble > gradVelPtr
boost::shared_ptr< MatrixDouble > defGradPtr
boost::shared_ptr< MatrixDouble > defGradDotPtr
OpCalculatePiolaIncompressibleNH(double shear_modulus, double bulk_modulus, double m_u, double lambda_lamme, boost::shared_ptr< MatrixDouble > first_piola_ptr, boost::shared_ptr< MatrixDouble > def_grad_ptr, boost::shared_ptr< MatrixDouble > inv_def_grad_ptr, boost::shared_ptr< VectorDouble > det)
boost::shared_ptr< VectorDouble > dEt
MoFEMErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
boost::shared_ptr< MatrixDouble > invDefGradPtr
boost::shared_ptr< MatrixDouble > defGradPtr
boost::shared_ptr< MatrixDouble > firstPiolaPtr
OpCalculatePiola(double shear_modulus, double bulk_modulus, double m_u, double lambda_lamme, boost::shared_ptr< MatrixDouble > first_piola_ptr, boost::shared_ptr< MatrixDouble > def_grad_ptr)
MoFEMErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
boost::shared_ptr< MatrixDouble > defGradPtr
boost::shared_ptr< MatrixDouble > firstPiolaPtr
PipelineManager::ElementsAndOpsByDim< 2 >::FaceSideEle SideEle
PipelineManager::ElementsAndOpsByDim< 3 >::FaceSideEle SideEle
Set of functions called by PETSc solver used to refine and update mesh.
static MoFEMErrorCode tsPostStep(TS ts)
virtual ~TSPrePostProc()=default
static MoFEMErrorCode tsPreStep(TS ts)
static MoFEMErrorCode tsPostStage(TS ts, PetscReal stagetime, PetscInt stageindex, Vec *Y)
[Boundary condition]
MoFEMErrorCode tsSetUp(TS ts)
Used to setup TS solver.
static boost::weak_ptr< TSPrePostProc > tsPrePostProc
#define EXECUTABLE_DIMENSION
ElementsAndOps< SPACE_DIM >::SideEle SideEle
DomainNaturalBC::OpFlux< NaturalMeshsetType< BLOCKSET >, 1, SPACE_DIM > OpBodyForce