CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Turbulent scalar mixing (https://www.cfd-online.com/Forums/openfoam-solving/148770-turbulent-scalar-mixing.html)

pippo2013 February 19, 2015 05:10

Turbulent scalar mixing
 
Hello Foamers,

I need to modify scalarTransportFoam to take into account turbulent dispersion. I would like to simulate pollutant dispersion around buildings.

but I'm not sure how to modify scalarTransportFoam, any help or example?

I've read this interesting post
http://www.cfd-online.com/Forums/ope...tml#post280210
Unfortunately the link in the post to is not working anymore.

thanks a lot in advance!:)

alexeym February 19, 2015 05:47

Hi,

A few clarifications.

Would you like to calculate velocity & turbulence fields with another solver (let's say pimpleFoam), map these fields to your test case and then use scalarTransportFoam to calculate mixing?

Also you can use scalarTransport function object with other solvers. It can take constant value of diffusivity or calculate it from turbulence model (though in assumption that turbulent Schmidt number is 1 and turbulent diffusivity is much higher than molecular).

pippo2013 February 19, 2015 06:18

Hi Alexeym,

and thanks for your prompt reply!
That's exactly what I would like to do,
I have already computed steady flow field with SIMPLE solver and now I would like to use this solution to understand how a source of pollutant in between two buildings (imposing a fixed gradient as a BC) would mix.
At this stage my simulation is 2D and the pollutant source should be a line.
I would like to simulate turbulent Schmidt numbers ranging from 0.2 to 0.7, however
turbulent diffusivity is much higher than molecular and as a first step, scalarTransport function would perfectly fit, but I do not understand how to use it!!

Thanks in advance

alexeym February 19, 2015 11:16

1 Attachment(s)
Hi,

Well, if you use simpleFoam, then scalarTransport function object is not an option, cause it uses fvm::ddt operator which will not be happy about steadyState ddt scheme which is usually used in simpleFoam simulations.

So you really need to modify scalarTransportFoam. Let's assume, will go with this expression for diffusivity:

D = D_{molecular} + \frac{\nu_t}{Sc_t}

Molecular diffusivity and turbulent Schmidt number are constant read from dictionary, turbulent viscosity is a field calculated with simpleFoam.

So you take createFields.H and add

Code:

    volScalarField nut
    (
        IOobject
        (
            "nut",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );

to read turbulent viscosity. Then you add

Code:

    Info<< "Reading turbulent Schmidt number\n" << endl;

    dimensionedScalar Sct
    (
        transportProperties.lookup("Sct")
    );

    volScalarField DTt
    (
        IOobject
        (
            "DTt",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        nut/Sct + DT,
        nut.boundaryField().types()
    );

to calculate turbulent diffusivity. As velocity and turbulent viscosity fields are taken from steady state simulation we need to calculate turbulent diffusivity only once. And finally you modify scalarTransportFoam.C, to account for new diffusivity:

Code:

            solve
            (
                fvm::ddt(T)
              + fvm::div(phi, T)
              - fvm::laplacian(DTt, T)
            ==
                fvOptions(T)
            );

And that's all.

See attached archive for source code and test case.

pippo2013 February 24, 2015 07:08

Dear Alexey,
thank you so much for your help!!
I am trying to use your code but I have some problems...
I have tried different configuration in order to avoid bothering you but without success...so I hope you can help me again!
When I run the test case you attached everything works (except for a warning) but the field does not change after the first time step!!

I attach the a few lines of log.turbulentScalarTransportFoam


Create time

Create mesh for time = 0

Reading field T

Reading field nut

Reading field U

Reading transportProperties

Reading diffusivity DT

Reading turbulent Schmidt number

--> FOAM Warning :
From function GeometricField<Type, PatchField, GeoMesh>::readIfPresent()
in file /opt/openfoam231/src/OpenFOAM/lnInclude/GeometricField.C at line 108
read option IOobject::MUST_READ or MUST_READ_IF_MODIFIED suggests that a read constructor for field DTt would be more appropriate.
Reading/calculating face flux field phi

No finite volume options present


SIMPLE: no convergence criteria found. Calculations will run for 1 steps.


Calculating scalar transport

Courant Number mean: 0.447422 max: 1.94995
Time = 0.0001

DILUPBiCG: Solving for T, Initial residual = 1, Final residual = 1.39684e-16, No Iterations 1
Time = 0.0002

DILUPBiCG: Solving for T, Initial residual = 1.76667e-45, Final residual = 1.76667e-45, No Iterations 0
Time = 0.0003

DILUPBiCG: Solving for T, Initial residual = 1.76667e-45, Final residual = 1.76667e-45, No Iterations 0
Time = 0.0004

DILUPBiCG: Solving for T, Initial residual = 1.76667e-45, Final residual = 1.76667e-45, No Iterations 0
Time = 0.0005

DILUPBiCG: Solving for T, Initial residual = 1.76667e-45, Final residual = 1.76667e-45, No Iterations 0
Time = 0.0006

DILUPBiCG: Solving for T, Initial residual = 1.76667e-45, Final residual = 1.76667e-45, No Iterations 0
Time = 0.0007


and it continues like that, without any change.
I have tried to change diffusivity and Schmidt number but nothing changes.
And the field is not stationary at all!!

Any help is highly appreciated
Thanks in advance.

alexeym February 24, 2015 07:37

Hi,

Well, it is rather interesting modification of mapFields in 2.3.1. After mapFields mapped values of nut are in the range [-2; infinity] (in 2.3.0 it was OK).

So if you modify mapFields line of Allrun script to:

Code:

runApplication mapFields -mapMethod direct -consistent -fields '(U nut)' -sourceTime latestTime ../pitzDaily-simple
everything start to run properly. Also you can modify DTt constructor in createField.H:

Code:

    volScalarField DTt
    (
        IOobject
        (
            "DTt",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        nut/Sct + DT,
        nut.boundaryField().types()
    );

to avoid this

Code:

--> FOAM Warning :
From function GeometricField<Type, PatchField, GeoMesh>::readIfPresent()
in file /opt/openfoam231/src/OpenFOAM/lnInclude/GeometricField.C at line 108
read option IOobject::MUST_READ or MUST_READ_IF_MODIFIED suggests that a read constructor for field DTt would be more appropriate.

during run-time.


All times are GMT -4. The time now is 15:59.