LevelBasedTank Class#

class rocketpy.LevelBasedTank[source]#

Class to define a tank whose flow is described by liquid level, i.e., the height of the liquid inside the tank. It assumes that the volume above the liquid level is uniformly occupied by gas. This class inherits from the Tank class. See the Tank class for more information on its attributes and methods.

See also

Tanks Usage

__init__(name, geometry, flux_time, liquid, gas, liquid_height, discretize=100)[source]#
Parameters:
  • name (str) – Name of the tank.

  • geometry (TankGeometry) – Geometry of the tank.

  • flux_time (float, tuple of float, optional) – Tank flux time in seconds. It is the time range in which the tank flux is being analyzed. In general, during this time, the tank is being filled or emptied. 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.

  • liquid (Fluid) – Liquid inside the tank as a Fluid object.

  • gas (Fluid) – Gas inside the tank as a Fluid object.

  • liquid_height (int, float, callable, string, array, Function) – Liquid height as a function of time in m. Must be a valid Function source. The liquid height zero level reference is assumed to be the same as the Tank geometry. If a callable is given, it must be a function of time in seconds If a .csv file is given, the first column is assumed to be the time and the second column the liquid height in meters.

  • discretize (int, optional) – Number of points to discretize fluid inputs. If the liquid height input is already discretized this parameter may be set to None. Otherwise, an uniform discretization will be applied based on the discretize value. The default is 100.

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:

Function

net_mass_flow_rate#

Returns the net mass flow rate of the tank as a function of time by taking the derivative of the mass function.

Returns:

Net mass flow rate of the tank as a function of time.

Return type:

Function

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:

Function

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:

Function

gas_volume#

Returns the volume of the gas as a function of time. The gas volume is assumed to uniformly occupy the volume above the liquid level.

Returns:

Volume of the gas as a function of time.

Return type:

Function

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:

Function

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:

Function

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:

Function

gas_height#

Returns the gas level as a function of time. This height is measured from the zero level of the tank geometry. Since the gas is assumed to uniformly occupy the volume above the liquid level, the gas height is constant and equal to the top of the tank geometry.

Returns:

Height of the ullage as a function of time.

Return type:

Function

discretize_liquid_height()[source]#

Discretizes the liquid height input according to the flux time and the discretize parameter.