WOLFRAM

Tank Example

Drag-in ComponentsConnect and Simulate
Define Tank ParametersAnalyze
Define Boundary Parameters

In this example, you will model a tank that has an outlet to the ambient. Using this model, you will observe how the flow velocity changes with the height of the tank.

1.gif

Model to determine the flow velocity at the tank outlet.

Drag-in Components

Create a new model and drag the following components from the Modelica standard library:

Define Tank Parameters

height: Total height of the tank. By default, the initial level of fluid in the tank is set at 0.5 * height of the tank. You can keep the default or change it by going to the Initialization tab and changing the level_start parameter.

crossArea: Define cross-sectional area of the tank.

Medium (This parameter cannot be left blank.) Select a fluid from the drop-down menu, e.g. Extension of the StandardWater package.

Ports: This refers to the outlet of the tank to which other components can be connected.

nPorts: In this example, as you want to connect only to the ambient, set the nPorts to 1.

use_portsData: Set use_portsData to true.

portsData: Provide the portsData as a list, which means they need to be specified using curly braces {}. It takes a function as an argument. The function is Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(). You can open the function (type Modelica.Fluid.Vessels.BaseClasses.VesselPortsData in the search field in the Class Browser) and check the inputs:

3.gif

You can define diameter, height and other parameters. For this example, set the port height to 1 m and diameter to 0.3 m. Use the defaults for zeta_out and zeta_in. The input to the portsData should look like this: {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=0.3,height=1)}

4.gif

Define Boundary Parameters

nPorts: As the ambient is only connected to the tank, set this value to 1.

5.gif

Medium: Select a fluid from the drop-down menu, e.g. Extension of the StandardWater package.

Connect and Simulate

Connect the ports of the tank and boundary:

6.gif

Provide a simulation time in the Experiment Setup and simulate:

7.gif

Analyze

Plot the mass flow rate and level at outlet in Simulation Center. Mass flow rate can be obtained from the ports data: tank.ports[1].m_flow. Level can be obtained by plotting the level: tank.level.

8.gif

Negative mass flow rate shows that fluid is moving out of the tank. As the fluid level decreases, the mass flow rate also decreases.