CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

scalarTransport functionObjects--coefficients alphaD and alphaDt have no effects

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 16, 2022, 06:45
Question scalarTransport functionObjects--coefficients alphaD and alphaDt have no effects
  #1
New Member
 
Thomas Shi
Join Date: Jan 2018
Posts: 20
Rep Power: 8
ThomasLong is on a distinguished road
Hi foamers!
I am trying to simulate passive scalar transport in water with OpenFOAM-V2206. I used scalarTransport function in controlDict. As for the diffusion coefficient, a specified constant coefficient D did have effects on the results though I didn't get a good result in this way. Then I noticed the desciption in scalarTransport.H and got these lines below:
Code:
Alternatively if a turbulence model is available a turbulent diffusivity may be constructed from the laminar and turbulent viscosities using the optional diffusivity coefficients alphaD and alphaDt (which default to 1):
      D = alphaD*nu + alphaDt*nut
This message offered me another way to define the diffusion coefficient in flows with turbulence models. And I studied the source codes in scalarTransport.H and scalarTransport.C, then I got these codes:
Code:
Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
(
    const volScalarField& s,
    const surfaceScalarField& phi
) const
{
    const word Dname("D" + s.name());
 
    if (constantD_)
    {
        return tmp<volScalarField>::New
        (
            IOobject
            (
                Dname,
                mesh_.time().timeName(),
                mesh_.time(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            mesh_,
            dimensionedScalar(Dname, phi.dimensions()/dimLength, D_)
        );
    }
 
    if (nutName_ != "none")
    {
        const volScalarField& nutMean =
            mesh_.lookupObject<volScalarField>(nutName_);
 
        return tmp<volScalarField>::New(Dname, nutMean);
    }
 
    // Incompressible
    {
        const auto* turb =
            findObject<incompressible::turbulenceModel>
            (
                turbulenceModel::propertiesName
            );
 
        if (turb)
        {
            return tmp<volScalarField>::New
            (
                Dname,
                alphaD_ * turb->nu() + alphaDt_ * turb->nut()
            );
        }
    }
 
    // Compressible
    {
        const auto* turb =
            findObject<compressible::turbulenceModel>
            (
                turbulenceModel::propertiesName
            );
 
        if (turb)
        {
            return tmp<volScalarField>::New
            (
                Dname,
                alphaD_ * turb->mu() + alphaDt_ * turb->mut()
            );
        }
    }
Code:
alphaD_ = dict.getOrDefault<scalar>("alphaD", 1);
    alphaDt_ = dict.getOrDefault<scalar>("alphaDt", 1);
In my conprehension, without a specified constant D, the coefficients alphaD and alphaDt which represent the laminar diffusion coefficient and turbulent diffusion coefficient respectively will decide the diffusion coefficient according to compressibility of the fluids. Especially, the default value of the two coefficients are set to be 1.
From this way, I edited the scalarTransport function in my controlDict as follows:
Code:
    sTransport
    {
        type            scalarTransport;
        libs            (solverFunctionObjects);
        enabled         true;
        writeControl    writeTime;
        writeInterval   1;
        field           s;
        bounded01       false;
        phase           alpha.water;
        rho             rho;
        p               p_rgh;
        nut             nut;
        nCorr          2;
        alphaD        1;
        alphaDt       1.42857;
        write           true;
        resetOnStartUp  false;
    }
After one simulation, I changed the coefficient alphaDt into a relatively larger value. Then I found the results hardly changed this time! I tried several simulations with different alphaD and alphaDt values and got the same results.
Did anybody have some experience on the simulation using these two coefficients? Or could anyone point out the errors in my defination of scalarTransport function? Thanks in advance!
ThomasLong is offline   Reply With Quote

Old   October 17, 2022, 01:28
Unhappy
  #2
New Member
 
Thomas Shi
Join Date: Jan 2018
Posts: 20
Rep Power: 8
ThomasLong is on a distinguished road
Nobody is interested in this issue?
ThomasLong is offline   Reply With Quote

Old   October 18, 2022, 11:21
Default
  #3
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 646
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi Thomas,

Not 100% sure, but it might be related to:

Code:
    if (nutName_ != "none")
    {
        const volScalarField& nutMean =
            mesh_.lookupObject<volScalarField>(nutName_);
 
        return tmp<volScalarField>::New(Dname, nutMean);
    }
As you have
Code:
        nut             nut;
in your setup this may result in always using nut for the diffusion coefficient?

Can you check if you see an effect if you comment that line in your setup?

Good luck,
Tom
tomf is offline   Reply With Quote

Old   October 19, 2022, 01:30
Default
  #4
New Member
 
Thomas Shi
Join Date: Jan 2018
Posts: 20
Rep Power: 8
ThomasLong is on a distinguished road
Thanks for your reply! I'm very grateful to you for your help!
ThomasLong is offline   Reply With Quote

Reply

Tags
alphad, alphadt, diffusion coefficient, functionobjects, scalartransport


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passive Scalar Function Object - Setting of alphaD and alphaDt foamF OpenFOAM 12 October 13, 2022 05:45


All times are GMT -4. The time now is 11:37.