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
Attention : Turbulence
The diffusion coefficient in this equation only refers to molecular (constant) diffusion. How to take turbulent diffusion into account?
Méthode : Setting 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:
Copy the U file from your previous hydrodynamic simulation, this will define the advective velocity of your tracer.
Add a T file adapted to your case (example below). Note the specific boundary condition simulating a pulse tracer injection at the inlet.
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type uniformFixedValue;
uniformValue table
(
(0 0.0)
(2 0.0)
(3 100)
(13 100)
(14 0.0)
);
}
outlet
{
type zeroGradient;
}
walls
{
type zeroGradient;
}
topAndBottom
{
type empty;
}
}
// ************************************************************************* //
In the system folder, include the controlDict, fvSchemes and fvSolution files:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application scalarTransportFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 3000000;
deltaT 10;
writeControl timeStep;
writeInterval 100;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss limitedLinearV 1;
div(phi,T) Gauss linear;
div(phi,k) Gauss limitedLinear 1;
div(phi,epsilon) Gauss limitedLinear 1;
div(phi,R) Gauss limitedLinear 1;
div(R) Gauss linear;
div(phi,nuTilda) Gauss limitedLinear 1;
div((nuEff*dev(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
fluxRequired
{
default no;
p ;
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 5 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
T
{
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-06;
relTol 0;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
}
// ************************************************************************* //
In the constant folder:
copy the polyMesh directory from your previous simulation (your mesh!)
add a transportProperties file like this:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 5 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
DT DT [0 2 -1 0 0 0 0] 0.01;
// ************************************************************************* //