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

Adding New phaseCompressible Turbulence Model

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 28, 2016, 06:07
Default Adding New phaseCompressible Turbulence Model
  #1
New Member
 
Stefan Wenzel
Join Date: Mar 2013
Posts: 6
Rep Power: 13
scram is on a distinguished road
Hello Foamers,

i try to add Rzehak's extension for bubble induced turbulence to the kOmegaSST model. See for example here:

http://www.qucosa.de/fileadmin/data/...nhein-ICMF.pdf

following the common procedure for adding new turbulence models:

- copy similar model (e.g kOmegaSSTSato)
- renaming files and functions
- adding Make/files + Make/options
- compiling using "wmake libso"

i got the following error multiple times for all functions/objects:
(example: )

kOmegaSSTRzehak.C:162:6: error: ‘virtual void Foam::RASModels::kOmegaSSTRzehak<BasicTurbulenceMo del>::correct()’ previously declared here
void kOmegaSSTRzehak<BasicTurbulenceModel>::correct()

AND

kOmegaSSTSASRzehak.C:40:1: error: redefinition of ‘Foam::RASModels::kOmegaSSTRzehak<BasicTurbulenceM odel>::kOmegaSSTRzehak(const alphaField&, const rhoField&, const volVectorField&, const surfaceScalarField&, const surfaceScalarField&, const transportModel&, const Foam::word&, const Foam::word&)’
kOmegaSSTRzehak<BasicTurbulenceModel>::kOmegaSSTRz ehak


same procedure still works for "normal" compressible/incompressible turbulence models but not for phaseIncompressible/phaseCompressible models.

I tried it with version 2.3.0/3.0.x and actual Openfoam-dev: same error in all versions.

Guess it has something to do with template formulation of the models.

Has anyone a suggestion how to add new phaseCompressible turbulence models to actual versions of OF?

Thanks to the community and best regards
Stefan
scram is offline   Reply With Quote

Old   May 2, 2016, 07:13
Default
  #2
New Member
 
Stefan Wenzel
Join Date: Mar 2013
Posts: 6
Rep Power: 13
scram is on a distinguished road
just to make sure i didn't made a basic linking mistake here are my Make/files Make/options:

files:
Code:
kOmegaSSTRzehak.C

LIB = $(FOAM_USER_LIBBIN)/myPhaseIncompressibleRASModels
options:
Code:
EXE_INC = \
    -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/RAS/RASModel \
    -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/RAS/kEpsilon \
    -I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel \
    -I$(LIB_SRC)/transportModels/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
    -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
    -I$(WM_PROJECT_USER_DIR)/applications/solvers/orgTwoPhaseEulerFoam/twoPhaseSystem/lnInclude \
    -I$(WM_PROJECT_USER_DIR)/applications/solvers/orgTwoPhaseEulerFoam/interfacialModels/lnInclude \
    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
    -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude   

LIB_LIBS = \
    -lfiniteVolume \
    -lmeshTools \
    -lincompressibleTurbulenceModels \
    -lincompressibleTransportModels \
    -lfluidThermophysicalModels \
    -lturbulenceModels \
    -lspecie \
    -L$(FOAM_USER_LIBBIN) \
    -lcompressibleOrgTwoPhaseSystem
scram is offline   Reply With Quote

Old   May 2, 2016, 09:38
Default
  #3
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
Hello,

I did a quick search and as we suspected the problems comes from compiling the template class directly instead of initiating it. Additionally, compiling such library isn't that straight forward even in OF original code.

Here what I found when I tried to compile a new phase compressible turbulence model;

you need to add new file which calling a macro to initialize the template class like;
Code:
$FOAM_SOLVERS/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModels.C
So, you can copy it and modify (rename it myphaseCompressibleTurbulenceModels.C) it to initialize your turbulence model as;

Code:
//copy all the header files

makeBaseTurbulenceModel
(
    volScalarField,
    volScalarField,
    compressibleTurbulenceModel,
    PhaseCompressibleTurbulenceModel,
    ThermalDiffusivity,
    phaseModel
);

#define makeRASModel(Type)                                                     \
    makeTemplatedTurbulenceModel                                               \
    (phaseModelPhaseCompressibleTurbulenceModel, RAS, Type)

#define makeLESModel(Type)                                                     \
    makeTemplatedTurbulenceModel                                               \
    (phaseModelPhaseCompressibleTurbulenceModel, LES, Type)




#include "kOmegaSSTRzehak.H"
makeRASModel(kOmegaSSTRzehak.H);
Then add this new file myphaseCompressibleTurbulenceModels.C to Make/files instead of kOmegaSSTRzehak.C

and here is a copy of the options file which I used,

Code:
EXE_INC = \
    -I$(FOAM_SOLVERS)/multiphase/twoPhaseEulerFoam/twoPhaseSystem/lnInclude \
    -I$(LIB_SRC)/transportModels/compressible/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude \
    -I$(FOAM_SOLVERS)/multiphase/twoPhaseEulerFoam/interfacialModels/lnInclude \
    -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude

LIB_LIBS = \
    -lcompressibleTransportModels \
    -lfluidThermophysicalModels \
    -lsolidThermo \
    -lsolidSpecie \
    -lturbulenceModels \
    -lspecie \
    -lfiniteVolume \
    -lcompressibleTurbulenceModels \
    -lmeshTools \
    -lcompressibleEulerianInterfacialModels \
    -lcompressibleTwoPhaseSystem
Probably many unneeded files are included, but I did quickly and tried to eliminate any possible source of error. Obviously, you can link your solver instead of twoPhaseEulerFoam libraries. The main trick (in red) about this options file is that TurbulenceModels/compressible must come first before TurbulenceModels/turbulenceModels. That is because there are two makeTurbulenceModel.H and you need the compressible one instead of the general one.

I tested by linking it to a tutorial case for twoPhaseEulerFoam and the solver recognized it and started to complain about the wallDist fvSchemes.
But having said that, there is another problem. The solver runs but complains first by showing a very long error. The main points of this error are;
Code:
  
 Duplicate entry laminar in runtime selection table TurbulenceModel
 Duplicate entry LES in runtime selection table TurbulenceModel
I hadn’t enough time to investigate further in this problem but I think if you linked it directly to your solver as in twoPhaseEulerFoam this problem may disappear. Please try and keep us updated.


I hope that will help you to fix this problem.

Best wishes,
Hassan Kassem
hk318i is offline   Reply With Quote

Old   May 2, 2016, 11:23
Talking
  #4
New Member
 
Stefan Wenzel
Join Date: Mar 2013
Posts: 6
Rep Power: 13
scram is on a distinguished road
Hello Hassan,

thank you so much! Your method solved the problem. The solver recognises the new turbulence model. I'm still faced to the same errors as you but i will post a solution here as soon as i found one.

Thank you again, this was really a great help!

Best regards,
Stefan
scram is offline   Reply With Quote

Old   June 25, 2016, 07:31
Default
  #5
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
Hello,

This problem comes from ``makeBaseTurbulenceModel`` macro which has two functions, initialize the base template class then add it to run time table. Using ``makeBaseTurbulenceModel`` as it is means re-adding the base models to the run time table again which cause this error. The following modified macro should solve the problem. Just replace everything (keep the header files) in ``myphaseCompressibleTurbulenceModels.C``

Note: This macro could be used for LES as well.

Best wishes,
Hassan Kassem

Code:
#define createBaseTurbulenceModel(                                             \
    Alpha, Rho, baseModel, BaseModel, TDModel, Transport)                      \
                                                                               \
    namespace Foam                                                             \
    {                                                                          \                                       \
        typedef TDModel<BaseModel<Transport>>                                  \
            Transport##BaseModel;                                              \
        typedef RASModel<EddyDiffusivity<Transport##BaseModel>>                \
            RAS##Transport##BaseModel;                                         \
        typedef LESModel<EddyDiffusivity<Transport##BaseModel>>                \
            LES##Transport##BaseModel;                                         \
}

#define makeRASModel(Type)                                                     \
    makeTemplatedTurbulenceModel                                               \
    (phaseModelPhaseCompressibleTurbulenceModel, RAS, Type)

#define makeLESModel(Type)                                                     \
    makeTemplatedTurbulenceModel                                               \
    (phaseModelPhaseCompressibleTurbulenceModel, LES, Type)

createBaseTurbulenceModel
(
    volScalarField,
    volScalarField,
    compressibleTurbulenceModel,
    PhaseCompressibleTurbulenceModel,
    ThermalDiffusivity,
    phaseModel
);

#include "mykOmegaSSTSato.H"
makeRASModel(mykOmegaSSTSato);

Last edited by hk318i; June 25, 2016 at 14:33.
hk318i is offline   Reply With Quote

Old   June 30, 2016, 13:29
Default
  #6
New Member
 
Nicoḷ Scapin
Join Date: Apr 2016
Posts: 15
Rep Power: 10
nic92 is on a distinguished road
Does your solution is still valid for OpenFOAM 3.0.x?
I notice that adding a new turbulence model in OpenFOAM 3.0.x is not so straightforward than in previous version
nic92 is offline   Reply With Quote

Old   June 30, 2016, 13:37
Default
  #7
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
Quote:
Originally Posted by nic92 View Post
Does your solution is still valid for OpenFOAM 3.0.x?
I notice that adding a new turbulence model in OpenFOAM 3.0.x is not so straightforward than in previous version
Yes, you are right. It is not straight forward. I explained in details why here
This solution for OpenFOAM-3.0.0 and upward unless they changed again.
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Old   June 30, 2016, 18:55
Default
  #8
New Member
 
Nicoḷ Scapin
Join Date: Apr 2016
Posts: 15
Rep Power: 10
nic92 is on a distinguished road
Thanks for your answer. I follow your steps, but I failed when I compiled the solver with the command wmake libso. In fact, I get:

make: *** No rule to make target 'Make/linux64GccDPInt32Opt/myphaseCompressibleTurbulenceModels.C.dep', needed by 'Make/linux64GccDPInt32Opt/myphaseCompressibleTurbulenceModels.o'. Stop.

I am pretty sure that it is a very basic error, but since I am at the beginning with OpenFOAM and with creating a new turbulent solver, I have not been able to solve it up to now. Thanks for your answer.
nic92 is offline   Reply With Quote

Old   June 30, 2016, 19:18
Default
  #9
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
You maybe need to run wclean first. In case, it did not wok, I'm attaching here two examples which you can use for comparison.

Bw,
Hassan
Attached Files
File Type: zip mymixtureKEpsilon.zip (8.3 KB, 85 views)
File Type: zip mykOmegaSSTSato.zip (6.2 KB, 89 views)
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Old   July 3, 2016, 19:53
Default
  #10
New Member
 
Nicoḷ Scapin
Join Date: Apr 2016
Posts: 15
Rep Power: 10
nic92 is on a distinguished road
Hi Thanks for your help. Now I am able to compile it. Just last questions, when I run my solver, the case is not able to recognize the new turbulence model. I add at the end of my controldict the command libs ("libmyphaseCompressibleTurbulenceModels.so"), as you suggested in your guide; in fact, the new model is not put in the directory /OpenFOAM-3.0.x/src/TurbulenceModels/phaseCompressible/RAS to mantain pure the installed version of OpenFOAM.

By doing so, I obtained an error concerning the fact that my model has not been recognized among those available.
nic92 is offline   Reply With Quote

Old   July 4, 2016, 06:57
Default
  #11
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
The library name is incorrect, it should be exactly the same as in Make/file. For example for the attached mymixtureKEpsilon model

Code:
libs ("mymixtureKEpsilon.so");
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Old   July 27, 2016, 19:34
Default
  #12
New Member
 
Nicoḷ Scapin
Join Date: Apr 2016
Posts: 15
Rep Power: 10
nic92 is on a distinguished road
Hi,

Up to now I succeded in compiling my new turbulence model. It works without errors. Nevertheless, I notice this warning:

--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : /cineca/prod/opt/applications/openfoam/3.0/openmpi--1.6.4--gnu--4.7.2/OpenFOAM-3.0.x/platforms/linux64GccDPInt32Opt/lib/libcompressibleTwoPhaseSystem.so: undefined symbol: _ZN4Foam2fv10optionList5debugE
--> FOAM Warning :
From function dlLibraryTable:pen(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "mymixtureKEpsilon.so"

If I use this model in my case, the solver correctly selects my turbulence model. However, this warning appears whenever I run checkMesh, decomposePar or other command that has to do with calling the controlDict. Even though, I obtained results I would like to solve this problem and avoid warnings.

Thanks in advance for your help
nic92 is offline   Reply With Quote

Old   July 28, 2016, 09:14
Default
  #13
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
Quote:
Originally Posted by nic92 View Post
Hi,

Up to now I succeded in compiling my new turbulence model. It works without errors. Nevertheless, I notice this warning:

--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : /cineca/prod/opt/applications/openfoam/3.0/openmpi--1.6.4--gnu--4.7.2/OpenFOAM-3.0.x/platforms/linux64GccDPInt32Opt/lib/libcompressibleTwoPhaseSystem.so: undefined symbol: _ZN4Foam2fv10optionList5debugE
--> FOAM Warning :
From function dlLibraryTable:pen(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "mymixtureKEpsilon.so"

If I use this model in my case, the solver correctly selects my turbulence model. However, this warning appears whenever I run checkMesh, decomposePar or other command that has to do with calling the controlDict. Even though, I obtained results I would like to solve this problem and avoid warnings.

Thanks in advance for your help
I'm not sure about this warning, it is probably because ``checkMesh`` cannot load the library. It think it will disappear once you comment out ``libs`` in ``controlDict``. The important point here, do you receive any warning with the solver or not?
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Old   November 11, 2016, 08:10
Default
  #14
Member
 
Mukesh Adlak
Join Date: Jun 2016
Posts: 32
Rep Power: 10
Adlak is on a distinguished road
I am trying to compile my dynamicsmagorinsky model in openfoam 3.0.x but getting following error :

symbol lookup error: /home/adlak/OpenFOAM/adlak-3.0.x-cfdsupport/platforms/linux64Gcc49DPInt32Opt/lib/libdynamicSmagorinsky.so: undefined symbol: _ZNK4Foam9LESModels18dynamicSmagorinskyINS_15EddyD iffusivityINS_18ThermalDiffusivityINS_27Compressib leTurbulenceModelINS_11fluidThermoEEEEEEEE2CkEv

If any one can help then it will be a great help for me. I followed steps given here http://hassankassem.me/posts/newturbulencemodel/
Adlak is offline   Reply With Quote

Old   November 11, 2016, 10:11
Default
  #15
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
Quote:
Originally Posted by Adlak View Post
I am trying to compile my dynamicsmagorinsky model in openfoam 3.0.x but getting following error :

symbol lookup error: /home/adlak/OpenFOAM/adlak-3.0.x-cfdsupport/platforms/linux64Gcc49DPInt32Opt/lib/libdynamicSmagorinsky.so: undefined symbol: _ZNK4Foam9LESModels18dynamicSmagorinskyINS_15EddyD iffusivityINS_18ThermalDiffusivityINS_27Compressib leTurbulenceModelINS_11fluidThermoEEEEEEEE2CkEv

If any one can help then it will be a great help for me. I followed steps given here http://hassankassem.me/posts/newturbulencemodel/

It is hard to debug such error without the code. BTW, are you using CFD-support windows version?
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Old   November 14, 2016, 07:29
Default
  #16
Member
 
Mukesh Adlak
Join Date: Jun 2016
Posts: 32
Rep Power: 10
Adlak is on a distinguished road
[/QUOTE][/QUOTE][/QUOTE][/QUOTE]
Quote:
Originally Posted by hk318i View Post
It is hard to debug such error without the code. BTW, are you using CFD-support windows version?

It is OpenFoam-in-box based on openfoam 3.0.x for ubuntu. Give me ur email id. i will mail u my code. I have modified dynamickeqn model to make dynamicSmagorinsky model.
Adlak is offline   Reply With Quote

Old   November 16, 2016, 10:41
Default
  #17
Member
 
W. Schuyler Hinman
Join Date: Apr 2013
Location: Calgary, Alberta, Canada
Posts: 38
Rep Power: 13
schuyler is on a distinguished road
Quote:
Originally Posted by Adlak View Post


It is OpenFoam-in-box based on openfoam 3.0.x for ubuntu. Give me ur email id. i will mail u my code. I have modified dynamickeqn model to make dynamicSmagorinsky model.

Did you guys figure this out? I am having the same issue at run-time. I had just assumed it was something silly in my code. Curious to see if you guys found anything useful? What was the issue?

Schuyler
schuyler is offline   Reply With Quote

Old   November 16, 2016, 10:51
Default
  #18
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
If it a common case, could anyone upload the code here with a test case or at least the steps to reproduce the error? It will be helpful for the community to keep a record of this case here.

Schuyler, could you please confirm which OF version have you tested? is it CFD-Support version?

Best wishes,
Hassan
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Old   November 16, 2016, 11:25
Default
  #19
Member
 
W. Schuyler Hinman
Join Date: Apr 2013
Location: Calgary, Alberta, Canada
Posts: 38
Rep Power: 13
schuyler is on a distinguished road
Quote:
Originally Posted by hk318i View Post
If it a common case, could anyone upload the code here with a test case or at least the steps to reproduce the error? It will be helpful for the community to keep a record of this case here.

Schuyler, could you please confirm which OF version have you tested? is it CFD-Support version?

Best wishes,
Hassan
Thanks for the quick response Hassan. I am using 4.1 on ubuntu. I have uploaded a case file that I have been trying it on. I also uploaded a zipped directory of the code.

This is just a simple case to see if the model would run. I have run this model before using OpenFOAM 2.3 but wanted to update it to the newer version using the new format for the turbulence src.

Schuyler
Attached Files
File Type: zip Goldberg.zip (6.4 KB, 33 views)
File Type: zip wedgeTest.zip (8.4 KB, 20 views)
schuyler is offline   Reply With Quote

Old   November 16, 2016, 12:11
Default
  #20
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
Hello Schuyle,

Thank you for uploading the code it helped a lot.

The problem of your model is a missing defination of one function, namely
Code:
 tmp<volScalarField> fmu(const volScalarField& chi) const;
The definition must be added (as f2() function) in the source file (.C)

Please keep us updated!

Best wishes,
Hassan
atulkjoy likes this.
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Reply

Tags
phasecompressible, phaseincompressible, tubulence model, turbulence, twophaseeulerfoam


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
Adding graviational acc. to turbulence model fertinaz OpenFOAM Programming & Development 6 December 12, 2020 01:04
chtMultiRegionSimpleFoam: strange error samiam1000 OpenFOAM Running, Solving & CFD 26 December 29, 2015 23:14
Turbulence model choice dave13 CFX 3 December 22, 2015 08:12
Compressible turbulence model issues 351Cleveland OpenFOAM 5 October 24, 2013 16:41
What model of turbulence choose to study an external aerodynamics case raffale OpenFOAM 0 August 23, 2012 06:45


All times are GMT -4. The time now is 20:26.