pytanksim.classes.onephasesorbentsimclasses

Module for the simulation of sorbent tanks in the one phase region.

Classes

OnePhaseSorbentSim

Base class for simulation of sorbent tanks in the one phase region.

OnePhaseSorbentDefault

Simulates sorbent tanks in the one phase region without constraints.

OnePhaseSorbentVenting

Sorbent tank venting at constant pressure in the one phase region.

OnePhaseSorbentCooled

Sorbent tank cooled at constant pressure in the one phase region.

OnePhaseSorbentHeatedDischarge

Sorbent tank heated at constant pressure in the one phase region.

Module Contents

class pytanksim.classes.onephasesorbentsimclasses.OnePhaseSorbentSim(simulation_params: SimParams, storage_tank: pytanksim.classes.storagetankclasses.StorageTank, boundary_flux: BoundaryFlux)

Bases: pytanksim.classes.basesimclass.BaseSimulation

Base class for simulation of sorbent tanks in the one phase region.

It includes functions to calculate the governing ODE

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.onephasesorbentsimclasses.OnePhaseSorbentDefault(simulation_params: SimParams, storage_tank: pytanksim.classes.storagetankclasses.StorageTank, boundary_flux: BoundaryFlux)

Bases: OnePhaseSorbentSim

Simulates sorbent tanks in the one 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(p: float, T: float, time: float) numpy.ndarray

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

Parameters:
  • p (float) – Current pressure (Pa).

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

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

Returns:

An array containing the right hand side of the ODE.

Return type:

np.ndarray

run() pytanksim.classes.simresultsclass.SimResults

Run the dynamic simulation.

Raises:

TerminateSimulation – Stops the simulation when it detects an event such as hitting the saturation line, or hitting the maximum pressure limit of the tank.

Returns:

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

Return type:

SimResults

class pytanksim.classes.onephasesorbentsimclasses.OnePhaseSorbentVenting(simulation_params: SimParams, storage_tank: pytanksim.classes.storagetankclasses.StorageTank, boundary_flux: BoundaryFlux)

Bases: OnePhaseSorbentSim

Sorbent tank venting at constant pressure in the one 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(T: float, time: float) numpy.ndarray

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

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

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

Returns:

An array containing the right hand side of the ODE.

Return type:

np.ndarray

run() pytanksim.classes.simresultsclass.SimResults

Run the dynamic simulation.

Raises:

TerminateSimulation – Stops the simulation when it detects an event such as hitting the saturation line, or hitting the maximum pressure limit of the tank.

Returns:

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

Return type:

SimResults

class pytanksim.classes.onephasesorbentsimclasses.OnePhaseSorbentCooled(simulation_params: SimParams, storage_tank: pytanksim.classes.storagetankclasses.StorageTank, boundary_flux: BoundaryFlux)

Bases: OnePhaseSorbentSim

Sorbent tank cooled at constant pressure in the one 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(T: float, time: float) numpy.ndarray

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

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

  • 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 hitting the saturation line, or hitting the maximum pressure limit of the tank.

Returns:

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

Return type:

SimResults

class pytanksim.classes.onephasesorbentsimclasses.OnePhaseSorbentHeatedDischarge(simulation_params: SimParams, storage_tank: pytanksim.classes.storagetankclasses.StorageTank, boundary_flux: BoundaryFlux)

Bases: OnePhaseSorbentSim

Sorbent tank heated at constant pressure in the one 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(T: float, time: float) numpy.ndarray

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

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

  • 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 hitting the saturation line, or hitting the maximum pressure limit of the tank.

Returns:

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

Return type:

SimResults