15 return (t_stress(0, 0) + t_stress(1, 1));
19 return (t_stress(0, 0) + t_stress(1, 1) + t_stress(2, 2));
64 GAUSS>::OpBaseTimesVector<1, SPACE_DIM, 0>;
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) {
289 const size_t nb_gauss_pts = getGaussPts().size2();
296 auto t_P = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
firstPiolaPtr);
297 auto t_F = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
defGradPtr);
298 auto t_inv_F = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
invDefGradPtr);
299 auto t_det = getFTensor0FromVec<1>(*
dEt);
300 const double two_o_three = 2. / 3.;
301 const double one_o_three = 1. / 3.;
304 for (
auto gg = 0; gg != nb_gauss_pts; ++gg) {
308 t_P(
i,
j) = bulk_mod * (t_det - 1.) * t_det * t_inv_F(
j,
i);
311 shear_mod * pow(t_det, two_o_three) *
312 (t_F(
i,
j) - one_o_three * (t_F(
l,
k) * t_F(
l,
k)) * t_inv_F(
j,
i));
331 boost::shared_ptr<VectorDouble>
dEt;
334template <
int DIM_0,
int DIM_1>
338 boost::shared_ptr<MatrixDouble> def_grad_ptr,
339 boost::shared_ptr<MatrixDouble> grad_tensor_ptr)
344 DataForcesAndSourcesCore::EntData &data) {
354 const size_t nb_gauss_pts = getGaussPts().size2();
357 defGradPtr->resize(nb_gauss_pts, DIM_0 * DIM_1,
false);
361 auto t_F = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
defGradPtr);
362 auto t_H = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
gradTensorPtr);
363 for (
auto gg = 0; gg != nb_gauss_pts; ++gg) {
396 PetscInt stageindex, Vec *Y);
435 double getScale(
const double time) {
return 0.001 * sin(0.1 * time); };
440 double getScale(
const double time) {
return 0.001; };
473 enum bases { AINSWORTH, DEMKOWICZ, LASBASETOPT };
474 const char *list_bases[LASBASETOPT] = {
"ainsworth",
"demkowicz"};
475 PetscInt choice_base_value = AINSWORTH;
477 LASBASETOPT, &choice_base_value, PETSC_NULLPTR);
480 switch (choice_base_value) {
484 <<
"Set AINSWORTH_LEGENDRE_BASE for displacements";
489 <<
"Set DEMKOWICZ_JACOBI_BASE for displacements";
516 auto project_ho_geometry = [&]() {
525 CHKERR project_ho_geometry();
538 auto time_scale = boost::make_shared<TimeScale>();
540 PetscBool sin_time_function = PETSC_FALSE;
542 &sin_time_function, PETSC_NULLPTR);
544 if (sin_time_function)
545 time_scale = boost::make_shared<DynamicFirstOrderConsSinusTimeScale>();
547 time_scale = boost::make_shared<DynamicFirstOrderConsConstantTimeScale>();
549 pipeline_mng->getBoundaryExplicitRhsFE().reset();
551 pipeline_mng->getOpBoundaryExplicitRhsPipeline(), {NOSPACE},
"GEOMETRY");
554 pipeline_mng->getOpBoundaryExplicitRhsPipeline(),
mField,
"V",
555 {time_scale},
"FORCE",
"PRESSURE", Sev::inform);
565 simple->getProblemName(),
"V");
567 auto get_pre_proc_hook = [&]() {
569 mField, pipeline_mng->getDomainExplicitRhsFE(), {time_scale});
571 pipeline_mng->getDomainExplicitRhsFE()->preProcessHook = get_pre_proc_hook();
578 PetscInt stageindex, Vec *Y) {
582 auto &m_field = ptr->fsRawPtr->mField;
584 auto fb = m_field.getInterface<
FieldBlas>();
588 CHKERR TSGetTime(ts, &time);
590 Vec *stage_solutions;
592 CHKERR TSGetStages(ts, &num_stages, &stage_solutions);
593 PetscPrintf(PETSC_COMM_WORLD,
"Check timestep %d time %e dt %e\n",
594 num_stages, time,
dt);
596 const double inv_num_step = (
double)num_stages;
597 CHKERR fb->fieldCopy(1.,
"x_1",
"x_2");
598 CHKERR fb->fieldAxpy(
dt,
"V",
"x_2");
599 CHKERR fb->fieldCopy(1.,
"x_2",
"x_1");
601 CHKERR fb->fieldCopy(-inv_num_step /
dt,
"F_0",
"F_dot");
602 CHKERR fb->fieldAxpy(inv_num_step /
dt,
"F",
"F_dot");
603 CHKERR fb->fieldCopy(1.,
"F",
"F_0");
615 CHKERR TSGetTime(ts, &time);
627 CHKERR TSGetTime(ts, &time);
629 CHKERR TSGetStepNumber(ts, &step_num);
637 [[maybe_unused]]
auto get_body_force = [
this](
const double,
const double,
648 [[maybe_unused]]
auto get_time_scale = [
this](
const double time) {
649 return sin(time *
omega * M_PI);
652 auto apply_rhs = [&](
auto &pip) {
659 auto mat_v_grad_ptr = boost::make_shared<MatrixDouble>();
661 "V", mat_v_grad_ptr));
663 auto gravity_vector_ptr = boost::make_shared<MatrixDouble>();
664 gravity_vector_ptr->resize(1,
SPACE_DIM);
665 auto set_body_force = [&]() {
668 auto t_force = getFTensor1FromMat<SPACE_DIM, 0>(*gravity_vector_ptr);
669 double unit_weight = 0.;
674 t_force(1) = -unit_weight;
676 t_force(2) = unit_weight;
682 pip.push_back(
new OpBodyForce(
"V", gravity_vector_ptr,
683 [](
double,
double,
double) {
return 1.; }));
686 auto mat_H_tensor_ptr = boost::make_shared<MatrixDouble>();
688 "F", mat_H_tensor_ptr));
705 auto mat_dot_F_tensor_ptr = boost::make_shared<MatrixDouble>();
707 "F_dot", mat_dot_F_tensor_ptr));
710 auto mat_x_grad_ptr = boost::make_shared<MatrixDouble>();
712 "x_2", mat_x_grad_ptr));
714 auto mat_F_tensor_ptr = boost::make_shared<MatrixDouble>();
716 mat_F_tensor_ptr, mat_H_tensor_ptr));
718 auto mat_F_stab_ptr = boost::make_shared<MatrixDouble>();
720 mat_F_tensor_ptr, mat_F_stab_ptr, mat_dot_F_tensor_ptr, tau, xi,
721 mat_x_grad_ptr, mat_v_grad_ptr));
723 PetscBool is_linear_elasticity = PETSC_TRUE;
725 &is_linear_elasticity, PETSC_NULLPTR);
727 auto mat_P_stab_ptr = boost::make_shared<MatrixDouble>();
728 if (is_linear_elasticity) {
733 auto inv_F = boost::make_shared<MatrixDouble>();
734 auto det_ptr = boost::make_shared<VectorDouble>();
742 mat_F_stab_ptr, inv_F, det_ptr));
752 CHKERR apply_rhs(pipeline_mng->getOpDomainExplicitRhsPipeline());
773 boost::shared_ptr<PostProcEle> post_proc,
774 boost::shared_ptr<PostProcFaceEle> post_proc_bdry,
775 boost::shared_ptr<MatrixDouble> velocity_field_ptr,
776 boost::shared_ptr<MatrixDouble> x2_field_ptr,
777 boost::shared_ptr<MatrixDouble> geometry_field_ptr,
778 std::array<double, 3> pass_field_eval_coords,
779 boost::shared_ptr<SetPtsData> pass_field_eval_data)
791 ->evalFEAtThePoint<SPACE_DIM>(
798 auto t_x2_field = getFTensor1FromMat<SPACE_DIM>(*
x2FieldPtr);
801 double u_x = t_x2_field(0) - t_geom(0);
802 double u_y = t_x2_field(1) - t_geom(1);
803 double u_z = t_x2_field(2) - t_geom(2);
806 <<
"Velocities x: " << t_vel(0) <<
" y: " << t_vel(1)
807 <<
" z: " << t_vel(2) <<
"\n";
808 MOFEM_LOG(
"SYNC", Sev::inform) <<
"Displacement x: " << u_x
809 <<
" y: " << u_y <<
" z: " << u_z <<
"\n";
813 std::regex((boost::format(
"%s(.*)") %
"Data_Vertex").str()))) {
817 auto print_vets = [](boost::shared_ptr<FieldEntity> ent_ptr) {
819 if (!(ent_ptr->getPStatus() & PSTATUS_NOT_OWNED)) {
821 <<
"Velocities: " << ent_ptr->getEntFieldData()[0] <<
" "
822 << ent_ptr->getEntFieldData()[1] <<
" "
823 << ent_ptr->getEntFieldData()[2] <<
"\n";
828 print_vets,
"V", &ents);
832 PetscBool print_volume = PETSC_FALSE;
836 PetscBool print_skin = PETSC_FALSE;
848 "out_step_" + boost::lexical_cast<std::string>(
ts_step) +
".h5m");
854 "out_boundary_" + boost::lexical_cast<std::string>(
ts_step) +
878 auto dm =
simple->getDM();
880 auto calculate_stress_ops = [&](
auto &pip) {
883 auto v_ptr = boost::make_shared<MatrixDouble>();
885 auto X_ptr = boost::make_shared<MatrixDouble>();
889 auto x_ptr = boost::make_shared<MatrixDouble>();
893 auto mat_H_tensor_ptr = boost::make_shared<MatrixDouble>();
895 "F", mat_H_tensor_ptr));
897 auto u_ptr = boost::make_shared<MatrixDouble>();
901 auto mat_F_ptr = boost::make_shared<MatrixDouble>();
903 mat_F_ptr, mat_H_tensor_ptr));
905 PetscBool is_linear_elasticity = PETSC_TRUE;
907 &is_linear_elasticity, PETSC_NULLPTR);
909 auto mat_P_ptr = boost::make_shared<MatrixDouble>();
910 if (is_linear_elasticity) {
915 auto inv_F = boost::make_shared<MatrixDouble>();
916 auto det_ptr = boost::make_shared<VectorDouble>();
922 mat_F_ptr, inv_F, det_ptr));
925 auto mat_v_grad_ptr = boost::make_shared<MatrixDouble>();
927 "V", mat_v_grad_ptr));
929 return boost::make_tuple(v_ptr, X_ptr, x_ptr, mat_P_ptr, mat_F_ptr, u_ptr);
932 auto post_proc_boundary = [&]() {
933 auto boundary_post_proc_fe = boost::make_shared<PostProcFaceEle>(
mField);
936 boundary_post_proc_fe->getOpPtrVector(), {},
"GEOMETRY");
940 auto [boundary_v_ptr, boundary_X_ptr, boundary_x_ptr, boundary_mat_P_ptr,
941 boundary_mat_F_ptr, boundary_u_ptr] =
942 calculate_stress_ops(op_loop_side->getOpPtrVector());
943 boundary_post_proc_fe->getOpPtrVector().push_back(op_loop_side);
947 boundary_post_proc_fe->getOpPtrVector().push_back(
951 boundary_post_proc_fe->getPostProcMesh(),
952 boundary_post_proc_fe->getMapGaussPts(),
957 {
"GEOMETRY", boundary_X_ptr},
958 {
"x", boundary_x_ptr},
959 {
"U", boundary_u_ptr}},
962 {
"F", boundary_mat_F_ptr}},
969 return boundary_post_proc_fe;
983 auto ts_pre_post_proc = boost::make_shared<TSPrePostProc>();
989 boost::shared_ptr<DomainEle> vol_mass_ele(
new DomainEle(mField));
999 vol_mass_ele->getOpPtrVector().push_back(
new OpMassV(
"V",
"V", get_rho));
1000 vol_mass_ele->getOpPtrVector().push_back(
new OpMassF(
"F",
"F"));
1003 CHKERR MatAssemblyBegin(
M, MAT_FINAL_ASSEMBLY);
1004 CHKERR MatAssemblyEnd(
M, MAT_FINAL_ASSEMBLY);
1007 CHKERR MatGetRowSum(
M, lumpVec);
1010 CHKERR MatDiagonalSet(
M, lumpVec, INSERT_VALUES);
1016 CHKERR KSPSetFromOptions(ksp);
1019 auto solve_boundary_for_g = [&]() {
1021 if (*(pipeline_mng->getBoundaryExplicitRhsFE()->vecAssembleSwitch)) {
1023 CHKERR VecGhostUpdateBegin(pipeline_mng->getBoundaryExplicitRhsFE()->ts_F,
1024 ADD_VALUES, SCATTER_REVERSE);
1025 CHKERR VecGhostUpdateEnd(pipeline_mng->getBoundaryExplicitRhsFE()->ts_F,
1026 ADD_VALUES, SCATTER_REVERSE);
1027 CHKERR VecAssemblyBegin(pipeline_mng->getBoundaryExplicitRhsFE()->ts_F);
1028 CHKERR VecAssemblyEnd(pipeline_mng->getBoundaryExplicitRhsFE()->ts_F);
1029 *(pipeline_mng->getBoundaryExplicitRhsFE()->vecAssembleSwitch) =
false;
1033 CHKERR KSPSolve(ksp, pipeline_mng->getBoundaryExplicitRhsFE()->ts_F,
D);
1034 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
1035 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
1036 CHKERR VecCopy(
D, pipeline_mng->getBoundaryExplicitRhsFE()->ts_F);
1042 pipeline_mng->getBoundaryExplicitRhsFE()->postProcessHook =
1043 solve_boundary_for_g;
1046 ts = pipeline_mng->createTSEX(dm);
1049 PetscBool field_eval_flag = PETSC_TRUE;
1050 boost::shared_ptr<MatrixDouble> velocity_field_ptr;
1051 boost::shared_ptr<MatrixDouble> geometry_field_ptr;
1052 boost::shared_ptr<MatrixDouble> spatial_position_field_ptr;
1053 boost::shared_ptr<SetPtsData> field_eval_data;
1055 std::array<double, 3> field_eval_coords = {0.5, 0.5, 5.};
1058 field_eval_coords.data(), &dim,
1061 if (field_eval_flag) {
1065 field_eval_data,
simple->getDomainFEName());
1067 field_eval_data->setEvalPoints(field_eval_coords.data(), 1);
1069 auto no_rule = [](
int,
int,
int) {
return -1; };
1071 auto fe_ptr = field_eval_data->feMethodPtr;
1072 fe_ptr->getRuleHook = no_rule;
1073 velocity_field_ptr = boost::make_shared<MatrixDouble>();
1074 geometry_field_ptr = boost::make_shared<MatrixDouble>();
1075 spatial_position_field_ptr = boost::make_shared<MatrixDouble>();
1076 fe_ptr->getOpPtrVector().push_back(
1078 fe_ptr->getOpPtrVector().push_back(
1080 geometry_field_ptr));
1081 fe_ptr->getOpPtrVector().push_back(
1083 "x_2", spatial_position_field_ptr));
1086 auto post_proc_domain = [&]() {
1087 auto post_proc_fe_vol = boost::make_shared<PostProcEle>(mField);
1091 auto [boundary_v_ptr, boundary_X_ptr, boundary_x_ptr, boundary_mat_P_ptr,
1092 boundary_mat_F_ptr, boundary_u_ptr] =
1093 calculate_stress_ops(post_proc_fe_vol->getOpPtrVector());
1095 post_proc_fe_vol->getOpPtrVector().push_back(
1099 post_proc_fe_vol->getPostProcMesh(),
1100 post_proc_fe_vol->getMapGaussPts(),
1104 {{
"V", boundary_v_ptr},
1105 {
"GEOMETRY", boundary_X_ptr},
1106 {
"x", boundary_x_ptr},
1107 {
"U", boundary_u_ptr}},
1109 {{
"FIRST_PIOLA", boundary_mat_P_ptr}, {
"F", boundary_mat_F_ptr}},
1116 return post_proc_fe_vol;
1119 boost::shared_ptr<FEMethod> null_fe;
1120 auto monitor_ptr = boost::make_shared<Monitor>(
1122 post_proc_boundary(), velocity_field_ptr, spatial_position_field_ptr,
1123 geometry_field_ptr, field_eval_coords, field_eval_data);
1126 null_fe, monitor_ptr);
1130 CHKERR TSSetExactFinalTime(ts, TS_EXACTFINALTIME_MATCHSTEP);
1135 CHKERR TSSetSolution(ts, T);
1136 CHKERR TSSetFromOptions(ts);
1142 boost::shared_ptr<ForcesAndSourcesCore> null;
1145 ptr->fsRawPtr =
this;
1147 CHKERR TSSolve(ts, NULL);
1148 CHKERR TSGetTime(ts, &ftime);
1158 PetscBool test_flg = PETSC_FALSE;
1166 CHKERR VecNorm(T, NORM_2, &nrm2);
1167 MOFEM_LOG(
"EXAMPLE", Sev::inform) <<
"Regression norm " << nrm2;
1168 constexpr double regression_value = 0.0194561;
1169 if (fabs(nrm2 - regression_value) > 1e-2)
1171 "Regression test failed; wrong norm value.");
1189 const char param_file[] =
"param_file.petsc";
1193 auto core_log = logging::core::get();
1202 DMType dm_name =
"DMMOFEM";
1207 moab::Core mb_instance;
1208 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< PETSC >::LinearForm< GAUSS >::OpBaseTimesVector< 1, SPACE_DIM, SPACE_DIM > OpInertiaForce
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 >::OpBaseTimesVector< 1, SPACE_DIM *SPACE_DIM, SPACE_DIM *SPACE_DIM > OpRhsTestPiola
FormsIntegrators< DomainEleOp >::Assembly< AssemblyType::PETSC >::LinearForm< IntegrationType::GAUSS >::OpGradTimesTensor< 1, SPACE_DIM, SPACE_DIM > OpGradTimesTensor2
constexpr double young_modulus
PetscErrorCode DMCreateMatrix_MoFEM(DM dm, Mat *M)
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.
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, RowColData rc=RowColData::COL)
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)
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
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 MatrixDouble 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, ScalarDataPtr > DataMapVec
std::map< std::string, boost::shared_ptr< MatrixDouble > > DataMapMat
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