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

Modification in Deardorff SGS

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By ehsan
  • 1 Post By Tobi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 18, 2016, 05:57
Default Modification in Deardorff SGS
  #1
Senior Member
 
Ehsan
Join Date: Mar 2009
Posts: 112
Rep Power: 17
ehsan is on a distinguished road
Hello,

We try to add a formula based on the gradient of velocity in the Deardorff stress model and develop a model (Modulated Gradient model). However, we encounter the errors that is attached. I would be regretful if someone could advice us in this issue, because as soon as we add a few lines of:

const volSymmTensorField Gij_
(

Gij_.component(symmTensor::XX) = ((sqr(delta())/12.0)*(fvc::grad(U).component(tensor::XX)*fvc::gra d(U).component(tensor::XX)))+((sqr(delta())/12.0)*(fvc::grad(U).component(tensor::XY)*fvc::gra d(U).component(tensor::XY)))+((sqr(delta())/12.0)*(fvc::grad(U).component(tensor::XZ)*fvc::gra d(U).component(tensor::XZ)));

);

in the void MyDeardorffDiffStress::correct(const tmp<volTensorField>& gradU)
the attached error appears.

Regards
Attached Images
File Type: jpg Screenshot from 2016-08-18 11-04-0511.jpg (189.2 KB, 16 views)
Attached Files
File Type: c MyDeardorffDiffStress.C (5.9 KB, 13 views)
Elyas_Mosibat likes this.
ehsan is offline   Reply With Quote

Old   August 18, 2016, 07:03
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,

the first problem is that the field U is not available in your function. So you can not call fvc::grad(U). What you can do is replacing fvc::grad(U) by gradU. Another way is to get access to the U field by taking it from the registry database from OpenFOAM and build the gradU field again (but in my opinion this would be senseless if you already have gradU available).

There are other mistakes you made but just one hint.

Think about your code: calling
fvc::grad(U) six times is just waste of computational resources. Call it once, save that field and use that field or just use the gradU that is already available.


PS: Use Code-tags.
Elyas_Mosibat likes this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   August 19, 2016, 07:40
Default
  #3
Senior Member
 
Ehsan
Join Date: Mar 2009
Posts: 112
Rep Power: 17
ehsan is on a distinguished road
Thank you. We move in this direction but now the code do not understand component command for gradU, as the attached file depicts.
Attached Images
File Type: jpg Error Component.jpg (196.6 KB, 11 views)
ehsan is offline   Reply With Quote

Old   August 19, 2016, 14:25
Default
  #4
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Okay,

you are using this field:
Code:
void MyDeardorffDiffStress::correct(const tmp<volTensorField>& gradU)
So gradU is a volTensorField. To know which functions you can use, you use Doxygen... http://cpp.openfoam.org/v4/

Then you can search for volTensorField. Here you will realize that this is derived from a GeometricField. So you check the GeometricField class. Here you will find a lot of functions. The function you can call is component. So you can do something like that:

Code:
tmp< GeometricField< cmptType, PatchField, GeoMesh > > theComponents = gradU.component();
Then you can go further. Maybe it is also possible to get the components directly like:

Code:
scalar oneComponent = gradU[0].component().xx();

or

scalar oneComponent = gradU[0].component()[0]
I have no enviroment at the moment, so no chance to check it
Hope you get some further steps.

Another way is to search the source code for the volTensorFields and hope that you get to a part where you find what you need

Have a nice weekend.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   August 20, 2016, 12:34
Default
  #5
Senior Member
 
Ehsan
Join Date: Mar 2009
Posts: 112
Rep Power: 17
ehsan is on a distinguished road
Thank you!
We tried lot of combinations, all our trials and their errors are put in a doc file here:

https://fumdrive.um.ac.ir/index.php/s/VqX1vK0FbbkFST3

1- Here, I attached the error of applying the lines attached in "Lines" image below as file "Error"

2- Once we tried the other command you suggested:

tmp< GeometricField< cmptType, PatchField, GeoMesh > > theComponents = gradU.component();


the "error2" appears. I'd be more than happy if you help us in this regards.


Ehsan


Attached Images
File Type: jpg Error.jpg (75.6 KB, 8 views)
File Type: jpg error2.jpg (128.7 KB, 12 views)
File Type: png Lines.png (4.7 KB, 5 views)
ehsan 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
Compressible vs incompressible SGS model! zhangyan Main CFD Forum 10 June 4, 2016 04:39
Issues on modelling of isotropic part of Reynolds (SGS) stresses Likun OpenFOAM Programming & Development 2 January 25, 2016 02:51
Smagorinsky Sub-Grid Turbulence Model vs. Deardorff oksero Main CFD Forum 4 July 29, 2015 10:43
How to exploit SGS kinetic energy with Smagorinsky model in LES babakflame OpenFOAM Programming & Development 3 December 14, 2014 06:58
What is really SGS dissipation term in LES? mrf6166 Main CFD Forum 0 January 5, 2014 06:57


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