|
[Sponsors] |
Debug help: Viscosity Model in compressibleInterFoam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 12, 2021, 08:03 |
Debug help: Viscosity Model in compressibleInterFoam
|
#1 |
New Member
Bruno Ramoa
Join Date: Jul 2019
Posts: 18
Rep Power: 7 |
Hello Foamers, I am starting my programming journey on OpenFOAM (with OFv2012). Currently, I am implementing a new viscosity model that depends on pressure, temperature and shear-rate to be used in compressibleInterFoam. I was able to implement this by changing the 'basicThermo', 'FluidThermo', 'RhoThermo', 'HeRhoThermo' and the 'twoPhaseMixtureThermo' classes (copied and changed the name to my+<className>). However, I am having issues with the update of the classes in the 'VoFphaseCompressibleTurbulenceModels' folder, specially the 'compressibleInterPhaseTransportModel' class. After updating the names in this class (e.g. twoPhaseMixtureThermo by myTwoPhaseMixtureThermo, fluidThermo by myFluidThermo) I noticed that the header. #include "turbulentFluidThermoModel.H" has: Code:
#ifndef turbulentFluidThermoModel_H #define turbulentFluidThermoModel_H #include"CompressibleTurbulenceModel.H" #include"ThermalDiffusivity.H" #include"EddyDiffusivity.H" #include"laminarModel.H" #include"RASModel.H" #include"LESModel.H" #include"fluidThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespaceFoam { namespacecompressible { typedef ThermalDiffusivity<CompressibleTurbulenceModel<fluidThermo>> turbulenceModel; typedef laminarModel<turbulenceModel> laminarModel; typedef RASModel<EddyDiffusivity<turbulenceModel>> RASModel; typedef LESModel<EddyDiffusivity<turbulenceModel>> LESModel; template<classBasicCompressibleTurbulenceModel> autoPtr<BasicCompressibleTurbulenceModel> New ( const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, consttypenameBasicCompressibleTurbulenceModel::transportModel& transport, const word& propertiesName =turbulenceModel::propertiesName ); } } Where the basic 'fluidThermo' class is used. I copied this class and changed fluidThermo with myFluidThermo and got the following compiler error: Code:
myCompressibleInterPhaseTransportModel.C: In constructor ‘Foam::myCompressibleInterPhaseTransportModel::myCompressibleInterPhaseTransportModel(const volScalarField&, const volVectorField&, const surfaceScalarField&, const surfaceScalarField&, const surfaceScalarField&, const Foam::myTwoPhaseMixtureThermo&)’: myCompressibleInterPhaseTransportModel.C:134:9: error: no matching function for call to ‘Foam::ThermalDiffusivity<Foam::CompressibleTurbulenceModel<Foam::myFluidThermo> >::New(const volScalarField&, const volVectorField&, const surfaceScalarField&, const Foam::myTwoPhaseMixtureThermo&)’ ); ^ In file included from /home/pc/OpenFOAM/OpenFOAM-v2012/src/TurbulenceModels/compressible/lnInclude/ThermalDiffusivity.H:182:0, from myTurbulentFluidThermoModel.H:49, from myCompressibleInterPhaseTransportModel.H:51, from myCompressibleInterPhaseTransportModel.C:29: /home/pc/OpenFOAM/OpenFOAM-v2012/src/TurbulenceModels/compressible/lnInclude/ThermalDiffusivity.C:63:1: note: candidate: static Foam::autoPtr<Foam::ThermalDiffusivity<BasicTurbulenceModel> > Foam::ThermalDiffusivity<BasicTurbulenceModel>::New(const alphaField&, const volScalarField&, const volVectorField&, const surfaceScalarField&, const surfaceScalarField&, const transportModel&, const Foam::word&) [with BasicTurbulenceModel = Foam::CompressibleTurbulenceModel<Foam::myFluidThermo>; Foam::ThermalDiffusivity<BasicTurbulenceModel>::alphaField = Foam::geometricOneField; Foam::volScalarField = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>; Foam::volVectorField = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>; Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>; Foam::ThermalDiffusivity<BasicTurbulenceModel>::transportModel = Foam::myFluidThermo] Foam::ThermalDiffusivity<BasicTurbulenceModel>::New ^~~~ /home/pc/OpenFOAM/OpenFOAM-v2012/src/TurbulenceModels/compressible/lnInclude/ThermalDiffusivity.C:63:1: note: candidate expects 7 arguments, 4 provided /home/pc/OpenFOAM/OpenFOAM-v2012/src/TurbulenceModels/compressible/lnInclude/ThermalDiffusivity.C:93:1: note: candidate: static Foam::autoPtr<Foam::ThermalDiffusivity<BasicTurbulenceModel> > Foam::ThermalDiffusivity<BasicTurbulenceModel>::New(const volScalarField&, const volVectorField&, const surfaceScalarField&, const transportModel&, const Foam::word&) [with BasicTurbulenceModel = Foam::CompressibleTurbulenceModel<Foam::myFluidThermo>; Foam::volScalarField = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>; Foam::volVectorField = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>; Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>; Foam::ThermalDiffusivity<BasicTurbulenceModel>::transportModel = Foam::myFluidThermo] Foam::ThermalDiffusivity<BasicTurbulenceModel>::New ^~~~ /home/pc/OpenFOAM/OpenFOAM-v2012/src/TurbulenceModels/compressible/lnInclude/ThermalDiffusivity.C:93:1: note: no known conversion for argument 4 from ‘const Foam::myTwoPhaseMixtureThermo’ to ‘const transportModel& {aka const Foam::myFluidThermo&}’ /home/pc/OpenFOAM/OpenFOAM-v2012/wmake/rules/General/transform:34: recipe for target 'Make/linux64GccDPInt32Debug/myCompressibleInterPhaseTransportModel.o' failed make: *** [Make/linux64GccDPInt32Debug/myCompressibleInterPhaseTransportModel.o] Error 1 Why does it convert with standard 'fluidThermo' class and not with the 'newFluidThermo' class? The solver can be found here: https://drive.google.com/file/d/19e7...ew?usp=sharing Any help would be highly appreciated! Best Regards, B. Ramoa |
|
February 12, 2021, 15:19 |
|
#2 |
New Member
Bruno Ramoa
Join Date: Jul 2019
Posts: 18
Rep Power: 7 |
Solved this issue.
In the myTwoPhaseMixtureThermo.H file, the class inheres publicly from the psiThermo class which in turn inheres from the fluidThermo class. Just needed to copy the psiThermo class and change it to myPsiThermo and make it inhere from the myFluidThermo class. Best Regards. |
|
February 14, 2021, 12:32 |
|
#3 |
New Member
Bruno Ramoa
Join Date: Jul 2019
Posts: 18
Rep Power: 7 |
Hello to all,
Now I am getting the following error: Code:
/home/pc/OpenFOAM/OpenFOAM-v2012/platforms/linux64GccDPInt32Debug/lib/libmyVoFphaseCompressibleTurbulenceModels.so: undefined reference to `Foam::TurbulenceModel<Foam::geometricOneField, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>, Foam::compressibleTurbulenceModel, Foam::myFluidThermo>::dictionaryConstructorTablePtr_' The same problem happens with OpenFOAM 7: https://drive.google.com/file/d/1klf...ew?usp=sharing Any suggestions on where could the problem be? Last edited by brunomramoa; February 18, 2021 at 10:17. |
|
February 19, 2021, 10:22 |
|
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Quick answer: The devil hides in the details...
The complaint is that the base turbulence model table does not exist, in other words, you're trying to add to or load from a non-existing table. But OpenFOAM is likely adding to an already existing table, when using its own names. Since the error is at linking time, means that the requested object does exist in a compile C file on any of the selected libraries to link to. I've tried looking at this from a few perspectives and the best I can assess is that you took one too many steps at a time. Simply copying and prefixing names with "my" is not always enough, because some details are implied on a common structure... so one single misplaced or absent "my" prefix is enough to through us for a loop... My advice is that you retake one step at a time, make sure each change compiles, commit the ongoing development on a public or sharable Git repository. One wrong step was enough for you to now be asking for help... the problem is that we don't know if you're in the Arctic or Antarctica or Siberia... or Mars?... all we know is that it's snowing and it's very cold... so retracing your steps is highly important here, hence the request for a Git repository. One neat trick I can at least write now is to try and investigate the pre-compiled code... when you run wmake, something like this appears: Code:
Making dependency list for source file myCompressibleInterFoam.C g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3 -DNoRepository -ftemplate-depth-100 -I. -I./VoF -I./Stuff -ImyTwoPhaseMixtureThermo -ImyVoFphaseCompressibleTurbulenceModels/lnInclude -I/opt/openfoam7/src/transportModels/compressible/lnInclude -I/opt/openfoam7/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam7/src/thermophysicalModels/specie/lnInclude -I/opt/openfoam7/src/transportModels/twoPhaseMixture/lnInclude -I/opt/openfoam7/src/transportModels/interfaceProperties/lnInclude -I/opt/openfoam7/src/TurbulenceModels/turbulenceModels/lnInclude -I/opt/openfoam7/src/TurbulenceModels/compressible/lnInclude -I/opt/openfoam7/src/TurbulenceModels/phaseCompressible/lnInclude -I/opt/openfoam7/src/meshTools/lnInclude -I/opt/openfoam7/src/dynamicMesh/lnInclude -I/opt/openfoam7/src/dynamicFvMesh/lnInclude -I/opt/openfoam7/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam7/src/OpenFOAM/lnInclude -I/opt/openfoam7/src/OSspecific/POSIX/lnInclude -fPIC -c myCompressibleInterFoam.C -o Make/linux64GccDPInt32Opt/myCompressibleInterFoam.o Code:
g++ -std=c++11 ................./myCompressibleInterFoam.E -E The annoying part is that what you're looking for could be anywhere... either in the main solver's ".o" file or in one of the library ".o" files.
__________________
|
|
February 19, 2021, 17:37 |
|
#5 |
New Member
Bruno Ramoa
Join Date: Jul 2019
Posts: 18
Rep Power: 7 |
Hello Bruno,
Thank you very much for your input. I placed the solver at github https://github.com/brunoramoa/myComp...commits/master with 3 commits to track the changes In the first, the solver compiles. It is using the psiThermo class (which will inherit from the fluidThermo class which will inherit from the basicThermo class). In the second, an error in compilation will occur. The psiThermo class was replaced by the myPsiThermo class. The compiler will have a conversion problem. Code:
no known conversion for argument 4 from ‘const Foam::myTwoPhaseMixtureThermo’ to ‘const transportModel& {aka const Foam::fluidThermo&}’ Code:
/home/pc/OpenFOAM/OpenFOAM-v2012/platforms/linux64GccDPInt32Debug/lib/libmyVoFphaseCompressibleTurbulenceModels.so: undefined reference to `Foam::TurbulenceModel<Foam::geometricOneField, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>, Foam::compressibleTurbulenceModel, Foam::myFluidThermo>::dictionaryConstructorTablePtr_' problem occurs |
|
February 22, 2021, 15:13 |
|
#6 |
New Member
Bruno Ramoa
Join Date: Jul 2019
Posts: 18
Rep Power: 7 |
Found out the problem...
had to redefine the "turbulentFluidThermoModels.C" and turbulentFluidThermoModels.H" with the myFluidthermo and compile everything in the "myVoFphaseCompressibleTurbulenceModels" library. Best regards. Last edited by brunomramoa; February 22, 2021 at 16:23. |
|
June 29, 2022, 18:37 |
|
#7 | |
New Member
Join Date: Aug 2016
Location: Maryland, USA
Posts: 1
Rep Power: 0 |
Quote:
Thanks and Regards. |
||
Tags |
compressibleinterfoam, debug information |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Use of k-epsilon and k-omega Models | Jade M | Main CFD Forum | 40 | January 27, 2023 08:18 |
Viscosity model - error: object is not allocated - C++ beginner | avila.vc | OpenFOAM Programming & Development | 5 | February 14, 2022 03:00 |
[swak4Foam] swakExpression not writing to log | alexfells | OpenFOAM Community Contributions | 3 | March 16, 2020 19:19 |
Using a new implemented viscosity model with simpleFoam | TemC | OpenFOAM Running, Solving & CFD | 6 | March 8, 2017 04:07 |
modelling solids viscosity in eulerian multiphase model | derkaiser | FLUENT | 1 | December 5, 2011 04:42 |