pyflightstream.geometry (provisional)¶
Generated from the docstrings at build time: every one of the 4 names in the __all__ of pyflightstream.geometry has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
Parametric geometry: component records, configuration, sections and lifting surfaces.
Pipeline role: pure numerical layer below the workspace. It describes aircraft components by a few parameters and rebuilds their skin as B-spline patches, with no geometry kernel, no solver and no import from the run, post or workspace layers. Stages that need a kernel (IGES writing, meshing) live in the workspace and import the types defined here.
The public names are :class:ComponentRecord (the parameter contract) and
:func:load_config and :func:resolve_config (the TOML input boundary).
The sections, distributions, lifting surfaces, caps and B-spline patches
behind them are private modules of this package.
Examples:
>>> from pyflightstream.geometry import resolve_config
>>> resolved = resolve_config({"type": "lifting_surface"})
>>> resolved["components"]["COMPONENT"]["type"]["source"]
'given'
Used in the guides¶
pyflightstream.geometry.Propeller
¶
Propeller(
config=None,
*,
radius=None,
blades=None,
stations=None,
airfoils=None,
hub_radius=0.0,
pitch_setting=30.0,
pitch_reference_r_R=0.7,
rotation="positive_x",
options=None,
output=None,
frame=None,
base_dir=None,
)
Classical planar propeller in mm, with degree-five sections and a cubic C2 loft.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
Strict schema 1 mapping. Alternatively supply radius, blades, stations and airfoils as keyword arguments. Station rows use r_R, c_R, beta_deg, t_c and airfoil, with optional stacking and displacement. |
None
|
radius
|
float
|
Radius and hub radius in mm. |
None
|
hub_radius
|
float
|
Radius and hub radius in mm. |
None
|
blades
|
int
|
Positive blade count. |
None
|
stations
|
list of dict or dict
|
Radial station rows or schema 1 column arrays. |
None
|
airfoils
|
dict
|
Named profiles, each containing exactly one of naca, file or cst. |
None
|
Examples:
>>> from pyflightstream.geometry import Propeller
>>> Propeller({})
Traceback (most recent call last):
...
pyflightstream._errors.InputValueError: schema_version: got None, expected 1
from_toml
classmethod
¶
from_toml(path)
Read schema 1 TOML, resolving coordinate files beside that input.
with_pitch
¶
with_pitch(setting)
Return an independent design with the reference pitch setting in degrees.
with_skew
¶
with_skew(value, *, units='deg')
Return a design with scalar, station array or callable skew, in deg or s/R.
with_rake
¶
with_rake(value, *, units='x/R')
Return a design with scalar, station array or callable aft rake, in x/R or deg.
spinner
¶
spinner()
Build the spinner of every sector, split for periodicity, with its record, in mm.
Returns:
| Type | Description |
|---|---|
SpinnerGeometry
|
|
Raises:
| Type | Description |
|---|---|
InputValueError
|
When the definition has no |
component
¶
component(*, blades=None)
Return the component mapping accepted by resolve_config and run_geometry.
pyflightstream.geometry.resolve_config
¶
resolve_config(data, stem=None, base=None)
Validate a geometry configuration and resolve it with the source of every value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
A configuration as read from TOML: fresh input (a |
required |
stem
|
str
|
File stem, the default of |
None
|
base
|
str or PathLike
|
Directory that the data files named in the input ( |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
The resolved configuration: |
Raises:
| Type | Description |
|---|---|
InputValueError
|
When the units are unknown, no component is given, a component lacks its type or an
X.Y.Z version, a value or relationship is out of range, a dominance or extends cycle
exists, a value has the wrong form, or a resolved input's derived quantity is
inconsistent. Unknown keys do not raise: they are skipped and listed in |
Examples:
>>> from pyflightstream.geometry import resolve_config
>>> resolved = resolve_config({"type": "body", "length_mm": 2000.0})
>>> resolved["components"]["COMPONENT"]["length"]["value"]
2.0
Advanced¶
pyflightstream.geometry.ComponentRecord
¶
Bases: _Strict
The parameter record of one component (schema 0.2.0 of the contract).
symmetry is required for body and revolution components and absent for
lifting components; te_base is explicit for lifting components and null
for the others. Structural rules are enforced on construction. Checks that
need the referenced files (that an entity exists, has the declared type and
that splits lie on their curves) are not made here: the pin check
covers the pins and the geometric checks belong to the check stage.
pyflightstream.geometry.load_config
¶
load_config(path)
Read a TOML geometry configuration file and return it validated and resolved.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or PathLike
|
The TOML file to read; the data files it names are read relative to its folder. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
The resolved configuration, as returned by :func: |