Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
4c2d8b0
ENH: add time variable density to Tank Fluids.
phmbressan Apr 27, 2024
6ca3bdc
TST: add tests for variable fluid density.
phmbressan May 3, 2024
1352a4d
STY: running isort for import order consistency.
phmbressan May 3, 2024
8be8859
DOC: update Fluid docs with variable density explanations.
phmbressan May 3, 2024
e468f88
MNT: use Union is Fluid dataclass type for Python <3.10 support.
phmbressan May 3, 2024
82d2d7b
ENH: add time variable density to Tank Fluids.
phmbressan Apr 27, 2024
a4cb1d4
STY: running isort for import order consistency.
phmbressan May 3, 2024
d42acab
MNT: use Union is Fluid dataclass type for Python <3.10 support.
phmbressan May 3, 2024
e4766b6
MNT: refactor density variation for temperature and pressure inputs.
phmbressan Aug 24, 2024
11f5bc6
MNT: improve Tank class outputs (WIP).
phmbressan Aug 26, 2024
72d2541
DOC: update fluid density documentation.
phmbressan Aug 26, 2024
5fdd5a4
MNT: Add CAD data for tank geometry validation.
phmbressan Aug 28, 2024
979692e
MNT: Refactor tank testing and improve file structure.
phmbressan Aug 28, 2024
af774d3
MNT: add recent changes to CHANGELOG.
phmbressan Aug 30, 2024
15c2225
MNT: post merge fixes from testing refactors.
phmbressan Aug 31, 2024
8788997
MNT: post rebase fixes.
phmbressan Sep 21, 2025
57f0124
TST: introduce testing to variable density tanks.
phmbressan Sep 22, 2025
1d09834
MNT: Add recent changes to CHANGELOG.
phmbressan Sep 22, 2025
568661d
TST: improve fluid tests and solve review comments.
phmbressan Sep 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ENH: add time variable density to Tank Fluids.
  • Loading branch information
phmbressan committed Sep 22, 2025
commit 82d2d7b30bf024e42b9dd4fb103ff5d9bfe2a16a
6 changes: 6 additions & 0 deletions rocketpy/motors/fluid.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import numpy as np

from dataclasses import dataclass
from typing import Union

Expand Down Expand Up @@ -47,6 +49,10 @@ def __post_init__(self):
if self.density < 0:
raise ValueError("The density must be a positive number.")

elif isinstance(self.density, Function):
if (self.density < 0).any():
raise ValueError("The density must be a positive number.")

self.density = Function(
self.density,
interpolation="linear",
Expand Down
2 changes: 1 addition & 1 deletion rocketpy/motors/tank.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def __init__(self, name, geometry, flux_time, liquid, gas, discretize=100):
Geometry of the tank.
flux_time : float, tuple of float
Tank flux time in seconds. Time interval that the fluid flux is
being analyzed. If a float is given, the flux time is assumed to
being analyzed. If a float is given, the flux time is assumed to
be between 0 and the given float, in seconds. If a tuple of float
is given, the flux time is assumed to be between the first and
second elements of the tuple.
Expand Down