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

Error compiling new turbulence model

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By hk318i
  • 1 Post By potentialFoam
  • 1 Post By Adlak

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 30, 2016, 04:00
Default Error compiling new turbulence model
  #1
New Member
 
Join Date: Feb 2016
Posts: 6
Rep Power: 10
jasv is on a distinguished road
I'm trying to compile a new turbulence model (modified SpalartAllmaras) in openFOAM 3.0.1 and I'm having errors I don't know how to fix.

A minimal script of what I want to do just taking the original Spalart Allmaras model, renaming it and trying to compile is:

Code:
Code:
#!/bin/bash
#
# Copy original files
srcDIR=$FOAM_SRC"/TurbulenceModels/turbulenceModels/RAS/SpalartAllmaras"
ownDIR=$FOAM_USER_APPBIN"/sameSpalartAllmaras"
mkdir -p $ownDIR
cp $srcDIR/* $ownDIR

# Rename original 'SpalartAllmaras' to 'sameSpalartAllmaras' in files
sed -i s/SpalartAllmaras/sameSpalartAllmaras/g $ownDIR/*
mv $ownDIR/SpalartAllmaras.C $ownDIR/sameSpalartAllmaras.C
mv $ownDIR/SpalartAllmaras.H $ownDIR/sameSpalartAllmaras.H
mkdir $ownDIR/Make

# Create Make/options
cat <<EOF > $ownDIR/Make/options
EXE_INC = \\
    -I\$(LIB_SRC)/finiteVolume/lnInclude \\
    -I\$(LIB_SRC)/meshTools/lnInclude \\
    -I\$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude

LIB_LIBS = \\
    -lfiniteVolume \\
    -lmeshTools
EOF

# Create Make/files
cat <<EOF > $ownDIR/Make/files
sameSpalartAllmaras.C
EXE = \$(FOAM_USER_APPBIN)/sameSpalartAllmaras
LIB = \$(FOAM_USER_LIBBIN)/libmyincompressibleRASModels
EOF


# Compile
cd $ownDIR
wclean lib
wmake libso
When I try to compile I first get lot of warnings (#654, #1125)

Code:
In file included from /usr/.../openfoam/3.0.1/intel-openmpi/OpenFOAM-3.0.1/src/OpenFOAM/lnInclude/messageStream.H(216),
    ...
    /usr/.../openfoam/3.0.1/intel-openmpi/OpenFOAM-3.0.1/src/OpenFOAM/lnInclude/OSstream.H(52): warning #654: overloaded virtual function "Foam::Ostream::write" is only partially overridden in class "Foam::OSstream"
    ...
    /usr/.../openfoam/3.0.1/intel-openmpi/OpenFOAM-3.0.1/src/OpenFOAM/lnInclude/processorPolyPatch.H(112): warning #1125: function "Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::movePoints(const Foam::Field<PointType> &) [with Face=Foam::face, FaceList=Foam::SubList, PointField=const Foam::pointField &, PointType=Foam::point]" is hidden by "Foam::processorPolyPatch::movePoints" -- virtual function override intended?
          void movePoints(PstreamBuffers&, const pointField&);
and then errors like

Code:
sameSpalartAllmaras.C(40): error: function "Foam::RASModels::sameSpalartAllmaras<BasicTurbulenceModel>::chi" has already been defined
  tmp<volScalarField> sameSpalartAllmaras<BasicTurbulenceModel>::chi() const
before the compilation is aborted.
I encounter similar errors when trying to compile other OF 3.0.x turbulence models (1, 2) posted on github by users of this forum.

Am I missing something very basic or are the Make/* files incomplete? Do you know where is the problem?

I posted this question as a reply to another thread with a similar topic some days ago. Let me know if I should delete it.
jasv is offline   Reply With Quote

Old   March 30, 2016, 11:03
Default
  #2
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 17
hk318i is on a distinguished road
Hello,
First, both codes on Github are working fine. The only trick to compile first one is to modify the options to locate findroot function. The second one works fine using OpenFOAM-dev not OpenFOAM-3.0.

What is missing from your code is "makeMyCompressibleTurbulenceModel.C" and "makeMyIncompressibleTurbulenceModel.C" for compressible and incompressible flow. Try to use the same structure as on these codes.
It is just a macro, that's all.

Bw,
Hassan
hk318i is offline   Reply With Quote

Old   March 31, 2016, 05:21
Default
  #3
New Member
 
Join Date: Feb 2016
Posts: 6
Rep Power: 10
jasv is on a distinguished road
Thanks! I've managed to make it work using the same structure as helio's code.

Do you know if there is any central repository with turbulence models implemented in OpenFOAM?
jasv is offline   Reply With Quote

Old   March 31, 2016, 05:42
Default
  #4
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 17
hk318i is on a distinguished road
You are welcome.
Sorry, Currently I'm working on FSI in inviscid flow and not following the new turbulence models. I was just curious about the new C++ implementation of turbulence models in new OF version.
hk318i is offline   Reply With Quote

Old   October 24, 2016, 09:36
Default SpalartAllmaras RC
  #5
Member
 
Peter
Join Date: Nov 2015
Location: Hamburg, Germany
Posts: 57
Rep Power: 10
potentialFoam is on a distinguished road
Dear Foamers,

I would like to create the SpalartAllmaras tubulence model with Rotation/Curvature Correction (SA-RC), see e.g. here:
https://turbmodels.larc.nasa.gov/spalart.html
in OF version 3.0.1.

Fortunately, H. Kassem shows here
http://hassankassem.me/posts/newturbulencemodel/
how to introduce new turbulence models for OF 3.0.x. Very great - thanks a lot!

Besides, I found the source code for the SA-RC model here
http://hobbyfoam.blogspot.de/2015/02...curvature.html
for OF version 2.3.0. Thanks also!!

If I merge both, I do not accomplish. Particularly, I am not sure how to introduce the correction function 'fr1' at the end of the '.C' file and the way how 'fr1' is calculated several lines above.

The error is strange.
1.) The compiler does not complain.
2.) Using the airFoil2D tutorial test case requires setting a divScheme in system/fvSchemes for Sxx (...)
3.) Using a 3D wing testcase leads to the following error type:
Code:
Foam::error::printStack(Foam::Ostream&)
Here, you find the code:

makeTurModel.C

SpalartAllmarasRC.H

SpalartAllmarasRC.C

The 'Make' directory contains:
files:
Code:
makeTurModel.C

LIB = $(FOAM_USER_LIBBIN)/libSpalartAllmarasRC
and options:
Code:
EXE_INC = \
    -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
    -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude

LIB_LIBS = \
    -lturbulenceModels \
    -lincompressibleTurbulenceModels \
    -lincompressibleTransportModels \
    -lfiniteVolume \
    -lmeshTools
I will be quite glad if someone has an idea
potentialFoam is offline   Reply With Quote

Old   October 26, 2016, 10:53
Default
  #6
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 17
hk318i is on a distinguished road
Hi,

I am glad that my post helped you.

Regarding this error because it is not a compiler error, it is not easy to pinpoint the source of it without extensive testing. From my point of view, this code looks fine except lines 101 and 115 (.C file). These lines are dangerous because if W or S is zero, SqrW and SqrD will be zero as well. This could be the source of error but I don't know alot about W or S values, therefore I could be wrong about that.

Best Wishes,
Hassan Kassem
potentialFoam likes this.
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Old   November 4, 2016, 07:29
Default
  #7
Member
 
Peter
Join Date: Nov 2015
Location: Hamburg, Germany
Posts: 57
Rep Power: 10
potentialFoam is on a distinguished road
@Hassan:
Thank you very much for watching my code!

This seemed to be the major error, as the model is running now. Nevertheless, a printStack-error occurs after some time. If I find a solution, I will upload the core here...
hk318i likes this.
potentialFoam is offline   Reply With Quote

Old   November 11, 2016, 06:48
Default turbulence model compilation erroe
  #8
Member
 
Mukesh Adlak
Join Date: Jun 2016
Posts: 32
Rep Power: 9
Adlak is on a distinguished road
Quote:
Originally Posted by hk318i View Post
Hi,

I am glad that my post helped you.

Regarding this error because it is not a compiler error, it is not easy to pinpoint the source of it without extensive testing. From my point of view, this code looks fine except lines 101 and 115 (.C file). These lines are dangerous because if W or S is zero, SqrW and SqrD will be zero as well. This could be the source of error but I don't know alot about W or S values, therefore I could be wrong about that.

Best Wishes,
Hassan Kassem


I am trying to compile my dynamicsmagorinsky model in openfoam 3.0.x but getting following error :
symbol lookup error: /home/adlak/OpenFOAM/adlak-3.0.x-cfdsupport/platforms/linux64Gcc49DPInt32Opt/lib/libdynamicSmagorinsky.so: undefined symbol: _ZNK4Foam9LESModels18dynamicSmagorinskyINS_15EddyD iffusivityINS_18ThermalDiffusivityINS_27Compressib leTurbulenceModelINS_11fluidThermoEEEEEEEE2CkEv
If any one can help then it will be a great help for me. I followed steps given here http://hassankassem.me/posts/newturbulencemodel/
Adlak is offline   Reply With Quote

Old   November 21, 2016, 16:14
Default
  #9
Member
 
Mohamed Elghorab
Join Date: May 2016
Location: Coventry, Engalnd
Posts: 41
Rep Power: 9
crazzy.pirate43 is on a distinguished road
Dear Adlak,
I'm new in openfoam and try also to implement my own turbulence model. I have many new parameters to add but I don't know how to define them inside the UEqn. for example, I have in my new UEqn. a vector C where:
C=x*y*z
where (x,y,z) are vectors so if you please can you help me in how I can define C in the same file of UEqn.??

Thanks in advance
crazzy.pirate43 is offline   Reply With Quote

Old   November 22, 2016, 03:41
Default
  #10
Member
 
Peter
Join Date: Nov 2015
Location: Hamburg, Germany
Posts: 57
Rep Power: 10
potentialFoam is on a distinguished road
I think you should not focus on UEqn.C, but rather watch a similar turbulence model (similar to the one you want to implement) and modify it.

As said already above, here
http://hassankassem.me/posts/newturbulencemodel/
you find a good overview of how to do that.

Regards,
Peter
potentialFoam is offline   Reply With Quote

Old   November 22, 2016, 06:52
Default
  #11
Member
 
Mukesh Adlak
Join Date: Jun 2016
Posts: 32
Rep Power: 9
Adlak is on a distinguished road
Quote:
Originally Posted by crazzy.pirate43 View Post
Dear Adlak,
I'm new in openfoam and try also to implement my own turbulence model. I have many new parameters to add but I don't know how to define them inside the UEqn. for example, I have in my new UEqn. a vector C where:
C=x*y*z
where (x,y,z) are vectors so if you please can you help me in how I can define C in the same file of UEqn.??

Thanks in advance
Dear crazzy.pirate43

I dont think u need to modify UEqn. If u want to modify then u should modify ur newturbulencemodel.c and .h file accordingly. And for compilation u can follow the steps given here
http://hassankassem.me/posts/newturbulencemodel/

I am also trying to do that but not succeed at.
crazzy.pirate43 likes this.
Adlak is offline   Reply With Quote

Old   November 23, 2016, 10:38
Default
  #12
Member
 
Mohamed Elghorab
Join Date: May 2016
Location: Coventry, Engalnd
Posts: 41
Rep Power: 9
crazzy.pirate43 is on a distinguished road
Thanks a lot for your quick reply. Now I will come back and search again in that way and I will tell you with the news
crazzy.pirate43 is offline   Reply With Quote

Old   December 5, 2016, 08:36
Default
  #13
Member
 
Mohamed Elghorab
Join Date: May 2016
Location: Coventry, Engalnd
Posts: 41
Rep Power: 9
crazzy.pirate43 is on a distinguished road
Hi Adlak,
I think I did it but when I tried to run it I got some error message at t=550 sec like :

srun: Job step aborted: Waiting up to 5 seconds for job step to finish.
slurmstepd: error: *** STEP 222951.0 ON cnode57 CANCELLED AT 2016-12-04T13:42:26 DUE TO TIME LIMIT ***

I tried to google it but actually there is no specific way to pass this error, Do you have any comment on that and how to solve it??

Mohamed
crazzy.pirate43 is offline   Reply With Quote

Old   December 6, 2016, 04:13
Default
  #14
Member
 
Mukesh Adlak
Join Date: Jun 2016
Posts: 32
Rep Power: 9
Adlak is on a distinguished road
Quote:
Originally Posted by crazzy.pirate43 View Post
Hi Adlak,
I think I did it but when I tried to run it I got some error message at t=550 sec like :

srun: Job step aborted: Waiting up to 5 seconds for job step to finish.
slurmstepd: error: *** STEP 222951.0 ON cnode57 CANCELLED AT 2016-12-04T13:42:26 DUE TO TIME LIMIT ***

I tried to google it but actually there is no specific way to pass this error, Do you have any comment on that and how to solve it??

Mohamed
Might be this is the max time for which u can run ur job on cluster. Resubmit the job from latest time step.
Adlak is offline   Reply With Quote

Old   December 7, 2016, 08:44
Default
  #15
Member
 
Mohamed Elghorab
Join Date: May 2016
Location: Coventry, Engalnd
Posts: 41
Rep Power: 9
crazzy.pirate43 is on a distinguished road
Hi adlak,

Thanks a lot I realized that it was due to the max. time for my job on the cluster.

Thanks again
crazzy.pirate43 is offline   Reply With Quote

Old   December 10, 2016, 04:20
Default
  #16
Member
 
Mukesh Adlak
Join Date: Jun 2016
Posts: 32
Rep Power: 9
Adlak is on a distinguished road
Quote:
Originally Posted by hk318i View Post
Hi,

I am glad that my post helped you.

Regarding this error because it is not a compiler error, it is not easy to pinpoint the source of it without extensive testing. From my point of view, this code looks fine except lines 101 and 115 (.C file). These lines are dangerous because if W or S is zero, SqrW and SqrD will be zero as well. This could be the source of error but I don't know alot about W or S values, therefore I could be wrong about that.

Best Wishes,
Hassan Kassem
Hi hassan,

I am trying to compile dynamicLagrangian model but getting following error :

#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 ? in "/lib/x86_64-linux-gnu/libpthread.so.0"
#3 ? in "/lib/x86_64-linux-gnu/libm.so.6"
#4 pow in "/lib/x86_64-linux-gnu/libm.so.6"
#5 Foam:ow(Foam::Field<double>&, Foam::UList<double> const&, double const&) at ??:?
#6 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam:ow<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<doub le, Foam::fvPatchField, Foam::volMesh> > const&, Foam::dimensioned<double> const&) at ??:?
#7 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam:ow<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<doub le, Foam::fvPatchField, Foam::volMesh> > const&, double const&) at ??:?
#8 Foam::LESModels:LM<Foam::IncompressibleTurbulenc eModel<Foam::transportModel> >::correct() at ??:?
#9 ? at ??:?
#10 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#11 ? at ??:?
Floating point exception (core dumped)

can anyone help me ?
Adlak is offline   Reply With Quote

Old   February 8, 2017, 04:04
Default
  #17
New Member
 
CHUNG Ching Chun
Join Date: Aug 2016
Location: Tin Shui Wai, New Territories, Hong Kong
Posts: 11
Rep Power: 9
richard.chung.jones is on a distinguished road
Quote:
Originally Posted by Adlak View Post
Hi hassan,

I am trying to compile dynamicLagrangian model but getting following error :

#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 ? in "/lib/x86_64-linux-gnu/libpthread.so.0"
#3 ? in "/lib/x86_64-linux-gnu/libm.so.6"
#4 pow in "/lib/x86_64-linux-gnu/libm.so.6"
#5 Foam:ow(Foam::Field<double>&, Foam::UList<double> const&, double const&) at ??:?
#6 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam:ow<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<doub le, Foam::fvPatchField, Foam::volMesh> > const&, Foam::dimensioned<double> const&) at ??:?
#7 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam:ow<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<doub le, Foam::fvPatchField, Foam::volMesh> > const&, double const&) at ??:?
#8 Foam::LESModels:LM<Foam::IncompressibleTurbulenc eModel<Foam::transportModel> >::correct() at ??:?
#9 ? at ??:?
#10 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#11 ? at ??:?
Floating point exception (core dumped)

can anyone help me ?
It is because you got something dividing by zero.
richard.chung.jones is offline   Reply With Quote

Old   February 26, 2017, 01:30
Default
  #18
New Member
 
Bo Kong
Join Date: Oct 2016
Location: China
Posts: 22
Rep Power: 9
huangfei is on a distinguished road
Quote:
Originally Posted by Adlak View Post
Hi hassan,

I am trying to compile dynamicLagrangian model but getting following error :

#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 ? in "/lib/x86_64-linux-gnu/libpthread.so.0"
#3 ? in "/lib/x86_64-linux-gnu/libm.so.6"
#4 pow in "/lib/x86_64-linux-gnu/libm.so.6"
#5 Foam:ow(Foam::Field<double>&, Foam::UList<double> const&, double const&) at ??:?
#6 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam:ow<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<doub le, Foam::fvPatchField, Foam::volMesh> > const&, Foam::dimensioned<double> const&) at ??:?
#7 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam:ow<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<doub le, Foam::fvPatchField, Foam::volMesh> > const&, double const&) at ??:?
#8 Foam::LESModels:LM<Foam::IncompressibleTurbulenc eModel<Foam::transportModel> >::correct() at ??:?
#9 ? at ??:?
#10 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#11 ? at ??:?
Floating point exception (core dumped)

can anyone help me ?
I am trying to compile the dynamicSmagorinsky model in version 4.0 post by AlbertoPa. But I get some errors:
dynamicSmagorinsky.C:155:6: error: ‘template<class BasicTurbulenceModel> class Foam::LESModels::dynamicSmagorinsky’ used without template parameters
bool dynamicSmagorinsky::read()
^
dynamicSmagorinsky.C: In function ‘bool Foam::LESModels::read()’:
dynamicSmagorinsky.C:159:9: error: ‘filter_’ was not declared in this scope
filter_.read(this->coeffDict());
^
dynamicSmagorinsky.C:159:22: error: invalid use of ‘this’ in non-member function
filter_.read(this->coeffDict());
^
dynamicSmagorinsky.C: In member function ‘virtual void Foam::LESModels::dynamicSmagorinsky<BasicTurbulenc eModel>::correct(const Foam::tmp<Foam::GeometricField<Foam::Tensor<double >, Foam::fvPatchField, Foam::volMesh> >&)’:
dynamicSmagorinsky.C:180:16: error: ‘kMin_’ was not declared in this scope
bound(k_, kMin_);
^
dynamicSmagorinsky.C:180:21: error: there are no arguments to ‘bound’ that depend on a template parameter, so a declaration of ‘bound’ must be available [-fpermissive]
bound(k_, kMin_);
^
Do you know how to solve these problems?
Thanks~
huangfei is offline   Reply With Quote

Old   September 12, 2020, 06:36
Default
  #19
New Member
 
Jiaui Zhang
Join Date: Aug 2018
Location: Changsha, China
Posts: 17
Rep Power: 7
charryzzz is on a distinguished road
Quote:
Originally Posted by huangfei View Post
I am trying to compile the dynamicSmagorinsky model in version 4.0 post by AlbertoPa. But I get some errors:
dynamicSmagorinsky.C:155:6: error: ‘template<class BasicTurbulenceModel> class Foam::LESModels::dynamicSmagorinsky’ used without template parameters
bool dynamicSmagorinsky::read()
^
dynamicSmagorinsky.C: In function ‘bool Foam::LESModels::read()’:
dynamicSmagorinsky.C:159:9: error: ‘filter_’ was not declared in this scope
filter_.read(this->coeffDict());
^
dynamicSmagorinsky.C:159:22: error: invalid use of ‘this’ in non-member function
filter_.read(this->coeffDict());
^
dynamicSmagorinsky.C: In member function ‘virtual void Foam::LESModels::dynamicSmagorinsky<BasicTurbulenc eModel>::correct(const Foam::tmp<Foam::GeometricField<Foam::Tensor<double >, Foam::fvPatchField, Foam::volMesh> >&)’:
dynamicSmagorinsky.C:180:16: error: ‘kMin_’ was not declared in this scope
bound(k_, kMin_);
^
dynamicSmagorinsky.C:180:21: error: there are no arguments to ‘bound’ that depend on a template parameter, so a declaration of ‘bound’ must be available [-fpermissive]
bound(k_, kMin_);
^
Do you know how to solve these problems?
Thanks~

You can add the head file #include "bound.H"
charryzzz is offline   Reply With Quote

Reply


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
Error in Two phase (condensation) modeling adilsyyed CFX 15 June 24, 2015 19:42
Overflow Error in Multiphase Modelling with Two Continuous Fluids ashtonJ CFX 6 August 11, 2014 14:32
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 17:44
Wrong calculation of nut in the kOmegaSST turbulence model FelixL OpenFOAM Bugs 27 March 27, 2012 09:02
Low Reynolds k-epsilon model YJZ ANSYS 1 August 20, 2010 13:57


All times are GMT -4. The time now is 10:45.