# Turbulent scalar mixing

 Register Blogs Members List Search Today's Posts Mark Forums Read

 February 19, 2015, 06:10 Turbulent scalar mixing #1 New Member   Join Date: Apr 2013 Posts: 3 Rep Power: 5 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 ScalarTransportFoam for RTD calculations Unfortunately the link in the post to is not working anymore. thanks a lot in advance!

 February 19, 2015, 06:47 #2 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,367 Rep Power: 23 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).

 February 19, 2015, 07:18 #3 New Member   Join Date: Apr 2013 Posts: 3 Rep Power: 5 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

February 19, 2015, 12:16
#4
Senior Member

Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,367
Rep Power: 23
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:

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::AUTO_WRITE
),
mesh
);

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

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

volScalarField DTt
(
IOobject
(
"DTt",
runTime.timeName(),
mesh,
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.
Attached Files
 turbulentScalarTransportFoam.tar.gz (7.6 KB, 29 views)

 February 24, 2015, 08:08 #5 New Member   Join Date: Apr 2013 Posts: 3 Rep Power: 5 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::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.

 February 24, 2015, 08:37 #6 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,367 Rep Power: 23 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::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.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post immortality OpenFOAM Running, Solving & CFD 11 April 22, 2014 12:32 zxj160 OpenFOAM 11 January 27, 2013 14:57 JJY OpenFOAM Running, Solving & CFD 4 April 3, 2009 11:25 Maged Ismail FLUENT 0 June 10, 2005 09:09 Flav FLUENT 5 December 13, 1999 04:11

All times are GMT -4. The time now is 09:54.