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, temperature=None, pressure=None)[source]#

Initializes the MassFlowRateBasedTank class.

Parameters:
  • name (str) – Name of the tank.

  • geometry (TankGeometry) – 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 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.

  • 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.

  • 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 (liquid or gas parameters) 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 (liquid or gas parameters) densities are functions of pressure.

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

Uniformly discretizes the parameter of inputs of fluid data .

discretize_flow()[source]#

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