Virtual Tracer Test

Different types of virtual tracer tests

In order to perform a virtual tracer test, several methods are available in CFD:

  • inject some particles with the same density than the fluid and follow their trajectories (Lagrangian approach)

  • solve a passive scalar transport equation. This can be achieved using two approaches:

    • transient fluid: the transport equation is coupled to the hydrodynamic solver

    • static fluid: the velocity and turbulence fields from a previous hydrodynamic simulation are used but only the scalar transport equation is solved. We will use this approach as this is the one requiring the less computational effort.

The passive scalar equation consists of one advective term and one diffusion term:

\(\frac{\partial T}{\partial t}+(\nabla \cdot \mathbf{U}T)-\nabla^2 (DT)=0\)

where:

  • T is the transported scalar

  • U is fluid velocity and

  • D is the diffusion coefficient

AttentionTurbulence

The diffusion coefficient in this equation only refers to molecular (constant) diffusion. How to take turbulent diffusion into account?

MéthodeSetting up a case for scalarTransportFoam

This solver is probably the easier to use in OpenFOAM. Simply create a new case folder with the 0, constant and system folders.

In the 0 folder:

  1. Copy the U file from your previous hydrodynamic simulation, this will define the advective velocity of your tracer.

  2. Add a T file adapted to your case (example below). Note the specific boundary condition simulating a pulse tracer injection at the inlet.

1
/*--------------------------------*- C++ -*----------------------------------*\
2
| =========                 |                                                 |
3
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
4
|  \\    /   O peration     | Version:  2.3.0                                 |
5
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
6
|    \\/     M anipulation  |                                                 |
7
\*---------------------------------------------------------------------------*/
8
FoamFile
9
{
10
    version     2.0;
11
    format      ascii;
12
    class       volScalarField;
13
    object      T;
14
}
15
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
16
17
dimensions      [0 0 0 1 0 0 0];
18
19
internalField   uniform 0;
20
21
boundaryField
22
{
23
    inlet
24
    {
25
        type            uniformFixedValue;
26
	uniformValue	table
27
	(
28
		(0	0.0)
29
		(2	0.0)
30
		(3	100)
31
		(13	100)
32
		(14	0.0)
33
	);
34
    }
35
36
    outlet
37
    {
38
        type            zeroGradient;
39
    }
40
    
41
    walls
42
    {
43
        type            zeroGradient;
44
    }
45
46
    topAndBottom
47
    {
48
        type            empty;
49
    }
50
}
51
52
// ************************************************************************* //

In the system folder, include the controlDict, fvSchemes and fvSolution files:

1
/*--------------------------------*- C++ -*----------------------------------*\
2
| =========                 |                                                 |
3
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
4
|  \\    /   O peration     | Version:  2.3.0                                 |
5
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
6
|    \\/     M anipulation  |                                                 |
7
\*---------------------------------------------------------------------------*/
8
FoamFile
9
{
10
    version     2.0;
11
    format      ascii;
12
    class       dictionary;
13
    location    "system";
14
    object      controlDict;
15
}
16
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17
18
application     scalarTransportFoam;
19
20
startFrom       latestTime;
21
22
startTime       0;
23
24
stopAt          endTime;
25
26
endTime         3000000;
27
28
deltaT          10;
29
30
writeControl    timeStep;
31
32
writeInterval   100;
33
34
purgeWrite      0;
35
36
writeFormat     ascii;
37
38
writePrecision  6;
39
40
writeCompression off;
41
42
timeFormat      general;
43
44
timePrecision   6;
45
46
runTimeModifiable true;
47
48
49
// ************************************************************************* //
50
1
/*--------------------------------*- C++ -*----------------------------------*\
2
| =========                 |                                                 |
3
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
4
|  \\    /   O peration     | Version:  2.3.0                                 |
5
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
6
|    \\/     M anipulation  |                                                 |
7
\*---------------------------------------------------------------------------*/
8
FoamFile
9
{
10
    version     2.0;
11
    format      ascii;
12
    class       dictionary;
13
    location    "system";
14
    object      fvSchemes;
15
}
16
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17
18
ddtSchemes
19
{
20
    default         Euler;
21
}
22
23
gradSchemes
24
{
25
    default         Gauss linear;
26
}
27
28
divSchemes
29
{
30
    default         none;
31
    div(phi,U)      Gauss limitedLinearV 1;
32
    div(phi,T)      Gauss linear;
33
    div(phi,k)      Gauss limitedLinear 1;
34
    div(phi,epsilon) Gauss limitedLinear 1;
35
    div(phi,R)      Gauss limitedLinear 1;
36
    div(R)          Gauss linear;
37
    div(phi,nuTilda) Gauss limitedLinear 1;
38
    div((nuEff*dev(T(grad(U))))) Gauss linear;
39
}
40
41
laplacianSchemes
42
{
43
    default         Gauss linear corrected;
44
}
45
46
interpolationSchemes
47
{
48
    default         linear;
49
}
50
51
snGradSchemes
52
{
53
    default         corrected;
54
}
55
56
fluxRequired
57
{
58
    default         no;
59
    p               ;
60
}
61
62
63
// ************************************************************************* //
64
1
/*--------------------------------*- C++ -*----------------------------------*\
2
| =========                 |                                                 |
3
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
4
|  \\    /   O peration     | Version:  5                                     |
5
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
6
|    \\/     M anipulation  |                                                 |
7
\*---------------------------------------------------------------------------*/
8
FoamFile
9
{
10
    version     2.0;
11
    format      ascii;
12
    class       dictionary;
13
    location    "system";
14
    object      fvSolution;
15
}
16
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17
18
solvers
19
{
20
    T
21
    {
22
        solver          PBiCGStab;
23
        preconditioner  DILU;
24
        tolerance       1e-06;
25
        relTol          0;
26
    }
27
}
28
29
SIMPLE
30
{
31
    nNonOrthogonalCorrectors 0;
32
}
33
34
35
// ************************************************************************* //
36

In the constant folder:

  1. copy the polyMesh directory from your previous simulation (your mesh!)

  2. add a transportProperties file like this:

1
/*--------------------------------*- C++ -*----------------------------------*\
2
| =========                 |                                                 |
3
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
4
|  \\    /   O peration     | Version:  5                                     |
5
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
6
|    \\/     M anipulation  |                                                 |
7
\*---------------------------------------------------------------------------*/
8
FoamFile
9
{
10
    version     2.0;
11
    format      ascii;
12
    class       dictionary;
13
    location    "constant";
14
    object      transportProperties;
15
}
16
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17
18
DT              DT [0 2 -1 0 0 0 0] 0.01;
19
20
21
// ************************************************************************* //