Mesh inputs and GUI-only operations¶
Repitch a blade¶
Save this as morphing.toml beside a mesh with a blade named Blade1 and a hub
named Spinner. This example uses a pitch axis through the origin along +Z:
[repitch]
angle_deg = 1.0
blades = ["Blade1"]
hub = ["Spinner"]
keep = []
axis = { origin = [0.0, 0.0, 0.0], direction = [0.0, 0.0, 1.0] }
max_angle_deg = 5.0
pyfs-mesh repitch sector.obj --morphing morphing.toml --out pitched.obj
This call is exercised on a synthetic blade and quad-ring hub in the offline tests. Set the origin and direction to the blade's pitch line, in the mesh coordinates. A positive angle is a right-handed rotation about that directed line; orient the line so this adds pitch for your rotor. The angle is a change from the source blade, not an absolute blade setting. Reversing the axis reverses the sign.
For a reference-defined rotor, replace axis with axis = "auto", add
reference = "../references/rotor.toml", and use blades = "all" for a wheel.
The reference's rotor origin, axis, blade1.zero, blade1.azimuth_deg and ordered
families_blades define equally spaced radial pitch axes. Their directed sense is
inward for rpm_sign = 1 (the default) and outward for rpm_sign = -1, so positive adds pitch
from the local rotation plane toward the axial direction, using the chord from
leading to trailing edge opposite the direction of blade travel. Use rotor = "ROTOR"
when the reference has multiple rotors. Coordinates of explicit axes use mesh units;
reference origins are converted from metres to the mesh's declared unit. An unstated
mesh unit is warned and interpreted as metres.
For another pitch line on each blade, use [repitch.axes.Blade1] with origin
and direction, and equivalent tables for the other blades. To have the code find each
blade's pitch line from the rotor axis and a reference point, state rotor_axis and
reference_point instead; see Morph a sector or a wheel.
How the hub follows the blade. hub_method in [repitch] chooses one of two routes:
hub_method = "auto" # the default; or "rings", or "remesh"
# band_width = 0.02 # remesh only: the band's width in the mesh's unit
"rings"needs at least two complete quad rings around each blade root, as an O-grid hub has; a quad-dominant hub gets them frompyfs-mesh hub-ringsor the[hub_rings]table ofpyfs-mesh morph. The operation recovers all complete source rings and carries their local orientation with the rotated blade, tapering the displacement to zero at the outer ring. Interior nodes are projected onto source faces. Winslow smoothing in a local surface chart is accepted only when it improves the minimum corner scaled Jacobian. Zero angle retains the source coordinates exactly. Outer rings, other boundaries, connectivity and face order remain unchanged. This is an incremental rebuild of the hub grid; it does not redistribute cell counts. It is the only route on a saved.fsm."remesh"(OBJ only) works on a quad-dominant hub as it is. Around each root it takes out the hub faces withinband_widthof the root plus one layer, and remeshes the band between the turned root and the band's unmoved boundary quad-dominant, asrefineremeshes a quad-dominant family, every free node on the source hub. The band never reaches a seam, another family or another blade's band; a band that would is narrowed a tenth at a time and warned.band_widthdefaults to the root's largest move plus two local cells (the median length of the hub edges leaving the root), the depth of the two rings the ring route needs. At least two rows of quads are marched around the turned root and only the gap beyond them is remeshed. Each band is held to a target: a least scaled Jacobian at least half the source band's and a largest aspect at most twice the source band's. Up to three band widths are tried (the first and two more, each one local cell wider, while they fit), with graded rows and then rows of one height, each remesh sized by the source hub and then by its two loops, at the remesh passes; the first with no cell turned against the hub that meets its target is kept, otherwise the one with the fewest turned cells and the largest margin to its target, and a miss is warned with its numbers. Kept hub faces keep their order, the new faces take the place of the first face taken, and the band is remeshed at every angle, zero included, so a series of angles shares one method."auto"takes"rings"where every named root has two complete quad rings, and"remesh"otherwise. A root whose trailing edge was collapsed keeps the ring route, which then refuses naming the working order (see Collapse a blunt trailing edge).
<out>.repitch.json names the route each blade took (hub_route) and, for the remesh,
hub_remesh per blade: the band width and how it was found, the faces taken and added, and
the quality of the source band beside the new band (least and largest scaled Jacobian and
aspect, folded cells, quad share, mean edge and the size ratio of the two). A new band worse
than the source band (a lower least scaled Jacobian or a higher largest aspect) is warned
with both numbers.
Shared root nodes follow the rigid blade rotation; the interior projection does not alter them. The checks print and save the root's distance from the source hub surface in metres and local cell edges. A root stand-off above half a local edge warns once: the hub shape near the root changes by this amount. Inspect that seam even when the rebuild passes.
Quality is warned, not refused. A folded or reversed hub cell, a moved non-root hub node
farther than 1e-8 local cell edges from the source faces, a new cell turned against the hub
and a new node off the hub are each warned with their numbers (the count, the least scaled
Jacobian, the worst node and its distance) and the mesh is written; checks.passed is then
false and checks.warnings lists them. Only a broken input or a broken invariant refuses:
nonfinite coordinates, an edge over two faces, a kept node, face or open boundary that
moved, a frozen loop node that moved, an unreadable control file.
Read <out>.repitch.json, inspect the root seam and leading edge, then perform a
short solver check. The geometric checks do not establish aerodynamic accuracy.
Choose a new output name for each change; existing outputs are refused.
Collapse a blunt trailing edge¶
A blade whose trailing edge ends in a one-cell base strip can be made sharp on the OBJ.
Add a [collapse_te] table to the same morphing.toml that holds [repitch]; each verb
reads its own table. The operation works on the OBJ; a saved .fsm is refused.
[collapse_te]
blades = ["Blade1"]
# base = ["Blade1Base"]
pyfs-mesh collapse-te sector.obj --morphing morphing.toml --out sharp.obj
blades names the families, or "all" for every family whose boundaries file declares a
blunt trailing edge. The rims come from the boundaries file beside the OBJ: its two rim
entries (or one points set naming both rims) give the two sides of the strip. Without a
boundaries file, or to name the strip directly, add base = ["Blade1Base"], one group per
blade in the order of blades; the rims are then the strip's two sides against the blade.
The strip may be in the blade's own group (declared by points) or in a group of its own.
Each node of one rim is paired with the node of the other rim joined to it across the strip,
from root to tip, and each pair is merged at its midpoint. The strip faces are deleted. A face
that met the strip loses its repeated node: a quad on the rung becomes a triangle, a tip cap
loses a node, and a triangle that reaches zero area is deleted. Every other node keeps its
text and its place in the node list, and every other face its place and node order. Rims with
different node counts, or a strip more than one cell wide, are refused naming the blade.
A blade that declares one rim with no strip on its nodes is taken as already sharp, warned and
skipped; when nothing is left to collapse, no file is written and the exit status is 2. A blade
whose skins are two families around a strip group has one rim on each, so name the strip group
in blades to collapse it.
The boundaries file written beside the output carries one trailing-edge line for each
collapsed blade (the label and edge type of the first rim, one wake termination at the merged
root when the source declares terminations), no base region for the removed strip, and every
other marking at its new position. A blade named through base with no rim entry gets a new
entry under its family name, with the edge type of the removed base region's points file, or
STANDARD, and the wake termination nodes that region's rim declares, at their new position.
Without a boundaries file, or when that file cannot take an entry (it states no
fs_build, none = true or a detection route, which a warning names), the line is written to
<out-stem>.<blade>.te.txt. An [[import.operations]] entry on a family the collapse
removes, or on the name a rename gave it, is warned and skipped. A marking that lies on an
edge of the removed strip is refused. Read <out>.collapse.json for the strip faces removed, the closure faces, the nodes
merged and the largest node move for each blade, with the base thickness; the operation
reports the thickness and sets no limit on it. A face near the trailing edge that the merge
turns over is warned with the count, the worst cosine and its place, and the mesh is written
(checks.turned_faces, checks.passed false).
Order with repitch. The ring route of repitch needs complete quad rings around the blade
root, which the closure triangle of a collapsed root breaks, and hub_method = "auto" keeps
the ring route on such a root. Run repitch first, then collapse-te on its output. The two
commute on the blade, because the pitch change is a rigid rotation.
Morph a sector or a wheel¶
One control file drives the whole morphing of a rotor's OBJ: hub rings, repitch, the collapse
of a blunt trailing edge and, for a sector, the full wheel. blades and hub sit at the top of
the file and serve every table; each table may state its own, which wins. The rotor axis and the
reference point of the pitch change live in [repitch].
A sector, which ends as a full wheel:
blades = ["Blade1"]
hub = ["Spinner"]
[hub_rings]
rings = 4 # band_width optional
[repitch]
angle_deg = 2.0
rotor_axis = "x" # or a vector, [1.0, 0.0, 0.0]
reference_point = 0.25 # a coordinate along the rotor axis, or a point [x, y, z]
[collapse_te]
[wheel] # a sector only
center = [0.0, 0.0, 0.0] # rotor-axis point, independent of reference_point
A full wheel, installed or not: every blade is named and there is no [wheel]. Every family
that is neither blade nor hub, a wing or a fuselage, stays to the bit. With no [hub_rings],
repitch remeshes the quad-dominant hub around each turned root (hub_method = "auto" takes
the remesh where a root has no complete quad rings):
blades = ["Blade1", "Blade2", "Blade3", "Blade4", "Blade5", "Blade6"]
hub = ["Spinner"]
[repitch]
angle_deg = 2.0
rotor_axis = "x"
reference_point = 0.25
hub_method = "remesh" # or "auto" (the default) or "rings"
# band_width = 0.02 # default the root's largest move plus two local cells
[collapse_te]
pyfs-mesh morph sector.obj --morphing morphing.toml --out morphed.obj
The chain works on a sector and on a full wheel, installed beside an airframe or not, with or
without [hub_rings]. Each remeshed band is held to half its source band's least scaled
Jacobian and twice its largest aspect, and a band that misses is warned with its numbers;
a face the trailing-edge merge turns over is warned the same way and the mesh is written.
morph works on the OBJ; a saved .fsm is refused. It applies the tables the file holds in one fixed
order, [hub_rings], [repitch], [collapse_te], [wheel]: the ring route of repitch needs
the rings, and the collapse leaves a closure triangle on the first ring, so no other order
works. [hub_rings] is optional: without it, repitch's hub_method decides how the hub
follows each blade (see Repitch a blade). Each step is the verb of
the same name with all its checks. One OBJ is written with its boundaries file, the points files
that file names and <out>.morph.json, which holds every step's checks. A quality finding in any
step is warned with its numbers and the chain goes on; when a step refuses a broken input or
invariant, nothing is written beside the output.
Hub rings. The ring route of repitch needs complete rings of quads around each blade
root, which a quad-dominant hub lacks. [hub_rings] builds rings rows of quads with as many nodes as the
root loop, marched outward on the hub, takes out the hub faces they reach plus one layer, and
remeshes the band between the outer ring and that hole quad-dominant, every node on the source
hub. band_width, the total height of the rings in the mesh's unit, defaults to rings times the
median length of the hub edges that leave the root. A hub face on an open boundary (a sector's
seam) or on another family is never taken, so the seams stay node for node and the wheel still
merges; rings that would need one are refused, naming a width that fits every blade. The same
table runs
alone as pyfs-mesh hub-rings sector.obj --morphing morphing.toml --out rings.obj.
The pitch axis. The code finds each blade's span direction, the principal axis of its nodes,
and the pitch axis is that direction projected on the plane perpendicular to rotor_axis.
rotor_axis is x, y or z when it is already the mesh's frame, or a vector. A scalar
reference_point is a coordinate along the rotor axis: it places that plane, and every pitch
axis passes through the hub centre in it, the centroid of the hub's cut by the plane on a full
wheel (so all the pitch axes of a wheel cross one point) or the centre of the circle fitted to
the cut's arc on a sector. A point [x, y, z] is one point for every blade. <out>.morph.json
reports the centre, the fit residual and each blade's directions, and a pitch axis that passes
outside its blade's root is warned with the distance. A positive angle turns right-handed about
the pitch axis pointing to the tip. With several blades named, the wheel periodicity of the
blades and hub is checked about the rotor axis; a source whose blades and hub were not periodic
is warned, not refused.
The wheel. [wheel] copies the finished sector about rotor_axis through the mesh's origin,
or through center = [x, y, z]. The copies come from the sector's own angle, the azimuth range
of its hub, taken to 360/N within 0.05 degrees; copies may be stated, and an angle that is no
360/N with no copies is refused. A chain with no [repitch] states axis in [wheel]. Seams
that do not close, as a wrong centre leaves them, are refused.
Each table also runs alone through its verb (hub-rings, repitch, collapse-te), reading its
own table and the top-level keys; a [repitch] table that states its own axis, axes or
reference reads and behaves as it does in repitch alone.
Refinement controls¶
Component governing also includes closed tube rings. If an inherited factor would leave too few tube intervals or section nodes, it is raised to the tube's minimum with a warning (FR-3322).
When the audit can wait, use pyfs-mesh refine wing.obj 2 --audit-off
(or pyfs-mesh refine wing.obj 2 --audit-off). In Python, pass audit=False
to refine_mesh. The level is written with the skipped audit recorded in
refine.json; the console prints its exact later audit command. Run
pyfs-mesh audit <level.obj> --against <source.obj> when ready.
Omitting the switch keeps the usual audit enabled (FR-3321).
To give all grid patches of an original family the same directional factors, prepare its component declarations with:
pyfs-mesh prepare-to-refine wing.obj --keep-within-component
pyfs-mesh refine wing_patches.obj
Edit the parallel factor of the patch marked governing_parallel and the normal
factor of the patch marked governing_normal in the prepared TOML. Preparation
persists [refine] keep_within_component = true. Each component's other grids
follow those factors, including across disconnected layouts. Where directions
cannot propagate, refinement warns and uses the patch's own orientation.
For a hand-written file with [components], pass --keep-within-component to
refine, or keep_within_component=True to refine_mesh. With no components,
the option leaves the existing per-layout behavior unchanged.
A matrix row names a saved simulation (.fsm). Start from an OBJ by
preparing its named declarations, running pyfs-mesh mark-boundaries --apply
once, and inspecting the resulting FSM. GUI-prepared FSM files are accepted
without a marking record. CAD, CCS and STL construction belong to
geometry build, which keeps its own solver pass.
Starting from an OBJ or STL¶
For an OBJ, write <stem>.obj.boundaries.toml with the boundary inventory,
fs_build, [import] units, and named [trailing_edges.<label>] entries.
Termination nodes belong to their trailing-edge entry and base regions to
[base_regions.<family>]. Use the reference for the complete
form. Preview marking without a solver, then apply it with a licensed solver.
The matrix names <stem>.fsm, never the OBJ. An STL first needs geometry
preparation into a saved body or an OBJ suitable for marking.
Writing a points file from a blade's mesh¶
pyflightstream.workspace.trailing_edge_midpoints reads a blade surface and
returns the mid-point of every mesh edge on its trailing edge, in order along
the span, and write_trailing_edge_node_file writes them as the blade's
points file. The points come back in the MESH's own reference frame and length
units, because they are mid-points of mesh edges and nothing transforms them.
The rotor axis and hub you pass in are what the CRITERION is computed in, not
what the output is expressed in. The file it writes is the file a
[trailing_edges] table names, file = "blade.te.txt", and the marking pass saves these edges before a row runs.
from pyflightstream.workspace import write_trailing_edge_node_file
write_trailing_edge_node_file(
"blade.obj", "blade.te.txt", axis=(0.0, 0.0, 1.0), hub=(0.0, 0.0, 0.0), unit="METER"
)
That block is skipped by the executable-examples run, because it names a blade mesh and this repository commits no blade. The name it imports is checked all the same: the offline suite resolves every name a python block on this page imports, so a rename fails the suite rather than leaving the block stale.
The vertices and the faces are read. The mesh need not be watertight and no
proximity query is made, so this runs on a base install with no extra.
extract_trailing_edge still returns one aftmost vertex per section, and
TrailingEdge.write_node_file refuses: a list of vertices marks nothing.
THE CRITERION IS NOT A CREASE, and that is the whole point. The obvious implementation is a dihedral-angle threshold over face adjacency, which every mesh library offers. This package refuses it, because marking wake edges from a file exists precisely BECAUSE the solver's own auto-detection is an angle criterion, and a strongly twisted blade has a trailing edge that is not a crease. Building the extraction on adjacency angles would reimplement in Python the criterion the capability was created to escape, and a campaign would gain a different threshold rather than a different capability.
What is computed instead: a vertex's spanwise coordinate is its radial distance
from the rotor axis, the vertices are binned into chordwise sections by that
coordinate, and each section contributes its AFTMOST point, with the chordwise
direction taken from the section's own extent. The trailing edge between two
sections is the shortest chain of mesh edges joining their aftmost points,
along edges that are the aft ridge of both their faces: the far vertex of each
face lies forward of the edge, forward meaning against the section's aft chord.
The chain continues past the first and last section while exactly one such edge
leads outward, and each edge of it gives one mid-point. No angle is compared
with a threshold. A blunt trailing edge, two aft corners at each station, is
refused rather than guessed. The reasoning, and the alternatives that were
rejected, are in the design note DD-27.
An OBJ file's named group for the trailing edge would have been the preferred route and was measured and dropped: the mesh library this package reads the mesh through does not surface OBJ group names, so a blade exported with its trailing edge already named as a group offers nothing that library can see. The groups ARE read for the SURFACE NAMES from the file's own text
Refining or coarsening a mesh¶
pyfs-mesh refine writes a finer or a coarser LEVEL of a panel mesh from its
OBJ, without returning to the pre-processor, and keeps what the mesh's author
chose: the clustering, the trailing edge, the junctions between surfaces and
the face order the solver reads. The source is never modified. The command
needs no executable, no matrix and no workspace.
In the examples below W1.obj holds two families, a wing grid Wing and a
triangulated tip Tip.
Refine with a factor on the command line:
pyfs-mesh refine inputs/geometries/W1/W1.obj 2
The level keeps the source's marking declarations. To mark its edges, edit the
level's [trailing_edges.<label>] file; the next section shows how the trailing
edges are listed and exported.
This writes the level folder inputs/geometries/W1_R2/:
inputs/geometries/W1_R2/
W1_R2.obj the refined mesh
W1_R2.obj.boundaries.toml preserved declarations and updated inventory
W1_R2.refine.json what was done to each family
W1_R2.audit.json the audit of the level against its source
While it runs, refine prints timed progress lines to stderr, one per stage and
family ([refine 14:02:11 +3.2 s] grid 1 of 2: Wing (...)), so a long
refinement shows it is moving; --log-level quiet hides them. At the end the
console names each family with the method it took (Wing: grid), prints
the audit's summary and then every file written. The level is a geometry of its
own and is marked like any OBJ:
pyfs-mesh mark-boundaries inputs/geometries/W1_R2/W1_R2.obj --apply,
and the saved W1_R2.fsm is named in a row's GEOMETRY column. A row naming
W1_R2.obj is refused (matrix geometry).
The level folder goes beside the folder holding the source. For a geometry kept
in its own folder (inputs/geometries/W1/W1.obj) that is the geometry library,
which is where a row looks. For a geometry in the flat layout
(inputs/geometries/W1.obj) the default would be inputs/, outside the
library, so give the folder: --out inputs/geometries. An existing level
folder is refused unless --overwrite is given, and a refused request writes
nothing.
Choosing the factors¶
When upgrading an old refine file, remove [periodic], [trailing_edge],
trailing_edge_direction and the body remesh keys axial,
circumferential, axis and origin. They are warned and skipped. Use the
[[perimeter]] example below for trailing edges, and put a row to keep into
its own family with method = "keep".
A family named nodes is accepted. Its trailing-edge files use a stem such as
nodes_family to keep them separate from the combined <level>.nodes.te.txt
and <level>.nodes.txt outputs. Read the warning or renamed_family_outputs
in refine.json for the chosen stem. Existing family stems are reserved before
choosing a replacement, so a family already named nodes_family keeps its files.
The FACTOR multiplies the number of intervals of a structured grid along each of its two index directions (2 doubles them, 0.5 halves them) and divides the target edge length of any other family. A study of three levels is three commands:
pyfs-mesh refine inputs/geometries/W1/W1.obj 0.5
pyfs-mesh refine inputs/geometries/W1/W1.obj 1
pyfs-mesh refine inputs/geometries/W1/W1.obj 2
They write W1_R0p5, W1_R1 and W1_R2 (p is the decimal point). The
level at factor 1 is the control of the study: its OBJ holds the source's
vertex and face lines, in the source's order.
--families A,B changes only the named families and leaves the others as
they are. --parallel F and --normal F replace the factor in one direction
of the selected grid families: --parallel runs along the family's reference
perimeter, --normal across it. They are refused for a family that is
remeshed, so here they go with --families Wing:
pyfs-mesh refine inputs/geometries/W1/W1.obj 2 --families Wing
pyfs-mesh refine inputs/geometries/W1/W1.obj --normal 1.5 --parallel 0.7 --families Wing
The first writes W1_R-Wing2, the second W1_R-Wing1c1p5s0p7. A mesh whose
families are all grids takes --normal 1.5 --parallel 0.7 alone, tagged
R1c1p5s0p7. A family that is not a grid but is given a directional factor is
refused; --accept-remesh remeshes it with FACTOR instead, with a warning.
A tag built from a long selection, more than 32 characters, is shortened to
R-<n>fam-<hash>: the number of selected families and a hash of the
selection, so W1_R-12fam-<hash> for twelve families. The selected families
are then listed under tag_selection in the level's refine.json. To choose
the name yourself, state [refine] tag in the refinement file.
Which families stay grids¶
Each family of the OBJ (each g or o group) is handled on its own. A family
whose faces form a structured grid, read from the connectivity alone, is
resampled along its two index directions by a cubic spline through its nodes:
quadrilaterals, or quadrilaterals each split into two triangles, laid out as a
sheet, or as a tube whose ends are open, closed by a fan of triangles around one
pole node, or closed by a zipper of triangles. A sheet is oriented by its reference perimeter: the line of
the grid that fixes which edge is index 0, taken from a [[perimeter]] node
list (see From an OBJ to a marked level) or
else from the mesh. A grid family with no trailing edge listed takes the
longest side of its boundary as its reference line, warns which, and does not
write it as a trailing edge; a multiblock family tells its patch sides against
that side. A smooth tube is recovered without one, its seam
standing in. The reference perimeter, the leading
edge and the end stations are knots of the spline, so the clustering is kept
and they do not move, and the level is written in the source's face order.
Any other family is remeshed: refined towards the source's local edge length
divided by its factor, into triangles whose nodes lie on the source surface.
Open boundaries, the trailing edge and every edge whose dihedral exceeds 40
degrees are curves the nodes move along and never leave. A mesh whose families are all grids refines
without any remesh. W1_R2.refine.json names, per family, the method taken and the
reason a grid was or was not recovered.
Grids that share nodes stay grids together. Grid families of quadrilaterals
that touch (a stabilizer, its centre strip and its junction strips, say) are
resampled as one layout: each curve two of them share is resampled once, so
both hold the same nodes on it, and each family keeps its own faces, their
orientation and its face order. The factors of the two families must give a
shared curve the same number of intervals, or the refinement is refused
naming both families and the curve; refine.json names under grouped_with
the families each grid was resampled with. A tube or a family with triangles joins no such layout: of grids that share
nodes, the first in the file's family order is then a grid and a later one is
remeshed under method = "auto", or refused under method = "grid".
When two families meet, they keep meeting on shared nodes. A family that shares
a curve with a refined grid is rebuilt on the grid's new nodes; a family the
refinement does not change is remeshed only in a band of two face layers along
that curve, and is otherwise the source's face for face. When that band would
hold every face of the family (a cap two face layers deep, say), the family is
rebuilt whole at factor 1 instead, as if its table stated factor = 1 and
method = "remesh"; one warning names it and its face count, and
refine.json records it as rebuilt_whole. A family rebuilt at factor 1
beside a refined grid takes, along the shared curve, the spacing of the grid's
new nodes there, graded back to its own size over two face layers, so no face
of the rebuilt family is squeezed at the shared curve.
Tubes and multiblock families¶
Two more layouts are recovered as grids, from the connectivity alone, when a family holds quadrilaterals only. A SMOOTH TUBE (a nacelle, a duct, a spinner cut open at both ends) has no trailing edge and no edge sharper than the ridge angle; it is resampled as a grid whose circumferential direction is a periodic spline, so the seam has no kink, and it writes no trailing-edge points. A MULTIBLOCK family, such as a body with a cap or a junction, is cut into four-sided patches along the grid lines that run from its singular nodes (a node of other than four faces inside, of other than two at the boundary); each patch side is resampled once, so two patches hold the same nodes on the side they share.
W1_R2.refine.json reports the layout multiblock for such a family, with the
number of patches and each patch's rows and columns. A multiblock family has
no single normal or parallel direction, so --normal and --parallel
apply to it side by side: a patch side running within 45 degrees of the
family's reference perimeter is parallel, any other normal, so a junction strip
can be coarsened normal only with normal_factor = 0.77 and parallel_factor = 1.
Each patch is told by its own sides: the pair of opposite sides that runs
more along the reference line is parallel, the other normal, so its two
directions always differ. Where the sides a patch shares with its neighbours
disagree, the family takes the parallel factor everywhere, with a warning;
nothing is refused. Across a patch side the level is
continuous but not smooth: no spline crosses it.
A patch side of m intervals that a factor below 1/m cannot coarsen (a strip
one face wide, say, at any factor below 1) is kept, with max(1, round(f m))
intervals, and the rest of the family is resampled as asked. One warning names
the family and, for each kept side, its patch, which side, both counts and
where the patch lies (centroid and bounding box in the mesh's units), and
refine.json lists the same under kept_sides. A family with a triangle, one patch, or a patch that is not
four-sided or wraps onto itself is not a multiblock and is remeshed under
method = "auto", as before.
Quadrilateral elements for a remeshed family¶
A remeshed family is written in triangles. The key elements in a family
table, or in [refine] as the default of every remeshed family, asks for
"quad-dominant" instead:
[refine]
elements = "quad-dominant"
[families.Tip]
factor = 2
elements = "triangles"
The remeshed triangles are paired into convex quadrilaterals (every angle
between 30 and 150 degrees, warp at most 10 degrees), never across an open
boundary, the trailing edge or a ridge, best pairs first, and the interior
nodes are smoothed along the surface. refine.json reports per family the
elements, the quads, the triangles and the quad share. An unknown value, and
elements on a table that states method = "grid", are refused; on a family
that "auto" resolves to a grid the key is ignored and refine.json says so.
Pairing can raise the audit's size growth and skewness figures, since a
quadrilateral beside a triangle reads as a size jump and a paired rhombus as
skewed; the audit warns only when a figure exceeds its limit, and the level
is written. Read the reported values in the audit.
One factor for many families¶
Declare the factor once in [vars] and reference it as ${name}; changing
the one line changes every family that uses it (the reference
has the rules):
[vars]
f_wing = 0.35013
[refine]
tag = "R0p350"
[families.WingLH]
method = "grid"
factor = "${f_wing}"
[families.WingRH]
method = "grid"
factor = "${f_wing}"
Factor 1¶
At factor 1 a family under method = "auto" is copied: a grid family keeps the
source's nodes and faces in order, and a family that would be remeshed is
unchanged. A family whose table states method = "remesh" is remeshed at any
factor, factor 1 included.
A solid blade kept structured by dummy families¶
A blade whose tip is closed by a triangulated cap is not one grid: a cap is part
of a grid only when it is a pole fan or a zipper. The pre-processor route is to
split the blade into DUMMY FAMILIES, each region a family of its own, for
example Blade1_side (the lateral grid) and Blade1_tip (the cap). The
refinement then resamples the side as a grid and remeshes the cap on its
new nodes, and [components] writes the two as the one family the solver must see,
Blade1:
[refine]
tag = "R2"
[families.Blade1_side]
factor = 2
method = "grid"
[families.Blade1_tip]
factor = 2
[components]
Blade1 = ["Blade1_side", "Blade1_tip"]
pyfs-mesh refine inputs/geometries/B1/B1.obj
With no factor on the command line the factors come from B1.refine.toml
beside the mesh (or from --config FILE). B1_R2.obj holds one family
Blade1, the side's faces then the cap's, and B1_R2.boundaries.toml names
Blade1 in place of its members. method = "grid" makes the refinement refuse
the side, naming why, if its grid is not recovered, rather than remesh it. The
[components] and [refine] tag of a file beside the mesh are read whatever
gives the factors, so pyfs-mesh refine inputs/geometries/B1/B1.obj 2
merges the families too.
From an OBJ to a marked level¶
The path from a mesh to a marked, refined geometry has six steps; the first is optional.
- Prepare the patches (optional).
prepare-to-refinecuts every family at its sharp edges into patches that the refinement recovers as grids (<family>_<NNN>_grid) and patches that it remeshes (<family>_<NNN>_mixed):
pyfs-mesh prepare-to-refine inputs/geometries/W1/W1.obj
It writes, beside the mesh and without modifying it, W1_patches.obj,
W1_patches.refine.toml and W1_patches.nodes.txt. The refine file holds
every patch at factor 1 and [components] putting each family back
together. Grid patches that share nodes are refined as one layout, so the
curves they share take one count. The planner reads the node list being written
and marks the patch with the greatest total length of parallel sides
governing_parallel = true, and the greatest total length of normal sides
governing_normal = true; source order breaks ties. Patches whose every arc's
direction can be propagated from these leads through shared curves have
explicit method = "grid_auto" tables: they follow the governing
patches' factors on those directions. A conflict or an unlinked patch (for
example, one touching only at a corner) is warned and keeps its own
method = "grid", factor = 1.0 table, preceded by a comment naming the
governing patches and the reason. A candidate the planner cannot refine as a
grid with that node list or beside its neighbours, including an unjoinable
tube, is declared method = "auto" with a comment. Set the factors on the governing patches;
use governing_parallel = true and governing_normal = true to select
separate leads for the two directions. One family may carry both keys.
For example, a parallel lead with parallel_factor = 2 and a normal lead
with normal_factor = 4 give their grid-auto followers those two factors
within the same layout. The earlier governing = true means both, warned.
The # follows comment names both directional governors; governing tables
have a # leads P1, N2 comment naming their bands. Change a follower to
method = "grid" to give it factors of its own. To isolate one governing
patch, delete the other family tables or write method = "keep" in them.
Those families stay unchanged except for the directions or mixed-neighbour
bands needed to keep the shared curves continuous.
pyfs-mesh prepare-to-refine W1.nas --visual-inspect also writes
W1_patches.inspect.pdf: two pages per original family. The first colors and
names patches and marks GOVERNING PARALLEL and GOVERNING NORMAL. The second
shows grey faces with blue parallel and orange normal perimeter arcs, relative
to the trailing edge or longest side. Planner band labels (P1, N1, and onward)
identify followers; the dominant arc is thicker with a bold framed label.
The node list holds the rearmost line of each grid patch, the
edges within --max-angle (default 45 degrees) of the plane across the
aft direction, as an ANSA SET node list. --aft X Y Z states the nose to
tail direction (default +x, so the plane is the yz plane). Any OBJ and refine file refine without this step.
To follow the pre-processor's meshing macros instead of the sharp edges,
give an ANSA NASTRAN export written with the FE perimeters on
(comment_output_fe_perimeters): each family is then cut along those
perimeters, so each patch is one macro. --unit states the export's
length unit (default MILLIMETER) and --obj-unit the unit the patches OBJ
is written in (default METER):
pyfs-mesh prepare-to-refine inputs/geometries/W1/W1.nas
method. The file names the node list in a [[perimeter]] table:
[refine]
filename = "W1_fine"
[families.Wing_001_grid]
parallel_factor = 2
normal_factor = 1.5
method = "grid"
[components]
Wing = ["Wing_001_grid", "Wing_002_mixed"]
[[perimeter]]
file = "W1_patches.nodes.txt"
export_te_per_family = true
te_families = ["Wing"]
A node list can also come from the pre-processor: save the nodes of an
ANSA SET from its node window. One list may hold the perimeters of every
component, in any node order. With export_te_per_family = true the list
holds trailing edges, and the level writes them; te_families instead
takes the rearmost line of each named family from a list that holds every
perimeter.
3. Refine.
pyfs-mesh refine inputs/geometries/W1/W1_patches.obj
With no factor on the command line the factors come from the refine file
beside the mesh. [refine] filename names the level's folder and OBJ in
place of <stem>_<tag>. The level inputs/geometries/W1_fine/ holds the
refined mesh, the trailing edges as W1_fine.te.txt and
W1_fine.<family>.te.txt, the quad families' trailing edges in the solver's
import format (W1_fine.nodes.te.txt, W1_fine.<family>.fs.te.txt) and as
ANSA node lists (W1_fine.nodes.txt, W1_fine.<family>.nodes.txt), and its
boundaries file.
4. Edit the level's boundaries file types. When the trailing edges were
exported and the source declares none, the level's
<level>.obj.boundaries.toml declares one table per component:
[trailing_edges.Wing]
file = "W1_fine.Wing.te.txt"
type = "STANDARD"
Change the type of each, and add fs_build, [import] units and the
other declarations as for any OBJ (the reference). A
source file that declares its own trailing edges keeps them.
5. Mark the boundaries. The level is a geometry of its own:
pyfs-mesh mark-boundaries inputs/geometries/W1_fine/W1_fine.obj --apply
- Name the saved simulation in a row's
GEOMETRYcolumn.
Looking at a mesh and its marked points¶
To inspect a refinement as it is produced, run:
pyfs-mesh refine inputs/geometries/W1/W1_patches.obj 2 --visual-inspect
Or call refine_mesh("inputs/geometries/W1/W1_patches.obj", 2, visual_inspect=True).
Open <level>.refine-governors.pdf beside the resulting OBJ. Its first page
lists each governing family, the direction it governs (PARALLEL or NORMAL), its
bands and the number of families it governs. The next pages compare, per family
and direction, the factor you requested with the factor achieved (intervals after
over intervals before) and name the family that governs it; a row in bold red
with * departs from its governor's factor by more than rounding to whole
intervals explains. Then one page per governing family
and direction shows the whole aircraft faint, the governing family in a strong
color and every family it governs in that direction in a color of its own,
whatever their component, named in the legend with the governing one in bold. Each output family or component then has a patches
page and a directions page with the same colors and P/N labels as preparation.
Recorded continuity changes are annotated. visual-inspect on the level OBJ
writes <level>.inspect.pdf, a separate file.
If refinement refuses after reading the source, open the
<stem>.refine-refusal.pdf named at the end of the error. Its first page locates
the affected families, nodes and points from structured refusal data; family
pages follow. This diagnostic does not require the flag and creates no level
folder. If drawing fails, the original refusal remains and a warning explains
the drawing failure.
visual-inspect writes a PDF of an OBJ or NASTRAN mesh: the top, front,
side and isometric views as a technical drawing (one scale, aligned, a scale
bar), each patch in its own color from --cmap with its perimeter in a
thick line, node lists (--nodes) and trailing-edge points files (--te)
over the surface, and a table of each patch's faces and marked points.
--png also writes the pages of views as PNG files.
pyfs-mesh visual-inspect inputs/geometries/W1/W1_patches.obj --nodes inputs/geometries/W1/W1_patches.nodes.txt --mesh-unit METER
From Python, visual_inspect of pyflightstream.workspace takes the same
inputs and returns the path of the PDF.
Marking trailing edges without refining¶
identify-te writes the trailing edges of an OBJ in the format the solver
imports, for a mesh that is not refined:
pyfs-mesh identify-te inputs/geometries/W1/W1.obj
pyfs-mesh identify-te inputs/geometries/W1/W1.obj --families Wing,Tail
Without a node list the edges are found from the mesh: each family is cut at
its sharp edges and its rearmost boundary edges within --max-angle of the
plane across --aft (the yz plane by default) are kept. Where the upper and
the lower surface meet at a sharp trailing edge, that fold is kept to the tip
of a twisted blade, whose chord turns toward the rotation plane, and the
contour a closed tip cap meets the surface along is left out. A line of a
family's perimeter (its boundary and sharp edges, from corner to corner) found
for more than half of its edges is taken whole within --max-angle, so a
trailing edge reaches its junction with a hub where it bends out of the rearmost
tests; raise --max-angle for a sharper bend. Without --families only quad families
are mapped (quadrilaterals at least 80 percent of the faces), so a tip cap or a
fairing meshed in triangles is warned and left out; --all-families maps every
family. The command writes W1.te.txt, a unit line and the mid-points, and
W1.nodes.te.txt, the same edges in the format the solver imports, for the mapped
families (or W1.<family>.te.txt and W1.<family>.fs.te.txt for each family named
by --families) and, beside them, W1.nodes.txt, the ANSA node list a refine file
reads. With a node list
saved from a SET, identify-te W1.obj nodes.txt takes the trailing edges among
its lines, on a refined level with merged families too. --unit states the
coordinates' unit and --simulation-unit the unit the solver reads the file
in. Name the file with the unit line in the boundaries file,
[trailing_edges.<label>] file = "W1.te.txt", and mark the OBJ; the marking pass
refuses W1.nodes.te.txt, which opens with a count in place of a unit.
A node list saved from the pre-processor in any node order becomes a points file
with convert2midnodes:
pyfs-mesh convert2midnodes nodes.txt wing.te.txt
pyfs-mesh convert2midnodes nodes.txt wing.te.txt --per-family inputs/geometries/W1/W1.obj
The nodes are ordered along their lines (a long jump starts a new line), and
each neighbouring pair gives one mid-point. With --per-family the file is
written per family of the OBJ, as wing.<family>.te.txt, from the mesh edges
joining two listed nodes.
Checking a level before a run¶
Every refinement audits its level against its source and writes
<stem>_<tag>.audit.json. A gate or check that fails is a WARNING naming it,
the family and both values; the level is still written and refine exits 0, so
read the summary before spending a licensed run:
audit of W1_R2.obj against W1.obj
G1 pass on (whole mesh): edges_of_more_than_two_faces 0, node_pairs_at_one_position 0, faces_of_zero_area 0
G2 pass on (whole mesh): neighbours_of_opposite_orientation 0
G3 pass on (whole mesh): open_loops 1, source_open_loops 1, unmatched_loops 0
G4 pass on (whole mesh): points 16, points_on_edges 16, chains 1, source_chains 1, length 3.2, source_length 3.2, source_ends 2, source_ends_missing 0
G5 pass on Wing and Tip: shared_nodes 37, source_shared_nodes 19
G6 not judged on (whole mesh): grid_families_at_factor_1 0
relative checks: 8 pass, 0 fail, 1 not judged
every gate and check passed
A level written with [components] is audited against the union of each
component's members in the source (the components are read from the level's
refine.json), so the dummy families of the example above are compared as the
one family the solver sees. A figure within a millionth of a limit or a floor
meets it.
pyfs-mesh audit runs the same audit on any OBJ, alone or against the
mesh it was made from, and its exit status is the verdict: 0 when every gate
and check passes, 1 when one fails, 2 when the input is refused.
pyfs-mesh audit inputs/geometries/W1_R2/W1_R2.obj --against inputs/geometries/W1/W1.obj --out W1_R2_audit.csv
From Python¶
refine_mesh and audit_mesh of pyflightstream.workspace are the functions
the two commands call, with the same files and the same refusals:
from pyflightstream.workspace import audit_mesh, refine_mesh
level = refine_mesh("inputs/geometries/W1/W1.obj", 2)
if level is None:
raise SystemExit("no family selected: no level written")
print(level.folder.name) # W1_R2
for name, family in level.report.items():
print(name, family["method"])
if not level.audit.passed:
for item in level.audit.failures:
print(item.line())
audit = audit_mesh("inputs/geometries/W1_R2/W1_R2.obj", against="inputs/geometries/W1/W1.obj")
print(audit.passed, audit.path.name) # True W1_R2.audit.json
That block is skipped by the executable-examples run because it names a mesh this repository does not commit; the names it imports are resolved by the offline suite. The refinement file, every key, the files of a level and the audit's gates are in the reference.
The saved simulation: GUI once, script everything after¶
The gap this route closes¶
See Saved simulation for the reason this route exists.
The supported pattern¶
When a step is GUI-only, the supported workflow is:
- Perform the GUI-only procedure interactively, once: import the geometry, run the manual meshing or repair step, configure what has no command.
- Save the result as a
.fsmsimulation file. That file is now an input artifact: store it in the campaign workspace input library underinputs/, selected by id like any other artifact, and treat it as immutable (redo the GUI step, save a new artifact, never edit in place). - Everything downstream stays scripted: scripts
OPENthe saved.fsm,declare_existingtells the builder which entities (boundaries, frames, actuators, motions) the file already contains so index and label checks keep working, and solver setup, sweeps, and exports run reproducibly on top.
The GUI step itself is the one part the library cannot replay; the saved
.fsm is its record. The workspace stages inputs with content hashes following
pyflightstream._digest's sha256 rule
in the run manifest (inputs_sha256), so every run names exactly which saved file it
consumed.
When a mesh exists only inside a .fsm, the pre-processing export
(run.export_surface_mesh) produces the OBJ counterpart through a solver run,
which is how the geometry gate of the probe planner gets its watertight
surface.
Repitch accepts a reference installation-axis table, for example
axis = { shaft = "X", vector_wrt_global = [2, 0, 0] }. It normalizes the
physical shaft and projects blade1.zero into its disk plane, using the same
frame convention for automatic pitch axes, the hub chart and wheel checks.
A datum parallel to the shaft cannot define the blade plane and must be fixed.