MassBasedTank Class#

class rocketpy.MassBasedTank[source]#

Class to define a tank whose flow is described by liquid and gas masses. 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_mass, gas_mass, 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_mass (int, float, callable, string, array, Function) – Liquid mass as a function of time in kg. Must be a valid Function source. If a callable is given, it must be a function of time in seconds. If a .csv file is given, the first column must be the time in seconds and the second column must be the liquid mass in kg.

  • gas_mass (int, float, callable, string, array, Function) – Gas mass as a function of time in kg. Must be a valid Function source. If a callable is given, it must be a function of time in seconds. If a .csv file is given, the first column must be the time in seconds and the second column must be the gas mass in kg.

  • discretize (int, optional) – Number of points to discretize fluid inputs. If the mass inputs are uniformly discretized (have the same time steps) 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

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_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

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

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:

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

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_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:

Function

discretize_masses()[source]#

Discretizes the fluid mass inputs according to the flux time and the discretize parameter.