CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Implement a turbulence model in OF-v1706 (https://www.cfd-online.com/Forums/openfoam-programming-development/193878-implement-turbulence-model-v1706.html)

MaryBau October 5, 2017 15:51

Implement a turbulence model in OF-v1706
 
1 Attachment(s)
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

MaryBau October 13, 2017 19:07

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!

Elliptic CFD October 16, 2017 13:47

Did you create a makeTurModel.C file
 
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.

MaryBau October 16, 2017 16:39

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.

Petr Kazarin October 17, 2017 15:43

Check this site. They explain how to code it in 1706.

https://pingpong.chalmers.se/public/...ml?language=en

MaryBau October 18, 2017 10:31

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.

potentialFoam November 27, 2017 08:12

Code for SST-RC
 
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

MaryBau November 27, 2017 09:35

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

purnp2 May 15, 2019 01:02

error in OF1812+
 
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 May 25, 2019 12:55

Ok! Solved the problem, thanks anyhow.

hamdani August 6, 2019 23:15

I have the same problem.

Please let me know how you solve the problem.

Thanks


All times are GMT -4. The time now is 01:52.