Skip to content

Commit 7234995

Browse files
Update tanks.py
simplified docs
1 parent 99c6214 commit 7234995

1 file changed

Lines changed: 5 additions & 17 deletions

File tree

src/models/sub/tanks.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ class TankKinds(str, Enum):
1111
ULLAGE: str = "ULLAGE"
1212

1313

14-
# Scalar density keeps the legacy behaviour (constant kg/m^3).
15-
# A list of (temperature_K, density_kg_per_m3) samples enables
16-
# temperature-dependent density — required for realistic LOX / N2O
17-
# modelling. Pressure dependence is out of scope for this iteration.
14+
# Scalar: constant density (kg/m^3).
15+
# [(temp_K, density_kg_m3)]: temperature-dependent (LOX / N2O).
16+
# No pressure dependence.
1817
DensityInput = Union[float, List[Tuple[float, float]]]
1918

2019

@@ -23,14 +22,6 @@ class TankFluids(BaseModel):
2322
density: DensityInput
2423

2524

26-
# --- Tank geometry discriminated union ----------------------------------
27-
# RocketPy ships three concrete geometry classes. We mirror them as a
28-
# discriminated Pydantic union keyed on `geometry_kind`. `custom` is the
29-
# generic piecewise form (original API shape); `cylindrical` and
30-
# `spherical` map to `rocketpy.motors.CylindricalTank` and
31-
# `SphericalTank` respectively.
32-
33-
3425
class CustomTankGeometry(BaseModel):
3526
geometry_kind: Literal["custom"] = "custom"
3627
geometry: List[Tuple[Tuple[float, float], float]]
@@ -59,9 +50,7 @@ class SphericalTankGeometry(BaseModel):
5950

6051

6152
# Map tank_kind → tuple of MotorTank field names that rocketpy's
62-
# corresponding Tank subclass requires. The validator below rejects
63-
# payloads that omit any of them so the API returns 422 instead of
64-
# letting rocketpy crash during motor construction.
53+
# corresponding Tank subclass requires.
6554
_REQUIRED_FIELDS_BY_TANK_KIND = {
6655
TankKinds.MASS_FLOW: (
6756
"initial_liquid_mass",
@@ -113,8 +102,7 @@ class MotorTank(BaseModel):
113102

114103
@model_validator(mode='after')
115104
def validate_tank_kind_fields(self):
116-
# Mirrors the validate_dry_inertia_for_kind pattern used on
117-
# MotorModel: reject incoherent payloads at the API boundary
105+
# reject incoherent payloads at the API boundary
118106
# instead of letting rocketpy crash during Tank construction.
119107
missing = [
120108
field

0 commit comments

Comments
 (0)