50 Range all_boundary_ents;
54 Range domain_ents_part;
56 Range domain_faces, boundary_faces;
59 moab::Interface::UNION);
60 boundary_faces = intersect(domain_faces, all_boundary_ents);
65 for (
auto &face_ent : boundary_faces) {
68 adj_tet, moab::Interface::UNION);
69 if (adj_tet.size() != 1)
72 "There should be only one ent adjacent to the boundary ent");
74 std::variant<int, double> data;
85 "Wrong data type %d for tag",
type);
152 CHKERR PetscOptionsGetReal(PETSC_NULLPTR,
"",
"-ref_adapt_threshold",
155 Tag th_error_ind, th_order;
159 std::vector<Range> refinement_levels(ref_level + 2);
161 Range domain_ents_part;
164 for (
auto ent : domain_ents_part) {
165 double err_indic = 0;
176 for (
int ll = refinement_levels.size() - 1; ll > 1; ll--) {
177 CHKERR comm->synchroniseEntities(refinement_levels[ll]);
182 moab::Interface::UNION);
185 moab::Interface::UNION);
186 tets = subtract(tets, refinement_levels[ll]);
187 refinement_levels[ll - 1].merge(tets);
190 for (
int ll = 1; ll < refinement_levels.size(); ll++) {
192 if (
oRder + ll > 8) {
194 <<
"setting approximation order higher than 8 is not currently "
199 for (
auto ent : refinement_levels[ll]) {
204 Range ents_to_refine;
205 ents_to_refine.merge(refinement_levels[ll]);
207 Range lower_dim_ents;
210 moab::Interface::UNION);
211 ents_to_refine.merge(lower_dim_ents);
214 CHKERR comm->synchroniseEntities(ents_to_refine);
222 CHKERR comm->synchroniseFieldEntities(
"U");
238 auto integration_rule = [](int, int,
int p_data) {
return 2 * p_data + 1; };
240 auto &skeleton_pipeline = pipeline_mng->getOpSkeletonRhsPipeline();
242 if (skeleton_pipeline.empty()) {
248 op_loop_side->getOpPtrVector(), {H1},
"GEOMETRY");
251 auto common_ptr = HookeOps::commonDataFactory<SPACE_DIM, GAUSS, DomainEle>(
252 mField, op_loop_side->getOpPtrVector(),
"U",
"MAT_ELASTIC",
255 auto mat_jump_ptr = boost::make_shared<MatrixDouble>();
257 "U", common_ptr->getMatCauchyStress(), mat_jump_ptr));
260 op_ptr->doWorkRhsHook = [
this, th_error_ind,
261 mat_jump_ptr](DataOperator *base_op_ptr,
int side,
263 EntitiesFieldData::EntData &data) {
267 auto fe_ent = op_ptr->getFEEntityHandle();
269 auto t_jump = getFTensor1FromMat<SPACE_DIM>(*mat_jump_ptr);
270 auto t_w = op_ptr->getFTensor0IntegrationWeight();
272 const auto nb_gauss_pts = op_ptr->getGaussPts().size2();
273 for (
auto gg = 0; gg != nb_gauss_pts; ++gg) {
274 err_int += t_w * (t_jump(
i) * t_jump(
i));
278 double err_measure = sqrt(err_int);
285 skeleton_pipeline.push_back(op_loop_side);
286 skeleton_pipeline.push_back(op_ptr);
295 pipeline_mng->getSkeletonRhsFE());
297 Range domain_ents_part;
300 ParallelComm *pcomm =
303 CHKERR pcomm->reduce_tags(th_error_ind, MPI_SUM, empty_range);
305 std::array<double, 3> error_indic_loc = {0.0, 0.0, 0.0};
307 for (
auto domain_ent : domain_ents_part) {
310 &domain_ent, 1,
SPACE_DIM - 1,
true, face_ents, moab::Interface::UNION);
312 double err_indic_sum = 0;
313 for (
auto face_ent : face_ents) {
314 double err_indic = 0;
317 err_indic_sum += err_indic;
324 const EntityHandle *vert_conn;
328 std::vector<double> vpos(3 * vert_num);
330 double vol = Tools::tetVolume(vpos.data());
338 static_cast<double>(domain_ents_part.size());
340 std::array<double, 3> error_indic_glob = {0.0, 0.0, 0.0};
342 MPI_Allreduce(&error_indic_loc[0], &error_indic_glob[0], 3, MPI_DOUBLE,
348 MOFEM_LOG(
"WORLD", Sev::inform) <<
"Global error indicator (norm): "