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

Adding New phaseCompressible Turbulence Model

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   April 28, 2016, 05:07
Default Adding New phaseCompressible Turbulence Model
  #1
New Member
 
Stefan Wenzel
Join Date: Mar 2013
Posts: 6
Rep Power: 5
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, 06:13
Default
  #2
New Member
 
Stefan Wenzel
Join Date: Mar 2013
Posts: 6
Rep Power: 5
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, 08:38
Default
  #3
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: UK
Posts: 208
Rep Power: 10
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, 10:23
Talking
  #4
New Member
 
Stefan Wenzel
Join Date: Mar 2013
Posts: 6
Rep Power: 5
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, 06:31
Default
  #5
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: UK
Posts: 208
Rep Power: 10
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 13:33.
hk318i is offline   Reply With Quote

Old   June 30, 2016, 12:29
Default
  #6
New Member
 
NicolÚ Scapin
Join Date: Apr 2016
Posts: 6
Rep Power: 2
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, 12:37
Default
  #7
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: UK
Posts: 208
Rep Power: 10
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, 17:55
Default
  #8
New Member
 
NicolÚ Scapin
Join Date: Apr 2016
Posts: 6
Rep Power: 2
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, 18:18
Default
  #9
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: UK
Posts: 208
Rep Power: 10
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, 3 views)
File Type: zip mykOmegaSSTSato.zip (6.2 KB, 2 views)
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Old   July 3, 2016, 18:53
Default
  #10
New Member
 
NicolÚ Scapin
Join Date: Apr 2016
Posts: 6
Rep Power: 2
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, 05:57
Default
  #11
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: UK
Posts: 208
Rep Power: 10
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

Reply

Tags
phasecompressible, phaseincompressible, tubulence model, turbulence, twophaseeulerfoam

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
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
Adding graviational acc. to turbulence model fertinaz OpenFOAM Programming & Development 5 March 13, 2015 07:26
Compressible turbulence model issues 351Cleveland OpenFOAM 5 October 24, 2013 15:41
What model of turbulence choose to study an external aerodynamics case raffale OpenFOAM 0 August 23, 2012 05:45


All times are GMT -4. The time now is 16:28.