how to add a new k-e model for twophaseeulerfoam?
Hi guys,
I had question that it is possible add a new turbulence model in Turbulence->incompressible->turbulentTransportModels.C (#include "mykEpsilon.H" makeRASModel(mykEpsilon);) However, I cannot find one file in phasecompressibleturbulencemodel. So How can I add a new k-epsilon model based on k-epsilon for twophaseeulerfoam? I added one code in the twophaseeulerfoam solver->phasecompressibleturbulencemodels.C as following but I faild to use this model in the test case. makeTurbulenceModelTypes ( volScalarField, volScalarField, compressibleTurbulenceModel, PhaseCompressibleTurbulenceModel, ThermalDiffusivity, phaseModel ); makeBaseTurbulenceModel ( volScalarField, volScalarField, compressibleTurbulenceModel, PhaseCompressibleTurbulenceModel, ThermalDiffusivity, phaseModel ); #define makeLaminarModel(Type) \ makeTemplatedLaminarModel \ (phaseModelPhaseCompressibleTurbulenceModel, laminar, Type) #define makeRASModel(Type) \ makeTemplatedTurbulenceModel \ (phaseModelPhaseCompressibleTurbulenceModel, RAS, Type) #define makeLESModel(Type) \ makeTemplatedTurbulenceModel \ (phaseModelPhaseCompressibleTurbulenceModel, LES, Type) #include "Stokes.T.H" makeLaminarModel(Stokes); #include "kEpsilon.H" makeRASModel(kEpsilon); #include "mykEpsilon.H" makeRASModel(mykEpsilon); |
didn't understand the question, but are you trying to find the following file?
src/phaseSystemModels/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModels.C |
Quote:
My question is to add a new turbulence model for twophaseeulerfoam. |
I don't think you can add or you need to add a turbulence model into a solver.
Instead, forum dudes can try to help you out for the compilation problem. |
Quote:
|
Yes, you should implement a new turbulence model. But this turbulence model is not going to be implemented into a solver. It is a separate entity from a solver. Once you implement a new turbulence model, you can mostly use it with any solvers.
Anyways, I think you are looking for on how to implement a new turbulence model. I think we should understand your question in this way. Could you please attach any error messages from the compilation attempt? |
Do you know this blog http://hassankassem.me/posts/newturbulencemodel/. You can also use the coded fvoption functionality to add missing terms to existing turbulence models
|
Quote:
According to this thread, https://www.cfd-online.com/Forums/op...tml#post757890 I cannot compile successfully. Do you have some suggests? |
Can you post the errors you get
|
Quote:
$ wmake wmakeLnInclude: linking include files to ./lnInclude Making dependency list for source file myphaseCompressibleTurbulenceModels.C could not open file ThermalDiffusivity.H for source file myphaseCompressibleTurbulenceModels.C could not open file EddyDiffusivity.H for source file myphaseCompressibleTurbulenceModels.C could not open file laminar.H for source file myphaseCompressibleTurbulenceModels.C could not open file RASModel.H for source file myphaseCompressibleTurbulenceModels.C could not open file LESModel.H for source file myphaseCompressibleTurbulenceModels.C $(/home/ofuser/blueCFD/OpenFOAM-5.x/wmake/scripts/makeReinterpretExePath x86_64-w64-mingw32-g++) -std=c++11 -Dmingw_w64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -DWIN64 -DLITTLE_ENDIAN -DWIN64 -DLITTLE_ENDIAN -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O2 -DNDEBUG -gdwarf -DNoRepository -ftemplate-depth-100 -D_FILE_OFFSET_BITS=64 -D_MODE_T_ -I/home/ofuser/blueCFD/OpenFOAM-5.x/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/transportModels/compressible/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/thermophysicalModels/basic/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/thermophysicalModels/specie/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/thermophysicalModels/solidThermo/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/thermophysicalModels/solidSpecie/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/finiteVolume/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/meshTools/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/transportModels/incompressible/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/TurbulenceModels/compressible/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/TurbulenceModels/turbulenceModels/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/TurbulenceModels/phaseCompressible/lnInclude @Make/mingw_w64GccDPInt32Opt/includeHeaderPaths -IlnInclude -I. -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/OpenFOAM/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/OSspecific/MSwindows/lnInclude -c myphaseCompressibleTurbulenceModels.C -o J:/blueCFD-Core-2017/ofuser-of5/applications/solvers/mytwoPhaseEulerFoam4/phaseCompressibleTurbulenceModels/Make/mingw_w64GccDPInt32Opt/myphaseCompressibleTurbulenceModels.o myphaseCompressibleTurbulenceModels.C:32:10: fatal error: ThermalDiffusivity.H: No such file or directory #include "ThermalDiffusivity.H" ^~~~~~~~~~~~~~~~~~~~~~ compilation terminated. After I changed all header files as the original ones like #include "PhaseCompressibleTurbulenceModel.T.H" #include "phaseModel.H" #include "twoPhaseSystem.H" #include "addToRunTimeSelectionTable.H" #include "makeTurbulenceModel.H" #include "ThermalDiffusivity.T.H" #include "EddyDiffusivity.T.H" #include "laminarModel.H" #include "RASModel.T.H" #include "LESModel.T.H" The errors above were disappeared, however it failed again. $ wmake wmakeLnInclude: linking include files to ./lnInclude Making dependency list for source file myphaseCompressibleTurbulenceModels.C $(/home/ofuser/blueCFD/OpenFOAM-5.x/wmake/scripts/makeReinterpretExePath x86_64-w64-mingw32-g++) -std=c++11 -Dmingw_w64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -DWIN64 -DLITTLE_ENDIAN -DWIN64 -DLITTLE_ENDIAN -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O2 -DNDEBUG -gdwarf -DNoRepository -ftemplate-depth-100 -D_FILE_OFFSET_BITS=64 -D_MODE_T_ -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/finiteVolume/lnInclude -I../twoPhaseSystem/lnInclude -I../interfacialModels/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/transportModels/compressible/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/thermophysicalModels/basic/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/transportModels/incompressible/transportModel -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/TurbulenceModels/compressible/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/TurbulenceModels/turbulenceModels/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/TurbulenceModels/phaseCompressible/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/meshTools/lnInclude @Make/mingw_w64GccDPInt32Opt/includeHeaderPaths -IlnInclude -I. -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/OpenFOAM/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/OSspecific/MSwindows/lnInclude -c myphaseCompressibleTurbulenceModels.C -o J:/blueCFD-Core-2017/ofuser-of5/applications/solvers/mytwoPhaseEulerFoam4/phaseCompressibleTurbulenceModels/Make/mingw_w64GccDPInt32Opt/myphaseCompressibleTurbulenceModels.o $(/home/ofuser/blueCFD/OpenFOAM-5.x/wmake/scripts/makeReinterpretExePath windres) Make/mingw_w64GccDPInt32Opt/version_of_build.rc Make/mingw_w64GccDPInt32Opt/version_of_build.o $(/home/ofuser/blueCFD/OpenFOAM-5.x/wmake/scripts/makeReinterpretExePath x86_64-w64-mingw32-g++) -std=c++11 -Dmingw_w64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -DWIN64 -DLITTLE_ENDIAN -DWIN64 -DLITTLE_ENDIAN -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O2 -DNDEBUG -gdwarf -DNoRepository -ftemplate-depth-100 -D_FILE_OFFSET_BITS=64 -D_MODE_T_ -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/finiteVolume/lnInclude -I../twoPhaseSystem/lnInclude -I../interfacialModels/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/transportModels/compressible/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/thermophysicalModels/basic/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/transportModels/incompressible/transportModel -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/TurbulenceModels/compressible/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/TurbulenceModels/turbulenceModels/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/TurbulenceModels/phaseCompressible/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/meshTools/lnInclude @Make/mingw_w64GccDPInt32Opt/includeHeaderPaths -IlnInclude -I. -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/OpenFOAM/lnInclude -I/home/ofuser/blueCFD/OpenFOAM-5.x/src/OSspecific/MSwindows/lnInclude -Wl,--output-def,/home/ofuser/blueCFD/ofuser-of5/platforms/mingw_w64GccDPInt32Opt/lib/mymixtureKEpsilon.def -Wl,--out-implib,/home/ofuser/blueCFD/ofuser-of5/platforms/mingw_w64GccDPInt32Opt/lib/mymixtureKEpsilon.a -Wl,--enable-auto-import -shared @Make/mingw_w64GccDPInt32Opt/objectList -L/home/ofuser/blueCFD/OpenFOAM-5.x/platforms/mingw_w64GccDPInt32Opt/lib \ -lOpenFOAM -L/home/ofuser/blueCFD/OpenFOAM-5.x/platforms/mingw_w64GccDPInt32Opt/lib/MS-MPI-7.1 -lPstream -lcompressibleTransportModels -lfluidThermophysicalModels -lspecie -lturbulenceModels -lcompressibleTurbulenceModels -lincompressibleTransportModels -lcompressibleTwoPhaseSystem -lcompressibleEulerianInterfacialModels -lfiniteVolume -lfvOptions -lmeshTools -o /home/ofuser/blueCFD/ofuser-of5/platforms/mingw_w64GccDPInt32Opt/lib/mymixtureKEpsilon.dll Make/mingw_w64GccDPInt32Opt/myphaseCompressibleTurbulenceModels.o: In function `Foam::RASModel<Foam::EddyDiffusivity<Foam::Therma lDiffusivity<Foam::PhaseCompressibleTurbulenceMode l<Foam::phaseModel> > > >::adddictionaryConstructorToTable<Foam::RASModels ::mykEpsilon<Foam::EddyDiffusivity<Foam::ThermalDi ffusivity<Foam::PhaseCompressibleTurbulenceModel<F oam::phaseModel> > > > >::~adddictionaryConstructorToTable()': J:/blueCFD-Core-2017/OpenFOAM-5.x/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.T.H:111: undefined reference to `Foam::RASModel<Foam::EddyDiffusivity<Foam::Therma lDiffusivity<Foam::PhaseCompressibleTurbulenceMode l<Foam::phaseModel> > > >::destroydictionaryConstructorTables()' Make/mingw_w64GccDPInt32Opt/myphaseCompressibleTurbulenceModels.o: In function `Foam::RASModel<Foam::EddyDiffusivity<Foam::Therma lDiffusivity<Foam::PhaseCompressibleTurbulenceMode l<Foam::phaseModel> > > >::adddictionaryConstructorToTable<Foam::RASModels ::mykEpsilon<Foam::EddyDiffusivity<Foam::ThermalDi ffusivity<Foam::PhaseCompressibleTurbulenceModel<F oam::phaseModel> > > > >::adddictionaryConstructorToTable(Foam::word const&)': J:/blueCFD-Core-2017/OpenFOAM-5.x/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.T.H:111: undefined reference to `Foam::RASModel<Foam::EddyDiffusivity<Foam::Therma lDiffusivity<Foam::PhaseCompressibleTurbulenceMode l<Foam::phaseModel> > > >::constructdictionaryConstructorTables()' Make/mingw_w64GccDPInt32Opt/myphaseCompressibleTurbulenceModels.o:myphaseCompr essibleTurbulenceModels.C:(.rdata$.refptr._ZN4Foam 8RASModelINS_15EddyDiffusivityINS_18ThermalDiffusi vityINS_32PhaseCompressibleTurbulenceModelINS_10ph aseModelEEEEEEEE30dictionaryConstructorTablePtr_E[.refptr._ZN4Foam8RASModelINS_15EddyDiffusivityINS_ 18ThermalDiffusivityINS_32PhaseCompressibleTurbule nceModelINS_10phaseModelEEEEEEEE30dictionaryConstr uctorTablePtr_E]+0x0): undefined reference to `Foam::RASModel<Foam::EddyDiffusivity<Foam::Therma lDiffusivity<Foam::PhaseCompressibleTurbulenceMode l<Foam::phaseModel> > > >::dictionaryConstructorTablePtr_' Make/mingw_w64GccDPInt32Opt/myphaseCompressibleTurbulenceModels.o:myphaseCompr essibleTurbulenceModels.C:(.rdata$.refptr._ZN4Foam 8RASModelINS_15EddyDiffusivityINS_18ThermalDiffusi vityINS_32PhaseCompressibleTurbulenceModelINS_10ph aseModelEEEEEEEE8typeNameE[.refptr._ZN4Foam8RASModelINS_15EddyDiffusivityINS_ 18ThermalDiffusivityINS_32PhaseCompressibleTurbule nceModelINS_10phaseModelEEEEEEEE8typeNameE]+0x0): undefined reference to `Foam::RASModel<Foam::EddyDiffusivity<Foam::Therma lDiffusivity<Foam::PhaseCompressibleTurbulenceMode l<Foam::phaseModel> > > >::typeName' collect2.exe: error: ld returned 1 exit status make: *** [/home/ofuser/blueCFD/OpenFOAM-5.x/wmake/makefiles/general:214: /home/ofuser/blueCFD/ofuser-of5/platforms/mingw_w64GccDPInt32Opt/lib/mymixtureKEpsilon.dll] Error 1 |
Hm something went wrong with a template parameter. But just from the information you provided it is difficult to judge what went wrong.
I suggest just to copy an existing model and rename it and try to compile it. If you sussed with this you step by step make the changes you require and compile it again after each change. If you're not able to compile it you exactly know where the error comes from |
Quote:
|
no actually not but the principle should be the same. phase compressible models are essentially compressible turbulence models. If you look at PhaseCompressibleTurbulenceModel.H you will see it. I found this only looking a bit at the source code.
So did you try to compy a compressible kEpsilon equation rename it and try to include it in the file multiphaseCompressibleTurbulenceModels.C. mybe this link is usefull to understand the undifined reference error: https://latedev.wordpress.com/2014/0...ved-reference/ |
3 Attachment(s)
Quote:
Thanks a lot. I tried but I failed. Could you please help me to have a look my source code.. I put those files in the folder phasecompressibleturbulencemodel (twophaseeulerfoam). |
your file myphaseCompressibleTurbulenceModels.C is not the same as the file
src/phaseSystemModels/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseCompressibleTurbulenceModels/multiphaseCompressibleTurbulenceModels.C see below Code:
/*---------------------------------------------------------------------------*\ Use the above file to compile you code. This should work. And check the file Make/options there the information for the linker is provided. The undefined reference error is probably a linker error. It does not find some files or definition in some library. |
Quote:
And also these codes cannot be used in the latest version. #include "phaseCompressibleTurbulenceModel.H" #include "addToRunTimeSelectionTable.H" #include "makeTurbulenceModel.H" #include "laminarModel.H" #include "RASModel.H" #include "LESModel.H" It should be "phaseCompressibleTurbulenceModel.T.H" etc.. |
I just modified the file multiphaseCompressibleTurbulenceModels.C (see blow) including the turbulencemodel mykEpsilon. It is just a copy of the existing kEpsilon model. I replaces obviously all string from kEpsilon to mykEpsilon. The compilation worked.
|
Quote:
|
|
All times are GMT -4. The time now is 05:17. |