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

Implement a turbulence model in OF-v1706

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By MaryBau
  • 1 Post By Petr Kazarin
  • 2 Post By MaryBau

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 5, 2017, 15:51
Default Implement a turbulence model in OF-v1706
  #1
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 16
MaryBau is on a distinguished road
Hi everyone,

I am trying to implement some changes to a turbulence model in OF-v1706. I have read some previous posts and blogs like Hassan´s (http://hassankassem.me/posts/newturbulencemodel/) about how to do it, but I am still getting errors and I am confused between the changes in the different versions.

What I have done so far is simply try to compile a OF turbulence model without making any real changes, so:

1) As in previous versions of OF, copy the kOmegaSSTIDDES .H and .C files into a folder in $WM_PROJECT_USER_DIR/src/, then I made the necessary changes to the file names and instances. Create Make/file and Make/options

2) If I understand correctly in the newer versions of OF, you now have to add also turbulentTransportModels.C and *.H, and do the according modifications as explained in Hassan´s blog.

wmake libso and it did not work. I get lots of errors and it seems that I am missing a library, but I am not sure.

This is my Make/options:

Code:
EXE_INC = \
    -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/turbulenceModels \
    -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
    -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude

LIB_LIBS = \
    -lincompressibleTurbulenceModels \
    -lincompressibleTransportModels \
    -libturbulenceModels \
    -lfiniteVolume \
    -lmeshTools
and this is the first of many errors that I get:

Code:
In file included from /home/mary/OpenFOAM/OpenFOAM-v1706/src/TurbulenceModels/turbulenceModels/lnInclude/kOmegaSSTDES.H:54:0,
                 from kOmegaSST_SIDDES.H:50,
                 from turbulentTransportModels.C:136:
/home/mary/OpenFOAM/OpenFOAM-v1706/src/TurbulenceModels/turbulenceModels/lnInclude/DESModel.H:55:28: error: expected template-name before ‘<’ token
     public LESeddyViscosity<BasicTurbulenceModel>
                            ^
I am attaching all my files and log of the compilation output.

Thanks,

Mary
Attached Files
File Type: gz kOmegaSST_SIDDES.tar.gz (7.5 KB, 44 views)
MaryBau is offline   Reply With Quote

Old   October 13, 2017, 19:07
Default
  #2
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 16
MaryBau is on a distinguished road
Hi again,

I have not tried it, but this link might be the solution.

But, is that the only way? Do I have to recompile all the turbulence models now in my $WM_PROJECT_USER_DIR ?

Thanks!
purnp2 likes this.
MaryBau is offline   Reply With Quote

Old   October 16, 2017, 13:47
Default Did you create a makeTurModel.C file
  #3
New Member
 
Ehimen
Join Date: Jun 2016
Posts: 12
Rep Power: 10
Elliptic CFD is on a distinguished road
You need to create a separate makeTurModel.C file as specified in Hassan's blog. In the file, you need to determine if you are building an LES, RANS or DES model. In your case, you are creating I believe a DES model.

If you are using OpenFOAM 4, then add the following lines

#include "kOmegaSSTIDDES.H"
makeLESModel(kOmegaSSTIDDES);

You are actually making a new 'LES' model. For OpenFOAM+, I believe that you can specify making a DES model template.

Afterwards, you add makeTurModel.C to 'file' in the Make directory.

If you still have problems, let me know.
Elliptic CFD is offline   Reply With Quote

Old   October 16, 2017, 16:39
Default
  #4
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 16
MaryBau is on a distinguished road
Thanks Ehimen for your help.

That is exactly what I did! And I still got the errors. What I am not sure is if I have to recompile ALL the turbulence models in my USER dir to be able to modify just one turbulence model (Like I mentioned in the post #2).

I am using OF-v1706.
MaryBau is offline   Reply With Quote

Old   October 17, 2017, 15:43
Default
  #5
New Member
 
John P
Join Date: Apr 2015
Posts: 7
Rep Power: 11
Petr Kazarin is on a distinguished road
Check this site. They explain how to code it in 1706.

https://pingpong.chalmers.se/public/...ml?language=en
potentialFoam likes this.
Petr Kazarin is offline   Reply With Quote

Old   October 18, 2017, 10:31
Default
  #6
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 16
MaryBau is on a distinguished road
Thanks Petr for your help.

I followed the Chalmer´s instructions to implement a turbulence model. It worked, but I had to recompile all the turbulence models in my USER directory, to do a small change in only one turbulence model.

I am not sure if that is the best way to do it, but it does the job.

Thanks everyone.
MaryBau is offline   Reply With Quote

Old   November 27, 2017, 08:12
Default Code for SST-RC
  #7
Member
 
Peter
Join Date: Nov 2015
Location: Hamburg, Germany
Posts: 57
Rep Power: 11
potentialFoam is on a distinguished road
Dear Foamers,

thanks for the nice thread, especially Petr's link was very helpful.

I try to implement the rotation/curvature correction to the SST turbulence model, according to
https://turbmodels.larc.nasa.gov/sst.html

My problem is that the SST approach is quite different and I don't know how to change the production term according to the curvature correction model.
Can I just redefine the function 'Pk' in the new file 'kOmegaSSTRC.C'?

Besides, I hope someone did it already and I hope to find someone who may load his code up to e.g. github. The old versions there on SST-RC cannot be used with the current implementation of the turbulence models in OF 1706.

Best Regards,
Peter
potentialFoam is offline   Reply With Quote

Old   November 27, 2017, 09:35
Default
  #8
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 16
MaryBau is on a distinguished road
Hi Peter,

I am not familiar with the rotation/curvature correction of the SST model, but it seems that in theory you only have to change the Pk term as you mentioned.

However, in the new versions of OF (including v1706) the Pk term and the k-w equations for the SST model are not defined in kOmegaSST.C, but in kOmegaSSTBase.C.

I think the more proper/efficient way to do it will be to create your_own_kOmegaSST.C that modifies the basic Pk (like it is done in kOmegaSSTLM turbulence model in OF).

Hope I answered your question,

Mary
potentialFoam and purnp2 like this.
MaryBau is offline   Reply With Quote

Old   May 15, 2019, 01:02
Default error in OF1812+
  #9
New Member
 
Purn Prakash
Join Date: Nov 2018
Posts: 27
Blog Entries: 1
Rep Power: 8
purnp2 is on a distinguished road
Hello,
I am using the method as prescribed on the Chalmers website (link attached) for OF-v1706 on OF-v1812.
After I copy-pasted definition of correct() function and replaced the template name according to instructions, I compiled with ./Allmake. Hereafter I found 2 errors which are not expected:

Code:
In file included from ../turbulenceModels/lnInclude/kOmegaSSTF.H:192:0,
                        from turbulentTransportModels/turbulentTransportModels.C:76:
../turbulenceModels/lnInclude/kOmegaSSTF.C:93:51: error: definition of ‘void Foam::kOmegaSSTBase<BasicEddyViscosityModel>::correct()’ is not in namespace enclosing ‘Foam::kOmegaSSTBase<BasicEddyViscosityModel>’ [-fpermissive]
 void kOmegaSSTBase<BasicTurbulenceModel>::correct()
                                                   ^
../turbulenceModels/lnInclude/kOmegaSSTF.C:93:6: error: redefinition of ‘void Foam::kOmegaSSTBase<BasicEddyViscosityModel>::correct()’
 void kOmegaSSTBase<BasicTurbulenceModel>::correct()
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The link to the Chalmers University's instruction page (the same link has been shared two times in this thread) :
https://pingpong.chalmers.se/public/...o?item=3855255

any help is appreciated.
Thanks
purnp2 is offline   Reply With Quote

Old   May 25, 2019, 12:55
Default
  #10
New Member
 
Purn Prakash
Join Date: Nov 2018
Posts: 27
Blog Entries: 1
Rep Power: 8
purnp2 is on a distinguished road
Ok! Solved the problem, thanks anyhow.
purnp2 is offline   Reply With Quote

Old   August 6, 2019, 23:15
Default
  #11
New Member
 
Hamdani
Join Date: Nov 2011
Posts: 5
Rep Power: 15
hamdani is on a distinguished road
I have the same problem.

Please let me know how you solve the problem.

Thanks
hamdani is offline   Reply With Quote

Old   September 12, 2023, 17:13
Default
  #12
New Member
 
Andrew McFadden
Join Date: May 2022
Posts: 3
Rep Power: 4
amcfad94 is on a distinguished road
Quote:
The link to the Chalmers University's instruction page (the same link has been shared two times in this thread) :
https://pingpong.chalmers.se/public/...o?item=3855255

any help is appreciated.
Thanks
Is there a way to find this link again? It sounds like it will explain what I need, but the link appears to be dead.

I'm trying to apply a correction to the dissipation of k and epsilon for a compressibility correction modified turbulence model
amcfad94 is offline   Reply With Quote

Reply

Tags
compilation, of-v1706, turbulence model


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
Fluent :- turbulence Model prince_pahariaa FLUENT 9 May 20, 2016 04:41
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44
What model of turbulence choose to study an external aerodynamics case raffale OpenFOAM 0 August 23, 2012 06:45
Discussion: Reason of Turbulence!! Wen Long Main CFD Forum 3 May 15, 2009 10:52
Why Turbulence models are not universal. Senthil Main CFD Forum 4 July 5, 2000 05:34


All times are GMT -4. The time now is 14:08.