20
Solved with COMSOL Multiphysics 4.2a ©2011 COMSOL 1 | FLOW AND MIXING IN TWO TANKS Flow and Mixing in Two Tanks Introduction This tutorial model shows how to set up basic components in the Chemical Engineering Flowsheet environment including: Material stream type Streams Unit operations Thermodynamic and physical property calculations using the CAPE-OPEN interface Model Definition Figure 1 illustrates a simple flowsheet model containing a two tanks, a feed unit, and a product unit. Feed Tank 1 Tank 2 Stream 2 Stream 3 Product Stream 1 Initial state Flow reversal Feed Tank 1 Tank 2 Stream 2 Stream 3 Product Stream 1 Figure 1: A simple flowsheet model with two tanks. Flow reversal occurs in Stream 2.

Models.cefs.Two Tanks

Embed Size (px)

Citation preview

Page 1: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

© 2 0 1 1 C O

F l ow and M i x i n g i n Two T ank s

Introduction

This tutorial model shows how to set up basic components in the Chemical Engineering Flowsheet environment including:

• Material stream type

• Streams

• Unit operations

• Thermodynamic and physical property calculations using the CAPE-OPEN interface

Model Definition

Figure 1 illustrates a simple flowsheet model containing a two tanks, a feed unit, and a product unit.

Feed

Tank 1 Tank 2

Stream 2 Stream 3 Product

Stream 1

Initial state

Flow reversal

Feed

Tank 1 Tank 2

Stream 2 Stream 3 Product

Stream 1

Figure 1: A simple flowsheet model with two tanks. Flow reversal occurs in Stream 2.

M S O L 1 | F L O W A N D M I X I N G I N TW O TA N K S

Page 2: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

2 | F L O W

Tank 1 is initially empty. It receives a liquid stream containing a mixture of hexane, heptane, and octane from the Feed unit. Tank 2 is initially filled with hexane only. Liquid flows from Tank 2 to Tank 1 until the hydrostatic pressure becomes sufficiently large in Tank 1. Thereafter the material flow in Stream 2 reverses direction, changing the composition in Tank 2 and the Product unit.

Model Setup

WO R K F L OW

The following steps outline the model setup:

1 Add units operations.

2 Add a material stream type.

3 Connect units with streams.

4 Set unit parameters and initial states.

5 Set up an external property calculation using the CAPE-OPEN interface.

It is important to note the how the Unit Operations and Material Stream Type features pass information and as a result influence each others content. Unit Operations require information of compounds and phases to set up it’s equations. This information is available once a material Stream, associated with a Material Stream Type, is connected to a unit port. Connecting streams to ports in turn requires that Unit Operations have been defined. Unit Operations may furthermore require thermodynamic or physical property calculations that describe the state of the material in the unit. This information is requested from the Material Stream Type defining the Stream connecting to the Unit. The dependencies are outlined in Figure 2 below.

Material StreamType

Unit Operation

Compounds and

Properties

Port informationProperty requests

phase definitions

Figure 2: Unit operations provide the Material Stream Type feature with port information and requests physical properties of the material. The Material Stream Type feature provides compound and phase definitions and physical properties to the Unit operations through the connected Streams.

A N D M I X I N G I N TW O TA N K S © 2 0 1 1 C O M S O L

Page 3: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

© 2 0 1 1 C O

U N I T O P E R A T I O N S

The Feed, two Tanks, and the Product units required for this model are added to the flowsheet model by right-clicking the Flowsheet feature, selecting units from the list that appears.

Figure 3: Unit operations and Material Stream Types are added as child nodes to the Flowsheet feature.

The Feed unit has a single material outlet port and specifies the material flowing into the system. In this case, a total flow of 5 kg/s contains a mixture of hexane, heptane and octane of weight fractions 0.2, 0.3, and 0.5, respectively. The unit equations will calculate the pressure at the feed required to maintain a constant total flow.

Figure 4: The Feed unit specifies the material stream entering the flowsheet model.

The Tank units are open to the atmosphere. Tank 1 is initially empty while Tank 2 contains a 1000 kg of hexane. Both tanks have one inlet and one outlet port. The

M S O L 3 | F L O W A N D M I X I N G I N TW O TA N K S

Page 4: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

4 | F L O

diameter of the ports is 5 cm and the flow through the ports is calculated from an orifice equation where K is a dimensionless empirical constant that accounts for the orifice shape. The unit will calculate the total mass contained (kg), the composition (weight fractions), the fill height (m), the pressure (Pa), and the material flow (kg/s) entering and leaving the tank.

Figure 5: Tank 1 (left) is empty initially, while Tank 2 contains pure hexane.

The Product unit has one material inlet port. It sets the pressure at the outlet and reports the material flow (kg/s) and composition.

Figure 6: The Product unit reports the total flow and composition of the material stream leaving the system.

W A N D M I X I N G I N TW O TA N K S © 2 0 1 1 C O M S O L

Page 5: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

© 2 0 1 1 C O

M A T E R I A L S T R E A M TY P E

The Material Stream Type feature defines a class of streams that contain the same set of compounds. In this model, the same liquid mixture flow through all unit operations so a single Material Stream Type feature is sufficient. A Material Stream Type feature is accessed by right-clicking the Flowsheet node and selecting from the list that appears. Chemicals carried on the stream type are defined in the Compounds section. In this example hexane, heptane, and octane are represented by the compound names C6, C7, and C8, respectively. Clicking the Add button creates a new entry in the Compounds list.

Figure 7: Compounds in a material stream are defined in the Material Stream Type feature.

The Properties section lists the properties of the material that are currently requested by the unit operations in the flowsheet model. In the example described here, the Tank units require the mixture density. The input in the Mixture density edit field can be a constant or an expression that evaluates the property accounting for the local conditions in the Tank, that is, temperature, pressure, and composition in the unit. One way to include accurate property function to the flowsheet model is by means of the CAPE-OPEN interface, as described in the section below.

M S O L 5 | F L O W A N D M I X I N G I N TW O TA N K S

Page 6: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

6 | F L O

The individual streams that carry material from one unit to another are added to the Streams list. This is also where the stream connections are specified.

Figure 8: Material streams are defined and connected to unit operations in the Streams section.

C A P E - O P E N I N T E R F A C E

With the COMSOL CAPE-OPEN thermo interface, functions can be set up in COMSOL that call calculations from external software. In this example, the CAPE-OPEN compliant thermo software TEA (Ref. 1) will be used to calculate the liquid density of a hexane/heptane/octane mixture. The CAPE-OPEN feature is added to a model by right-clicking the top node in the model tree. In turn, right-clicking the CAPE-OPEN feature brings up a list of available property calculations. The Single Phase Property selection is appropriate to set up a function for the density calculation,

Figure 9: The CAPE-OPEN feature can be used to set up functions calling external calculations of thermodynamic and physical properties.

Selecting a property calculation launches the CAPE-OPEN wizard that step-wise presents the sets up the property function. The first step allows for browsing and

W A N D M I X I N G I N TW O TA N K S © 2 0 1 1 C O M S O L

Page 7: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

© 2 0 1 1 C O

selecting a property package that contains the desired compounds and property calculations. In this case, the property package alkanes in the TEA property package manager has the desired content for the density calculation.

Figure 10: Browsing the property package alkanes reveals it can calculate the density of liquid mixtures of hexane, heptane and octane.

M S O L 7 | F L O W A N D M I X I N G I N TW O TA N K S

Page 8: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

8 | F L O

The wizard moves on to prompt for the selection of properties and compounds.

Figure 11: Indicated selections set up a calculation for the density of a mixture of hexane, heptane, and octane.

After the mixture phase has been chosen, the wizard displays the function that will be set up along with the associated arguments.

Figure 12: The calculating the density requires the temperature, pressure, and mass fractions of the liquid mixture as input arguments.

W A N D M I X I N G I N TW O TA N K S © 2 0 1 1 C O M S O L

Page 9: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

© 2 0 1 1 C O

Exiting the wizard generates a function child node under the associated Property Package feature. The function can be used directly in COMSOL Multiphysics in the same way as standard functions. Here the property function rho_mix is used in the Material Stream Type feature.

Figure 13: The CAPE-OPEN wizard generates a function for calculating the mixture density that can be used in the Material Stream Type node.

Results and Discussion

Figure 14 shows the flow rates in the different streams. Stream 1 going from the Feed unit to Tank 1 has the constant value of 5 kg/s. Stream 2 initially flow from Tank 2 to Tank 1. After ~26 s the flow changes direction. Connecting Tank 2 with the Product

M S O L 9 | F L O W A N D M I X I N G I N TW O TA N K S

Page 10: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

10 | F L O

unit, Stream 3 decreases it’s flow rate as the tank is drained. After ~450 s all streams have converged to the value of the inlet stream 5 kg/s.

Figure 14: The material flow in Stream 2 changes direction after ~26 seconds.

W A N D M I X I N G I N TW O TA N K S © 2 0 1 1 C O M S O L

Page 11: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

© 2 0 1 1 C O

Streams 1 and 2 have the same flow rate and direction after ~38 s. This coincides with the maximum mass contained in Tank 1, as illustrated in Figure 15.

Figure 15: The total mass contained in Tank 1 and 2 as function of time.

Figure 16 shows the mass fractions of hexane, heptane, and octane in Tank 2. Initially, this tank contains pure hexane. However, after flow reversal in Stream 2, the tank starts

M S O L 11 | F L O W A N D M I X I N G I N TW O TA N K S

Page 12: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

12 | F L O

accepting a mixture of compounds from Tank 1, with the composition converging on the composition of the Feed.

Figure 16: Composition of Tank 2 as function of time.

W A N D M I X I N G I N TW O TA N K S © 2 0 1 1 C O M S O L

Page 13: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

© 2 0 1 1 C O

The density change with changing composition is shown in Figure 17. The density calculations are performed by the external thermo software TEA, integrated into the flowsheet model by means of the COMSOL CAPE-OPEN interface.

Figure 17: Mixture density in Tank 1 and Tank 2.

Model Library path: Chemical_Engineering_Flowsheet_Module/Tutorial_Models/two_tanks

Notes About the COMSOL Implementation

The example model is first set up using a constant density for the liquid mixture. In a second step, an external density calculation is performed by means of the CAPE-OPEN interface. This calculation requires that the thermo software TEA is installed locally on your computer. The TEA software is free to download from the web (Ref. 1).

M S O L 13 | F L O W A N D M I X I N G I N TW O TA N K S

Page 14: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

14 | F L O

Reference

1. www.cocosimulator.org

Modeling Instructions

M O D E L W I Z A R D

1 Go to the Model Wizard window.

2 Click the 0D button.

3 Click Next.

4 In the Add physics tree, select Chemical Species Transport>Flowsheet (flsh).

5 Click Add Selected.

6 Click Next.

7 In the Studies tree, select Preset Studies>Time Dependent.

8 Click Finish.

F L O W S H E E T

Start by adding all the unit operations to the model.

Feed 1In the Model Builder window, right-click Model 1>Flowsheet and choose Feed.

Tank 1In the Model Builder window, right-click Flowsheet and choose Tank.

Tank 2In the Model Builder window, right-click Flowsheet and choose Tank.

Product 1In the Model Builder window, right-click Flowsheet and choose Product.

Next, add a Material Stream Type feature, define the compounds, and connect the unit operations with Streams.

Material Stream Type 11 In the Model Builder window, right-click Flowsheet and choose Material_stream_type.

2 Go to the Settings window for Material Stream Type.

3 Locate the Compounds section. Click Add.

W A N D M I X I N G I N TW O TA N K S © 2 0 1 1 C O M S O L

Page 15: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

© 2 0 1 1 C O

4 In the Compounds table, enter the following settings:

5 Locate the Properties section. In the ρtot edit field, type 665.

6 Locate the Streams section. Click Add.

7 In the Streams table, enter the following settings:

Connecting the unit operations makes them aware of the compounds carried on the material streams. The settings and equations of the unit operations are therefore updated. Go through the unit operations to specify operating conditions and initial states.

Feed 11 In the Model Builder window, click Feed 1.

2 Go to the Settings window for Feed.

3 Locate the Feed section. In the f edit field, type 5.

4 In the Feed table, enter the following settings:

Tank 11 In the Model Builder window, click Tank 1.

2 Go to the Settings window for Tank.

SPECIES NAMES

C6

C6

C8

NAME FROM TO

Stream1 feed1 tank1

Stream2 tank1 tank2

Stream3 tank2 prod1

SPECIES NAMES INITIAL MASS FRACTION

C6 0.2

C7 0.3

C8 0.5

M S O L 15 | F L O W A N D M I X I N G I N TW O TA N K S

Page 16: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

16 | F L O

3 Locate the Initial State section. In the Initial State table, enter the following settings:

The tank is empty at time zero.

4 Locate the Initial State section. In the Initial State table, enter the following settings:

Enter a non-zero initial compound concentration to avoid that the external density calculation fails during initialization.

Tank 21 In the Model Builder window, click Tank 2.

2 Go to the Settings window for Tank.

3 Locate the Initial Values section. In the Initial Values table, enter the following settings:

Move on to solve the flowsheet model.

S T U D Y 1

Step 1: Time Dependent1 In the Model Builder window, expand the Study 1 node, then click Step 1: Time

Dependent.

2 Go to the Settings window for Time Dependent.

3 Locate the Study Settings section. In the Times edit field, type range(0,1,600).

Solver 11 In the Model Builder window, right-click Study 1 and choose Show Default Solver.

2 In the Model Builder window, expand the Solver 1 node, then click Time-Dependent

Solver 1.

3 Go to the Settings window for Time-Dependent Solver.

SPECIES NAMES INITIAL MASS

C6 0

SPECIES NAMES INITIAL MASS FRACTION

C6 1/3

C7 1/3

C8 1/3

SPECIES NAMES INITIAL MASS FRACTION

C6 1

W A N D M I X I N G I N TW O TA N K S © 2 0 1 1 C O M S O L

Page 17: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

© 2 0 1 1 C O

4 Click to expand the Absolute Tolerance section.

5 In the Tolerance edit field, type 1e-6.

6 In the Model Builder window, right-click Study 1 and choose Compute.

R E S U L T S

Create plots for the stream flow rates, the total mass in the tanks, and the compound concentrations in tank 2.

1D Plot Group 11 In the Model Builder window, expand the 1D Plot Group 1 node, then click Global 1.

2 Go to the Settings window for Global.

3 Locate the y-Axis Data section. In the y-axis data table, enter the following settings:

4 In the Model Builder window, click 1D Plot Group 1.

5 Go to the Settings window for 1D Plot Group.

6 Locate the Plot Settings section. Select the y-axis label check box.

7 In the associated edit field, type Flow rate [kg/s].

8 Click the Plot button.

1D Plot Group 21 In the Model Builder window, right-click Results and choose 1D Plot Group.

2 Right-click Results>1D Plot Group 2 and choose Global.

3 Go to the Settings window for Global.

4 In the upper-right corner of the y-Axis Data section, click Add Expression.

5 From the menu, choose Flowsheet>Total mass (mod1.flsh.tank1_mtot).

6 In the upper-right corner of the y-Axis Data section, click Add Expression.

7 From the menu, choose Flowsheet>Total mass (mod1.flsh.tank2_mtot).

8 Locate the y-Axis Data section. In the y-axis data table, enter the following settings:

EXPRESSION DESCRIPTION

mod1.flsh.tank1_inlet_f Stream 1

mod1.flsh.tank1_outlet_f Stream 2

mod1.flsh.tank2_outlet_f Stream 3

DESCRIPTION

Tank 1

Tank 2

M S O L 17 | F L O W A N D M I X I N G I N TW O TA N K S

Page 18: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

18 | F L O

9 In the Model Builder window, click 1D Plot Group 2.

10 Go to the Settings window for 1D Plot Group.

11 Locate the Plot Settings section. Select the y-axis label check box.

12 In the associated edit field, type Total mass [kg].

13 Click the Plot button.

1D Plot Group 31 In the Model Builder window, right-click Results and choose 1D Plot Group.

2 Right-click Results>1D Plot Group 3 and choose Global.

3 Go to the Settings window for Global.

4 In the upper-right corner of the y-Axis Data section, click Add Expression.

5 From the menu, choose Flowsheet>Mass fraction (mod1.flsh.tank2_wC6).

6 In the upper-right corner of the y-Axis Data section, click Add Expression.

7 From the menu, choose Flowsheet>Mass fraction (mod1.flsh.tank2_wC7).

8 In the upper-right corner of the y-Axis Data section, click Add Expression.

9 From the menu, choose Flowsheet>Mass fraction (mod1.flsh.tank2_wC8).

10 Locate the y-Axis Data section. In the y-axis data table, enter the following settings:

11 In the Model Builder window, click 1D Plot Group 3.

12 Go to the Settings window for 1D Plot Group.

13 Locate the Plot Settings section. Select the y-axis label check box.

14 In the associated edit field, type Mass fraction, Tank 2.

15 Click the Plot button.

Now, add the CAPE-OPEN interface to set up an external property calculation for the mixture density. Note that the following instructions assume that you have the TEA thermo software installed locally on your computer.

CAPE-OPEN Interface

1 In the Model Builder window, right-click the top node and choose Add CAPE-OPEN

Interface.

DESCRIPTION

Hexane

Heptane

Octane

W A N D M I X I N G I N TW O TA N K S © 2 0 1 1 C O M S O L

Page 19: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

© 2 0 1 1 C O

2 In the Model Builder window, right-click CAPE-OPEN and choose Single-Phase

Property.

3 Go to the Settings window for CAPE-OPEN Wizard.

4 Locate the Property Packages section. In the Property Packages tree, select TEA

(CAPE-OPEN 1.1)>alkanes.

5 Click Next.

6 Click the Mass basis button.

This returns the calculated density in kg/mol.

7 In the Available properties list, select density.

8 Click Add Selected.

9 Click Next.

10 In the Available compound list, select N-hexane, N-heptane, and N-octane.

11 Click Add Selected.

12 Click Next.

13 From the Phases list, select Liquid.

14 Click the Mass fraction button.

This specifies the composition arguments for the calculation.

15 Click Finish.

Single-Phase Property 1 (density_N_hexane_N_heptane_N_octane_Liquid_mix)1 In the Model Builder window, click CAPE-OPEN>Property Package 1

(alkanes)>Single-Phase Property 1

(density_N_hexane_N_heptane_N_octane_Liquid_mix).

2 Go to the Settings window for Single-Phase Property.

3 Locate the Function Name section. In the Function name edit field, type rho_mix.

Next, specify the density of the material streams using the external property function rho_mix, and then re-solve the problem.

F L O W S H E E T

Material Stream Type 11 In the Model Builder window, expand the Model 1>Flowsheet node, then click Material

Stream Type 1.

2 Go to the Settings window for Material Stream Type.

M S O L 19 | F L O W A N D M I X I N G I N TW O TA N K S

Page 20: Models.cefs.Two Tanks

Solved with COMSOL Multiphysics 4.2a

20 | F L O

3 Locate the Properties section. In the ρtot edit field, type rho_mix(300,101325,wC6,wC7,wC8).

S T U D Y 1

In the Model Builder window, right-click Study 1 and choose Compute.

Create a plot of the mixture density in the two tanks.

R E S U L T S

1D Plot Group 41 In the Model Builder window, right-click Results and choose 1D Plot Group.

2 Right-click Results>1D Plot Group 4 and choose Global.

3 Go to the Settings window for Global.

4 Locate the y-Axis Data section. In the y-axis data table, enter the following settings:

5 In the Model Builder window, click 1D Plot Group 4.

6 Go to the Settings window for 1D Plot Group.

7 Locate the Plot Settings section. Select the y-axis label check box.

8 In the associated edit field, type Density.

9 Click the Plot button.

EXPRESSION DESCRIPTION

mod1.flsh.tank1_mtot/mod1.flsh.tank1_V Tank 1

mod1.flsh.tank2_mtot/mod1.flsh.tank2_V Tank 2

W A N D M I X I N G I N TW O TA N K S © 2 0 1 1 C O M S O L