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

Several questions about modification of turbulence model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 27, 2018, 23:37
Question Several questions about modification of turbulence model
  #1
Senior Member
 
LT
Join Date: Dec 2010
Posts: 104
Rep Power: 15
NewKid is on a distinguished road
Hi ,Foamers, I've been working on the modification of Smagorinsky model to add one source. Now several questions must be killed before next move, listed as follows.
(1) while modifying model code, pointer 'this' in the file (or scope?) means what? Since I need to access the liquid parcels (in a two-phase case), how to make it through 'this'? To instance laplaceFilter class, the dictionary is a must. How to do it?
(2) I try to use a volScalarField field-variable to hold the source mentioned above, but it seems that 'volScalarField Ws(0.0)' does not success, whereas there some declarations in the Smagorinsky.C which are safe, listed as follows:
volSymmTensorField D(symm(gradU));
volScalarField a(this->Ce_/this->delta());
volScalarField b((2.0/3/0)*tr(D));
volScalarField c(2*Ck_*this->delta()*(dev(D) && D));

While in general, volScalarField is declared as follows??
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
What's the difference? And if declare 'volScalarField Ws(0.0)', an error message is shown as 'no matching function for call to 'Foam::GeometricField<Foam::fvPatchField,Foam::vol Mesh>::GeometricField(double)''. Seems OF treat it as a function?

(3) In Smogrinsky model, k (SGS kinetic energy) is volScalarField. I must filter the velocity field to calculate the source, therefore, the input velocity field should be a ScalarField or a VectorField? If it's a scalar field, how to get it since the U() is a vector field? In Smagorinsky.H, the function is declared as follows:
virtual tmp<volSaclarField> K() const
{
retrn k(fvc::grad(this->U_));
}

Thanks a lots!!!
NewKid is offline   Reply With Quote

Old   November 2, 2018, 19:26
Question
  #2
Senior Member
 
LT
Join Date: Dec 2010
Posts: 104
Rep Power: 15
NewKid is on a distinguished road
Question NO.2 seems OK once volScalarField Ws(0.0) is defined like volScalarField Ws(0.0*tr(D)).
Anyone could give any clue to other questions? Especially question NO. 1.
Thanks in advance.
NewKid is offline   Reply With Quote

Old   November 3, 2018, 12:24
Default
  #3
Senior Member
 
Peter Baskovich
Join Date: Jul 2014
Posts: 127
Rep Power: 11
pete20r2 is on a distinguished road
I can answer some of this, the IOobject type of declaration is used for fields that are stored on the mesh. These are for fields that are read and written to timesteps (although they don't have to be).
The inline style declaration is calculated on the fly and is destroyed after each iteration.
pete20r2 is offline   Reply With Quote

Old   November 3, 2018, 13:04
Default
  #4
Senior Member
 
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 354
Rep Power: 15
Santiago is on a distinguished road
Quote:
Originally Posted by NewKid View Post
Question NO.2 seems OK once volScalarField Ws(0.0) is defined like volScalarField Ws(0.0*tr(D)).
Anyone could give any clue to other questions? Especially question NO. 1.
Thanks in advance.
Note: i work with foam-extend


Regarding question 1. "this" refers to an instance (an object) of the class itself. So if you have a member of the class that does:

return *this;

The member function would return the object itself.

2.
An object of type double is not correct to construct an object of type volScalarField, you can use a scalar type:

volScalarField xss(scalar::zero);

Check the constructors of geometricField for details.

3. Check the overloading function operator() for the LESfilter class, there you'll see one virtual function that admits volVectorFields.

4. The parent class that you should be using for your new turbulence model should be GenEddyVisc, which inherits a virtual function called 'read'. There you can make the filter object call its "read" using the appropriate dictionary (LESProperties)
Santiago is offline   Reply With Quote

Old   November 7, 2018, 11:01
Question
  #5
Senior Member
 
LT
Join Date: Dec 2010
Posts: 104
Rep Power: 15
NewKid is on a distinguished road
Hi, pete20r2 and Santiago, thank both of you for your responses!
So nice to see you, Santiago!

In fact, the key point of the NO. 1 question is that how to access the spraycloud or liquid parcels in the turbulence file (or scope) since I need to assess the influence of the liquid parcels on the kinetic energy of the ambient gas. The pointer 'this' in the LES model means a model and the owner of 'this' means an UList which do not have any member to access the spraycloud or liquid parcels in the mesh. The biggest issue is to access every liquid parcel to calculate one source to modify the model.

As you mentioned, the parent class of my new modified model should be GenEddyVisc, which is not found in OpenFOAM 4.0. What I've been doing is to modify the source code of Smagorinsky model directly to have the source. Is it proper to do so? Or maybe I must write a new model code which inherits GenEddyVisc-like class?

PS: I find 'LESeddyViscosity' class instead of 'GenEddyVisc' class in OpenFOAM 4.0, the former is the parent class of Smagorinsky model, defined as follows in Smagorinsky.H:

template<class BasicTurbulenceModel>
class Smagorinsky
:
public LESeddyViscosity<BasicTurbulenceModel>
{
......
}

Is 'LESeddyViscosity' class in OpenFOAM the same as 'GenEddyVisc' class in foam-extend?
NewKid is offline   Reply With Quote

Reply

Tags
liquid parcels, turbulence model, two-phase


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
Modified k-e turbulence model UDF Travis Fluent UDF and Scheme Programming 7 November 11, 2018 20:21
NEW turbulence TRANSITIONAL model giammy92 OpenFOAM 3 June 30, 2016 09:47
Turbulence model for two phase incompressible flow SailorLiu OpenFOAM Running, Solving & CFD 2 April 4, 2016 07:53
Implement an les turbulence model pante OpenFOAM Programming & Development 19 December 5, 2014 16:16
How to decide to Turbulence model shipman OpenFOAM 2 August 18, 2013 03:00


All times are GMT -4. The time now is 19:48.