@rulecad/fea 0.2.14 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/README.md +56 -22
- package/fea.d.mts +50 -4
- package/fea.mjs +955 -202
- package/frame.d.mts +51 -7
- package/frame.mjs +1693 -353
- package/layout.mjs +667 -167
- package/package.json +9 -11
- package/threads.mjs +114 -45
package/frame.d.mts
CHANGED
|
@@ -18,7 +18,9 @@ export function elementMatrices(section: FrameSection, material: FrameMaterial,
|
|
|
18
18
|
/**
|
|
19
19
|
* A frame, read, checked and factorised once, ready for its solves. What is wrong with the model is said here, by
|
|
20
20
|
* name, before any solve: each refusal is an Error with a `code` ("fea.frame." then node, length, section, material,
|
|
21
|
-
* axes, join, support, load, mass, input, unheld or mechanism; buckling adds compression, and sizing fit).
|
|
21
|
+
* axes, join, support, load, mass, input, unheld or mechanism; buckling adds compression, and sizing fit). A key the
|
|
22
|
+
* model, an element, a load, these options or a solve's options do not have is refused as input, with the nearest
|
|
23
|
+
* key it has: `load` for `loads` would otherwise leave the frame unloaded, and read as perfectly stiff.
|
|
22
24
|
* @param {FrameModel} model
|
|
23
25
|
* @param {{ shear?: boolean }} [o] shear: false ignores the sections' shear areas (Euler-Bernoulli beams)
|
|
24
26
|
* @returns {{
|
|
@@ -102,19 +104,28 @@ export function subdivide(model: FrameModel, pieces?: number): FrameModel;
|
|
|
102
104
|
* the limits are met, then each down as far as the limits allow), which is near the lightest but not proven so. Each
|
|
103
105
|
* group's result names the limit that set it: the one its next lighter choice would break, with the other groups as
|
|
104
106
|
* chosen. The geometry stays as drawn: only sections, materials and rolls change, and members outside every group
|
|
105
|
-
* keep theirs
|
|
106
|
-
*
|
|
107
|
+
* keep theirs; with ends, each design's element end springs are its own too (a join's spring follows the size of the
|
|
108
|
+
* beams it joins). Refused by name: unknown options (and unknown keys in a choice, a load case or a limit; a choice
|
|
109
|
+
* may also carry profile and title, which sizing does not read), a member in no element
|
|
110
|
+
* or in two groups, a choice with no section, a limit that is not above 0, sizing by cost where a choice has none,
|
|
111
|
+
* and, under a stress limit, a choice a group may take with no strength (its material's, or the member's where it
|
|
112
|
+
* has none: fea.frame.material) or no section modulus (cy and cz, or Wy and Wz: fea.frame.section). A member outside
|
|
113
|
+
* every group with either missing is not refused but cannot be held to the stress limit: it is named in `unchecked`.
|
|
107
114
|
* @param {FrameModel | FrameModel[]} model the frame; or a list, the first the frame and the rest the same frame
|
|
108
115
|
* joined other ways (its joins rigid), whose stress is checked too, as a join's moment grows as it stiffens
|
|
109
116
|
* @param {{ groups: Record<string, (string | number)[]>, choices: SizingChoice[], only?: Record<string, string[]>,
|
|
110
117
|
* fits?: (design: Record<string, string>) => { where: string, why: string }[],
|
|
118
|
+
* ends?: (design: Record<string, string>) => Record<string, { a?: EndJoin, b?: EndJoin }>,
|
|
111
119
|
* limits: SizingLimits, cases?: { label?: string, loads?: FrameLoad[], masses?: Record<string, number>, inertia?: Record<string, number>, gravity?: Vec3, limits?: string[] }[],
|
|
112
120
|
* by?: 'mass' | 'cost', pieces?: number, search?: 'every' | 'steps', every?: number }} o
|
|
113
121
|
* groups: members by group name, each an element's id or the member its pieces came from (`of`); only: the
|
|
114
122
|
* choices a group may take, by name (all of them if left out); fits: whether a design's choices go together, given
|
|
115
123
|
* each group's choice by name: what does not (a join between two groups that one's choice cannot make with the
|
|
116
124
|
* other's), each { where, why }, none where it fits; a design that does not fit is never solved, and a group
|
|
117
|
-
* whose next lighter choice does not fit says so as the limit that set it (limit 'fit');
|
|
125
|
+
* whose next lighter choice does not fit says so as the limit that set it (limit 'fit'); ends: each design's own
|
|
126
|
+
* end springs, given each group's choice by name: the ends that change with the design, by element id, each end
|
|
127
|
+
* given in place of the frame's own and the rest kept; asked once a design, for the frame alone (the others,
|
|
128
|
+
* joined other ways, keep theirs); cases: load cases (the
|
|
118
129
|
* model's own if left out), loads and masses as statics takes them, inertia: masses whose weight is already in
|
|
119
130
|
* loads, which ring in the modes only, gravity: the case's own (a side push alone: [0, 0, 0]), and limits: the
|
|
120
131
|
* limits it is held to, by name (every limit where left out; a deflection limit's own cases narrow it further);
|
|
@@ -122,11 +133,15 @@ export function subdivide(model: FrameModel, pieces?: number): FrameModel;
|
|
|
122
133
|
* @returns {{ ok: boolean, by: 'mass' | 'cost', search: 'every' | 'steps', tried: number, total: number,
|
|
123
134
|
* groups: { name: string, members: (string | number)[], choice: string, length: number, mass: number, cost: number | null,
|
|
124
135
|
* lighter: string | null, governs: (SizingCheck & { lighter: string, broken: number }) | { limit: 'fit', where: string, why: string, lighter: string, broken: null } | null, margin: number | null }[],
|
|
125
|
-
* checks: SizingCheck[],
|
|
136
|
+
* checks: SizingCheck[], unchecked: { member: string, why: 'no strength' | 'no section modulus' | 'no strength and no section modulus' }[],
|
|
137
|
+
* worst: SizingCheck | null, model: FrameModel }}
|
|
126
138
|
* ok: the limits are met (else the design that came nearest, and its checks say by how much); total: kg (or cost) of
|
|
127
139
|
* the grouped members; tried: designs solved; each group's length (mm), mass (kg) and cost; lighter: the next choice
|
|
128
140
|
* that weighs (or costs) less; governs: the limit that lighter choice breaks, its ratio there as `broken`; margin: how many times inside
|
|
129
|
-
* that limit the design is, as chosen;
|
|
141
|
+
* that limit the design is, as chosen; unchecked: under a stress limit, the members outside every group whose stress
|
|
142
|
+
* it could not check, each once (by the member its pieces came from) with why: its material has no strength, or its
|
|
143
|
+
* section no section modulus, so no stress is read in it (a join's rigid link, a panel); empty with no stress limit;
|
|
144
|
+
* model: the frame with the chosen sections
|
|
130
145
|
*/
|
|
131
146
|
export function sizing(model: FrameModel | FrameModel[], o?: {
|
|
132
147
|
groups: Record<string, (string | number)[]>;
|
|
@@ -136,6 +151,10 @@ export function sizing(model: FrameModel | FrameModel[], o?: {
|
|
|
136
151
|
where: string;
|
|
137
152
|
why: string;
|
|
138
153
|
}[];
|
|
154
|
+
ends?: (design: Record<string, string>) => Record<string, {
|
|
155
|
+
a?: EndJoin;
|
|
156
|
+
b?: EndJoin;
|
|
157
|
+
}>;
|
|
139
158
|
limits: SizingLimits;
|
|
140
159
|
cases?: {
|
|
141
160
|
label?: string;
|
|
@@ -176,16 +195,26 @@ export function sizing(model: FrameModel | FrameModel[], o?: {
|
|
|
176
195
|
margin: number | null;
|
|
177
196
|
}[];
|
|
178
197
|
checks: SizingCheck[];
|
|
198
|
+
unchecked: {
|
|
199
|
+
member: string;
|
|
200
|
+
why: "no strength" | "no section modulus" | "no strength and no section modulus";
|
|
201
|
+
}[];
|
|
179
202
|
worst: SizingCheck | null;
|
|
180
203
|
model: FrameModel;
|
|
181
204
|
};
|
|
182
205
|
export function statics(model: FrameModel, o?: {
|
|
183
206
|
shear?: boolean;
|
|
207
|
+
loads?: FrameLoad[];
|
|
208
|
+
gravity?: Vec3;
|
|
209
|
+
masses?: Record<string, number>;
|
|
184
210
|
samples?: number;
|
|
185
211
|
}): StaticResult;
|
|
186
212
|
export function buckling(model: FrameModel, o?: {
|
|
187
213
|
shear?: boolean;
|
|
188
214
|
count?: number;
|
|
215
|
+
loads?: FrameLoad[];
|
|
216
|
+
gravity?: Vec3;
|
|
217
|
+
masses?: Record<string, number>;
|
|
189
218
|
}): {
|
|
190
219
|
factors: number[];
|
|
191
220
|
modes: BucklingMode[];
|
|
@@ -202,6 +231,7 @@ export function buckling(model: FrameModel, o?: {
|
|
|
202
231
|
export function modes(model: FrameModel, o?: {
|
|
203
232
|
shear?: boolean;
|
|
204
233
|
count?: number;
|
|
234
|
+
masses?: Record<string, number>;
|
|
205
235
|
}): {
|
|
206
236
|
frequencies: number[];
|
|
207
237
|
modes: VibrationMode[];
|
|
@@ -269,6 +299,11 @@ export type FrameMaterial = {
|
|
|
269
299
|
* g/cm³ (for gravity and modes; left out: weightless)
|
|
270
300
|
*/
|
|
271
301
|
density?: number;
|
|
302
|
+
/**
|
|
303
|
+
* MPa, what sizing's stress limit holds each member's peak stress to (a member whose
|
|
304
|
+
* material has none is not held to it; a choice a group may take needs one, its own or the member's)
|
|
305
|
+
*/
|
|
306
|
+
strength?: number;
|
|
272
307
|
};
|
|
273
308
|
/**
|
|
274
309
|
* how one rotation at an element's end is joined to its node: rigidly, not at all (a hinge), or through a spring of that many N·mm/rad
|
|
@@ -524,6 +559,14 @@ export type SizingChoice = {
|
|
|
524
559
|
* standing on edge in place of lying flat)
|
|
525
560
|
*/
|
|
526
561
|
roll?: number;
|
|
562
|
+
/**
|
|
563
|
+
* carried along for the caller, not read (profileChoices gives the profile's name)
|
|
564
|
+
*/
|
|
565
|
+
profile?: string;
|
|
566
|
+
/**
|
|
567
|
+
* carried along for the caller, not read; any key not listed here is refused by name
|
|
568
|
+
*/
|
|
569
|
+
title?: string;
|
|
527
570
|
};
|
|
528
571
|
/**
|
|
529
572
|
* What every design must meet; leave one out and it sets nothing
|
|
@@ -545,7 +588,8 @@ export type SizingLimits = {
|
|
|
545
588
|
along?: Vec3;
|
|
546
589
|
})[];
|
|
547
590
|
/**
|
|
548
|
-
* each member's peak stress times margin stays under its material's strength
|
|
591
|
+
* each member's peak stress times margin stays under its material's strength:
|
|
592
|
+
* every choice a group may take needs a strength and a section modulus, or sizing is refused
|
|
549
593
|
*/
|
|
550
594
|
stress?: {
|
|
551
595
|
margin: number;
|