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/)
-   -   dynLagrangian SGS model (https://www.cfd-online.com/Forums/openfoam-solving/90351-dynlagrangian-sgs-model.html)

Lieven April 3, 2014 13:26

Hi vut,

Do you mean as boundary condition or initial value?
The boundary condition for walls is typically a zeroGradient...

Cheers,

L

vut April 4, 2014 10:46

Dear Lieven,

Thank you for your answer.

I am searching now the initial conditions for flm and fmm for:

- internalField
- inlet
- and outlet

Is there some formula to estimate it?

I have a turbulent inlet with fluctuation scale of 0.02 for x, y and z and a mean flow in z-direction only.

Thanks in advance,

vut

anishtain4 March 30, 2016 16:44

1 Attachment(s)
Hi,

Since there is no clear example of dynamic Lagrangian LES model in the OpenFOAM tutorials, I attached a case I had to make work.
This is for OpenFOAM 3.0.1,
Let me know if you have any questions about it.

The codes to run it are as follow:

Code:

cp -r 0.org 0;
blockMesh;
perturbUChannel;
pimpleFoam;

One also needs

zhangyan April 30, 2016 03:18

Quote:

Originally Posted by anishtain4 (Post 592490)
Hi,

Since there is no clear example of dynamic Lagrangian LES model in the OpenFOAM tutorials, I attached a case I had to make work.
This is for OpenFOAM 3.0.1,
Let me know if you have any questions about it.

The codes to run it are as follow:

Code:

cp -r 0.org 0;
blockMesh;
perturbUChannel;
pimpleFoam;

One also needs

Hello Mahdi,
I want to know why you use the "simple filter", in your turbulenceProperties.
Because I found "laplace Filter" in the source codes, I guessed the dynLagrangian must be used accompany with "laplace Filter".

Actually, I am going to implement the dynamic K-E or dynLagrangian SGS model to another software. But I don't know how to implement the "simple Filter".

It seems that implementing laplace Filter is more easier. Could you tell me does the SGS models must be used accompany with particular Filters? For example, dynamicKEqn + simple filter; dynamicLagrangian + laplace Filter.

Another question: do you understand the simple Filter? Could you tell me the physical meaning of it?

Please forgive my poor English.

simple Filter:

tmp<volScalarField> filteredField = fvc::surfaceSum
(
mesh().magSf()*fvc::interpolate(unFilteredField)
)/fvc::surfaceSum(mesh().magSf())

laplace Filter:

tmp<volTensorField> filteredField =
unFilteredField() + fvc::laplacian(coeff_, unFilteredField())


Thanks,
Zhang Yan

Mirage October 16, 2016 15:37

Hi Guys,

@Mahdi: I am also intressted to understand the meaning of ""simple filter", in your turbulenceProperties. How did u validate the accuracy of ur solver? :)

I would like to compare my results with a case solved with OF 2.3 and I have to make sure that I am using the same SGS model. How can I make sure that I am using the same coefficient in OF 3.0.1? Thank you .
I appreciate any help.

Adlak November 25, 2016 05:37

While running dynamicLagrangian model i am getting following error :

--> FOAM FATAL ERROR:
incompatible dimensions for operation
[flm[0 4 -5 0 0 0 0] ] + [flm[1 1 -5 0 0 0 0] ]

From function checkMethod(const fvMatrix<Type>&, const fvMatrix<Type>&)
in file /mnt/home/SW/CFDSupportFOAM3.0/OpenFOAM-3.0.x/src/finiteVolume/lnInclude/fvMatrix.C at line 1295.

FOAM aborting

#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::error::abort() at ??:?
#2 void Foam::checkMethod<double>(Foam::fvMatrix<double> const&, Foam::fvMatrix<double> const&, char const*) at ??:?
#3 Foam::tmp<Foam::fvMatrix<double> > Foam::operator+<double>(Foam::tmp<Foam::fvMatrix<d ouble> > const&, Foam::tmp<Foam::fvMatrix<double> > const&) at ??:?
#4 Foam::LESModels::dynamicLagrangian<Foam::EddyDiffu sivity<Foam::ThermalDiffusivity<Foam::Compressible TurbulenceModel<Foam::fluidThermo> > > >::correct() at ??:?
#5 ? at ??:?
#6 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#7 ? at ??:?
Aborted (core dumped)

Can anyone help me ?

Adlak November 25, 2016 06:02

Quote:

Originally Posted by tidal_Tom (Post 319852)
I do not know what is causing your errors. I am a relatively novice user so it is beyond me. below are my files I used for flm and fmm. I don't think fmm can be zero, as the calculation for turbulent viscosity divides by fmm, I set this to a value of 1. flm can be zero as it is the nominator.

Have you added flm and fmm in the fvSolution and fvSchemes? lines I added are below.

fvSolution:

flm
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0;
}

fmm
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0;
}

fvSchemes:

divSchemes
{
default none;
div(phi,U) Gauss linear;
div(phi,flm) Gauss limitedLinear 1;
div(phi,fmm) Gauss limitedLinear 1;
div(phi,B) Gauss limitedLinear 1;
div(B) Gauss linear;
div((nuEff*dev(T(grad(U))))) Gauss linear;
}

and I added:

dynLagrangianCoeffs
{
filter simple;
ce 1.048;
theta 1.5;
}

in the LESProperties dictionary.

flm:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.0.0 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object flm;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 4 -4 0 0 0 0];

internalField uniform 0;

boundaryField
{
inlet
{
type fixedValue;
value uniform 0;
}

outlet
{
type zeroGradient;
}

outside
{
type fixedValue;
value uniform 0;
}

object
{
type fixedValue;
value uniform 0;
}

wedge1
{
type wedge;
}

wedge2
{
type wedge;
}
}

// ************************************************** *********************** //

fmm:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.0.0 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object fmm;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 4 -4 0 0 0 0];

internalField uniform 1;

boundaryField
{
inlet
{
type fixedValue;
value uniform 1;
}

outlet
{
type zeroGradient;
}

outside
{
type zeroGradient;
}

object
{
type zeroGradient;
}

wedge1
{
type wedge;
}

wedge2
{
type wedge;
}
}

// ************************************************** *********************** //

While running dynamicLagrangian model i am getting following error :

--> FOAM FATAL ERROR:
incompatible dimensions for operation
[flm[0 4 -5 0 0 0 0] ] + [flm[1 1 -5 0 0 0 0] ]

From function checkMethod(const fvMatrix<Type>&, const fvMatrix<Type>&)
in file /mnt/home/SW/CFDSupportFOAM3.0/OpenFOAM-3.0.x/src/finiteVolume/lnInclude/fvMatrix.C at line 1295.

FOAM aborting

#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::error::abort() at ??:?
#2 void Foam::checkMethod<double>(Foam::fvMatrix<double> const&, Foam::fvMatrix<double> const&, char const*) at ??:?
#3 Foam::tmp<Foam::fvMatrix<double> > Foam::operator+<double>(Foam::tmp<Foam::fvMatrix<d ouble> > const&, Foam::tmp<Foam::fvMatrix<double> > const&) at ??:?
#4 Foam::LESModels::dynamicLagrangian<Foam::EddyDiffu sivity<Foam::ThermalDiffusivity<Foam::Compressible TurbulenceModel<Foam::fluidThermo> > > >::correct() at ??:?
#5 ? at ??:?
#6 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#7 ? at ??:?
Aborted (core dumped)

Can anyone help me ?

Adlak November 28, 2016 02:14

hi everyone,

I am trying to use dynamic lagrangian les model but facing following error :

--> FOAM FATAL ERROR:
incompatible dimensions for operation
[flm[0 4 -5 0 0 0 0] ] + [flm[1 1 -5 0 0 0 0] ]

From function checkMethod(const fvMatrix<Type>&, const fvMatrix<Type>&)
in file /mnt/home/SW/CFDSupportFOAM3.0/OpenFOAM-3.0.x/src/finiteVolume/lnInclude/fvMatrix.C at line 1295.

FOAM aborting

#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::error::abort() at ??:?
#2 void Foam::checkMethod<double>(Foam::fvMatrix<double> const&, Foam::fvMatrix<double> const&, char const*) at ??:?
#3 Foam::tmp<Foam::fvMatrix<double> > Foam::operator+<double>(Foam::tmp<Foam::fvMatrix<d ouble> > const&, Foam::tmp<Foam::fvMatrix<double> > const&) at ??:?
#4 Foam::LESModels::dynamicLagrangian<Foam::EddyDiffu sivity<Foam::ThermalDiffusivity<Foam::Compressible TurbulenceModel<Foam::fluidThermo> > > >::correct() at ??:?
#5 ? at ??:?
#6 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#7 ? at ??:?
Aborted (core dumped)

If anyone can help then it will be great for me.
Thanks

eb19 February 15, 2017 10:33

wall function
 
dear all,

Do we have to apply a wall function if our grid resolution near to the wall is quite coarse (let's say y+>11) even if this dynLagrangian model is applied?

In the case where wall function is necessary, do we use the standard wall function available in OpenFOAM. Please anyone give your suggestion.

anishtain4 February 15, 2017 11:26

Sorry to reply so late, have been busy past few months and missed the topic.

Q: I want to know why you use the "simple filter", in your turbulenceProperties.
A: it's the simplest model and I didn't have to worry about the filter.

Q: Could you tell me does the SGS models must be used accompany with particular Filters?
A: Theoretically now, the CFD implementation of LES should work with any form of filter or filter width, practically? the best way is to test it.

Q: do you understand the simple Filter? Could you tell me the physical meaning of it?
A: It's a tophat averaging over the filter length (usually the cell volume). This is the most common filter as it's implied by discretization, if you apply any other filter with bigger width, you are basically getting the effect of both filters. If you're going to use dynamic models then you can choose any form for the second filter as the effect of filter overlay is being considered.

Quote:

Originally Posted by zhangyan (Post 597428)
Hello Mahdi,
I want to know why you use the "simple filter", in your turbulenceProperties.
Because I found "laplace Filter" in the source codes, I guessed the dynLagrangian must be used accompany with "laplace Filter".

Actually, I am going to implement the dynamic K-E or dynLagrangian SGS model to another software. But I don't know how to implement the "simple Filter".

It seems that implementing laplace Filter is more easier. Could you tell me does the SGS models must be used accompany with particular Filters? For example, dynamicKEqn + simple filter; dynamicLagrangian + laplace Filter.

Another question: do you understand the simple Filter? Could you tell me the physical meaning of it?

Please forgive my poor English.

simple Filter:

tmp<volScalarField> filteredField = fvc::surfaceSum
(
mesh().magSf()*fvc::interpolate(unFilteredField)
)/fvc::surfaceSum(mesh().magSf())

laplace Filter:

tmp<volTensorField> filteredField =
unFilteredField() + fvc::laplacian(coeff_, unFilteredField())


Thanks,
Zhang Yan


anishtain4 February 15, 2017 11:33

Quote:

Originally Posted by Mirage (Post 621691)
Hi Guys,

@Mahdi: I am also intressted to understand the meaning of ""simple filter", in your turbulenceProperties. How did u validate the accuracy of ur solver? :)

I would like to compare my results with a case solved with OF 2.3 and I have to make sure that I am using the same SGS model. How can I make sure that I am using the same coefficient in OF 3.0.1? Thank you .
I appreciate any help.

Hi Mirage,

I solved it in a channel and the results agree well. The case is attached, you can run it.

Regarding the coefficients, the model is based on this paper:
A Lagrangian dynamic subgrid-scale model of turbulence.
(It's still the same on version 1606), so I assume the coefficients won't change as they're based on the paper.

anishtain4 February 15, 2017 11:33

Quote:

Originally Posted by eb19 (Post 637254)
dear all,

Do we have to apply a wall function if our grid resolution near to the wall is quite coarse (let's say y+>11) even if this dynLagrangian model is applied?

In the case where wall function is necessary, do we use the standard wall function available in OpenFOAM. Please anyone give your suggestion.

Yes and Yes.

eb19 February 15, 2017 12:05

Quote:

Originally Posted by anishtain4 (Post 637275)
Yes and Yes.

Thanks for your reply. Do you know or anyone knows if OpenFoam has a wall function which is capable for modeling flow separation? Or do you know papers that implemented this dynamic Lagrangian model for flow separation problem? Please help.

eb19 February 15, 2017 12:59

Quote:

Originally Posted by anishtain4 (Post 592490)
Hi,

Since there is no clear example of dynamic Lagrangian LES model in the OpenFOAM tutorials, I attached a case I had to make work.
This is for OpenFOAM 3.0.1,
Let me know if you have any questions about it.

The codes to run it are as follow:

Code:

cp -r 0.org 0;
blockMesh;
perturbUChannel;
pimpleFoam;

One also needs

Hi Mahdi,

In the 0 folder of your test case, you included nut and nuTilda. I tried my model following your test case, and it gave error because nuSgs file is missing in the 0 folder. ( I use OpenFoam v2.3). I tried replacing nut and nuTilda with nuSgs. The simulation well. Which one is actually necessary to include? I guess this model dynamically quantifies the nuSgs (eddy viscosity based on smagorinsky coefficient). Can you please kindly explain this part? Thanks

anishtain4 February 15, 2017 16:17

Quote:

Originally Posted by Adlak (Post 626864)
While running dynamicLagrangian model i am getting following error :

--> FOAM FATAL ERROR:
incompatible dimensions for operation
[flm[0 4 -5 0 0 0 0] ] + [flm[1 1 -5 0 0 0 0] ]

From function checkMethod(const fvMatrix<Type>&, const fvMatrix<Type>&)
in file /mnt/home/SW/CFDSupportFOAM3.0/OpenFOAM-3.0.x/src/finiteVolume/lnInclude/fvMatrix.C at line 1295.

FOAM aborting

#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::error::abort() at ??:?
#2 void Foam::checkMethod<double>(Foam::fvMatrix<double> const&, Foam::fvMatrix<double> const&, char const*) at ??:?
#3 Foam::tmp<Foam::fvMatrix<double> > Foam::operator+<double>(Foam::tmp<Foam::fvMatrix<d ouble> > const&, Foam::tmp<Foam::fvMatrix<double> > const&) at ??:?
#4 Foam::LESModels::dynamicLagrangian<Foam::EddyDiffu sivity<Foam::ThermalDiffusivity<Foam::Compressible TurbulenceModel<Foam::fluidThermo> > > >::correct() at ??:?
#5 ? at ??:?
#6 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#7 ? at ??:?
Aborted (core dumped)

Can anyone help me ?

This says the dimension in the flm is set wrong, I tried the case I've attached here again in OF 3.0+ and 1606, works on both fine. Not sure what's your problem.

Zaffar April 24, 2017 15:35

compressible dynamicLagrangian SGS
 
Hi, I am trying to use compressible dynamicLagrangian SGS model.

Apparently, “dynamicLagrangian” has been implemented in OpenFOAM version 4.0 for both compressible and incompressible flows.

I wonder how the fmm and flm should look like in zero directory and also what are the dimensions of those two quantiles for compressible solver.

In addition, have you had any successful experience with compressible “dynamicLagrangian” SGS model?

Thanks a lot for all the help and guidance.

Adlak April 25, 2017 01:22

1 Attachment(s)
Quote:

Originally Posted by Zaffar (Post 646342)
Hi, I am trying to use compressible dynamicLagrangian SGS model.

Apparently, “dynamicLagrangian” has been implemented in OpenFOAM version 4.0 for both compressible and incompressible flows.

I wonder how the fmm and flm should look like in zero directory and also what are the dimensions of those two quantiles for compressible solver.

In addition, have you had any successful experience with compressible “dynamicLagrangian” SGS model?

Thanks a lot for all the help and guidance.


Hi Zaffar,
I have succesfully tested dynamicLagrangian model in OpenFOAM-3.0.x after little modification which was required for compressible flows. It was running well for incompressible flows but not for compressible flows. So I modified fmm and flm equations (Just put the density inside derivatives). I am attaching flm and fmm files for zero folder please check it, it might be helpful for u.

Zaffar April 25, 2017 18:03

Thank you for your reply Adlak,

From OF4.0 source, you can see that "rho" variable already implemented in both equations for fmm and flm as:

Code:

    volScalarField invT
    (
        alpha*rho*(1.0/(theta_.value()*this->delta()))*pow(flm_*fmm_, 1.0/8.0)
    );

    volScalarField LM(L && M);

    fvScalarMatrix flmEqn
    (
        fvm::ddt(alpha, rho, flm_)
      + fvm::div(alphaRhoPhi, flm_)
    ==
        invT*LM
      - fvm::Sp(invT, flm_)
      + fvOptions(alpha, rho, flm_)
    );

    flmEqn.relax();
    fvOptions.constrain(flmEqn);
    flmEqn.solve();
    fvOptions.correct(flm_);
    bound(flm_, flm0_);

    volScalarField MM(M && M);

    fvScalarMatrix fmmEqn
    (
        fvm::ddt(alpha, rho, fmm_)
      + fvm::div(alphaRhoPhi, fmm_)
    ==
        invT*MM
      - fvm::Sp(invT, fmm_)
      + fvOptions(alpha, rho, fmm_)
    );

    fmmEqn.relax();
    fvOptions.constrain(fmmEqn);
    fmmEqn.solve();
    fvOptions.correct(fmm_);
    bound(fmm_, fmm0_);

    correctNut(gradU);
}

I tried fmm and flm dimensions similar to your files too but the dimensional error persists. I tested many different cases but it seems that there is a problem with dynamicLagrangian for compressible solver in OpenFOAM-4.0.

Any comments or suggestions would be greatly appreciated

Adlak April 27, 2017 02:00

Quote:

Originally Posted by Zaffar (Post 646577)
Thank you for your reply Adlak,

From OF4.0 source, you can see that "rho" variable already implemented in both equations for fmm and flm as:

Code:

    volScalarField invT
    (
        alpha*rho*(1.0/(theta_.value()*this->delta()))*pow(flm_*fmm_, 1.0/8.0)
    );

    volScalarField LM(L && M);

    fvScalarMatrix flmEqn
    (
        fvm::ddt(alpha, rho, flm_)
      + fvm::div(alphaRhoPhi, flm_)
    ==
        invT*LM
      - fvm::Sp(invT, flm_)
      + fvOptions(alpha, rho, flm_)
    );

    flmEqn.relax();
    fvOptions.constrain(flmEqn);
    flmEqn.solve();
    fvOptions.correct(flm_);
    bound(flm_, flm0_);

    volScalarField MM(M && M);

    fvScalarMatrix fmmEqn
    (
        fvm::ddt(alpha, rho, fmm_)
      + fvm::div(alphaRhoPhi, fmm_)
    ==
        invT*MM
      - fvm::Sp(invT, fmm_)
      + fvOptions(alpha, rho, fmm_)
    );

    fmmEqn.relax();
    fvOptions.constrain(fmmEqn);
    fmmEqn.solve();
    fvOptions.correct(fmm_);
    bound(fmm_, fmm0_);

    correctNut(gradU);
}

I tried fmm and flm dimensions similar to your files too but the dimensional error persists. I tested many different cases but it seems that there is a problem with dynamicLagrangian for compressible solver in OpenFOAM-4.0.

Any comments or suggestions would be greatly appreciated




Hi,
I have already installed and checked OF4.0 and OF4.x both but I haven't seen any changes. Please check this file in the installed version on ur system. Also send me the complete folder of dynamicLagrangian turbulence model at adlak@iitk.ac.in

rob3rt 0ng September 23, 2017 03:41

Quote:

Originally Posted by Zaffar (Post 646577)
Thank you for your reply Adlak,

From OF4.0 source, you can see that "rho" variable already implemented in both equations for fmm and flm as:

Code:

    volScalarField invT
    (
        alpha*rho*(1.0/(theta_.value()*this->delta()))*pow(flm_*fmm_, 1.0/8.0)
    );

    volScalarField LM(L && M);

    fvScalarMatrix flmEqn
    (
        fvm::ddt(alpha, rho, flm_)
      + fvm::div(alphaRhoPhi, flm_)
    ==
        invT*LM
      - fvm::Sp(invT, flm_)
      + fvOptions(alpha, rho, flm_)
    );

    flmEqn.relax();
    fvOptions.constrain(flmEqn);
    flmEqn.solve();
    fvOptions.correct(flm_);
    bound(flm_, flm0_);

    volScalarField MM(M && M);

    fvScalarMatrix fmmEqn
    (
        fvm::ddt(alpha, rho, fmm_)
      + fvm::div(alphaRhoPhi, fmm_)
    ==
        invT*MM
      - fvm::Sp(invT, fmm_)
      + fvOptions(alpha, rho, fmm_)
    );

    fmmEqn.relax();
    fvOptions.constrain(fmmEqn);
    fmmEqn.solve();
    fvOptions.correct(fmm_);
    bound(fmm_, fmm0_);

    correctNut(gradU);
}

I tried fmm and flm dimensions similar to your files too but the dimensional error persists. I tested many different cases but it seems that there is a problem with dynamicLagrangian for compressible solver in OpenFOAM-4.0.

Any comments or suggestions would be greatly appreciated

Hi Zaffar,
I'm getting the same incompatible dimension error.
Have you managed to solve it?
Thanks
Robert


All times are GMT -4. The time now is 13:44.