Aero¶
flapjax.aero ¶
AeroCase ¶
AeroCase(
zeta_b: ArrayList,
zeta_b_dot: ArrayList,
zeta_w: ArrayList,
c: ArrayList | None,
n: ArrayList | None,
gamma_b: ArrayList,
gamma_b_dot: ArrayList | None,
gamma_w: ArrayList,
f_steady: ArrayList,
f_unsteady: ArrayList | None,
alpha: ArrayList | None,
cl: ArrayList | None,
cd: ArrayList | None,
cm: ArrayList | None,
cs_ang: dict[str, Array],
cs_vel: dict[str, Array],
kernels: Sequence[KernelFunction],
mirror_point: Array | None,
mirror_normal: Array | None,
mirror_edge_low: ArrayList | None,
mirror_edge_high: ArrayList | None,
flowfield: FlowField,
surf_b_names: Sequence[str],
surf_w_names: Sequence[str],
t: Array,
i_ts: Array | int,
dof_mapping: ArrayList,
static_horseshoe: bool,
free_wake: bool,
gamma_dot_relaxation: float | Array,
batch_size: int | None,
)
Contains an aerodynamic solution across one or many timesteps.
A single instance may represent either:
- Snapshot (single timestep): array leaves within have no leading time axis (e.g.
zeta_b[i_surf].shape == (m+1, n+1, 3),gamma_b[i_surf].shape == (m, n)).tis a scalar andi_tsis an integer - Batched (many timesteps): array leaves carry a leading
n_tstepaxis (e.g.zeta_b[i_surf].shape == (n_tstep, m+1, n+1, 3)).tis(n_tstep,)andi_tsis a(n_tstep, )array of indices.
Use is_batched to distinguish at runtime.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zeta_b
|
ArrayList
|
Bound grid coordinates, batched: |
required |
zeta_b_dot
|
ArrayList
|
Bound grid velocities, same layout as |
required |
zeta_w
|
ArrayList
|
Wake grid coordinates or |
required |
c
|
ArrayList | None
|
Bound collocation points or |
required |
n
|
ArrayList | None
|
Bound grid normals or |
required |
gamma_b
|
ArrayList
|
Bound circulation strengths, batched: |
required |
gamma_b_dot
|
ArrayList | None
|
Bound circulation time derivatives or |
required |
gamma_w
|
ArrayList
|
Wake circulation strengths. |
required |
f_steady
|
ArrayList
|
Steady force contributions. |
required |
f_unsteady
|
ArrayList | None
|
Unsteady force contributions or |
required |
alpha
|
ArrayList | None
|
Per-strip effective angle of attack extracted from the UVLM sectional lift; batched:
|
required |
cl
|
ArrayList | None
|
Per-strip lift coefficient sampled from the airfoil polars, or |
required |
cd
|
ArrayList | None
|
Per-strip drag coefficient sampled from the airfoil polars, or |
required |
cm
|
ArrayList | None
|
Per-strip moment coefficient sampled from the airfoil polars, or |
required |
cs_ang
|
dict[str, Array]
|
Control surface angle time history, |
required |
cs_vel
|
dict[str, Array]
|
Control surface velocity time history. |
required |
kernels
|
Sequence[KernelFunction]
|
Kernel functions for both bound and wake source grids. |
required |
mirror_point
|
Array | None
|
Point on mirror plane, |
required |
mirror_normal
|
Array | None
|
Normal on mirror plane, |
required |
mirror_edge_low
|
ArrayList | None
|
Per-surface booleans marking whether that surface's |
required |
mirror_edge_high
|
ArrayList | None
|
As |
required |
flowfield
|
FlowField
|
|
required |
surf_b_names
|
Sequence[str]
|
Names of bound surfaces, |
required |
surf_w_names
|
Sequence[str]
|
Names of wake surfaces, |
required |
t
|
Array
|
Time; batched: |
required |
i_ts
|
Array | int
|
Timestep index; batched: |
required |
dof_mapping
|
ArrayList
|
Map from aero grid to beam DOFs, |
required |
static_horseshoe
|
bool
|
If true, a horseshoe formulation was used for the initial static solution. |
required |
free_wake
|
bool
|
Free-wake formulation flag. |
required |
gamma_dot_relaxation
|
float | Array
|
Circulation time derivative filter. |
required |
batch_size
|
int | None
|
Batch size used for AIC vectorisation. |
required |
Source code in src/flapjax/aero/data_structures.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
get_states ¶
get_states(
i_ts: int | Array | None = None,
) -> AeroFullStates
Obtain the aerodynamic state at a given timestep (used in the adjoint solution).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array | None
|
Time step index (required for batched, ignored for snapshot). |
None
|
Returns:
| Type | Description |
|---|---|
AeroFullStates
|
Aero states. |
Source code in src/flapjax/aero/data_structures.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
gamma_full ¶
gamma_full(i_ts: int | None = None) -> ArrayList
Concatenate bound and wake circulation strengths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | None
|
Time step index (required for batched, ignored for snapshot). |
None
|
Returns:
| Type | Description |
|---|---|
ArrayList
|
Circulation strength, |
Source code in src/flapjax/aero/data_structures.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
zeta_full ¶
zeta_full(i_ts: int | None = None) -> ArrayList
Concatenate bound and wake grids.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | None
|
Time step index (required for batched, ignored for snapshot). |
None
|
Returns:
| Type | Description |
|---|---|
ArrayList
|
Grids, |
Source code in src/flapjax/aero/data_structures.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
set_arraylist_at_ts ¶
set_arraylist_at_ts(
attr: str, values: ArrayList, i_ts: int
) -> None
Set an attribute at a given timestep on a batched AeroCase.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attr
|
str
|
Name of the attribute to set. |
required |
values
|
ArrayList
|
ArrayList of per-surface values (no leading time axis). |
required |
i_ts
|
int
|
Time step index. |
required |
Source code in src/flapjax/aero/data_structures.py
345 346 347 348 349 350 351 352 353 354 355 | |
get_surf_snapshot ¶
get_surf_snapshot(
i_ts: int, i_surf: int
) -> _AeroSurfacePlot
Get single-surface plot data for a given (timestep, surface) pair on
a batched AeroCase.
Source code in src/flapjax/aero/data_structures.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |
get_surface ¶
get_surface(idx: int) -> _AeroSurfacePlot
Get single-surface plot data for the given surface on a snapshot AeroCase.
Source code in src/flapjax/aero/data_structures.py
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | |
plot ¶
plot(
directory: PathLike | str,
plot_bound: bool = True,
plot_wake: bool = True,
index: int
| Sequence[int]
| Array
| slice
| None = None,
) -> Sequence[Path]
Plot aerodynamic surfaces to VTU files (with per-surface PVD when batched).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
PathLike | str
|
Directory to save files. |
required |
plot_bound
|
bool
|
If True, plot the bound surfaces. |
True
|
plot_wake
|
bool
|
If True, plot the wake surfaces. |
True
|
index
|
int | Sequence[int] | Array | slice | None
|
For batched, timestep indices to plot (all if None). Ignored for snapshots. |
None
|
Returns:
| Type | Description |
|---|---|
Sequence[Path]
|
Sequence of paths to the saved PVD (batched) or VTU (snapshot) files. |
Source code in src/flapjax/aero/data_structures.py
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | |
project_forcing_to_beam ¶
project_forcing_to_beam(
i_ts: int,
rmat: Array,
x0_aero: ArrayList,
include_unsteady: bool,
) -> Array
Project aerodynamic forcing at i_ts onto the beam grid (global frame).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int
|
Time step index (ignored for snapshot). |
required |
rmat
|
Array
|
Rotation matrix for each node relative to reference, |
required |
x0_aero
|
ArrayList
|
Reference coordinates for aerodynamic grid, |
required |
include_unsteady
|
bool
|
If true, include unsteady forcing. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Steady and unsteady forcing projected onto the beam grid, |
Source code in src/flapjax/aero/data_structures.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | |
get_v_background ¶
get_v_background(x_target: T, i_ts: int | None = None) -> T
Background velocity at specified points and time step.
Source code in src/flapjax/aero/data_structures.py
561 562 563 564 565 566 567 568 569 570 | |
get_v_ind ¶
get_v_ind(x_target: T, i_ts: int | None = None) -> T
Induced velocity at specified points and time step.
Source code in src/flapjax/aero/data_structures.py
572 573 574 575 576 577 578 579 580 581 582 583 584 | |
get_v_tot ¶
get_v_tot(x_target: T, i_ts: int | None = None) -> T
Total (induced + background) velocity at specified points and time step.
Source code in src/flapjax/aero/data_structures.py
586 587 588 589 590 591 592 | |
to_dynamic ¶
to_dynamic(i_ts: int, n_tstep: int) -> AeroCase
Expand this snapshot into a batched AeroCase with n_tstep
timesteps, placing the current snapshot at index i_ts.
Source code in src/flapjax/aero/data_structures.py
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | |
initialise
classmethod
¶
initialise(
initial_snapshot: AeroCase, n_tstep: int
) -> AeroCase
Create a batched AeroCase from a snapshot placed at i_ts=0.
Source code in src/flapjax/aero/data_structures.py
683 684 685 686 | |
GridDiscretisation
dataclass
¶
GridDiscretisation(m: int, n: int, m_star: int)
Data class to hold discretisation parameters for each aerodynamic grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m
|
int
|
Number of panels in the chordwise direction. |
required |
n
|
int
|
Number of panels in the spanwise direction. |
required |
m_star
|
int
|
Number of wake panels in the chordwise direction. |
required |
ConstantFlowField ¶
ConstantFlowField(
u_inf: Array,
rho: float | Array,
relative_motion: bool,
mach: float | Array = 0.0,
)
Bases: FlowField
Constant velocity flow field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u_inf
|
Array
|
Base flow velocity, |
required |
rho
|
float | Array
|
Flow density. |
required |
relative_motion
|
bool
|
If True, the air moves, if False, the plane moves. |
required |
mach
|
float | Array
|
Freestream Mach number, used to apply a Prandtl-Glauert compressibility correction. Defaults to 0 (incompressible). |
0.0
|
Source code in src/flapjax/aero/flowfields.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
vmap_call ¶
vmap_call(x: Array, t: Array) -> Array
Vectorized version of the call method. This maps over all leading dimensions of x.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
Spatial coordinates, |
required |
t
|
Array
|
Time, () |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Flow field values at the specified coordinates, |
Source code in src/flapjax/aero/flowfields.py
63 64 65 66 67 68 69 70 71 72 73 74 | |
surf_vmap_call ¶
surf_vmap_call(xs: ArrayList, t: Array) -> ArrayList
Vectorized version of the call method over a list of surfaces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xs
|
ArrayList
|
Spatial coordinates, |
required |
t
|
Array
|
Time, () |
required |
Returns:
| Type | Description |
|---|---|
ArrayList
|
Flow field values at the specified coordinates, |
Source code in src/flapjax/aero/flowfields.py
76 77 78 79 80 81 82 83 | |
to_design_variables ¶
to_design_variables() -> dict[str, Array]
Extract the design variables associated with this flow field.
Returns:
| Type | Description |
|---|---|
dict[str, Array]
|
Dictionary of design variables. |
Source code in src/flapjax/aero/flowfields.py
85 86 87 88 89 90 | |
from_design_variables ¶
from_design_variables(
design_variables: dict[str, Array],
) -> FlowField
Create a new flow field from design variables as the inverse of self.to_design_variables().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
design_variables
|
dict[str, Array]
|
Dictionary of design variables. |
required |
Returns:
| Type | Description |
|---|---|
FlowField
|
New FlowField object. |
Source code in src/flapjax/aero/flowfields.py
92 93 94 95 96 97 98 | |
OneMinusCosineFlowField ¶
OneMinusCosineFlowField(
u_inf: Array,
rho: float | Array,
relative_motion: bool,
gust_length: float | Array,
gust_amplitude: float | Array,
gust_travel_direction: Array | None = None,
gust_amplitude_direction: Array | None = None,
gust_x0: Array | None = None,
mach: float | Array = 0.0,
)
Bases: FlowField
One minus cosine gust flow field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u_inf
|
Array
|
Base flow velocity, |
required |
rho
|
float | Array
|
Flow density. |
required |
relative_motion
|
bool
|
If True, the air moves, if False, the plane moves. |
required |
gust_length
|
float | Array
|
Gust length. |
required |
gust_amplitude
|
float | Array
|
Gust amplitude. |
required |
gust_travel_direction
|
Array | None
|
Vector which defines the direction that the gust travels, |
None
|
gust_amplitude_direction
|
Array | None
|
Vector which defines the direction that the gust amplitude acts, |
None
|
gust_x0
|
Array | None
|
Coordinate on the initial leading edge of the gust, |
None
|
mach
|
float | Array
|
Freestream Mach number, used to apply a Prandtl-Glauert compressibility correction. Defaults to 0 (incompressible). |
0.0
|
Source code in src/flapjax/aero/flowfields.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
vmap_call ¶
vmap_call(x: Array, t: Array) -> Array
Vectorized version of the call method. This maps over all leading dimensions of x.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
Spatial coordinates, |
required |
t
|
Array
|
Time, () |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Flow field values at the specified coordinates, |
Source code in src/flapjax/aero/flowfields.py
63 64 65 66 67 68 69 70 71 72 73 74 | |
surf_vmap_call ¶
surf_vmap_call(xs: ArrayList, t: Array) -> ArrayList
Vectorized version of the call method over a list of surfaces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xs
|
ArrayList
|
Spatial coordinates, |
required |
t
|
Array
|
Time, () |
required |
Returns:
| Type | Description |
|---|---|
ArrayList
|
Flow field values at the specified coordinates, |
Source code in src/flapjax/aero/flowfields.py
76 77 78 79 80 81 82 83 | |
AeroFullStates ¶
AeroFullStates(
gamma_b: ArrayList,
gamma_w: ArrayList,
gamma_b_dot: ArrayList,
zeta_w: ArrayList,
)
Aerodynamic states used for the adjoint solve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gamma_b
|
ArrayList
|
Bound panel circulation strengths. |
required |
gamma_w
|
ArrayList
|
Wake panel circulation strengths. |
required |
gamma_b_dot
|
ArrayList
|
Bound grid circulation time derivatives. |
required |
zeta_w
|
ArrayList
|
Wake grid coordinates. |
required |
Source code in src/flapjax/aero/gradients/data_structures.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
n_states
property
¶
n_states: int
Obtain the total number of states contained within the data structure, being the size of the vector obtained
from self.ravel().
Returns:
| Type | Description |
|---|---|
int
|
Size of vector. |
shapes ¶
shapes() -> OrderedDict[
str, tuple[int, ...] | ArrayListShape | None
]
Obtain the shapes of all arrays within the data structure.
Returns:
| Type | Description |
|---|---|
OrderedDict[str, tuple[int, ...] | ArrayListShape | None]
|
Dictionary of {name: shape} pairs of all arrays or ArrayLists within the data structure. |
Source code in src/flapjax/aero/gradients/data_structures.py
139 140 141 142 143 144 145 146 147 148 149 | |
from_vector
staticmethod
¶
from_vector(
vect: Array,
shapes: OrderedDict[
str, tuple[int, ...] | ArrayListShape | None
],
) -> AeroFullStates
Construct an AeroFullStates object from a vector of data and a corresponding dictionary of shapes, being the inverse
of self.ravel().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vect
|
Array
|
Aerodynamic state vector. |
required |
shapes
|
OrderedDict[str, tuple[int, ...] | ArrayListShape | None]
|
Dictionary of {name: shape} pairs of all arrays or ArrayLists within the data structure. |
required |
Returns:
| Type | Description |
|---|---|
AeroFullStates
|
AeroFullStates object. |
Source code in src/flapjax/aero/gradients/data_structures.py
151 152 153 154 155 156 157 158 159 160 161 162 163 | |
ravel ¶
ravel() -> Array
Ravel the data structure to a vector, being the inverse of cls.from_vector().
Returns:
| Type | Description |
|---|---|
Array
|
Data vector containing all states. |
Source code in src/flapjax/aero/gradients/data_structures.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
AeroGradsToCompute
dataclass
¶
AeroGradsToCompute(
x0_aero: bool = True,
flowfield: bool = False,
cs_ang_t: bool = False,
cs_vel_t: bool = False,
)
Class which contains flags to determine which gradients are to be computed for the aerodynamic problem during the adjoint solve. Defaults to computing only the aerodynamic grid gradients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x0_aero
|
bool
|
Aerodynamic grid coordinates. |
True
|
flowfield
|
bool
|
Flow field parameters. |
False
|
cs_ang_t
|
bool
|
Control surface deflection angle time history. |
False
|
cs_vel_t
|
bool
|
Control surface velocity time history. |
False
|
AeroLinearResult ¶
AeroLinearResult(
reference: AeroCase,
u_t: AeroInputUnflattened,
x_t: AeroStateUnflattened,
y_t: AeroOutputUnflattened,
u_t_tot: AeroInputUnflattened,
x_t_tot: AeroStateUnflattened,
y_t_tot: AeroOutputUnflattened,
n_tstep: int,
n_surf: int,
t: Array,
surf_b_names: list[str],
surf_w_names: list[str],
)
Source code in src/flapjax/aero/linear/data_structures.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
plot ¶
plot(
directory: str | PathLike,
index: slice
| Sequence[int]
| int
| Array
| None = None,
plot_wake: bool = True,
) -> None
Plot the aerodynamic grid at specified time steps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str | PathLike
|
Directory to save the plots to |
required |
index
|
slice | Sequence[int] | int | Array | None
|
Index or slice of time steps to plot. If None, plot all time steps. |
None
|
plot_wake
|
bool
|
If True, plot the wake grid |
True
|
Source code in src/flapjax/aero/linear/data_structures.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
LinearUVLM ¶
LinearUVLM(
case: UVLM,
reference: AeroCase,
wake_type: LinearWakeType = "frozen",
bound_upwash: bool = True,
wake_upwash: bool = True,
unsteady_force: bool = True,
*,
skip_checks: bool = False,
skip_linearisation: bool = False,
)
Bases: LinearModel[AeroCase, AeroInputUnflattened, AeroStateUnflattened, AeroOutputUnflattened, AeroLinearResult]
Class to represent a linearised UVLM aerodynamic system about a reference state.
Initialise linear UVLM system about a reference state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
UVLM
|
UVLM case object to linearise. |
required |
reference
|
AeroCase
|
StaticAero representing the reference state for linearisation. |
required |
wake_type
|
LinearWakeType
|
Instance of LinearWakeType enum to specify wake treatment. |
'frozen'
|
bound_upwash
|
bool
|
If true, include bound surface upwash velocities as inputs. |
True
|
wake_upwash
|
bool
|
If true, include wake surface upwash velocities as inputs. |
True
|
unsteady_force
|
bool
|
If true, include unsteady force. |
True
|
Source code in src/flapjax/aero/linear/linear_uvlm.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
unpack_state_vector ¶
unpack_state_vector(x: Array) -> S
Unpack a state vector into its components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
State vector, |
required |
Returns:
| Type | Description |
|---|---|
S
|
StateUnflattened object. |
Source code in src/flapjax/utils/linear.py
286 287 288 289 290 291 292 | |
unpack_output_vector ¶
unpack_output_vector(y: Array) -> O
Unpack an output vector into its components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
Array
|
Output vector, |
required |
Returns:
| Type | Description |
|---|---|
O
|
OutputUnflattened object. |
Source code in src/flapjax/utils/linear.py
294 295 296 297 298 299 300 | |
pack_input_vector ¶
pack_input_vector(u_input: InputUnflattened) -> Array
Pack an input unflattened object into a vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u_input
|
InputUnflattened
|
InputUnflattened object. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Input vector, |
Source code in src/flapjax/utils/linear.py
362 363 364 365 366 367 368 369 370 371 372 | |
pack_state_vector ¶
pack_state_vector(x_state: StateUnflattened) -> Array
Pack a state unflattened object into a vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_state
|
StateUnflattened
|
StateUnflattened object. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
State vector, |
Source code in src/flapjax/utils/linear.py
374 375 376 377 378 379 380 381 382 383 384 | |
pack_output_vector ¶
pack_output_vector(y_output: OutputUnflattened) -> Array
Pack an output unflattened object into a vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_output
|
OutputUnflattened
|
OutputUnflattened object. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Output vector, |
Source code in src/flapjax/utils/linear.py
386 387 388 389 390 391 392 393 394 395 396 | |
get_total_input ¶
get_total_input(u: InputUnflattened) -> InputUnflattened
Get the total input by adding the reference to the input perturbation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
InputUnflattened
|
InputUnflattened perturbation object. |
required |
Returns:
| Type | Description |
|---|---|
InputUnflattened
|
InputUnflattened total object. |
Source code in src/flapjax/utils/linear.py
522 523 524 525 526 527 528 529 530 531 532 | |
get_total_state ¶
get_total_state(x: StateUnflattened) -> StateUnflattened
Get the total state by adding the reference to the state perturbation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
StateUnflattened
|
StateUnflattened perturbation object. |
required |
Returns:
| Type | Description |
|---|---|
StateUnflattened
|
StateUnflattened total object. |
Source code in src/flapjax/utils/linear.py
534 535 536 537 538 539 540 541 542 543 544 | |
get_total_output ¶
get_total_output(y: OutputUnflattened) -> OutputUnflattened
Get the total output by adding the reference to the output perturbation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
OutputUnflattened
|
OutputUnflattened perturbation object. |
required |
Returns:
| Type | Description |
|---|---|
OutputUnflattened
|
OutputUnflattened total object. |
Source code in src/flapjax/utils/linear.py
546 547 548 549 550 551 552 553 554 555 556 | |
get_total_input_t ¶
get_total_input_t(
u_t: InputUnflattened,
) -> InputUnflattened
Get the total input time history by adding the reference to the input perturbation time history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u_t
|
InputUnflattened
|
InputUnflattened perturbation time history object. |
required |
Returns:
| Type | Description |
|---|---|
InputUnflattened
|
InputUnflattened total time history object. |
Source code in src/flapjax/utils/linear.py
558 559 560 561 562 563 564 565 566 567 568 569 570 | |
get_total_state_t ¶
get_total_state_t(
x_t: StateUnflattened,
) -> StateUnflattened
Get the total state time history by adding the reference to the state perturbation time history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_t
|
StateUnflattened
|
StateUnflattened perturbation time history object. |
required |
Returns:
| Type | Description |
|---|---|
StateUnflattened
|
StateUnflattened total time history object. |
Source code in src/flapjax/utils/linear.py
572 573 574 575 576 577 578 579 580 581 582 583 584 | |
get_total_output_t ¶
get_total_output_t(
y_t: OutputUnflattened,
) -> OutputUnflattened
Get the total output time history by adding the reference to the output perturbation time history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_t
|
OutputUnflattened
|
OutputUnflattened perturbation time history object. |
required |
Returns:
| Type | Description |
|---|---|
OutputUnflattened
|
OutputUnflattened total time history object. |
Source code in src/flapjax/utils/linear.py
586 587 588 589 590 591 592 593 594 595 596 597 598 | |
get_zero_input ¶
get_zero_input() -> InputUnflattened
Get a zero input unflattened object.
Returns:
| Type | Description |
|---|---|
InputUnflattened
|
InputUnflattened object with zero arrays. |
Source code in src/flapjax/utils/linear.py
627 628 629 630 631 632 | |
get_zero_state ¶
get_zero_state() -> StateUnflattened
Get a zero state unflattened object.
Returns:
| Type | Description |
|---|---|
StateUnflattened
|
StateUnflattened object with zero arrays. |
Source code in src/flapjax/utils/linear.py
634 635 636 637 638 639 | |
get_zero_output ¶
get_zero_output() -> OutputUnflattened
Get a zero output unflattened object.
Returns:
| Type | Description |
|---|---|
OutputUnflattened
|
OutputUnflattened object with zero arrays. |
Source code in src/flapjax/utils/linear.py
641 642 643 644 645 646 | |
step_vec ¶
step_vec(x_vec: Array, u_vec: Array) -> tuple[Array, Array]
Combined state/output step in vector form, operating on total (reference + perturbation) quantities and returning perturbations relative to the reference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_vec
|
Array
|
State vector, |
required |
u_vec
|
Array
|
Input vector, |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Tuple of (state perturbation vector, output perturbation vector). |
Source code in src/flapjax/aero/linear/linear_uvlm.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | |
step ¶
step(
u_np1: AeroInputUnflattened, x_n: AeroStateUnflattened
) -> tuple[AeroStateUnflattened, AeroOutputUnflattened]
From total inputs u at timestep n+1 and states x at timestep n, compute the states at timestep n+1 and
outputs at timestep n.
Source code in src/flapjax/aero/linear/linear_uvlm.py
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
compute_jacobians ¶
compute_jacobians(
input_projection: LinearInputProjection | None = None,
output_projection: LinearOutputProjection | None = None,
residual_names: Sequence[str] | None = None,
) -> dict[
str,
tuple[
Callable[..., Any], dict[str, Any], Sequence[str]
],
]
Build the Jacobians for the linear system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_projection
|
LinearInputProjection | None
|
If set, projects the inputs onto a different space. |
None
|
output_projection
|
LinearOutputProjection | None
|
If set, projects the forcing outputs onto a different space. |
None
|
residual_names
|
Sequence[str] | None
|
If set, restrict the returned residuals to this subset to avoid redundant computation. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, tuple[Callable[..., Any], dict[str, Any], Sequence[str]]]
|
Mapping of residual name to Jacobian(s). |
Source code in src/flapjax/aero/linear/linear_uvlm.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | |
create_jacobians ¶
create_jacobians(
mode: ADMode | dict[str, ADMode] = "reverse",
batch_size: int | None = None,
input_projection: LinearInputProjection | None = None,
output_projection: LinearOutputProjection | None = None,
residual_names: Sequence[str] | None = None,
) -> dict[str, dict[str, Array]]
Compute the per-residual Jacobians using :func:jacrev_custom.
Source code in src/flapjax/aero/linear/linear_uvlm.py
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 | |
linearise ¶
linearise(
batch_size: int | None = None,
*,
input_projection: LinearInputProjection | None = None,
output_projection: LinearOutputProjection | None = None,
) -> LinearSystem
Build the linear state-space system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
batch_size
|
int | None
|
If not None, batch the Jacobian passes to reduce memory. |
None
|
input_projection
|
LinearInputProjection | None
|
Optional projection from lower-dim inputs (e.g. beam DOFs) to
|
None
|
output_projection
|
LinearOutputProjection | None
|
Optional projection from |
None
|
Returns:
| Type | Description |
|---|---|
LinearSystem
|
LinearSystem object. |
Source code in src/flapjax/aero/linear/linear_uvlm.py
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 | |
run ¶
run(
u: AeroInputUnflattened,
x0: AeroStateUnflattened | None = None,
flowfield: FlowField | None = None,
) -> AeroLinearResult
Run the linear system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
AeroInputUnflattened
|
Total input over time (reference + pertubation). |
required |
x0
|
AeroStateUnflattened | None
|
Initial state perturbations, defaults to zero state. |
None
|
flowfield
|
FlowField | None
|
FlowField object to provide flow velocities for bound and wake upwash, defaults to no flow. |
None
|
Source code in src/flapjax/aero/linear/linear_uvlm.py
878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | |
reference_snapshot ¶
reference_snapshot() -> AeroCase
Get the reference (initial) initial_snapshot of the aerodynamic case. This will set the timestep as -1.
Returns:
| Type | Description |
|---|---|
AeroCase
|
StaticAero at reference state |
Source code in src/flapjax/aero/linear/linear_uvlm.py
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 | |
plot_reference ¶
plot_reference(
directory: PathLike, plot_wake: bool = True
) -> Sequence[Path]
Plot the reference (initial) initial_snapshot of the aerodynamic case. This will set the timestep as -1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
PathLike
|
File path to save the plots to |
required |
plot_wake
|
bool
|
If True, plot the wake grid |
True
|
Source code in src/flapjax/aero/linear/linear_uvlm.py
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | |
UVLM ¶
UVLM(
grid_shapes: Sequence[
GridDiscretisation | tuple[int, int, int]
],
dof_mapping: ArrayList | Sequence[Array] | Array,
variable_wake_disc: bool = False,
mirror_point: Array | None = None,
mirror_normal: Array | None = None,
kernel: KernelFunction | None = None,
grid_func: AeroGridFunction | None = None,
free_wake: bool = False,
gamma_dot_relaxation: float | Array = 0.7,
include_unsteady_force: bool = True,
batch_size: int | None = 64,
polar_data: Sequence[Any | None] | None = None,
polar_function: Sequence[PolarFunction | None]
| None = None,
polar_circulation_scale: float = 0.0,
)
Class to define an unsteady vortex lattice method aerodynamic case with arbitrary number of aerodynamic surfaces.
Initialise UVLM class with all non-design parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid_shapes
|
Sequence[GridDiscretisation | tuple[int, int, int]]
|
Discretisations for the number of chordwise, spanwise and wake-wise panels for each surface.
May be passed as a sequence of either the GridDiscretisation class or a tuple of integers ordered as |
required |
dof_mapping
|
ArrayList | Sequence[Array] | Array
|
Mapping from aerodynamic grid points to structure grid points for each surface. |
required |
variable_wake_disc
|
bool
|
If True, allow for variable wake discretisations. |
False
|
mirror_point
|
Array | None
|
Optional point in mirror plane, |
None
|
mirror_normal
|
Array | None
|
Optional normal vector for mirror plane, |
None
|
kernel
|
KernelFunction | None
|
Input for custom kernel function to use for induced velocity calculations. |
None
|
grid_func
|
AeroGridFunction | None
|
Input functions used for defining surfaces with control surfaces. This function should take
the reference local grid coordinates |
None
|
free_wake
|
bool
|
If True, include the velocity induced from the aerodynamic elements for wake propagation. |
False
|
gamma_dot_relaxation
|
float | Array
|
Filtering parameter used for obtaining the time derivative of the circulation strengths. |
0.7
|
include_unsteady_force
|
bool
|
If True, include forces due to apparent mass for simulation. |
True
|
batch_size
|
int | None
|
Batch size for vectorising AIC computations. Larger values may result in faster computations, at the expense of increased memory usage. Setting to None is equivelant to a vmap. |
64
|
polar_data
|
Sequence[Any | None] | None
|
Optional per-surface polar database used to correct the UVLM sectional forcing, which can be an arbitrary data type. |
None
|
polar_function
|
Sequence[PolarFunction | None] | None
|
Per-surface function mapping |
None
|
polar_circulation_scale
|
float
|
Factor in |
0.0
|
Source code in src/flapjax/aero/uvlm.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | |
dt
property
writable
¶
dt: Array
Get the time step length.
Returns:
| Type | Description |
|---|---|
Array
|
Time step length. |
linearise ¶
linearise(
reference: AeroCase,
wake_type: LinearWakeType,
bound_upwash: bool = True,
wake_upwash: bool = True,
unsteady_force: bool = True,
) -> LinearUVLM
Create linearised aerodynamic model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
AeroCase
|
Reference StaticAero around which to linearise. |
required |
wake_type
|
LinearWakeType
|
Type of wake model to use in linearisation, with options given from the LinearWakeType class (frozen, prescribed, or free). Value of None defaults to prescribed. |
required |
bound_upwash
|
bool
|
If true, linearise for flowfield perturbations at the bound vortex vertex. |
True
|
wake_upwash
|
bool
|
If true, linearise for flowfield perturbations at the wake vortex vertex. |
True
|
unsteady_force
|
bool
|
If true, include unsteady force terms in linearisation. |
True
|
Returns:
| Type | Description |
|---|---|
LinearUVLM
|
LinearUVLM model, linearised at specified time step. |
Source code in src/flapjax/aero/uvlm.py
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | |
set_design_variables ¶
set_design_variables(
dt: float | Array,
flowfield: FlowField,
zeta_b0: ArrayList | Sequence[Array] | Array,
hg0: Array,
delta_w: Sequence[Array | None] | Array | None = None,
reference_cs_angles: dict[str, Array] | None = None,
) -> None
Set aerodynamic design variables for solution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dt
|
float | Array
|
Time step length |
required |
flowfield
|
FlowField
|
FlowField object defining the background flow in space and time |
required |
delta_w
|
Sequence[Array | None] | Array | None
|
Vector to define segment lengths of a variable wake discretisation per surface. If None, this will use a uniform discretisation, as in the canonical UVLM. |
None
|
zeta_b0
|
ArrayList | Sequence[Array] | Array
|
Aerodynamic local grid coordinates, |
required |
hg0
|
Array
|
Beam reference global grid coordinates, |
required |
reference_cs_angles
|
dict[str, Array] | None
|
Dictionary of {name: angle} for each control surface at the reference. If None, defaults to no control surfaces. |
None
|
Source code in src/flapjax/aero/uvlm.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
case_from_dv ¶
case_from_dv(dv: AeroDesignVariables) -> UVLM
Create a new UVLM instance as a function of design variables, allowing it to have defined gradients w.r.t. design variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dv
|
AeroDesignVariables
|
Design variables. |
required |
Returns:
| Type | Description |
|---|---|
UVLM
|
UVLM object with the same functionality as |
Source code in src/flapjax/aero/uvlm.py
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | |
get_design_variables ¶
get_design_variables(
cs_ang_t: dict[str, Array],
cs_vel_t: dict[str, Array],
grads_to_compute: AeroGradsToCompute | None,
) -> AeroDesignVariables
Extract design variables from the aerodynamic case. As the control input time histories are defined when
initialising the simulation, they are not included in self and so are passed by argument.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cs_ang_t
|
dict[str, Array]
|
Time history of control surface angles, |
required |
cs_vel_t
|
dict[str, Array]
|
Time history of control surface velocities, |
required |
grads_to_compute
|
AeroGradsToCompute | None
|
Data structure which describes which design variables should be obtained. If None, all variables are obtained. |
required |
Returns:
| Type | Description |
|---|---|
AeroDesignVariables
|
Aerodynamic design variables. |
Source code in src/flapjax/aero/uvlm.py
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 | |
hg_to_zeta_b ¶
hg_to_zeta_b(
hg_n: Array, cs_ang_n: dict[str, Array]
) -> ArrayList
Convert beam global grid coordinates to aerodynamic global grid coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_n
|
Array
|
Beam global grid coordinates at time step n, |
required |
cs_ang_n
|
dict[str, Array]
|
Control surface angles as {surface_name: angle} pairs at time step n. |
required |
Returns:
| Type | Description |
|---|---|
ArrayList
|
Full aerodynamic global grid coordinates for each surface, |
Source code in src/flapjax/aero/uvlm.py
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 | |
hg_dot_to_zeta_b_dot ¶
hg_dot_to_zeta_b_dot(
hg_n: Array,
hg_dot_n: Array,
cs_ang_n: dict[str, Array],
cs_vel_n: dict[str, Array],
) -> ArrayList
Convert beam global grid velocities to aerodynamic global grid velocities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_n
|
Array
|
Beam global grid coordinates, |
required |
hg_dot_n
|
Array
|
Beam global grid velocities, |
required |
cs_ang_n
|
dict[str, Array]
|
Control surface angles as {surface_name: angle} pairs. |
required |
cs_vel_n
|
dict[str, Array]
|
Control surface velocities as {surface_name: velocities} pairs. |
required |
Returns:
| Type | Description |
|---|---|
ArrayList
|
Full aerodynamic global grid velocities for each surface, |
Source code in src/flapjax/aero/uvlm.py
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | |
initialise_wake ¶
initialise_wake(
zeta_b: ArrayList | None = None,
) -> ArrayList
Generate initial wake grid coordinates, based on the bound grid coordinates and the freestream conditions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zeta_b
|
ArrayList | None
|
Initial wake grid coordinates, |
None
|
Returns:
| Type | Description |
|---|---|
ArrayList
|
Initial wake grid coordinates, |
Source code in src/flapjax/aero/uvlm.py
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 | |
compute_gamma_dot
staticmethod
¶
compute_gamma_dot(
gamma_b_n: ArrayList,
gamma_b_nm1: ArrayList,
gamma_b_dot_nm1: ArrayList,
dt: Array,
gamma_dot_relaxation: float | Array,
) -> ArrayList
Calculate time derivative of bound circulation strengths at specified time step using finite difference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gamma_b_n
|
ArrayList
|
Bound circulation strengths at timestep n, |
required |
gamma_b_nm1
|
ArrayList
|
Bound circulation strengths at timestep n-1, |
required |
gamma_b_dot_nm1
|
ArrayList
|
Filtered bound circulation strengths time derivative at timestep n-1, |
required |
dt
|
Array
|
Time step length. |
required |
gamma_dot_relaxation
|
float | Array
|
Relaxation factor which filters the time derivative. |
required |
Source code in src/flapjax/aero/uvlm.py
738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 | |
set_gamma_w ¶
set_gamma_w(
gamma_vec: Array, case: AeroCase, i_ts: int
) -> None
Set wake circulation strengths from total circulation strengths at specified time step. Can be passed either a full vector of strengths, or a sequence of strengths per surface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
AeroCase
|
AeroCase object. |
required |
gamma_vec
|
Array
|
Total circulation strengths vector, |
required |
i_ts
|
int
|
Timestep index. |
required |
Source code in src/flapjax/aero/uvlm.py
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | |
base_solve ¶
base_solve(
q_nm1: AeroFullStates | None,
t_n: Array,
hg_n: Array | None,
hg_nm1: Array | None,
hg_dot_n: Array | None,
static: bool,
horseshoe: bool,
cs_ang_n: dict[str, Array],
cs_ang_nm1: dict[str, Array] | None,
cs_vel_n: dict[str, Array] | None,
) -> tuple[
ArrayList,
ArrayList,
ArrayList,
ArrayList,
ArrayList | None,
ArrayList,
ArrayList,
ArrayList | None,
ArrayList,
ArrayList | None,
ArrayList,
ArrayList,
ArrayList,
ArrayList,
]
Solve the UVLM equations for a single time step from beam coordinate inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q_nm1
|
AeroFullStates | None
|
Minimal aerodynamic states from timestep n-1. |
required |
t_n
|
Array
|
Time at timestep n. |
required |
hg_n
|
Array | None
|
Beam global grid coordinates at time step n, |
required |
hg_nm1
|
Array | None
|
Beam global grid coordinates at time step n - 1, |
required |
hg_dot_n
|
Array | None
|
Beam global grid velocities, |
required |
static
|
bool
|
If True, perform a static solve. |
required |
horseshoe
|
bool
|
If True, replace the wake with a horseshoe wake in static solve which extends a fixed distance. |
required |
cs_ang_n
|
dict[str, Array]
|
Control surface angle at timestep n, {name, ()}. |
required |
cs_ang_nm1
|
dict[str, Array] | None
|
Control surface angle at timestep n - 1, {name, ()}. |
required |
cs_vel_n
|
dict[str, Array] | None
|
Control surface velocity at timestep n, {name, ()}. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ArrayList, ArrayList, ArrayList, ArrayList, ArrayList | None, ArrayList, ArrayList, ArrayList | None, ArrayList, ArrayList | None, ArrayList, ArrayList, ArrayList, ArrayList]
|
Collocation points, bound normals, bound circulation, wake circulation, bound circulation time derivative, bound grid, wake grid, bound grid time derivative, steady forcing, unsteady forcing, per-strip effective angle of attack, and per-strip lift, drag and moment coefficients. |
Source code in src/flapjax/aero/uvlm.py
792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 | |
base_solve_from_grid ¶
base_solve_from_grid(
q_nm1: AeroFullStates | None,
t_n: Array,
zeta_b_n: ArrayList,
zeta_b_nm1: ArrayList | None,
zeta_b_dot_n: ArrayList | None,
static: bool,
horseshoe: bool,
*,
linearise_variable_wake: bool = False,
nu_b: ArrayList | None = None,
nu_w: ArrayList | None = None,
) -> tuple[
ArrayList,
ArrayList,
ArrayList,
ArrayList,
ArrayList | None,
ArrayList,
ArrayList,
ArrayList | None,
ArrayList,
ArrayList | None,
ArrayList,
ArrayList,
ArrayList,
ArrayList,
]
Solve the UVLM equations for a single time step from aerodynamic grid inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q_nm1
|
AeroFullStates | None
|
Aerodynamic states carried from timestep n-1. Required for dynamic ( |
required |
t_n
|
Array
|
Time at timestep n. |
required |
zeta_b_n
|
ArrayList
|
Bound aerodynamic grid at timestep n, |
required |
zeta_b_nm1
|
ArrayList | None
|
Bound aerodynamic grid at timestep n-1, used to seed the wake-convection velocity for the free-wake case. Required for dynamic solves. |
required |
zeta_b_dot_n
|
ArrayList | None
|
Bound grid velocity at timestep n, or |
required |
static
|
bool
|
If True, perform a static solve (initialise wake, skip wake propagation and unsteady forcing). |
required |
horseshoe
|
bool
|
If True, replace the wake with a horseshoe wake in the static solve. |
required |
linearise_variable_wake
|
bool
|
If True, block gradients through the arc-length discretisation in wake propagation so it acts as a linear operator when differentiated. Used by the linear system; default False. |
False
|
nu_b
|
ArrayList | None
|
Optional additive bound upwash velocity at bound vertices, |
None
|
nu_w
|
ArrayList | None
|
Optional additive wake-convection velocity at wake vertices, |
None
|
Returns:
| Type | Description |
|---|---|
tuple[ArrayList, ArrayList, ArrayList, ArrayList, ArrayList | None, ArrayList, ArrayList, ArrayList | None, ArrayList, ArrayList | None, ArrayList, ArrayList, ArrayList, ArrayList]
|
Collocation points, bound normals, bound circulation, wake circulation, bound circulation time derivative, bound grid, wake grid, bound grid velocity, steady forcing, unsteady forcing, per-strip effective angle of attack, and per-strip lift, drag and moment coefficients sampled from the polars. |
Source code in src/flapjax/aero/uvlm.py
868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 | |
case_solve ¶
case_solve(
case: AeroCase,
i_ts: int,
hg_n: Array | None,
hg_nm1: Array | None,
hg_dot_n: Array | None,
static: bool,
horseshoe: bool,
cs_ang_n: dict[str, Array],
cs_ang_nm1: dict[str, Array] | None,
cs_vel_n: dict[str, Array] | None,
) -> AeroCase
Solve the UVLM equations for a single time step. Can be used for both static and dynamic solves. The solution is updated in-place in the case object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
AeroCase
|
Solution object. |
required |
i_ts
|
int
|
Timestep index to solve for. |
required |
hg_n
|
Array | None
|
Beam global grid coordinates at time step n, |
required |
hg_nm1
|
Array | None
|
Beam global grid coordinates at time step n-1, |
required |
hg_dot_n
|
Array | None
|
Beam global grid velocities at time step n, |
required |
static
|
bool
|
If true, perform a static solve. |
required |
horseshoe
|
bool
|
If true, replace the wake with a static_horseshoe wake in static solve which extends a fixed distance. |
required |
cs_ang_n
|
dict[str, Array]
|
Control surface angle at timestep n, {name, ()}. |
required |
cs_ang_nm1
|
dict[str, Array] | None
|
Control surface angle at timestep n - 1, {name, ()}. |
required |
cs_vel_n
|
dict[str, Array] | None
|
Control surface velocity at timestep n, {name, ()}. |
required |
Returns:
| Type | Description |
|---|---|
AeroCase
|
Solution object with data for current time step added. |
Source code in src/flapjax/aero/uvlm.py
1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 | |
initialise_case_object ¶
initialise_case_object(
n_tstep: int,
static_horseshoe: bool,
free_wake: bool,
gamma_dot_relaxation: float | Array,
cs_ang_t: dict[str, Array],
cs_vel_t: dict[str, Array],
) -> AeroCase
Initialise an AeroCase object to store the solution of the aerodynamic case for a given number of time steps. All solution data is initialised to zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_tstep
|
int
|
Number of time steps to solve for in dynamic solution. |
required |
static_horseshoe
|
bool
|
Whether a horseshoe formulation was used for the static case. |
required |
free_wake
|
bool
|
Whether to use a free wake formulation. |
required |
gamma_dot_relaxation
|
float | Array
|
Relaxation factor for damping gamma_dot. |
required |
cs_ang_t
|
dict[str, Array]
|
Control surface angle time history, |
required |
cs_vel_t
|
dict[str, Array]
|
Control surface velocity time history, |
required |
Returns:
| Type | Description |
|---|---|
AeroCase
|
AeroCase object. |
Source code in src/flapjax/aero/uvlm.py
1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 | |
static_solve ¶
static_solve(
hg: Array | None = None,
t: Array | float = 0.0,
horseshoe: bool = False,
cs_ang: dict[str, Array] | None = None,
) -> AeroCase
Solve the VLM for given static beam coordinates. TODO: add free wake
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array | None
|
Beam coordinates, |
None
|
t
|
Array | float
|
Time at which to solve static solution, used for background flowfield evaluation. |
0.0
|
horseshoe
|
bool
|
If true, replace the wake with a horseshoe wake which extends a fixed distance. |
False
|
cs_ang
|
dict[str, Array] | None
|
Control surface angles, |
None
|
Returns:
| Type | Description |
|---|---|
AeroCase
|
AeroCase solution object. |
Source code in src/flapjax/aero/uvlm.py
1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 | |
prescribed_dynamic_solve ¶
prescribed_dynamic_solve(
init_case: AeroCase,
hg_t: Array,
hg_dot_t: Array,
cs_ang_t: dict[str, Array] | None = None,
cs_vel_t: dict[str, Array] | None = None,
) -> AeroCase
Solve the UVLM for prescribed grid motions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_case
|
AeroCase
|
StaticAero object containing initial conditions for the solution at time step 0. |
required |
hg_t
|
Array
|
Beam coordinates over time, |
required |
hg_dot_t
|
Array
|
Beam coordinate time derivative over time, |
required |
cs_ang_t
|
dict[str, Array] | None
|
Control surface angle time history, {name, |
None
|
cs_vel_t
|
dict[str, Array] | None
|
Control surface velocity time history, {name, |
None
|
Returns:
| Type | Description |
|---|---|
AeroCase
|
AeroCase solution object. |
Source code in src/flapjax/aero/uvlm.py
1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 | |
reference_configuration ¶
reference_configuration() -> AeroCase
Get the reference (initial) snapshot of the aerodynamic case. This will set the timestep as -1.
Returns:
| Type | Description |
|---|---|
AeroCase
|
StaticAero object at initial time step. |
Source code in src/flapjax/aero/uvlm.py
1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 | |
plot_reference ¶
plot_reference(
directory: PathLike | str, plot_wake: bool = True
) -> Sequence[Path]
Plot the reference (initial) snapshot of the aerodynamic case. This will set the timestep as -1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
PathLike | str
|
Path to write files to. |
required |
plot_wake
|
bool
|
If True, plot the wake grid. |
True
|
Source code in src/flapjax/aero/uvlm.py
1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 | |
gamma_b_res_func ¶
gamma_b_res_func(
i_ts: int | Array,
t_n: Array,
varphi_n: Array,
v_n: Array,
gamma_b_n: Array,
gamma_w_n: Array,
zeta_w_n: Array,
dv: AeroelasticDesignVariables,
dv_full: AeroelasticDesignVariables,
struct_obj: BeamStructure,
) -> Array
Bound circulation residual used for adjoint computations.
:math:\mathbf{r}_{\Gamma_b} = \left(\boldsymbol{\mathcal{A}}_{b, n} \cdot \mathbf{n}_n\right)^{-1} \left[\left(
\boldsymbol{\mathcal{A}}_{w, n} \boldsymbol{\Gamma}_{w, n} +\mathbf{v}_{bc, n} - \dot{\boldsymbol{\zeta}}_c\right)
\cdot \mathbf{n}_n\right] + \boldsymbol{\Gamma}_{b, n}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array
|
Time step index. |
required |
t_n
|
Array
|
Time at step n. |
required |
varphi_n
|
Array
|
varphi vector at timestep n. |
required |
v_n
|
Array
|
Beam velocity vector at timestep n. |
required |
gamma_b_n
|
Array
|
Bound circulation vector at timestep n. |
required |
gamma_w_n
|
Array
|
Wake circulation vector at timestep n. |
required |
zeta_w_n
|
Array
|
Wake grid vector at timestep n. |
required |
dv
|
AeroelasticDesignVariables
|
Aeroelastic design variables. |
required |
dv_full
|
AeroelasticDesignVariables
|
Aeroelastic design variables without omissions for the variables where gradients aren't requested. |
required |
struct_obj
|
BeamStructure
|
Beam structure. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Bound circulation residual. |
Source code in src/flapjax/aero/uvlm.py
1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 | |
wake_prop_res_func ¶
wake_prop_res_func(
i_ts: int | Array,
t_n: Array,
varphi_nm1: Array,
varphi_n: Array,
gamma_b_nm1: Array,
gamma_w_nm1: Array,
gamma_w_n: Array,
zeta_w_nm1: Array,
zeta_w_n: Array,
dv: AeroelasticDesignVariables,
dv_full: AeroelasticDesignVariables,
struct_obj: BeamStructure,
) -> tuple[Array, Array]
Wake propagation residual for both grid coordinates and circulation strengths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array
|
Time step index. |
required |
t_n
|
Array
|
Time at timestep n. |
required |
varphi_nm1
|
Array
|
Beam minimal coordinates vector at timestep n-1. |
required |
varphi_n
|
Array
|
Beam maximal coordinates vector at timestep n. |
required |
gamma_b_nm1
|
Array
|
Bound circulation vector at timestep n-1. |
required |
gamma_w_nm1
|
Array
|
Wake circulation vector at timestep n-1. |
required |
gamma_w_n
|
Array
|
Wake circulation vector at timestep n. |
required |
zeta_w_nm1
|
Array
|
Wake grid vector at timestep n-1. |
required |
zeta_w_n
|
Array
|
Wake grid vector at timestep n. |
required |
dv
|
AeroelasticDesignVariables
|
Aeroelastic design variables. |
required |
dv_full
|
AeroelasticDesignVariables
|
Aeroelastic design variables without omissions. |
required |
struct_obj
|
BeamStructure
|
Beam structure. |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Wake grid and circulation residuals. |
Source code in src/flapjax/aero/uvlm.py
1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 | |
gamma_b_dot_res_func ¶
gamma_b_dot_res_func(
gamma_b_nm1: Array,
gamma_b_n: Array,
gamma_b_dot_nm1: Array,
gamma_b_dot_n: Array,
dv: AeroelasticDesignVariables,
) -> Array
Bound circulation time derivative residual.
:math:\frac{g}{h} \left[\mathbf{\Gamma}_{b, n} - \mathbf{\Gamma}_{b, n-1}\right] + (1-g)
\dot{\mathbf{\Gamma}}_{b, n-1} - \dot{\mathbf{\Gamma}}_{b, n}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gamma_b_nm1
|
Array
|
Bound circulation vector at timestep n-1. |
required |
gamma_b_n
|
Array
|
Bound circulation vector at timestep n. |
required |
gamma_b_dot_nm1
|
Array
|
Bound circulation time derivative vector at timestep n-1. |
required |
gamma_b_dot_n
|
Array
|
Bound circulation time derivative vector at timestep n. |
required |
dv
|
AeroelasticDesignVariables
|
Design variables. Whilst this function does not depend upon it, including it simplified obtaining the residual design gradient. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Bound circulation time derivative residual. |
Source code in src/flapjax/aero/uvlm.py
1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 | |
f_aero_res_func ¶
f_aero_res_func(
i_ts: int | Array,
t_n: Array,
varphi_n: Array,
v_n: Array,
gamma_b_n: Array,
gamma_w_n: Array,
gamma_b_dot_n: Array,
zeta_w_n: Array,
dv: AeroelasticDesignVariables,
dv_full: AeroelasticDesignVariables,
struct_obj: BeamStructure,
f_aero_beam_n: Array,
block_grid_gradients: bool,
solve_dofs: tuple[int, ...],
) -> Array
Aerodynamic forcing residual, compared in the local frame for compatibility with the structure.
:math:\boldsymbol{\mathcal{F}}_{\text{aero}, n}(\mathbf{\Gamma}_{b, n}, \mathbf{\Gamma}_{w, n},
\dot{\mathbf{\Gamma}}_{b, n}, \boldsymbol{\zeta}_{b, n}, \dot{\boldsymbol{\zeta}}_{b, n},
\boldsymbol{\zeta}_{w, n}) - \mathbf{f}_{\text{aero}, n}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array
|
Time step index. |
required |
t_n
|
Array
|
Time at timestep n. |
required |
varphi_n
|
Array
|
Beam minimal coordinates vector at timestep n. |
required |
v_n
|
Array
|
Beam velocity vector at timestep n. |
required |
gamma_b_n
|
Array
|
Bound circulation vector at timestep n. |
required |
gamma_w_n
|
Array
|
Wake circulation vector at timestep n. |
required |
gamma_b_dot_n
|
Array
|
Bound circulation vector time derivative at timestep n. |
required |
zeta_w_n
|
Array
|
Wake grid vector at timestep n. |
required |
dv
|
AeroelasticDesignVariables
|
Aeroelastic design variables. |
required |
dv_full
|
AeroelasticDesignVariables
|
Aeroelastic design variables without omissions. |
required |
struct_obj
|
BeamStructure
|
Beam structure. |
required |
f_aero_beam_n
|
Array
|
Local aerodynamic forcing projected onto beam. |
required |
block_grid_gradients
|
bool
|
If true, blocks the gradient path for the dependency of the steady aerodynamic forcing on the bound grid. |
required |
solve_dofs
|
tuple[int, ...]
|
Index of forces to keep for solution. |
required |
Source code in src/flapjax/aero/uvlm.py
1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 | |
timestep_residual ¶
timestep_residual(
i_ts: int | Array,
varphi_nm1: Array,
varphi_n: Array,
v_n: Array,
t_n: Array,
q_n: AeroFullStates,
q_nm1: AeroFullStates,
dv: AeroelasticDesignVariables,
dv_full: AeroelasticDesignVariables,
f_aero_beam_n: Array,
struct_obj: BeamStructure,
approx_grads: bool,
) -> Array
Compute the residual vector to the UVLM equations. These are given as:
:math:\left(\boldsymbol{\mathcal{A}}_{b, n} \cdot \mathbf{n}_n\right)^{-1} \left[\left(
\boldsymbol{\mathcal{A}}_{w, n} \boldsymbol{\Gamma}_{w, n} +\mathbf{v}_{bc, n} - \dot{\mathbf{c}}\right)
\cdot \mathbf{n}_n\right] + \boldsymbol{\Gamma}_{b, n}
:math:\boldsymbol{\mathcal{W}}_{\Gamma}(\mathbf{\Gamma}_{b, {n-1}}, \mathbf{\Gamma}_{w, {n-1}})
- \mathbf{\Gamma}_{w, n}
:math:\frac{g}{h} \left[\mathbf{\Gamma}_{b, n} - \mathbf{\Gamma}_{b, n-1}\right] + (1-g)
\dot{\mathbf{\Gamma}}_{b, n-1} - \dot{\mathbf{\Gamma}}_{b, n}
:math:\boldsymbol{\mathcal{W}}_{\zeta}(\boldsymbol{\zeta}_{b, n}, \boldsymbol{\zeta}_{w, n-1})
- \boldsymbol{\zeta}_{w, n}
:math:\boldsymbol{\mathcal{F}}_{\text{aero}, n}(\mathbf{\Gamma}_{b, n}, \mathbf{\Gamma}_{w, n},
\dot{\mathbf{\Gamma}}_{b, n}, \boldsymbol{\zeta}_{b, n}, \dot{\boldsymbol{\zeta}}_{b, n},
\boldsymbol{\zeta}_{w, n}) - \mathbf{f}_{\text{aero}, n}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array
|
Time step index. |
required |
varphi_nm1
|
Array
|
Beam minimal coordinates at timestep n-1, |
required |
varphi_n
|
Array
|
Beam maximal coordinates at timestep n, |
required |
v_n
|
Array
|
Beam velocity at timestep n, |
required |
t_n
|
Array
|
Time at step n. |
required |
q_n
|
AeroFullStates
|
Aero minimal states at timestep n. |
required |
q_nm1
|
AeroFullStates
|
Aero minimal states at timestep n-1. |
required |
dv
|
AeroelasticDesignVariables
|
Aeroelastic design variables. |
required |
dv_full
|
AeroelasticDesignVariables
|
Aeroelastic design variables without omissions. |
required |
f_aero_beam_n
|
Array
|
Aerodynamic forcing for the beam at timestep n, in the local frame. |
required |
struct_obj
|
BeamStructure
|
Beam structure. |
required |
approx_grads
|
bool
|
If true, eliminate grid gradients from the aerodynamic force residual. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Residual vector. |
Source code in src/flapjax/aero/uvlm.py
2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 | |
construct_approximate_jacobians ¶
construct_approximate_jacobians(
aero_sol: AeroCase,
structure_sol: StructureCase,
struct_obj: BeamStructure,
dv: AeroelasticDesignVariables,
dv_full: AeroelasticDesignVariables,
solve_dofs: tuple[int, ...],
jacobian_approximations: AeroJacobianApproximations,
) -> dict[str, dict[str, Callable[..., Any] | None]]
Compute approximations for the aerodynamic residual Jacobians specified in the jacobian_approximations data
structure. The residuals covered are the bound circulation, wake propagation, bound circulation rate, and
aerodynamic forcing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aero_sol
|
AeroCase
|
Aerodynamic solution from which to extract states for the initial time step. |
required |
structure_sol
|
StructureCase
|
Structural solution from which to extract states for the initial time step. |
required |
struct_obj
|
BeamStructure
|
Beam structure used by the residual functions for the kinematic transformations. |
required |
dv
|
AeroelasticDesignVariables
|
Aeroelastic design variables. |
required |
dv_full
|
AeroelasticDesignVariables
|
Aeroelastic design variables without omissions for the variables where gradients aren't requested. |
required |
solve_dofs
|
tuple[int, ...]
|
Active structural degrees of freedom. |
required |
jacobian_approximations
|
AeroJacobianApproximations
|
Data structure which defines which approximations to create. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, Callable[..., Any] | None]]
|
Dictionary of approximations keyed by residual name. |
Source code in src/flapjax/aero/uvlm.py
2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 | |
timestep_residual_jacobians ¶
timestep_residual_jacobians(
i_ts: int | Array,
varphi_nm1: Array,
varphi_n: Array,
v_n: Array,
t_n: Array,
q_n: AeroFullStates,
q_nm1: AeroFullStates,
dv: AeroelasticDesignVariables,
dv_full: AeroelasticDesignVariables,
f_aero_beam_n: Array,
struct_obj: BeamStructure,
approx_grads: bool,
solve_dofs: tuple[int, ...],
n_profile_loops: int | None,
jac_options: dict[str, dict[str, Any]],
compute_wake_gradients: bool = True,
mode: ADMode = "reverse",
map_batch_size: int | None = None,
) -> tuple[
Array,
Array,
AeroelasticDesignVariables,
Array,
Array,
dict[str, dict[str, float]] | None,
dict[str, dict[str, float]] | None,
]
Compute the Jacobians of the aerodynamic problem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array
|
Time step index. |
required |
varphi_nm1
|
Array
|
Minimal structural coordinates at timestep n-1, |
required |
varphi_n
|
Array
|
Minimal structural coordinates at timestep n, |
required |
v_n
|
Array
|
Structural velocity at timestep n, |
required |
t_n
|
Array
|
Time at timestep n. |
required |
q_n
|
AeroFullStates
|
Aerodynamic minimal states at timestep n. |
required |
q_nm1
|
AeroFullStates
|
Aerodynamic minimal states at timestep n-1. |
required |
dv
|
AeroelasticDesignVariables
|
Aeroelastic design variables. |
required |
dv_full
|
AeroelasticDesignVariables
|
Aeroelastic design variables without omissions. |
required |
f_aero_beam_n
|
Array
|
Aerodynamic forcing in local frame of reference at timestep n, |
required |
struct_obj
|
BeamStructure
|
Structural object. |
required |
approx_grads
|
bool
|
If true, eliminate grid gradients from force computation. |
required |
solve_dofs
|
tuple[int, ...]
|
Degrees of freedom to solve for. This removes non-active forcing entries. |
required |
n_profile_loops
|
int | None
|
Optional number of loops for profiling function. |
required |
jac_options
|
dict[str, dict[str, Any]]
|
Dictionary of optional functions which can be used to substitute Jacobian evaluations from AD. |
required |
compute_wake_gradients
|
bool
|
If False, skip Jacobians involving the wake for |
True
|
mode
|
ADMode
|
AD mode for obtaining gradients, either |
'reverse'
|
map_batch_size
|
int | None
|
Batch size for vectorising Jacobian construction. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, AeroelasticDesignVariables, Array, Array, dict[str, dict[str, float]] | None, dict[str, dict[str, float]] | None]
|
Gradients of aerodynamic residual with respect to previous states, current states, and design variables. Additionally, includes Jacobians of the aerodynamic residual with respect to the structural displacement and velocity, and profiling times for compilation and run time. |
Source code in src/flapjax/aero/uvlm.py
2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 | |
add_control_surface ¶
add_control_surface(
grid: Array,
angle: Array,
m_slice: Array | Sequence[int] | slice,
n_slice: Array | Sequence[int] | slice,
hinge_axis: Array = HINGE_AXIS_DEFAULT,
) -> Array
Add a control surface to a panel grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid
|
Array
|
Grid without deflection of this surface, |
required |
angle
|
Array
|
Angle in radians through which the control surface will be deflected. |
required |
m_slice
|
Array | Sequence[int] | slice
|
Slice of chordwise strips to include in the control surface. |
required |
n_slice
|
Array | Sequence[int] | slice
|
Slice of spanwise strips to include in the control surface. |
required |
hinge_axis
|
Array
|
Axis of the hinge surface in the local frame, |
HINGE_AXIS_DEFAULT
|
Returns:
| Type | Description |
|---|---|
Array
|
Deflected aerodynamic grid, |
Source code in src/flapjax/aero/utils.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
make_rectangular_grid ¶
make_rectangular_grid(
m: int,
n: int,
chord: Array | float,
ea: Array | float,
camber_line: tuple[Array, Array] | None = None,
twist: Array | float = 0.0,
) -> Array
Create a rectangular aerodynamic grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m
|
int
|
Number of panels in the chordwise direction. |
required |
n
|
int
|
Number of panels in the spanwise direction. |
required |
chord
|
Array | float
|
Surface chord length. |
required |
ea
|
Array | float
|
Elastic axis location as fraction of chord. |
required |
camber_line
|
tuple[Array, Array] | None
|
Optional mean camber line as a pair |
None
|
twist
|
Array | float
|
Built-in geometric twist angle in radians, uniform over the whole grid, applied by rotating the
local chord/camber section about the local spanwise axis ( |
0.0
|
Returns:
| Type | Description |
|---|---|
Array
|
Local grid points for planar wing, |
Source code in src/flapjax/aero/utils.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
aic ¶
compute_aic_grid ¶
compute_aic_grid(
c: Array,
n: Array | None,
zeta: Array,
kernel: KernelFunction,
batch_size: int | None,
) -> Array
Compute the aerodynamic influence coefficient (AIC) across grids of points. When normal is provided, fuses the dot product inside each map step so the trailing 3-component axis is never accumulated, saving memory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c
|
Array
|
Collocation points, |
required |
n
|
Array | None
|
Normal vectors at collocation points, |
required |
zeta
|
Array
|
Grid vertices, |
required |
kernel
|
KernelFunction
|
Kernel function to compute the influence. |
required |
batch_size
|
int | None
|
Batch size for vectorising AIC computations. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
|
Source code in src/flapjax/aero/aic.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
compute_aic_sys ¶
compute_aic_sys(
zetas: ArrayList,
cs: ArrayList,
ns: ArrayList,
kernels: Sequence[KernelFunction],
batch_size: int | None,
mirror_point: Array | None,
mirror_normal: Array | None,
) -> list[list[Array]]
Compute the AIC matrix for a system of elements. Returns a list of AIC matrices, one for each element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zetas
|
ArrayList
|
List of source points to compute the AIC from, |
required |
cs
|
ArrayList
|
List of target points to compute the AIC at, |
required |
ns
|
ArrayList
|
Bound normal vectors, |
required |
kernels
|
Sequence[KernelFunction]
|
List of kernel functions to use for each source surface, |
required |
batch_size
|
int | None
|
Batch size for vectorising AIC computations. |
required |
mirror_normal
|
Array | None
|
Normal vector to mirror across, |
required |
mirror_point
|
Array | None
|
Point on mirror plane, |
required |
Returns:
| Type | Description |
|---|---|
list[list[Array]]
|
Nested sequences of AIC matrices, |
Source code in src/flapjax/aero/aic.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
reshape_aic_sys ¶
reshape_aic_sys(aic_mat: Array) -> Array
Reshape an AIC matrix such that the source and target dimensions are flattened.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aic_mat
|
Array
|
Input AIC matrix, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Reshaped AIC matrix, |
Source code in src/flapjax/aero/aic.py
115 116 117 118 119 120 121 122 | |
assemble_aic_sys ¶
assemble_aic_sys(
aic_mats: Sequence[Sequence[Array]],
) -> Array
Assemble a nested sequence of AIC matrices into a single AIC matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aic_mats
|
Sequence[Sequence[Array]]
|
Nested sequence of AIC matrices, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Assembled AIC matrix, |
Source code in src/flapjax/aero/aic.py
125 126 127 128 129 130 131 132 133 134 | |
compute_aic_solve ¶
compute_aic_solve(
cs: ArrayList,
ns: ArrayList,
zetas_b: ArrayList,
zetas_w: ArrayList | None,
kernels_b: Sequence[KernelFunction],
kernels_w: Sequence[KernelFunction] | None,
batch_size: int | None,
mirror_point: Array | None,
mirror_normal: Array | None,
) -> Array
Compute the AIC matrix used for the UVLM solve step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cs
|
ArrayList
|
List of target points to compute the AIC at, |
required |
ns
|
ArrayList
|
Bound normal vectors, |
required |
zetas_b
|
ArrayList
|
Bound aerodynamic grids, |
required |
zetas_w
|
ArrayList | None
|
Wake aerodynamic grids, |
required |
kernels_b
|
Sequence[KernelFunction]
|
Bound grid kernels. |
required |
kernels_w
|
Sequence[KernelFunction] | None
|
Wake grid kernels. |
required |
batch_size
|
int | None
|
Batch size for vectorising AIC computations. |
required |
mirror_normal
|
Array | None
|
Normal vector to mirror across, |
required |
mirror_point
|
Array | None
|
Point on mirror plane, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Square AIC matrix for the solve step, |
Source code in src/flapjax/aero/aic.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
add_wake_influence ¶
add_wake_influence(
aic_bs: list[list[Array]], aic_ws: list[list[Array]]
) -> list[list[Array]]
Lump the wake influence onto the last column of the bound AIC matrices. This captures the steady Kutta condition by ensuring that the trailing edge panels have the same strength as all wake panels along a streamline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aic_bs
|
list[list[Array]]
|
Bound influence matrices, |
required |
aic_ws
|
list[list[Array]]
|
Wake influence matrices, |
required |
Returns:
| Type | Description |
|---|---|
list[list[Array]]
|
Updated bound influence matrices, |
Source code in src/flapjax/aero/aic.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
v_ind_vmap ¶
v_ind_vmap(
c: Array,
zeta: Array,
gamma: Array,
kernel: KernelFunction,
batch_size: int | None,
) -> Array
Compute the induced velocity by the aerodynamic elements at some points in space for a single source-target panel system. This is done without materialising the full AIC matrix, instead directly computing its contraction with the circulation strength.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c
|
Array
|
Points at which to sample the velocity, |
required |
zeta
|
Array
|
Filament grid, |
required |
gamma
|
Array
|
Circulation strengths, |
required |
kernel
|
KernelFunction
|
Kernel function. |
required |
batch_size
|
int | None
|
Batch size for vectorising AIC computations. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Induced velocity, |
Source code in src/flapjax/aero/aic.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
compute_v_ind ¶
compute_v_ind(
cs: T,
zetas: ArrayList,
gammas: ArrayList,
kernels: Sequence[KernelFunction],
mirror_point: Array | None,
mirror_normal: Array | None,
batch_size: int | None,
) -> T
Compute the induced velocity by multiple surfaces of aerodynamic elements at one or multiple grids of points in space. This is done without materialising the full AIC matrix, instead directly computing its contraction with the circulation strength.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cs
|
T
|
Points at which to sample the velocity, |
required |
zetas
|
ArrayList
|
Filament grid, |
required |
gammas
|
ArrayList
|
Circulation strengths, |
required |
kernels
|
Sequence[KernelFunction]
|
Kernel function. |
required |
mirror_point
|
Array | None
|
Mirror point, |
required |
mirror_normal
|
Array | None
|
Normal mirror vector, |
required |
batch_size
|
int | None
|
Batch size for vectorising AIC computations. |
required |
Returns:
| Type | Description |
|---|---|
T
|
Array or ArrayList of induced velocity, |
Source code in src/flapjax/aero/aic.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
data_structures ¶
GridDiscretisation
dataclass
¶
GridDiscretisation(m: int, n: int, m_star: int)
Data class to hold discretisation parameters for each aerodynamic grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m
|
int
|
Number of panels in the chordwise direction. |
required |
n
|
int
|
Number of panels in the spanwise direction. |
required |
m_star
|
int
|
Number of wake panels in the chordwise direction. |
required |
AeroCase ¶
AeroCase(
zeta_b: ArrayList,
zeta_b_dot: ArrayList,
zeta_w: ArrayList,
c: ArrayList | None,
n: ArrayList | None,
gamma_b: ArrayList,
gamma_b_dot: ArrayList | None,
gamma_w: ArrayList,
f_steady: ArrayList,
f_unsteady: ArrayList | None,
alpha: ArrayList | None,
cl: ArrayList | None,
cd: ArrayList | None,
cm: ArrayList | None,
cs_ang: dict[str, Array],
cs_vel: dict[str, Array],
kernels: Sequence[KernelFunction],
mirror_point: Array | None,
mirror_normal: Array | None,
mirror_edge_low: ArrayList | None,
mirror_edge_high: ArrayList | None,
flowfield: FlowField,
surf_b_names: Sequence[str],
surf_w_names: Sequence[str],
t: Array,
i_ts: Array | int,
dof_mapping: ArrayList,
static_horseshoe: bool,
free_wake: bool,
gamma_dot_relaxation: float | Array,
batch_size: int | None,
)
Contains an aerodynamic solution across one or many timesteps.
A single instance may represent either:
- Snapshot (single timestep): array leaves within have no leading time axis (e.g.
zeta_b[i_surf].shape == (m+1, n+1, 3),gamma_b[i_surf].shape == (m, n)).tis a scalar andi_tsis an integer - Batched (many timesteps): array leaves carry a leading
n_tstepaxis (e.g.zeta_b[i_surf].shape == (n_tstep, m+1, n+1, 3)).tis(n_tstep,)andi_tsis a(n_tstep, )array of indices.
Use is_batched to distinguish at runtime.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zeta_b
|
ArrayList
|
Bound grid coordinates, batched: |
required |
zeta_b_dot
|
ArrayList
|
Bound grid velocities, same layout as |
required |
zeta_w
|
ArrayList
|
Wake grid coordinates or |
required |
c
|
ArrayList | None
|
Bound collocation points or |
required |
n
|
ArrayList | None
|
Bound grid normals or |
required |
gamma_b
|
ArrayList
|
Bound circulation strengths, batched: |
required |
gamma_b_dot
|
ArrayList | None
|
Bound circulation time derivatives or |
required |
gamma_w
|
ArrayList
|
Wake circulation strengths. |
required |
f_steady
|
ArrayList
|
Steady force contributions. |
required |
f_unsteady
|
ArrayList | None
|
Unsteady force contributions or |
required |
alpha
|
ArrayList | None
|
Per-strip effective angle of attack extracted from the UVLM sectional lift; batched:
|
required |
cl
|
ArrayList | None
|
Per-strip lift coefficient sampled from the airfoil polars, or |
required |
cd
|
ArrayList | None
|
Per-strip drag coefficient sampled from the airfoil polars, or |
required |
cm
|
ArrayList | None
|
Per-strip moment coefficient sampled from the airfoil polars, or |
required |
cs_ang
|
dict[str, Array]
|
Control surface angle time history, |
required |
cs_vel
|
dict[str, Array]
|
Control surface velocity time history. |
required |
kernels
|
Sequence[KernelFunction]
|
Kernel functions for both bound and wake source grids. |
required |
mirror_point
|
Array | None
|
Point on mirror plane, |
required |
mirror_normal
|
Array | None
|
Normal on mirror plane, |
required |
mirror_edge_low
|
ArrayList | None
|
Per-surface booleans marking whether that surface's |
required |
mirror_edge_high
|
ArrayList | None
|
As |
required |
flowfield
|
FlowField
|
|
required |
surf_b_names
|
Sequence[str]
|
Names of bound surfaces, |
required |
surf_w_names
|
Sequence[str]
|
Names of wake surfaces, |
required |
t
|
Array
|
Time; batched: |
required |
i_ts
|
Array | int
|
Timestep index; batched: |
required |
dof_mapping
|
ArrayList
|
Map from aero grid to beam DOFs, |
required |
static_horseshoe
|
bool
|
If true, a horseshoe formulation was used for the initial static solution. |
required |
free_wake
|
bool
|
Free-wake formulation flag. |
required |
gamma_dot_relaxation
|
float | Array
|
Circulation time derivative filter. |
required |
batch_size
|
int | None
|
Batch size used for AIC vectorisation. |
required |
Source code in src/flapjax/aero/data_structures.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
get_states ¶
get_states(
i_ts: int | Array | None = None,
) -> AeroFullStates
Obtain the aerodynamic state at a given timestep (used in the adjoint solution).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array | None
|
Time step index (required for batched, ignored for snapshot). |
None
|
Returns:
| Type | Description |
|---|---|
AeroFullStates
|
Aero states. |
Source code in src/flapjax/aero/data_structures.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
gamma_full ¶
gamma_full(i_ts: int | None = None) -> ArrayList
Concatenate bound and wake circulation strengths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | None
|
Time step index (required for batched, ignored for snapshot). |
None
|
Returns:
| Type | Description |
|---|---|
ArrayList
|
Circulation strength, |
Source code in src/flapjax/aero/data_structures.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
zeta_full ¶
zeta_full(i_ts: int | None = None) -> ArrayList
Concatenate bound and wake grids.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | None
|
Time step index (required for batched, ignored for snapshot). |
None
|
Returns:
| Type | Description |
|---|---|
ArrayList
|
Grids, |
Source code in src/flapjax/aero/data_structures.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
set_arraylist_at_ts ¶
set_arraylist_at_ts(
attr: str, values: ArrayList, i_ts: int
) -> None
Set an attribute at a given timestep on a batched AeroCase.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attr
|
str
|
Name of the attribute to set. |
required |
values
|
ArrayList
|
ArrayList of per-surface values (no leading time axis). |
required |
i_ts
|
int
|
Time step index. |
required |
Source code in src/flapjax/aero/data_structures.py
345 346 347 348 349 350 351 352 353 354 355 | |
get_surf_snapshot ¶
get_surf_snapshot(
i_ts: int, i_surf: int
) -> _AeroSurfacePlot
Get single-surface plot data for a given (timestep, surface) pair on
a batched AeroCase.
Source code in src/flapjax/aero/data_structures.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |
get_surface ¶
get_surface(idx: int) -> _AeroSurfacePlot
Get single-surface plot data for the given surface on a snapshot AeroCase.
Source code in src/flapjax/aero/data_structures.py
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | |
plot ¶
plot(
directory: PathLike | str,
plot_bound: bool = True,
plot_wake: bool = True,
index: int
| Sequence[int]
| Array
| slice
| None = None,
) -> Sequence[Path]
Plot aerodynamic surfaces to VTU files (with per-surface PVD when batched).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
PathLike | str
|
Directory to save files. |
required |
plot_bound
|
bool
|
If True, plot the bound surfaces. |
True
|
plot_wake
|
bool
|
If True, plot the wake surfaces. |
True
|
index
|
int | Sequence[int] | Array | slice | None
|
For batched, timestep indices to plot (all if None). Ignored for snapshots. |
None
|
Returns:
| Type | Description |
|---|---|
Sequence[Path]
|
Sequence of paths to the saved PVD (batched) or VTU (snapshot) files. |
Source code in src/flapjax/aero/data_structures.py
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | |
project_forcing_to_beam ¶
project_forcing_to_beam(
i_ts: int,
rmat: Array,
x0_aero: ArrayList,
include_unsteady: bool,
) -> Array
Project aerodynamic forcing at i_ts onto the beam grid (global frame).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int
|
Time step index (ignored for snapshot). |
required |
rmat
|
Array
|
Rotation matrix for each node relative to reference, |
required |
x0_aero
|
ArrayList
|
Reference coordinates for aerodynamic grid, |
required |
include_unsteady
|
bool
|
If true, include unsteady forcing. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Steady and unsteady forcing projected onto the beam grid, |
Source code in src/flapjax/aero/data_structures.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | |
get_v_background ¶
get_v_background(x_target: T, i_ts: int | None = None) -> T
Background velocity at specified points and time step.
Source code in src/flapjax/aero/data_structures.py
561 562 563 564 565 566 567 568 569 570 | |
get_v_ind ¶
get_v_ind(x_target: T, i_ts: int | None = None) -> T
Induced velocity at specified points and time step.
Source code in src/flapjax/aero/data_structures.py
572 573 574 575 576 577 578 579 580 581 582 583 584 | |
get_v_tot ¶
get_v_tot(x_target: T, i_ts: int | None = None) -> T
Total (induced + background) velocity at specified points and time step.
Source code in src/flapjax/aero/data_structures.py
586 587 588 589 590 591 592 | |
to_dynamic ¶
to_dynamic(i_ts: int, n_tstep: int) -> AeroCase
Expand this snapshot into a batched AeroCase with n_tstep
timesteps, placing the current snapshot at index i_ts.
Source code in src/flapjax/aero/data_structures.py
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | |
initialise
classmethod
¶
initialise(
initial_snapshot: AeroCase, n_tstep: int
) -> AeroCase
Create a batched AeroCase from a snapshot placed at i_ts=0.
Source code in src/flapjax/aero/data_structures.py
683 684 685 686 | |
flowfields ¶
FlowField ¶
FlowField(
u_inf: Array,
rho: float | Array,
relative_motion: bool,
mach: float | Array = 0.0,
)
Base class for background flow field definitions. Allows for the definition of arbitrary flow fields which are functions of space and time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u_inf
|
Array
|
Base flow velocity, |
required |
rho
|
float | Array
|
Flow density. |
required |
relative_motion
|
bool
|
If True, the air moves, if False, the plane moves. |
required |
mach
|
float | Array
|
Freestream Mach number, used to apply a Prandtl-Glauert compressibility correction. Defaults to 0 (incompressible). |
0.0
|
Source code in src/flapjax/aero/flowfields.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
vmap_call ¶
vmap_call(x: Array, t: Array) -> Array
Vectorized version of the call method. This maps over all leading dimensions of x.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
Spatial coordinates, |
required |
t
|
Array
|
Time, () |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Flow field values at the specified coordinates, |
Source code in src/flapjax/aero/flowfields.py
63 64 65 66 67 68 69 70 71 72 73 74 | |
surf_vmap_call ¶
surf_vmap_call(xs: ArrayList, t: Array) -> ArrayList
Vectorized version of the call method over a list of surfaces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xs
|
ArrayList
|
Spatial coordinates, |
required |
t
|
Array
|
Time, () |
required |
Returns:
| Type | Description |
|---|---|
ArrayList
|
Flow field values at the specified coordinates, |
Source code in src/flapjax/aero/flowfields.py
76 77 78 79 80 81 82 83 | |
to_design_variables ¶
to_design_variables() -> dict[str, Array]
Extract the design variables associated with this flow field.
Returns:
| Type | Description |
|---|---|
dict[str, Array]
|
Dictionary of design variables. |
Source code in src/flapjax/aero/flowfields.py
85 86 87 88 89 90 | |
from_design_variables ¶
from_design_variables(
design_variables: dict[str, Array],
) -> FlowField
Create a new flow field from design variables as the inverse of self.to_design_variables().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
design_variables
|
dict[str, Array]
|
Dictionary of design variables. |
required |
Returns:
| Type | Description |
|---|---|
FlowField
|
New FlowField object. |
Source code in src/flapjax/aero/flowfields.py
92 93 94 95 96 97 98 | |
ConstantFlowField ¶
ConstantFlowField(
u_inf: Array,
rho: float | Array,
relative_motion: bool,
mach: float | Array = 0.0,
)
Bases: FlowField
Constant velocity flow field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u_inf
|
Array
|
Base flow velocity, |
required |
rho
|
float | Array
|
Flow density. |
required |
relative_motion
|
bool
|
If True, the air moves, if False, the plane moves. |
required |
mach
|
float | Array
|
Freestream Mach number, used to apply a Prandtl-Glauert compressibility correction. Defaults to 0 (incompressible). |
0.0
|
Source code in src/flapjax/aero/flowfields.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
vmap_call ¶
vmap_call(x: Array, t: Array) -> Array
Vectorized version of the call method. This maps over all leading dimensions of x.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
Spatial coordinates, |
required |
t
|
Array
|
Time, () |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Flow field values at the specified coordinates, |
Source code in src/flapjax/aero/flowfields.py
63 64 65 66 67 68 69 70 71 72 73 74 | |
surf_vmap_call ¶
surf_vmap_call(xs: ArrayList, t: Array) -> ArrayList
Vectorized version of the call method over a list of surfaces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xs
|
ArrayList
|
Spatial coordinates, |
required |
t
|
Array
|
Time, () |
required |
Returns:
| Type | Description |
|---|---|
ArrayList
|
Flow field values at the specified coordinates, |
Source code in src/flapjax/aero/flowfields.py
76 77 78 79 80 81 82 83 | |
to_design_variables ¶
to_design_variables() -> dict[str, Array]
Extract the design variables associated with this flow field.
Returns:
| Type | Description |
|---|---|
dict[str, Array]
|
Dictionary of design variables. |
Source code in src/flapjax/aero/flowfields.py
85 86 87 88 89 90 | |
from_design_variables ¶
from_design_variables(
design_variables: dict[str, Array],
) -> FlowField
Create a new flow field from design variables as the inverse of self.to_design_variables().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
design_variables
|
dict[str, Array]
|
Dictionary of design variables. |
required |
Returns:
| Type | Description |
|---|---|
FlowField
|
New FlowField object. |
Source code in src/flapjax/aero/flowfields.py
92 93 94 95 96 97 98 | |
OneMinusCosineFlowField ¶
OneMinusCosineFlowField(
u_inf: Array,
rho: float | Array,
relative_motion: bool,
gust_length: float | Array,
gust_amplitude: float | Array,
gust_travel_direction: Array | None = None,
gust_amplitude_direction: Array | None = None,
gust_x0: Array | None = None,
mach: float | Array = 0.0,
)
Bases: FlowField
One minus cosine gust flow field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u_inf
|
Array
|
Base flow velocity, |
required |
rho
|
float | Array
|
Flow density. |
required |
relative_motion
|
bool
|
If True, the air moves, if False, the plane moves. |
required |
gust_length
|
float | Array
|
Gust length. |
required |
gust_amplitude
|
float | Array
|
Gust amplitude. |
required |
gust_travel_direction
|
Array | None
|
Vector which defines the direction that the gust travels, |
None
|
gust_amplitude_direction
|
Array | None
|
Vector which defines the direction that the gust amplitude acts, |
None
|
gust_x0
|
Array | None
|
Coordinate on the initial leading edge of the gust, |
None
|
mach
|
float | Array
|
Freestream Mach number, used to apply a Prandtl-Glauert compressibility correction. Defaults to 0 (incompressible). |
0.0
|
Source code in src/flapjax/aero/flowfields.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
vmap_call ¶
vmap_call(x: Array, t: Array) -> Array
Vectorized version of the call method. This maps over all leading dimensions of x.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
Spatial coordinates, |
required |
t
|
Array
|
Time, () |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Flow field values at the specified coordinates, |
Source code in src/flapjax/aero/flowfields.py
63 64 65 66 67 68 69 70 71 72 73 74 | |
surf_vmap_call ¶
surf_vmap_call(xs: ArrayList, t: Array) -> ArrayList
Vectorized version of the call method over a list of surfaces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xs
|
ArrayList
|
Spatial coordinates, |
required |
t
|
Array
|
Time, () |
required |
Returns:
| Type | Description |
|---|---|
ArrayList
|
Flow field values at the specified coordinates, |
Source code in src/flapjax/aero/flowfields.py
76 77 78 79 80 81 82 83 | |
frequency_flowfields ¶
FrequencyFlowField ¶
FrequencyFlowField(
sigma: float | Array,
length_scale: float | Array,
u_inf: float | Array,
)
Base class for turbulence spectra used in frequency-domain gust analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sigma
|
float | Array
|
Turbulence intensity (RMS gust velocity), m/s. |
required |
length_scale
|
float | Array
|
Turbulence scale length, m. |
required |
u_inf
|
float | Array
|
Freestream velocity magnitude, m/s. |
required |
Source code in src/flapjax/aero/frequency_flowfields.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
psd ¶
psd(omega: Array) -> Array
Power spectral density of the vertical gust velocity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
omega
|
Array
|
Sampling requencies in rad/s, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
PSD values, |
Source code in src/flapjax/aero/frequency_flowfields.py
33 34 35 36 37 38 39 40 | |
VonKarmanFlowField ¶
VonKarmanFlowField(
sigma: float | Array,
length_scale: float | Array,
u_inf: float | Array,
)
Bases: FrequencyFlowField
Von Kármán continuous turbulence spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sigma
|
float | Array
|
Turbulence intensity (RMS gust velocity), m/s. |
required |
length_scale
|
float | Array
|
Turbulence scale length, m. |
required |
u_inf
|
float | Array
|
Freestream velocity magnitude, m/s. |
required |
Source code in src/flapjax/aero/frequency_flowfields.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
DrydenFlowField ¶
DrydenFlowField(
sigma: float | Array,
length_scale: float | Array,
u_inf: float | Array,
)
Bases: FrequencyFlowField
Dryden continuous turbulence spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sigma
|
float | Array
|
Turbulence intensity (RMS gust velocity), m/s. |
required |
length_scale
|
float | Array
|
Turbulence scale length, m. |
required |
u_inf
|
float | Array
|
Freestream velocity magnitude, m/s. |
required |
Source code in src/flapjax/aero/frequency_flowfields.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
gradients ¶
data_structures ¶
AeroGradsToCompute
dataclass
¶
AeroGradsToCompute(
x0_aero: bool = True,
flowfield: bool = False,
cs_ang_t: bool = False,
cs_vel_t: bool = False,
)
Class which contains flags to determine which gradients are to be computed for the aerodynamic problem during the adjoint solve. Defaults to computing only the aerodynamic grid gradients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x0_aero
|
bool
|
Aerodynamic grid coordinates. |
True
|
flowfield
|
bool
|
Flow field parameters. |
False
|
cs_ang_t
|
bool
|
Control surface deflection angle time history. |
False
|
cs_vel_t
|
bool
|
Control surface velocity time history. |
False
|
AeroFullStates ¶
AeroFullStates(
gamma_b: ArrayList,
gamma_w: ArrayList,
gamma_b_dot: ArrayList,
zeta_w: ArrayList,
)
Aerodynamic states used for the adjoint solve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gamma_b
|
ArrayList
|
Bound panel circulation strengths. |
required |
gamma_w
|
ArrayList
|
Wake panel circulation strengths. |
required |
gamma_b_dot
|
ArrayList
|
Bound grid circulation time derivatives. |
required |
zeta_w
|
ArrayList
|
Wake grid coordinates. |
required |
Source code in src/flapjax/aero/gradients/data_structures.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
n_states
property
¶
n_states: int
Obtain the total number of states contained within the data structure, being the size of the vector obtained
from self.ravel().
Returns:
| Type | Description |
|---|---|
int
|
Size of vector. |
shapes ¶
shapes() -> OrderedDict[
str, tuple[int, ...] | ArrayListShape | None
]
Obtain the shapes of all arrays within the data structure.
Returns:
| Type | Description |
|---|---|
OrderedDict[str, tuple[int, ...] | ArrayListShape | None]
|
Dictionary of {name: shape} pairs of all arrays or ArrayLists within the data structure. |
Source code in src/flapjax/aero/gradients/data_structures.py
139 140 141 142 143 144 145 146 147 148 149 | |
from_vector
staticmethod
¶
from_vector(
vect: Array,
shapes: OrderedDict[
str, tuple[int, ...] | ArrayListShape | None
],
) -> AeroFullStates
Construct an AeroFullStates object from a vector of data and a corresponding dictionary of shapes, being the inverse
of self.ravel().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vect
|
Array
|
Aerodynamic state vector. |
required |
shapes
|
OrderedDict[str, tuple[int, ...] | ArrayListShape | None]
|
Dictionary of {name: shape} pairs of all arrays or ArrayLists within the data structure. |
required |
Returns:
| Type | Description |
|---|---|
AeroFullStates
|
AeroFullStates object. |
Source code in src/flapjax/aero/gradients/data_structures.py
151 152 153 154 155 156 157 158 159 160 161 162 163 | |
ravel ¶
ravel() -> Array
Ravel the data structure to a vector, being the inverse of cls.from_vector().
Returns:
| Type | Description |
|---|---|
Array
|
Data vector containing all states. |
Source code in src/flapjax/aero/gradients/data_structures.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
AeroDesignVariables ¶
AeroDesignVariables(
zeta_b0: ArrayList | None,
flowfield: dict[str, Array] | None,
cs_ang_t: dict[str, Array] | None,
cs_vel_t: dict[str, Array] | None,
f_shape: tuple[int, ...],
)
Bases: DesignVariables
Class to hold all differentiable aerodynamic design variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zeta_b0
|
ArrayList | None
|
Bound aerodynamic grid local reference coordinates. |
required |
flowfield
|
dict[str, Array] | None
|
Dictionary of flowfield variables. |
required |
cs_ang_t
|
dict[str, Array] | None
|
Control surface angle time histories, {name: |
required |
cs_vel_t
|
dict[str, Array] | None
|
Control velocity time histories, {name: |
required |
f_shape
|
tuple[int, ...]
|
Shape of objective. As this class can hold both the primal design variables and the gradient of the objective with respect to design variables, the latter case results in arrays which have a shape which depends on the objective shape. In this case, all data has (f_shape, dv.shape) dimensionality. |
required |
Source code in src/flapjax/aero/gradients/data_structures.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
get_cs_n ¶
get_cs_n(
i_ts: int | Array, dv_full: AeroDesignVariables
) -> tuple[dict[str, Array], dict[str, Array]]
Obtain the angles and velocities for all control surfaces at a given timestep.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array
|
Timestep index. |
required |
dv_full
|
AeroDesignVariables
|
Full design variables. This is used to substitute a non-differentiable value when the control inputs are chosen to be omitted from the design variables. |
required |
Returns:
| Type | Description |
|---|---|
tuple[dict[str, Array], dict[str, Array]]
|
Dictionary of {name: value} pairs for control angles and velocities. |
Source code in src/flapjax/aero/gradients/data_structures.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
premultiply_adj ¶
premultiply_adj(adj: Array) -> AeroDesignVariables
Premultiply all design gradients by the adjoint vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adj
|
Array
|
Adjoint vector. |
required |
Returns:
| Type | Description |
|---|---|
AeroDesignVariables
|
Adjoint-Jacobian product. |
Source code in src/flapjax/aero/gradients/data_structures.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
to_dict ¶
to_dict() -> dict[
str, Array | ArrayList | dict[str, Array] | None
]
Extract the design variables as a dictionary.
Returns:
| Type | Description |
|---|---|
dict[str, Array | ArrayList | dict[str, Array] | None]
|
Dictionary of design variable name and value pairs. |
Source code in src/flapjax/aero/gradients/data_structures.py
329 330 331 332 333 334 335 336 337 338 339 | |
plot ¶
plot(
case: AeroCase,
rmat_nodal: ArrayList | None,
directory: PathLike | str,
) -> Sequence[Path]
Plot the aerodynamic grid gradient for cases with a scalar objective.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
AeroCase
|
Dynamic aerodynamic case object. This should only contain 1 time step, as the gradients for the grid are constant across all time steps. |
required |
rmat_nodal
|
ArrayList | None
|
Rotation matrices from beam. As the aerodynamic grid gradients are given in the local frame
(as this is where |
required |
directory
|
PathLike | str
|
Directory in which to save the plots. |
required |
Returns:
| Type | Description |
|---|---|
Sequence[Path]
|
Sequence of paths of data created. |
Source code in src/flapjax/aero/gradients/data_structures.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | |
linear ¶
AeroLinearResult ¶
AeroLinearResult(
reference: AeroCase,
u_t: AeroInputUnflattened,
x_t: AeroStateUnflattened,
y_t: AeroOutputUnflattened,
u_t_tot: AeroInputUnflattened,
x_t_tot: AeroStateUnflattened,
y_t_tot: AeroOutputUnflattened,
n_tstep: int,
n_surf: int,
t: Array,
surf_b_names: list[str],
surf_w_names: list[str],
)
Source code in src/flapjax/aero/linear/data_structures.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
plot ¶
plot(
directory: str | PathLike,
index: slice
| Sequence[int]
| int
| Array
| None = None,
plot_wake: bool = True,
) -> None
Plot the aerodynamic grid at specified time steps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str | PathLike
|
Directory to save the plots to |
required |
index
|
slice | Sequence[int] | int | Array | None
|
Index or slice of time steps to plot. If None, plot all time steps. |
None
|
plot_wake
|
bool
|
If True, plot the wake grid |
True
|
Source code in src/flapjax/aero/linear/data_structures.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
LinearUVLM ¶
LinearUVLM(
case: UVLM,
reference: AeroCase,
wake_type: LinearWakeType = "frozen",
bound_upwash: bool = True,
wake_upwash: bool = True,
unsteady_force: bool = True,
*,
skip_checks: bool = False,
skip_linearisation: bool = False,
)
Bases: LinearModel[AeroCase, AeroInputUnflattened, AeroStateUnflattened, AeroOutputUnflattened, AeroLinearResult]
Class to represent a linearised UVLM aerodynamic system about a reference state.
Initialise linear UVLM system about a reference state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
UVLM
|
UVLM case object to linearise. |
required |
reference
|
AeroCase
|
StaticAero representing the reference state for linearisation. |
required |
wake_type
|
LinearWakeType
|
Instance of LinearWakeType enum to specify wake treatment. |
'frozen'
|
bound_upwash
|
bool
|
If true, include bound surface upwash velocities as inputs. |
True
|
wake_upwash
|
bool
|
If true, include wake surface upwash velocities as inputs. |
True
|
unsteady_force
|
bool
|
If true, include unsteady force. |
True
|
Source code in src/flapjax/aero/linear/linear_uvlm.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
unpack_state_vector ¶
unpack_state_vector(x: Array) -> S
Unpack a state vector into its components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
State vector, |
required |
Returns:
| Type | Description |
|---|---|
S
|
StateUnflattened object. |
Source code in src/flapjax/utils/linear.py
286 287 288 289 290 291 292 | |
unpack_output_vector ¶
unpack_output_vector(y: Array) -> O
Unpack an output vector into its components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
Array
|
Output vector, |
required |
Returns:
| Type | Description |
|---|---|
O
|
OutputUnflattened object. |
Source code in src/flapjax/utils/linear.py
294 295 296 297 298 299 300 | |
pack_input_vector ¶
pack_input_vector(u_input: InputUnflattened) -> Array
Pack an input unflattened object into a vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u_input
|
InputUnflattened
|
InputUnflattened object. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Input vector, |
Source code in src/flapjax/utils/linear.py
362 363 364 365 366 367 368 369 370 371 372 | |
pack_state_vector ¶
pack_state_vector(x_state: StateUnflattened) -> Array
Pack a state unflattened object into a vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_state
|
StateUnflattened
|
StateUnflattened object. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
State vector, |
Source code in src/flapjax/utils/linear.py
374 375 376 377 378 379 380 381 382 383 384 | |
pack_output_vector ¶
pack_output_vector(y_output: OutputUnflattened) -> Array
Pack an output unflattened object into a vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_output
|
OutputUnflattened
|
OutputUnflattened object. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Output vector, |
Source code in src/flapjax/utils/linear.py
386 387 388 389 390 391 392 393 394 395 396 | |
get_total_input ¶
get_total_input(u: InputUnflattened) -> InputUnflattened
Get the total input by adding the reference to the input perturbation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
InputUnflattened
|
InputUnflattened perturbation object. |
required |
Returns:
| Type | Description |
|---|---|
InputUnflattened
|
InputUnflattened total object. |
Source code in src/flapjax/utils/linear.py
522 523 524 525 526 527 528 529 530 531 532 | |
get_total_state ¶
get_total_state(x: StateUnflattened) -> StateUnflattened
Get the total state by adding the reference to the state perturbation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
StateUnflattened
|
StateUnflattened perturbation object. |
required |
Returns:
| Type | Description |
|---|---|
StateUnflattened
|
StateUnflattened total object. |
Source code in src/flapjax/utils/linear.py
534 535 536 537 538 539 540 541 542 543 544 | |
get_total_output ¶
get_total_output(y: OutputUnflattened) -> OutputUnflattened
Get the total output by adding the reference to the output perturbation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
OutputUnflattened
|
OutputUnflattened perturbation object. |
required |
Returns:
| Type | Description |
|---|---|
OutputUnflattened
|
OutputUnflattened total object. |
Source code in src/flapjax/utils/linear.py
546 547 548 549 550 551 552 553 554 555 556 | |
get_total_input_t ¶
get_total_input_t(
u_t: InputUnflattened,
) -> InputUnflattened
Get the total input time history by adding the reference to the input perturbation time history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u_t
|
InputUnflattened
|
InputUnflattened perturbation time history object. |
required |
Returns:
| Type | Description |
|---|---|
InputUnflattened
|
InputUnflattened total time history object. |
Source code in src/flapjax/utils/linear.py
558 559 560 561 562 563 564 565 566 567 568 569 570 | |
get_total_state_t ¶
get_total_state_t(
x_t: StateUnflattened,
) -> StateUnflattened
Get the total state time history by adding the reference to the state perturbation time history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_t
|
StateUnflattened
|
StateUnflattened perturbation time history object. |
required |
Returns:
| Type | Description |
|---|---|
StateUnflattened
|
StateUnflattened total time history object. |
Source code in src/flapjax/utils/linear.py
572 573 574 575 576 577 578 579 580 581 582 583 584 | |
get_total_output_t ¶
get_total_output_t(
y_t: OutputUnflattened,
) -> OutputUnflattened
Get the total output time history by adding the reference to the output perturbation time history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_t
|
OutputUnflattened
|
OutputUnflattened perturbation time history object. |
required |
Returns:
| Type | Description |
|---|---|
OutputUnflattened
|
OutputUnflattened total time history object. |
Source code in src/flapjax/utils/linear.py
586 587 588 589 590 591 592 593 594 595 596 597 598 | |
get_zero_input ¶
get_zero_input() -> InputUnflattened
Get a zero input unflattened object.
Returns:
| Type | Description |
|---|---|
InputUnflattened
|
InputUnflattened object with zero arrays. |
Source code in src/flapjax/utils/linear.py
627 628 629 630 631 632 | |
get_zero_state ¶
get_zero_state() -> StateUnflattened
Get a zero state unflattened object.
Returns:
| Type | Description |
|---|---|
StateUnflattened
|
StateUnflattened object with zero arrays. |
Source code in src/flapjax/utils/linear.py
634 635 636 637 638 639 | |
get_zero_output ¶
get_zero_output() -> OutputUnflattened
Get a zero output unflattened object.
Returns:
| Type | Description |
|---|---|
OutputUnflattened
|
OutputUnflattened object with zero arrays. |
Source code in src/flapjax/utils/linear.py
641 642 643 644 645 646 | |
step_vec ¶
step_vec(x_vec: Array, u_vec: Array) -> tuple[Array, Array]
Combined state/output step in vector form, operating on total (reference + perturbation) quantities and returning perturbations relative to the reference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_vec
|
Array
|
State vector, |
required |
u_vec
|
Array
|
Input vector, |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Tuple of (state perturbation vector, output perturbation vector). |
Source code in src/flapjax/aero/linear/linear_uvlm.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | |
step ¶
step(
u_np1: AeroInputUnflattened, x_n: AeroStateUnflattened
) -> tuple[AeroStateUnflattened, AeroOutputUnflattened]
From total inputs u at timestep n+1 and states x at timestep n, compute the states at timestep n+1 and
outputs at timestep n.
Source code in src/flapjax/aero/linear/linear_uvlm.py
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
compute_jacobians ¶
compute_jacobians(
input_projection: LinearInputProjection | None = None,
output_projection: LinearOutputProjection | None = None,
residual_names: Sequence[str] | None = None,
) -> dict[
str,
tuple[
Callable[..., Any], dict[str, Any], Sequence[str]
],
]
Build the Jacobians for the linear system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_projection
|
LinearInputProjection | None
|
If set, projects the inputs onto a different space. |
None
|
output_projection
|
LinearOutputProjection | None
|
If set, projects the forcing outputs onto a different space. |
None
|
residual_names
|
Sequence[str] | None
|
If set, restrict the returned residuals to this subset to avoid redundant computation. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, tuple[Callable[..., Any], dict[str, Any], Sequence[str]]]
|
Mapping of residual name to Jacobian(s). |
Source code in src/flapjax/aero/linear/linear_uvlm.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | |
create_jacobians ¶
create_jacobians(
mode: ADMode | dict[str, ADMode] = "reverse",
batch_size: int | None = None,
input_projection: LinearInputProjection | None = None,
output_projection: LinearOutputProjection | None = None,
residual_names: Sequence[str] | None = None,
) -> dict[str, dict[str, Array]]
Compute the per-residual Jacobians using :func:jacrev_custom.
Source code in src/flapjax/aero/linear/linear_uvlm.py
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 | |
linearise ¶
linearise(
batch_size: int | None = None,
*,
input_projection: LinearInputProjection | None = None,
output_projection: LinearOutputProjection | None = None,
) -> LinearSystem
Build the linear state-space system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
batch_size
|
int | None
|
If not None, batch the Jacobian passes to reduce memory. |
None
|
input_projection
|
LinearInputProjection | None
|
Optional projection from lower-dim inputs (e.g. beam DOFs) to
|
None
|
output_projection
|
LinearOutputProjection | None
|
Optional projection from |
None
|
Returns:
| Type | Description |
|---|---|
LinearSystem
|
LinearSystem object. |
Source code in src/flapjax/aero/linear/linear_uvlm.py
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 | |
run ¶
run(
u: AeroInputUnflattened,
x0: AeroStateUnflattened | None = None,
flowfield: FlowField | None = None,
) -> AeroLinearResult
Run the linear system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
AeroInputUnflattened
|
Total input over time (reference + pertubation). |
required |
x0
|
AeroStateUnflattened | None
|
Initial state perturbations, defaults to zero state. |
None
|
flowfield
|
FlowField | None
|
FlowField object to provide flow velocities for bound and wake upwash, defaults to no flow. |
None
|
Source code in src/flapjax/aero/linear/linear_uvlm.py
878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | |
reference_snapshot ¶
reference_snapshot() -> AeroCase
Get the reference (initial) initial_snapshot of the aerodynamic case. This will set the timestep as -1.
Returns:
| Type | Description |
|---|---|
AeroCase
|
StaticAero at reference state |
Source code in src/flapjax/aero/linear/linear_uvlm.py
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 | |
plot_reference ¶
plot_reference(
directory: PathLike, plot_wake: bool = True
) -> Sequence[Path]
Plot the reference (initial) initial_snapshot of the aerodynamic case. This will set the timestep as -1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
PathLike
|
File path to save the plots to |
required |
plot_wake
|
bool
|
If True, plot the wake grid |
True
|
Source code in src/flapjax/aero/linear/linear_uvlm.py
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | |
data_structures ¶
AeroLinearResult ¶
AeroLinearResult(
reference: AeroCase,
u_t: AeroInputUnflattened,
x_t: AeroStateUnflattened,
y_t: AeroOutputUnflattened,
u_t_tot: AeroInputUnflattened,
x_t_tot: AeroStateUnflattened,
y_t_tot: AeroOutputUnflattened,
n_tstep: int,
n_surf: int,
t: Array,
surf_b_names: list[str],
surf_w_names: list[str],
)
Source code in src/flapjax/aero/linear/data_structures.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
plot ¶
plot(
directory: str | PathLike,
index: slice
| Sequence[int]
| int
| Array
| None = None,
plot_wake: bool = True,
) -> None
Plot the aerodynamic grid at specified time steps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str | PathLike
|
Directory to save the plots to |
required |
index
|
slice | Sequence[int] | int | Array | None
|
Index or slice of time steps to plot. If None, plot all time steps. |
None
|
plot_wake
|
bool
|
If True, plot the wake grid |
True
|
Source code in src/flapjax/aero/linear/data_structures.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
linear_uvlm ¶
LinearInputProjection
dataclass
¶
LinearInputProjection(
arg_names: tuple[str, ...],
arg_sizes: tuple[int, ...],
arg_refs: tuple[Array, ...],
to_zeta: Callable[..., tuple[Array, Array]],
)
Projection of grid coordinates and velocities from a lower-dimensional input space (e.g. beam DOFs) to
(zeta_b_np1_vec, zeta_b_dot_np1_vec).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arg_names
|
tuple[str, ...]
|
Names of the projected input dofs (used as column labels). |
required |
arg_sizes
|
tuple[int, ...]
|
Sizes of each projected input dof block. |
required |
arg_refs
|
tuple[Array, ...]
|
Reference values for the projected inputs. |
required |
to_zeta
|
Callable[..., tuple[Array, Array]]
|
Callable |
required |
LinearOutputProjection
dataclass
¶
LinearOutputProjection(
name: str,
size: int,
to_output: Callable[[Array, Array | None], Array],
)
Projection of forces from the full aerodynamic grid to a single output space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the projected output block (used as row label). |
required |
size
|
int
|
Size of the projected output. |
required |
to_output
|
Callable[[Array, Array | None], Array]
|
Callable |
required |
LinearUVLM ¶
LinearUVLM(
case: UVLM,
reference: AeroCase,
wake_type: LinearWakeType = "frozen",
bound_upwash: bool = True,
wake_upwash: bool = True,
unsteady_force: bool = True,
*,
skip_checks: bool = False,
skip_linearisation: bool = False,
)
Bases: LinearModel[AeroCase, AeroInputUnflattened, AeroStateUnflattened, AeroOutputUnflattened, AeroLinearResult]
Class to represent a linearised UVLM aerodynamic system about a reference state.
Initialise linear UVLM system about a reference state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
UVLM
|
UVLM case object to linearise. |
required |
reference
|
AeroCase
|
StaticAero representing the reference state for linearisation. |
required |
wake_type
|
LinearWakeType
|
Instance of LinearWakeType enum to specify wake treatment. |
'frozen'
|
bound_upwash
|
bool
|
If true, include bound surface upwash velocities as inputs. |
True
|
wake_upwash
|
bool
|
If true, include wake surface upwash velocities as inputs. |
True
|
unsteady_force
|
bool
|
If true, include unsteady force. |
True
|
Source code in src/flapjax/aero/linear/linear_uvlm.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
step_vec ¶
step_vec(x_vec: Array, u_vec: Array) -> tuple[Array, Array]
Combined state/output step in vector form, operating on total (reference + perturbation) quantities and returning perturbations relative to the reference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_vec
|
Array
|
State vector, |
required |
u_vec
|
Array
|
Input vector, |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Tuple of (state perturbation vector, output perturbation vector). |
Source code in src/flapjax/aero/linear/linear_uvlm.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | |
step ¶
step(
u_np1: AeroInputUnflattened, x_n: AeroStateUnflattened
) -> tuple[AeroStateUnflattened, AeroOutputUnflattened]
From total inputs u at timestep n+1 and states x at timestep n, compute the states at timestep n+1 and
outputs at timestep n.
Source code in src/flapjax/aero/linear/linear_uvlm.py
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
compute_jacobians ¶
compute_jacobians(
input_projection: LinearInputProjection | None = None,
output_projection: LinearOutputProjection | None = None,
residual_names: Sequence[str] | None = None,
) -> dict[
str,
tuple[
Callable[..., Any], dict[str, Any], Sequence[str]
],
]
Build the Jacobians for the linear system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_projection
|
LinearInputProjection | None
|
If set, projects the inputs onto a different space. |
None
|
output_projection
|
LinearOutputProjection | None
|
If set, projects the forcing outputs onto a different space. |
None
|
residual_names
|
Sequence[str] | None
|
If set, restrict the returned residuals to this subset to avoid redundant computation. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, tuple[Callable[..., Any], dict[str, Any], Sequence[str]]]
|
Mapping of residual name to Jacobian(s). |
Source code in src/flapjax/aero/linear/linear_uvlm.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | |
create_jacobians ¶
create_jacobians(
mode: ADMode | dict[str, ADMode] = "reverse",
batch_size: int | None = None,
input_projection: LinearInputProjection | None = None,
output_projection: LinearOutputProjection | None = None,
residual_names: Sequence[str] | None = None,
) -> dict[str, dict[str, Array]]
Compute the per-residual Jacobians using :func:jacrev_custom.
Source code in src/flapjax/aero/linear/linear_uvlm.py
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 | |
linearise ¶
linearise(
batch_size: int | None = None,
*,
input_projection: LinearInputProjection | None = None,
output_projection: LinearOutputProjection | None = None,
) -> LinearSystem
Build the linear state-space system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
batch_size
|
int | None
|
If not None, batch the Jacobian passes to reduce memory. |
None
|
input_projection
|
LinearInputProjection | None
|
Optional projection from lower-dim inputs (e.g. beam DOFs) to
|
None
|
output_projection
|
LinearOutputProjection | None
|
Optional projection from |
None
|
Returns:
| Type | Description |
|---|---|
LinearSystem
|
LinearSystem object. |
Source code in src/flapjax/aero/linear/linear_uvlm.py
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 | |
run ¶
run(
u: AeroInputUnflattened,
x0: AeroStateUnflattened | None = None,
flowfield: FlowField | None = None,
) -> AeroLinearResult
Run the linear system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
AeroInputUnflattened
|
Total input over time (reference + pertubation). |
required |
x0
|
AeroStateUnflattened | None
|
Initial state perturbations, defaults to zero state. |
None
|
flowfield
|
FlowField | None
|
FlowField object to provide flow velocities for bound and wake upwash, defaults to no flow. |
None
|
Source code in src/flapjax/aero/linear/linear_uvlm.py
878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | |
reference_snapshot ¶
reference_snapshot() -> AeroCase
Get the reference (initial) initial_snapshot of the aerodynamic case. This will set the timestep as -1.
Returns:
| Type | Description |
|---|---|
AeroCase
|
StaticAero at reference state |
Source code in src/flapjax/aero/linear/linear_uvlm.py
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 | |
plot_reference ¶
plot_reference(
directory: PathLike, plot_wake: bool = True
) -> Sequence[Path]
Plot the reference (initial) initial_snapshot of the aerodynamic case. This will set the timestep as -1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
PathLike
|
File path to save the plots to |
required |
plot_wake
|
bool
|
If True, plot the wake grid |
True
|
Source code in src/flapjax/aero/linear/linear_uvlm.py
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | |
unpack_state_vector ¶
unpack_state_vector(x: Array) -> S
Unpack a state vector into its components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
State vector, |
required |
Returns:
| Type | Description |
|---|---|
S
|
StateUnflattened object. |
Source code in src/flapjax/utils/linear.py
286 287 288 289 290 291 292 | |
unpack_output_vector ¶
unpack_output_vector(y: Array) -> O
Unpack an output vector into its components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
Array
|
Output vector, |
required |
Returns:
| Type | Description |
|---|---|
O
|
OutputUnflattened object. |
Source code in src/flapjax/utils/linear.py
294 295 296 297 298 299 300 | |
pack_input_vector ¶
pack_input_vector(u_input: InputUnflattened) -> Array
Pack an input unflattened object into a vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u_input
|
InputUnflattened
|
InputUnflattened object. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Input vector, |
Source code in src/flapjax/utils/linear.py
362 363 364 365 366 367 368 369 370 371 372 | |
pack_state_vector ¶
pack_state_vector(x_state: StateUnflattened) -> Array
Pack a state unflattened object into a vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_state
|
StateUnflattened
|
StateUnflattened object. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
State vector, |
Source code in src/flapjax/utils/linear.py
374 375 376 377 378 379 380 381 382 383 384 | |
pack_output_vector ¶
pack_output_vector(y_output: OutputUnflattened) -> Array
Pack an output unflattened object into a vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_output
|
OutputUnflattened
|
OutputUnflattened object. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Output vector, |
Source code in src/flapjax/utils/linear.py
386 387 388 389 390 391 392 393 394 395 396 | |
get_total_input ¶
get_total_input(u: InputUnflattened) -> InputUnflattened
Get the total input by adding the reference to the input perturbation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
InputUnflattened
|
InputUnflattened perturbation object. |
required |
Returns:
| Type | Description |
|---|---|
InputUnflattened
|
InputUnflattened total object. |
Source code in src/flapjax/utils/linear.py
522 523 524 525 526 527 528 529 530 531 532 | |
get_total_state ¶
get_total_state(x: StateUnflattened) -> StateUnflattened
Get the total state by adding the reference to the state perturbation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
StateUnflattened
|
StateUnflattened perturbation object. |
required |
Returns:
| Type | Description |
|---|---|
StateUnflattened
|
StateUnflattened total object. |
Source code in src/flapjax/utils/linear.py
534 535 536 537 538 539 540 541 542 543 544 | |
get_total_output ¶
get_total_output(y: OutputUnflattened) -> OutputUnflattened
Get the total output by adding the reference to the output perturbation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
OutputUnflattened
|
OutputUnflattened perturbation object. |
required |
Returns:
| Type | Description |
|---|---|
OutputUnflattened
|
OutputUnflattened total object. |
Source code in src/flapjax/utils/linear.py
546 547 548 549 550 551 552 553 554 555 556 | |
get_total_input_t ¶
get_total_input_t(
u_t: InputUnflattened,
) -> InputUnflattened
Get the total input time history by adding the reference to the input perturbation time history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u_t
|
InputUnflattened
|
InputUnflattened perturbation time history object. |
required |
Returns:
| Type | Description |
|---|---|
InputUnflattened
|
InputUnflattened total time history object. |
Source code in src/flapjax/utils/linear.py
558 559 560 561 562 563 564 565 566 567 568 569 570 | |
get_total_state_t ¶
get_total_state_t(
x_t: StateUnflattened,
) -> StateUnflattened
Get the total state time history by adding the reference to the state perturbation time history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_t
|
StateUnflattened
|
StateUnflattened perturbation time history object. |
required |
Returns:
| Type | Description |
|---|---|
StateUnflattened
|
StateUnflattened total time history object. |
Source code in src/flapjax/utils/linear.py
572 573 574 575 576 577 578 579 580 581 582 583 584 | |
get_total_output_t ¶
get_total_output_t(
y_t: OutputUnflattened,
) -> OutputUnflattened
Get the total output time history by adding the reference to the output perturbation time history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_t
|
OutputUnflattened
|
OutputUnflattened perturbation time history object. |
required |
Returns:
| Type | Description |
|---|---|
OutputUnflattened
|
OutputUnflattened total time history object. |
Source code in src/flapjax/utils/linear.py
586 587 588 589 590 591 592 593 594 595 596 597 598 | |
get_zero_input ¶
get_zero_input() -> InputUnflattened
Get a zero input unflattened object.
Returns:
| Type | Description |
|---|---|
InputUnflattened
|
InputUnflattened object with zero arrays. |
Source code in src/flapjax/utils/linear.py
627 628 629 630 631 632 | |
get_zero_state ¶
get_zero_state() -> StateUnflattened
Get a zero state unflattened object.
Returns:
| Type | Description |
|---|---|
StateUnflattened
|
StateUnflattened object with zero arrays. |
Source code in src/flapjax/utils/linear.py
634 635 636 637 638 639 | |
get_zero_output ¶
get_zero_output() -> OutputUnflattened
Get a zero output unflattened object.
Returns:
| Type | Description |
|---|---|
OutputUnflattened
|
OutputUnflattened object with zero arrays. |
Source code in src/flapjax/utils/linear.py
641 642 643 644 645 646 | |
utils ¶
DynamicAeroSolver ¶
Bases: Protocol
Required methods for a dynamic aerodynamic solver that can be coupled into the structural solver.
make_rectangular_grid ¶
make_rectangular_grid(
m: int,
n: int,
chord: Array | float,
ea: Array | float,
camber_line: tuple[Array, Array] | None = None,
twist: Array | float = 0.0,
) -> Array
Create a rectangular aerodynamic grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m
|
int
|
Number of panels in the chordwise direction. |
required |
n
|
int
|
Number of panels in the spanwise direction. |
required |
chord
|
Array | float
|
Surface chord length. |
required |
ea
|
Array | float
|
Elastic axis location as fraction of chord. |
required |
camber_line
|
tuple[Array, Array] | None
|
Optional mean camber line as a pair |
None
|
twist
|
Array | float
|
Built-in geometric twist angle in radians, uniform over the whole grid, applied by rotating the
local chord/camber section about the local spanwise axis ( |
0.0
|
Returns:
| Type | Description |
|---|---|
Array
|
Local grid points for planar wing, |
Source code in src/flapjax/aero/utils.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
add_control_surface ¶
add_control_surface(
grid: Array,
angle: Array,
m_slice: Array | Sequence[int] | slice,
n_slice: Array | Sequence[int] | slice,
hinge_axis: Array = HINGE_AXIS_DEFAULT,
) -> Array
Add a control surface to a panel grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid
|
Array
|
Grid without deflection of this surface, |
required |
angle
|
Array
|
Angle in radians through which the control surface will be deflected. |
required |
m_slice
|
Array | Sequence[int] | slice
|
Slice of chordwise strips to include in the control surface. |
required |
n_slice
|
Array | Sequence[int] | slice
|
Slice of spanwise strips to include in the control surface. |
required |
hinge_axis
|
Array
|
Axis of the hinge surface in the local frame, |
HINGE_AXIS_DEFAULT
|
Returns:
| Type | Description |
|---|---|
Array
|
Deflected aerodynamic grid, |
Source code in src/flapjax/aero/utils.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
compute_surf_c ¶
compute_surf_c(zeta: Array) -> Array
Compute the colocation points for a given grid of points on a single surface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zeta
|
Array
|
Grid of points, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Colocation points, |
Source code in src/flapjax/aero/utils.py
111 112 113 114 115 116 117 | |
compute_surf_nc ¶
compute_surf_nc(zeta: Array) -> Array
Compute the surface normal vectors for a given grid of points on a single surface. These have length equal to the area of their corresponding panel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zeta
|
Array
|
Grid of points, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Normal vectors, |
Source code in src/flapjax/aero/utils.py
120 121 122 123 124 125 126 127 128 129 | |
compute_c ¶
compute_c(zetas: ArrayList) -> ArrayList
Compute the colocation points for a list of surface grids.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zetas
|
ArrayList
|
Grids of points, |
required |
Returns:
| Type | Description |
|---|---|
ArrayList
|
Colocation points |
Source code in src/flapjax/aero/utils.py
132 133 134 135 136 137 138 | |
compute_nc ¶
compute_nc(zetas: ArrayList) -> ArrayList
Compute the surface normal vectors for a list of surface grids.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zetas
|
ArrayList
|
Grids of points, |
required |
Returns:
| Type | Description |
|---|---|
ArrayList
|
Normal vectors |
Source code in src/flapjax/aero/utils.py
141 142 143 144 145 146 147 | |
compute_mirror_edges ¶
compute_mirror_edges(
zeta_b_ref: ArrayList,
mirror_point: Array | None,
mirror_normal: Array | None,
) -> tuple[ArrayList, ArrayList]
Determine which surfaces have an edge coinciding with a mirror plane.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zeta_b_ref
|
ArrayList
|
Reference bound grid coordinates, |
required |
mirror_point
|
Array | None
|
Point on mirror plane, |
required |
mirror_normal
|
Array | None
|
Normal vector to mirror across, |
required |
Returns:
| Type | Description |
|---|---|
tuple[ArrayList, ArrayList]
|
Per-surface booleans for the low and high spanwise edges, each |
Source code in src/flapjax/aero/utils.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
compute_steady_forcing ¶
compute_steady_forcing(
zeta_b: ArrayList,
zeta_dot_b: ArrayList | None,
gamma_b: ArrayList,
gamma_w: ArrayList,
rho: Array,
v_func: Callable[[Array], Array],
v_inputs: ArrayList | None,
mirror_point: Array | None = None,
mirror_normal: Array | None = None,
mirror_edge_low: ArrayList | None = None,
mirror_edge_high: ArrayList | None = None,
) -> ArrayList
Calculate steady aerodynamic forcing for all surfaces at specified time step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zeta_b
|
ArrayList
|
Bound grid coordinates, |
required |
zeta_dot_b
|
ArrayList | None
|
Bound grid velocities, |
required |
gamma_b
|
ArrayList
|
Bound grid circulation, |
required |
gamma_w
|
ArrayList
|
Wake grid circulation, |
required |
rho
|
Array
|
Flow field density. |
required |
v_func
|
Callable[[Array], Array]
|
Total velocity as a function of coordinate. |
required |
v_inputs
|
ArrayList | None
|
Additive inputs for total velocity on bound grid vertex, used for the linear solver for custom perturbations. |
required |
mirror_point
|
Array | None
|
Point on mirror plane, |
None
|
mirror_normal
|
Array | None
|
Normal vector to mirror across, |
None
|
mirror_edge_low
|
ArrayList | None
|
Per-surface booleans marking whether that surface's |
None
|
mirror_edge_high
|
ArrayList | None
|
As |
None
|
Source code in src/flapjax/aero/utils.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | |
strip_alpha ¶
strip_alpha(
zeta_b: ArrayList,
f_steady: ArrayList,
v_func: Callable[[Array], Array],
rho: Array,
beta: Array,
) -> ArrayList
Compute the per-strip effective angle of attack from the UVLM sectional forcing. For each spanwise strip, the strip
total force is projected onto the local lift direction to obtain the strip lift coefficient. The angle of attack is
found by using a Prandtl-Glauert-corrected lift slope of 2 * pi / beta, since
f_steady already reflects any compressibility correction applied to the circulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zeta_b
|
ArrayList
|
Bound grid coordinates, |
required |
f_steady
|
ArrayList
|
Steady forcing, |
required |
v_func
|
Callable[[Array], Array]
|
Reference velocity as a function of position, |
required |
rho
|
Array
|
Flow density. |
required |
beta
|
Array
|
Prandtl-Glauert compressibility factor, |
required |
Returns:
| Type | Description |
|---|---|
ArrayList
|
Per-surface strip angle of attack, |
Source code in src/flapjax/aero/utils.py
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | |
apply_polar_correction ¶
apply_polar_correction(
zeta_b: ArrayList,
f_steady: ArrayList,
v_func: Callable[[Array], Array],
rho: Array,
beta: Array,
polar_data: Sequence[Any | None],
polar_function: Sequence[PolarFunction | None],
alpha: ArrayList | None = None,
) -> tuple[
ArrayList, ArrayList, ArrayList, ArrayList, ArrayList
]
Replace UVLM strip forcing with a sectional force built from tabulated airfoil polars. This method uses the UVLM to compute the strip-wise angles of attack, before obtaining the new forces from the passed polar databases.
For each surface where a polar database is provided, and for each spanwise strip, we firstly compute the strip
forcing in the global frame. This forcing can then be converted into the local strip coordinate frame. We
compute the velocity at the mid-strip point, from which we can calculate the lift coefficient. By assuming a
Prandtl-Glauert-corrected 2*pi/beta potential flow lift slope, we can correct the forcing from
polar_function's output for lift, drag and moment. To correct the output, we distribute the forcing back onto
the grid in a way which satisfies the moment and force balance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zeta_b
|
ArrayList
|
Bound grid coordinates, |
required |
f_steady
|
ArrayList
|
Steady vertex forcing, |
required |
v_func
|
Callable[[Array], Array]
|
Reference velocity as a function of position, |
required |
rho
|
Array
|
Flow density. |
required |
beta
|
Array
|
Prandtl-Glauert compressibility factor, |
required |
polar_data
|
Sequence[Any | None]
|
Per-surface polar database, length |
required |
polar_function
|
Sequence[PolarFunction | None]
|
Per-surface function mapping |
required |
alpha
|
ArrayList | None
|
Optional precomputed per-strip angle of attack, |
None
|
Returns:
| Type | Description |
|---|---|
tuple[ArrayList, ArrayList, ArrayList, ArrayList, ArrayList]
|
Corrected vertex forcing, |
Source code in src/flapjax/aero/utils.py
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | |
propagate_surf_wake ¶
propagate_surf_wake(
gamma_b_nm1: Array,
gamma_w_nm1: Array,
zeta_b_n: Array,
zeta_w_nm1: Array,
delta_w: Array | None,
v_func: Callable[[Array], Array],
dt: Array,
frozen_wake: bool,
linearise_variable_wake: bool = False,
) -> tuple[Array | None, Array]
Convect the wake at some given velocity for a single surface from timestep n-1 to timestep n. This step includes convection from the trailing edge and culling the downstream data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gamma_b_nm1
|
Array
|
Bound circulation at time step n-1, |
required |
gamma_w_nm1
|
Array
|
Wake circulation at time step n-1, |
required |
zeta_b_n
|
Array
|
Bound grid at time step n, |
required |
zeta_w_nm1
|
Array
|
Wake grid at time step n-1, |
required |
delta_w
|
Array | None
|
Desired wake discretisation, |
required |
v_func
|
Callable[[Array], Array]
|
Function that computes the velocity as a function of coordinate, |
required |
dt
|
Array
|
Time step length. |
required |
frozen_wake
|
bool
|
If true, the grid stays constant with time. Used in the linearised case. |
required |
linearise_variable_wake
|
bool
|
If true, block gradients through the arc-length computation so that the re-discretisation is treated as a linear operator when differentiated. |
False
|
Returns:
| Type | Description |
|---|---|
tuple[Array | None, Array]
|
New wake grid and circulation, |
Source code in src/flapjax/aero/utils.py
622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | |
propagate_wake ¶
propagate_wake(
gamma_b_nm1: ArrayList,
gamma_w_nm1: ArrayList,
zeta_b_n: ArrayList,
zeta_w_nm1: ArrayList,
delta_w: Sequence[Array | None],
v_func: Callable[[Array], Array],
dt: Array,
frozen_wake: Literal[True],
linearise_variable_wake: bool,
) -> tuple[None, ArrayList]
propagate_wake(
gamma_b_nm1: ArrayList,
gamma_w_nm1: ArrayList,
zeta_b_n: ArrayList,
zeta_w_nm1: ArrayList,
delta_w: Sequence[Array | None],
v_func: Callable[[Array], Array],
dt: Array,
frozen_wake: Literal[False],
linearise_variable_wake: bool,
) -> tuple[ArrayList, ArrayList]
propagate_wake(
gamma_b_nm1: ArrayList,
gamma_w_nm1: ArrayList,
zeta_b_n: ArrayList,
zeta_w_nm1: ArrayList,
delta_w: Sequence[Array | None],
v_func: Callable[[Array], Array],
dt: Array,
frozen_wake: bool,
linearise_variable_wake: bool = False,
) -> tuple[ArrayList | None, ArrayList]
Convect the wake for all surfaces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gamma_b_nm1
|
ArrayList
|
Bound circulation at time step n-1, |
required |
gamma_w_nm1
|
ArrayList
|
Wake circulation at time step n-1, |
required |
zeta_b_n
|
ArrayList
|
Bound grid at time step n, |
required |
zeta_w_nm1
|
ArrayList
|
Wake grid at time step n-1, |
required |
delta_w
|
Sequence[Array | None]
|
Desired wake discretisation, |
required |
v_func
|
Callable[[Array], Array]
|
Function that computes the velocity, |
required |
dt
|
Array
|
Time step length. |
required |
frozen_wake
|
bool
|
If true, the grid stays constant with time, useful in the linearised case. |
required |
linearise_variable_wake
|
bool
|
If true, block gradients through the arc-length computation so that the re-discretisation is treated as a linear operator when differentiated with jax.jvp. |
False
|
Returns:
| Type | Description |
|---|---|
tuple[ArrayList | None, ArrayList]
|
New wake grid and circulation, |
Source code in src/flapjax/aero/utils.py
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 | |
biot_savart ¶
biot_savart(x: Array, y: Array) -> Array
Biot-Savart kernel without any smoothing or cutoff.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
Target point, |
required |
y
|
Array
|
Filament endpoints, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Influence at target point, |
Source code in src/flapjax/aero/utils.py
802 803 804 805 806 807 808 809 810 811 812 813 814 | |
make_unit_epsilon ¶
make_unit_epsilon(r: Array) -> Array
Differentiable function to obtain a unit vector that is defined for all r. As r -> 0, the output approaches
zero instead of being undefined. Autodiff of this form matches a custom JVP to floating-point noise but transposes
to a much cheaper VJP under reverse-mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
Array
|
Vector to be normalised, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Unit vector, |
Source code in src/flapjax/aero/utils.py
817 818 819 820 821 822 823 824 825 | |
biot_savart_epsilon ¶
biot_savart_epsilon(x: Array, y: Array) -> Array
Biot-Savart kernel with epsilon term added to remove singularity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
Target point, |
required |
y
|
Array
|
Filament endpoints, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Influence at target point, |
Source code in src/flapjax/aero/utils.py
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 | |
biot_savart_cutoff ¶
biot_savart_cutoff(x: Array, y: Array) -> Array
Biot-Savart kernel with truncation radius to remove singularity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
Target point, |
required |
y
|
Array
|
Filament endpoints, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Influence at target point, |
Source code in src/flapjax/aero/utils.py
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 | |
mirror_grid ¶
mirror_grid(
zeta: Array, mirror_point: Array, mirror_normal: Array
) -> Array
Mirror a grid of points across a plane defined by a point and a normal vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zeta
|
Array
|
Grid of points, |
required |
mirror_point
|
Array
|
Point in mirror plane, |
required |
mirror_normal
|
Array
|
Normal vector of mirror plane, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Mirrored grid of points, |
Source code in src/flapjax/aero/utils.py
873 874 875 876 877 878 879 880 881 882 883 884 885 | |
prandtl_glauert_transform ¶
prandtl_glauert_transform(
zeta: Array, u_inf_dir: Array, beta: Array
) -> Array
Apply the Prandtl-Glauert transform, used to map compressible-flow geometry onto its
incompressible-equivalent for solving the ordinary (incompressible) UVLM equations. Components parallel to
the freestream direction are unchanged; components perpendicular to the freestream are scaled by
beta = sqrt(1 - M^2).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zeta
|
Array
|
Points or velocities to transform, |
required |
u_inf_dir
|
Array
|
Unit freestream direction, |
required |
beta
|
Array
|
Prandtl-Glauert compressibility factor, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Transformed points or velocities, |
Source code in src/flapjax/aero/utils.py
888 889 890 891 892 893 894 895 896 897 898 899 900 | |
project_forcing_to_beam ¶
project_forcing_to_beam(
f_total: ArrayList,
rmat: Array,
dof_mapping: ArrayList,
x0_aero: ArrayList,
mirror_edge_low: ArrayList | None = None,
mirror_edge_high: ArrayList | None = None,
) -> Array
Project aerodynamic forcing at specified time step onto the beam grid. Returned forces are in the global frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_total
|
ArrayList
|
Total force on aerodynamic grid, |
required |
rmat
|
Array
|
Rotation matrix for each node relative to reference, |
required |
x0_aero
|
ArrayList
|
Reference coordinates for aerodynamic grid, |
required |
dof_mapping
|
ArrayList
|
Mapping between aero and beam discretisations. |
required |
mirror_edge_low
|
ArrayList | None
|
Per-surface booleans marking whether that surface's |
None
|
mirror_edge_high
|
ArrayList | None
|
As |
None
|
Returns:
| Type | Description |
|---|---|
Array
|
Steady and unsteady forcing projected onto the beam grid, |
Source code in src/flapjax/aero/utils.py
903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 | |
cs_ang_to_cs_vel ¶
cs_ang_to_cs_vel(
cs_ang_t: dict[str, Array], dt: float | Array
) -> dict[str, Array]
Approximate control surfaces velocities from the time series of their angles using finite differences.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cs_ang_t
|
dict[str, Array]
|
Time history of control surface angle, |
required |
dt
|
float | Array
|
Time step length. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Array]
|
Control surface velocity, |
Source code in src/flapjax/aero/utils.py
956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | |
cs_vel_to_cs_ang ¶
cs_vel_to_cs_ang(
cs_vel_t: dict[str, Array], dt: float | Array
) -> dict[str, Array]
Approximate control surfaces angles from the time series of their velocities using finite differences.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cs_vel_t
|
dict[str, Array]
|
Time history of control surface velocity, |
required |
dt
|
float | Array
|
Time step length. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Array]
|
Control surface angle, |
Source code in src/flapjax/aero/utils.py
979 980 981 982 983 984 985 986 987 988 989 | |
uvlm ¶
UVLM ¶
UVLM(
grid_shapes: Sequence[
GridDiscretisation | tuple[int, int, int]
],
dof_mapping: ArrayList | Sequence[Array] | Array,
variable_wake_disc: bool = False,
mirror_point: Array | None = None,
mirror_normal: Array | None = None,
kernel: KernelFunction | None = None,
grid_func: AeroGridFunction | None = None,
free_wake: bool = False,
gamma_dot_relaxation: float | Array = 0.7,
include_unsteady_force: bool = True,
batch_size: int | None = 64,
polar_data: Sequence[Any | None] | None = None,
polar_function: Sequence[PolarFunction | None]
| None = None,
polar_circulation_scale: float = 0.0,
)
Class to define an unsteady vortex lattice method aerodynamic case with arbitrary number of aerodynamic surfaces.
Initialise UVLM class with all non-design parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid_shapes
|
Sequence[GridDiscretisation | tuple[int, int, int]]
|
Discretisations for the number of chordwise, spanwise and wake-wise panels for each surface.
May be passed as a sequence of either the GridDiscretisation class or a tuple of integers ordered as |
required |
dof_mapping
|
ArrayList | Sequence[Array] | Array
|
Mapping from aerodynamic grid points to structure grid points for each surface. |
required |
variable_wake_disc
|
bool
|
If True, allow for variable wake discretisations. |
False
|
mirror_point
|
Array | None
|
Optional point in mirror plane, |
None
|
mirror_normal
|
Array | None
|
Optional normal vector for mirror plane, |
None
|
kernel
|
KernelFunction | None
|
Input for custom kernel function to use for induced velocity calculations. |
None
|
grid_func
|
AeroGridFunction | None
|
Input functions used for defining surfaces with control surfaces. This function should take
the reference local grid coordinates |
None
|
free_wake
|
bool
|
If True, include the velocity induced from the aerodynamic elements for wake propagation. |
False
|
gamma_dot_relaxation
|
float | Array
|
Filtering parameter used for obtaining the time derivative of the circulation strengths. |
0.7
|
include_unsteady_force
|
bool
|
If True, include forces due to apparent mass for simulation. |
True
|
batch_size
|
int | None
|
Batch size for vectorising AIC computations. Larger values may result in faster computations, at the expense of increased memory usage. Setting to None is equivelant to a vmap. |
64
|
polar_data
|
Sequence[Any | None] | None
|
Optional per-surface polar database used to correct the UVLM sectional forcing, which can be an arbitrary data type. |
None
|
polar_function
|
Sequence[PolarFunction | None] | None
|
Per-surface function mapping |
None
|
polar_circulation_scale
|
float
|
Factor in |
0.0
|
Source code in src/flapjax/aero/uvlm.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | |
dt
property
writable
¶
dt: Array
Get the time step length.
Returns:
| Type | Description |
|---|---|
Array
|
Time step length. |
linearise ¶
linearise(
reference: AeroCase,
wake_type: LinearWakeType,
bound_upwash: bool = True,
wake_upwash: bool = True,
unsteady_force: bool = True,
) -> LinearUVLM
Create linearised aerodynamic model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
AeroCase
|
Reference StaticAero around which to linearise. |
required |
wake_type
|
LinearWakeType
|
Type of wake model to use in linearisation, with options given from the LinearWakeType class (frozen, prescribed, or free). Value of None defaults to prescribed. |
required |
bound_upwash
|
bool
|
If true, linearise for flowfield perturbations at the bound vortex vertex. |
True
|
wake_upwash
|
bool
|
If true, linearise for flowfield perturbations at the wake vortex vertex. |
True
|
unsteady_force
|
bool
|
If true, include unsteady force terms in linearisation. |
True
|
Returns:
| Type | Description |
|---|---|
LinearUVLM
|
LinearUVLM model, linearised at specified time step. |
Source code in src/flapjax/aero/uvlm.py
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | |
set_design_variables ¶
set_design_variables(
dt: float | Array,
flowfield: FlowField,
zeta_b0: ArrayList | Sequence[Array] | Array,
hg0: Array,
delta_w: Sequence[Array | None] | Array | None = None,
reference_cs_angles: dict[str, Array] | None = None,
) -> None
Set aerodynamic design variables for solution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dt
|
float | Array
|
Time step length |
required |
flowfield
|
FlowField
|
FlowField object defining the background flow in space and time |
required |
delta_w
|
Sequence[Array | None] | Array | None
|
Vector to define segment lengths of a variable wake discretisation per surface. If None, this will use a uniform discretisation, as in the canonical UVLM. |
None
|
zeta_b0
|
ArrayList | Sequence[Array] | Array
|
Aerodynamic local grid coordinates, |
required |
hg0
|
Array
|
Beam reference global grid coordinates, |
required |
reference_cs_angles
|
dict[str, Array] | None
|
Dictionary of {name: angle} for each control surface at the reference. If None, defaults to no control surfaces. |
None
|
Source code in src/flapjax/aero/uvlm.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
case_from_dv ¶
case_from_dv(dv: AeroDesignVariables) -> UVLM
Create a new UVLM instance as a function of design variables, allowing it to have defined gradients w.r.t. design variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dv
|
AeroDesignVariables
|
Design variables. |
required |
Returns:
| Type | Description |
|---|---|
UVLM
|
UVLM object with the same functionality as |
Source code in src/flapjax/aero/uvlm.py
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | |
get_design_variables ¶
get_design_variables(
cs_ang_t: dict[str, Array],
cs_vel_t: dict[str, Array],
grads_to_compute: AeroGradsToCompute | None,
) -> AeroDesignVariables
Extract design variables from the aerodynamic case. As the control input time histories are defined when
initialising the simulation, they are not included in self and so are passed by argument.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cs_ang_t
|
dict[str, Array]
|
Time history of control surface angles, |
required |
cs_vel_t
|
dict[str, Array]
|
Time history of control surface velocities, |
required |
grads_to_compute
|
AeroGradsToCompute | None
|
Data structure which describes which design variables should be obtained. If None, all variables are obtained. |
required |
Returns:
| Type | Description |
|---|---|
AeroDesignVariables
|
Aerodynamic design variables. |
Source code in src/flapjax/aero/uvlm.py
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 | |
hg_to_zeta_b ¶
hg_to_zeta_b(
hg_n: Array, cs_ang_n: dict[str, Array]
) -> ArrayList
Convert beam global grid coordinates to aerodynamic global grid coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_n
|
Array
|
Beam global grid coordinates at time step n, |
required |
cs_ang_n
|
dict[str, Array]
|
Control surface angles as {surface_name: angle} pairs at time step n. |
required |
Returns:
| Type | Description |
|---|---|
ArrayList
|
Full aerodynamic global grid coordinates for each surface, |
Source code in src/flapjax/aero/uvlm.py
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 | |
hg_dot_to_zeta_b_dot ¶
hg_dot_to_zeta_b_dot(
hg_n: Array,
hg_dot_n: Array,
cs_ang_n: dict[str, Array],
cs_vel_n: dict[str, Array],
) -> ArrayList
Convert beam global grid velocities to aerodynamic global grid velocities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_n
|
Array
|
Beam global grid coordinates, |
required |
hg_dot_n
|
Array
|
Beam global grid velocities, |
required |
cs_ang_n
|
dict[str, Array]
|
Control surface angles as {surface_name: angle} pairs. |
required |
cs_vel_n
|
dict[str, Array]
|
Control surface velocities as {surface_name: velocities} pairs. |
required |
Returns:
| Type | Description |
|---|---|
ArrayList
|
Full aerodynamic global grid velocities for each surface, |
Source code in src/flapjax/aero/uvlm.py
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | |
initialise_wake ¶
initialise_wake(
zeta_b: ArrayList | None = None,
) -> ArrayList
Generate initial wake grid coordinates, based on the bound grid coordinates and the freestream conditions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zeta_b
|
ArrayList | None
|
Initial wake grid coordinates, |
None
|
Returns:
| Type | Description |
|---|---|
ArrayList
|
Initial wake grid coordinates, |
Source code in src/flapjax/aero/uvlm.py
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 | |
compute_gamma_dot
staticmethod
¶
compute_gamma_dot(
gamma_b_n: ArrayList,
gamma_b_nm1: ArrayList,
gamma_b_dot_nm1: ArrayList,
dt: Array,
gamma_dot_relaxation: float | Array,
) -> ArrayList
Calculate time derivative of bound circulation strengths at specified time step using finite difference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gamma_b_n
|
ArrayList
|
Bound circulation strengths at timestep n, |
required |
gamma_b_nm1
|
ArrayList
|
Bound circulation strengths at timestep n-1, |
required |
gamma_b_dot_nm1
|
ArrayList
|
Filtered bound circulation strengths time derivative at timestep n-1, |
required |
dt
|
Array
|
Time step length. |
required |
gamma_dot_relaxation
|
float | Array
|
Relaxation factor which filters the time derivative. |
required |
Source code in src/flapjax/aero/uvlm.py
738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 | |
set_gamma_w ¶
set_gamma_w(
gamma_vec: Array, case: AeroCase, i_ts: int
) -> None
Set wake circulation strengths from total circulation strengths at specified time step. Can be passed either a full vector of strengths, or a sequence of strengths per surface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
AeroCase
|
AeroCase object. |
required |
gamma_vec
|
Array
|
Total circulation strengths vector, |
required |
i_ts
|
int
|
Timestep index. |
required |
Source code in src/flapjax/aero/uvlm.py
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | |
base_solve ¶
base_solve(
q_nm1: AeroFullStates | None,
t_n: Array,
hg_n: Array | None,
hg_nm1: Array | None,
hg_dot_n: Array | None,
static: bool,
horseshoe: bool,
cs_ang_n: dict[str, Array],
cs_ang_nm1: dict[str, Array] | None,
cs_vel_n: dict[str, Array] | None,
) -> tuple[
ArrayList,
ArrayList,
ArrayList,
ArrayList,
ArrayList | None,
ArrayList,
ArrayList,
ArrayList | None,
ArrayList,
ArrayList | None,
ArrayList,
ArrayList,
ArrayList,
ArrayList,
]
Solve the UVLM equations for a single time step from beam coordinate inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q_nm1
|
AeroFullStates | None
|
Minimal aerodynamic states from timestep n-1. |
required |
t_n
|
Array
|
Time at timestep n. |
required |
hg_n
|
Array | None
|
Beam global grid coordinates at time step n, |
required |
hg_nm1
|
Array | None
|
Beam global grid coordinates at time step n - 1, |
required |
hg_dot_n
|
Array | None
|
Beam global grid velocities, |
required |
static
|
bool
|
If True, perform a static solve. |
required |
horseshoe
|
bool
|
If True, replace the wake with a horseshoe wake in static solve which extends a fixed distance. |
required |
cs_ang_n
|
dict[str, Array]
|
Control surface angle at timestep n, {name, ()}. |
required |
cs_ang_nm1
|
dict[str, Array] | None
|
Control surface angle at timestep n - 1, {name, ()}. |
required |
cs_vel_n
|
dict[str, Array] | None
|
Control surface velocity at timestep n, {name, ()}. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ArrayList, ArrayList, ArrayList, ArrayList, ArrayList | None, ArrayList, ArrayList, ArrayList | None, ArrayList, ArrayList | None, ArrayList, ArrayList, ArrayList, ArrayList]
|
Collocation points, bound normals, bound circulation, wake circulation, bound circulation time derivative, bound grid, wake grid, bound grid time derivative, steady forcing, unsteady forcing, per-strip effective angle of attack, and per-strip lift, drag and moment coefficients. |
Source code in src/flapjax/aero/uvlm.py
792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 | |
base_solve_from_grid ¶
base_solve_from_grid(
q_nm1: AeroFullStates | None,
t_n: Array,
zeta_b_n: ArrayList,
zeta_b_nm1: ArrayList | None,
zeta_b_dot_n: ArrayList | None,
static: bool,
horseshoe: bool,
*,
linearise_variable_wake: bool = False,
nu_b: ArrayList | None = None,
nu_w: ArrayList | None = None,
) -> tuple[
ArrayList,
ArrayList,
ArrayList,
ArrayList,
ArrayList | None,
ArrayList,
ArrayList,
ArrayList | None,
ArrayList,
ArrayList | None,
ArrayList,
ArrayList,
ArrayList,
ArrayList,
]
Solve the UVLM equations for a single time step from aerodynamic grid inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q_nm1
|
AeroFullStates | None
|
Aerodynamic states carried from timestep n-1. Required for dynamic ( |
required |
t_n
|
Array
|
Time at timestep n. |
required |
zeta_b_n
|
ArrayList
|
Bound aerodynamic grid at timestep n, |
required |
zeta_b_nm1
|
ArrayList | None
|
Bound aerodynamic grid at timestep n-1, used to seed the wake-convection velocity for the free-wake case. Required for dynamic solves. |
required |
zeta_b_dot_n
|
ArrayList | None
|
Bound grid velocity at timestep n, or |
required |
static
|
bool
|
If True, perform a static solve (initialise wake, skip wake propagation and unsteady forcing). |
required |
horseshoe
|
bool
|
If True, replace the wake with a horseshoe wake in the static solve. |
required |
linearise_variable_wake
|
bool
|
If True, block gradients through the arc-length discretisation in wake propagation so it acts as a linear operator when differentiated. Used by the linear system; default False. |
False
|
nu_b
|
ArrayList | None
|
Optional additive bound upwash velocity at bound vertices, |
None
|
nu_w
|
ArrayList | None
|
Optional additive wake-convection velocity at wake vertices, |
None
|
Returns:
| Type | Description |
|---|---|
tuple[ArrayList, ArrayList, ArrayList, ArrayList, ArrayList | None, ArrayList, ArrayList, ArrayList | None, ArrayList, ArrayList | None, ArrayList, ArrayList, ArrayList, ArrayList]
|
Collocation points, bound normals, bound circulation, wake circulation, bound circulation time derivative, bound grid, wake grid, bound grid velocity, steady forcing, unsteady forcing, per-strip effective angle of attack, and per-strip lift, drag and moment coefficients sampled from the polars. |
Source code in src/flapjax/aero/uvlm.py
868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 | |
case_solve ¶
case_solve(
case: AeroCase,
i_ts: int,
hg_n: Array | None,
hg_nm1: Array | None,
hg_dot_n: Array | None,
static: bool,
horseshoe: bool,
cs_ang_n: dict[str, Array],
cs_ang_nm1: dict[str, Array] | None,
cs_vel_n: dict[str, Array] | None,
) -> AeroCase
Solve the UVLM equations for a single time step. Can be used for both static and dynamic solves. The solution is updated in-place in the case object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
AeroCase
|
Solution object. |
required |
i_ts
|
int
|
Timestep index to solve for. |
required |
hg_n
|
Array | None
|
Beam global grid coordinates at time step n, |
required |
hg_nm1
|
Array | None
|
Beam global grid coordinates at time step n-1, |
required |
hg_dot_n
|
Array | None
|
Beam global grid velocities at time step n, |
required |
static
|
bool
|
If true, perform a static solve. |
required |
horseshoe
|
bool
|
If true, replace the wake with a static_horseshoe wake in static solve which extends a fixed distance. |
required |
cs_ang_n
|
dict[str, Array]
|
Control surface angle at timestep n, {name, ()}. |
required |
cs_ang_nm1
|
dict[str, Array] | None
|
Control surface angle at timestep n - 1, {name, ()}. |
required |
cs_vel_n
|
dict[str, Array] | None
|
Control surface velocity at timestep n, {name, ()}. |
required |
Returns:
| Type | Description |
|---|---|
AeroCase
|
Solution object with data for current time step added. |
Source code in src/flapjax/aero/uvlm.py
1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 | |
initialise_case_object ¶
initialise_case_object(
n_tstep: int,
static_horseshoe: bool,
free_wake: bool,
gamma_dot_relaxation: float | Array,
cs_ang_t: dict[str, Array],
cs_vel_t: dict[str, Array],
) -> AeroCase
Initialise an AeroCase object to store the solution of the aerodynamic case for a given number of time steps. All solution data is initialised to zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_tstep
|
int
|
Number of time steps to solve for in dynamic solution. |
required |
static_horseshoe
|
bool
|
Whether a horseshoe formulation was used for the static case. |
required |
free_wake
|
bool
|
Whether to use a free wake formulation. |
required |
gamma_dot_relaxation
|
float | Array
|
Relaxation factor for damping gamma_dot. |
required |
cs_ang_t
|
dict[str, Array]
|
Control surface angle time history, |
required |
cs_vel_t
|
dict[str, Array]
|
Control surface velocity time history, |
required |
Returns:
| Type | Description |
|---|---|
AeroCase
|
AeroCase object. |
Source code in src/flapjax/aero/uvlm.py
1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 | |
static_solve ¶
static_solve(
hg: Array | None = None,
t: Array | float = 0.0,
horseshoe: bool = False,
cs_ang: dict[str, Array] | None = None,
) -> AeroCase
Solve the VLM for given static beam coordinates. TODO: add free wake
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array | None
|
Beam coordinates, |
None
|
t
|
Array | float
|
Time at which to solve static solution, used for background flowfield evaluation. |
0.0
|
horseshoe
|
bool
|
If true, replace the wake with a horseshoe wake which extends a fixed distance. |
False
|
cs_ang
|
dict[str, Array] | None
|
Control surface angles, |
None
|
Returns:
| Type | Description |
|---|---|
AeroCase
|
AeroCase solution object. |
Source code in src/flapjax/aero/uvlm.py
1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 | |
prescribed_dynamic_solve ¶
prescribed_dynamic_solve(
init_case: AeroCase,
hg_t: Array,
hg_dot_t: Array,
cs_ang_t: dict[str, Array] | None = None,
cs_vel_t: dict[str, Array] | None = None,
) -> AeroCase
Solve the UVLM for prescribed grid motions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_case
|
AeroCase
|
StaticAero object containing initial conditions for the solution at time step 0. |
required |
hg_t
|
Array
|
Beam coordinates over time, |
required |
hg_dot_t
|
Array
|
Beam coordinate time derivative over time, |
required |
cs_ang_t
|
dict[str, Array] | None
|
Control surface angle time history, {name, |
None
|
cs_vel_t
|
dict[str, Array] | None
|
Control surface velocity time history, {name, |
None
|
Returns:
| Type | Description |
|---|---|
AeroCase
|
AeroCase solution object. |
Source code in src/flapjax/aero/uvlm.py
1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 | |
reference_configuration ¶
reference_configuration() -> AeroCase
Get the reference (initial) snapshot of the aerodynamic case. This will set the timestep as -1.
Returns:
| Type | Description |
|---|---|
AeroCase
|
StaticAero object at initial time step. |
Source code in src/flapjax/aero/uvlm.py
1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 | |
plot_reference ¶
plot_reference(
directory: PathLike | str, plot_wake: bool = True
) -> Sequence[Path]
Plot the reference (initial) snapshot of the aerodynamic case. This will set the timestep as -1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
PathLike | str
|
Path to write files to. |
required |
plot_wake
|
bool
|
If True, plot the wake grid. |
True
|
Source code in src/flapjax/aero/uvlm.py
1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 | |
gamma_b_res_func ¶
gamma_b_res_func(
i_ts: int | Array,
t_n: Array,
varphi_n: Array,
v_n: Array,
gamma_b_n: Array,
gamma_w_n: Array,
zeta_w_n: Array,
dv: AeroelasticDesignVariables,
dv_full: AeroelasticDesignVariables,
struct_obj: BeamStructure,
) -> Array
Bound circulation residual used for adjoint computations.
:math:\mathbf{r}_{\Gamma_b} = \left(\boldsymbol{\mathcal{A}}_{b, n} \cdot \mathbf{n}_n\right)^{-1} \left[\left(
\boldsymbol{\mathcal{A}}_{w, n} \boldsymbol{\Gamma}_{w, n} +\mathbf{v}_{bc, n} - \dot{\boldsymbol{\zeta}}_c\right)
\cdot \mathbf{n}_n\right] + \boldsymbol{\Gamma}_{b, n}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array
|
Time step index. |
required |
t_n
|
Array
|
Time at step n. |
required |
varphi_n
|
Array
|
varphi vector at timestep n. |
required |
v_n
|
Array
|
Beam velocity vector at timestep n. |
required |
gamma_b_n
|
Array
|
Bound circulation vector at timestep n. |
required |
gamma_w_n
|
Array
|
Wake circulation vector at timestep n. |
required |
zeta_w_n
|
Array
|
Wake grid vector at timestep n. |
required |
dv
|
AeroelasticDesignVariables
|
Aeroelastic design variables. |
required |
dv_full
|
AeroelasticDesignVariables
|
Aeroelastic design variables without omissions for the variables where gradients aren't requested. |
required |
struct_obj
|
BeamStructure
|
Beam structure. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Bound circulation residual. |
Source code in src/flapjax/aero/uvlm.py
1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 | |
wake_prop_res_func ¶
wake_prop_res_func(
i_ts: int | Array,
t_n: Array,
varphi_nm1: Array,
varphi_n: Array,
gamma_b_nm1: Array,
gamma_w_nm1: Array,
gamma_w_n: Array,
zeta_w_nm1: Array,
zeta_w_n: Array,
dv: AeroelasticDesignVariables,
dv_full: AeroelasticDesignVariables,
struct_obj: BeamStructure,
) -> tuple[Array, Array]
Wake propagation residual for both grid coordinates and circulation strengths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array
|
Time step index. |
required |
t_n
|
Array
|
Time at timestep n. |
required |
varphi_nm1
|
Array
|
Beam minimal coordinates vector at timestep n-1. |
required |
varphi_n
|
Array
|
Beam maximal coordinates vector at timestep n. |
required |
gamma_b_nm1
|
Array
|
Bound circulation vector at timestep n-1. |
required |
gamma_w_nm1
|
Array
|
Wake circulation vector at timestep n-1. |
required |
gamma_w_n
|
Array
|
Wake circulation vector at timestep n. |
required |
zeta_w_nm1
|
Array
|
Wake grid vector at timestep n-1. |
required |
zeta_w_n
|
Array
|
Wake grid vector at timestep n. |
required |
dv
|
AeroelasticDesignVariables
|
Aeroelastic design variables. |
required |
dv_full
|
AeroelasticDesignVariables
|
Aeroelastic design variables without omissions. |
required |
struct_obj
|
BeamStructure
|
Beam structure. |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Wake grid and circulation residuals. |
Source code in src/flapjax/aero/uvlm.py
1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 | |
gamma_b_dot_res_func ¶
gamma_b_dot_res_func(
gamma_b_nm1: Array,
gamma_b_n: Array,
gamma_b_dot_nm1: Array,
gamma_b_dot_n: Array,
dv: AeroelasticDesignVariables,
) -> Array
Bound circulation time derivative residual.
:math:\frac{g}{h} \left[\mathbf{\Gamma}_{b, n} - \mathbf{\Gamma}_{b, n-1}\right] + (1-g)
\dot{\mathbf{\Gamma}}_{b, n-1} - \dot{\mathbf{\Gamma}}_{b, n}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gamma_b_nm1
|
Array
|
Bound circulation vector at timestep n-1. |
required |
gamma_b_n
|
Array
|
Bound circulation vector at timestep n. |
required |
gamma_b_dot_nm1
|
Array
|
Bound circulation time derivative vector at timestep n-1. |
required |
gamma_b_dot_n
|
Array
|
Bound circulation time derivative vector at timestep n. |
required |
dv
|
AeroelasticDesignVariables
|
Design variables. Whilst this function does not depend upon it, including it simplified obtaining the residual design gradient. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Bound circulation time derivative residual. |
Source code in src/flapjax/aero/uvlm.py
1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 | |
f_aero_res_func ¶
f_aero_res_func(
i_ts: int | Array,
t_n: Array,
varphi_n: Array,
v_n: Array,
gamma_b_n: Array,
gamma_w_n: Array,
gamma_b_dot_n: Array,
zeta_w_n: Array,
dv: AeroelasticDesignVariables,
dv_full: AeroelasticDesignVariables,
struct_obj: BeamStructure,
f_aero_beam_n: Array,
block_grid_gradients: bool,
solve_dofs: tuple[int, ...],
) -> Array
Aerodynamic forcing residual, compared in the local frame for compatibility with the structure.
:math:\boldsymbol{\mathcal{F}}_{\text{aero}, n}(\mathbf{\Gamma}_{b, n}, \mathbf{\Gamma}_{w, n},
\dot{\mathbf{\Gamma}}_{b, n}, \boldsymbol{\zeta}_{b, n}, \dot{\boldsymbol{\zeta}}_{b, n},
\boldsymbol{\zeta}_{w, n}) - \mathbf{f}_{\text{aero}, n}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array
|
Time step index. |
required |
t_n
|
Array
|
Time at timestep n. |
required |
varphi_n
|
Array
|
Beam minimal coordinates vector at timestep n. |
required |
v_n
|
Array
|
Beam velocity vector at timestep n. |
required |
gamma_b_n
|
Array
|
Bound circulation vector at timestep n. |
required |
gamma_w_n
|
Array
|
Wake circulation vector at timestep n. |
required |
gamma_b_dot_n
|
Array
|
Bound circulation vector time derivative at timestep n. |
required |
zeta_w_n
|
Array
|
Wake grid vector at timestep n. |
required |
dv
|
AeroelasticDesignVariables
|
Aeroelastic design variables. |
required |
dv_full
|
AeroelasticDesignVariables
|
Aeroelastic design variables without omissions. |
required |
struct_obj
|
BeamStructure
|
Beam structure. |
required |
f_aero_beam_n
|
Array
|
Local aerodynamic forcing projected onto beam. |
required |
block_grid_gradients
|
bool
|
If true, blocks the gradient path for the dependency of the steady aerodynamic forcing on the bound grid. |
required |
solve_dofs
|
tuple[int, ...]
|
Index of forces to keep for solution. |
required |
Source code in src/flapjax/aero/uvlm.py
1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 | |
timestep_residual ¶
timestep_residual(
i_ts: int | Array,
varphi_nm1: Array,
varphi_n: Array,
v_n: Array,
t_n: Array,
q_n: AeroFullStates,
q_nm1: AeroFullStates,
dv: AeroelasticDesignVariables,
dv_full: AeroelasticDesignVariables,
f_aero_beam_n: Array,
struct_obj: BeamStructure,
approx_grads: bool,
) -> Array
Compute the residual vector to the UVLM equations. These are given as:
:math:\left(\boldsymbol{\mathcal{A}}_{b, n} \cdot \mathbf{n}_n\right)^{-1} \left[\left(
\boldsymbol{\mathcal{A}}_{w, n} \boldsymbol{\Gamma}_{w, n} +\mathbf{v}_{bc, n} - \dot{\mathbf{c}}\right)
\cdot \mathbf{n}_n\right] + \boldsymbol{\Gamma}_{b, n}
:math:\boldsymbol{\mathcal{W}}_{\Gamma}(\mathbf{\Gamma}_{b, {n-1}}, \mathbf{\Gamma}_{w, {n-1}})
- \mathbf{\Gamma}_{w, n}
:math:\frac{g}{h} \left[\mathbf{\Gamma}_{b, n} - \mathbf{\Gamma}_{b, n-1}\right] + (1-g)
\dot{\mathbf{\Gamma}}_{b, n-1} - \dot{\mathbf{\Gamma}}_{b, n}
:math:\boldsymbol{\mathcal{W}}_{\zeta}(\boldsymbol{\zeta}_{b, n}, \boldsymbol{\zeta}_{w, n-1})
- \boldsymbol{\zeta}_{w, n}
:math:\boldsymbol{\mathcal{F}}_{\text{aero}, n}(\mathbf{\Gamma}_{b, n}, \mathbf{\Gamma}_{w, n},
\dot{\mathbf{\Gamma}}_{b, n}, \boldsymbol{\zeta}_{b, n}, \dot{\boldsymbol{\zeta}}_{b, n},
\boldsymbol{\zeta}_{w, n}) - \mathbf{f}_{\text{aero}, n}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array
|
Time step index. |
required |
varphi_nm1
|
Array
|
Beam minimal coordinates at timestep n-1, |
required |
varphi_n
|
Array
|
Beam maximal coordinates at timestep n, |
required |
v_n
|
Array
|
Beam velocity at timestep n, |
required |
t_n
|
Array
|
Time at step n. |
required |
q_n
|
AeroFullStates
|
Aero minimal states at timestep n. |
required |
q_nm1
|
AeroFullStates
|
Aero minimal states at timestep n-1. |
required |
dv
|
AeroelasticDesignVariables
|
Aeroelastic design variables. |
required |
dv_full
|
AeroelasticDesignVariables
|
Aeroelastic design variables without omissions. |
required |
f_aero_beam_n
|
Array
|
Aerodynamic forcing for the beam at timestep n, in the local frame. |
required |
struct_obj
|
BeamStructure
|
Beam structure. |
required |
approx_grads
|
bool
|
If true, eliminate grid gradients from the aerodynamic force residual. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Residual vector. |
Source code in src/flapjax/aero/uvlm.py
2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 | |
construct_approximate_jacobians ¶
construct_approximate_jacobians(
aero_sol: AeroCase,
structure_sol: StructureCase,
struct_obj: BeamStructure,
dv: AeroelasticDesignVariables,
dv_full: AeroelasticDesignVariables,
solve_dofs: tuple[int, ...],
jacobian_approximations: AeroJacobianApproximations,
) -> dict[str, dict[str, Callable[..., Any] | None]]
Compute approximations for the aerodynamic residual Jacobians specified in the jacobian_approximations data
structure. The residuals covered are the bound circulation, wake propagation, bound circulation rate, and
aerodynamic forcing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aero_sol
|
AeroCase
|
Aerodynamic solution from which to extract states for the initial time step. |
required |
structure_sol
|
StructureCase
|
Structural solution from which to extract states for the initial time step. |
required |
struct_obj
|
BeamStructure
|
Beam structure used by the residual functions for the kinematic transformations. |
required |
dv
|
AeroelasticDesignVariables
|
Aeroelastic design variables. |
required |
dv_full
|
AeroelasticDesignVariables
|
Aeroelastic design variables without omissions for the variables where gradients aren't requested. |
required |
solve_dofs
|
tuple[int, ...]
|
Active structural degrees of freedom. |
required |
jacobian_approximations
|
AeroJacobianApproximations
|
Data structure which defines which approximations to create. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, Callable[..., Any] | None]]
|
Dictionary of approximations keyed by residual name. |
Source code in src/flapjax/aero/uvlm.py
2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 | |
timestep_residual_jacobians ¶
timestep_residual_jacobians(
i_ts: int | Array,
varphi_nm1: Array,
varphi_n: Array,
v_n: Array,
t_n: Array,
q_n: AeroFullStates,
q_nm1: AeroFullStates,
dv: AeroelasticDesignVariables,
dv_full: AeroelasticDesignVariables,
f_aero_beam_n: Array,
struct_obj: BeamStructure,
approx_grads: bool,
solve_dofs: tuple[int, ...],
n_profile_loops: int | None,
jac_options: dict[str, dict[str, Any]],
compute_wake_gradients: bool = True,
mode: ADMode = "reverse",
map_batch_size: int | None = None,
) -> tuple[
Array,
Array,
AeroelasticDesignVariables,
Array,
Array,
dict[str, dict[str, float]] | None,
dict[str, dict[str, float]] | None,
]
Compute the Jacobians of the aerodynamic problem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array
|
Time step index. |
required |
varphi_nm1
|
Array
|
Minimal structural coordinates at timestep n-1, |
required |
varphi_n
|
Array
|
Minimal structural coordinates at timestep n, |
required |
v_n
|
Array
|
Structural velocity at timestep n, |
required |
t_n
|
Array
|
Time at timestep n. |
required |
q_n
|
AeroFullStates
|
Aerodynamic minimal states at timestep n. |
required |
q_nm1
|
AeroFullStates
|
Aerodynamic minimal states at timestep n-1. |
required |
dv
|
AeroelasticDesignVariables
|
Aeroelastic design variables. |
required |
dv_full
|
AeroelasticDesignVariables
|
Aeroelastic design variables without omissions. |
required |
f_aero_beam_n
|
Array
|
Aerodynamic forcing in local frame of reference at timestep n, |
required |
struct_obj
|
BeamStructure
|
Structural object. |
required |
approx_grads
|
bool
|
If true, eliminate grid gradients from force computation. |
required |
solve_dofs
|
tuple[int, ...]
|
Degrees of freedom to solve for. This removes non-active forcing entries. |
required |
n_profile_loops
|
int | None
|
Optional number of loops for profiling function. |
required |
jac_options
|
dict[str, dict[str, Any]]
|
Dictionary of optional functions which can be used to substitute Jacobian evaluations from AD. |
required |
compute_wake_gradients
|
bool
|
If False, skip Jacobians involving the wake for |
True
|
mode
|
ADMode
|
AD mode for obtaining gradients, either |
'reverse'
|
map_batch_size
|
int | None
|
Batch size for vectorising Jacobian construction. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, AeroelasticDesignVariables, Array, Array, dict[str, dict[str, float]] | None, dict[str, dict[str, float]] | None]
|
Gradients of aerodynamic residual with respect to previous states, current states, and design variables. Additionally, includes Jacobians of the aerodynamic residual with respect to the structural displacement and velocity, and profiling times for compilation and run time. |
Source code in src/flapjax/aero/uvlm.py
2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 | |