MassFlowRateBasedTank Class#

class rocketpy.MassFlowRateBasedTank[source]#

Class to define a tank based on mass flow rates inputs. 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, initial_liquid_mass, initial_gas_mass, liquid_mass_flow_rate_in, gas_mass_flow_rate_in, liquid_mass_flow_rate_out, gas_mass_flow_rate_out, discretize=100)[source]#

Initializes the MassFlowRateBasedTank class.

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.

  • initial_liquid_mass (float) – Initial liquid mass in the tank in kg.

  • initial_gas_mass (float) – Initial gas mass in the tank in kg.

  • liquid_mass_flow_rate_in (int, float, callable, string, array, Function) – Liquid mass flow rate into the tank in kg/s. Always positive. It must be a valid Function source. If a callable is given, it must be a function of time. If a .csv file is given, it must have two columns, the first one being time in seconds and the second one being the mass flow rate in kg/s.

  • gas_mass_flow_rate_in (int, float, callable, string, array, Function) – Gas mass flow rate into the tank in kg/s. Always positive. It must be a valid Function source. If a callable is given, it must be a function of time. If a .csv file is given, it must have two columns, the first one being time in seconds and the second one being the mass flow rate in kg/s.

  • liquid_mass_flow_rate_out (int, float, callable, string, array, Function) – Liquid mass flow rate out of the tank in kg/s. Always positive. It must be a valid Function source. If a callable is given, it must be a function of time. If a .csv file is given, it must have two columns, the first one being time in seconds and the second one being the mass flow rate in kg/s.

  • gas_mass_flow_rate_out (int, float, callable, string, array, Function) – Gas mass flow rate out of the tank in kg/s. Always positive. It must be a valid Function source. If a callable is given, it must be a function of time. If a .csv file is given, it must have two columns, the first one being time in seconds and the second one being the mass flow rate in kg/s.

  • discretize (int, optional) – Number of points to discretize fluid inputs. If the mass flow rate 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

liquid_mass#

Returns the mass of the liquid as a function of time by integrating the liquid mass flow rate.

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 by integrating the gas mass flow rate.

Returns:

Mass of the gas as a function of time.

Return type:

Function

net_liquid_flow_rate#

Returns the net mass flow rate of liquid as a function of time. It is computed as the liquid mass flow rate entering the tank minus the liquid mass flow rate exiting the tank.

Returns:

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

Return type:

Function

net_gas_flow_rate#

Returns the net mass flow rate of gas as a function of time. It is computed as the gas mass flow rate entering the tank minus the gas mass flow rate exiting the tank.

Returns:

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

Return type:

Function

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:

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.

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_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_flow()[source]#

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