CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Adding graviational acc. to turbulence model (http://www.cfd-online.com/Forums/openfoam-programming-development/103370-adding-graviational-acc-turbulence-model.html)

fertinaz June 18, 2012 13:46

Adding graviational acc. to turbulence model
 
Hi,

I am trying to modify the standard kEps model to attain the influence of the buoyancy related turbulence.

I followed a few different methods however all seemed to fail.

1- Using readGravitationalAcceleration.H :
--> FOAM FATAL ERROR:
request for dictionary gravitationalProperties from objectRegistry region0 failed
available objects of type dictionary are
4
(
RASProperties
fvSchemes
fvSolution
transportProperties
)

2 - Reading from transportProperties:
--> FOAM FATAL ERROR:
LHS and RHS of + have different dimensions

The solver works fine with the standard kEps so I don't think that I have to change the solver or B.C's.

3- Creating a file called "g" and reading via lookupObject<uniformDimensionedVectorField>("g") :
Unknow type uniformDimensionedVectorField

4- Linking as a field by lookupObject<volVectorField>("g") :
gives an error during the runTime since g is a uniformDimensionedVectorField

I guess one other way would be to use a hard-coded vector but I don't want to do that. Any help is appreciated.

OF version: 1.6.x
OS: CentOS 5

Thanks a lot,
Fatih.

Fabf March 13, 2015 06:08

Facing the same problem. Did you find a solution?

I prefer to add

Code:

#include "UniformDimensionedField.H"
in the Header-file and call "g" by

Code:

const uniformDimensionedVectorField& g_ = db().lookupObject<uniformDimensionedVectorField>("g");
But I get an Error that uniformDimensionedVectorField is not a type. I use OF 2.3.

alexeym March 13, 2015 06:26

Hi,

You should include another file

Code:

#include "UniformDimensionedFields.H"
to have uniformDimensionedVectorField. Or declate your g_ as

Code:

UniformDimensionedField<vector>
if you insist on including just UniformDimensionedField.H.

And if you are adding gravitation to turbulence model:

http://www.cfd-online.com/Forums/ope...nce-model.html
http://openfoamwiki.net/index.php/Co...EpsilonViollet

Fabf March 13, 2015 06:49

Hi Alexey,

thanks for your quick response.

I guess you meant
Code:

#include "uniformDimensionedFields.H"
This works fine fine for including the lib. However, I get for
Code:

const uniformDimensionedVectorField& g_ = db().lookupObject<uniformDimensionedVectorField>("g");
the following error:
Code:

kEpsilonBuoyant/kEpsilonBuoyant.C: In Elementfunktion »virtual void Foam::compressible::RASModels::kEpsilonBuoyant::correct()«:
kEpsilonBuoyant/kEpsilonBuoyant.C:324:47: Fehler: Referenz auf »db« ist mehrdeutig
/opt/openfoam230/src/OpenFOAM/lnInclude/IOobject.H:250:35: Fehler: Kandidaten sind: const Foam::objectRegistry& Foam::IOobject::db() const
/opt/openfoam230/src/OpenFOAM/lnInclude/IOobject.H:250:35: Fehler:                  const Foam::objectRegistry& Foam::IOobject::db() const
kEpsilonBuoyant/kEpsilonBuoyant.C:324:94: Fehler: expected primary-expression before »>« token

Means db is ambiguous. I copied that formulation from the mentioned kEpsilonViolett.

alexeym March 13, 2015 07:02

Yes, you are right about header name.

Well, kEpsilonViollet was developed for 1.7, guess that time RASModel was a little bit simpler. Right now it is a child of turbulenceModel and IOobject. Each of parents has db method.

So you can either create g_ property of your class and initialize it in constructor with something like:

Code:

    g_
    (
        IOobject
        (
            "g",
            runTime_.constant(),
            mesh_,
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE
        )
    )

or use constant reference to fvMesh from turbulenceModel (there db ambiguity was resolved):

Code:

const uniformDimensionedVectorField& g_ = mesh_.thisDb().lookupObject<uniformDimensionedVectorField>("g");

Fabf March 13, 2015 07:26

Model runs. Thank you a lot!

To sum it up: Inculding gravity acceleration in turbulence models by adding in the .H-file:

Code:

#include "uniformDimensionedFields.H"
and in the .C-File:
Code:

const uniformDimensionedVectorField& g_ = mesh_.thisDb().lookupObject<uniformDimensionedVectorField>("g");


All times are GMT -4. The time now is 10:51.