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

Adding LES to a laminar solver

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 9, 2018, 23:20
Default Adding LES to a laminar solver
  #1
Senior Member
 
Ali Shayegh
Join Date: Oct 2015
Posts: 130
Rep Power: 10
amuzeshi is on a distinguished road
Hi there !


My question is about adding turbulence to a laminar solver.
I'm using rheoEFoam to simulate a flow with electro-kinetic effects. Unfortunately, this solver is laminar; I want to simulate electric-flow interaction using LES(Large Eddy Simulation). Do you have any idea doing so?


Best wishes
Ali
amuzeshi is offline   Reply With Quote

Old   August 13, 2018, 05:33
Default
  #2
ano
Member
 
ano
Join Date: Jan 2017
Location: Delft
Posts: 58
Rep Power: 10
ano is on a distinguished road
Hi Ali,


The big question would be whether you want to keep your rheological models or do you have a Newtonian fluid and only want to use the electric library?


The former would be complicated, the latter much easier.
ano is offline   Reply With Quote

Old   August 13, 2018, 08:48
Default
  #3
Senior Member
 
Ali Shayegh
Join Date: Oct 2015
Posts: 130
Rep Power: 10
amuzeshi is on a distinguished road
Hi ano


My case is the latter, although there is a file named constitutiveProperties in constant directory of a rheoEFoam problem in which you could


set the "type" as Newtonian and not necessarily the other models.
amuzeshi is offline   Reply With Quote

Old   August 13, 2018, 09:42
Default
  #4
ano
Member
 
ano
Join Date: Jan 2017
Location: Delft
Posts: 58
Rep Power: 10
ano is on a distinguished road
Hello Ali,

The OpenFoam turbulence model uses the inbuilt transport model, which calculates the viscosity, so that the turbulence model can add the molecular and turbulent viscosity to an effective viscosity. Therefore, it is better to stick to the inbuilt transport model instead of the constitutive model, when you want to have turbulence.

You have to do two things: A) get rid of the constitutive model and B) use instead the inbuilt OpenFoam transportmodel to describe your viscosity and the turbulencemodel to describe your turbulence.

(0.First copy the solver to a new directory and rename it (change the names in Make/files and rhoEFoam.C). Compile with 'wmake' to see whether it works.)

A. Get rid of constitutive model:

1. Delete in createFields.H:
Code:
 
// Create constitutive equation
constitutiveModel constEq(U, phi);
Code:
    IOdictionary cttProperties
    (
        IOobject
        (
            "constitutiveProperties",
            runTime.constant(),
            mesh,
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE
        )
    );
The easiest way is to look into simpleFoam and look for everywhere where 'turbulence' or 'turbulent appears' and include these changes into rheoEFoam. You will end up for OF4 version of rheoEFoam with the following steps:

2. Delete in rheoEFoam.C (or the new name you use):
Code:
#include "constitutiveModel.H"
and
Code:
// ---- Solve constitutive equation ----                  
constEq.correct();
After this compiling is not possible since the solver still calls 'constEq' in velocity equation file, i.e. UEqn.H. This you are going to change in the next section.

B) Use instead the inbuilt OpenFoam transportModel to describe your viscosity and the turbulenceModel to describe your turbulence:

1. Add at the end of createFields.H the lines to create a transport model instance and a turbulence instance. And also a transportProperties dictionary to read the density whcih you need for the electric forcing:

Code:
singlePhaseTransportModel laminarTransport(U, phi);

autoPtr<incompressible::turbulenceModel> turbulence
(
    incompressible::turbulenceModel::New(U, phi, laminarTransport)
);
Info« "Reading transportProperties\n" « endl;
IOdictionary transportProperties
    (
  IOobject
      (
    "transportProperties",
    runTime.constant(),
    mesh,
    IOobject::MUST_READ_IF_MODIFIED,
    IOobject::NO_WRITE
       )
);
dimensionedScalar rho
    (
  transportProperties.lookup("rho")
);
2. Add the words in the bold font in rheoEFoam.C (the words in normal font are for your orientation).
First to read the declarations of the transport and turbulence model into your solver.
Code:
#include "ppUtilInterface.H"
#include "EDFModel.H"
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
Then to update and validate the turbulence fields, e.g. the turbulent viscosity nut after the construction of the object (which happens in createFields.H), add before the simple loop:
Code:
    #include "initContinuityErrs.H"

    turbulence->validate();
Before the fields are written to the time directory add a correction of both instances (e.g. update of turbulent viscosity based on the new velocity field):
Code:
        laminarTransport.correct();
        turbulence->correct();

        runTime.write();
3. Change the UEqn.H to include the Reynoldsstress and get rid of the constEq:
Code:
   (
        fvm::ddt(U)
      + fvm::div(phi, U)
      + turbulence->divDevReff(U)
      ==
        fvOptions(U)
      + elecM.Fe()/rho  

   );
4. In the end add the following bold lines to Make/options:
Code:
EXE_INC = \
   -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
.....

EXE_LIBS = \
   -lturbulenceModels \
    -lincompressibleTurbulenceModels \
    -lincompressibleTransportModels \
Afterwards compile. Please let me know whether it worked, I didn't try the steps myself. So most probably I am missing something.

In the end you can copy the transportProperties and turbulenceProperties e.g. from 'tutorials/incompressible/pimpleFoam/LES/channel395/constant', you have to add rho to the transportProperties file.

I wonder whether one can use the 'normal' turbulence models for flow with electro-kinetic effects?
ano is offline   Reply With Quote

Old   August 13, 2018, 12:50
Default
  #5
Senior Member
 
Ali Shayegh
Join Date: Oct 2015
Posts: 130
Rep Power: 10
amuzeshi is on a distinguished road
I really appreciate your accurate, coherent and high velocity reply . I will do this and let you know what happens . To the best of my


knowledge, RANS models don't fit for low Re problems with which I'm dealing.
amuzeshi is offline   Reply With Quote

Old   August 19, 2018, 03:31
Default
  #6
Senior Member
 
Ali Shayegh
Join Date: Oct 2015
Posts: 130
Rep Power: 10
amuzeshi is on a distinguished road
Quote:
Originally Posted by ano View Post
Hello Ali,

The OpenFoam turbulence model uses the inbuilt transport model, which calculates the viscosity, so that the turbulence model can add the molecular and turbulent viscosity to an effective viscosity. Therefore, it is better to stick to the inbuilt transport model instead of the constitutive model, when you want to have turbulence.

You have to do two things: A) get rid of the constitutive model and B) use instead the inbuilt OpenFoam transportmodel to describe your viscosity and the turbulencemodel to describe your turbulence.

(0.First copy the solver to a new directory and rename it (change the names in Make/files and rhoEFoam.C). Compile with 'wmake' to see whether it works.)

A. Get rid of constitutive model:

1. Delete in createFields.H:
Code:
 
// Create constitutive equation
constitutiveModel constEq(U, phi);
Code:
    IOdictionary cttProperties
    (
        IOobject
        (
            "constitutiveProperties",
            runTime.constant(),
            mesh,
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE
        )
    );
The easiest way is to look into simpleFoam and look for everywhere where 'turbulence' or 'turbulent appears' and include these changes into rheoEFoam. You will end up for OF4 version of rheoEFoam with the following steps:

2. Delete in rheoEFoam.C (or the new name you use):
Code:
#include "constitutiveModel.H"
and
Code:
// ---- Solve constitutive equation ----                  
constEq.correct();
After this compiling is not possible since the solver still calls 'constEq' in velocity equation file, i.e. UEqn.H. This you are going to change in the next section.

B) Use instead the inbuilt OpenFoam transportModel to describe your viscosity and the turbulenceModel to describe your turbulence:

1. Add at the end of createFields.H the lines to create a transport model instance and a turbulence instance. And also a transportProperties dictionary to read the density whcih you need for the electric forcing:

Code:
singlePhaseTransportModel laminarTransport(U, phi);

autoPtr<incompressible::turbulenceModel> turbulence
(
    incompressible::turbulenceModel::New(U, phi, laminarTransport)
);
Info« "Reading transportProperties\n" « endl;
IOdictionary transportProperties
    (
  IOobject
      (
    "transportProperties",
    runTime.constant(),
    mesh,
    IOobject::MUST_READ_IF_MODIFIED,
    IOobject::NO_WRITE
       )
);
dimensionedScalar rho
    (
  transportProperties.lookup("rho")
);
2. Add the words in the bold font in rheoEFoam.C (the words in normal font are for your orientation).
First to read the declarations of the transport and turbulence model into your solver.
Code:
#include "ppUtilInterface.H"
#include "EDFModel.H"
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
Then to update and validate the turbulence fields, e.g. the turbulent viscosity nut after the construction of the object (which happens in createFields.H), add before the simple loop:
Code:
    #include "initContinuityErrs.H"

    turbulence->validate();
Before the fields are written to the time directory add a correction of both instances (e.g. update of turbulent viscosity based on the new velocity field):
Code:
        laminarTransport.correct();
        turbulence->correct();

        runTime.write();
3. Change the UEqn.H to include the Reynoldsstress and get rid of the constEq:
Code:
   (
        fvm::ddt(U)
      + fvm::div(phi, U)
      + turbulence->divDevReff(U)
      ==
        fvOptions(U)
      + elecM.Fe()/rho  

   );
4. In the end add the following bold lines to Make/options:
Code:
EXE_INC = \
   -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
.....

EXE_LIBS = \
   -lturbulenceModels \
    -lincompressibleTurbulenceModels \
    -lincompressibleTransportModels \
Afterwards compile. Please let me know whether it worked, I didn't try the steps myself. So most probably I am missing something.

In the end you can copy the transportProperties and turbulenceProperties e.g. from 'tutorials/incompressible/pimpleFoam/LES/channel395/constant', you have to add rho to the transportProperties file.

I wonder whether one can use the 'normal' turbulence models for flow with electro-kinetic effects?
After the step B-5 above:

6-in solver.C delete :
Code:
    bool   sPS =  cttProperties.subDict("passiveScalarProperties").lookupOrDefault<Switch>("solvePassiveScalar",  false);
Code:
if (sPS) C.writeOpt() = IOobject::AUTO_WRITE;
Code:
if (sPS)
             {
               #include "CEqn.H"
             }
7-in UEqn.H ADD the words in the bold font:

Code:
    dimensionedScalar  rho_ = transportProperties.lookup("rho");
    tmp<fvVectorMatrix> tUEqn
    (
        fvm::ddt(U) 
      + fvm::div(phi, U)
+ turbulence->divDevReff(U)
      ==
        fvOptions(U)  

      + elecM.Fe()/rho_
    );
9- wmake
And that's it! It is successfully compiled!
ano ! I really appreciate your co-operation.
amuzeshi is offline   Reply With Quote

Reply


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
Error running compiled solver of fireFoam and conjugate heat transfer solver charles4allme OpenFOAM Running, Solving & CFD 2 April 26, 2019 06:58
adding Porous media to lagrangian Solver kalyan OpenFOAM Programming & Development 0 September 19, 2014 07:41
Star cd es-ice solver error ernarasimman STAR-CD 2 September 12, 2014 00:01
Problem of InterFoam with LES SpalartAllmarasIDDES keepfit OpenFOAM 3 August 29, 2013 11:21
LES solver with variable density for incompressible liquids matthias OpenFOAM Running, Solving & CFD 1 April 26, 2010 05:46


All times are GMT -4. The time now is 20:31.