pytanksim.classes.twophasesorbentsimclasses

Module for simulating sorbent tanks in the two-phase region.

Classes

TwoPhaseSorbentSim

Base class for sorbent tanks in the two-phase region.

TwoPhaseSorbentDefault

Simulate sorbent tanks in the two phase region without constraints.

TwoPhaseSorbentCooled

Sorbent tank cooled at constant pressure in the two-phase region.

TwoPhaseSorbentVenting

Sorbent tank venting at constant pressure in the two-phase region.

TwoPhaseSorbentHeatedDischarge

Sorbent tank heated at constant pressure in the two-phase region.

Module Contents

class pytanksim.classes.twophasesorbentsimclasses.TwoPhaseSorbentSim(simulation_params: SimParams, storage_tank: pytanksim.classes.storagetankclasses.StorageTank, boundary_flux: BoundaryFlux)

Bases: pytanksim.classes.basesimclass.BaseSimulation

Base class for sorbent tanks in the two-phase region.

Initialize the BaseSimulation class.

Parameters:
  • simulation_params (SimParams) – Object containing simulation-specific parameters.

  • storage_tank (StorageTank) – Object containing attributes and methods specific to the storage tank being simulated.

  • boundary_flux (BoundaryFlux) – Object containing information on the mass and energy going in and out of the tank during the simulation.

Raises:
  • ValueError – If the simulation is set to begin on the saturation line but the initial values for liquid and gas in the tank, or, alternatively, the initial vapor quality, was not specified.

  • ValueError – If both the initial values for liquid and gas in the tank is specified as well as the initial vapor quality, but the values don’t match each other.

Returns:

A simulation object which can be run to get results.

Return type:

BaseSimulation

class pytanksim.classes.twophasesorbentsimclasses.TwoPhaseSorbentDefault(simulation_params: SimParams, storage_tank: pytanksim.classes.storagetankclasses.StorageTank, boundary_flux: BoundaryFlux)

Bases: TwoPhaseSorbentSim

Simulate sorbent tanks in the two phase region without constraints.

Initialize the BaseSimulation class.

Parameters:
  • simulation_params (SimParams) – Object containing simulation-specific parameters.

  • storage_tank (StorageTank) – Object containing attributes and methods specific to the storage tank being simulated.

  • boundary_flux (BoundaryFlux) – Object containing information on the mass and energy going in and out of the tank during the simulation.

Raises:
  • ValueError – If the simulation is set to begin on the saturation line but the initial values for liquid and gas in the tank, or, alternatively, the initial vapor quality, was not specified.

  • ValueError – If both the initial values for liquid and gas in the tank is specified as well as the initial vapor quality, but the values don’t match each other.

Returns:

A simulation object which can be run to get results.

Return type:

BaseSimulation

solve_differentials(ng: float, nl: float, T: float, time: float) numpy.ndarray

Find the right hand side of the governing ODE at a given time step.

Parameters:
  • time (float) – Current time step (in s).

  • ng (float) – Current amount of gas in the tank (moles).

  • nl (float) – Current amount of liquid in the tank (moles).

  • T (float) – Current temperature (K).

Returns:

An array containing the right hand side of the ODE.

Return type:

np.ndarray

run()

Run the dynamic simulation.

Raises:

TerminateSimulation – Stops the simulation when it detects an event such as the end of the phase change, or if the simulation hits the maximum pressure of the tank.

Returns:

An object for storing and manipulating the results of the dynamic simulation.

Return type:

SimResults

class pytanksim.classes.twophasesorbentsimclasses.TwoPhaseSorbentCooled(simulation_params: SimParams, storage_tank: pytanksim.classes.storagetankclasses.StorageTank, boundary_flux: BoundaryFlux)

Bases: TwoPhaseSorbentSim

Sorbent tank cooled at constant pressure in the two-phase region.

Initialize the BaseSimulation class.

Parameters:
  • simulation_params (SimParams) – Object containing simulation-specific parameters.

  • storage_tank (StorageTank) – Object containing attributes and methods specific to the storage tank being simulated.

  • boundary_flux (BoundaryFlux) – Object containing information on the mass and energy going in and out of the tank during the simulation.

Raises:
  • ValueError – If the simulation is set to begin on the saturation line but the initial values for liquid and gas in the tank, or, alternatively, the initial vapor quality, was not specified.

  • ValueError – If both the initial values for liquid and gas in the tank is specified as well as the initial vapor quality, but the values don’t match each other.

Returns:

A simulation object which can be run to get results.

Return type:

BaseSimulation

solve_differentials(time: float, ng: float, nl: float) numpy.ndarray

Find the right hand side of the governing ODE at a given time step.

Parameters:
  • time (float) – Current time step (in s).

  • ng (float) – Current amount of gas in the tank (moles).

  • nl (float) – Current amount of liquid in the tank (moles).

Returns:

An array containing the right hand side of the ODE.

Return type:

np.ndarray

run()

Run the dynamic simulation.

Raises:

TerminateSimulation – Stops the simulation when it detects an event such as the end of the phase change, or if the simulation hits the maximum pressure of the tank.

Returns:

An object for storing and manipulating the results of the dynamic simulation.

Return type:

SimResults

class pytanksim.classes.twophasesorbentsimclasses.TwoPhaseSorbentVenting(simulation_params: SimParams, storage_tank: pytanksim.classes.storagetankclasses.StorageTank, boundary_flux: BoundaryFlux)

Bases: TwoPhaseSorbentSim

Sorbent tank venting at constant pressure in the two-phase region.

Initialize the BaseSimulation class.

Parameters:
  • simulation_params (SimParams) – Object containing simulation-specific parameters.

  • storage_tank (StorageTank) – Object containing attributes and methods specific to the storage tank being simulated.

  • boundary_flux (BoundaryFlux) – Object containing information on the mass and energy going in and out of the tank during the simulation.

Raises:
  • ValueError – If the simulation is set to begin on the saturation line but the initial values for liquid and gas in the tank, or, alternatively, the initial vapor quality, was not specified.

  • ValueError – If both the initial values for liquid and gas in the tank is specified as well as the initial vapor quality, but the values don’t match each other.

Returns:

A simulation object which can be run to get results.

Return type:

BaseSimulation

solve_differentials(ng: float, nl: float, time: float) numpy.ndarray

Find the right hand side of the governing ODE at a given time step.

Parameters:
  • ng (float) – Current amount of gas in the tank (moles).

  • nl (float) – Current amount of liquid in the tank (moles).

  • time (float) – Current time step (in s).

Returns:

An array containing the right hand side of the ODE.

Return type:

np.ndarray

run()

Run the dynamic simulation.

Raises:

TerminateSimulation – Stops the simulation when it detects an event such as the end of the phase change, or if the simulation hits the maximum pressure of the tank.

Returns:

An object for storing and manipulating the results of the dynamic simulation.

Return type:

SimResults

class pytanksim.classes.twophasesorbentsimclasses.TwoPhaseSorbentHeatedDischarge(simulation_params: SimParams, storage_tank: pytanksim.classes.storagetankclasses.StorageTank, boundary_flux: BoundaryFlux)

Bases: TwoPhaseSorbentSim

Sorbent tank heated at constant pressure in the two-phase region.

Initialize the BaseSimulation class.

Parameters:
  • simulation_params (SimParams) – Object containing simulation-specific parameters.

  • storage_tank (StorageTank) – Object containing attributes and methods specific to the storage tank being simulated.

  • boundary_flux (BoundaryFlux) – Object containing information on the mass and energy going in and out of the tank during the simulation.

Raises:
  • ValueError – If the simulation is set to begin on the saturation line but the initial values for liquid and gas in the tank, or, alternatively, the initial vapor quality, was not specified.

  • ValueError – If both the initial values for liquid and gas in the tank is specified as well as the initial vapor quality, but the values don’t match each other.

Returns:

A simulation object which can be run to get results.

Return type:

BaseSimulation

solve_differentials(time: float, ng: float, nl: float) numpy.ndarray

Find the right hand side of the governing ODE at a given time step.

Parameters:
  • ng (float) – Current amount of gas in the tank (moles).

  • nl (float) – Current amount of liquid in the tank (moles).

  • time (float) – Current time step (in s).

Returns:

An array containing the right hand side of the ODE.

Return type:

np.ndarray

run()

Run the dynamic simulation.

Raises:

TerminateSimulation – Stops the simulation when it detects an event such as the end of the phase change, or if the simulation hits the maximum pressure of the tank.

Returns:

An object for storing and manipulating the results of the dynamic simulation.

Return type:

SimResults