openairbearing.core.meshes

Meshes for film domains, with quadratic elements and curved edges.

Each builder returns (basis, edges) where edges maps an edge name to the degrees of freedom on it. Lengths are in m and angles in rad. Flat faces use their own (x, y). A cylinder is unrolled to (s, z) with s = R·theta, which is exact because the surface is developable, and is periodic in s. Any other surface of revolution is meshed in (s, theta), periodic in theta (unwrapped).

Annular meshes are structured in (r, theta) and curved so that circles are represented to the accuracy of the quadratic elements. The disc is an O-grid.

annulus(r_in: float, r_out: float, n_circ: int = 96, n_radial: int = 16, grading=2.0)[source]

Closed annular face, refined toward both circles.

Edges: “inner”, “outer”. n_circ and n_radial are the numbers of elements around and across; grading = 1 is uniform across.

annular_sectors(r_in: float, r_out: float, n_pads: int = 3, pad_angle: float = np.deg2rad(100.0), offset: float = 0.0, n_circ: int = 20, n_radial: int = 12, grading: float = 2.0)[source]

Sector pads of an annulus, equally spaced, as one mesh.

Pad k is centred at angle offset + 2 pi k / n_pads and spans pad_angle, with n_circ elements along its arc and n_radial across. Every pad is refined toward its four edges, and its curved edges follow the circles to the accuracy of the quadratic elements. The edge “edge” is every edge of every pad.

cylinder(radius: float, length: float, n_circ: int = 96, n_axial: int = 16, z_centre: float = 0.0, grading: float = 2.0, axial_marks=())[source]

Full cylinder unrolled to (s, z), periodic in s, refined toward both ends.

Edges: “end_low”, “end_high”, at z = z_centre - length / 2 and z_centre + length / 2. n_circ and n_axial are the numbers of elements around and along the axis; grading = 1 is uniform along the axis. axial_marks are axial positions that must carry a line of nodes, such as the edges of a feed groove behind the restrictor; the nearest line of the graded mesh is moved onto each (marked).

cylinder_pads(radius: float, length: float, n_pads: int = 3, pad_angle: float = np.deg2rad(100.0), offset: float = 0.0, n_circ: int = 20, n_axial: int = 12, z_centre: float = 0.0, grading: float = 2.0)[source]

Partial-arc pads of a cylinder, unrolled to (s, z), as one mesh.

Pad k is centred at angle offset + 2 pi k / n_pads and spans pad_angle, with n_circ elements along its arc and n_axial along the axis; s = radius·theta and z runs length / 2 to either side of z_centre. Every pad is refined toward its four edges. The edge “edge” is every edge of every pad.

disc(radius: float, nrefs: int = 4, grading: float = 2.0, rings=(), radial: int | None = None)[source]

Circular face of quadrilaterals, refined toward the rim.

An O-grid: a square core with bent sides at the centre, a band that turns it into a circle, and from there rings of elements between circles, out to the rim. Lines of nodes run straight from the core to the rim at equal angles. Stacked through the depth of a restrictor these elements are hexahedra. The edge is “rim”.

  • nrefs: the core has 2**(nrefs - 1) elements along a side, so there are four times as many around; half as many layers turn the core into the first circle and, without rings, as many again as the core has along a side lie between that circle and the rim. One more refinement divides the error by about 15 (flow of a porous pad at a 1 µm film: 2.9e-4 at nrefs = 4).

  • grading: the rings get thinner toward the rim, where the pressure falls to ambient: the last one is (1 / their number)**grading of the distance from the first circle to the rim. 1 is uniform. Of 1.5, 2 and 2.5, 2 gives the smallest load error and a flow error within a tenth of the smallest.

  • rings: radii that carry a circle of nodes, such as the edges of a feed groove or hole behind the restrictor, or of an insert. The first circle is at 0.75 of the radius or at the smallest of these radii, whichever is less, so a small one makes a small core. The elements get thinner toward each of these radii from both sides, down to the thickness of the rim ring of the plain mesh, and toward the rim: at the edge of a feed the pressure in the restrictor is singular. That takes more rings, about twice the elements for two radii. For a pad of 18.5 mm fed between 8 and 12 mm the load at nrefs = 4 is 0.02 % high, against 2.3 % low without the circles.

  • radial: the refinement along the radius, when it should differ from nrefs: the layers to the first circle and the rings are those of nrefs = radial, while nrefs still sets the core and the number of elements around. For a pad whose solution does not change around (axial motion, feeds in circles about the centre) a low nrefs with a higher radial costs a fraction of the same refinement everywhere: a ring-fed pad at nrefs = 2, radial = 3 has stiffness and flow within 0.3 % of nrefs = 4.

The rim is a parabola through three points of the circle on each element, which leaves the area short by a fraction pi**4 / (30 N**4) for N elements around (3e-6 at nrefs = 4). nrefs and radial below 2, and rings outside the pad, are a ValueError.

disc_circles(radius: float, circles, nrefs: int = 3)[source]

Circular face of quadratic triangles whose edges follow given circles.

circles are (x, y, r) each: the centre and the radius of a circle, such as the edge of a feed insert or of a hole set off the centre of the pad. They may lie side by side or one inside another, but neither cut nor touch each other or the rim. A feed whose edges are these circles is then exact up to the curved elements, where on disc an off-centre one would be a staircase of elements. The edge is “rim”.

The face is triangulated with nodes along every circle and the rim; the other nodes are spread by the spring model of DistMesh (P.-O. Persson, G. Strang, SIAM Review 46 (2004) 329-345) to a length that is smallest on the circles and the rim, and where they come close to each other, and grows away from them. The elements are quadratic triangles (six nodes); an edge on a circle is a parabola through three points of it, as the rim of disc: the area inside a circle of N elements is short by about pi**4 / (30 N**4) of it. Triangles, not quadrilaterals: these nodes have no structure to give quadrilaterals a grading or square corners.

nrefs: one more halves every element. A circle has at least 3·2**nrefs elements around. The mesh has no symmetry; it is the same on every call (the random thinning of the starting nodes has a fixed seed). Its size, and the memory and time it takes, follow the elements it makes: a gap g between circles of radius r adds about (r / g)**0.5 elements along it, a small circle about 3·2**nrefs around it.

nrefs below 2, a circle that is not (x, y, r) with r > 0, and a circle that cuts, touches or coincides with another or the rim (to 1e-12 of the radius) are a ValueError.

element_edges(basis, steps: int = 4) → ndarray[source]

Points along every edge of every element, for drawing the mesh.

Returns an array of shape (2, elements, edges, steps + 1): each edge of each element at steps + 1 equally spaced points of the reference element, from one corner to the next, through the element’s own geometry. That is the geometry the solver integrates over, so a curved edge comes out curved and a surface that closes on itself is unrolled with its seam at both ends. An edge shared by two elements appears in both.

graded(start: float, stop: float, n: int, ratio: float = 2.0) → ndarray[source]

n nodes from start to stop, refined toward both ends for ratio > 1.

The end elements are (2 / (n - 1)) ** ratio of half the length; ratio = 1 is uniform.

marked(nodes: ndarray, marks) → ndarray[source]

The nodes with the nearest interior one moved onto each mark.

Every mark needs a node of its own, so there must be enough of them between the ends: a mark outside the ends, more marks than interior nodes, or nodes left out of order are a ValueError.

rectangle(lx: float, ly: float, nx: int = 32, ny: int = 32, grading: float = 2.0)[source]

Rectangle of lx by ly centred at the origin, refined toward its edges.

Edges: “left”, “right” (x = -lx/2, lx/2), “bottom”, “top” (y = -ly/2, ly/2). nx and ny are the numbers of elements; grading = 1 is uniform.

reference_corners(basis) → ndarray[source]

Corners of the reference element of a basis, in order around it: (2, corners).

triangles(basis, nodal, max_elements: int = 4000) → tuple[source]

A nodal field as flat triangles, for drawing.

Returns (x, t, values): points of shape (2, n), triangles of shape (3, m) and the field at the points. Each quadratic element is cut into four flat pieces, unless the mesh has more than max_elements elements, and each quadrilateral into two triangles.

unwrapped(s_nodes, n_theta: int = 48)[source]

Surface of revolution in (s, theta), periodic in theta.

s_nodes are the node positions along the meridian in m and n_theta the number of elements around; theta is in rad. The mesh does not know the radius at each s: give it to the film as its metric. Edges: “s_min”, “s_max”.