openairbearing.study¶
Studies: one request in, one result document out.
A study evaluates one or more bearing cases over zero, one or two swept quantities. Request and result are plain JSON-ready dicts in SI units, so the same call serves a script, a notebook and a web front end:
result = run({
"cases": [
{"name": "A", "case": {"kind": "circular_pad"}},
{"name": "B", "case": {"kind": "circular_pad", "radius": 25e-3}},
],
"sweep": [{"path": "position.h", "values": [3e-6, 5e-6, 8e-6]}],
})
result["cases"][0]["outputs"]["force.h"]["values"] # N, one per gap
A case entry may also hold “position”, the coordinates that differ from the default position of its kind. A swept path is either “position.<name>” (h, rx, x, … of the position) or a case field by dotted path (“ps”, “porous.kappa”, “radius”). Every case in the request is swept over the same axes, which is what makes them comparable; a path a case does not have is an error. “stiffness”: True in the request adds the static stiffness matrix to the outputs of every point (“stiffness.h.h”, …).
Each output holds its SI unit, its display unit and an array shaped like the sweep axes. A point that cannot be evaluated (contact, no convergence) is None in every output and listed under “errors” with its index and the reason.
Besides run there are computations on one case at one position, for a
form to show beside the study: field (pressure and gap over the film),
mesh, free_flow and permeability.
- cache_key(request: dict) str[source]¶
SHA-256 (hex) of the model version and the request with sorted keys.
- field(case_doc: dict, position: dict | None = None) dict[source]¶
Pressure and gap over the film of one case at one position.
position holds the coordinates that differ from the default position of the case. Returns a JSON-ready triangle mesh in the film coordinates: “x”, “y” (with their names and units), the triangles “i”, “j”, “k”, and nodal “p” (absolute pressure, Pa) and “h” (gap, m), plus the ambient pressure “pa” (Pa) and the integrated “outputs” of that point. Raises ValueError for a bad case or position and FilmSolveError (a RuntimeError) if the point cannot be solved.
- free_flow(case_doc: dict, measured_at: dict | None = None) dict[source]¶
Free flow of every restrictor of a case, the usual permeability measurement.
The bare restrictor vents from a supply pressure straight to the ambient pressure of the case, with no film in front of it (see
core.film.free_flow). measured_at gives the absolute supply pressure of the measurement in Pa for each restrictor, {“porous”: 0.5e6}; a restrictor it leaves out is measured at the supply pressure of the case. Returns the flow as free gas at ambient pressure with its unit, {“unit”, “display”, “scale”, “values”: {“porous”: m³/s, …}}: one value per restrictor of the case, each over its own face. Raises ValueError for a bad case, a pressure not above ambient, a restrictor the relation does not cover (fed over part of its back, or with an open rim) and a monolithic thrust bushing (core.free_flowcomputes that one).
- free_flow_offered(case_doc: dict, what: str = 'The free flow of each restrictor')[source]¶
Raise ValueError if free flow is not offered for a case; builds nothing.
For a caller that would otherwise build the film first (the server counts its nodes): the body of a monolithic thrust bushing takes far longer to build than a form can wait for.
whatstarts the message.
- idle_rules(kind: str) dict[source]¶
When a field of a case kind has no effect on a study, and why.
Returns {field path: [rule, …]} for the fields that can be without effect. A rule is {“path”: other field, “is”: [values], “why”: text}: the field changes nothing while the other field has one of those values. A form uses this to mark such fields instead of leaving the user to find out from identical results.
- mesh(case_doc: dict, max_drawn: int = 20_000) dict[source]¶
The film mesh of one case, for drawing: where the elements are and how many.
Returns the element edges in the film coordinates as one broken line, “lines”: {“x”: […], “y”: […]} with None between edges, next to “x” and “y” (name, unit and display unit of each coordinate), the number of “elements” and of “nodes” (the pressure unknowns: the elements are quadratic, so there is a node on every edge too). An edge that is curved in the film coordinates is drawn through five points on it. A surface that closes on itself (a journal) is shown unrolled, with the seam at both ends. “edge” holds the shortest and the longest element edge in m when both coordinates are plain lengths, and is None for a surface with a metric, where the film coordinates are not distances.
A mesh of more than max_drawn elements is counted and measured but not drawn: “lines” is then None, because the edges would be tens of megabytes that show as a solid area. Raises ValueError for a bad case.
- permeability(case_doc: dict, restrictor: str, flow: float, measured_at: float | None = None) float[source]¶
Permeability (m²) that gives a restrictor of a case the free flow
flow.The inverse of
free_flow: flow is in m³/s of free gas at the ambient pressure of the case, measured at the absolute supply pressure measured_at (Pa; the supply pressure of the case if not given); restrictor names the one it was measured on (“porous”). Everything else about the case stays as it is, so thickness, face area, wall curvature, gas, inertial resistance and Knudsen skin are those of the case. Raises ValueError for a flow that is not positive, if no permeability gives that flow (the inertial resistance or the skin alone limits it) and wherefree_flowdoes.
- position_display(name: str) dict[source]¶
Label, SI unit, display unit and scale of a position coordinate.
- run(request: dict, progress=None, executor=None) dict[source]¶
Run a study request and return its result document.
The result holds “axes” (as
validatereturns them), one entry per case under “cases” with its “outputs” and “errors”, and “provenance” with the model version, the cache key and the running time in s. Raises asvalidatedoes for a request that cannot be run.progress, if given, is called as progress(done, total) as points finish; raising from it cancels the run. executor, if given, is a concurrent.futures executor (normally a ProcessPoolExecutor) that the points are dealt out to; without one they are solved here, in order. With an executor, progress is also called about twice a second while nothing finishes, so that a run can be stopped during a long solve; a solve that has started is not interrupted by that, only abandoned.
- solve_count(request: dict) int[source]¶
Film solves a request asks for.
One per case and sweep point; stiffness costs two more per position coordinate at every point.
workweighs them by the size of the mesh.
- validate(request: dict) list[source]¶
Check a request without solving anything; return its sweep axes.
An axis is {“path”, “label”, “unit”, “display”, “scale”, “values”}, with the values in the SI unit. Raises ValueError with the reason if the request cannot be run, also for a key the request, a case entry or a sweep axis does not take (_REQUEST_KEYS, _ENTRY_KEYS, _AXIS_KEYS). An axis may also hold what an axis of a result carries (label, unit, display, scale: _AXIS_SHOWN), which is ignored, so that an axis of a result can be swept again as it is. A request that is not shaped as the module describes can also raise KeyError, TypeError or AttributeError.
- work(request: dict) dict[source]¶
What a request will cost, found without solving anything.
The number of solves alone does not say how long a study runs: a solve on the largest mesh takes hundreds of times longer than one on the default mesh, and the volume restrictor model 17 to 90 times longer than the column model on the same mesh (counted VOLUME_WEIGHT times, its worst case on a mesh a public server allows). Returns
“solves”: film solves, as
solve_count;“nodes”: pressure unknowns of the largest film mesh among the cases;
“nodes_volume”: the same among the cases that use the volume model or a porous body (0 if none does);
“nodes_body”: nodes of the largest porous body among the cases (0 if none has one);
“work”: the sum over the cases of solves × nodes, with the solves of the volume model counted VOLUME_WEIGHT times, and those of a case on a porous body as its body nodes counted BODY_WEIGHT times.
A swept whole-number field (a mesh size, a number of pads) counts at its largest value. Each case says its size without being solved (
Case.size): a film takes well under a second to build even for the largest mesh, and a porous body is counted without being built. Raises ValueError for a case that cannot be built.