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/)
-   -   scalarTransport functionObjects--coefficients alphaD and alphaDt have no effects (https://www.cfd-online.com/Forums/openfoam-solving/245619-scalartransport-functionobjects-coefficients-alphad-alphadt-have-no-effects.html)

ThomasLong October 16, 2022 05:45

scalarTransport functionObjects--coefficients alphaD and alphaDt have no effects
 
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!:eek::eek::confused::confused: 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 October 17, 2022 00:28

Nobody is interested in this issue?:(:(:confused::confused:

tomf October 18, 2022 10:21

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

ThomasLong October 19, 2022 00:30

Thanks for your reply! I'm very grateful to you for your help!


All times are GMT -4. The time now is 18:16.