pv-calc 0.1.0__tar.gz
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.
- pv_calc-0.1.0/CHANGELOG.md +113 -0
- pv_calc-0.1.0/CITATION.cff +19 -0
- pv_calc-0.1.0/LICENSE +21 -0
- pv_calc-0.1.0/MANIFEST.in +6 -0
- pv_calc-0.1.0/PKG-INFO +175 -0
- pv_calc-0.1.0/README.md +142 -0
- pv_calc-0.1.0/pv_calc/__init__.py +3 -0
- pv_calc-0.1.0/pv_calc/cli.py +1689 -0
- pv_calc-0.1.0/pv_calc/contracts.py +844 -0
- pv_calc-0.1.0/pv_calc/describe.py +1206 -0
- pv_calc-0.1.0/pv_calc/errors.py +13 -0
- pv_calc-0.1.0/pv_calc/evaluate.py +835 -0
- pv_calc-0.1.0/pv_calc/hydrostatics.py +246 -0
- pv_calc-0.1.0/pv_calc/materials.py +131 -0
- pv_calc-0.1.0/pv_calc/pressure_vessel.py +2810 -0
- pv_calc-0.1.0/pv_calc/py.typed +0 -0
- pv_calc-0.1.0/pv_calc/resolve.py +237 -0
- pv_calc-0.1.0/pv_calc/ring_section.py +78 -0
- pv_calc-0.1.0/pv_calc/schemas.py +33 -0
- pv_calc-0.1.0/pv_calc/serialize.py +366 -0
- pv_calc-0.1.0/pv_calc/sizing.py +1405 -0
- pv_calc-0.1.0/pv_calc/units.py +121 -0
- pv_calc-0.1.0/pv_calc.egg-info/PKG-INFO +175 -0
- pv_calc-0.1.0/pv_calc.egg-info/SOURCES.txt +28 -0
- pv_calc-0.1.0/pv_calc.egg-info/dependency_links.txt +1 -0
- pv_calc-0.1.0/pv_calc.egg-info/entry_points.txt +2 -0
- pv_calc-0.1.0/pv_calc.egg-info/requires.txt +7 -0
- pv_calc-0.1.0/pv_calc.egg-info/top_level.txt +1 -0
- pv_calc-0.1.0/pyproject.toml +91 -0
- pv_calc-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Notable changes to pv-calc are recorded here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the package
|
|
5
|
+
follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The
|
|
6
|
+
JSON request/response contract carries its own version
|
|
7
|
+
(`CALC_SCHEMA_VERSION`), independent of the package version, as does each
|
|
8
|
+
model; both predate this changelog.
|
|
9
|
+
|
|
10
|
+
## [Unreleased]
|
|
11
|
+
|
|
12
|
+
## [0.1.0] - 2026-08-28
|
|
13
|
+
|
|
14
|
+
Initial release.
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- Five source-cited external-pressure models: closed-end tube stress with
|
|
19
|
+
elastic displacement, flat circular plate bending and deflection,
|
|
20
|
+
hemispherical head stress and NASA SP-8032 buckling, NASA SP-8007
|
|
21
|
+
smooth-cylinder buckling, and NASA SP-8007 ring-stiffened shell general
|
|
22
|
+
instability (advisory). Plate and hemisphere also report seat bearing
|
|
23
|
+
stress; smooth buckling also reports the Roark Table 35 case 20 probable
|
|
24
|
+
minimum as a comparator. The plate result's `envelope_source_reference`
|
|
25
|
+
names the committed sweep summary by its content,
|
|
26
|
+
`validation/fea/results/plate_sweep_fea_summary.json`.
|
|
27
|
+
- `elastic_applicability` on smooth-cylinder buckling (model 3.0.0), with
|
|
28
|
+
`working_circumferential_membrane_stress_mpa`,
|
|
29
|
+
`elastic_applicability_limit_mpa`, and `elastic_applicability_limit_basis`:
|
|
30
|
+
whether a capacity is released only as an elastic upper bound, at every
|
|
31
|
+
unsupported length. The regime boundary is
|
|
32
|
+
`short_regime_gamma_z_boundary`, not `short_theoretical_gamma_z_boundary`:
|
|
33
|
+
that branch carries correlation factor 0.5625 and releases a correlated
|
|
34
|
+
capacity, so nothing about it is theoretical. Semantics in
|
|
35
|
+
[docs/engineering.md](https://github.com/ccluett/pv-calc/blob/main/docs/engineering.md).
|
|
36
|
+
- `advisory_candidate_modes`, `advisory_governing_status`,
|
|
37
|
+
`global_elastic_applicability`, and a global plasticity screen on the
|
|
38
|
+
ring-stiffened shell result (model 2.0.0). NASA states plasticity factors
|
|
39
|
+
for unstiffened cylinders only, so an over-limit global pressure is
|
|
40
|
+
labelled, never corrected or withheld. A mode-search iteration reports
|
|
41
|
+
`governing_mode_below_frontier`, not `comfortably_interior`; the name now
|
|
42
|
+
states the condition, matching its `frontier_above_governing` sibling.
|
|
43
|
+
Semantics in
|
|
44
|
+
[docs/engineering.md](https://github.com/ccluett/pv-calc/blob/main/docs/engineering.md).
|
|
45
|
+
- Three failure categories — `ductile_metal`, `plastic`, and `brittle` —
|
|
46
|
+
each read against its own strength; every stress result names its
|
|
47
|
+
`failure_criterion`.
|
|
48
|
+
- Three bounded thickness sizing operations: `tube size`,
|
|
49
|
+
`smooth-buckling size` (shell stress and buckling together), and
|
|
50
|
+
`plate size` (bending margin and optional deflection limit), each reporting
|
|
51
|
+
branch and governing-check changes and verifying its bracket when one
|
|
52
|
+
exists. A capacity that steps upward at a regime boundary can open a branch
|
|
53
|
+
already meeting the target; the opening thickness is then selected as
|
|
54
|
+
`branch_start`, with no bracket to verify.
|
|
55
|
+
- `mass-properties`, and an optional `inputs.submergence` block on the four
|
|
56
|
+
closed-body forward models for weight in air and in fluid plus failure
|
|
57
|
+
depths. The `failure_depths` basis states only the direction of the
|
|
58
|
+
constant-density approximation; the percentages it used to quote were
|
|
59
|
+
measured against a citation since removed.
|
|
60
|
+
- `sweep` over a pressure or depth axis and `compare-materials` over an
|
|
61
|
+
ordered list of named materials, each capped at 1,000 points.
|
|
62
|
+
- `pv-calc` CLI with unit-carrying options, JSON requests via `--input`,
|
|
63
|
+
`--json` output, structured JSON errors with nonzero exit, and
|
|
64
|
+
`pv-calc describe MODEL --json` for each versioned contract
|
|
65
|
+
(`CALC_SCHEMA_VERSION` 5.0.0). An option's quantity is one ASCII number
|
|
66
|
+
(underscore digit grouping included, `1_000 psi`) followed by one unit,
|
|
67
|
+
quoted or attached. A unit is unit names joined by `*`, `/`, `**`/`^`, and
|
|
68
|
+
parentheses; it may spell a number only in an unparenthesized exponent
|
|
69
|
+
(`m/s^2`), may not name a dimensionless factor (`pi`, `ppm`), and may not
|
|
70
|
+
contain any other character — a decimal comma, a quote, `#`, `%` — so a
|
|
71
|
+
second magnitude, a bare unit, or a typographic minus is rejected as
|
|
72
|
+
`invalid_quantity` rather than silently normalized. The JSON `--input`
|
|
73
|
+
path's unit strings pass the same screen, and a unit pint cannot evaluate
|
|
74
|
+
(`mm/0`, an unbalanced bracket) is a structured error on both paths, never
|
|
75
|
+
a traceback. The `hemisphere` and `tube` help names everything each
|
|
76
|
+
command calculates — stress, material failure, buckling, displacement —
|
|
77
|
+
rather than yielding alone, which no brittle material has, and
|
|
78
|
+
`--proportional-limit` is required for `released` capacity, the status the
|
|
79
|
+
contract documents.
|
|
80
|
+
- Named-material loading from an explicit `--materials-file`, or fully
|
|
81
|
+
explicit properties; `materials.yaml` is the project's database, ten
|
|
82
|
+
records over the three failure categories, every value cited to its own
|
|
83
|
+
source and stated as a screening value.
|
|
84
|
+
- Validation evidence under
|
|
85
|
+
[validation/](https://github.com/ccluett/pv-calc/tree/main/validation):
|
|
86
|
+
independent reference implementations, the DTMB report 1324 case 17
|
|
87
|
+
benchmark, and FEA comparisons, with a golden response-contract snapshot
|
|
88
|
+
test. The committed FEA summaries are named for their content:
|
|
89
|
+
`tube_plate_fea_summary.json`, `plate_sweep_fea_summary.json`, and
|
|
90
|
+
`ring_shell_eigenvalue_fea_summary.json`. Not shipped in the package.
|
|
91
|
+
|
|
92
|
+
### Changed
|
|
93
|
+
|
|
94
|
+
- The probable-minimum buckling comparator now names its source in the
|
|
95
|
+
response: `underpressure_probable_minimum_coefficient` and
|
|
96
|
+
`underpressure_probable_minimum_pressure_mpa` on `hemisphere`, and
|
|
97
|
+
`underpressure_probable_minimum_factor`,
|
|
98
|
+
`underpressure_probable_minimum_pressure_mpa`, and
|
|
99
|
+
`underpressure_probable_minimum_lobes_n` on `smooth-buckling`, are
|
|
100
|
+
`roark_probable_minimum_*`. The value is Roark's Table 35 case 22 (sphere)
|
|
101
|
+
and case 20 (cylinder) probable minimum.
|
|
102
|
+
- `CALC_SCHEMA_VERSION` 5.0.0 for that rename; hemisphere and smooth-cylinder
|
|
103
|
+
buckling models 3.0.0. Model source citations name the primary reference
|
|
104
|
+
rather than a third-party implementation of it; no formula, factor, or
|
|
105
|
+
applicability rule changed. The two result-field renames above fold into
|
|
106
|
+
the same 5.0.0 rather than bumping it again: nothing has been released.
|
|
107
|
+
- One material database, `materials.yaml` at the repository root, and it is
|
|
108
|
+
the project's own: ten records across `ductile_metal`, `plastic`, and
|
|
109
|
+
`brittle`, each property cited to an ASTM specification, MIL-HDBK-5J, ASME
|
|
110
|
+
PVHO-1, or a named manufacturer data sheet, and strengths are specification
|
|
111
|
+
minimums where a specification states one. These are screening values, not
|
|
112
|
+
design allowables; a null `proportional_limit_mpa` withholds elastic
|
|
113
|
+
buckling capacity rather than defaulting it.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: If you use this software, please cite it using this metadata.
|
|
3
|
+
title: pv-calc
|
|
4
|
+
type: software
|
|
5
|
+
authors:
|
|
6
|
+
- family-names: Cluett
|
|
7
|
+
given-names: Christopher S.
|
|
8
|
+
license: MIT
|
|
9
|
+
version: 0.1.0
|
|
10
|
+
date-released: 2026-08-28
|
|
11
|
+
repository-code: https://github.com/ccluett/pv-calc
|
|
12
|
+
url: https://github.com/ccluett/pv-calc
|
|
13
|
+
abstract: >-
|
|
14
|
+
Source-cited external-pressure vessel calculations: tube stress, flat
|
|
15
|
+
circular plate, hemispherical head, NASA smooth-cylinder buckling, and
|
|
16
|
+
NASA ring-stiffened shell general instability, as a Python library and
|
|
17
|
+
CLI with a versioned JSON contract. Results are screening values from
|
|
18
|
+
idealized formulas, with formula sources, assumptions, and validity
|
|
19
|
+
gates attached; none is a design approval.
|
pv_calc-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Christopher S. Cluett
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pv_calc-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pv-calc
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Source-cited external-pressure vessel calculations.
|
|
5
|
+
Author: Christopher S. Cluett
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/ccluett/pv-calc
|
|
8
|
+
Project-URL: Documentation, https://github.com/ccluett/pv-calc/blob/main/docs/engineering.md
|
|
9
|
+
Project-URL: Issues, https://github.com/ccluett/pv-calc/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/ccluett/pv-calc/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: pressure-vessel,external-pressure,buckling,subsea,structural-analysis
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Intended Audience :: Manufacturing
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: pydantic>=2.12
|
|
27
|
+
Requires-Dist: pint>=0.25
|
|
28
|
+
Requires-Dist: PyYAML>=6.0.1
|
|
29
|
+
Requires-Dist: typer>=0.16
|
|
30
|
+
Provides-Extra: test
|
|
31
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# pv-calc
|
|
35
|
+
|
|
36
|
+
Source-cited external-pressure vessel calculations, as a command-line tool and
|
|
37
|
+
a Python library. Five structural models — tube stress, flat circular plate,
|
|
38
|
+
hemispherical head, NASA smooth-cylinder buckling, and NASA ring-stiffened
|
|
39
|
+
shell general instability — three of them with a bounded thickness sizing
|
|
40
|
+
mode, plus submerged mass properties. Every result carries its formula
|
|
41
|
+
sources, assumptions, and validity gates.
|
|
42
|
+
|
|
43
|
+
Results are screening values from idealized formulas. None is a design
|
|
44
|
+
approval.
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install pv-calc
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Python 3.11 or later; depends on pydantic, pint, PyYAML, and typer. From a
|
|
53
|
+
checkout, `pip install .`.
|
|
54
|
+
|
|
55
|
+
## Quick start
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pv-calc tube \
|
|
59
|
+
--external-pressure "1000 psi" \
|
|
60
|
+
--internal-radius "3 in" \
|
|
61
|
+
--wall-thickness "0.470 in" \
|
|
62
|
+
--yield-strength "62 ksi" \
|
|
63
|
+
--failure-category ductile_metal \
|
|
64
|
+
--json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Every dimensioned input carries a unit, quoted (`"8 mm"`) or attached (`8mm`).
|
|
68
|
+
Results are JSON with `{"value", "unit"}` quantities, model and source
|
|
69
|
+
citations, and validity status.
|
|
70
|
+
|
|
71
|
+
A material is either explicit properties on the command line, as above, or a
|
|
72
|
+
named record: `--material NAME --materials-file FILE`. Its `failure_category`
|
|
73
|
+
(`ductile_metal`, `plastic`, or `brittle`) selects the strength it carries and
|
|
74
|
+
the criterion it is compared under, each the ordinary check for that behavior:
|
|
75
|
+
a ductile metal on von Mises distortion-energy stress against a yield
|
|
76
|
+
strength; a plastic on its largest stress against a working strength the
|
|
77
|
+
designer selects, which is the number carrying creep; and a brittle material,
|
|
78
|
+
which has no yield, against separate tensile and compressive ultimates. The
|
|
79
|
+
buckling models read elastic constants only.
|
|
80
|
+
[materials.yaml](https://github.com/ccluett/pv-calc/blob/main/materials.yaml)
|
|
81
|
+
is the project's own database: ten records over those three categories, every
|
|
82
|
+
property cited to its source, and screening values throughout rather than
|
|
83
|
+
design allowables.
|
|
84
|
+
|
|
85
|
+
The same kernels are plain Python functions in MPa and mm, returning frozen
|
|
86
|
+
dataclasses:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from pv_calc.pressure_vessel import closed_end_tube_stress
|
|
90
|
+
|
|
91
|
+
result = closed_end_tube_stress(
|
|
92
|
+
external_pressure_mpa=6.895,
|
|
93
|
+
internal_radius_mm=76.2,
|
|
94
|
+
wall_thickness_mm=11.94,
|
|
95
|
+
material_failure_category="ductile_metal",
|
|
96
|
+
strength_mpa=427.5,
|
|
97
|
+
)
|
|
98
|
+
print(result.branch, result.governing_stress_mpa, result.margin)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Commands
|
|
102
|
+
|
|
103
|
+
| Command | Calculates |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `tube` | Closed-end tube stress, failure pressure, margin, and elastic displacement |
|
|
106
|
+
| `tube size` | The wall thickness meeting a `cylindrical_shell_stress` margin, inside bounds |
|
|
107
|
+
| `plate` | Flat circular plate bending, shear, centre deflection, and seat bearing stress |
|
|
108
|
+
| `plate size` | The plate thickness meeting a bending margin and an optional deflection limit |
|
|
109
|
+
| `hemisphere` | Hemispherical head stress, NASA SP-8032 buckling, displacement, and seat stress |
|
|
110
|
+
| `smooth-buckling` | NASA SP-8007 smooth-cylinder external-pressure buckling |
|
|
111
|
+
| `smooth-buckling size` | The wall thickness meeting a margin across shell stress and buckling |
|
|
112
|
+
| `ring-shell` | NASA SP-8007 ring-stiffened shell general instability (advisory) |
|
|
113
|
+
| `mass-properties` | Submerged mass and buoyancy from resolved volumes, fluid density, and gravity |
|
|
114
|
+
| `sweep` | One forward request over a pressure or depth axis |
|
|
115
|
+
| `compare-materials` | One forward request against an ordered list of named materials |
|
|
116
|
+
| `describe MODEL` | The model's versioned input/output contract |
|
|
117
|
+
|
|
118
|
+
Output is always JSON, indented by default and compact on one line with
|
|
119
|
+
`--json`. Every calculation takes `--input FILE` (or `-` for stdin) for the
|
|
120
|
+
same request as JSON; `pv-calc describe MODEL --json` prints the contract that
|
|
121
|
+
request must satisfy, and `pv-calc COMMAND --help` lists the options. The
|
|
122
|
+
tube, plate, hemisphere, and smooth-buckling commands also take
|
|
123
|
+
`--fluid-density` and `--gravity` to report the body's weight in air and in
|
|
124
|
+
that fluid and each failure pressure as a depth.
|
|
125
|
+
|
|
126
|
+
## Errors
|
|
127
|
+
|
|
128
|
+
An evaluated negative margin, or a capacity the model withholds, is a normal
|
|
129
|
+
result and exits zero. A request that cannot be evaluated exits 2 with one
|
|
130
|
+
JSON object on stderr:
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{"schema_version": "5.0.0",
|
|
134
|
+
"error": {"code": "unknown_material", "message": "...", "details": [...]}}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
`details` is a list of objects whose shape depends on the code, and may be
|
|
138
|
+
empty; `message` always says what went wrong. The codes:
|
|
139
|
+
|
|
140
|
+
| Code | Cause |
|
|
141
|
+
|---|---|
|
|
142
|
+
| `input_read_error`, `invalid_json` | `--input` cannot be read, or is not JSON |
|
|
143
|
+
| `invalid_request` | the request does not satisfy the model's contract, including a missing option; `details` lists each pydantic error with its `location` |
|
|
144
|
+
| `invalid_quantity`, `invalid_number`, `incompatible_unit` | a quantity has no unit, an unknown unit, or no finite value; a plain number is not numeric or finite; a quantity's unit has the wrong dimension |
|
|
145
|
+
| `missing_input` | `sweep` or `compare-materials` was run without `--input` |
|
|
146
|
+
| `input_source_conflict`, `material_source_conflict`, `missing_material_source`, `axis_source_conflict` | `--input` beside option values; both or neither of `--material` and explicit properties; two sweep axes |
|
|
147
|
+
| `missing_materials_file`, `invalid_material_database`, `unknown_material`, `invalid_material` | a named material without `--materials-file`; an unreadable database; a name it lacks (`details` lists every name); a record missing a property the model reads |
|
|
148
|
+
| `unknown_model` | `describe` was given a name that is not a model or batch operation |
|
|
149
|
+
| `invalid_bounds`, `no_reliable_solution` | a sizing operation's bounds are malformed, or no thickness inside them meets the target; `details` names the bracket evaluated |
|
|
150
|
+
| `unevaluable_model` | the kernel rejected the resolved inputs, a sizing sample fell outside a model's validity, or the result is not finite |
|
|
151
|
+
|
|
152
|
+
## Documentation
|
|
153
|
+
|
|
154
|
+
- [docs/engineering.md](https://github.com/ccluett/pv-calc/blob/main/docs/engineering.md):
|
|
155
|
+
models, sources, sizing and batch operation contracts, failure coverage,
|
|
156
|
+
and validation approach.
|
|
157
|
+
- [validation/](https://github.com/ccluett/pv-calc/tree/main/validation):
|
|
158
|
+
independent reference implementations, published benchmarks (DTMB report
|
|
159
|
+
1324 case 17), and FEA comparisons. The reference implementations
|
|
160
|
+
re-derive the same published algebra separately from production, so they
|
|
161
|
+
catch refactor regressions, not a shared misreading of a source.
|
|
162
|
+
- [examples/](https://github.com/ccluett/pv-calc/tree/main/examples):
|
|
163
|
+
committed example requests for every command; a golden-response test pins
|
|
164
|
+
their output.
|
|
165
|
+
|
|
166
|
+
Links are absolute because this file is also the PyPI page, and the packaged
|
|
167
|
+
distribution does not ship the docs, validation, examples, or material
|
|
168
|
+
database.
|
|
169
|
+
|
|
170
|
+
Released under the
|
|
171
|
+
[MIT License](https://github.com/ccluett/pv-calc/blob/main/LICENSE). Changes
|
|
172
|
+
are recorded in the
|
|
173
|
+
[changelog](https://github.com/ccluett/pv-calc/blob/main/CHANGELOG.md), and
|
|
174
|
+
citation metadata is in
|
|
175
|
+
[CITATION.cff](https://github.com/ccluett/pv-calc/blob/main/CITATION.cff).
|
pv_calc-0.1.0/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# pv-calc
|
|
2
|
+
|
|
3
|
+
Source-cited external-pressure vessel calculations, as a command-line tool and
|
|
4
|
+
a Python library. Five structural models — tube stress, flat circular plate,
|
|
5
|
+
hemispherical head, NASA smooth-cylinder buckling, and NASA ring-stiffened
|
|
6
|
+
shell general instability — three of them with a bounded thickness sizing
|
|
7
|
+
mode, plus submerged mass properties. Every result carries its formula
|
|
8
|
+
sources, assumptions, and validity gates.
|
|
9
|
+
|
|
10
|
+
Results are screening values from idealized formulas. None is a design
|
|
11
|
+
approval.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install pv-calc
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Python 3.11 or later; depends on pydantic, pint, PyYAML, and typer. From a
|
|
20
|
+
checkout, `pip install .`.
|
|
21
|
+
|
|
22
|
+
## Quick start
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pv-calc tube \
|
|
26
|
+
--external-pressure "1000 psi" \
|
|
27
|
+
--internal-radius "3 in" \
|
|
28
|
+
--wall-thickness "0.470 in" \
|
|
29
|
+
--yield-strength "62 ksi" \
|
|
30
|
+
--failure-category ductile_metal \
|
|
31
|
+
--json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Every dimensioned input carries a unit, quoted (`"8 mm"`) or attached (`8mm`).
|
|
35
|
+
Results are JSON with `{"value", "unit"}` quantities, model and source
|
|
36
|
+
citations, and validity status.
|
|
37
|
+
|
|
38
|
+
A material is either explicit properties on the command line, as above, or a
|
|
39
|
+
named record: `--material NAME --materials-file FILE`. Its `failure_category`
|
|
40
|
+
(`ductile_metal`, `plastic`, or `brittle`) selects the strength it carries and
|
|
41
|
+
the criterion it is compared under, each the ordinary check for that behavior:
|
|
42
|
+
a ductile metal on von Mises distortion-energy stress against a yield
|
|
43
|
+
strength; a plastic on its largest stress against a working strength the
|
|
44
|
+
designer selects, which is the number carrying creep; and a brittle material,
|
|
45
|
+
which has no yield, against separate tensile and compressive ultimates. The
|
|
46
|
+
buckling models read elastic constants only.
|
|
47
|
+
[materials.yaml](https://github.com/ccluett/pv-calc/blob/main/materials.yaml)
|
|
48
|
+
is the project's own database: ten records over those three categories, every
|
|
49
|
+
property cited to its source, and screening values throughout rather than
|
|
50
|
+
design allowables.
|
|
51
|
+
|
|
52
|
+
The same kernels are plain Python functions in MPa and mm, returning frozen
|
|
53
|
+
dataclasses:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from pv_calc.pressure_vessel import closed_end_tube_stress
|
|
57
|
+
|
|
58
|
+
result = closed_end_tube_stress(
|
|
59
|
+
external_pressure_mpa=6.895,
|
|
60
|
+
internal_radius_mm=76.2,
|
|
61
|
+
wall_thickness_mm=11.94,
|
|
62
|
+
material_failure_category="ductile_metal",
|
|
63
|
+
strength_mpa=427.5,
|
|
64
|
+
)
|
|
65
|
+
print(result.branch, result.governing_stress_mpa, result.margin)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Commands
|
|
69
|
+
|
|
70
|
+
| Command | Calculates |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `tube` | Closed-end tube stress, failure pressure, margin, and elastic displacement |
|
|
73
|
+
| `tube size` | The wall thickness meeting a `cylindrical_shell_stress` margin, inside bounds |
|
|
74
|
+
| `plate` | Flat circular plate bending, shear, centre deflection, and seat bearing stress |
|
|
75
|
+
| `plate size` | The plate thickness meeting a bending margin and an optional deflection limit |
|
|
76
|
+
| `hemisphere` | Hemispherical head stress, NASA SP-8032 buckling, displacement, and seat stress |
|
|
77
|
+
| `smooth-buckling` | NASA SP-8007 smooth-cylinder external-pressure buckling |
|
|
78
|
+
| `smooth-buckling size` | The wall thickness meeting a margin across shell stress and buckling |
|
|
79
|
+
| `ring-shell` | NASA SP-8007 ring-stiffened shell general instability (advisory) |
|
|
80
|
+
| `mass-properties` | Submerged mass and buoyancy from resolved volumes, fluid density, and gravity |
|
|
81
|
+
| `sweep` | One forward request over a pressure or depth axis |
|
|
82
|
+
| `compare-materials` | One forward request against an ordered list of named materials |
|
|
83
|
+
| `describe MODEL` | The model's versioned input/output contract |
|
|
84
|
+
|
|
85
|
+
Output is always JSON, indented by default and compact on one line with
|
|
86
|
+
`--json`. Every calculation takes `--input FILE` (or `-` for stdin) for the
|
|
87
|
+
same request as JSON; `pv-calc describe MODEL --json` prints the contract that
|
|
88
|
+
request must satisfy, and `pv-calc COMMAND --help` lists the options. The
|
|
89
|
+
tube, plate, hemisphere, and smooth-buckling commands also take
|
|
90
|
+
`--fluid-density` and `--gravity` to report the body's weight in air and in
|
|
91
|
+
that fluid and each failure pressure as a depth.
|
|
92
|
+
|
|
93
|
+
## Errors
|
|
94
|
+
|
|
95
|
+
An evaluated negative margin, or a capacity the model withholds, is a normal
|
|
96
|
+
result and exits zero. A request that cannot be evaluated exits 2 with one
|
|
97
|
+
JSON object on stderr:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{"schema_version": "5.0.0",
|
|
101
|
+
"error": {"code": "unknown_material", "message": "...", "details": [...]}}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
`details` is a list of objects whose shape depends on the code, and may be
|
|
105
|
+
empty; `message` always says what went wrong. The codes:
|
|
106
|
+
|
|
107
|
+
| Code | Cause |
|
|
108
|
+
|---|---|
|
|
109
|
+
| `input_read_error`, `invalid_json` | `--input` cannot be read, or is not JSON |
|
|
110
|
+
| `invalid_request` | the request does not satisfy the model's contract, including a missing option; `details` lists each pydantic error with its `location` |
|
|
111
|
+
| `invalid_quantity`, `invalid_number`, `incompatible_unit` | a quantity has no unit, an unknown unit, or no finite value; a plain number is not numeric or finite; a quantity's unit has the wrong dimension |
|
|
112
|
+
| `missing_input` | `sweep` or `compare-materials` was run without `--input` |
|
|
113
|
+
| `input_source_conflict`, `material_source_conflict`, `missing_material_source`, `axis_source_conflict` | `--input` beside option values; both or neither of `--material` and explicit properties; two sweep axes |
|
|
114
|
+
| `missing_materials_file`, `invalid_material_database`, `unknown_material`, `invalid_material` | a named material without `--materials-file`; an unreadable database; a name it lacks (`details` lists every name); a record missing a property the model reads |
|
|
115
|
+
| `unknown_model` | `describe` was given a name that is not a model or batch operation |
|
|
116
|
+
| `invalid_bounds`, `no_reliable_solution` | a sizing operation's bounds are malformed, or no thickness inside them meets the target; `details` names the bracket evaluated |
|
|
117
|
+
| `unevaluable_model` | the kernel rejected the resolved inputs, a sizing sample fell outside a model's validity, or the result is not finite |
|
|
118
|
+
|
|
119
|
+
## Documentation
|
|
120
|
+
|
|
121
|
+
- [docs/engineering.md](https://github.com/ccluett/pv-calc/blob/main/docs/engineering.md):
|
|
122
|
+
models, sources, sizing and batch operation contracts, failure coverage,
|
|
123
|
+
and validation approach.
|
|
124
|
+
- [validation/](https://github.com/ccluett/pv-calc/tree/main/validation):
|
|
125
|
+
independent reference implementations, published benchmarks (DTMB report
|
|
126
|
+
1324 case 17), and FEA comparisons. The reference implementations
|
|
127
|
+
re-derive the same published algebra separately from production, so they
|
|
128
|
+
catch refactor regressions, not a shared misreading of a source.
|
|
129
|
+
- [examples/](https://github.com/ccluett/pv-calc/tree/main/examples):
|
|
130
|
+
committed example requests for every command; a golden-response test pins
|
|
131
|
+
their output.
|
|
132
|
+
|
|
133
|
+
Links are absolute because this file is also the PyPI page, and the packaged
|
|
134
|
+
distribution does not ship the docs, validation, examples, or material
|
|
135
|
+
database.
|
|
136
|
+
|
|
137
|
+
Released under the
|
|
138
|
+
[MIT License](https://github.com/ccluett/pv-calc/blob/main/LICENSE). Changes
|
|
139
|
+
are recorded in the
|
|
140
|
+
[changelog](https://github.com/ccluett/pv-calc/blob/main/CHANGELOG.md), and
|
|
141
|
+
citation metadata is in
|
|
142
|
+
[CITATION.cff](https://github.com/ccluett/pv-calc/blob/main/CITATION.cff).
|