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

Turbulent dispersion of particle tracking in LES

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 22, 2011, 04:02
Default Turbulent dispersion of particle tracking in LES
  #1
New Member
 
Kushagra Mittal
Join Date: Mar 2009
Posts: 15
Rep Power: 17
mittal is on a distinguished road
Hi,

OpenFOAM source code has RANS based turbulent dispersion models for particle tracking but not LES. To build a LES based dispersion model, I tried to modify file DispersionRASModel.C and DispersionRASModel.H in the directory /OpenFOAM/OpenFOAM-1.6/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionRASModel

My idea was to force above mentioned files access LES data (instead of RANS data) without changing the model name (the dispersion model name still remains StochasticDispersionRAS or GradientDispersionRAS but it would become LES based, if successful). ofcourse, calculations will change, but i plan to take care of them later on. just trying to check if it works first.

so following are the changes that I make (in red)

file DispersionRASModel.C
\*---------------------------------------------------------------------------*/

#include "DispersionRASModel.H"

// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

template<class CloudType>
Foam:: DispersionRASModel<CloudType>:: DispersionRASModel
(
const dictionary& dict,
CloudType& owner
)
:
DispersionModel<CloudType>(dict, owner),
turbulence_
(
owner.mesh().objectRegistry::lookupObject<compress ible::LESModel>
(
"LESProperties"
)
),
kPtr_(NULL),
ownK_(false),
epsilonPtr_(NULL),
ownEpsilon_(false)
{}


// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

template<class CloudType>
Foam:: DispersionRASModel<CloudType>::~DispersionRASModel ()
{
cacheFields(false);
}


// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

template<class CloudType>
void Foam:: DispersionRASModel<CloudType>::cacheFields(const bool store)
{
if (store)
{
tmp<volScalarField> tk = this->turbulence().k();
if (tk.isTmp())
{
kPtr_ = tk.ptr();
ownK_ = true;
}
else
{
kPtr_ = tk.operator->();
ownK_ = false;
}

tmp<volScalarField> tepsilon = this->turbulence().epsilon();
if (tepsilon.isTmp())
{
epsilonPtr_ = tepsilon.ptr();
ownEpsilon_ = true;
}
else
{
epsilonPtr_ = tepsilon.operator->();
ownEpsilon_ = false;
}
}
else
{
if (ownK_ && kPtr_)
{
delete kPtr_;
ownK_ = false;
}
if (ownEpsilon_ && epsilonPtr_)
{
delete epsilonPtr_;
ownEpsilon_ = false;
}
}
}


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

file DispersionRASModel.H


\*---------------------------------------------------------------------------*/

#ifndef DispersionRASModel_H
#define DispersionRASModel_H

#include "DispersionModel.H"
#include "LESModel.H"


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

namespace Foam
{

/*---------------------------------------------------------------------------*\
Class DispersionRASModel Declaration
\*---------------------------------------------------------------------------*/

template<class CloudType>
class DispersionRASModel
:
public DispersionModel<CloudType>
{
protected:

// Protected data

//- Reference to the compressible turbulence model
const compressible::LESModel& turbulence_;

// Locally cached turbulence fields

//- Turbulence k
const volScalarField* kPtr_;

//- Take ownership of the k field
bool ownK_;

//- Turbulence epsilon
const volScalarField* epsilonPtr_;

//- Take ownership of the epsilon field
bool ownEpsilon_;


public:

//- Runtime type information
TypeName("DispersionRASModel");


// Constructors

//- Construct from components
DispersionRASModel
(
const dictionary& dict,
CloudType& owner
);


//- Destructor
virtual ~DispersionRASModel();


// Member Functions

//- Cache carrier fields
virtual void cacheFields(const bool store);

//- Return const access to the turbulence model
const compressible::LESModel& turbulence() const
{
return turbulence_;
}
};


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

} // End namespace Foam

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

#ifdef NoRepository
# include "DispersionRASModel.C"
#endif

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

#endif


so when i run my simulation, it throws error

:lookup of LESProperties from objectRegistry region0 successful
but it is not a LESModel, it is a Smagorinsky#0 Foam::error:: printStack(Foam::Ostream&) in "/home/user/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"


In original code, it searched for file:RASProperties (which I change to LESProperties file here) and looked for the RASModel (here i make it search for the LESModel). So why it does not accept Smangroski as LESModel while the original code successfully accepted kEpsilon option for RASModel.

Could you please guide me so that I can prepare a template for LES based turbulent dispersion model.

Many many thanks for your help and considersation,

Regards,
Kushagra
mittal is offline   Reply With Quote

Old   February 8, 2011, 19:26
Default
  #2
Member
 
N. A.
Join Date: May 2010
Posts: 64
Rep Power: 15
N. A. is on a distinguished road
Hello there,

So I was trying to implement a LES based dispersion model (Apte and Moin). its based on solving Langevin equation. I have not started yet, but I was experimenting to add a particule dispersion model.

So I went on and renamed GradientDispersionRAS to myGradientDispersionRAS. I also changed whereever the word was GradientDispersionRAS to myGradientDispersionRAS.

Few of the files I had to do was:

makeReactingParcelDispersionModels.H (intermediate/parcels/include/makeReactingParcelDispersionModels.H)

makeParcelDispersionModels.H (intermediate/parcels/include/makeReactingParcelDispersionModels.H)

myGradientDispersionRAS.H (intermediate/submodels/Kinematic/DispersionModel/myGradientDispersionRAS/myGradientDispersionRAS.H)

myGradientDispersionRAS.C (intermediate/submodels/Kinematic/DispersionModel/myGradientDispersionRAS/myGradientDispersionRAS.H)

___________

But when I run the coalChemistryFoam, it still says that the only option I have is one among the following 3 dispersion models:

--> FOAM FATAL ERROR:
Unknown DispersionModelType type myGradientDispersionRAS, constructor not in hash table
Valid DispersionModel types are:
3
(
GradientDispersionRAS
StochasticDispersionRAS
none
)

From function DispersionModel<CloudType>::New(const dictionary&, CloudType&)
in file /home/NA/OpenFOAM/OpenFOAM1.7.x/src/lagrangian/intermediate/lnInclude/NewDispersionModel.C at line 54.


I am at a total loss why would it do, inspite of the fact that all the libraries were compiled successfully. yes I also compiled after deleting lninclude and Make/linux64GccDPOpt directories. I also compiled the coalChemsitryFoam solver also.

Any suggestions will be helpful.

Kushagra,

Can you try this and let me know if you are also getting the same issue.

Thanks,
Nir
N. A. is offline   Reply With Quote

Old   February 9, 2011, 00:35
Default
  #3
New Member
 
Kushagra Mittal
Join Date: Mar 2009
Posts: 15
Rep Power: 17
mittal is on a distinguished road
Hi,

I am just a beginner in OpenFOAM. You get this error because your new model 'myGradient--------' has not been added to the object list. The code does not know if this key 'myGradient--------' word. Yes, your code may compile because all the files/libraries it needs are accessible to it. But successful compilation does not mean that you code will do what you want it do. It is just like convergence in CFD. convergence does not mean you will get RIGHT solution. yes, you will get a solution but it may be wrong or right. Does it make more clear?

Now how to add your new model option to objects list ( I may not be using right words from OpenFOAM programming perspective but blame should go to my lack of experience with it)? I did it at some point but do not remember it right now. Do one simple thing. Use cat and grep command to find which other files use StochasticRAS----- or Gradient----- words. One of them must be adding these models to the code. Just use existing code in that file to add your model to the code.

Good Luck,
Kushagra
mittal is offline   Reply With Quote

Old   February 9, 2011, 01:08
Default
  #4
Member
 
N. A.
Join Date: May 2010
Posts: 64
Rep Power: 15
N. A. is on a distinguished road
Hi Kushagra,

I acutally did a grep search of word GradientDispersionRAS and thats how I proceeded. I found that there are 4 files that use GradientDispersionRAS:

makeReactingParcelDispersionModels.H (intermediate/parcels/include/makeReactingParcelDispersionModels.H)

makeParcelDispersionModels.H (intermediate/parcels/include/makeReactingParcelDispersionModels.H)

GradientDispersionRAS.H (intermediate/submodels/Kinematic/DispersionModel/GradientDispersionRAS/GradientDispersionRAS.H)

GradientDispersionRAS.C (intermediate/submodels/Kinematic/DispersionModel/GradientDispersionRAS/GradientDispersionRAS.H)

Can you please try renaming it and see if you are able to run coalChemistryFoam with a modified name. With this I can confirm if I am missing any other files. I found that there are only four above files that are involved with turbulent dispersion.

Thanks,
Nir
N. A. is offline   Reply With Quote

Old   February 23, 2011, 19:01
Default wmake libso?
  #5
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
This type of error is often encountered when making a new boundary condition, custom linear system solver, etc. I would suggest making a dynamic library from your dispersion model into something named libMyDispersionModel and then including the line.

libs("libMyDispersionModel.so")

in your controlDict file of the solver you want to use your dispersion model in. This is similar to the explanation for adding a new boundary condition in:

http://www.tfd.chalmers.se/~hani/kur...yCondition.pdf

Thats probably not clear (my brain is fighting to write clearly right now), but its a quick answer.

hope that helps.

Dan
chegdan is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Particle dispersion model with LES? mittal OpenFOAM Running, Solving & CFD 2 October 29, 2010 16:50
LES + VOF + Particle tracking mittal OpenFOAM Running, Solving & CFD 5 October 21, 2010 20:32
LES + VOF + Particle tracking mittal OpenFOAM 0 June 29, 2010 07:41
Turbulent Dispersion for Coal Combustion gravis CFX 2 March 24, 2010 00:56
Turbulent Dispersion in Particle Tracking ariel CFX 2 April 22, 2008 23:02


All times are GMT -4. The time now is 07:30.