34 const std::string &physWall,
const std::string &physOpen) {
36 const double x0 = lo.
d_x, y0 = lo.
d_y, z0 = lo.
d_z;
37 const double x1 = hi.
d_x, y1 = hi.
d_y, z1 = hi.
d_z;
38 const double Lx = x1 - x0;
39 const double Ly = y1 - y0;
40 const double Lz = z1 - z0;
41 const double horizTol = std::max(tol, 1.0e-9 * std::max({Lx, Ly, Lz, 1.0}));
43 std::vector<std::pair<int, int>> bnd;
45 gmsh::model::getBoundary({{3, volumeTag}}, bnd,
false,
false);
47 std::vector<int> wallTags;
48 std::vector<int> openTags;
49 wallTags.reserve(bnd.size());
50 openTags.reserve(bnd.size());
52 for (
const auto &pr : bnd) {
55 const int surfTag = std::abs(pr.second);
56 double xmin = 0., ymin = 0., zmin = 0., xmax = 0., ymax = 0., zmax = 0.;
57 gmsh::model::getBoundingBox(pr.first, surfTag, xmin, ymin, zmin, xmax, ymax, zmax);
58 const double dx = xmax - xmin;
59 const double dy = ymax - ymin;
60 const double dz = zmax - zmin;
61 const double cx = 0.5 * (xmin + xmax);
62 const double cy = 0.5 * (ymin + ymax);
63 const double cz = 0.5 * (zmin + zmax);
64 const double emin = minEdge2D(dx, dy, dz);
65 const double emax = maxEdge2D(dx, dy, dz);
66 const bool thin = emin < horizTol * std::max(1.0, 0.1 * emax);
72 isOpen = cx > x1 - t - 2. * horizTol && std::abs(dx - t) < 0.25 * t + horizTol;
75 isOpen = cx < x0 + t + 2. * horizTol && std::abs(dx - t) < 0.25 * t + horizTol;
78 isOpen = cy > y1 - t - 2. * horizTol && std::abs(dy - t) < 0.25 * t + horizTol;
81 isOpen = cy < y0 + t + 2. * horizTol && std::abs(dy - t) < 0.25 * t + horizTol;
84 isOpen = cz > z1 - t - 2. * horizTol && dz < horizTol * 10.;
87 isOpen = cz < z0 + t + 2. * horizTol && dz < horizTol * 10.;
95 openTags.push_back(surfTag);
97 wallTags.push_back(surfTag);
100 if (!wallTags.empty()) {
101 const int g = gmsh::model::addPhysicalGroup(2, wallTags, -1);
102 gmsh::model::setPhysicalName(2, g, physWall);
104 if (!openTags.empty()) {
105 const int g = gmsh::model::addPhysicalGroup(2, openTags, -1);
106 gmsh::model::setPhysicalName(2, g, physOpen);
void physicalGroupsWallOpenFromFace3D(int volumeTag, int openFace, const util::Point &lo, const util::Point &hi, double t, double tol, const std::string &physWall, const std::string &physOpen)