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

Boundary Condition and U-field

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 23, 2012, 08:37
Default Boundary Condition and U-field
  #1
Member
 
Join Date: May 2012
Location: Dresden, Germany
Posts: 32
Rep Power: 4
dl6tud is on a distinguished road
From a boundary condition I would like to access for example the velocity field. I try like that:

Quote:
fvPatchField<vector>& U = this->patch().lookupPatchField<volVectorField, vector>("U");
That gives me the error
Quote:
heatFlowFvPatchField.C:232:71: Fehler: expected primary-expression before »,« token
heatFlowFvPatchField.C:232:79: Fehler: expected primary-expression before »>« token
And I do not know why. The code comes from an older version of OF. I thought some include file may be missing, but I found nothing. Can anyone help me?
dl6tud is offline   Reply With Quote

Old   August 23, 2012, 09:29
Default
  #2
Senior Member
 
Jens Höpken
Join Date: Apr 2009
Location: Duisburg, Germany
Posts: 129
Rep Power: 7
jhoepken is on a distinguished road
Send a message via Skype™ to jhoepken
I usually use
Code:
const fvPatchField<vector>& foo = patch().lookupPatchField<volVectorField, vector>("U");
So the difference is only in the constness of foo, but your compiler error does not complain about the constness but about some incorrect expressions. Have you copied the code from somewhere (internet,...)? Maybe the encoding is screwed up a little bit.

Jens
jhoepken is offline   Reply With Quote

Old   August 23, 2012, 09:42
Default
  #3
Member
 
Join Date: May 2012
Location: Dresden, Germany
Posts: 32
Rep Power: 4
dl6tud is on a distinguished road
Thanks for your answer! I use a modified 'fixedValue' BC added to a solver. I tried 100 different versions for accessing U, but nothing worked. It's always the same error -> no idea why :-(

A good explanation how to access fixed dict entries:
http://albertopassalacqua.com/?p=947
dl6tud is offline   Reply With Quote

Old   August 24, 2012, 02:20
Default
  #4
Senior Member
 
Jens Höpken
Join Date: Apr 2009
Location: Duisburg, Germany
Posts: 129
Rep Power: 7
jhoepken is on a distinguished road
Send a message via Skype™ to jhoepken
What exactly do you mean by "added to a solver"? Did you compile the boundary condition into the executable of a solver?
jhoepken is offline   Reply With Quote

Old   August 24, 2012, 02:28
Default
  #5
Member
 
Join Date: May 2012
Location: Dresden, Germany
Posts: 32
Rep Power: 4
dl6tud is on a distinguished road
Yes, that's what I did! Linking a BC directly to a solver is possible by compiling BC and Solver together (Make/files):

Quote:
buoyantBoussinesqPimpleFoamQ.C
heatFlowFvPatchFields.C

EXE = $(FOAM_USER_APPBIN)/buoyantBoussinesqQFoam
First, I based my new BC on fixedValueFvPatchField, that did newer work. It worked with wallHeatTransferFvPatchScalarField, I have no idea why.
dl6tud is offline   Reply With Quote

Old   August 24, 2012, 02:57
Default
  #6
Senior Member
 
Jens Höpken
Join Date: Apr 2009
Location: Duisburg, Germany
Posts: 129
Rep Power: 7
jhoepken is on a distinguished road
Send a message via Skype™ to jhoepken
I know how this should work in principle, but I would very much like to avoid it. Since one might want to use the BC with a different solver as well. But I guess that this is a matter of choice .

It doesn't compile at the moment, right? Have you checked your line for incorrect chars (resulting from copying code from somewhere else, e.g. the internet)?
jhoepken is offline   Reply With Quote

Old   August 26, 2012, 17:37
Default
  #7
Member
 
Join Date: May 2012
Location: Dresden, Germany
Posts: 32
Rep Power: 4
dl6tud is on a distinguished road
Yes, I checked for incorrect characters. And I tried different ways of access (db.lookup; this->patch.lookup; etc.).

First, I thought using fixedValue as basis because I know very well how it works. But as I want to use the BC only for Temperature I thought later that it might be better to use some scalar BC (fixedValue can be scalar or vector). So I took wallHeatTransfer and modified that. I had to investigate again to understand how it works, but here I did no face any problems.

--> The problem it not solved, but I found a working solution. Thank you!!!
dl6tud is offline   Reply With Quote

Old   August 27, 2012, 03:55
Default
  #8
Senior Member
 
Jens Höpken
Join Date: Apr 2009
Location: Duisburg, Germany
Posts: 129
Rep Power: 7
jhoepken is on a distinguished road
Send a message via Skype™ to jhoepken
I see. Do you mind sharing your workaround? Maybe others run into the same issue as well.
jhoepken 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
Field value inside a boundary condition class pcaron OpenFOAM 8 July 27, 2010 06:04
External Radiation Boundary Condition (Two sided wall), Grid Interface CFD XUE FLUENT 0 July 8, 2010 06:49
vorticity boundary condition bearcharge Main CFD Forum 0 May 14, 2010 11:32
Boundary condition vector field gradient from two sides of patch face quba OpenFOAM 0 December 12, 2007 05:26
Slip boundary condition what is inside normunds OpenFOAM Running, Solving & CFD 2 June 4, 2007 06:45


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