Tank Abstract Class#
- class rocketpy.Tank[source]#
Abstract Tank class that defines a tank object for a rocket motor, so that it evaluates useful properties of the tank and its fluids, such as mass, volume, fluid flow rate, center of mass, etc.
See also
- Variables:
Tank.name (
str) – Name of the tank.Tank.geometry (
TankGeometry) – Geometry of the tank.Tank.flux_time (
float,tupleoffloat) – Tank flux time in seconds.Tank.liquid (
Fluid) – Liquid inside the tank as a Fluid object.Tank.gas (
Fluid) – Gas inside the tank as a Fluid object.Tank.discretize (
int, optional) – Number of points to discretize fluid inputs.Tank.fluid_mass (
Function) – Total mass of liquid and gases in kg inside the tank as a function of time.Tank.net_mass_flow_rate (
Function) – Net mass flow rate of the tank in kg/s as a function of time, also understood as time derivative of the fluids mass.Tank.liquid_volume (
Function) – Volume of the liquid inside the Tank in m^3 as a function of time.Tank.gas_volume (
Function) – Volume of the gas inside the Tank in m^3 as a function of time.Tank.liquid_height (
Function) – Height of the liquid inside the Tank in m as a function of time. The zero level reference is the same as set in Tank.geometry.Tank.gas_height (
Function) – Height of the gas inside the Tank in m as a function of time. The zero level reference is the same as set in Tank.geometry.Tank.liquid_mass (
Function) – Mass of the liquid inside the Tank in kg as a function of time.Tank.gas_mass (
Function) – Mass of the gas inside the Tank in kg as a function of time.Tank.liquid_center_of_mass (
Function) – Center of mass of the liquid inside the Tank in m as a function of time. The zero level reference is the same as set in Tank.geometry.Tank.gas_center_of_mass (
Function) – Center of mass of the gas inside the Tank in m as a function of time. The zero level reference is the same as set in Tank.geometry.Tank.center_of_mass (
Function) – Center of mass of liquid and gas (i.e. propellant) inside the Tank in m as a function of time. The zero level reference is the same as set in Tank.geometry.Tank.liquid_inertia (
Function) – The inertia of the liquid inside the Tank in kg*m^2 as a function of time around a perpendicular axis to the Tank symmetry axis. The reference point is the Tank center of mass.Tank.gas_inertia (
Function) – The inertia of the gas inside the Tank in kg*m^2 as a function of time around a perpendicular axis to the Tank symmetry axis. The reference point is the Tank center of mass.Tank.inertia (
Function) – The inertia of the liquid and gas (i.e. propellant) inside the Tank in kg*m^2 as a function of time around a perpendicular axis to the Tank symmetry axis. The reference point is the Tank center of mass.
- __init__(name, geometry, flux_time, liquid, gas, discretize=100, temperature=None, pressure=None)[source]#
Initialize Tank class.
- Parameters:
name (
str) – Name of the tank.geometry (
TankGeometry) – Geometry of the tank.flux_time (
float,tupleoffloat) – 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 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. Before the start time, the tank properties are kept at their initial state. After the final time, their final state is kept.gas (
Fluid) – Gas inside the tank as a Fluid object.liquid (
Fluid) – Liquid inside the tank as a Fluid object.discretize (
int, optional) – Number of points to discretize fluid inputs. If the input already has a appropriate uniform discretization, this parameter must be set to None. The default is 100.temperature (
int,float,callable,string,array,Function) – Temperature inside the tank as a function of time in K. If a callable is given, it must be a function of time in seconds. An array of points can also be given as a list or a string with the path to a .csv file with two columns, the first one being the time in seconds and the second one being the temperature in K. The default is None. This parameter is only required if fluid (liquidorgasparameters) densities are functions of temperature.pressure (
int,float,callable,string,array,Function) – Pressure inside the tank as a function of time in Pa. If a callable is given, it must be a function of time in seconds. An array of points can also be given as a list or a string with the path to a .csv file with two columns, the first one being the time in seconds and the second one being the pressure in Pa. The default is None. This parameter is only required if fluid (liquidorgasparameters) densities are functions of pressure.
- property flux_time#
Returns the start and final times of the tank flux.
- Returns:
Tuple containing start and final times of the tank flux.
- Return type:
tuple
- property temperature#
Returns the temperature of the tank as a function of time.
- Returns:
Temperature of the tank as a function of time.
- Return type:
- property pressure#
Returns the pressure of the tank as a function of time.
- Returns:
Pressure of the tank as a function of time.
- Return type:
- abstract property fluid_mass#
Returns the total mass of liquid and gases inside the tank as a function of time.
- Returns:
Mass of the tank as a function of time. Units in kg.
- Return type:
- abstract property net_mass_flow_rate#
Returns the net mass flow rate of the tank as a function of time. Net mass flow rate is the mass flow rate entering the tank minus the mass flow rate exiting the tank, including liquids and gases.
- Returns:
Net mass flow rate of the tank as a function of time.
- Return type:
- abstract property fluid_volume#
Returns the volume total fluid volume inside the tank as a function of time. This volume is the sum of the liquid and gas volumes.
- Returns:
Volume of the fluid as a function of time.
- Return type:
- abstract property liquid_volume#
Returns the volume of the liquid as a function of time.
- Returns:
Volume of the liquid as a function of time.
- Return type:
- abstract property gas_volume#
Returns the volume of the gas as a function of time.
- Returns:
Volume of the gas as a function of time.
- Return type:
- abstract property liquid_height#
Returns the liquid level as a function of time. This height is measured from the zero level of the tank geometry.
- Returns:
Height of the ullage as a function of time.
- Return type:
- abstract property gas_height#
Returns the gas level as a function of time. This height is measured from the zero level of the tank geometry.
- Returns:
Height of the ullage as a function of time.
- Return type:
- abstract property liquid_mass#
Returns the mass of the liquid as a function of time.
- Returns:
Mass of the liquid as a function of time.
- Return type:
- abstract property gas_mass#
Returns the mass of the gas as a function of time.
- Returns:
Mass of the gas as a function of time.
- Return type:
- liquid_center_of_mass#
Returns the center of mass of the liquid portion of the tank as a function of time. This height is measured from the zero level of the tank geometry.
- Returns:
Center of mass of the liquid portion of the tank as a function of time.
- Return type:
- gas_center_of_mass#
Returns the center of mass of the gas portion of the tank as a function of time. This height is measured from the zero level of the tank geometry.
- Returns:
Center of mass of the gas portion of the tank as a function of time.
- Return type:
- center_of_mass#
Returns the center of mass of the tank’s fluids as a function of time. This height is measured from the zero level of the tank geometry.
- Returns:
Center of mass of the tank’s fluids as a function of time.
- Return type:
- liquid_inertia#
Returns the inertia tensor of the liquid portion of the tank as a function of time. The reference point is the center of mass of the tank.
- Returns:
Inertia tensor of the liquid portion of the tank as a function of time.
- Return type:
- gas_inertia#
Returns the inertia tensor of the gas portion of the tank as a function of time. The reference point is the center of mass of the tank.
- Returns:
Inertia tensor of the gas portion of the tank as a function of time.
- Return type:
- inertia#
Returns the inertia tensor of the tank’s fluids as a function of time. The reference point is the center of mass of the tank.
- Returns:
Inertia tensor of the tank’s fluids as a function of time.
- Return type:
- _check_volume_bounds()[source]#
Checks if the tank is overfilled or underfilled. Raises a ValueError if either the gas_volume or liquid_volume are out of tank geometry bounds.
- _check_height_bounds()[source]#
Checks if the tank is overfilled or underfilled. Raises a ValueError if either the gas_height or liquid_height are out of tank geometry bounds.
- abstract _discretize_fluid_inputs()[source]#
Uniformly discretizes the parameter of inputs of fluid data .
- draw(*, filename=None)[source]#
Draws the tank geometry.
- Parameters:
filename (
str | None, optional) – The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff and webp (these are the formats supported by matplotlib).- Return type:
None