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

Problem with compilation of new Boundary Conditions

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 20, 2012, 16:55
Default Problem with compilation of new Boundary Conditions
  #1
New Member
 
Arvind Bharathi
Join Date: Oct 2012
Posts: 6
Rep Power: 13
arvind3008 is on a distinguished road
Dear readers

I am new to Open foam, so please bear with me if the question is trivial. I am trying to create new BC based on advectiveFvPatchField and using rhoPimpleFoam solver.

Following standard procedure, I copied the solver files and advectiveFvPatchField.h and .C to a folder and tried to compile I am getting the following error:

Making dependency list for source file advectiveFvPatchField.C
Making dependency list for source file rhoPimpleFoam.C
SOURCE=rhoPimpleFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam211/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam211/src/turbulenceModels/compressible/turbulenceModel -I/opt/openfoam211/src/finiteVolume/cfdTools -I/opt/openfoam211/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam211/src/OpenFOAM/lnInclude -I/opt/openfoam211/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/rhoPimpleFoam.o
SOURCE=advectiveFvPatchField.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam211/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam211/src/turbulenceModels/compressible/turbulenceModel -I/opt/openfoam211/src/finiteVolume/cfdTools -I/opt/openfoam211/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam211/src/OpenFOAM/lnInclude -I/opt/openfoam211/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/advectiveFvPatchField.o
advectiveFvPatchField.C:38:1: error: redefinition of ‘Foam::advectiveFvPatchField<Type1>::advectiveFvPa tchField(const Foam::fvPatch&, const Foam:imensionedField<Type, Foam::volMesh>&)’
advectiveFvPatchField.C:38:1: error: ‘Foam::advectiveFvPatchField<Type1>::advectiveFvPa tchField(const Foam::fvPatch&, const Foam:imensionedField<Type, Foam::volMesh>&)’ previously declared here
advectiveFvPatchField.C:57:1: error: redefinition of ‘Foam::advectiveFvPatchField<Type1>::advectiveFvPa tchField(const Foam::advectiveFvPatchField<Type1>&, const Foam::fvPatch&, const Foam:imensionedField<Type, Foam::volMesh>&, const Foam::fvPatchFieldMapper&)’
advectiveFvPatchField.C:57:1: error: ‘Foam::advectiveFvPatchField<Type1>::advectiveFvPa tchField(const Foam::advectiveFvPatchField<Type1>&, const Foam::fvPatch&, const Foam:imensionedField<Type, Foam::volMesh>&, const Foam::fvPatchFieldMapper&)’ previously declared here
advectiveFvPatchField.C:74:1: error: redefinition of ‘Foam::advectiveFvPatchField<Type1>::advectiveFvPa tchField(const Foam::fvPatch&, const Foam:imensionedField<Type, Foam::volMesh>&, const Foam::dictionary&)’
advectiveFvPatchField.C:74:1: error: ‘Foam::advectiveFvPatchField<Type1>::advectiveFvPa tchField(const Foam::fvPatch&, const Foam:imensionedField<Type, Foam::volMesh>&, const Foam::dictionary&)’ previously declared here
advectiveFvPatchField.C:126:1: error: redefinition of ‘Foam::advectiveFvPatchField<Type1>::advectiveFvPa tchField(const Foam::advectiveFvPatchField<Type1>&)’
advectiveFvPatchField.C:126:1: error: ‘Foam::advectiveFvPatchField<Type1>::advectiveFvPa tchField(const Foam::advectiveFvPatchField<Type1>&)’ previously declared here
advectiveFvPatchField.C:140:1: error: redefinition of ‘Foam::advectiveFvPatchField<Type1>::advectiveFvPa tchField(const Foam::advectiveFvPatchField<Type1>&, const Foam:imensionedField<Type, Foam::volMesh>&)’
advectiveFvPatchField.C:140:1: error: ‘Foam::advectiveFvPatchField<Type1>::advectiveFvPa tchField(const Foam::advectiveFvPatchField<Type1>&, const Foam:imensionedField<Type, Foam::volMesh>&)’ previously declared here
advectiveFvPatchField.C:158:1: error: redefinition of ‘Foam::tmp<Foam::Field<double> > Foam::advectiveFvPatchField<Type1>::advectionSpeed () const’
advectiveFvPatchField.C:158:1: error: ‘virtual Foam::tmp<Foam::Field<double> > Foam::advectiveFvPatchField<Type1>::advectionSpeed () const’ previously declared here
advectiveFvPatchField.C:188:6: error: redefinition of ‘void Foam::advectiveFvPatchField<Type1>::updateCoeffs() ’
advectiveFvPatchField.C:188:6: error: ‘virtual void Foam::advectiveFvPatchField<Type1>::updateCoeffs() ’ previously declared here
advectiveFvPatchField.C:303:6: error: redefinition of ‘void Foam::advectiveFvPatchField<Type1>::write(Foam::Os tream&) const’
advectiveFvPatchField.C:303:6: error: ‘virtual void Foam::advectiveFvPatchField<Type1>::write(Foam::Os tream&) const’ previously declared here
make: *** [Make/linux64GccDPOpt/advectiveFvPatchField.o] Error 1

I think the error has more to do with C++ template definitions. I tried reading up on it and tried a couple of things by changing the template type name etc... but nothing has worked so far. Any help would be appreciated. I have attached the relevant files.

This is my make file settings:
rhoPimpleFoam.C
advectiveFvPatchField.C
EXE = $(FOAM_USER_APPBIN)/myRhoPimpleFoam

Thank you
arvind3008
Attached Files
File Type: h advectiveFvPatchField.H (6.5 KB, 13 views)
File Type: c rhoPimpleFoam.C (2.9 KB, 7 views)
arvind3008 is offline   Reply With Quote

Old   October 22, 2012, 09:57
Default
  #2
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 21
marupio is on a distinguished road
This is a template problem. I think you need to create another file to instantiate the types, and only include that one. See other fvPatchFields... the ones that have an extra couple of files ending with "s". (Also, it is generally undesirable to tie a solver to a boundary condition... but I've done it myself.)
__________________
~~~
Follow me on twitter @DavidGaden
marupio is offline   Reply With Quote

Old   October 22, 2012, 16:13
Default
  #3
New Member
 
Arvind Bharathi
Join Date: Oct 2012
Posts: 6
Rep Power: 13
arvind3008 is on a distinguished road
Thanks That solved the problem .. although I am not sure why this is the case

Also, I am unable to compile without a solver as I get the error of unreferenced function main() which is true as there is not main function. I assume that in this case we can compile only as a static library then?
arvind3008 is offline   Reply With Quote

Old   October 22, 2012, 17:08
Default
  #4
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 21
marupio is on a distinguished road
You have to compile it to a static library with "wmake libso". You can link your solver to it directly if you want when you compile that, or you could load it with the controlDict at runTime.

-Dave
__________________
~~~
Follow me on twitter @DavidGaden
marupio is offline   Reply With Quote

Reply

Tags
boundary coundition, compilation, errors

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
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 05:21
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 17:44
[Gmsh] Import problem ARC OpenFOAM Meshing & Mesh Conversion 0 February 27, 2010 10:56
CG, BICGSTAB(2) : problem with matrix operation and boundary conditions moomba Main CFD Forum 2 February 17, 2010 03:37
Boundary conditions? Tom Main CFD Forum 0 November 5, 2002 01:54


All times are GMT -4. The time now is 02:14.