CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   how to add a new k-e model for twophaseeulerfoam? (https://www.cfd-online.com/Forums/openfoam-programming-development/224252-how-add-new-k-e-model-twophaseeulerfoam.html)

qi.yang@polimi.it February 11, 2020 12:40

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);

HPE February 11, 2020 12:54

didn't understand the question, but are you trying to find the following file?

src/phaseSystemModels/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModels.C

qi.yang@polimi.it February 11, 2020 13:16

Quote:

Originally Posted by HPE (Post 757753)
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.

HPE February 11, 2020 13:18

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.

qi.yang@polimi.it February 11, 2020 13:22

Quote:

Originally Posted by HPE (Post 757764)
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.

HPE February 11, 2020 15:22

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?

mAlletto February 11, 2020 15:26

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

qi.yang@polimi.it February 12, 2020 10:50

Quote:

Originally Posted by mAlletto (Post 757776)
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, https://www.cfd-online.com/Forums/op...tml#post757890
I cannot compile successfully. Do you have some suggests?

mAlletto February 12, 2020 16:29

Can you post the errors you get

qi.yang@polimi.it February 13, 2020 03:07

Quote:

Originally Posted by mAlletto (Post 757933)
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::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

mAlletto February 14, 2020 11:14

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

qi.yang@polimi.it February 14, 2020 11:45

Quote:

Originally Posted by mAlletto (Post 758171)
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.

mAlletto February 17, 2020 05:39

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/

qi.yang@polimi.it February 17, 2020 05:52

3 Attachment(s)
Quote:

Originally Posted by mAlletto (Post 758349)
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).

mAlletto February 17, 2020 06:21

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.

qi.yang@polimi.it February 17, 2020 08:06

Quote:

Originally Posted by mAlletto (Post 758355)
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..

mAlletto February 18, 2020 04:53

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);


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


qi.yang@polimi.it February 18, 2020 05:36

Quote:

Originally Posted by mAlletto (Post 758481)
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!

gu1 June 24, 2023 11:52

Hello,

Would you mind helping me?

post852306


All times are GMT -4. The time now is 05:17.