Mastering Twophaseeulerfoam Four: Two-Phase Stirred Tank Reactor
Mastering Twophaseeulerfoam Four: Two-Phase Stirred Tank Reactor
Compatible OpenFOAM® 7
with OpenFOAM® v1912
Author
Hamidreza Norouzi
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
Amirkabir University of Technology Center of Engineering and Multiscale Modeling of Fluid Flow
License Agreement
This material is licensed under (CC BY-SA 4.0), unless otherwise stated.
[Link]
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
You are free to:
Share — copy and redistribute the material in any medium or format
Adapt — remix, transform, and build upon the material
The licensor cannot revoke these freedoms as long as you follow the license terms.
Notices:
You do not have to comply with the license for elements of the material in the public domain
or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary for
your intended use. For example, other rights such as publicity, privacy, or moral rights may
limit how you use the material.
Extra consideration:
This document is developed to teach how to use OpenFOAM® software. The document has
gone under several reviews to reduce any possible errors, though it may still have some. We
will be glad to receive your comments on the content and error reports through this address:
[Link]@[Link]
1
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
Document history
Revision Description Date
Rev1 The tutorial was reviewed and the simulation was performed using May 1, 2020
OpenFOAM® v1912
Rev0 First draft was prepared and run with OpenFOAM ® 7 April 25, 2020
2
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
Table of Contents
Prerequisites ................................................................................................................................................. 4
How to get simulation setup files? ............................................................................................................... 4
1. Brief Description of twoPhaseEulerFoam ................................................................................................. 5
2. Problem definition .................................................................................................................................... 5
3. MRF ........................................................................................................................................................... 6
4. Simulation setup ....................................................................................................................................... 7
4.1. Physical properties of phases............................................................................................................. 7
4.2. Defining phases and interphase coupling parameters ...................................................................... 8
4.3. Turbulence properties of phases ................................................................................................. 11
4.4. Gravitational acceleration ................................................................................................................ 11
4.5. Generating geometry and mesh ...................................................................................................... 12
4.5.1. blockMesh for creating the background mesh ......................................................................... 12
4.5.2. snappyHexMesh for creating the final mesh ............................................................................ 13
4.6. Defining rotating zone ..................................................................................................................... 18
4.7. Defining sparger ............................................................................................................................... 19
4.8. Boundary and initial conditions ....................................................................................................... 22
5. Running the simulation ....................................................................................................................... 23
6. Results ................................................................................................................................................. 24
3
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
Prerequisites
Basic simulation setup of a bubble column using twoPhaseEulerFoam solver.
You need to know the basics of snappyHexMesh utility for creating the mesh.
Most of the model setup settings and physical properties are similar to what is simulated
in tutorial “Mastering twoPhaseEulerFoam, Three: Bubble Column,” so you are referred to
this document several times in this tutorial.
4
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
In the case of gas-liquid systems, laminar and turbulence models (RAS and LES) models can
be selected for both phases. In this case of gas-solid or liquid solid systems, these models can only
be applied for the fluid phase. The solid phase momentum equation incorporates a model for the
stress tensor. Two main approaches are possible: inviscid solid phase with a pressure model and
a solid phase with stress tensor that is obtained by KTGF theory and frictional models.
Various sub-models for interphase coupling are also provided that make it possible to select
a wide range of physical models for the system. It is also possible to extend the standard solver to
include new sub-models in the simulation.
2. Problem definition
The stirred tank reactor in this tutorial has a cylindrical shell with inner diameter of 0.4 m
and height of 0.35 m. The bottom cap is a 2:1 ellipse (radius1 is 0.2 m and radius2 is 0.1 m) and
top of this cylinder is open to atmosphere. A four-bladed impeller is located in the middle of the
reactor to provide the mixing force. This impeller rotates with at 120 RPM. The surface geometries
of this mixer and the reactor vessel are provided in the form of stl files. The vessel is initially filled
up to 0.15 m with water at 300 K. Air enters the reactor through a sparger located beneath the
impeller at the bottom of the reactor.
In this tutorial you will learn how to simulate such a reactor system using multiple reference
frame (MFR) method. Other properties and operating conditions are given in Table 1. In this
5
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
tutorial it is tried to keep important details (not all details) of the such systems while keeping the
whole geometry simple enough to obtain reasonable execution time for the final case.
3. MRF
Rotating walls can be simulated using multiple reference frame (MRF). In this method, the
whole region is sub-divided into one or more rotating zones and one stationary zone. This
approach considers the rotation of wall (impeller) without moving the mesh by making necessary
changes in the momentum equation. The velocity field with respect to inertial frame (stationary
zone) is 𝑢
⃗ and the relative velocity in the rotating zone is 𝑢
⃗ 𝑟 . The absolute velocity and relative
velocity in each zone are related as:
𝑢
⃗𝑟 =𝑢 ⃗⃗ × 𝑟)
⃗ − (Ω
⃗⃗ is the rotation speed and 𝑟 is the vector pointing from rotation center to the point of
where Ω
evaluation of relative velocity.
The momentum equation is solved for absolute velocity with convective fluxes that accounts
for the rotation of the rotating zones (by making fluxed relative to stationary frame in all zones).
The left-hand side of momentum equation (for a single phase flow) becomes:
𝜕
(𝜌𝑢
⃗ ) + ∇. (𝜌𝑢 ⃗ ) + 𝜌(⃗Ω × 𝑢
⃗ 𝑟𝑢 ⃗ ) = 𝑅𝐻𝑆
𝜕𝑥
⃗⃗ × 𝑢
where 𝜌(Ω ⃗ ) is the Coriolis force. The face fluxed are made relative by the following equation:
⃗⃗ × 𝑟)𝑆
𝑝ℎ𝑖𝑟 = 𝑝ℎ𝑖 − 𝜌(Ω
6
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
⃗⃗ =0)
where the relative flux of cells and relative velocity of the cells located in the stationary zone (Ω
are reduce to absolute flux and velocity.
4. Simulation setup
Physical properties of both phases and phase coupling models are first specified and then
you will learn how to generate the mesh, to define MRF in the simulation, and to define an
injection region as the sparger.
constant/[Link]
thermoType
{
type heRhoThermo;
mixture pureMixture;
transport const;
thermo hConst;
equationOfState perfectGas;
specie specie;
energy sensibleInternalEnergy;
}
mixture
{
specie
{
molWeight 28.9;
}
thermodynamics
{
Cp 1007;
Hf 0;
}
transport
{
mu 1.84e-05;
Pr 0.7;
}
}
7
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
constant/[Link]
thermoType
{
type heRhoThermo;
mixture pureMixture;
transport const;
thermo eConst;
equationOfState perfectFluid;
specie specie;
energy sensibleInternalEnergy;
}
mixture
{
specie
{
molWeight 18;
}
equationOfState
{
R 3000;
rho0 1027;
}
thermodynamics
{
Cv 4195;
Hf 0;
}
transport
{
mu 3.645e-4;
Pr 2.289;
}
}
constant/phaseProperties
phases (air water);
air
{
diameterModel isothermal;
isothermalCoeffs
{
d0 3e-3;
p0 101325;
}
8
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
residualAlpha 1e-6;
}
water
{
diameterModel constant;
constantCoeffs
{
d 1e-4;
}
residualAlpha 1e-6;
}
blending
{
default
{
type linear;
[Link] 0.3;
[Link] 0.5;
[Link] 0.3;
[Link] 0.5;
}
heatTransfer
{
type linear;
[Link] 0.3;
[Link] 0.7;
[Link] 0.3;
[Link] 0.7;
}
}
sigma
(
(air and water) 0.072
);
aspectRatio
(
(air in water)
{
type Wellek;
}
(water in air)
{
type constant;
E0 1.0;
}
);
drag
(
(air in water)
{
9
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
type IshiiZuber;
residualRe 1e-3;
swarmCorrection
{
type none;
residualAlpha Tomiyama;
l 1.75;
}
}
(water in air)
{
type SchillerNaumann;
residualRe 1e-3;
swarmCorrection
{
type none;
}
}
virtualMass
(
(air in water)
{
type constantCoefficient;
Cvm 0.5;
}
(water in air)
{
type constantCoefficient;
Cvm 0.5;
}
);
heatTransfer
(
(air in water)
{
type RanzMarshall;
residualAlpha 1e-4;
}
(water in air)
{
type RanzMarshall;
residualAlpha 1e-4;
10
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
}
);
lift
(
(air in water)
{
type constantCoefficient;
Cl 0.25;
}
(water in air)
{
type none;
}
);
wallLubrication
(
);
turbulentDispersion
(
);
constant/[Link]
simulationType laminar;
constant/[Link]
simulationType laminar;
constant/g
dimensions [0 1 -2 0 0 0 0];
value (0 -9.81 0);
11
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
refining, cutting and conforming the mesh on the triangulated surfaces that are provided
to the program: here impeller blade and vessel surfaces.
> blockMesh
system/blockMeshDict
convertToMeters 1;
vertices
(
( -0.21 -0.16 -0.21)
( 0.21 -0.16 -0.21)
( 0.21 0.3 -0.21)
( -0.21 0.3 -0.21)
( -0.21 -0.16 0.21)
( 0.21 -0.16 0.21)
( 0.21 0.3 0.21)
( -0.21 0.3 0.21)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (42 46 42) simpleGrading (1 1 1)
);
edges
(
);
12
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
boundary
(
allBoundary
{
type patch;
faces
(
(0 4 7 3)
(2 6 5 1)
(1 5 4 0)
(0 3 2 1)
(4 5 6 7)
);
}
outlet
{
type patch;
faces
(
(3 7 6 2)
);
}
);
13
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
Note
The axial shaft of the impeller system is not considered here to resolve the impeller
surface with a less number of cells.
Splitting of cells starts with the edge features (eMesh file) that the user supplies in
snappyHexMeshDict file. sufraceFeatureExtractDict utility is used to extract edge features
from stl surfaces. The corresponding dictionary is as follows:
system/surfaceFeatrueExtractDict
[Link]
{
extractionMethod extractFromSurface;
extractFromSurfaceCoeffs
{
includedAngle 150;
}
}
[Link]
{
extractionMethod extractFromSurface;
extractFromSurfaceCoeffs
{
includedAngle 150;
}
}
Two separate files, [Link] and [Link], are explored to find surface edges. Those
edges whose angle are less than includedAngle, will be considered as the edges that will be
refined in the mesh generation step. The result of this step is saved in an eMesh file. Execute the
following command to create eMesh files for your surfaces:
> sufraceFeatureExtract
14
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
The settings for snappyHexMesh utility can be found in system/snappyHexMeshDict file. The
first part of this file is as follows:
castellatedMesh true;
snap true;
addLayers false;
geometry
{
impeller
{
type triSurfaceMesh;
file "[Link]";
}
vessel
{
type triSurfaceMesh;
file "[Link]";
}
//- Used to define MRF zone and to refine mesh round the impeller
MRF
{
type searchableCylinder;
point1 (0.0 -0.04 0.0);
point2 (0.0 0.04 0.0);
radius 0.11;
}
}
The first three lines specify which step should be performed. Steps castellation and snapping will
be performed and layering will be bypassed. In geometry sub-dictionray, all the geometry entities
that will be used in the meshing process are defined. The first two, impeller and vessel, are
created from stl files. The last one, MRF, is created using the built-in geometry entity,
searchableCylinder. It only requires you to define the first and last point of the cylinder axis
and its radius. This cylinder will be later utilized for defining the MRF zone.
Sub-dictionary castellatedMeshControls defines all the features (edges), surfaces and regions
refinement parameters. In sub-dictionary features, extracted surface features (edges) are
15
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
addressed to be split up to a defined level. Here, cells at [Link] surface features are split
at level 0 (cells as large as background mesh) and cells at [Link] surface feature are
split at level 1. Entry resolveFeatureAngle controls the local curvature of the surface features.
If you use high values for resolveFeatureAngle, surface features (edges) with high curvature will
not be captured in the final mesh.
castellatedMeshControls
{
maxLocalCells 100000;
maxGlobalCells 2000000;
minRefinementCells 0;
nCellsBetweenLevels 2;
maxLoadUnbalance 0.10;
features
(
{
file "[Link]";
level 0;
}
{
file "[Link]";
level 1;
}
);
resolveFeatureAngle 30;
refinementSurfaces
{
MRF
{
level (1 1);
cellZone cellMRFzone;
faceZone faceMRFzone;
cellZoneInside inside;
}
impeller
{
level (1 1);
}
vessel
{
level (0 0);
16
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
}
}
refinementRegions
{
MRF
{
mode inside;
levels ((1E15 1));
}
allowFreeStandingZoneFaces true;
}
In sub-dictionary refinementRegions, the cells inside the MRF surface are selected to be
refined at level 1. This part refines cells that are far from the MRF surface and surface features of
impeller (it refines cells in the bulk of the region).
The final mesh and the cell zone cellMRFZone are illustrated in the figure below.
17
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
surface mesh
of vessel
cellMRFZone
Figure 2: (left) vessel surface and MRF zone and (right) final mesh of the vessel and impeller.
constant/MRFProperties
MRFImpeller
{
cellZone cellMRFzone;
active yes;
// Fixed patches (by default they 'move' with the MRF zone)
nonRotatingPatches ();
18
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
𝐷
𝜑 = 𝑆(𝜑)
𝐷𝑡
where is the dependent field variable for which the conservation equation is solved and 𝑆(𝜑) is
the source term that is decomposed (linearized) into two explicit and implicit parts:
𝑆(𝜑) = 𝑆𝑢 + 𝑆𝑝 𝜑
where 𝑆𝑢 is the explicit source term component and 𝑆𝑝 is the implicit source term component.
system/fvOptions
injector1
{
timeStart 0.0;
duration 30;
selectionMode cellSet;
cellSet injection1;
}
options
{
massSource1
{
type scalarSemiImplicitSource;
$injector1;
volumeMode absolute;
injectionRateSuSp
{
thermo:[Link] (3.0e-4 0); // kg/s
}
}
1
Other applications of fvOptions
19
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
momentumSource1
{
type vectorSemiImplicitSource;
$injector1;
volumeMode absolute;
injectionRateSuSp
{
[Link] ((0 -1.0e-6 0) 0); // kg*m/s^2
}
}
energySource1
{
type scalarSemiImplicitSource;
$injector1;
volumeMode absolute;
injectionRateSuSp
{
[Link] (90 0); // kg*m^2/s^3
}
}
}
injector1 is an inline sub-dictionary that defines the duration of source term (here from the start
of simulation up to 30 s) and the collection of cells that the source term is applied for (here, cell
set injection1). The process of creating a cell set injection1 will be described later.
Three conservation equation are solved for the gas phase for which you must apply the
source term: continuity, momentum and energy equation (here sensible internal energy based on
the settings in file [Link]). In table below you will see variable for each
equation and the units of each source term component (if volumeMode is absolute2):
2
the other option for volumeMode is specific in which the source term is a volumetric term.
20
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
In the injectionRateSuSp sub-dictionaries, you must supply the name of primitive field of the
conservation PDE. For continuity equation, the primitive field is thermo:[Link]; for momentum
equation, [Link]; and for energy equation [Link]. In front of the primitive field name specify the
source term components, the first value in the parentheses is 𝑆𝑢 and the second one is 𝑆𝑝 .
The cell set injection1 is used to define a set of cells that the source term is applied for (here, it
is the sparger). To create this cell set, you need to use topoSet utility. The settings can be found
in system/topoSetDict file.
system/topoSetDict
actions
(
{
name injection1;
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (-0.02 -0.13 -0.02) (0.02 -0.12 0.02);
}
}
);
A new cell set with name injection1 will be created whose cells are inside the box with minimax
points (-0.02 -0.13 -0.02) and (0.02 -0.12 0.02). Execute the following command to create
this cell set:
> topoSet
21
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
inletOutlet condition is applied for outlet patch to prevent reverse flow into the tank. The
impeller is treated as a fixed wall, as we know that in MRF method, the impeller is assumed to be
fixed with no-slip condition on the surface. For volume fraction fields zeroGradient is applied at
walls and fixedFluxPressure, for p_rgh field.
The reactor should be initially filled with water up to 0.15 m. setFields utility is used to
create an initial (non-uniform) patch for phase volume fraction. The settings can be found in
system/setFieldsDict.
22
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
system/setFieldsDict
defaultFieldValues
(
volScalarFieldValue [Link] 1
volScalarFieldValue [Link] 0
);
regions
(
boxToCell
{
box (-0.21 -0.2 -0.21) (0.21 0.15 0.21);
fieldValues
(
volScalarFieldValue [Link] 0
volScalarFieldValue [Link] 1
);
}
);
The default settings are first applied for all cells and then the values specified in the regions entry
overwrite the default values. Here, the default settings are air = 1 and water = 0, which create and
an empty tank. Then, volume fractions of the cells reside in the cuboid box defined by two points
(-0.21 -0.2 -0.21) and (0.21 0.15 0.21) are set to air = 0.0 and water = 1.0. Execute the
> mkdir 0
> cp [Link]/* 0/
> setFields
> twoPhaseEulerFoam
A summary of all commands to run this simulation is listed below for your reference.
> blockMesh
> snappyHexMesh -overwrite
> topoSet
> mkdir 0
> cp [Link]/* 0/
> setFields
23
Mastering
twoPhaseEulerFoam
Four: Two-Phase Stirred Tank Reactor
> twoPhaseEulerFoam
6. Results
Some snapshots of the bubble column simulation are presented here.
0 sec
2 sec
10 sec
Figure 3: (left) water volume fraction contour on a plate at the center of the vessel and (right) the
velocity contour on a cross-sectional plane near the impeller.
24