Structure¶
flapjax.structure ¶
StructureCase ¶
StructureCase(
hg: Array,
conn: tuple[tuple[int, int], ...],
o0: Array,
d: Array,
eps: Array,
varphi: Array,
f_ext_follower: Array | None,
f_ext_dead: Array | None,
f_ext_aero: Array | None,
f_grav: Array | None,
f_int: Array,
f_elem: Array,
f_res: Array,
t: Array,
thrust: dict[str, Array],
thrust_nodes: tuple[tuple[str, int], ...],
thrust_direction: tuple[
tuple[str, tuple[float, float, float]], ...
],
prescribed_dofs: tuple[int, ...] | Array,
v: Array | None = None,
v_dot: Array | None = None,
a: Array | None = None,
f_iner_gyr: Array | None = None,
i_ts: int | None = None,
local: bool = True,
constraint_data: dict[str, dict[str, Array]]
| None = None,
)
Object to hold the full state and forces of a structure analysis.
A single instance may represent any of three flavours:
- Static: dynamic-only fields (
v,v_dot,a,f_iner_gyr) are not set — their public properties return an all-zeros array of appropriate shape. Array shapes are(n_nodes, ...). - Dynamic snapshot: all dynamic fields populated for a single timestep. Array shapes are
(n_nodes, ...). - Dynamic trajectory: all dynamic fields populated for multiple timesteps.
tis a(n_tstep,)array andi_tsisNone. Array shapes are(n_tstep, n_nodes, ...).
Use :attr:is_dynamic and :attr:is_batched to distinguish at runtime.
Source code in src/flapjax/structure/data_structures.py
61 62 63 64 65 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 113 114 115 116 117 118 119 120 | |
to_dynamic ¶
to_dynamic() -> StructureCase
to_dynamic(t: None) -> StructureCase
to_dynamic(t: Array) -> StructureCase
to_dynamic(t: Array | None = None) -> StructureCase
Convert static structure results to a dynamic snapshot (t=None) or
a batched trajectory (t provided), zeroing velocity/acceleration
fields. Calling on a Structure that is already dynamic returns self.
Source code in src/flapjax/structure/data_structures.py
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 | |
to_static ¶
to_static() -> StructureCase
Return a static Structure, dropping velocity/acceleration
fields. If already static, returns self. For a batched trajectory,
raises: use self[i_ts].to_static() to extract a single time step first.
Source code in src/flapjax/structure/data_structures.py
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 | |
initialise
classmethod
¶
initialise(
initial_snapshot: StructureCase,
t: Array,
use_f_ext_follower: bool,
use_f_ext_dead: bool,
use_f_ext_aero: bool,
) -> StructureCase
Initialise a batched dynamic Structure from a single dynamic snapshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_snapshot
|
StructureCase
|
Snapshot at initial time step (must be dynamic,
i.e. |
required |
t
|
Array
|
Time step array, |
required |
use_f_ext_follower
|
bool
|
Whether to include follower force array |
required |
use_f_ext_dead
|
bool
|
Whether to include dead force array |
required |
use_f_ext_aero
|
bool
|
Whether to include aero force array |
required |
Returns:
| Type | Description |
|---|---|
StructureCase
|
Batched Structure with arrays initialised to zero except for the first time step. |
Source code in src/flapjax/structure/data_structures.py
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 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | |
to_global ¶
to_global() -> None
Convert local structure results to global frame.
Source code in src/flapjax/structure/data_structures.py
460 461 462 463 464 465 466 | |
to_local ¶
to_local() -> None
Convert global structure results to local frame.
Source code in src/flapjax/structure/data_structures.py
468 469 470 471 472 473 474 475 476 477 478 | |
plot ¶
plot(directory: PathLike | str, n_interp: int = 0) -> Path
plot(
directory: PathLike | str,
n_interp: int = 0,
*,
index: slice
| Sequence[int]
| int
| Array
| None = None,
) -> Path
plot(
directory: PathLike | str,
n_interp: int = 0,
*,
index: slice
| Sequence[int]
| int
| Array
| None = None,
) -> Path
Plot beam results to VTK/VTU files in the specified directory. For a batched Structure, a PVD is written alongside per-timestep VTUs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
PathLike | str
|
Path to write files to. |
required |
n_interp
|
int
|
Number of interpolation points to add between each element for smoother visualisation. |
0
|
index
|
slice | Sequence[int] | int | Array | None
|
For batched Structures only, time step indices to plot. |
None
|
Source code in src/flapjax/structure/data_structures.py
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 | |
BeamStructure ¶
BeamStructure(
num_nodes: int,
connectivity: Array,
y_vector: Array,
k_cs_index: Array | None = None,
m_cs_index: Array | None = None,
m_lumped_index: Array | None = None,
gravity: Array | Sequence[float] | None = None,
thrust_nodes: dict[str, int] | None = None,
thrust_direction: dict[str, Array] | None = None,
optional_jacobians: OptionalJacobians | None = None,
relaxation_factor: float = 1.0,
spectral_radius: float = 0.9,
alpha_m: float = 0.0,
beta_k: float = 0.0,
struct_convergence_settings: ConvergenceSettings = DEFAULT_STRUCT_CONVERGENCE_SETTINGS,
constraints: dict[str, SoftConstraint | HardConstraint]
| None = None,
)
Bases: BaseBeamStructure
Initialise BaseBeamStructure class with all non-design parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_nodes
|
int
|
Number of nodes in the structure. |
required |
connectivity
|
Array
|
Connectivity array, `(n_elem, 2)``. |
required |
y_vector
|
Array
|
Vector defining the y direction for each element, |
required |
k_cs_index
|
Array | None
|
Array defining the index from the library of k_cs to use for each element, |
None
|
m_cs_index
|
Array | None
|
Array defining the index from the library of m_cs to use for each element, |
None
|
m_lumped_index
|
Array | None
|
Node index for nodes which are to have a lumped mass attached. The order is the same as
that for the lumped mass data |
None
|
gravity
|
Array | Sequence[float] | None
|
Gravity vector in global reference frame, or None for no gravity_vec, |
None
|
thrust_nodes
|
dict[str, int] | None
|
Dictionary of thrust node names and their corresponding node indices, {keys, int}. |
None
|
thrust_direction
|
dict[str, Array] | None
|
Dictionary of thrust node names and their corresponding thrust direction vectors,
|
None
|
optional_jacobians
|
OptionalJacobians | None
|
Define which Jacobians contributions are to be used for solution. |
None
|
relaxation_factor
|
float
|
Relaxation factor which reduces the displacement update at each iteration. A value of 1 is no relaxation, and a value of 0 is no update. |
1.0
|
spectral_radius
|
float
|
Spectral radius for structural time integrator, where a value of 0 is highly damped and a value of 1 is undamped. |
0.9
|
alpha_m
|
float
|
Mass-proportional Rayleigh damping coefficient. |
0.0
|
beta_k
|
float
|
Stiffness-proportional Rayleigh damping coefficient. |
0.0
|
struct_convergence_settings
|
ConvergenceSettings
|
Structure convergence settings. |
DEFAULT_STRUCT_CONVERGENCE_SETTINGS
|
constraints
|
dict[str, SoftConstraint | HardConstraint] | None
|
Named dict |
None
|
Source code in src/flapjax/structure/beam.py
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 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 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | |
n_multibody_constraints
property
¶
n_multibody_constraints: int
Total number of scalar Lagrange-multiplier constraints.
n_holonomic_constraints
property
¶
n_holonomic_constraints: int
Number of scalar holonomic (position-level) Lagrange-multiplier constraints.
n_nonholonomic_constraints
property
¶
n_nonholonomic_constraints: int
Number of scalar non-holonomic (velocity-level) Lagrange-multiplier constraints.
set_design_variables ¶
set_design_variables(
coords: Array,
k_cs: Array,
m_cs: Array | None,
m_lumped: Array | None = None,
orientation_euler: Array | None = None,
thrust_reference: dict[str, Array | float]
| None = None,
*,
remove_checks: bool = False,
) -> None
Set design variables and compute initial configuration dependent quantities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
Array
|
Node coordinates in the reference configuration, |
required |
k_cs
|
Array
|
Cross-section stiffness matrices, |
required |
m_cs
|
Array | None
|
Cross-section mass matrices, |
required |
m_lumped
|
Array | None
|
Lumped mass matrices at nodes, |
None
|
orientation_euler
|
Array | None
|
Euler angles in radians which to rotate the reference configuration by, |
None
|
thrust_reference
|
dict[str, Array | float] | None
|
Reference thrust magnitude, |
None
|
remove_checks
|
bool
|
Flag to ignore input checks, used when function is JIT compiled. |
False
|
Source code in src/flapjax/structure/beam.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 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 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 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 | |
get_design_variables ¶
get_design_variables(
struct_case: StructureCase,
thrust_t: dict[str, Array],
grads_to_compute: StructureGradsToCompute | None,
) -> StructureDesignVariables
Obtain the design variables for the structural problem. As the external forcing is defined for each solve, the chosen forcing is required as input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
struct_case
|
StructureCase
|
Structural case |
required |
thrust_t
|
dict[str, Array]
|
Thrust time history, {keys, |
required |
grads_to_compute
|
StructureGradsToCompute | None
|
Data structure which describes which design variables should be obtained. If none, all variables are obtained. |
required |
Returns:
| Type | Description |
|---|---|
StructureDesignVariables
|
StructureDesignVariables dataclass containing design variables |
Source code in src/flapjax/structure/beam.py
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 | |
reference_configuration ¶
reference_configuration(
prescribed_dofs: Sequence[int]
| Array
| slice
| int = (),
use_f_ext_follower: bool = True,
use_f_ext_dead: bool = True,
use_f_aero: bool = True,
use_f_grav: bool = True,
) -> StructureCase
Get the reference configuration of the structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prescribed_dofs
|
Sequence[int] | Array | slice | int
|
Prescribed degrees of freedom, which are not solved for. Defaults to no prescribed DoFs. |
()
|
use_f_ext_follower
|
bool
|
Whether to include follower forces in the reference configuration. |
True
|
use_f_ext_dead
|
bool
|
Whether to include dead forces in the reference configuration. |
True
|
use_f_aero
|
bool
|
Whether to include aerodynamic forces in the reference configuration. |
True
|
use_f_grav
|
bool
|
Whether to include gravitational forces in the reference configuration. |
True
|
Returns:
| Type | Description |
|---|---|
StructureCase
|
Structure dataclass containing reference configuration. |
Source code in src/flapjax/structure/beam.py
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 | |
compute_varphi_from_hg ¶
compute_varphi_from_hg(hg: Array) -> Array
Calculate the twist vector from the reference configuration to hg
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Deformed coordinates, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Vector of twists, |
Source code in src/flapjax/structure/beam.py
665 666 667 668 669 670 671 | |
assemble_matrix_from_entries ¶
assemble_matrix_from_entries(entries: Array) -> Array
Assemble global matrix from element entries
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entries
|
Array
|
Array of element matrix entries, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
System global matrix, |
Source code in src/flapjax/structure/beam.py
677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | |
assemble_vector_from_entries ¶
assemble_vector_from_entries(entries: Array) -> Array
Assemble global vector from element entries
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entries
|
Array
|
Array of element vector entries, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
System global vector, |
Source code in src/flapjax/structure/beam.py
696 697 698 699 700 701 702 703 704 705 | |
add_lumped_contributions_to_arr ¶
add_lumped_contributions_to_arr(
arr: Array, lumped_arr: Array
) -> Array
Add lumped contributions to an array
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
Array
|
Full array, |
required |
lumped_arr
|
Array
|
Lumped contributions, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
In-place updated array, |
Source code in src/flapjax/structure/beam.py
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | |
add_lumped_contributions_to_vec ¶
add_lumped_contributions_to_vec(
vec: Array, lumped_vec: Array
) -> Array
Add lumped contributions to an array
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vec
|
Array
|
Full vector, |
required |
lumped_vec
|
Array
|
Lumped contributions, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
In-place updated vector, |
Source code in src/flapjax/structure/beam.py
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | |
make_k_t ¶
make_k_t(d: Array, p_d: Array, eps: Array) -> Array
Assemble tangent stiffness matrix as a function of the element relative configuration vectors
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Element relative configuration, |
required |
p_d
|
Array
|
P(d) operator, |
required |
eps
|
Array
|
Element strains, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Elementwise stiffness matrix entries, |
Source code in src/flapjax/structure/beam.py
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 | |
make_k_t_full ¶
make_k_t_full(
d: Array,
p_d: Array,
eps: Array,
f_ext_dead: Array | None,
rmat: Array,
m_t: Array | None,
) -> Array
Compute the full tangent stiffness matrix, with contributions from stiffness, dead forces and gravity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Element relative configuration, |
required |
p_d
|
Array
|
P(d) operator, |
required |
eps
|
Array
|
Strain vectors, |
required |
f_ext_dead
|
Array | None
|
External dead forces in global reference, |
required |
rmat
|
Array
|
Nodal rotation matrices, |
required |
m_t
|
Array | None
|
Disassembled system mass matrix, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Tangent stiffness matrix with all contributions, |
Source code in src/flapjax/structure/beam.py
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 | |
make_m_t ¶
make_m_t(
d: Array,
int_order: Literal[3, 4, 5] = BASE_LOBATTO_ORDER,
) -> Array
Assemble tangent mass matrix as a function of the element relative configuration vectors. This does not include the lumped mass contribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Element relative configuration, |
required |
int_order
|
Literal[3, 4, 5]
|
Integration order for mass matrix computation |
BASE_LOBATTO_ORDER
|
Returns:
| Type | Description |
|---|---|
Array
|
Elementwise mass matrix, |
Source code in src/flapjax/structure/beam.py
944 945 946 947 948 949 950 951 952 953 954 955 956 | |
make_nodal_m_k ¶
make_nodal_m_k(
case: StructureCase,
int_order: Literal[3, 4, 5] = BASE_LOBATTO_ORDER,
) -> tuple[Array, Array]
Create the global mass and stiffness matrices for a given static structure case. These can be used for modal analysis or other purposes. These matrices are the Jacobians of the local forcing residual with respect to global perturbations in acceleration and displacement, respectively.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
StructureCase
|
Static structure case for which to compute the global mass and stiffness matrices. |
required |
int_order
|
Literal[3, 4, 5]
|
Integration order for mass matrix computation. |
BASE_LOBATTO_ORDER
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Global mass and stiffness matrices, |
Source code in src/flapjax/structure/beam.py
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 | |
modal ¶
modal(
case: StructureCase,
remove_complex_conjugate: bool = True,
int_order: Literal[3, 4, 5] = BASE_LOBATTO_ORDER,
n_modes: int = 20,
freq_range: tuple[float | Array, float | Array] = (
0.0,
jnp.inf,
),
damp_range: tuple[float | Array, float | Array] = (
-jnp.inf,
jnp.inf,
),
vtu_directory: str | PathLike = "./modal",
n_plot_vtu: int | None = None,
aero: UVLM | None = None,
n_phase: int = 8,
n_interp: int = 0,
max_disp: float = 0.2,
max_ang: float = 0.2,
) -> tuple[Array, Array, Array]
Perform modal analysis on the structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
StructureCase
|
The static structure case for which to perform modal analysis. |
required |
remove_complex_conjugate
|
bool
|
If true, keep only one mode from each complex conjugate pair. |
True
|
int_order
|
Literal[3, 4, 5]
|
Integration order for mass matrix computation. |
BASE_LOBATTO_ORDER
|
n_modes
|
int
|
Number of modes to preserve. |
20
|
freq_range
|
tuple[float | Array, float | Array]
|
Frequency range for filtering out modes. |
(0.0, inf)
|
damp_range
|
tuple[float | Array, float | Array]
|
Damping range for filtering out modes. |
(-inf, inf)
|
vtu_directory
|
str | PathLike
|
Directory to for saving the mode shapes to vtu files. |
'./modal'
|
n_plot_vtu
|
int | None
|
Number of modes to plot to vtu files. Will default to "./modal". |
None
|
aero
|
UVLM | None
|
UVLM aerodynamic model. If passed, the vtu files will include the aerodynamic grid. If not, they will just be the beam structure. |
None
|
n_phase
|
int
|
Number of phases to use when plotting the modes to vtu files. |
8
|
n_interp
|
int
|
Number of times to interpolate between beam nodes for vtu plotting. |
0
|
max_disp
|
float
|
Maximum displacement of structure for plotted modes, used for scaling. |
0.2
|
max_ang
|
float
|
Maximum angle of structure for plotted modes in radians, used for scaling. |
0.2
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, Array]
|
Tuple of natural frequencies (n_free_dof), damping ratios (n_free_dof), and mode shapes with no
normalisation |
Source code in src/flapjax/structure/beam.py
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 | |
linearise ¶
linearise(
reference: StructureCase,
dt: float,
n_modes: int | None = None,
modal_inputs: bool = False,
modal_outputs: bool = False,
prescribed_dofs: Sequence[int]
| Array
| slice
| int
| None = None,
) -> LinearBeam
Linearise the beam about a given static structure case. This creates a LinearBeam object which can be used for linear dynamic analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
StructureCase
|
Static structure case about which to linearise the beam. |
required |
dt
|
float
|
Time step size, used for conversions between continuous and discrete time. |
required |
n_modes
|
int | None
|
If not None, the linearised system uses modal state coordinates truncated to this many modes. |
None
|
modal_inputs
|
bool
|
If True, external forcing inputs are provided as modal forces (requires n_modes). |
False
|
modal_outputs
|
bool
|
If True, outputs are exposed as modal coordinates (requires n_modes). |
False
|
prescribed_dofs
|
Sequence[int] | Array | slice | int | None
|
If provided, overrides the prescribed DOFs from the reference case. |
None
|
Returns:
| Type | Description |
|---|---|
LinearBeam
|
Continuous-time linearised beam object. |
Source code in src/flapjax/structure/beam.py
1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 | |
apply_nodal_constraint_tangent ¶
apply_nodal_constraint_tangent(
mat: Array,
hg: Array,
i_ts: int,
gamma_prime: float | Array | None,
) -> Array
Add nodal constraint contributions to a system matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mat
|
Array
|
System matrix to update, |
required |
hg
|
Array
|
SE(3) coordiantes, |
required |
i_ts
|
int
|
Time-step index (0 for static solves). |
required |
gamma_prime
|
float | Array | None
|
Time-integrator gamma_prime for damping scaling, or |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Updated system matrix. |
Source code in src/flapjax/structure/beam.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 | |
postprocess_constraints ¶
postprocess_constraints(
hg: Array,
) -> dict[str, dict[str, Array]]
Postprocess all constraints to extract derived quantities (e.g. hinge angles).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Nodal SE(3) frames, |
required |
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, Array]]
|
Nested dict |
Source code in src/flapjax/structure/beam.py
1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 | |
solve_constrained ¶
solve_constrained(
sys_mat_solve: Array,
f_res_solve: Array,
hg_eval: Array,
solve_dofs: Array,
hg_base: Array | None = None,
phi: Array | None = None,
v: Array | None = None,
gamma_prime: float | Array | None = None,
) -> tuple[Array, Array, Array]
Solve the augmented system with Lagrange multipliers, supporting both holonomic and non-holonomic constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sys_mat_solve
|
Array
|
System matrix at solve DOFs, |
required |
f_res_solve
|
Array
|
Force residual at solve DOFs, |
required |
hg_eval
|
Array
|
SE(3) frames for constraint evaluation, |
required |
solve_dofs
|
Array
|
Free DOF indices, |
required |
hg_base
|
Array | None
|
Base frames for Jacobian computation (defaults to |
None
|
phi
|
Array | None
|
Accumulated configuration increment, |
None
|
v
|
Array | None
|
Current nodal velocities for non-holonomic constraints, |
None
|
gamma_prime
|
float | Array | None
|
Newmark parameter for non-holonomic constraints. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, Array]
|
|
Source code in src/flapjax/structure/beam.py
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 | |
compute_centre_of_mass ¶
compute_centre_of_mass(hg: Array) -> Array
Compute the centre of mass for an arbitrary system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Node SE(3) coordinates, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Centre of mass, (3) or |
Source code in src/flapjax/structure/beam.py
1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 | |
make_f_elem ¶
make_f_elem(eps: Array) -> Array
Compute the forces within the elements as :math:\mathbf{f}_{elem} = \mathcal{K}_{cs} \epsilon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eps
|
Array
|
Element strain vectors, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Element forces, |
Source code in src/flapjax/structure/beam.py
1730 1731 1732 1733 1734 1735 1736 | |
make_f_int ¶
make_f_int(p_d: Array, eps: Array) -> Array
Assemble global internal force vector as a function of the element relative configuration vectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p_d
|
Array
|
P(d) operator, |
required |
eps
|
Array
|
Element strain vectors, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Internal forces, |
Source code in src/flapjax/structure/beam.py
1738 1739 1740 1741 1742 1743 1744 1745 1746 | |
make_f_dead_ext
staticmethod
¶
make_f_dead_ext(f_ext: Array, rmat: Array) -> Array
Compute the global external dead force vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_ext
|
Array
|
External forces array of dead forces in global reference, |
required |
rmat
|
Array
|
Deformation rotation matrices, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
External forces, |
Source code in src/flapjax/structure/beam.py
1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 | |
add_thrust_force ¶
add_thrust_force(
force: Array, thrust: dict[str, Array]
) -> Array
Add thrust acting at nodes onto full system forcing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force
|
Array
|
Input forcing, |
required |
thrust
|
dict[str, Array]
|
Input thrust at the current step, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Updated forcing, |
Source code in src/flapjax/structure/beam.py
1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 | |
make_eps ¶
make_eps(d: Array) -> Array
Compute the element strain vectors as a function of the element relative configuration vectors. Formulation from Geometrically exact beam finite element formulated on the special Euclidean group SE(3), by Sonneville et al., 2013, Eq 64.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Element relative configuration, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Element strain vectors, |
Source code in src/flapjax/structure/beam.py
1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 | |
make_p_d ¶
make_p_d(d: Array) -> Array
Compute the P(d) operator as a function of the element relative configuration vectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Relative configuration vectors, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
P(d) operator, |
Source code in src/flapjax/structure/beam.py
1912 1913 1914 1915 1916 1917 1918 | |
make_d ¶
make_d(hg: Array) -> Array
Compute the element relative configuration vectors from the nodal homogeneous transformation matrices
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Nodal homogeneous transformation matrices, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Element relative configuration vectors, |
Source code in src/flapjax/structure/beam.py
1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 | |
make_hg_dot
staticmethod
¶
make_hg_dot(hg: Array, v: Array) -> Array
Obtain the time derivative of the nodal coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Node coordinates, |
required |
v
|
Array
|
Node local velocities, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Coordinate time derivative, |
Source code in src/flapjax/structure/beam.py
1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 | |
resolve_forces ¶
resolve_forces(
hg: Array,
dynamic: Literal[True],
f_ext_follower: Array | None,
f_ext_dead: Array | None,
f_ext_aero: Array | None,
thrust: dict[str, Array],
v: Array,
v_dot: Array,
approx_gradients: bool = False,
) -> tuple[
Array,
Array,
Array | None,
Array | None,
Array | None,
Array,
Array,
Array,
Array,
]
resolve_forces(
hg: Array,
dynamic: Literal[False],
f_ext_follower: Array | None,
f_ext_dead: Array | None,
f_ext_aero: Array | None,
thrust: dict[str, Array],
v: None,
v_dot: None,
approx_gradients: bool = False,
) -> tuple[
Array,
Array,
Array | None,
Array | None,
Array | None,
Array,
None,
None,
Array,
]
resolve_forces(
hg: Array,
dynamic: bool,
f_ext_follower: Array | None,
f_ext_dead: Array | None,
f_ext_aero: Array | None,
thrust: dict[str, Array],
v: Array | None,
v_dot: Array | None,
approx_gradients: bool = False,
) -> tuple[
Array,
Array,
Array | None,
Array | None,
Array | None,
Array,
Array | None,
Array | None,
Array,
]
Obtain all components of the force from a final solution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Nodal homogeneous transformation matrices, |
required |
dynamic
|
bool
|
Whether to compute dynamic forces. |
required |
f_ext_follower
|
Array | None
|
External follower forces in local reference, |
required |
f_ext_dead
|
Array | None
|
External dead forces in global reference, |
required |
f_ext_aero
|
Array | None
|
External aero forces in global reference, |
required |
thrust
|
dict[str, Array]
|
Thrust forces at current step, {keys, |
required |
v
|
Array | None
|
Nodal velocities in global frame, |
required |
v_dot
|
Array | None
|
Nodal accelerations in global frame, |
required |
approx_gradients
|
bool
|
Whether to stop computing gradients of the inertial and gyroscopic forces with respect to the node coordinates, as these are small but nonzero values in practice. |
False
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, Array | None, Array | None, Array | None, Array, Array | None, Array | None, Array]
|
Configuration vectors, strain vectors, Dead external forces, aero external forces, gravitational forces, internal forces, gyroscopic forces, inertial forces and residual forces. |
Source code in src/flapjax/structure/beam.py
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 2058 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 | |
make_f_res ¶
make_f_res(
solve_dofs: Array | None,
p_d: Array,
eps: Array,
hg: Array,
f_ext_follower_n: Array | None,
f_ext_dead_n: Array | None,
thrust_n: dict[str, Array],
dynamic: Literal[True],
m_t: Array,
c_l: Array,
c_l_lumped: Array | None,
v: Array,
v_dot: Array,
i_ts: int = 0,
k_t_assembled: Array | None = None,
) -> tuple[Array, Array]
make_f_res(
solve_dofs: Array | None,
p_d: Array,
eps: Array,
hg: Array,
f_ext_follower_n: Array | None,
f_ext_dead_n: Array | None,
thrust_n: dict[str, Array],
dynamic: Literal[False],
m_t: Array | None,
c_l: None,
c_l_lumped: None,
v: None,
v_dot: None,
i_ts: int = 0,
k_t_assembled: Array | None = None,
) -> tuple[Array, Array]
make_f_res(
solve_dofs: Array | None,
p_d: Array,
eps: Array,
hg: Array,
f_ext_follower_n: Array | None,
f_ext_dead_n: Array | None,
thrust_n: dict[str, Array],
dynamic: bool,
m_t,
c_l,
c_l_lumped,
v,
v_dot,
i_ts: int = 0,
k_t_assembled: Array | None = None,
) -> tuple[Array, Array]
Compute the residual force vector for a given configuration and external forces, used in the nonlinear solve. This is the force imbalance that the nonlinear solver will seek to drive to zero. Additionally, returns an "absolute sum" of all forces, used for relative convergence checks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
solve_dofs
|
Array | None
|
Optional array of degrees of freedom to solve for |
required |
p_d
|
Array
|
P(d) operator, |
required |
eps
|
Array
|
Element strain vectors, |
required |
hg
|
Array
|
Nodal homogeneous transformation matrices, |
required |
f_ext_follower_n
|
Array | None
|
Nodal follower forces, |
required |
f_ext_dead_n
|
Array | None
|
Nodal dead forces, |
required |
thrust_n
|
dict[str, Array]
|
Thrust magnitude, |
required |
dynamic
|
bool
|
Flag for whether to compute dynamic entries. |
required |
m_t
|
Disassembled system mass matrix, |
required | |
c_l
|
Dissembled system gyroscopic matrix, |
required | |
c_l_lumped
|
Lumped gyroscopic matrix, |
required | |
v
|
Nodal velocities, |
required | |
v_dot
|
Nodal accelerations, |
required | |
i_ts
|
int
|
Time-step index (0 for static solves). |
0
|
k_t_assembled
|
Array | None
|
Assembled global tangent stiffness matrix |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Residual force vector, |
Source code in src/flapjax/structure/beam.py
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 2299 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 | |
update_hg
staticmethod
¶
update_hg(hg: Array, phi: Array) -> Array
Update the nodal homogeneous transformation matrices with the configuration increments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Existing nodal homogeneous transformation matrices, |
required |
phi
|
Array
|
Perturbation to the configuration vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Updated nodal homogeneous transformation matrices, |
Source code in src/flapjax/structure/beam.py
2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 | |
static_solve ¶
static_solve(
prescribed_dofs: Sequence[int] | Array | slice | int,
f_ext_follower: Array | None = None,
f_ext_dead: Array | None = None,
f_ext_aero: Array | None = None,
load_steps: int = 1,
*,
print_header: bool = True,
postprocess_constraints: bool = True,
) -> StructureCase
Perform static solve of the structure under external loads.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_ext_follower
|
Array | None
|
External forces array of follower forces |
None
|
f_ext_dead
|
Array | None
|
External forces array of dead loads |
None
|
f_ext_aero
|
Array | None
|
External forces array of aerodynamic loads |
None
|
prescribed_dofs
|
Sequence[int] | Array | slice | int
|
Index of degrees of freedom which are prescribed (not solved for). |
required |
load_steps
|
int
|
Number of load steps to apply the external loads over. |
1
|
print_header
|
bool
|
If False, suppress the "Static Solve" table header and trailing line. |
True
|
postprocess_constraints
|
bool
|
If True, apply constraint postprocessing to the final solution. |
True
|
Returns:
| Type | Description |
|---|---|
StructureCase
|
StructureCase object containing results of the static analysis. |
Source code in src/flapjax/structure/beam.py
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 | |
base_dynamic_solve ¶
base_dynamic_solve(
struct_case: StructureCase,
struct_convergence_status: ConvergenceStatus,
t: Array,
solve_dofs: tuple[int, ...],
load_steps: int,
f_ext_dead: Array | None,
f_ext_follower: Array | None,
thrust_t: dict[str, Array],
aero_obj: None,
aero_case: None,
fsi_convergence_status: None,
cs_ang_t: None,
cs_vel_t: None,
) -> StructureCase
base_dynamic_solve(
struct_case: StructureCase,
struct_convergence_status: ConvergenceStatus,
t: Array,
solve_dofs: tuple[int, ...],
load_steps: int,
f_ext_dead: Array | None,
f_ext_follower: Array | None,
thrust_t: dict[str, Array],
aero_obj: DynamicAeroSolver,
aero_case: AeroCase,
fsi_convergence_status: ConvergenceStatus,
cs_ang_t: dict[str, Array],
cs_vel_t: dict[str, Array],
) -> AeroelasticCase
base_dynamic_solve(
struct_case: StructureCase,
struct_convergence_status: ConvergenceStatus,
t: Array,
solve_dofs: tuple[int, ...],
load_steps: int,
f_ext_dead: Array | None,
f_ext_follower: Array | None,
thrust_t: dict[str, Array],
aero_obj: DynamicAeroSolver | None,
aero_case: AeroCase | None,
fsi_convergence_status: ConvergenceStatus | None,
cs_ang_t: dict[str, Array] | None,
cs_vel_t: dict[str, Array] | None,
) -> StructureCase | AeroelasticCase
Generic dynamic solver. Both the structural dynamic solve, and aeroelastic dynamic solve, are formed as wrappers of this
Source code in src/flapjax/structure/beam.py
2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 | |
dynamic_solve ¶
dynamic_solve(
init_state: StructureCase | None,
n_tstep: int,
dt: Array | float,
prescribed_dofs: Sequence[int]
| Array
| slice
| int
| None = None,
f_ext_follower: Array | None = None,
f_ext_dead: Array | None = None,
f_ext_aero: Array | None = None,
thrust_t: dict[str, Array] | None = None,
load_steps: int = 1,
) -> StructureCase
Perform dynamic solve of the structure under external loads
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_state
|
StructureCase | None
|
Initial state of the structure, either static or a dynamic snapshot. If None, the reference configuration is used with zero velocities. |
required |
prescribed_dofs
|
Sequence[int] | Array | slice | int | None
|
Degrees of freedom which are prescribed (not solved for). If None, inherit from the initial state. |
None
|
n_tstep
|
int
|
Number of time steps to simulate. |
required |
dt
|
Array | float
|
Time step length. |
required |
f_ext_follower
|
Array | None
|
Following external forces array, |
None
|
f_ext_dead
|
Array | None
|
Dead external forces array, |
None
|
f_ext_aero
|
Array | None
|
Aerodynamic external forces array, |
None
|
thrust_t
|
dict[str, Array] | None
|
Thrust time history, |
None
|
load_steps
|
int
|
Number of load steps to apply the external loads over. |
1
|
Returns:
| Type | Description |
|---|---|
StructureCase
|
Structure dataclass containing results of the dynamic analysis. |
Source code in src/flapjax/structure/beam.py
3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 | |
case_from_dv ¶
case_from_dv(dv: StructureDesignVariables) -> BeamStructure
Obtain a structural object as a function of design variables, allowing it to have defined gradients w.r.t. design variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dv
|
StructureDesignVariables
|
Design variables. |
required |
Returns:
| Type | Description |
|---|---|
BeamStructure
|
Beam structure object with the same functionality as self. |
Source code in src/flapjax/structure/gradients/beam.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
minimal_states_to_full_states ¶
minimal_states_to_full_states(
i_ts: int,
q: StructureMinimalStates,
dv: StructureDesignVariables,
dv_full: StructureDesignVariables,
) -> StructureFullStates
Obtain the full set of states from the minimal states and the design variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int
|
Index of the time step. |
required |
q
|
StructureMinimalStates
|
Minimal dynamic structure states. |
required |
dv
|
StructureDesignVariables
|
Design variables, where entries for gradients which aren't needed are set to None. |
required |
dv_full
|
StructureDesignVariables
|
Design variables, without omissions. These values are fallen back to when an entry in |
required |
Returns:
| Type | Description |
|---|---|
StructureFullStates
|
Full set of structural states used inside objective function. |
Source code in src/flapjax/structure/gradients/beam.py
65 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 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 | |
static_adjoint ¶
static_adjoint(
structure: StructureCase,
objective: StructureObjectiveFunction,
optional_jacobians: OptionalJacobians
| None = OPTIONAL_JACOBIANS_DEFAULT,
ad_mode: ADMode = "reverse",
) -> tuple[StructureDesignVariables, Array]
Computes the static grads of the structure, which is used to compute gradients of the loss with respect to the structure's parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure
|
StructureCase
|
StructureCase containing the current state of the structure. |
required |
objective
|
StructureObjectiveFunction
|
Objective function that takes the structure and design variables and returns an array |
required |
optional_jacobians
|
OptionalJacobians | None
|
OptionalJacobians object specifying which Jacobians to compute. |
OPTIONAL_JACOBIANS_DEFAULT
|
ad_mode
|
ADMode
|
Flag on which to use of the forward or reverse adjoint. |
'reverse'
|
Returns:
| Type | Description |
|---|---|
tuple[StructureDesignVariables, Array]
|
Gradient of objective function output with respect to design variables, and adjoint states. |
Source code in src/flapjax/structure/gradients/beam.py
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 | |
timestep_residual ¶
timestep_residual(
i_ts: int | Array,
q_nm1: StructureMinimalStates,
q_n: StructureMinimalStates,
dv_: StructureDesignVariables,
thrust_t: dict[str, Array],
solve_dofs: tuple[int, ...],
approx_grads: bool,
) -> Array
Routine to compute the full residual for the structural dynamic problem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array
|
Time step index. |
required |
q_nm1
|
StructureMinimalStates
|
Previous minimal state. |
required |
q_n
|
StructureMinimalStates
|
Current minimal state. |
required |
dv_
|
StructureDesignVariables
|
Design variables. |
required |
thrust_t
|
dict[str, Array]
|
Thrust time history, |
required |
solve_dofs
|
tuple[int, ...]
|
Solve degrees of freedom. |
required |
approx_grads
|
bool
|
If true, block gradients from some parts of the solution. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Residual vector, |
Source code in src/flapjax/structure/gradients/beam.py
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 | |
timestep_residual_jacobians ¶
timestep_residual_jacobians(
i_ts: int | Array,
q_nm1: StructureMinimalStates,
q_n: StructureMinimalStates,
f_ext_aero_nm1: Array | None,
f_ext_aero_n: Array | None,
dv: StructureDesignVariables,
thrust_t: dict[str, Array],
solve_dofs: tuple[int, ...],
approx_grads: bool,
n_profile_loops: int | None,
jac_options: dict[
str, dict[str, Callable[..., Any] | None]
],
mode: ADMode = "reverse",
) -> tuple[
Array,
Array,
StructureDesignVariables,
Array | None,
Array | None,
dict[str, dict[str, float]] | None,
dict[str, dict[str, float]] | None,
]
Obtain the Jacobians of the structural residual with respect to the current states and previous states.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array
|
Time step index. |
required |
q_nm1
|
StructureMinimalStates
|
Previous minimal states. |
required |
q_n
|
StructureMinimalStates
|
Current minimal states. |
required |
f_ext_aero_nm1
|
Array | None
|
Optional aerodynamic forcing for previous time step, |
required |
f_ext_aero_n
|
Array | None
|
Optional aerodynamic forcing for current time step, |
required |
dv
|
StructureDesignVariables
|
Design variables. |
required |
thrust_t
|
dict[str, Array]
|
Thrust time history, |
required |
solve_dofs
|
tuple[int, ...]
|
Index of degrees of freedom to solve for. |
required |
approx_grads
|
bool
|
If True, remove some gradient terms which are generally small. |
required |
n_profile_loops
|
int | None
|
Number of profile loops to run for timing function. If None, no profiling is done. |
required |
jac_options
|
dict[str, dict[str, Callable[..., Any] | None]]
|
Input which passes functions which can be used to approximate the Jacobians. If entries are None, AD is used. |
required |
mode
|
ADMode
|
AD mode used for Jacobian construction. |
'reverse'
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, StructureDesignVariables, Array | None, Array | None, dict[str, dict[str, float]] | None, dict[str, dict[str, float]] | None]
|
Jacobians with respect to previous state and current state, gradients with respect to design variables, previous, and current aerodynamic forces respectively, and profiling times for compilation and run time. |
Source code in src/flapjax/structure/gradients/beam.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 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 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 | |
j_from_q_x ¶
j_from_q_x(
q_n_mat: Array,
dv: StructureDesignVariables,
dv_full: StructureDesignVariables,
objective: StructureObjectiveFunction,
i_ts: int,
) -> Array
Obtain the objective as a function of the minimal states and design variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q_n_mat
|
Array
|
Matrix representation of the minimal states. |
required |
dv
|
StructureDesignVariables
|
Design variables, with unwanted entries replaced with None. |
required |
dv_full
|
StructureDesignVariables
|
Design variables which are defined for all entries. |
required |
objective
|
StructureObjectiveFunction
|
Objective function. |
required |
i_ts
|
int
|
Time step index. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Objective value. |
Source code in src/flapjax/structure/gradients/beam.py
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 | |
p_j ¶
p_j(
objective: StructureObjectiveFunction,
i_ts: int,
dv: StructureDesignVariables,
dv_full: StructureDesignVariables,
q_n: StructureMinimalStates,
) -> tuple[Array, StructureDesignVariables]
Obtains Jacobians of the objective function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
objective
|
StructureObjectiveFunction
|
Objective function. |
required |
i_ts
|
int
|
Time step index. |
required |
dv
|
StructureDesignVariables
|
Design variables. |
required |
dv_full
|
StructureDesignVariables
|
Design variables which are defined for all entries. |
required |
q_n
|
StructureMinimalStates
|
Current minimal states. |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, StructureDesignVariables]
|
Jacobian with respect to minimal states and design variables. |
Source code in src/flapjax/structure/gradients/beam.py
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 | |
adjoint_time_loop ¶
adjoint_time_loop(
rev_i_ts: int,
d_j_d_x_: StructureDesignVariables,
adj_: Array,
p_r_np1_p_q_n: Array | None,
adj_t_p_r_np1_p_q_n: Array | None,
q_n: StructureMinimalStates,
structure: StructureCase,
objective: StructureObjectiveFunction,
dv: StructureDesignVariables,
dv_full: StructureDesignVariables,
thrust_t: dict[str, Array],
solve_dofs: tuple[int, ...],
approx_grads: bool,
save_adjoint: bool,
matrix_free: bool,
n_j: int,
jac_options: dict[
str, dict[str, Callable[..., Any] | None]
],
i_ts_end: int | None = None,
) -> tuple[
StructureDesignVariables,
Array,
Array,
StructureMinimalStates,
]
Function to obtain the grads states at timestep varphi, which is dependent on the grads at timestep varphi+1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rev_i_ts
|
int
|
Reversed timestep index. JAX loop does not allow for reverse indexing, and so this is. explicitly reversed within the function body to obtain i_ts. |
required |
d_j_d_x_
|
StructureDesignVariables
|
Design gradient to accumulate. |
required |
adj_
|
Array
|
Full grads matrix which is updated inplace, |
required |
p_r_np1_p_q_n
|
Array | None
|
Gradient of future step with respect to current state, used when computing the full
Jacobian |
required |
adj_t_p_r_np1_p_q_n
|
Array | None
|
VJP of the future adjoint step and the Jacobian of the future residual with respect
to the current state, |
required |
q_n
|
StructureMinimalStates
|
Current minimal states. |
required |
structure
|
StructureCase
|
Dynamic structure solution. |
required |
objective
|
StructureObjectiveFunction
|
Objective function. |
required |
dv
|
StructureDesignVariables
|
Structure design variables. |
required |
dv_full
|
StructureDesignVariables
|
Structure design variables which are defined for all entries. |
required |
thrust_t
|
dict[str, Array]
|
Thrust time history, |
required |
solve_dofs
|
tuple[int, ...]
|
Tuple of dof index to solve. |
required |
approx_grads
|
bool
|
Whether to approximate the gradient or not. |
required |
save_adjoint
|
bool
|
Whether to save the full adjoint time history. |
required |
matrix_free
|
bool
|
If False, solve the system using the residual Jacobian-vector product using GMRES. |
required |
n_j
|
int
|
Number of objective function outputs. |
required |
jac_options
|
dict[str, dict[str, Callable[..., Any] | None]]
|
Input which passes functions which can be used to approximate the Jacobians. If entries are None, AD is used. |
required |
i_ts_end
|
int | None
|
Largest time step index for which the adjoint is computed. Defaults to
|
None
|
Returns:
| Type | Description |
|---|---|
tuple[StructureDesignVariables, Array, Array, StructureMinimalStates]
|
Updated grads matrix, gradient of current step with respect to previous state and current state. |
Source code in src/flapjax/structure/gradients/beam.py
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 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 | |
construct_approximate_jacobians ¶
construct_approximate_jacobians(
sol: StructureCase,
jacobian_approximations: StructureJacobianApproximations,
) -> dict[str, dict[str, Callable[..., Any] | None]]
Compute approximations for Jacobians which are specified in the jacobian_approximations data structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sol
|
StructureCase
|
Solution for which approximations will be created for the initial time step. |
required |
jacobian_approximations
|
StructureJacobianApproximations
|
Data structure which defines which approximations to create. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, Callable[..., Any] | None]]
|
Dictionary of approximations. |
Source code in src/flapjax/structure/gradients/beam.py
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 | |
dynamic_adjoint ¶
dynamic_adjoint(
structure: StructureCase,
objective: StructureObjectiveFunction,
matrix_free: bool = False,
jacobian_approximations: StructureJacobianApproximations = JACOBIAN_APPROXIMATIONS_DEFAULT,
p_q0_p_x: StructureDesignVariables | None = None,
save_adjoint: bool = False,
approx_grads: bool = True,
grads_to_compute: StructureGradsToCompute = GRADS_TO_COMPUTE_DEFAULT,
i_ts_adjoint_range: tuple[int | None, int | None] = (
None,
None,
),
) -> tuple[StructureDesignVariables, Array | None]
Dynamic structure grads problem. This computes the gradient of the objective of the dynamic response with
respect to design variables. The objective has structure
:math:J = \sum_{i=1}^N \left(j(\mathbf{x}, \mathbf{y}_i)\right) where :math:\mathbf{x} are the design variables
and :math:\mathbf{y} are the structural states at each timestep, which depend on the design variables through
the dynamic structure equations. The gradient is computed by first solving a backward pass to obtain the grads
states, and then using these to compute the gradient w.r.t. design variables in a forward pass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure
|
StructureCase
|
Dynamic structure solution object. |
required |
objective
|
StructureObjectiveFunction
|
Objective function :math: |
required |
matrix_free
|
bool
|
Whether to use matrix-free methods for solving the linear systems. Default is False, as structural problems generally do not benefit from this solve. |
False
|
jacobian_approximations
|
StructureJacobianApproximations
|
Data structure which specifies Jacobian approximations to use for each part of
the problem. The value can either be None for no approximation, |
JACOBIAN_APPROXIMATIONS_DEFAULT
|
p_q0_p_x
|
StructureDesignVariables | None
|
Optional Jacobian used to describe the sensitivities of the initial structural degrees of freedom to the design variables. |
None
|
save_adjoint
|
bool
|
Whether to save the full adjoint vectors. |
False
|
approx_grads
|
bool
|
If true, some gradient contributions which are assumed to be near-zero are removed to decrease computational cost. |
True
|
grads_to_compute
|
StructureGradsToCompute
|
Design variables with which to compute design gradients for. |
GRADS_TO_COMPUTE_DEFAULT
|
i_ts_adjoint_range
|
tuple[int | None, int | None]
|
Optional |
(None, None)
|
Returns:
| Type | Description |
|---|---|
tuple[StructureDesignVariables, Array | None]
|
Objective gradient :math: |
Source code in src/flapjax/structure/gradients/beam.py
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 1194 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 1298 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 | |
dynamic_adjoint_jacobian_profile ¶
dynamic_adjoint_jacobian_profile(
sol: StructureCase,
approx_grads: bool,
jacobian_approximations: StructureJacobianApproximations = JACOBIAN_APPROXIMATIONS_DEFAULT,
grads_to_compute: StructureGradsToCompute | None = None,
f_aero_nm1_n: tuple[Array, Array] | None = None,
i_ts: int = 1,
n_loop: int = 10,
*,
print_header: bool = True,
) -> tuple[
dict[str, dict[str, float]], dict[str, dict[str, float]]
]
Function to time evaluation of the Jacobians used for the adjoint solution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sol
|
StructureCase
|
Dynamic structural solution to extract states from. |
required |
approx_grads
|
bool
|
If True, neglect small gradient terms. |
required |
jacobian_approximations
|
StructureJacobianApproximations
|
Data structure which specifies Jacobian approximations to use for each part of the problem. |
JACOBIAN_APPROXIMATIONS_DEFAULT
|
grads_to_compute
|
StructureGradsToCompute | None
|
StructureGradsToCompute object which describes which design gradients to compute. If None, all gradients will be computed. |
None
|
f_aero_nm1_n
|
tuple[Array, Array] | None
|
Tuple of [f_aero_nm1, f_aero_n] which are passed from the aero problem. If None, no aerodynamic force gradients will be computed. |
None
|
i_ts
|
int
|
Time step index where to evaluate residual Jacobians. |
1
|
n_loop
|
int
|
Number of times to loop the Jacobian evaluation time for averaging the runtime. |
10
|
print_header
|
bool
|
Flag used to prevent heading printer when called by the coupled profiler. |
True
|
Returns:
| Type | Description |
|---|---|
tuple[dict[str, dict[str, float]], dict[str, dict[str, float]]]
|
Dictionary of {residual_name: {gradient_argument: val}} for compile time and run time respectively. |
Source code in src/flapjax/structure/gradients/beam.py
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 1372 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 | |
LinearBeam ¶
LinearBeam(
beam: BaseBeamStructure,
reference: StructureCase,
n_modes: int | None,
dt: float | Array,
modal_inputs: bool = False,
modal_outputs: bool = False,
int_order: Literal[3, 4, 5] = BASE_LOBATTO_ORDER,
prescribed_dofs: Sequence[int]
| Array
| slice
| int
| None = None,
)
Bases: LinearModel[StructureCase, StructureInputUnflattened, StructureStateUnflattened, StructureOutputUnflattened, StructureLinearResult]
Class to represent a linearised beam system about a reference state.
Source code in src/flapjax/structure/linear/linear_beam.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 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 | |
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 | |
nodal_to_modal ¶
nodal_to_modal(q_nodal: Array) -> Array
Convert a nodal property to a modal property.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q_nodal
|
Array
|
Nodal property, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Modal property, |
Source code in src/flapjax/structure/linear/linear_beam.py
105 106 107 108 109 110 111 112 | |
modal_to_nodal ¶
modal_to_nodal(q_modal: Array) -> Array
Convert a modal property to a nodal property.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q_modal
|
Array
|
Mode property, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Nodal property, |
Source code in src/flapjax/structure/linear/linear_beam.py
114 115 116 117 118 119 120 121 | |
linearise_continuous ¶
linearise_continuous() -> LinearSystem
Form a system of linear equations about a reference state. The system is of the form:
:math:\dot{\mathbf{x}} = \mathbf{A~x + B~u}, \mathbf{y} = \mathbf{C~x + D~u}.
The state, input and output layouts each depend on their respective modal_* flag:
- States: nodal-free-dof :math:
[q, \dot q]of length2 * n_free_dofwhenn_modes is None, or modal :math:[q_m, \dot q_m]of length2 * n_modeswhenmodal_states. Modal mass and stiffness are the projected :math:\Phi M \Phi^T/ :math:\Phi K \Phi^TwithPhi = mode_shapesof shape[n_modes, n_free_dof](rows are mode shapes). - Inputs: a single global-frame external force
f_ext. Non-modal inputs are per-node[n_nodes, 6]. Modal inputs are direct modal forces of lengthn_modes, requiring the user to have already applied the modal projection. - Outputs: :math:
[q, \dot q]in either nodal-free-dof or modal form to matchmodal_outputs.
Returns:
| Type | Description |
|---|---|
LinearSystem
|
Linearised continuous-time system. |
Source code in src/flapjax/structure/linear/linear_beam.py
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 | |
run ¶
run(
u: StructureInputUnflattened,
x0: StructureStateUnflattened | None = None,
) -> StructureLinearResult
Run the linear system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
StructureInputUnflattened
|
Total input over time (reference + pertubation). |
required |
x0
|
StructureStateUnflattened | None
|
Initial state perturbations, defaults to zero state. |
None
|
Returns:
| Type | Description |
|---|---|
StructureLinearResult
|
Linear system results. |
Source code in src/flapjax/structure/linear/linear_beam.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 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 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 | |
beam ¶
BaseBeamStructure ¶
BaseBeamStructure(
num_nodes: int,
connectivity: Array,
y_vector: Array,
k_cs_index: Array | None = None,
m_cs_index: Array | None = None,
m_lumped_index: Array | None = None,
gravity: Array | Sequence[float] | None = None,
thrust_nodes: dict[str, int] | None = None,
thrust_direction: dict[str, Array] | None = None,
optional_jacobians: OptionalJacobians | None = None,
relaxation_factor: float = 1.0,
spectral_radius: float = 0.9,
alpha_m: float = 0.0,
beta_k: float = 0.0,
struct_convergence_settings: ConvergenceSettings = DEFAULT_STRUCT_CONVERGENCE_SETTINGS,
constraints: dict[str, SoftConstraint | HardConstraint]
| None = None,
)
Class to represent nonlinear beam structure model
Initialise BaseBeamStructure class with all non-design parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_nodes
|
int
|
Number of nodes in the structure. |
required |
connectivity
|
Array
|
Connectivity array, `(n_elem, 2)``. |
required |
y_vector
|
Array
|
Vector defining the y direction for each element, |
required |
k_cs_index
|
Array | None
|
Array defining the index from the library of k_cs to use for each element, |
None
|
m_cs_index
|
Array | None
|
Array defining the index from the library of m_cs to use for each element, |
None
|
m_lumped_index
|
Array | None
|
Node index for nodes which are to have a lumped mass attached. The order is the same as
that for the lumped mass data |
None
|
gravity
|
Array | Sequence[float] | None
|
Gravity vector in global reference frame, or None for no gravity_vec, |
None
|
thrust_nodes
|
dict[str, int] | None
|
Dictionary of thrust node names and their corresponding node indices, {keys, int}. |
None
|
thrust_direction
|
dict[str, Array] | None
|
Dictionary of thrust node names and their corresponding thrust direction vectors,
|
None
|
optional_jacobians
|
OptionalJacobians | None
|
Define which Jacobians contributions are to be used for solution. |
None
|
relaxation_factor
|
float
|
Relaxation factor which reduces the displacement update at each iteration. A value of 1 is no relaxation, and a value of 0 is no update. |
1.0
|
spectral_radius
|
float
|
Spectral radius for structural time integrator, where a value of 0 is highly damped and a value of 1 is undamped. |
0.9
|
alpha_m
|
float
|
Mass-proportional Rayleigh damping coefficient. |
0.0
|
beta_k
|
float
|
Stiffness-proportional Rayleigh damping coefficient. |
0.0
|
struct_convergence_settings
|
ConvergenceSettings
|
Structure convergence settings. |
DEFAULT_STRUCT_CONVERGENCE_SETTINGS
|
constraints
|
dict[str, SoftConstraint | HardConstraint] | None
|
Named dict |
None
|
Source code in src/flapjax/structure/beam.py
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 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 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | |
n_multibody_constraints
property
¶
n_multibody_constraints: int
Total number of scalar Lagrange-multiplier constraints.
n_holonomic_constraints
property
¶
n_holonomic_constraints: int
Number of scalar holonomic (position-level) Lagrange-multiplier constraints.
n_nonholonomic_constraints
property
¶
n_nonholonomic_constraints: int
Number of scalar non-holonomic (velocity-level) Lagrange-multiplier constraints.
set_design_variables ¶
set_design_variables(
coords: Array,
k_cs: Array,
m_cs: Array | None,
m_lumped: Array | None = None,
orientation_euler: Array | None = None,
thrust_reference: dict[str, Array | float]
| None = None,
*,
remove_checks: bool = False,
) -> None
Set design variables and compute initial configuration dependent quantities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
Array
|
Node coordinates in the reference configuration, |
required |
k_cs
|
Array
|
Cross-section stiffness matrices, |
required |
m_cs
|
Array | None
|
Cross-section mass matrices, |
required |
m_lumped
|
Array | None
|
Lumped mass matrices at nodes, |
None
|
orientation_euler
|
Array | None
|
Euler angles in radians which to rotate the reference configuration by, |
None
|
thrust_reference
|
dict[str, Array | float] | None
|
Reference thrust magnitude, |
None
|
remove_checks
|
bool
|
Flag to ignore input checks, used when function is JIT compiled. |
False
|
Source code in src/flapjax/structure/beam.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 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 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 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 | |
get_design_variables ¶
get_design_variables(
struct_case: StructureCase,
thrust_t: dict[str, Array],
grads_to_compute: StructureGradsToCompute | None,
) -> StructureDesignVariables
Obtain the design variables for the structural problem. As the external forcing is defined for each solve, the chosen forcing is required as input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
struct_case
|
StructureCase
|
Structural case |
required |
thrust_t
|
dict[str, Array]
|
Thrust time history, {keys, |
required |
grads_to_compute
|
StructureGradsToCompute | None
|
Data structure which describes which design variables should be obtained. If none, all variables are obtained. |
required |
Returns:
| Type | Description |
|---|---|
StructureDesignVariables
|
StructureDesignVariables dataclass containing design variables |
Source code in src/flapjax/structure/beam.py
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 | |
reference_configuration ¶
reference_configuration(
prescribed_dofs: Sequence[int]
| Array
| slice
| int = (),
use_f_ext_follower: bool = True,
use_f_ext_dead: bool = True,
use_f_aero: bool = True,
use_f_grav: bool = True,
) -> StructureCase
Get the reference configuration of the structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prescribed_dofs
|
Sequence[int] | Array | slice | int
|
Prescribed degrees of freedom, which are not solved for. Defaults to no prescribed DoFs. |
()
|
use_f_ext_follower
|
bool
|
Whether to include follower forces in the reference configuration. |
True
|
use_f_ext_dead
|
bool
|
Whether to include dead forces in the reference configuration. |
True
|
use_f_aero
|
bool
|
Whether to include aerodynamic forces in the reference configuration. |
True
|
use_f_grav
|
bool
|
Whether to include gravitational forces in the reference configuration. |
True
|
Returns:
| Type | Description |
|---|---|
StructureCase
|
Structure dataclass containing reference configuration. |
Source code in src/flapjax/structure/beam.py
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 | |
compute_varphi_from_hg ¶
compute_varphi_from_hg(hg: Array) -> Array
Calculate the twist vector from the reference configuration to hg
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Deformed coordinates, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Vector of twists, |
Source code in src/flapjax/structure/beam.py
665 666 667 668 669 670 671 | |
assemble_matrix_from_entries ¶
assemble_matrix_from_entries(entries: Array) -> Array
Assemble global matrix from element entries
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entries
|
Array
|
Array of element matrix entries, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
System global matrix, |
Source code in src/flapjax/structure/beam.py
677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | |
assemble_vector_from_entries ¶
assemble_vector_from_entries(entries: Array) -> Array
Assemble global vector from element entries
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entries
|
Array
|
Array of element vector entries, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
System global vector, |
Source code in src/flapjax/structure/beam.py
696 697 698 699 700 701 702 703 704 705 | |
add_lumped_contributions_to_arr ¶
add_lumped_contributions_to_arr(
arr: Array, lumped_arr: Array
) -> Array
Add lumped contributions to an array
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
Array
|
Full array, |
required |
lumped_arr
|
Array
|
Lumped contributions, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
In-place updated array, |
Source code in src/flapjax/structure/beam.py
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | |
add_lumped_contributions_to_vec ¶
add_lumped_contributions_to_vec(
vec: Array, lumped_vec: Array
) -> Array
Add lumped contributions to an array
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vec
|
Array
|
Full vector, |
required |
lumped_vec
|
Array
|
Lumped contributions, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
In-place updated vector, |
Source code in src/flapjax/structure/beam.py
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | |
make_k_t ¶
make_k_t(d: Array, p_d: Array, eps: Array) -> Array
Assemble tangent stiffness matrix as a function of the element relative configuration vectors
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Element relative configuration, |
required |
p_d
|
Array
|
P(d) operator, |
required |
eps
|
Array
|
Element strains, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Elementwise stiffness matrix entries, |
Source code in src/flapjax/structure/beam.py
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 | |
make_k_t_full ¶
make_k_t_full(
d: Array,
p_d: Array,
eps: Array,
f_ext_dead: Array | None,
rmat: Array,
m_t: Array | None,
) -> Array
Compute the full tangent stiffness matrix, with contributions from stiffness, dead forces and gravity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Element relative configuration, |
required |
p_d
|
Array
|
P(d) operator, |
required |
eps
|
Array
|
Strain vectors, |
required |
f_ext_dead
|
Array | None
|
External dead forces in global reference, |
required |
rmat
|
Array
|
Nodal rotation matrices, |
required |
m_t
|
Array | None
|
Disassembled system mass matrix, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Tangent stiffness matrix with all contributions, |
Source code in src/flapjax/structure/beam.py
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 | |
make_m_t ¶
make_m_t(
d: Array,
int_order: Literal[3, 4, 5] = BASE_LOBATTO_ORDER,
) -> Array
Assemble tangent mass matrix as a function of the element relative configuration vectors. This does not include the lumped mass contribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Element relative configuration, |
required |
int_order
|
Literal[3, 4, 5]
|
Integration order for mass matrix computation |
BASE_LOBATTO_ORDER
|
Returns:
| Type | Description |
|---|---|
Array
|
Elementwise mass matrix, |
Source code in src/flapjax/structure/beam.py
944 945 946 947 948 949 950 951 952 953 954 955 956 | |
make_nodal_m_k ¶
make_nodal_m_k(
case: StructureCase,
int_order: Literal[3, 4, 5] = BASE_LOBATTO_ORDER,
) -> tuple[Array, Array]
Create the global mass and stiffness matrices for a given static structure case. These can be used for modal analysis or other purposes. These matrices are the Jacobians of the local forcing residual with respect to global perturbations in acceleration and displacement, respectively.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
StructureCase
|
Static structure case for which to compute the global mass and stiffness matrices. |
required |
int_order
|
Literal[3, 4, 5]
|
Integration order for mass matrix computation. |
BASE_LOBATTO_ORDER
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Global mass and stiffness matrices, |
Source code in src/flapjax/structure/beam.py
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 | |
modal ¶
modal(
case: StructureCase,
remove_complex_conjugate: bool = True,
int_order: Literal[3, 4, 5] = BASE_LOBATTO_ORDER,
n_modes: int = 20,
freq_range: tuple[float | Array, float | Array] = (
0.0,
jnp.inf,
),
damp_range: tuple[float | Array, float | Array] = (
-jnp.inf,
jnp.inf,
),
vtu_directory: str | PathLike = "./modal",
n_plot_vtu: int | None = None,
aero: UVLM | None = None,
n_phase: int = 8,
n_interp: int = 0,
max_disp: float = 0.2,
max_ang: float = 0.2,
) -> tuple[Array, Array, Array]
Perform modal analysis on the structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
StructureCase
|
The static structure case for which to perform modal analysis. |
required |
remove_complex_conjugate
|
bool
|
If true, keep only one mode from each complex conjugate pair. |
True
|
int_order
|
Literal[3, 4, 5]
|
Integration order for mass matrix computation. |
BASE_LOBATTO_ORDER
|
n_modes
|
int
|
Number of modes to preserve. |
20
|
freq_range
|
tuple[float | Array, float | Array]
|
Frequency range for filtering out modes. |
(0.0, inf)
|
damp_range
|
tuple[float | Array, float | Array]
|
Damping range for filtering out modes. |
(-inf, inf)
|
vtu_directory
|
str | PathLike
|
Directory to for saving the mode shapes to vtu files. |
'./modal'
|
n_plot_vtu
|
int | None
|
Number of modes to plot to vtu files. Will default to "./modal". |
None
|
aero
|
UVLM | None
|
UVLM aerodynamic model. If passed, the vtu files will include the aerodynamic grid. If not, they will just be the beam structure. |
None
|
n_phase
|
int
|
Number of phases to use when plotting the modes to vtu files. |
8
|
n_interp
|
int
|
Number of times to interpolate between beam nodes for vtu plotting. |
0
|
max_disp
|
float
|
Maximum displacement of structure for plotted modes, used for scaling. |
0.2
|
max_ang
|
float
|
Maximum angle of structure for plotted modes in radians, used for scaling. |
0.2
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, Array]
|
Tuple of natural frequencies (n_free_dof), damping ratios (n_free_dof), and mode shapes with no
normalisation |
Source code in src/flapjax/structure/beam.py
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 | |
linearise ¶
linearise(
reference: StructureCase,
dt: float,
n_modes: int | None = None,
modal_inputs: bool = False,
modal_outputs: bool = False,
prescribed_dofs: Sequence[int]
| Array
| slice
| int
| None = None,
) -> LinearBeam
Linearise the beam about a given static structure case. This creates a LinearBeam object which can be used for linear dynamic analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
StructureCase
|
Static structure case about which to linearise the beam. |
required |
dt
|
float
|
Time step size, used for conversions between continuous and discrete time. |
required |
n_modes
|
int | None
|
If not None, the linearised system uses modal state coordinates truncated to this many modes. |
None
|
modal_inputs
|
bool
|
If True, external forcing inputs are provided as modal forces (requires n_modes). |
False
|
modal_outputs
|
bool
|
If True, outputs are exposed as modal coordinates (requires n_modes). |
False
|
prescribed_dofs
|
Sequence[int] | Array | slice | int | None
|
If provided, overrides the prescribed DOFs from the reference case. |
None
|
Returns:
| Type | Description |
|---|---|
LinearBeam
|
Continuous-time linearised beam object. |
Source code in src/flapjax/structure/beam.py
1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 | |
apply_nodal_constraint_tangent ¶
apply_nodal_constraint_tangent(
mat: Array,
hg: Array,
i_ts: int,
gamma_prime: float | Array | None,
) -> Array
Add nodal constraint contributions to a system matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mat
|
Array
|
System matrix to update, |
required |
hg
|
Array
|
SE(3) coordiantes, |
required |
i_ts
|
int
|
Time-step index (0 for static solves). |
required |
gamma_prime
|
float | Array | None
|
Time-integrator gamma_prime for damping scaling, or |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Updated system matrix. |
Source code in src/flapjax/structure/beam.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 | |
postprocess_constraints ¶
postprocess_constraints(
hg: Array,
) -> dict[str, dict[str, Array]]
Postprocess all constraints to extract derived quantities (e.g. hinge angles).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Nodal SE(3) frames, |
required |
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, Array]]
|
Nested dict |
Source code in src/flapjax/structure/beam.py
1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 | |
solve_constrained ¶
solve_constrained(
sys_mat_solve: Array,
f_res_solve: Array,
hg_eval: Array,
solve_dofs: Array,
hg_base: Array | None = None,
phi: Array | None = None,
v: Array | None = None,
gamma_prime: float | Array | None = None,
) -> tuple[Array, Array, Array]
Solve the augmented system with Lagrange multipliers, supporting both holonomic and non-holonomic constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sys_mat_solve
|
Array
|
System matrix at solve DOFs, |
required |
f_res_solve
|
Array
|
Force residual at solve DOFs, |
required |
hg_eval
|
Array
|
SE(3) frames for constraint evaluation, |
required |
solve_dofs
|
Array
|
Free DOF indices, |
required |
hg_base
|
Array | None
|
Base frames for Jacobian computation (defaults to |
None
|
phi
|
Array | None
|
Accumulated configuration increment, |
None
|
v
|
Array | None
|
Current nodal velocities for non-holonomic constraints, |
None
|
gamma_prime
|
float | Array | None
|
Newmark parameter for non-holonomic constraints. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, Array]
|
|
Source code in src/flapjax/structure/beam.py
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 | |
compute_centre_of_mass ¶
compute_centre_of_mass(hg: Array) -> Array
Compute the centre of mass for an arbitrary system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Node SE(3) coordinates, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Centre of mass, (3) or |
Source code in src/flapjax/structure/beam.py
1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 | |
make_f_elem ¶
make_f_elem(eps: Array) -> Array
Compute the forces within the elements as :math:\mathbf{f}_{elem} = \mathcal{K}_{cs} \epsilon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eps
|
Array
|
Element strain vectors, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Element forces, |
Source code in src/flapjax/structure/beam.py
1730 1731 1732 1733 1734 1735 1736 | |
make_f_int ¶
make_f_int(p_d: Array, eps: Array) -> Array
Assemble global internal force vector as a function of the element relative configuration vectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p_d
|
Array
|
P(d) operator, |
required |
eps
|
Array
|
Element strain vectors, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Internal forces, |
Source code in src/flapjax/structure/beam.py
1738 1739 1740 1741 1742 1743 1744 1745 1746 | |
make_f_dead_ext
staticmethod
¶
make_f_dead_ext(f_ext: Array, rmat: Array) -> Array
Compute the global external dead force vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_ext
|
Array
|
External forces array of dead forces in global reference, |
required |
rmat
|
Array
|
Deformation rotation matrices, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
External forces, |
Source code in src/flapjax/structure/beam.py
1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 | |
add_thrust_force ¶
add_thrust_force(
force: Array, thrust: dict[str, Array]
) -> Array
Add thrust acting at nodes onto full system forcing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force
|
Array
|
Input forcing, |
required |
thrust
|
dict[str, Array]
|
Input thrust at the current step, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Updated forcing, |
Source code in src/flapjax/structure/beam.py
1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 | |
make_eps ¶
make_eps(d: Array) -> Array
Compute the element strain vectors as a function of the element relative configuration vectors. Formulation from Geometrically exact beam finite element formulated on the special Euclidean group SE(3), by Sonneville et al., 2013, Eq 64.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Element relative configuration, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Element strain vectors, |
Source code in src/flapjax/structure/beam.py
1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 | |
make_p_d ¶
make_p_d(d: Array) -> Array
Compute the P(d) operator as a function of the element relative configuration vectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Relative configuration vectors, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
P(d) operator, |
Source code in src/flapjax/structure/beam.py
1912 1913 1914 1915 1916 1917 1918 | |
make_d ¶
make_d(hg: Array) -> Array
Compute the element relative configuration vectors from the nodal homogeneous transformation matrices
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Nodal homogeneous transformation matrices, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Element relative configuration vectors, |
Source code in src/flapjax/structure/beam.py
1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 | |
make_hg_dot
staticmethod
¶
make_hg_dot(hg: Array, v: Array) -> Array
Obtain the time derivative of the nodal coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Node coordinates, |
required |
v
|
Array
|
Node local velocities, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Coordinate time derivative, |
Source code in src/flapjax/structure/beam.py
1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 | |
resolve_forces ¶
resolve_forces(
hg: Array,
dynamic: Literal[True],
f_ext_follower: Array | None,
f_ext_dead: Array | None,
f_ext_aero: Array | None,
thrust: dict[str, Array],
v: Array,
v_dot: Array,
approx_gradients: bool = False,
) -> tuple[
Array,
Array,
Array | None,
Array | None,
Array | None,
Array,
Array,
Array,
Array,
]
resolve_forces(
hg: Array,
dynamic: Literal[False],
f_ext_follower: Array | None,
f_ext_dead: Array | None,
f_ext_aero: Array | None,
thrust: dict[str, Array],
v: None,
v_dot: None,
approx_gradients: bool = False,
) -> tuple[
Array,
Array,
Array | None,
Array | None,
Array | None,
Array,
None,
None,
Array,
]
resolve_forces(
hg: Array,
dynamic: bool,
f_ext_follower: Array | None,
f_ext_dead: Array | None,
f_ext_aero: Array | None,
thrust: dict[str, Array],
v: Array | None,
v_dot: Array | None,
approx_gradients: bool = False,
) -> tuple[
Array,
Array,
Array | None,
Array | None,
Array | None,
Array,
Array | None,
Array | None,
Array,
]
Obtain all components of the force from a final solution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Nodal homogeneous transformation matrices, |
required |
dynamic
|
bool
|
Whether to compute dynamic forces. |
required |
f_ext_follower
|
Array | None
|
External follower forces in local reference, |
required |
f_ext_dead
|
Array | None
|
External dead forces in global reference, |
required |
f_ext_aero
|
Array | None
|
External aero forces in global reference, |
required |
thrust
|
dict[str, Array]
|
Thrust forces at current step, {keys, |
required |
v
|
Array | None
|
Nodal velocities in global frame, |
required |
v_dot
|
Array | None
|
Nodal accelerations in global frame, |
required |
approx_gradients
|
bool
|
Whether to stop computing gradients of the inertial and gyroscopic forces with respect to the node coordinates, as these are small but nonzero values in practice. |
False
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, Array | None, Array | None, Array | None, Array, Array | None, Array | None, Array]
|
Configuration vectors, strain vectors, Dead external forces, aero external forces, gravitational forces, internal forces, gyroscopic forces, inertial forces and residual forces. |
Source code in src/flapjax/structure/beam.py
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 2058 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 | |
make_f_res ¶
make_f_res(
solve_dofs: Array | None,
p_d: Array,
eps: Array,
hg: Array,
f_ext_follower_n: Array | None,
f_ext_dead_n: Array | None,
thrust_n: dict[str, Array],
dynamic: Literal[True],
m_t: Array,
c_l: Array,
c_l_lumped: Array | None,
v: Array,
v_dot: Array,
i_ts: int = 0,
k_t_assembled: Array | None = None,
) -> tuple[Array, Array]
make_f_res(
solve_dofs: Array | None,
p_d: Array,
eps: Array,
hg: Array,
f_ext_follower_n: Array | None,
f_ext_dead_n: Array | None,
thrust_n: dict[str, Array],
dynamic: Literal[False],
m_t: Array | None,
c_l: None,
c_l_lumped: None,
v: None,
v_dot: None,
i_ts: int = 0,
k_t_assembled: Array | None = None,
) -> tuple[Array, Array]
make_f_res(
solve_dofs: Array | None,
p_d: Array,
eps: Array,
hg: Array,
f_ext_follower_n: Array | None,
f_ext_dead_n: Array | None,
thrust_n: dict[str, Array],
dynamic: bool,
m_t,
c_l,
c_l_lumped,
v,
v_dot,
i_ts: int = 0,
k_t_assembled: Array | None = None,
) -> tuple[Array, Array]
Compute the residual force vector for a given configuration and external forces, used in the nonlinear solve. This is the force imbalance that the nonlinear solver will seek to drive to zero. Additionally, returns an "absolute sum" of all forces, used for relative convergence checks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
solve_dofs
|
Array | None
|
Optional array of degrees of freedom to solve for |
required |
p_d
|
Array
|
P(d) operator, |
required |
eps
|
Array
|
Element strain vectors, |
required |
hg
|
Array
|
Nodal homogeneous transformation matrices, |
required |
f_ext_follower_n
|
Array | None
|
Nodal follower forces, |
required |
f_ext_dead_n
|
Array | None
|
Nodal dead forces, |
required |
thrust_n
|
dict[str, Array]
|
Thrust magnitude, |
required |
dynamic
|
bool
|
Flag for whether to compute dynamic entries. |
required |
m_t
|
Disassembled system mass matrix, |
required | |
c_l
|
Dissembled system gyroscopic matrix, |
required | |
c_l_lumped
|
Lumped gyroscopic matrix, |
required | |
v
|
Nodal velocities, |
required | |
v_dot
|
Nodal accelerations, |
required | |
i_ts
|
int
|
Time-step index (0 for static solves). |
0
|
k_t_assembled
|
Array | None
|
Assembled global tangent stiffness matrix |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Residual force vector, |
Source code in src/flapjax/structure/beam.py
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 2299 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 | |
update_hg
staticmethod
¶
update_hg(hg: Array, phi: Array) -> Array
Update the nodal homogeneous transformation matrices with the configuration increments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Existing nodal homogeneous transformation matrices, |
required |
phi
|
Array
|
Perturbation to the configuration vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Updated nodal homogeneous transformation matrices, |
Source code in src/flapjax/structure/beam.py
2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 | |
static_solve ¶
static_solve(
prescribed_dofs: Sequence[int] | Array | slice | int,
f_ext_follower: Array | None = None,
f_ext_dead: Array | None = None,
f_ext_aero: Array | None = None,
load_steps: int = 1,
*,
print_header: bool = True,
postprocess_constraints: bool = True,
) -> StructureCase
Perform static solve of the structure under external loads.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_ext_follower
|
Array | None
|
External forces array of follower forces |
None
|
f_ext_dead
|
Array | None
|
External forces array of dead loads |
None
|
f_ext_aero
|
Array | None
|
External forces array of aerodynamic loads |
None
|
prescribed_dofs
|
Sequence[int] | Array | slice | int
|
Index of degrees of freedom which are prescribed (not solved for). |
required |
load_steps
|
int
|
Number of load steps to apply the external loads over. |
1
|
print_header
|
bool
|
If False, suppress the "Static Solve" table header and trailing line. |
True
|
postprocess_constraints
|
bool
|
If True, apply constraint postprocessing to the final solution. |
True
|
Returns:
| Type | Description |
|---|---|
StructureCase
|
StructureCase object containing results of the static analysis. |
Source code in src/flapjax/structure/beam.py
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 | |
base_dynamic_solve ¶
base_dynamic_solve(
struct_case: StructureCase,
struct_convergence_status: ConvergenceStatus,
t: Array,
solve_dofs: tuple[int, ...],
load_steps: int,
f_ext_dead: Array | None,
f_ext_follower: Array | None,
thrust_t: dict[str, Array],
aero_obj: None,
aero_case: None,
fsi_convergence_status: None,
cs_ang_t: None,
cs_vel_t: None,
) -> StructureCase
base_dynamic_solve(
struct_case: StructureCase,
struct_convergence_status: ConvergenceStatus,
t: Array,
solve_dofs: tuple[int, ...],
load_steps: int,
f_ext_dead: Array | None,
f_ext_follower: Array | None,
thrust_t: dict[str, Array],
aero_obj: DynamicAeroSolver,
aero_case: AeroCase,
fsi_convergence_status: ConvergenceStatus,
cs_ang_t: dict[str, Array],
cs_vel_t: dict[str, Array],
) -> AeroelasticCase
base_dynamic_solve(
struct_case: StructureCase,
struct_convergence_status: ConvergenceStatus,
t: Array,
solve_dofs: tuple[int, ...],
load_steps: int,
f_ext_dead: Array | None,
f_ext_follower: Array | None,
thrust_t: dict[str, Array],
aero_obj: DynamicAeroSolver | None,
aero_case: AeroCase | None,
fsi_convergence_status: ConvergenceStatus | None,
cs_ang_t: dict[str, Array] | None,
cs_vel_t: dict[str, Array] | None,
) -> StructureCase | AeroelasticCase
Generic dynamic solver. Both the structural dynamic solve, and aeroelastic dynamic solve, are formed as wrappers of this
Source code in src/flapjax/structure/beam.py
2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 | |
dynamic_solve ¶
dynamic_solve(
init_state: StructureCase | None,
n_tstep: int,
dt: Array | float,
prescribed_dofs: Sequence[int]
| Array
| slice
| int
| None = None,
f_ext_follower: Array | None = None,
f_ext_dead: Array | None = None,
f_ext_aero: Array | None = None,
thrust_t: dict[str, Array] | None = None,
load_steps: int = 1,
) -> StructureCase
Perform dynamic solve of the structure under external loads
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_state
|
StructureCase | None
|
Initial state of the structure, either static or a dynamic snapshot. If None, the reference configuration is used with zero velocities. |
required |
prescribed_dofs
|
Sequence[int] | Array | slice | int | None
|
Degrees of freedom which are prescribed (not solved for). If None, inherit from the initial state. |
None
|
n_tstep
|
int
|
Number of time steps to simulate. |
required |
dt
|
Array | float
|
Time step length. |
required |
f_ext_follower
|
Array | None
|
Following external forces array, |
None
|
f_ext_dead
|
Array | None
|
Dead external forces array, |
None
|
f_ext_aero
|
Array | None
|
Aerodynamic external forces array, |
None
|
thrust_t
|
dict[str, Array] | None
|
Thrust time history, |
None
|
load_steps
|
int
|
Number of load steps to apply the external loads over. |
1
|
Returns:
| Type | Description |
|---|---|
StructureCase
|
Structure dataclass containing results of the dynamic analysis. |
Source code in src/flapjax/structure/beam.py
3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 | |
constraints ¶
SoftConstraint ¶
Bases: ABC
Base class for a single-node structural soft constraint (applied without Lagrange multipliers).
f_res
abstractmethod
¶
f_res(hg: Array, v: Array, i_ts: int) -> Array
Compute the forcing residual contribution from the constraint
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Node SE(3) coordinate, |
required |
v
|
Array
|
Node local velocity, |
required |
i_ts
|
int
|
Time-step index. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Nodal force, |
Source code in src/flapjax/structure/constraints.py
21 22 23 24 25 26 27 28 29 | |
k_tangent ¶
k_tangent(hg: Array, i_ts: int) -> Array
Effective stiffness contribution :math:-\partial \mathbf{f_{res}}/\partial \boldsymbol{\varphi}.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Node SE(3) coordinate, |
required |
i_ts
|
int
|
Time-step index. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Nodal stiffness contribution, |
Source code in src/flapjax/structure/constraints.py
31 32 33 34 35 36 37 38 | |
c_tangent ¶
c_tangent(hg: Array, i_ts: int) -> Array
Effective damping contribution :math:-\partial \mathbf{f_{res}}/\partial \mathbf{v}.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Node SE(3) coordinate, |
required |
i_ts
|
int
|
Time-step index. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Nodal damping contribution, |
Source code in src/flapjax/structure/constraints.py
40 41 42 43 44 45 46 47 | |
resolve_hg_ref ¶
resolve_hg_ref(hg0: Array) -> None
Called once hg0 is populated so subclasses can default their reference frame to the node's initial pose.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg0
|
Array
|
Full nodal initial-frame array, |
required |
Source code in src/flapjax/structure/constraints.py
49 50 51 52 53 | |
postprocess ¶
postprocess(hg: Array) -> dict[str, Array]
Extract derived quantities from the converged solution that are given in the returned structure object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Nodal SE(3) frames, |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Array]
|
Dict of named result arrays. |
Source code in src/flapjax/structure/constraints.py
55 56 57 58 59 60 | |
SpringDamper ¶
SpringDamper(
node_index: int,
k: Array,
hg_ref: Array | None = None,
c: Array | None = None,
)
Bases: SoftConstraint
6-DOF spring-damper attached to a fixed reference frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_index
|
int
|
Index of the node to attach to. |
required |
k
|
Array
|
Stiffness matrix, |
required |
hg_ref
|
Array | None
|
Reference SE(3) frame, |
None
|
c
|
Array | None
|
Damping matrix, |
None
|
Source code in src/flapjax/structure/constraints.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
postprocess ¶
postprocess(hg: Array) -> dict[str, Array]
Extract derived quantities from the converged solution that are given in the returned structure object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Nodal SE(3) frames, |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Array]
|
Dict of named result arrays. |
Source code in src/flapjax/structure/constraints.py
55 56 57 58 59 60 | |
PrescribedMotion ¶
PrescribedMotion(
node_index: int,
k: Array,
hg_ref_t: Array,
c: Array | None = None,
)
Bases: SoftConstraint
Prescribe the trajectory of a node along a reference SE(3) history. The node is driven through a 6-DOF spring-damper to the reference trajectory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_index
|
int
|
Index of the node to drive. |
required |
k
|
Array
|
Tracking stiffness, |
required |
hg_ref_t
|
Array
|
Reference SE(3) trajectory, |
required |
c
|
Array | None
|
Tracking damping, |
None
|
Source code in src/flapjax/structure/constraints.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
resolve_hg_ref ¶
resolve_hg_ref(hg0: Array) -> None
Called once hg0 is populated so subclasses can default their reference frame to the node's initial pose.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg0
|
Array
|
Full nodal initial-frame array, |
required |
Source code in src/flapjax/structure/constraints.py
49 50 51 52 53 | |
postprocess ¶
postprocess(hg: Array) -> dict[str, Array]
Extract derived quantities from the converged solution that are given in the returned structure object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Nodal SE(3) frames, |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Array]
|
Dict of named result arrays. |
Source code in src/flapjax/structure/constraints.py
55 56 57 58 59 60 | |
HardConstraint ¶
Bases: ABC
Base class for a constraint applied through Lagrange multipliers.
Subclasses are either holonomic or non-holonomic
Grounded constraints constrain a single node relative to a fixed reference frame stored on the object.
They have no node_j and must provide a reference coordinate hg_ref.
has_f_res
property
¶
has_f_res: bool
Whether this constraint contributes internal forces, for example if it includes a srping or damper.
violation ¶
violation(hg_i: Array, hg_j: Array) -> Array
Compute the position-level constraint violation vector. Must be overridden by holonomic constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_i
|
Array
|
SE(3) frame of node i, |
required |
hg_j
|
Array
|
SE(3) frame of node j, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Constraint violation, |
Source code in src/flapjax/structure/constraints.py
172 173 174 175 176 177 178 179 180 181 182 | |
vel_violation ¶
vel_violation(
hg_i: Array, hg_j: Array, v_i: Array, v_j: Array
) -> Array
Compute the velocity-level constraint violation vector. Must be overridden by non-holonomic constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_i
|
Array
|
SE(3) frame of node i, |
required |
hg_j
|
Array
|
SE(3) frame of node j, |
required |
v_i
|
Array
|
Local velocity of node i, |
required |
v_j
|
Array
|
Local velocity of node j, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Velocity constraint violation, |
Source code in src/flapjax/structure/constraints.py
184 185 186 187 188 189 190 191 192 193 194 195 196 | |
jacobian_local ¶
jacobian_local(
hg_base_i: Array,
hg_base_j: Array,
phi_i: Array | None = None,
phi_j: Array | None = None,
) -> tuple[Array, Array]
Compute constraint Jacobian blocks via forward-mode AD.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_base_i
|
Array
|
Base SE(3) frame of node i, |
required |
hg_base_j
|
Array
|
Base SE(3) frame of node j, |
required |
phi_i
|
Array | None
|
Accumulated configuration increment for node i, |
None
|
phi_j
|
Array | None
|
Accumulated configuration increment for node j, |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Jacobian blocks |
Source code in src/flapjax/structure/constraints.py
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 | |
a_vel_local ¶
a_vel_local(
hg_i: Array, hg_j: Array, v_i: Array, v_j: Array
) -> tuple[Array, Array]
Velocity Jacobian blocks :math:\partial g_{vel}/\partial v_i and
:math:\partial g_{vel}/\partial v_j via forward-mode AD.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_i
|
Array
|
SE(3) frame of node i, |
required |
hg_j
|
Array
|
SE(3) frame of node j, |
required |
v_i
|
Array
|
Local velocity of node i, |
required |
v_j
|
Array
|
Local velocity of node j, |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Jacobian blocks |
Source code in src/flapjax/structure/constraints.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
a_phi_local ¶
a_phi_local(
hg_base_i: Array,
hg_base_j: Array,
v_i: Array,
v_j: Array,
phi_i: Array | None = None,
phi_j: Array | None = None,
) -> tuple[Array, Array]
Configuration Jacobian blocks of :meth:vel_violation with respect to SE(3)
configuration increments, via forward-mode AD.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_base_i
|
Array
|
Base SE(3) frame of node i, |
required |
hg_base_j
|
Array
|
Base SE(3) frame of node j, |
required |
v_i
|
Array
|
Local velocity of node i, |
required |
v_j
|
Array
|
Local velocity of node j, |
required |
phi_i
|
Array | None
|
Accumulated configuration increment for node i, |
None
|
phi_j
|
Array | None
|
Accumulated configuration increment for node j, |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Jacobian blocks |
Source code in src/flapjax/structure/constraints.py
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 | |
f_res ¶
f_res(
hg_i: Array, hg_j: Array, v_i: Array, v_j: Array
) -> tuple[Array, Array]
Internal force contributions at nodes i and j.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_i
|
Array
|
SE(3) frame of node i, |
required |
hg_j
|
Array
|
SE(3) frame of node j, |
required |
v_i
|
Array
|
Local velocity of node i, |
required |
v_j
|
Array
|
Local velocity of node j, |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
|
Source code in src/flapjax/structure/constraints.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
k_tangent ¶
k_tangent(hg_i: Array, hg_j: Array) -> Array
Tangent stiffness contribution from constraint, (12, 12).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_i
|
Array
|
SE(3) frame of node i, |
required |
hg_j
|
Array
|
SE(3) frame of node j, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Tangent stiffness, |
Source code in src/flapjax/structure/constraints.py
327 328 329 330 331 332 333 334 | |
c_tangent ¶
c_tangent(hg_i: Array, hg_j: Array) -> Array
Tangent damping contribution from constraint, (12, 12).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_i
|
Array
|
SE(3) frame of node i, |
required |
hg_j
|
Array
|
SE(3) frame of node j, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Tangent damping, |
Source code in src/flapjax/structure/constraints.py
336 337 338 339 340 341 342 343 | |
resolve_hg_ref ¶
resolve_hg_ref(hg0: Array) -> None
Called once hg0 is populated so subclasses can default their reference frame to the initial relative pose.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg0
|
Array
|
Full nodal initial-frame array, |
required |
Source code in src/flapjax/structure/constraints.py
345 346 347 348 349 | |
postprocess ¶
postprocess(hg: Array) -> dict[str, Array]
Extract derived quantities from the converged solution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Nodal SE(3) frames, |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Array]
|
Dict of named result arrays. |
Source code in src/flapjax/structure/constraints.py
351 352 353 354 355 356 357 | |
MultibodyHinge ¶
MultibodyHinge(
node_i: int,
node_j: int | None = None,
*,
axis: Array,
hg_rel_ref: Array | None = None,
spring_stiffness: float = 0.0,
damping: float = 0.0,
prescribed_angle: Array | float | None = None,
)
Bases: HardConstraint
Hinge joint between two nodes. Constrains the relative configuration to allow only rotation about the specified axis (5 scalar constraints: 3 translation + 2 perpendicular rotation).
Optionally includes a linear rotational spring and/or damper about the hinge axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_i
|
int
|
Index of first node. |
required |
node_j
|
int | None
|
Index of second node, or |
None
|
axis
|
Array
|
Hinge axis direction |
required |
hg_rel_ref
|
Array | None
|
Reference relative SE(3) pose of the hinge |
None
|
spring_stiffness
|
float
|
Scalar rotational spring stiffness about the hinge axis (N·m/rad). |
0.0
|
damping
|
float
|
Scalar rotational damping about the hinge axis (N·m·s/rad). |
0.0
|
prescribed_angle
|
Array | float | None
|
If not |
None
|
Source code in src/flapjax/structure/constraints.py
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 432 433 434 435 436 437 438 439 | |
hinge_angle ¶
hinge_angle(hg_i: Array, hg_j: Array) -> Array
Extract rotation angle about the hinge axis, relative to the reference configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_i
|
Array
|
SE(3) frame of node i, |
required |
hg_j
|
Array
|
SE(3) frame of node j, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Hinge angle (rad), scalar. |
Source code in src/flapjax/structure/constraints.py
458 459 460 461 462 463 464 465 466 467 | |
f_res ¶
f_res(
hg_i: Array, hg_j: Array, v_i: Array, v_j: Array
) -> tuple[Array, Array]
Spring-damper force contributions at nodes i and j.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_i
|
Array
|
SE(3) frame of node i, |
required |
hg_j
|
Array
|
SE(3) frame of node j, |
required |
v_i
|
Array
|
Local velocity of node i, |
required |
v_j
|
Array
|
Local velocity of node j, |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Forces |
Source code in src/flapjax/structure/constraints.py
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 | |
k_tangent ¶
k_tangent(hg_i: Array, hg_j: Array) -> Array
Tangent stiffness from the hinge spring, (12, 12).
Source code in src/flapjax/structure/constraints.py
502 503 504 505 506 507 508 509 510 511 | |
c_tangent ¶
c_tangent(hg_i: Array, hg_j: Array) -> Array
Tangent damping from the hinge damper, (12, 12).
Source code in src/flapjax/structure/constraints.py
513 514 515 516 517 518 519 520 521 522 | |
vel_violation ¶
vel_violation(
hg_i: Array, hg_j: Array, v_i: Array, v_j: Array
) -> Array
Compute the velocity-level constraint violation vector. Must be overridden by non-holonomic constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_i
|
Array
|
SE(3) frame of node i, |
required |
hg_j
|
Array
|
SE(3) frame of node j, |
required |
v_i
|
Array
|
Local velocity of node i, |
required |
v_j
|
Array
|
Local velocity of node j, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Velocity constraint violation, |
Source code in src/flapjax/structure/constraints.py
184 185 186 187 188 189 190 191 192 193 194 195 196 | |
jacobian_local ¶
jacobian_local(
hg_base_i: Array,
hg_base_j: Array,
phi_i: Array | None = None,
phi_j: Array | None = None,
) -> tuple[Array, Array]
Compute constraint Jacobian blocks via forward-mode AD.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_base_i
|
Array
|
Base SE(3) frame of node i, |
required |
hg_base_j
|
Array
|
Base SE(3) frame of node j, |
required |
phi_i
|
Array | None
|
Accumulated configuration increment for node i, |
None
|
phi_j
|
Array | None
|
Accumulated configuration increment for node j, |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Jacobian blocks |
Source code in src/flapjax/structure/constraints.py
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 | |
a_vel_local ¶
a_vel_local(
hg_i: Array, hg_j: Array, v_i: Array, v_j: Array
) -> tuple[Array, Array]
Velocity Jacobian blocks :math:\partial g_{vel}/\partial v_i and
:math:\partial g_{vel}/\partial v_j via forward-mode AD.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_i
|
Array
|
SE(3) frame of node i, |
required |
hg_j
|
Array
|
SE(3) frame of node j, |
required |
v_i
|
Array
|
Local velocity of node i, |
required |
v_j
|
Array
|
Local velocity of node j, |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Jacobian blocks |
Source code in src/flapjax/structure/constraints.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
a_phi_local ¶
a_phi_local(
hg_base_i: Array,
hg_base_j: Array,
v_i: Array,
v_j: Array,
phi_i: Array | None = None,
phi_j: Array | None = None,
) -> tuple[Array, Array]
Configuration Jacobian blocks of :meth:vel_violation with respect to SE(3)
configuration increments, via forward-mode AD.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_base_i
|
Array
|
Base SE(3) frame of node i, |
required |
hg_base_j
|
Array
|
Base SE(3) frame of node j, |
required |
v_i
|
Array
|
Local velocity of node i, |
required |
v_j
|
Array
|
Local velocity of node j, |
required |
phi_i
|
Array | None
|
Accumulated configuration increment for node i, |
None
|
phi_j
|
Array | None
|
Accumulated configuration increment for node j, |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Jacobian blocks |
Source code in src/flapjax/structure/constraints.py
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 | |
GroundedHinge ¶
GroundedHinge(
node_i: int, *, axis: Array, hg_ref: Array | None = None
)
Bases: HardConstraint
Hinge joint pinning a single node to a fixed point in space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_i
|
int
|
Index of the constrained node. |
required |
axis
|
Array
|
Hinge axis direction |
required |
hg_ref
|
Array | None
|
Reference SE(3) frame |
None
|
Source code in src/flapjax/structure/constraints.py
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | |
has_f_res
property
¶
has_f_res: bool
Whether this constraint contributes internal forces, for example if it includes a srping or damper.
hinge_angle ¶
hinge_angle(hg_i: Array) -> Array
Scalar rotation angle about the hinge axis, relative to the reference frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_i
|
Array
|
SE(3) frame of the constrained node, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Hinge angle (rad), scalar. |
Source code in src/flapjax/structure/constraints.py
578 579 580 581 582 583 584 585 | |
vel_violation ¶
vel_violation(
hg_i: Array, hg_j: Array, v_i: Array, v_j: Array
) -> Array
Compute the velocity-level constraint violation vector. Must be overridden by non-holonomic constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_i
|
Array
|
SE(3) frame of node i, |
required |
hg_j
|
Array
|
SE(3) frame of node j, |
required |
v_i
|
Array
|
Local velocity of node i, |
required |
v_j
|
Array
|
Local velocity of node j, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Velocity constraint violation, |
Source code in src/flapjax/structure/constraints.py
184 185 186 187 188 189 190 191 192 193 194 195 196 | |
a_vel_local ¶
a_vel_local(
hg_i: Array, hg_j: Array, v_i: Array, v_j: Array
) -> tuple[Array, Array]
Velocity Jacobian blocks :math:\partial g_{vel}/\partial v_i and
:math:\partial g_{vel}/\partial v_j via forward-mode AD.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_i
|
Array
|
SE(3) frame of node i, |
required |
hg_j
|
Array
|
SE(3) frame of node j, |
required |
v_i
|
Array
|
Local velocity of node i, |
required |
v_j
|
Array
|
Local velocity of node j, |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Jacobian blocks |
Source code in src/flapjax/structure/constraints.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
a_phi_local ¶
a_phi_local(
hg_base_i: Array,
hg_base_j: Array,
v_i: Array,
v_j: Array,
phi_i: Array | None = None,
phi_j: Array | None = None,
) -> tuple[Array, Array]
Configuration Jacobian blocks of :meth:vel_violation with respect to SE(3)
configuration increments, via forward-mode AD.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_base_i
|
Array
|
Base SE(3) frame of node i, |
required |
hg_base_j
|
Array
|
Base SE(3) frame of node j, |
required |
v_i
|
Array
|
Local velocity of node i, |
required |
v_j
|
Array
|
Local velocity of node j, |
required |
phi_i
|
Array | None
|
Accumulated configuration increment for node i, |
None
|
phi_j
|
Array | None
|
Accumulated configuration increment for node j, |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Jacobian blocks |
Source code in src/flapjax/structure/constraints.py
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 | |
f_res ¶
f_res(
hg_i: Array, hg_j: Array, v_i: Array, v_j: Array
) -> tuple[Array, Array]
Internal force contributions at nodes i and j.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_i
|
Array
|
SE(3) frame of node i, |
required |
hg_j
|
Array
|
SE(3) frame of node j, |
required |
v_i
|
Array
|
Local velocity of node i, |
required |
v_j
|
Array
|
Local velocity of node j, |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
|
Source code in src/flapjax/structure/constraints.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
k_tangent ¶
k_tangent(hg_i: Array, hg_j: Array) -> Array
Tangent stiffness contribution from constraint, (12, 12).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_i
|
Array
|
SE(3) frame of node i, |
required |
hg_j
|
Array
|
SE(3) frame of node j, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Tangent stiffness, |
Source code in src/flapjax/structure/constraints.py
327 328 329 330 331 332 333 334 | |
c_tangent ¶
c_tangent(hg_i: Array, hg_j: Array) -> Array
Tangent damping contribution from constraint, (12, 12).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg_i
|
Array
|
SE(3) frame of node i, |
required |
hg_j
|
Array
|
SE(3) frame of node j, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Tangent damping, |
Source code in src/flapjax/structure/constraints.py
336 337 338 339 340 341 342 343 | |
data_structures ¶
StructureCase ¶
StructureCase(
hg: Array,
conn: tuple[tuple[int, int], ...],
o0: Array,
d: Array,
eps: Array,
varphi: Array,
f_ext_follower: Array | None,
f_ext_dead: Array | None,
f_ext_aero: Array | None,
f_grav: Array | None,
f_int: Array,
f_elem: Array,
f_res: Array,
t: Array,
thrust: dict[str, Array],
thrust_nodes: tuple[tuple[str, int], ...],
thrust_direction: tuple[
tuple[str, tuple[float, float, float]], ...
],
prescribed_dofs: tuple[int, ...] | Array,
v: Array | None = None,
v_dot: Array | None = None,
a: Array | None = None,
f_iner_gyr: Array | None = None,
i_ts: int | None = None,
local: bool = True,
constraint_data: dict[str, dict[str, Array]]
| None = None,
)
Object to hold the full state and forces of a structure analysis.
A single instance may represent any of three flavours:
- Static: dynamic-only fields (
v,v_dot,a,f_iner_gyr) are not set — their public properties return an all-zeros array of appropriate shape. Array shapes are(n_nodes, ...). - Dynamic snapshot: all dynamic fields populated for a single timestep. Array shapes are
(n_nodes, ...). - Dynamic trajectory: all dynamic fields populated for multiple timesteps.
tis a(n_tstep,)array andi_tsisNone. Array shapes are(n_tstep, n_nodes, ...).
Use :attr:is_dynamic and :attr:is_batched to distinguish at runtime.
Source code in src/flapjax/structure/data_structures.py
61 62 63 64 65 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 113 114 115 116 117 118 119 120 | |
to_dynamic ¶
to_dynamic() -> StructureCase
to_dynamic(t: None) -> StructureCase
to_dynamic(t: Array) -> StructureCase
to_dynamic(t: Array | None = None) -> StructureCase
Convert static structure results to a dynamic snapshot (t=None) or
a batched trajectory (t provided), zeroing velocity/acceleration
fields. Calling on a Structure that is already dynamic returns self.
Source code in src/flapjax/structure/data_structures.py
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 | |
to_static ¶
to_static() -> StructureCase
Return a static Structure, dropping velocity/acceleration
fields. If already static, returns self. For a batched trajectory,
raises: use self[i_ts].to_static() to extract a single time step first.
Source code in src/flapjax/structure/data_structures.py
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 | |
initialise
classmethod
¶
initialise(
initial_snapshot: StructureCase,
t: Array,
use_f_ext_follower: bool,
use_f_ext_dead: bool,
use_f_ext_aero: bool,
) -> StructureCase
Initialise a batched dynamic Structure from a single dynamic snapshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_snapshot
|
StructureCase
|
Snapshot at initial time step (must be dynamic,
i.e. |
required |
t
|
Array
|
Time step array, |
required |
use_f_ext_follower
|
bool
|
Whether to include follower force array |
required |
use_f_ext_dead
|
bool
|
Whether to include dead force array |
required |
use_f_ext_aero
|
bool
|
Whether to include aero force array |
required |
Returns:
| Type | Description |
|---|---|
StructureCase
|
Batched Structure with arrays initialised to zero except for the first time step. |
Source code in src/flapjax/structure/data_structures.py
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 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | |
to_global ¶
to_global() -> None
Convert local structure results to global frame.
Source code in src/flapjax/structure/data_structures.py
460 461 462 463 464 465 466 | |
to_local ¶
to_local() -> None
Convert global structure results to local frame.
Source code in src/flapjax/structure/data_structures.py
468 469 470 471 472 473 474 475 476 477 478 | |
plot ¶
plot(directory: PathLike | str, n_interp: int = 0) -> Path
plot(
directory: PathLike | str,
n_interp: int = 0,
*,
index: slice
| Sequence[int]
| int
| Array
| None = None,
) -> Path
plot(
directory: PathLike | str,
n_interp: int = 0,
*,
index: slice
| Sequence[int]
| int
| Array
| None = None,
) -> Path
Plot beam results to VTK/VTU files in the specified directory. For a batched Structure, a PVD is written alongside per-timestep VTUs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
PathLike | str
|
Path to write files to. |
required |
n_interp
|
int
|
Number of interpolation points to add between each element for smoother visualisation. |
0
|
index
|
slice | Sequence[int] | int | Array | None
|
For batched Structures only, time step indices to plot. |
None
|
Source code in src/flapjax/structure/data_structures.py
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 | |
gradients ¶
beam ¶
BeamStructure ¶
BeamStructure(
num_nodes: int,
connectivity: Array,
y_vector: Array,
k_cs_index: Array | None = None,
m_cs_index: Array | None = None,
m_lumped_index: Array | None = None,
gravity: Array | Sequence[float] | None = None,
thrust_nodes: dict[str, int] | None = None,
thrust_direction: dict[str, Array] | None = None,
optional_jacobians: OptionalJacobians | None = None,
relaxation_factor: float = 1.0,
spectral_radius: float = 0.9,
alpha_m: float = 0.0,
beta_k: float = 0.0,
struct_convergence_settings: ConvergenceSettings = DEFAULT_STRUCT_CONVERGENCE_SETTINGS,
constraints: dict[str, SoftConstraint | HardConstraint]
| None = None,
)
Bases: BaseBeamStructure
Initialise BaseBeamStructure class with all non-design parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_nodes
|
int
|
Number of nodes in the structure. |
required |
connectivity
|
Array
|
Connectivity array, `(n_elem, 2)``. |
required |
y_vector
|
Array
|
Vector defining the y direction for each element, |
required |
k_cs_index
|
Array | None
|
Array defining the index from the library of k_cs to use for each element, |
None
|
m_cs_index
|
Array | None
|
Array defining the index from the library of m_cs to use for each element, |
None
|
m_lumped_index
|
Array | None
|
Node index for nodes which are to have a lumped mass attached. The order is the same as
that for the lumped mass data |
None
|
gravity
|
Array | Sequence[float] | None
|
Gravity vector in global reference frame, or None for no gravity_vec, |
None
|
thrust_nodes
|
dict[str, int] | None
|
Dictionary of thrust node names and their corresponding node indices, {keys, int}. |
None
|
thrust_direction
|
dict[str, Array] | None
|
Dictionary of thrust node names and their corresponding thrust direction vectors,
|
None
|
optional_jacobians
|
OptionalJacobians | None
|
Define which Jacobians contributions are to be used for solution. |
None
|
relaxation_factor
|
float
|
Relaxation factor which reduces the displacement update at each iteration. A value of 1 is no relaxation, and a value of 0 is no update. |
1.0
|
spectral_radius
|
float
|
Spectral radius for structural time integrator, where a value of 0 is highly damped and a value of 1 is undamped. |
0.9
|
alpha_m
|
float
|
Mass-proportional Rayleigh damping coefficient. |
0.0
|
beta_k
|
float
|
Stiffness-proportional Rayleigh damping coefficient. |
0.0
|
struct_convergence_settings
|
ConvergenceSettings
|
Structure convergence settings. |
DEFAULT_STRUCT_CONVERGENCE_SETTINGS
|
constraints
|
dict[str, SoftConstraint | HardConstraint] | None
|
Named dict |
None
|
Source code in src/flapjax/structure/beam.py
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 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 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | |
n_multibody_constraints
property
¶
n_multibody_constraints: int
Total number of scalar Lagrange-multiplier constraints.
n_holonomic_constraints
property
¶
n_holonomic_constraints: int
Number of scalar holonomic (position-level) Lagrange-multiplier constraints.
n_nonholonomic_constraints
property
¶
n_nonholonomic_constraints: int
Number of scalar non-holonomic (velocity-level) Lagrange-multiplier constraints.
case_from_dv ¶
case_from_dv(dv: StructureDesignVariables) -> BeamStructure
Obtain a structural object as a function of design variables, allowing it to have defined gradients w.r.t. design variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dv
|
StructureDesignVariables
|
Design variables. |
required |
Returns:
| Type | Description |
|---|---|
BeamStructure
|
Beam structure object with the same functionality as self. |
Source code in src/flapjax/structure/gradients/beam.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
minimal_states_to_full_states ¶
minimal_states_to_full_states(
i_ts: int,
q: StructureMinimalStates,
dv: StructureDesignVariables,
dv_full: StructureDesignVariables,
) -> StructureFullStates
Obtain the full set of states from the minimal states and the design variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int
|
Index of the time step. |
required |
q
|
StructureMinimalStates
|
Minimal dynamic structure states. |
required |
dv
|
StructureDesignVariables
|
Design variables, where entries for gradients which aren't needed are set to None. |
required |
dv_full
|
StructureDesignVariables
|
Design variables, without omissions. These values are fallen back to when an entry in |
required |
Returns:
| Type | Description |
|---|---|
StructureFullStates
|
Full set of structural states used inside objective function. |
Source code in src/flapjax/structure/gradients/beam.py
65 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 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 | |
static_adjoint ¶
static_adjoint(
structure: StructureCase,
objective: StructureObjectiveFunction,
optional_jacobians: OptionalJacobians
| None = OPTIONAL_JACOBIANS_DEFAULT,
ad_mode: ADMode = "reverse",
) -> tuple[StructureDesignVariables, Array]
Computes the static grads of the structure, which is used to compute gradients of the loss with respect to the structure's parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure
|
StructureCase
|
StructureCase containing the current state of the structure. |
required |
objective
|
StructureObjectiveFunction
|
Objective function that takes the structure and design variables and returns an array |
required |
optional_jacobians
|
OptionalJacobians | None
|
OptionalJacobians object specifying which Jacobians to compute. |
OPTIONAL_JACOBIANS_DEFAULT
|
ad_mode
|
ADMode
|
Flag on which to use of the forward or reverse adjoint. |
'reverse'
|
Returns:
| Type | Description |
|---|---|
tuple[StructureDesignVariables, Array]
|
Gradient of objective function output with respect to design variables, and adjoint states. |
Source code in src/flapjax/structure/gradients/beam.py
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 | |
timestep_residual ¶
timestep_residual(
i_ts: int | Array,
q_nm1: StructureMinimalStates,
q_n: StructureMinimalStates,
dv_: StructureDesignVariables,
thrust_t: dict[str, Array],
solve_dofs: tuple[int, ...],
approx_grads: bool,
) -> Array
Routine to compute the full residual for the structural dynamic problem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array
|
Time step index. |
required |
q_nm1
|
StructureMinimalStates
|
Previous minimal state. |
required |
q_n
|
StructureMinimalStates
|
Current minimal state. |
required |
dv_
|
StructureDesignVariables
|
Design variables. |
required |
thrust_t
|
dict[str, Array]
|
Thrust time history, |
required |
solve_dofs
|
tuple[int, ...]
|
Solve degrees of freedom. |
required |
approx_grads
|
bool
|
If true, block gradients from some parts of the solution. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Residual vector, |
Source code in src/flapjax/structure/gradients/beam.py
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 | |
timestep_residual_jacobians ¶
timestep_residual_jacobians(
i_ts: int | Array,
q_nm1: StructureMinimalStates,
q_n: StructureMinimalStates,
f_ext_aero_nm1: Array | None,
f_ext_aero_n: Array | None,
dv: StructureDesignVariables,
thrust_t: dict[str, Array],
solve_dofs: tuple[int, ...],
approx_grads: bool,
n_profile_loops: int | None,
jac_options: dict[
str, dict[str, Callable[..., Any] | None]
],
mode: ADMode = "reverse",
) -> tuple[
Array,
Array,
StructureDesignVariables,
Array | None,
Array | None,
dict[str, dict[str, float]] | None,
dict[str, dict[str, float]] | None,
]
Obtain the Jacobians of the structural residual with respect to the current states and previous states.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_ts
|
int | Array
|
Time step index. |
required |
q_nm1
|
StructureMinimalStates
|
Previous minimal states. |
required |
q_n
|
StructureMinimalStates
|
Current minimal states. |
required |
f_ext_aero_nm1
|
Array | None
|
Optional aerodynamic forcing for previous time step, |
required |
f_ext_aero_n
|
Array | None
|
Optional aerodynamic forcing for current time step, |
required |
dv
|
StructureDesignVariables
|
Design variables. |
required |
thrust_t
|
dict[str, Array]
|
Thrust time history, |
required |
solve_dofs
|
tuple[int, ...]
|
Index of degrees of freedom to solve for. |
required |
approx_grads
|
bool
|
If True, remove some gradient terms which are generally small. |
required |
n_profile_loops
|
int | None
|
Number of profile loops to run for timing function. If None, no profiling is done. |
required |
jac_options
|
dict[str, dict[str, Callable[..., Any] | None]]
|
Input which passes functions which can be used to approximate the Jacobians. If entries are None, AD is used. |
required |
mode
|
ADMode
|
AD mode used for Jacobian construction. |
'reverse'
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, StructureDesignVariables, Array | None, Array | None, dict[str, dict[str, float]] | None, dict[str, dict[str, float]] | None]
|
Jacobians with respect to previous state and current state, gradients with respect to design variables, previous, and current aerodynamic forces respectively, and profiling times for compilation and run time. |
Source code in src/flapjax/structure/gradients/beam.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 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 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 | |
j_from_q_x ¶
j_from_q_x(
q_n_mat: Array,
dv: StructureDesignVariables,
dv_full: StructureDesignVariables,
objective: StructureObjectiveFunction,
i_ts: int,
) -> Array
Obtain the objective as a function of the minimal states and design variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q_n_mat
|
Array
|
Matrix representation of the minimal states. |
required |
dv
|
StructureDesignVariables
|
Design variables, with unwanted entries replaced with None. |
required |
dv_full
|
StructureDesignVariables
|
Design variables which are defined for all entries. |
required |
objective
|
StructureObjectiveFunction
|
Objective function. |
required |
i_ts
|
int
|
Time step index. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Objective value. |
Source code in src/flapjax/structure/gradients/beam.py
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 | |
p_j ¶
p_j(
objective: StructureObjectiveFunction,
i_ts: int,
dv: StructureDesignVariables,
dv_full: StructureDesignVariables,
q_n: StructureMinimalStates,
) -> tuple[Array, StructureDesignVariables]
Obtains Jacobians of the objective function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
objective
|
StructureObjectiveFunction
|
Objective function. |
required |
i_ts
|
int
|
Time step index. |
required |
dv
|
StructureDesignVariables
|
Design variables. |
required |
dv_full
|
StructureDesignVariables
|
Design variables which are defined for all entries. |
required |
q_n
|
StructureMinimalStates
|
Current minimal states. |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, StructureDesignVariables]
|
Jacobian with respect to minimal states and design variables. |
Source code in src/flapjax/structure/gradients/beam.py
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 | |
adjoint_time_loop ¶
adjoint_time_loop(
rev_i_ts: int,
d_j_d_x_: StructureDesignVariables,
adj_: Array,
p_r_np1_p_q_n: Array | None,
adj_t_p_r_np1_p_q_n: Array | None,
q_n: StructureMinimalStates,
structure: StructureCase,
objective: StructureObjectiveFunction,
dv: StructureDesignVariables,
dv_full: StructureDesignVariables,
thrust_t: dict[str, Array],
solve_dofs: tuple[int, ...],
approx_grads: bool,
save_adjoint: bool,
matrix_free: bool,
n_j: int,
jac_options: dict[
str, dict[str, Callable[..., Any] | None]
],
i_ts_end: int | None = None,
) -> tuple[
StructureDesignVariables,
Array,
Array,
StructureMinimalStates,
]
Function to obtain the grads states at timestep varphi, which is dependent on the grads at timestep varphi+1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rev_i_ts
|
int
|
Reversed timestep index. JAX loop does not allow for reverse indexing, and so this is. explicitly reversed within the function body to obtain i_ts. |
required |
d_j_d_x_
|
StructureDesignVariables
|
Design gradient to accumulate. |
required |
adj_
|
Array
|
Full grads matrix which is updated inplace, |
required |
p_r_np1_p_q_n
|
Array | None
|
Gradient of future step with respect to current state, used when computing the full
Jacobian |
required |
adj_t_p_r_np1_p_q_n
|
Array | None
|
VJP of the future adjoint step and the Jacobian of the future residual with respect
to the current state, |
required |
q_n
|
StructureMinimalStates
|
Current minimal states. |
required |
structure
|
StructureCase
|
Dynamic structure solution. |
required |
objective
|
StructureObjectiveFunction
|
Objective function. |
required |
dv
|
StructureDesignVariables
|
Structure design variables. |
required |
dv_full
|
StructureDesignVariables
|
Structure design variables which are defined for all entries. |
required |
thrust_t
|
dict[str, Array]
|
Thrust time history, |
required |
solve_dofs
|
tuple[int, ...]
|
Tuple of dof index to solve. |
required |
approx_grads
|
bool
|
Whether to approximate the gradient or not. |
required |
save_adjoint
|
bool
|
Whether to save the full adjoint time history. |
required |
matrix_free
|
bool
|
If False, solve the system using the residual Jacobian-vector product using GMRES. |
required |
n_j
|
int
|
Number of objective function outputs. |
required |
jac_options
|
dict[str, dict[str, Callable[..., Any] | None]]
|
Input which passes functions which can be used to approximate the Jacobians. If entries are None, AD is used. |
required |
i_ts_end
|
int | None
|
Largest time step index for which the adjoint is computed. Defaults to
|
None
|
Returns:
| Type | Description |
|---|---|
tuple[StructureDesignVariables, Array, Array, StructureMinimalStates]
|
Updated grads matrix, gradient of current step with respect to previous state and current state. |
Source code in src/flapjax/structure/gradients/beam.py
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 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 | |
construct_approximate_jacobians ¶
construct_approximate_jacobians(
sol: StructureCase,
jacobian_approximations: StructureJacobianApproximations,
) -> dict[str, dict[str, Callable[..., Any] | None]]
Compute approximations for Jacobians which are specified in the jacobian_approximations data structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sol
|
StructureCase
|
Solution for which approximations will be created for the initial time step. |
required |
jacobian_approximations
|
StructureJacobianApproximations
|
Data structure which defines which approximations to create. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, Callable[..., Any] | None]]
|
Dictionary of approximations. |
Source code in src/flapjax/structure/gradients/beam.py
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 | |
dynamic_adjoint ¶
dynamic_adjoint(
structure: StructureCase,
objective: StructureObjectiveFunction,
matrix_free: bool = False,
jacobian_approximations: StructureJacobianApproximations = JACOBIAN_APPROXIMATIONS_DEFAULT,
p_q0_p_x: StructureDesignVariables | None = None,
save_adjoint: bool = False,
approx_grads: bool = True,
grads_to_compute: StructureGradsToCompute = GRADS_TO_COMPUTE_DEFAULT,
i_ts_adjoint_range: tuple[int | None, int | None] = (
None,
None,
),
) -> tuple[StructureDesignVariables, Array | None]
Dynamic structure grads problem. This computes the gradient of the objective of the dynamic response with
respect to design variables. The objective has structure
:math:J = \sum_{i=1}^N \left(j(\mathbf{x}, \mathbf{y}_i)\right) where :math:\mathbf{x} are the design variables
and :math:\mathbf{y} are the structural states at each timestep, which depend on the design variables through
the dynamic structure equations. The gradient is computed by first solving a backward pass to obtain the grads
states, and then using these to compute the gradient w.r.t. design variables in a forward pass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure
|
StructureCase
|
Dynamic structure solution object. |
required |
objective
|
StructureObjectiveFunction
|
Objective function :math: |
required |
matrix_free
|
bool
|
Whether to use matrix-free methods for solving the linear systems. Default is False, as structural problems generally do not benefit from this solve. |
False
|
jacobian_approximations
|
StructureJacobianApproximations
|
Data structure which specifies Jacobian approximations to use for each part of
the problem. The value can either be None for no approximation, |
JACOBIAN_APPROXIMATIONS_DEFAULT
|
p_q0_p_x
|
StructureDesignVariables | None
|
Optional Jacobian used to describe the sensitivities of the initial structural degrees of freedom to the design variables. |
None
|
save_adjoint
|
bool
|
Whether to save the full adjoint vectors. |
False
|
approx_grads
|
bool
|
If true, some gradient contributions which are assumed to be near-zero are removed to decrease computational cost. |
True
|
grads_to_compute
|
StructureGradsToCompute
|
Design variables with which to compute design gradients for. |
GRADS_TO_COMPUTE_DEFAULT
|
i_ts_adjoint_range
|
tuple[int | None, int | None]
|
Optional |
(None, None)
|
Returns:
| Type | Description |
|---|---|
tuple[StructureDesignVariables, Array | None]
|
Objective gradient :math: |
Source code in src/flapjax/structure/gradients/beam.py
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 1194 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 1298 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 | |
dynamic_adjoint_jacobian_profile ¶
dynamic_adjoint_jacobian_profile(
sol: StructureCase,
approx_grads: bool,
jacobian_approximations: StructureJacobianApproximations = JACOBIAN_APPROXIMATIONS_DEFAULT,
grads_to_compute: StructureGradsToCompute | None = None,
f_aero_nm1_n: tuple[Array, Array] | None = None,
i_ts: int = 1,
n_loop: int = 10,
*,
print_header: bool = True,
) -> tuple[
dict[str, dict[str, float]], dict[str, dict[str, float]]
]
Function to time evaluation of the Jacobians used for the adjoint solution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sol
|
StructureCase
|
Dynamic structural solution to extract states from. |
required |
approx_grads
|
bool
|
If True, neglect small gradient terms. |
required |
jacobian_approximations
|
StructureJacobianApproximations
|
Data structure which specifies Jacobian approximations to use for each part of the problem. |
JACOBIAN_APPROXIMATIONS_DEFAULT
|
grads_to_compute
|
StructureGradsToCompute | None
|
StructureGradsToCompute object which describes which design gradients to compute. If None, all gradients will be computed. |
None
|
f_aero_nm1_n
|
tuple[Array, Array] | None
|
Tuple of [f_aero_nm1, f_aero_n] which are passed from the aero problem. If None, no aerodynamic force gradients will be computed. |
None
|
i_ts
|
int
|
Time step index where to evaluate residual Jacobians. |
1
|
n_loop
|
int
|
Number of times to loop the Jacobian evaluation time for averaging the runtime. |
10
|
print_header
|
bool
|
Flag used to prevent heading printer when called by the coupled profiler. |
True
|
Returns:
| Type | Description |
|---|---|
tuple[dict[str, dict[str, float]], dict[str, dict[str, float]]]
|
Dictionary of {residual_name: {gradient_argument: val}} for compile time and run time respectively. |
Source code in src/flapjax/structure/gradients/beam.py
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 1372 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 | |
set_design_variables ¶
set_design_variables(
coords: Array,
k_cs: Array,
m_cs: Array | None,
m_lumped: Array | None = None,
orientation_euler: Array | None = None,
thrust_reference: dict[str, Array | float]
| None = None,
*,
remove_checks: bool = False,
) -> None
Set design variables and compute initial configuration dependent quantities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
Array
|
Node coordinates in the reference configuration, |
required |
k_cs
|
Array
|
Cross-section stiffness matrices, |
required |
m_cs
|
Array | None
|
Cross-section mass matrices, |
required |
m_lumped
|
Array | None
|
Lumped mass matrices at nodes, |
None
|
orientation_euler
|
Array | None
|
Euler angles in radians which to rotate the reference configuration by, |
None
|
thrust_reference
|
dict[str, Array | float] | None
|
Reference thrust magnitude, |
None
|
remove_checks
|
bool
|
Flag to ignore input checks, used when function is JIT compiled. |
False
|
Source code in src/flapjax/structure/beam.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 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 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 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 | |
get_design_variables ¶
get_design_variables(
struct_case: StructureCase,
thrust_t: dict[str, Array],
grads_to_compute: StructureGradsToCompute | None,
) -> StructureDesignVariables
Obtain the design variables for the structural problem. As the external forcing is defined for each solve, the chosen forcing is required as input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
struct_case
|
StructureCase
|
Structural case |
required |
thrust_t
|
dict[str, Array]
|
Thrust time history, {keys, |
required |
grads_to_compute
|
StructureGradsToCompute | None
|
Data structure which describes which design variables should be obtained. If none, all variables are obtained. |
required |
Returns:
| Type | Description |
|---|---|
StructureDesignVariables
|
StructureDesignVariables dataclass containing design variables |
Source code in src/flapjax/structure/beam.py
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 | |
reference_configuration ¶
reference_configuration(
prescribed_dofs: Sequence[int]
| Array
| slice
| int = (),
use_f_ext_follower: bool = True,
use_f_ext_dead: bool = True,
use_f_aero: bool = True,
use_f_grav: bool = True,
) -> StructureCase
Get the reference configuration of the structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prescribed_dofs
|
Sequence[int] | Array | slice | int
|
Prescribed degrees of freedom, which are not solved for. Defaults to no prescribed DoFs. |
()
|
use_f_ext_follower
|
bool
|
Whether to include follower forces in the reference configuration. |
True
|
use_f_ext_dead
|
bool
|
Whether to include dead forces in the reference configuration. |
True
|
use_f_aero
|
bool
|
Whether to include aerodynamic forces in the reference configuration. |
True
|
use_f_grav
|
bool
|
Whether to include gravitational forces in the reference configuration. |
True
|
Returns:
| Type | Description |
|---|---|
StructureCase
|
Structure dataclass containing reference configuration. |
Source code in src/flapjax/structure/beam.py
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 | |
compute_varphi_from_hg ¶
compute_varphi_from_hg(hg: Array) -> Array
Calculate the twist vector from the reference configuration to hg
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Deformed coordinates, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Vector of twists, |
Source code in src/flapjax/structure/beam.py
665 666 667 668 669 670 671 | |
assemble_matrix_from_entries ¶
assemble_matrix_from_entries(entries: Array) -> Array
Assemble global matrix from element entries
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entries
|
Array
|
Array of element matrix entries, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
System global matrix, |
Source code in src/flapjax/structure/beam.py
677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | |
assemble_vector_from_entries ¶
assemble_vector_from_entries(entries: Array) -> Array
Assemble global vector from element entries
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entries
|
Array
|
Array of element vector entries, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
System global vector, |
Source code in src/flapjax/structure/beam.py
696 697 698 699 700 701 702 703 704 705 | |
add_lumped_contributions_to_arr ¶
add_lumped_contributions_to_arr(
arr: Array, lumped_arr: Array
) -> Array
Add lumped contributions to an array
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
Array
|
Full array, |
required |
lumped_arr
|
Array
|
Lumped contributions, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
In-place updated array, |
Source code in src/flapjax/structure/beam.py
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | |
add_lumped_contributions_to_vec ¶
add_lumped_contributions_to_vec(
vec: Array, lumped_vec: Array
) -> Array
Add lumped contributions to an array
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vec
|
Array
|
Full vector, |
required |
lumped_vec
|
Array
|
Lumped contributions, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
In-place updated vector, |
Source code in src/flapjax/structure/beam.py
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | |
make_k_t ¶
make_k_t(d: Array, p_d: Array, eps: Array) -> Array
Assemble tangent stiffness matrix as a function of the element relative configuration vectors
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Element relative configuration, |
required |
p_d
|
Array
|
P(d) operator, |
required |
eps
|
Array
|
Element strains, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Elementwise stiffness matrix entries, |
Source code in src/flapjax/structure/beam.py
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 | |
make_k_t_full ¶
make_k_t_full(
d: Array,
p_d: Array,
eps: Array,
f_ext_dead: Array | None,
rmat: Array,
m_t: Array | None,
) -> Array
Compute the full tangent stiffness matrix, with contributions from stiffness, dead forces and gravity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Element relative configuration, |
required |
p_d
|
Array
|
P(d) operator, |
required |
eps
|
Array
|
Strain vectors, |
required |
f_ext_dead
|
Array | None
|
External dead forces in global reference, |
required |
rmat
|
Array
|
Nodal rotation matrices, |
required |
m_t
|
Array | None
|
Disassembled system mass matrix, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Tangent stiffness matrix with all contributions, |
Source code in src/flapjax/structure/beam.py
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 | |
make_m_t ¶
make_m_t(
d: Array,
int_order: Literal[3, 4, 5] = BASE_LOBATTO_ORDER,
) -> Array
Assemble tangent mass matrix as a function of the element relative configuration vectors. This does not include the lumped mass contribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Element relative configuration, |
required |
int_order
|
Literal[3, 4, 5]
|
Integration order for mass matrix computation |
BASE_LOBATTO_ORDER
|
Returns:
| Type | Description |
|---|---|
Array
|
Elementwise mass matrix, |
Source code in src/flapjax/structure/beam.py
944 945 946 947 948 949 950 951 952 953 954 955 956 | |
make_nodal_m_k ¶
make_nodal_m_k(
case: StructureCase,
int_order: Literal[3, 4, 5] = BASE_LOBATTO_ORDER,
) -> tuple[Array, Array]
Create the global mass and stiffness matrices for a given static structure case. These can be used for modal analysis or other purposes. These matrices are the Jacobians of the local forcing residual with respect to global perturbations in acceleration and displacement, respectively.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
StructureCase
|
Static structure case for which to compute the global mass and stiffness matrices. |
required |
int_order
|
Literal[3, 4, 5]
|
Integration order for mass matrix computation. |
BASE_LOBATTO_ORDER
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Global mass and stiffness matrices, |
Source code in src/flapjax/structure/beam.py
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 | |
modal ¶
modal(
case: StructureCase,
remove_complex_conjugate: bool = True,
int_order: Literal[3, 4, 5] = BASE_LOBATTO_ORDER,
n_modes: int = 20,
freq_range: tuple[float | Array, float | Array] = (
0.0,
jnp.inf,
),
damp_range: tuple[float | Array, float | Array] = (
-jnp.inf,
jnp.inf,
),
vtu_directory: str | PathLike = "./modal",
n_plot_vtu: int | None = None,
aero: UVLM | None = None,
n_phase: int = 8,
n_interp: int = 0,
max_disp: float = 0.2,
max_ang: float = 0.2,
) -> tuple[Array, Array, Array]
Perform modal analysis on the structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
StructureCase
|
The static structure case for which to perform modal analysis. |
required |
remove_complex_conjugate
|
bool
|
If true, keep only one mode from each complex conjugate pair. |
True
|
int_order
|
Literal[3, 4, 5]
|
Integration order for mass matrix computation. |
BASE_LOBATTO_ORDER
|
n_modes
|
int
|
Number of modes to preserve. |
20
|
freq_range
|
tuple[float | Array, float | Array]
|
Frequency range for filtering out modes. |
(0.0, inf)
|
damp_range
|
tuple[float | Array, float | Array]
|
Damping range for filtering out modes. |
(-inf, inf)
|
vtu_directory
|
str | PathLike
|
Directory to for saving the mode shapes to vtu files. |
'./modal'
|
n_plot_vtu
|
int | None
|
Number of modes to plot to vtu files. Will default to "./modal". |
None
|
aero
|
UVLM | None
|
UVLM aerodynamic model. If passed, the vtu files will include the aerodynamic grid. If not, they will just be the beam structure. |
None
|
n_phase
|
int
|
Number of phases to use when plotting the modes to vtu files. |
8
|
n_interp
|
int
|
Number of times to interpolate between beam nodes for vtu plotting. |
0
|
max_disp
|
float
|
Maximum displacement of structure for plotted modes, used for scaling. |
0.2
|
max_ang
|
float
|
Maximum angle of structure for plotted modes in radians, used for scaling. |
0.2
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, Array]
|
Tuple of natural frequencies (n_free_dof), damping ratios (n_free_dof), and mode shapes with no
normalisation |
Source code in src/flapjax/structure/beam.py
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 | |
linearise ¶
linearise(
reference: StructureCase,
dt: float,
n_modes: int | None = None,
modal_inputs: bool = False,
modal_outputs: bool = False,
prescribed_dofs: Sequence[int]
| Array
| slice
| int
| None = None,
) -> LinearBeam
Linearise the beam about a given static structure case. This creates a LinearBeam object which can be used for linear dynamic analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
StructureCase
|
Static structure case about which to linearise the beam. |
required |
dt
|
float
|
Time step size, used for conversions between continuous and discrete time. |
required |
n_modes
|
int | None
|
If not None, the linearised system uses modal state coordinates truncated to this many modes. |
None
|
modal_inputs
|
bool
|
If True, external forcing inputs are provided as modal forces (requires n_modes). |
False
|
modal_outputs
|
bool
|
If True, outputs are exposed as modal coordinates (requires n_modes). |
False
|
prescribed_dofs
|
Sequence[int] | Array | slice | int | None
|
If provided, overrides the prescribed DOFs from the reference case. |
None
|
Returns:
| Type | Description |
|---|---|
LinearBeam
|
Continuous-time linearised beam object. |
Source code in src/flapjax/structure/beam.py
1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 | |
apply_nodal_constraint_tangent ¶
apply_nodal_constraint_tangent(
mat: Array,
hg: Array,
i_ts: int,
gamma_prime: float | Array | None,
) -> Array
Add nodal constraint contributions to a system matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mat
|
Array
|
System matrix to update, |
required |
hg
|
Array
|
SE(3) coordiantes, |
required |
i_ts
|
int
|
Time-step index (0 for static solves). |
required |
gamma_prime
|
float | Array | None
|
Time-integrator gamma_prime for damping scaling, or |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Updated system matrix. |
Source code in src/flapjax/structure/beam.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 | |
postprocess_constraints ¶
postprocess_constraints(
hg: Array,
) -> dict[str, dict[str, Array]]
Postprocess all constraints to extract derived quantities (e.g. hinge angles).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Nodal SE(3) frames, |
required |
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, Array]]
|
Nested dict |
Source code in src/flapjax/structure/beam.py
1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 | |
solve_constrained ¶
solve_constrained(
sys_mat_solve: Array,
f_res_solve: Array,
hg_eval: Array,
solve_dofs: Array,
hg_base: Array | None = None,
phi: Array | None = None,
v: Array | None = None,
gamma_prime: float | Array | None = None,
) -> tuple[Array, Array, Array]
Solve the augmented system with Lagrange multipliers, supporting both holonomic and non-holonomic constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sys_mat_solve
|
Array
|
System matrix at solve DOFs, |
required |
f_res_solve
|
Array
|
Force residual at solve DOFs, |
required |
hg_eval
|
Array
|
SE(3) frames for constraint evaluation, |
required |
solve_dofs
|
Array
|
Free DOF indices, |
required |
hg_base
|
Array | None
|
Base frames for Jacobian computation (defaults to |
None
|
phi
|
Array | None
|
Accumulated configuration increment, |
None
|
v
|
Array | None
|
Current nodal velocities for non-holonomic constraints, |
None
|
gamma_prime
|
float | Array | None
|
Newmark parameter for non-holonomic constraints. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, Array]
|
|
Source code in src/flapjax/structure/beam.py
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 | |
compute_centre_of_mass ¶
compute_centre_of_mass(hg: Array) -> Array
Compute the centre of mass for an arbitrary system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Node SE(3) coordinates, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Centre of mass, (3) or |
Source code in src/flapjax/structure/beam.py
1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 | |
make_f_elem ¶
make_f_elem(eps: Array) -> Array
Compute the forces within the elements as :math:\mathbf{f}_{elem} = \mathcal{K}_{cs} \epsilon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eps
|
Array
|
Element strain vectors, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Element forces, |
Source code in src/flapjax/structure/beam.py
1730 1731 1732 1733 1734 1735 1736 | |
make_f_int ¶
make_f_int(p_d: Array, eps: Array) -> Array
Assemble global internal force vector as a function of the element relative configuration vectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p_d
|
Array
|
P(d) operator, |
required |
eps
|
Array
|
Element strain vectors, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Internal forces, |
Source code in src/flapjax/structure/beam.py
1738 1739 1740 1741 1742 1743 1744 1745 1746 | |
make_f_dead_ext
staticmethod
¶
make_f_dead_ext(f_ext: Array, rmat: Array) -> Array
Compute the global external dead force vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_ext
|
Array
|
External forces array of dead forces in global reference, |
required |
rmat
|
Array
|
Deformation rotation matrices, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
External forces, |
Source code in src/flapjax/structure/beam.py
1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 | |
add_thrust_force ¶
add_thrust_force(
force: Array, thrust: dict[str, Array]
) -> Array
Add thrust acting at nodes onto full system forcing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force
|
Array
|
Input forcing, |
required |
thrust
|
dict[str, Array]
|
Input thrust at the current step, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Updated forcing, |
Source code in src/flapjax/structure/beam.py
1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 | |
make_eps ¶
make_eps(d: Array) -> Array
Compute the element strain vectors as a function of the element relative configuration vectors. Formulation from Geometrically exact beam finite element formulated on the special Euclidean group SE(3), by Sonneville et al., 2013, Eq 64.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Element relative configuration, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Element strain vectors, |
Source code in src/flapjax/structure/beam.py
1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 | |
make_p_d ¶
make_p_d(d: Array) -> Array
Compute the P(d) operator as a function of the element relative configuration vectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Relative configuration vectors, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
P(d) operator, |
Source code in src/flapjax/structure/beam.py
1912 1913 1914 1915 1916 1917 1918 | |
make_d ¶
make_d(hg: Array) -> Array
Compute the element relative configuration vectors from the nodal homogeneous transformation matrices
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Nodal homogeneous transformation matrices, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Element relative configuration vectors, |
Source code in src/flapjax/structure/beam.py
1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 | |
make_hg_dot
staticmethod
¶
make_hg_dot(hg: Array, v: Array) -> Array
Obtain the time derivative of the nodal coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Node coordinates, |
required |
v
|
Array
|
Node local velocities, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Coordinate time derivative, |
Source code in src/flapjax/structure/beam.py
1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 | |
resolve_forces ¶
resolve_forces(
hg: Array,
dynamic: Literal[True],
f_ext_follower: Array | None,
f_ext_dead: Array | None,
f_ext_aero: Array | None,
thrust: dict[str, Array],
v: Array,
v_dot: Array,
approx_gradients: bool = False,
) -> tuple[
Array,
Array,
Array | None,
Array | None,
Array | None,
Array,
Array,
Array,
Array,
]
resolve_forces(
hg: Array,
dynamic: Literal[False],
f_ext_follower: Array | None,
f_ext_dead: Array | None,
f_ext_aero: Array | None,
thrust: dict[str, Array],
v: None,
v_dot: None,
approx_gradients: bool = False,
) -> tuple[
Array,
Array,
Array | None,
Array | None,
Array | None,
Array,
None,
None,
Array,
]
resolve_forces(
hg: Array,
dynamic: bool,
f_ext_follower: Array | None,
f_ext_dead: Array | None,
f_ext_aero: Array | None,
thrust: dict[str, Array],
v: Array | None,
v_dot: Array | None,
approx_gradients: bool = False,
) -> tuple[
Array,
Array,
Array | None,
Array | None,
Array | None,
Array,
Array | None,
Array | None,
Array,
]
Obtain all components of the force from a final solution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Nodal homogeneous transformation matrices, |
required |
dynamic
|
bool
|
Whether to compute dynamic forces. |
required |
f_ext_follower
|
Array | None
|
External follower forces in local reference, |
required |
f_ext_dead
|
Array | None
|
External dead forces in global reference, |
required |
f_ext_aero
|
Array | None
|
External aero forces in global reference, |
required |
thrust
|
dict[str, Array]
|
Thrust forces at current step, {keys, |
required |
v
|
Array | None
|
Nodal velocities in global frame, |
required |
v_dot
|
Array | None
|
Nodal accelerations in global frame, |
required |
approx_gradients
|
bool
|
Whether to stop computing gradients of the inertial and gyroscopic forces with respect to the node coordinates, as these are small but nonzero values in practice. |
False
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, Array | None, Array | None, Array | None, Array, Array | None, Array | None, Array]
|
Configuration vectors, strain vectors, Dead external forces, aero external forces, gravitational forces, internal forces, gyroscopic forces, inertial forces and residual forces. |
Source code in src/flapjax/structure/beam.py
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 2058 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 | |
make_f_res ¶
make_f_res(
solve_dofs: Array | None,
p_d: Array,
eps: Array,
hg: Array,
f_ext_follower_n: Array | None,
f_ext_dead_n: Array | None,
thrust_n: dict[str, Array],
dynamic: Literal[True],
m_t: Array,
c_l: Array,
c_l_lumped: Array | None,
v: Array,
v_dot: Array,
i_ts: int = 0,
k_t_assembled: Array | None = None,
) -> tuple[Array, Array]
make_f_res(
solve_dofs: Array | None,
p_d: Array,
eps: Array,
hg: Array,
f_ext_follower_n: Array | None,
f_ext_dead_n: Array | None,
thrust_n: dict[str, Array],
dynamic: Literal[False],
m_t: Array | None,
c_l: None,
c_l_lumped: None,
v: None,
v_dot: None,
i_ts: int = 0,
k_t_assembled: Array | None = None,
) -> tuple[Array, Array]
make_f_res(
solve_dofs: Array | None,
p_d: Array,
eps: Array,
hg: Array,
f_ext_follower_n: Array | None,
f_ext_dead_n: Array | None,
thrust_n: dict[str, Array],
dynamic: bool,
m_t,
c_l,
c_l_lumped,
v,
v_dot,
i_ts: int = 0,
k_t_assembled: Array | None = None,
) -> tuple[Array, Array]
Compute the residual force vector for a given configuration and external forces, used in the nonlinear solve. This is the force imbalance that the nonlinear solver will seek to drive to zero. Additionally, returns an "absolute sum" of all forces, used for relative convergence checks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
solve_dofs
|
Array | None
|
Optional array of degrees of freedom to solve for |
required |
p_d
|
Array
|
P(d) operator, |
required |
eps
|
Array
|
Element strain vectors, |
required |
hg
|
Array
|
Nodal homogeneous transformation matrices, |
required |
f_ext_follower_n
|
Array | None
|
Nodal follower forces, |
required |
f_ext_dead_n
|
Array | None
|
Nodal dead forces, |
required |
thrust_n
|
dict[str, Array]
|
Thrust magnitude, |
required |
dynamic
|
bool
|
Flag for whether to compute dynamic entries. |
required |
m_t
|
Disassembled system mass matrix, |
required | |
c_l
|
Dissembled system gyroscopic matrix, |
required | |
c_l_lumped
|
Lumped gyroscopic matrix, |
required | |
v
|
Nodal velocities, |
required | |
v_dot
|
Nodal accelerations, |
required | |
i_ts
|
int
|
Time-step index (0 for static solves). |
0
|
k_t_assembled
|
Array | None
|
Assembled global tangent stiffness matrix |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Residual force vector, |
Source code in src/flapjax/structure/beam.py
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 2299 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 | |
update_hg
staticmethod
¶
update_hg(hg: Array, phi: Array) -> Array
Update the nodal homogeneous transformation matrices with the configuration increments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
Existing nodal homogeneous transformation matrices, |
required |
phi
|
Array
|
Perturbation to the configuration vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Updated nodal homogeneous transformation matrices, |
Source code in src/flapjax/structure/beam.py
2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 | |
static_solve ¶
static_solve(
prescribed_dofs: Sequence[int] | Array | slice | int,
f_ext_follower: Array | None = None,
f_ext_dead: Array | None = None,
f_ext_aero: Array | None = None,
load_steps: int = 1,
*,
print_header: bool = True,
postprocess_constraints: bool = True,
) -> StructureCase
Perform static solve of the structure under external loads.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_ext_follower
|
Array | None
|
External forces array of follower forces |
None
|
f_ext_dead
|
Array | None
|
External forces array of dead loads |
None
|
f_ext_aero
|
Array | None
|
External forces array of aerodynamic loads |
None
|
prescribed_dofs
|
Sequence[int] | Array | slice | int
|
Index of degrees of freedom which are prescribed (not solved for). |
required |
load_steps
|
int
|
Number of load steps to apply the external loads over. |
1
|
print_header
|
bool
|
If False, suppress the "Static Solve" table header and trailing line. |
True
|
postprocess_constraints
|
bool
|
If True, apply constraint postprocessing to the final solution. |
True
|
Returns:
| Type | Description |
|---|---|
StructureCase
|
StructureCase object containing results of the static analysis. |
Source code in src/flapjax/structure/beam.py
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 | |
base_dynamic_solve ¶
base_dynamic_solve(
struct_case: StructureCase,
struct_convergence_status: ConvergenceStatus,
t: Array,
solve_dofs: tuple[int, ...],
load_steps: int,
f_ext_dead: Array | None,
f_ext_follower: Array | None,
thrust_t: dict[str, Array],
aero_obj: None,
aero_case: None,
fsi_convergence_status: None,
cs_ang_t: None,
cs_vel_t: None,
) -> StructureCase
base_dynamic_solve(
struct_case: StructureCase,
struct_convergence_status: ConvergenceStatus,
t: Array,
solve_dofs: tuple[int, ...],
load_steps: int,
f_ext_dead: Array | None,
f_ext_follower: Array | None,
thrust_t: dict[str, Array],
aero_obj: DynamicAeroSolver,
aero_case: AeroCase,
fsi_convergence_status: ConvergenceStatus,
cs_ang_t: dict[str, Array],
cs_vel_t: dict[str, Array],
) -> AeroelasticCase
base_dynamic_solve(
struct_case: StructureCase,
struct_convergence_status: ConvergenceStatus,
t: Array,
solve_dofs: tuple[int, ...],
load_steps: int,
f_ext_dead: Array | None,
f_ext_follower: Array | None,
thrust_t: dict[str, Array],
aero_obj: DynamicAeroSolver | None,
aero_case: AeroCase | None,
fsi_convergence_status: ConvergenceStatus | None,
cs_ang_t: dict[str, Array] | None,
cs_vel_t: dict[str, Array] | None,
) -> StructureCase | AeroelasticCase
Generic dynamic solver. Both the structural dynamic solve, and aeroelastic dynamic solve, are formed as wrappers of this
Source code in src/flapjax/structure/beam.py
2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 | |
dynamic_solve ¶
dynamic_solve(
init_state: StructureCase | None,
n_tstep: int,
dt: Array | float,
prescribed_dofs: Sequence[int]
| Array
| slice
| int
| None = None,
f_ext_follower: Array | None = None,
f_ext_dead: Array | None = None,
f_ext_aero: Array | None = None,
thrust_t: dict[str, Array] | None = None,
load_steps: int = 1,
) -> StructureCase
Perform dynamic solve of the structure under external loads
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_state
|
StructureCase | None
|
Initial state of the structure, either static or a dynamic snapshot. If None, the reference configuration is used with zero velocities. |
required |
prescribed_dofs
|
Sequence[int] | Array | slice | int | None
|
Degrees of freedom which are prescribed (not solved for). If None, inherit from the initial state. |
None
|
n_tstep
|
int
|
Number of time steps to simulate. |
required |
dt
|
Array | float
|
Time step length. |
required |
f_ext_follower
|
Array | None
|
Following external forces array, |
None
|
f_ext_dead
|
Array | None
|
Dead external forces array, |
None
|
f_ext_aero
|
Array | None
|
Aerodynamic external forces array, |
None
|
thrust_t
|
dict[str, Array] | None
|
Thrust time history, |
None
|
load_steps
|
int
|
Number of load steps to apply the external loads over. |
1
|
Returns:
| Type | Description |
|---|---|
StructureCase
|
Structure dataclass containing results of the dynamic analysis. |
Source code in src/flapjax/structure/beam.py
3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 | |
linear ¶
linear_beam ¶
LinearBeam ¶
LinearBeam(
beam: BaseBeamStructure,
reference: StructureCase,
n_modes: int | None,
dt: float | Array,
modal_inputs: bool = False,
modal_outputs: bool = False,
int_order: Literal[3, 4, 5] = BASE_LOBATTO_ORDER,
prescribed_dofs: Sequence[int]
| Array
| slice
| int
| None = None,
)
Bases: LinearModel[StructureCase, StructureInputUnflattened, StructureStateUnflattened, StructureOutputUnflattened, StructureLinearResult]
Class to represent a linearised beam system about a reference state.
Source code in src/flapjax/structure/linear/linear_beam.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 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 | |
nodal_to_modal ¶
nodal_to_modal(q_nodal: Array) -> Array
Convert a nodal property to a modal property.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q_nodal
|
Array
|
Nodal property, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Modal property, |
Source code in src/flapjax/structure/linear/linear_beam.py
105 106 107 108 109 110 111 112 | |
modal_to_nodal ¶
modal_to_nodal(q_modal: Array) -> Array
Convert a modal property to a nodal property.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q_modal
|
Array
|
Mode property, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Nodal property, |
Source code in src/flapjax/structure/linear/linear_beam.py
114 115 116 117 118 119 120 121 | |
linearise_continuous ¶
linearise_continuous() -> LinearSystem
Form a system of linear equations about a reference state. The system is of the form:
:math:\dot{\mathbf{x}} = \mathbf{A~x + B~u}, \mathbf{y} = \mathbf{C~x + D~u}.
The state, input and output layouts each depend on their respective modal_* flag:
- States: nodal-free-dof :math:
[q, \dot q]of length2 * n_free_dofwhenn_modes is None, or modal :math:[q_m, \dot q_m]of length2 * n_modeswhenmodal_states. Modal mass and stiffness are the projected :math:\Phi M \Phi^T/ :math:\Phi K \Phi^TwithPhi = mode_shapesof shape[n_modes, n_free_dof](rows are mode shapes). - Inputs: a single global-frame external force
f_ext. Non-modal inputs are per-node[n_nodes, 6]. Modal inputs are direct modal forces of lengthn_modes, requiring the user to have already applied the modal projection. - Outputs: :math:
[q, \dot q]in either nodal-free-dof or modal form to matchmodal_outputs.
Returns:
| Type | Description |
|---|---|
LinearSystem
|
Linearised continuous-time system. |
Source code in src/flapjax/structure/linear/linear_beam.py
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 | |
run ¶
run(
u: StructureInputUnflattened,
x0: StructureStateUnflattened | None = None,
) -> StructureLinearResult
Run the linear system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
StructureInputUnflattened
|
Total input over time (reference + pertubation). |
required |
x0
|
StructureStateUnflattened | None
|
Initial state perturbations, defaults to zero state. |
None
|
Returns:
| Type | Description |
|---|---|
StructureLinearResult
|
Linear system results. |
Source code in src/flapjax/structure/linear/linear_beam.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 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 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 | |
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 | |
time_integration ¶
TimeIntegrator ¶
TimeIntegrator(spectral_radius: float, dt: Array)
Container for time integration parameters.
Source code in src/flapjax/structure/time_integration.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
compute_a_n ¶
compute_a_n(
v_dot_nm1: Array, v_dot_n: Array, a_nm1: Array
) -> Array
Calculate the pseudo-acceleration at the next time step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v_dot_nm1
|
Array
|
Previous acceleration, |
required |
v_dot_n
|
Array
|
Next acceleration, |
required |
a_nm1
|
Array
|
Previous pseudo-acceleration, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
pseudo-acceleration at next time step, |
Source code in src/flapjax/structure/time_integration.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
predict_q ¶
predict_q(
q_nm1: StructureMinimalStates,
) -> tuple[Array, StructureMinimalStates]
Predict the current state based upon the previous state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q_nm1
|
StructureMinimalStates
|
State at timestep n |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, StructureMinimalStates]
|
Predicted state at timestep n+1 |
Source code in src/flapjax/structure/time_integration.py
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 | |
compute_phi_from_phi_alpha ¶
compute_phi_from_phi_alpha(phi_alpha: Array) -> Array
Obtain the full timestep increment from the alpha increment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
phi_alpha
|
Array
|
Increment from timestep n-1 to alpha, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Increment for timestep n, |
Source code in src/flapjax/structure/time_integration.py
157 158 159 160 161 162 163 | |
compute_v_from_v_alpha ¶
compute_v_from_v_alpha(
v_alpha: Array, v_nm1: Array
) -> Array
Obtain the full timestep velocity from the alpha increment and the previous velocity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v_alpha
|
Array
|
Velocity at alpha step, |
required |
v_nm1
|
Array
|
Velocity at timestep n-1, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Velocity at timestep n, |
Source code in src/flapjax/structure/time_integration.py
165 166 167 168 169 170 171 172 173 | |
utils ¶
get_solve_dofs ¶
get_solve_dofs(
n_dof: int, prescribed_dofs: tuple[int, ...]
) -> tuple[int, ...]
Obtain the index of degrees of freedom to solve for, given the index of prescribed degrees of freedom.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_dof
|
int
|
Total number of degrees of freedom |
required |
prescribed_dofs
|
tuple[int, ...]
|
Index of prescribed degrees of freedom |
required |
Returns:
| Type | Description |
|---|---|
tuple[int, ...]
|
Index of degrees of freedom to solve for |
Source code in src/flapjax/structure/utils.py
250 251 252 253 254 255 256 257 | |
transform_nodal_vect ¶
transform_nodal_vect(vect: Array, rmat: Array) -> Array
Rotate a nodal vector quantity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vect
|
Array
|
Nodal vectors, |
required |
rmat
|
Array
|
Rotation matrix, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Rotated vectors, |
Source code in src/flapjax/structure/utils.py
271 272 273 274 275 276 277 278 279 280 281 282 | |
apply_frame_transform ¶
apply_frame_transform(
obj, rmat: Array, extra_fields: tuple[str, ...] = ()
) -> None
Rotate all force / velocity fields of a structure state object in place.
Source code in src/flapjax/structure/utils.py
293 294 295 296 297 298 299 300 301 | |