10 ExampleTen
10 ExampleTen
This offering is not approved or endorsed by ESI® Group, ESI-OpenCFD® or the OpenFOAM®
Foundation, the producer of the OpenFOAM® software and owner of the OpenFOAM® trademark.
OpenFOAM® Basic Training
Tutorial Ten
Background
In this tutorial we will carry out Residence Time Distribution (RTD) analysis of fluid flow through
a T-junction pipe.
Residence time distribution is a probability distribution function that provides information about the
amount of time a tracer element spends within a process unit, such as a reactor or a column. RTD
analysis is important because in almost all real-life processes, the mixing is not ideal and chemical
engineers will need RTD to analyze the real mixing characteristics inside for example, a
continuously stirred reactor. They can also use RTD analysis and to obtain information about the
flow pattern, back mixing and bypassing behavior of a process unit.
2. Tracer Analysis
Sometimes a radioactive tracer is usually used to determine RTD of a process unit. Based on the
above diagram, first the tracer is injected into the inlet, and then the exit tracer concentration, ,
is measured at regular time intervals. This allows the exit age distribution, , to be calculated.
It is clear from the above equation that the fraction of tracer molecules exiting the reactor that have
spent a time between and in the process unit is . Since all tracer elements will leave
the unit at some point, RTD satisfies the following relationship:
∫
OpenFOAM® Basic Training
Tutorial Ten
Simulation
Use the simpleFoam and scalarTransportFoam to simulate the flow through a square cross section T
pipe and calculate RTD (Residence Time Distribution) for both inlets using a step function
injection:
Objectives
Data processing
Plot the step response function and the RTD curve.
OpenFOAM® Basic Training
Tutorial Ten
1. Pre-processing
$FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily
1.2. 0 directory
Update p, U, nut, nuTilda, k and epsilon files with the new boundary conditions, e.g. U:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
dimensions [0 1 -1 0 0 0 0];
boundaryField
{
inlet_one
{
type fixedValue;
value uniform (0.1 0 0)
}
inlet_two
{
type fixedValue;
value uniform (-0.2 0 0)
}
outlet
{
type zeroGradient;
}
walls
{
type fixedValue;
value uniform (0 0 0)
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
turbulence on;
printCoeffs on;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
vertices
(
OpenFOAM® Basic Training
Tutorial Ten
(0 4 0) // 0
(0 3 0) // 1
(3 3 0) // 2
(3 0 0) // 3
(4 0 0) // 4
(4 3 0) // 5
(7 3 0) // 6
(7 4 0) // 7
(4 4 0) // 8
(3 4 0) // 9
(0 4 1) // 10
(0 3 1) // 11
(3 3 1) // 12
(3 0 1) // 13
(4 0 1) // 14
(4 3 1) // 15
(7 3 1) // 16
(7 4 1) // 17
(4 4 1) // 18
(3 4 1) // 19
);
blocks
(
hex (0 1 2 9 10 11 12 19) (10 30 10) simpleGrading (1 1 1)
hex (9 2 5 8 19 12 15 18) (10 10 10) simpleGrading (1 1 1)
hex (8 5 6 7 18 15 16 17) (10 30 10) simpleGrading (1 1 1)
hex (2 3 4 5 12 13 14 15) (30 10 10) simpleGrading (1 1 1)
);
edges
(
);
patches
(
patch inlet_one
(
(0 10 11 1)
)
patch inlet_two
(
(7 6 16 17)
)
patch outlet
(
(4 3 13 14)
)
wall walls
(
(0 1 2 9)
(2 5 8 9)
(5 6 7 8)
(2 3 4 5)
(10 19 12 11)
(19 18 15 12)
(18 17 16 15)
(15 14 13 12)
(0 9 19 10)
(9 8 18 19)
(8 7 17 18)
(2 1 11 12)
(3 2 12 13)
(5 4 14 15)
(6 5 15 16)
)
);
mergePatchPairs
(
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
OpenFOAM® Basic Training
Tutorial Ten
2. Running simulation
>blockMesh
>simpleFoam
Wait for simulation to converge. After convergency check the results to be sure the solution is
converged.
>foamToVTK
The simulation results are as follows (results are on the cut plane in the middle):
3. RTD calculation
$FOAM_TUTORIALS/basic/scalarTransportFoam/pitzDaily
3.2. 0 directory
Delete the U file and replace it with the calculated velocity field from the first part of the tutorial
(use the latest time step velocity field from previous part of simulation to calculate RTD for this
geometry). There is no need to modify or change it. The solver will use this field to calculate the
scalar transportation.
OpenFOAM® Basic Training
Tutorial Ten
Update T (T will be used as an inert scalar in this simulation) file boundary conditions to match new
simulation boundaries, to calculate RTD of the inlet_one set the internalField value to 0, T
value for inlet_one to 1.0 and T value for inlet_two to 0.
4. Running Simulation
>blockMesh
>scalarTransportFoam
>foamToVTK
5. Post-processing
>foamToVTK
Load the outlet VTK file into paraview using following path:
File > Open > VTK > outlet > outlet_..vtk > OK > Apply
Select T from variables menu, and then integrate the variables on the outlet:
Filters > Data Analysis > Integrate Variables > Apply
The values given in the opened window are integrated values in this specific time step. By changing
the time step values for different time steps are displayed. As mentioned before, the average value
of the property is needed. Therefore, these values should be divided by outlet area to get average
values (1m 1m).
The same procedure should be followed for calculating RTD of inlet_two, except T value for
inlet_one should be 0 and for inlet_two it should be 1.0.
OpenFOAM® Basic Training
Tutorial Ten
The average value of T for each outlet approaches a certain constant value, which is the ratio of that
scalar mass inlet to the whole mass inlet. For plotting data over time “Plot Selection Over Time”
option in ParaView can be used, in the opened SpreadSheetView window (IntegrateVariables)
select the set of data which you want to plot over time and then:
Filters > Data Analysis > Plot Selection Over Time > Apply
Next, to obtain the RTD plots, simply calculate the gradient of change in average value of T on the
outlet from time 0 to 120s, export the data to Excel, and plot the results.