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

Compiling a custion Boundary Condition

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

Like Tree1Likes
  • 1 Post By chegdan

Reply
 
LinkBack Thread Tools Display Modes
Old   March 21, 2013, 12:26
Default Compiling a custion Boundary Condition
  #1
Member
 
Jim Knopf
Join Date: Dec 2010
Posts: 60
Rep Power: 6
JimKnopf is on a distinguished road
Hello Everyone,

i got a problem that i don't understand.

What I want:
A custom BC derived from fixedGradientFvPatchField

What I tried:
Copy the original source code an replace fixedGradientFvPatchField with hTCFvPatchField in the filenames and in the files.
Added a Make directory with files:
Code:
hTCFvPatchField.C

LIB = $(FOAM_USER_LIBBIN)/libmyBCs
and options:
Code:
EXE_INC = \
        -I$(FOAM_SRC)/finiteVolume/lnInclude

LIB_LIBS =
Unfortunatly this results in a compiling error:
Code:
hTCFvPatchField.C:37:1: error: redefinition of 'Foam::hTCFvPatchField<Type>::hTCFvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&)'
hTCFvPatchField.C:37:1: error: 'Foam::hTCFvPatchField<Type>::hTCFvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&)' previously declared here
hTCFvPatchField.C:49:1: error: redefinition of 'Foam::hTCFvPatchField<Type>::hTCFvPatchField(const Foam::hTCFvPatchField<Type>&, const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::fvPatchFieldMapper&)'
and so forth for every method.

What did I do wrong?
I tried the same workflow with the original code and got the same result ?!?

I would be glad abount any idea.

Greets
Jim
JimKnopf is offline   Reply With Quote

Old   March 21, 2013, 16:11
Default
  #2
Member
 
Jim Knopf
Join Date: Dec 2010
Posts: 60
Rep Power: 6
JimKnopf is on a distinguished road
Although double posting should be no godd style, here is the answer I found:

in Make/files is has to be
Code:
htcFvPatchFields.C

LIB =  $(FOAM_USER_LIBBIN)/libmyBCs
Now, my question is why? What is the intention of the classNames.C files ?

It does just include the definition file and does some kinde of object registration, but it does not do a forward declaration.

Greets,
Jim

Last edited by JimKnopf; March 21, 2013 at 16:51.
JimKnopf is offline   Reply With Quote

Old   March 21, 2013, 18:35
Default
  #3
Senior Member
 
chegdan's Avatar
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 546
Rep Power: 18
chegdan will become famous soon enough
Just a tip on derived boundary conditions. If it is going to be derived from a basic type, then start with something else other than the basic type. By this i mean, go to an already derived BC from the type you want....and start from there. This will be much less painless as you will deal less with the template and minimize the amount of time you bang your head on the table in frustration .

#protip
carowjp likes this.
__________________
Dan

Find me on twitter @dancombest and LinkedIn
chegdan is offline   Reply With Quote

Old   March 22, 2013, 02:52
Default
  #4
Member
 
Jim Knopf
Join Date: Dec 2010
Posts: 60
Rep Power: 6
JimKnopf is on a distinguished road
The head banging is definitly your point. but for me, I don't like to do what the software "wants" me to do, I like to do with the Software what I want.

Templates are not the magic that made the problem, it was more the point that there is a "NoRepository" Flag in the class.H file, which included the .C file and therefore produced a preprocessor loop.

What I'm wondering is, why is it done the way it is done, to me it makes no sense yet. As far as I can see, the inventors of OpenFoam included some kind of sens in every piece of their code.

Greets
Jim
JimKnopf is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening Boundary Condition andreachan Main CFD Forum 11 March 19, 2013 17:46
Periodic Boundary Condition C.C Main CFD Forum 22 November 20, 2012 01:48
Setting outlet Pressure boundary condition using CAFFA code Mukund Pondkule Main CFD Forum 0 March 16, 2011 04:23
Domain Imbalance HMR CFX 3 March 6, 2011 21:10
How exactly the "pressure outlet" bdry condition compute properties on the boundary? yating9901 FLUENT 3 June 28, 2010 12:26


All times are GMT -4. The time now is 00:55.