CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   the error during add turbulence model in openFOAM 5.0 (https://www.cfd-online.com/Forums/openfoam/199105-error-during-add-turbulence-model-openfoam-5-0-a.html)

ht2017 February 26, 2018 02:25

the error during add turbulence model in openFOAM 5.0
 
Hi everyone,
Now, I implement adding turbulence model in openFoam 5.0. But when I comment "wmake" then the error appeared.
https://www.cfd-online.com/Forums/me...4-thanh123.jpg

please help me find this error

thank you very much

anuragm February 26, 2018 05:03

First of all, why are you messing around in the OF install directory?

You should be working in the user directories:
$FOAM_USER_APPBIN / $FOAM_USER_LIBBIN

This way you ensure that your changes do not mess up your installation and other solvers that may be dependent on common libraries

You should start with a tutorial that explains how to implement a custom turbulence model. Following is an example, it might not work exactly like that in newer version of OF, but at least it will get you started in the right direction.

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

ht2017 February 26, 2018 05:53

Quote:

Originally Posted by anuragm (Post 682919)
First of all, why are you messing around in the OF install directory?

You should be working in the user directories:
$FOAM_USER_APPBIN / $FOAM_USER_LIBBIN

This way you ensure that your changes do not mess up your installation and other solvers that may be dependent on common libraries

You should start with a tutorial that explains how to implement a custom turbulence model. Following is an example, it might not work exactly like that in newer version of OF, but at least it will get you started in the right direction.

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

I also follow this reference but I also can't do it.Could you help me.

anuragm February 26, 2018 06:13

Quote:

Originally Posted by ht2017 (Post 682924)
I also follow this reference but I also can't do it.Could you help me.

You clearly are not following it as written because the very first slide mentions this command

Code:

cd $WM_PROJECT_DIR
cp -r --parents src/turbulenceModels/RAS/incompressible/kEpsilon \
$WM_PROJECT_USER_DIR
cd $WM_PROJECT_USER_DIR/src/turbulenceModels/RAS/incompressible/
mv kEpsilon mykEpsilon
cd mykEpsilon

These lines copy an existing turbulence model (kEpsilon) into the user directory (WM_PROJECT_USER_DIR) and then rename it to mykEpsilon. This is the directory in which the example is being tested and not in the opt directory.

In fact, in your own screenshot you are running wmake in the wrong directory. First of all you are trying to do this in the /opt directory (which is the default install location of OpenFOAM) and not in your user copy - this could create problems for you. Second, even the wmake command is being executed in the wrong directory. It just seems to me you have no idea what you are doing but are blindly copy-pasting into the command line. This is a dangerous practice and will only cause more harm than good! Correct me if I'm wrong in this assumption.

ht2017 February 27, 2018 00:31

Quote:

Originally Posted by anuragm (Post 682929)
You clearly are not following it as written because the very first slide mentions this command

Code:

cd $WM_PROJECT_DIR
cp -r --parents src/turbulenceModels/RAS/incompressible/kEpsilon \
$WM_PROJECT_USER_DIR
cd $WM_PROJECT_USER_DIR/src/turbulenceModels/RAS/incompressible/
mv kEpsilon mykEpsilon
cd mykEpsilon

These lines copy an existing turbulence model (kEpsilon) into the user directory (WM_PROJECT_USER_DIR) and then rename it to mykEpsilon. This is the directory in which the example is being tested and not in the opt directory.

In fact, in your own screenshot you are running wmake in the wrong directory. First of all you are trying to do this in the /opt directory (which is the default install location of OpenFOAM) and not in your user copy - this could create problems for you. Second, even the wmake command is being executed in the wrong directory. It just seems to me you have no idea what you are doing but are blindly copy-pasting into the command line. This is a dangerous practice and will only cause more harm than good! Correct me if I'm wrong in this assumption.

Hi you,
I did it again and it runs with comment "wmake". In my library appear the folders ( platforms>>linux64GccDPlnt32Opt>>lib>>libuserincom pressibleRASModels.so and in the folder SRC of usre>>turbulenceModels>>incompressible>>RAS appear the lnInclude folder and in the folder Make appear the linux64GccDPlnt32Opt>>(mykEpsilon +option + sourcefile+variable). I think I built my new turbulence in my library. And then I add a line to "controlDict" in the my simulation (libs ("libuserincompressibleRASModels.so"); and change RASModel to mykEpsilon. but when I run my simulation it report "Unknown RASModel type mykEpsilon". Can you give me your advice about the problem?
thank you very much.
https://www.cfd-online.com/Forums/me...906-thanh4.jpg
https://www.cfd-online.com/Forums/me...e905-thanh.jpg

anuragm February 27, 2018 03:09

To put it simply, it appears that your custom turbulence model is now compiled but the solver (or OpenFOAM) is not aware of its existence. You will need to add this model to the runtime selection table.

This following link is a follow up to the previously linked tutorial. The author mentions what has changed in the recent version of OpenFOAM and why the previous tutorial does not work in OF 3.0 (and newer). They also mention how to make it work.

http://hassankassem.me/posts/newturbulencemodel/

ht2017 March 1, 2018 05:40

Quote:

Originally Posted by anuragm (Post 683041)
To put it simply, it appears that your custom turbulence model is now compiled but the solver (or OpenFOAM) is not aware of its existence. You will need to add this model to the runtime selection table.

This following link is a follow up to the previously linked tutorial. The author mentions what has changed in the recent version of OpenFOAM and why the previous tutorial does not work in OF 3.0 (and newer). They also mention how to make it work.

http://hassankassem.me/posts/newturbulencemodel/

Hi you,
I am following this the reference you sent me. When I run the test with new turbulence it appears the error.
https://www.cfd-online.com/Forums/me...e907-thaaa.jpg

do you know what is the error? How to fix it?
thank you

anuragm March 1, 2018 11:34

There could be many sources behind the error, mostly related to how you've defined your custom library. Chances are you forgot to link an important library or made a wrong class definition in there. Double check it to see you've not made any errors. Then compare your library with one of the default OF libraries to see if you are missing something. Especially, check the Make/options. You can use nm to list the library file and search for the symbol that causes the error using grep with the following format:

Code:

$> nm LIBRARY_PATH/LIBRARY_NAME.so | grep SYMBOL
And to be honest, just do a search of the forum before you ask a question. Chances are it has already been answered by someone before.

https://www.cfd-online.com/Forums/op...tml#post660305

https://www.cfd-online.com/Forums/op...kup-error.html

https://www.cfd-online.com/Forums/op...kup-error.html

https://www.cfd-online.com/Forums/op...kup-error.html

ht2017 March 2, 2018 07:17

Quote:

Originally Posted by anuragm (Post 683401)
There could be many sources behind the error, mostly related to how you've defined your custom library. Chances are you forgot to link an important library or made a wrong class definition in there. Double check it to see you've not made any errors. Then compare your library with one of the default OF libraries to see if you are missing something. Especially, check the Make/options. You can use nm to list the library file and search for the symbol that causes the error using grep with the following format:

Code:

$> nm LIBRARY_PATH/LIBRARY_NAME.so | grep SYMBOL
And to be honest, just do a search of the forum before you ask a question. Chances are it has already been answered by someone before.

https://www.cfd-online.com/Forums/op...tml#post660305

https://www.cfd-online.com/Forums/op...kup-error.html

https://www.cfd-online.com/Forums/op...kup-error.html

https://www.cfd-online.com/Forums/op...kup-error.html

the first, I want to thank you to help me and give me the advice necessary. I had success in the adding new turbulence.

Now I am doing the same work with the kOmegaSSTLM turbulence. But I give this notification. Could you give me your advice?

this error: opt/openfoam5/src/TurbulenceModels/turbulence/lnInclude/kOmegaSSTBase.C:133:30 ERROR: 'fvc' has not been declared correctNut(2*magSqr(symm(fvc::grad(this-->u_))),F23());
opt/openfoam5/src/TurbulenceModels/turbulence/lnInclude/kOmegaSSTBase.C:133:30 ERROR: 'fvc' has not been declared
fvc::div(fvc::absolute(this-->phi(),u))()()


https://www.cfd-online.com/Forums/me...e908-error.jpg
https://www.cfd-online.com/Forums/me...09-options.jpg
https://www.cfd-online.com/Forums/me...keturmodel.jpg

I think I do not have a reasonable path in options file or the makeTurModel.C has not declared a thing.
please give me advice.

anuragm March 2, 2018 08:23

Try

Code:

#include "fvc.H"

ancolli August 9, 2018 11:25

Quote:

Originally Posted by ht2017 (Post 683522)
the first, I want to thank you to help me and give me the advice necessary. I had success in the adding new turbulence.

Now I am doing the same work with the kOmegaSSTLM turbulence. But I give this notification. Could you give me your advice?

this error: opt/openfoam5/src/TurbulenceModels/turbulence/lnInclude/kOmegaSSTBase.C:133:30 ERROR: 'fvc' has not been declared correctNut(2*magSqr(symm(fvc::grad(this-->u_))),F23());
opt/openfoam5/src/TurbulenceModels/turbulence/lnInclude/kOmegaSSTBase.C:133:30 ERROR: 'fvc' has not been declared
fvc::div(fvc::absolute(this-->phi(),u))()()


https://www.cfd-online.com/Forums/me...e908-error.jpg
https://www.cfd-online.com/Forums/me...09-options.jpg
https://www.cfd-online.com/Forums/me...keturmodel.jpg

I think I do not have a reasonable path in options file or the makeTurModel.C has not declared a thing.
please give me advice.

I have the same problem, did u solve it?

ht2017 August 9, 2018 11:48

Quote:

Originally Posted by ancolli (Post 702128)
I have the same problem, did u solve it?

hi ancoli,

now, I have been resolved this problem.

gned July 17, 2019 13:28

ht2017, in post #9 you say you solved one previous problem you reported in post #7.
How, please?


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