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

Equation of state redifinition error

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By usv001

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 20, 2018, 16:18
Post Equation of state redifinition error
  #1
New Member
 
Gergely Keszthelyi
Join Date: Nov 2018
Posts: 1
Rep Power: 0
kergely is on a distinguished road
Hello everyone!

I am currently trying to create a new Equation of State model loosely based on the IAPWS formulation for super-heated steam called oneIAPWS, working on OpenFOAM 6.0.
(Though it is at the moment just a simple polynomial fit in the region interest, but this would suffice for my needs at the moment.) This way this is an equation of state that does not need any input data.

Therefore I based my code on the perfectGas built-in equation of state, where I switched all instances of perfectGas to oneIAPWS, and edited the property functions in the file containing the inline declarations. All the operators were left alone.

For compilation, I made a Make directory as necessary, along with the files. In the files file, I created an so
Code:
./oneIAPWS.C

LIB = $(FOAM_USER_LIBBIN)/liboneIAPWS
, and in the options file I called the following sources:

Code:
EXE_INC = \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude

LIB_LIBS = \
    -lfiniteVolume
As per this earlier thread on including the EoS later in my code, i also included a file with makeThermo along with the source code, based on this (albeit old) discussion on these forums, to have run-time linking.

The library does not compile however, as I get the following error message after using wmake libso:

Code:
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file oneIAPWS.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/opt/openfoam6/src/finiteVolume/lnInclude -I/opt/openfoam6/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam6/src/thermophysicalModels/specie/lnInclude -I/opt/openfoam6/src/thermophysicalModels/reactionThermo/lnInclude -IlnInclude -I. -I/opt/openfoam6/src/OpenFOAM/lnInclude -I/opt/openfoam6/src/OSspecific/POSIX/lnInclude   -fPIC -c oneIAPWS.C -o Make/linux64GccDPInt32Opt/./oneIAPWS.o
oneIAPWS.C:32:1: error: redefinition of ‘Foam::oneIAPWS<Specie>::oneIAPWS(const Foam::dictionary&)’
 Foam::oneIAPWS<Specie>::oneIAPWS(const dictionary& dict)
 ^~~~
In file included from oneIAPWS.H:200:0,
                 from oneIAPWS.C:26:
oneIAPWS.C:32:1: note: ‘Foam::oneIAPWS<Specie>::oneIAPWS(const Foam::dictionary&)’ previously declared here
 Foam::oneIAPWS<Specie>::oneIAPWS(const dictionary& dict)
 ^~~~
oneIAPWS.C:41:6: error: redefinition of ‘void Foam::oneIAPWS<Specie>::write(Foam::Ostream&) const’
 void Foam::oneIAPWS<Specie>::write(Ostream& os) const
      ^~~~
In file included from oneIAPWS.H:200:0,
                 from oneIAPWS.C:26:
oneIAPWS.C:41:6: note: ‘void Foam::oneIAPWS<Specie>::write(Foam::Ostream&) const’ previously declared here
 void Foam::oneIAPWS<Specie>::write(Ostream& os) const
      ^~~~
oneIAPWS.C:50:16: error: redefinition of ‘template<class Specie> Foam::Ostream& Foam::operator<<(Foam::Ostream&, const Foam::oneIAPWS<Specie>&)’
 Foam::Ostream& Foam::operator<<(Ostream& os, const oneIAPWS<Specie>& pg)
                ^~~~
In file included from oneIAPWS.H:200:0,
                 from oneIAPWS.C:26:
oneIAPWS.C:50:16: note: ‘template<class Specie> Foam::Ostream& Foam::operator<<(Foam::Ostream&, const Foam::oneIAPWS<Specie>&)’ previously declared here
 Foam::Ostream& Foam::operator<<(Ostream& os, const oneIAPWS<Specie>& pg)
                ^~~~
/opt/openfoam6/wmake/rules/General/transform:25: recipe for target 'Make/linux64GccDPInt32Opt/./oneIAPWS.o' failed
make: *** [Make/linux64GccDPInt32Opt/./oneIAPWS.o] Error 1
I also tried to simply copy the perfectGas equation of state, renaming only the files, and copying with the same Make folder, but without the file for makeThermo to test compilation. I got the same error that time as well.

What could I be doing wrong? Are the headers wrongly declared? (As this is most often linked to redefinition errors. I did not edit the #ifndef settings though.) I only found one similar error, but that simply "disappeared" by copying the files again. All of my files are attached to this post.

Thanks for all the help in advance;
Gergely
Attached Files
File Type: zip oneIAPWS.zip (6.1 KB, 5 views)
kergely is offline   Reply With Quote

Old   December 4, 2018, 06:07
Default
  #2
Senior Member
 
Join Date: Sep 2015
Location: Singapore
Posts: 102
Rep Power: 11
usv001 is on a distinguished road
I had a similar problem. Try removing the following lines from oneIAPWS.H.

Code:
#ifdef NoRepository
    #include "oneIAPWS.C"
#endif
USV
m.omair likes this.
usv001 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
Setting the height of the stream in the free channel kevinmccartin CFX 12 October 13, 2022 22:43
[OpenFOAM] an error in Calculator's equation immortality ParaView 12 June 29, 2021 01:10
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 20:43
error message cuteapathy CFX 14 March 20, 2012 07:45
How to get the max value of the whole field waynezw0618 OpenFOAM Running, Solving & CFD 4 June 17, 2008 06:07


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