pytanksim.classes.twophasefluidsimclasses
Module for simulating fluid tanks in the two-phase region.
Classes
Base class for the simulation of fluid tanks in the two-phase region. |
|
Simulation of fluid tanks in the two-phase region w/o constraints. |
|
Fluid tank venting at constant pressure in the two-phase region. |
|
Fluid tank being cooled at constant pressure in the two-phase region. |
|
Fluid tank being heated at constant pressure in the two-phase region. |
Module Contents
- class pytanksim.classes.twophasefluidsimclasses.TwoPhaseFluidSim(simulation_params: SimParams, storage_tank: pytanksim.classes.storagetankclasses.StorageTank, boundary_flux: BoundaryFlux)
Bases:
pytanksim.classes.basesimclass.BaseSimulation
Base class for the simulation of fluid tanks in the two-phase region.
Contains functions for calculating the governing ODEs.
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:
- class pytanksim.classes.twophasefluidsimclasses.TwoPhaseFluidDefault(simulation_params: SimParams, storage_tank: pytanksim.classes.storagetankclasses.StorageTank, boundary_flux: BoundaryFlux)
Bases:
TwoPhaseFluidSim
Simulation of fluid tanks in the two-phase region w/o 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:
- solve_differentials(time: float, ng: float, nl: float, T: 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:
- class pytanksim.classes.twophasefluidsimclasses.TwoPhaseFluidVenting(simulation_params: SimParams, storage_tank: pytanksim.classes.storagetankclasses.StorageTank, boundary_flux: BoundaryFlux)
Bases:
TwoPhaseFluidSim
Fluid 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:
- solve_differentials(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).
- 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:
- class pytanksim.classes.twophasefluidsimclasses.TwoPhaseFluidCooled(simulation_params: SimParams, storage_tank: pytanksim.classes.storagetankclasses.StorageTank, boundary_flux: BoundaryFlux)
Bases:
TwoPhaseFluidSim
Fluid tank being 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:
- solve_differentials(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).
- 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:
- class pytanksim.classes.twophasefluidsimclasses.TwoPhaseFluidHeatedDischarge(simulation_params: SimParams, storage_tank: pytanksim.classes.storagetankclasses.StorageTank, boundary_flux: BoundaryFlux)
Bases:
TwoPhaseFluidSim
Fluid tank being 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:
- solve_differentials(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).
- 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: