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

how to add a new k-e model for twophaseeulerfoam?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 11, 2020, 13:40
Question how to add a new k-e model for twophaseeulerfoam?
  #1
Member
 
yangqi
Join Date: Mar 2019
Posts: 35
Rep Power: 2
qi.yang@polimi.it is on a distinguished road
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);
qi.yang@polimi.it is offline   Reply With Quote

Old   February 11, 2020, 13:54
Default
  #2
HPE
Senior Member
 
Herpes Free Engineer
Join Date: Sep 2019
Posts: 298
Rep Power: 3
HPE is on a distinguished road
didn't understand the question, but are you trying to find the following file?

src/phaseSystemModels/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModels.C
__________________
Kind regards,
HPE

The OpenFOAM community is the biggest contributor to OpenFOAM; not person A or B. Let's report bugs or issue feature requests in GitLab-OpenFOAM.

Please `design` your questions well. Such effort always pays off well for inquirers and `helpmate`s:
How to create a Minimal, Reproducible Example,
How to give enough info to get help.
HPE is offline   Reply With Quote

Old   February 11, 2020, 14:16
Default
  #3
Member
 
yangqi
Join Date: Mar 2019
Posts: 35
Rep Power: 2
qi.yang@polimi.it is on a distinguished road
Quote:
Originally Posted by HPE View Post
didn't understand the question, but are you trying to find the following file?

src/phaseSystemModels/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModels.C
Thanks a lot. I also added the new code in "phaseCompressibleTurbulenceModels.C" but it failed to compile.

My question is to add a new turbulence model for twophaseeulerfoam.
qi.yang@polimi.it is offline   Reply With Quote

Old   February 11, 2020, 14:18
Default
  #4
HPE
Senior Member
 
Herpes Free Engineer
Join Date: Sep 2019
Posts: 298
Rep Power: 3
HPE is on a distinguished road
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.
__________________
Kind regards,
HPE

The OpenFOAM community is the biggest contributor to OpenFOAM; not person A or B. Let's report bugs or issue feature requests in GitLab-OpenFOAM.

Please `design` your questions well. Such effort always pays off well for inquirers and `helpmate`s:
How to create a Minimal, Reproducible Example,
How to give enough info to get help.
HPE is offline   Reply With Quote

Old   February 11, 2020, 14:22
Default
  #5
Member
 
yangqi
Join Date: Mar 2019
Posts: 35
Rep Power: 2
qi.yang@polimi.it is on a distinguished road
Quote:
Originally Posted by HPE View Post
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.
I have to use a new turbulence model which we provided so I must implement one.
qi.yang@polimi.it is offline   Reply With Quote

Old   February 11, 2020, 16:22
Default
  #6
HPE
Senior Member
 
Herpes Free Engineer
Join Date: Sep 2019
Posts: 298
Rep Power: 3
HPE is on a distinguished road
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?
__________________
Kind regards,
HPE

The OpenFOAM community is the biggest contributor to OpenFOAM; not person A or B. Let's report bugs or issue feature requests in GitLab-OpenFOAM.

Please `design` your questions well. Such effort always pays off well for inquirers and `helpmate`s:
How to create a Minimal, Reproducible Example,
How to give enough info to get help.
HPE is offline   Reply With Quote

Old   February 11, 2020, 16:26
Default
  #7
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 290
Rep Power: 5
mAlletto is on a distinguished road
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
mAlletto is offline   Reply With Quote

Old   February 12, 2020, 11:50
Default
  #8
Member
 
yangqi
Join Date: Mar 2019
Posts: 35
Rep Power: 2
qi.yang@polimi.it is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
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
Thanks a lot. I read this post before but I cannot realize it for the phasecompressibleturbulencemodel.
According to this thread, Adding New phaseCompressible Turbulence Model
I cannot compile successfully. Do you have some suggests?
qi.yang@polimi.it is offline   Reply With Quote

Old   February 12, 2020, 17:29
Default
  #9
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 290
Rep Power: 5
mAlletto is on a distinguished road
Can you post the errors you get
mAlletto is offline   Reply With Quote

Old   February 13, 2020, 04:07
Question
  #10
Member
 
yangqi
Join Date: Mar 2019
Posts: 35
Rep Power: 2
qi.yang@polimi.it is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
Can you post the errors you get

$ 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:haseModel> > > >::adddictionaryConstructorToTable<Foam::RASModels ::mykEpsilon<Foam::EddyDiffusivity<Foam::ThermalDi ffusivity<Foam::PhaseCompressibleTurbulenceModel<F oam:haseModel> > > > >::~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:haseModel> > > >::destroydictionaryConstructorTables()'
Make/mingw_w64GccDPInt32Opt/myphaseCompressibleTurbulenceModels.o: In function `Foam::RASModel<Foam::EddyDiffusivity<Foam::Therma lDiffusivity<Foam::PhaseCompressibleTurbulenceMode l<Foam:haseModel> > > >::adddictionaryConstructorToTable<Foam::RASModels ::mykEpsilon<Foam::EddyDiffusivity<Foam::ThermalDi ffusivity<Foam::PhaseCompressibleTurbulenceModel<F oam:haseModel> > > > >::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:haseModel> > > >::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:haseModel> > > >::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:haseModel> > > >::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
qi.yang@polimi.it is offline   Reply With Quote

Old   February 14, 2020, 12:14
Default
  #11
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 290
Rep Power: 5
mAlletto is on a distinguished road
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
mAlletto is offline   Reply With Quote

Old   February 14, 2020, 12:45
Default
  #12
Member
 
yangqi
Join Date: Mar 2019
Posts: 35
Rep Power: 2
qi.yang@polimi.it is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
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
Yep, thanks! In fact I know the process of implementing a new turbulence model. I added one successfully into incompressible turbulence model. However, now I need to implement a new one into phasecompressibleturbulencemodel. Did you do this before? I did it step by step according to the thread said however it is not compatible for the latest version.
qi.yang@polimi.it is offline   Reply With Quote

Old   February 17, 2020, 06:39
Default
  #13
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 290
Rep Power: 5
mAlletto is on a distinguished road
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/
mAlletto is offline   Reply With Quote

Old   February 17, 2020, 06:52
Default
  #14
Member
 
yangqi
Join Date: Mar 2019
Posts: 35
Rep Power: 2
qi.yang@polimi.it is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
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/

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).
Attached Files
File Type: c mykEpsilon.C (7.3 KB, 1 views)
File Type: h mykEpsilon.H (5.9 KB, 1 views)
File Type: c myphaseCompressibleTurbulenceModels.C (3.1 KB, 2 views)
qi.yang@polimi.it is offline   Reply With Quote

Old   February 17, 2020, 07:21
Default
  #15
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 290
Rep Power: 5
mAlletto is on a distinguished road
your file myphaseCompressibleTurbulenceModels.C is not the same as the file


src/phaseSystemModels/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseCompressibleTurbulenceModels/multiphaseCompressibleTurbulenceModels.C


see below





Code:
 /*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | www.openfoam.com
     \\/     M anipulation  |
-------------------------------------------------------------------------------
    Copyright (C) 2014-2018 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

\*---------------------------------------------------------------------------*/

#include "phaseCompressibleTurbulenceModel.H"
#include "addToRunTimeSelectionTable.H"
#include "makeTurbulenceModel.H"

#include "laminarModel.H"
#include "RASModel.H"
#include "LESModel.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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.H"
makeLaminarModel(Stokes);

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

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

#include "Smagorinsky.H"
makeLESModel(Smagorinsky);

#include "kEqn.H"
makeLESModel(kEqn);


// ************************************************************************* //

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.
mAlletto is offline   Reply With Quote

Old   February 17, 2020, 09:06
Default
  #16
Member
 
yangqi
Join Date: Mar 2019
Posts: 35
Rep Power: 2
qi.yang@polimi.it is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
your file myphaseCompressibleTurbulenceModels.C is not the same as the file


src/phaseSystemModels/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseCompressibleTurbulenceModels/multiphaseCompressibleTurbulenceModels.C


see below





Code:
 /*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | www.openfoam.com
     \\/     M anipulation  |
-------------------------------------------------------------------------------
    Copyright (C) 2014-2018 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

\*---------------------------------------------------------------------------*/

#include "phaseCompressibleTurbulenceModel.H"
#include "addToRunTimeSelectionTable.H"
#include "makeTurbulenceModel.H"

#include "laminarModel.H"
#include "RASModel.H"
#include "LESModel.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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.H"
makeLaminarModel(Stokes);

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

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

#include "Smagorinsky.H"
makeLESModel(Smagorinsky);

#include "kEqn.H"
makeLESModel(kEqn);


// ************************************************************************* //

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.
Thanks. In fact, the name has no problem. Because I am using twophaseeulerfoam rather than reactingmultiphasefoam.
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..
qi.yang@polimi.it is offline   Reply With Quote

Old   February 18, 2020, 05:53
Default
  #17
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 290
Rep Power: 5
mAlletto is on a distinguished road
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.



  1. Code:
    /*---------------------------------------------------------------------------*\
      =========                 |
      \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
       \\    /   O peration     |
        \\  /    A nd           | www.openfoam.com
         \\/     M anipulation  |
    -------------------------------------------------------------------------------
        Copyright (C) 2014-2018 OpenFOAM Foundation
    -------------------------------------------------------------------------------
    License
        This file is part of OpenFOAM.
    
        OpenFOAM is free software: you can redistribute it and/or modify it
        under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.
    
        OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
        ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        for more details.
    
        You should have received a copy of the GNU General Public License
        along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
    
    \*---------------------------------------------------------------------------*/
    
    #include "phaseCompressibleTurbulenceModel.H"
    #include "addToRunTimeSelectionTable.H"
    #include "makeTurbulenceModel.H"
    
    #include "laminarModel.H"
    #include "RASModel.H"
    #include "LESModel.H"
    
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    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.H"
    makeLaminarModel(Stokes);
    
    #include "kEpsilon.H"
    makeRASModel(kEpsilon);
    
    #include "mykEpsilon.H"
    makeRASModel(mykEpsilon);
    
    #include "kOmegaSST.H"
    makeRASModel(kOmegaSST);
    
    #include "Smagorinsky.H"
    makeLESModel(Smagorinsky);
    
    #include "kEqn.H"
    makeLESModel(kEqn);
    
    
    // ************************************************************************* //
mAlletto is offline   Reply With Quote

Old   February 18, 2020, 06:36
Talking
  #18
Member
 
yangqi
Join Date: Mar 2019
Posts: 35
Rep Power: 2
qi.yang@polimi.it is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
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.



  1. Code:
    /*---------------------------------------------------------------------------*\
      =========                 |
      \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
       \\    /   O peration     |
        \\  /    A nd           | www.openfoam.com
         \\/     M anipulation  |
    -------------------------------------------------------------------------------
        Copyright (C) 2014-2018 OpenFOAM Foundation
    -------------------------------------------------------------------------------
    License
        This file is part of OpenFOAM.
    
        OpenFOAM is free software: you can redistribute it and/or modify it
        under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.
    
        OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
        ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        for more details.
    
        You should have received a copy of the GNU General Public License
        along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
    
    \*---------------------------------------------------------------------------*/
    
    #include "phaseCompressibleTurbulenceModel.H"
    #include "addToRunTimeSelectionTable.H"
    #include "makeTurbulenceModel.H"
    
    #include "laminarModel.H"
    #include "RASModel.H"
    #include "LESModel.H"
    
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    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.H"
    makeLaminarModel(Stokes);
    
    #include "kEpsilon.H"
    makeRASModel(kEpsilon);
    
    #include "mykEpsilon.H"
    makeRASModel(mykEpsilon);
    
    #include "kOmegaSST.H"
    makeRASModel(kOmegaSST);
    
    #include "Smagorinsky.H"
    makeLESModel(Smagorinsky);
    
    #include "kEqn.H"
    makeLESModel(kEqn);
    
    
    // ************************************************************************* //
Thanks a lot. I also compiled successfully because I used the version based on the windows system. After I changed it to linux, it works!
qi.yang@polimi.it is offline   Reply With Quote

Reply

Tags
multiphase flow, turbulence models, twophaseeuelrfoam

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[IHFOAM] The IHFOAM Thread Phicau OpenFOAM Community Contributions 307 December 19, 2019 11:51
add a fuel cell model in ansys fluent 15 msdkhl FLUENT 0 June 15, 2016 10:14
Add Singhal model into interPhaseChangeFoam zhouhoucun OpenFOAM Running, Solving & CFD 0 April 28, 2015 05:32
Superlinear speedup in OpenFOAM 13 msrinath80 OpenFOAM Running, Solving & CFD 18 March 3, 2015 06:36
Add additional scalar to turbulence model john_w OpenFOAM 1 December 23, 2010 13:45


All times are GMT -4. The time now is 09:47.