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

complicated boundary condition

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

Like Tree1Likes
  • 1 Post By benk

Reply
 
LinkBack Thread Tools Display Modes
Old   April 26, 2011, 04:02
Default complicated boundary condition
  #1
New Member
 
David Eržen
Join Date: Jan 2011
Posts: 3
Rep Power: 6
daviderzen is on a distinguished road
Hi!

I would like to create a velocity boundary condition (on a wing profile) with following properties:
- tangential slip
- normal velocity calculated from a formula that contains two imported, precalculated velocity fields.

I have tried using fixedNormalSlip bc, but I had problems with imported velocity fields (volVectorField). I couldn't match the field types.

Does anybody have similar bc already implemented?

David
daviderzen is offline   Reply With Quote

Old   April 26, 2011, 09:21
Default
  #2
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 10
benk is on a distinguished road
Although I don't have much experience with your application, normally the implementation of complicated boundary conditions are made much easier using groovyBC (http://openfoamwiki.net/index.php/Contrib_groovyBC). This is like an add on module that you have to install.
benk is offline   Reply With Quote

Old   May 4, 2011, 05:38
Default
  #3
New Member
 
David Eržen
Join Date: Jan 2011
Posts: 3
Rep Power: 6
daviderzen is on a distinguished road
Excellent!!!!

that's what i need

thank you very very much


ehm, is ti possible to access also scalars from this groovyBC, not just scalar (or other) fields?
daviderzen is offline   Reply With Quote

Old   May 4, 2011, 08:53
Default
  #4
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 10
benk is on a distinguished road
Quote:
Originally Posted by daviderzen View Post
ehm, is ti possible to access also scalars from this groovyBC, not just scalar (or other) fields?
This is something that I also want to do (so that I can set a flag within my solver and change the boundary condition based on this flag) but groovyBC cannot read in scalars, it only has access to the field data.

Check out this thread: Change of boundary conditions during run time

As a workaround, I set up a dummy volScalarField filled with all 0 values except for the boundary which I set to 1 or 0 in my solver depending on whether I want a gradient or fixedvalue BC. Then, in groovyBC, you can just treat that volScalarField like a scalar. This is a bit of a workaround though and wouldn't work well if you want to read in a lot of scalar values.

If Bernhard is reading this: +1 for this feature (when you have some time )
daviderzen likes this.
benk is offline   Reply With Quote

Old   May 5, 2011, 12:23
Default
  #5
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by benk View Post
This is something that I also want to do (so that I can set a flag within my solver and change the boundary condition based on this flag) but groovyBC cannot read in scalars, it only has access to the field data.

Check out this thread: Change of boundary conditions during run time

As a workaround, I set up a dummy volScalarField filled with all 0 values except for the boundary which I set to 1 or 0 in my solver depending on whether I want a gradient or fixedvalue BC. Then, in groovyBC, you can just treat that volScalarField like a scalar. This is a bit of a workaround though and wouldn't work well if you want to read in a lot of scalar values.

If Bernhard is reading this: +1 for this feature (when you have some time )
I don't quite get what you want to achieve? Do these 1s and 0s change during the simulation (by the solver or so) and therefor you can't use a plain fractionExpression? With "plain" groovyBC this would be hard (and your solution would be the only choice). With the groovyBC in swak you can achieve something similar if the switches depend on the state of the simulation: Using "external" variables you can say stuff like "if the maximum value of the temperature is above 342 then this BC should be a zeroGradient otherwise fixed"

With the release that I pushed to the SVN a couple of weeks ago (never properly announced it I'm afraid) I introduced "stored variables" with which you can implement stuff like "if the maximum temperature is above 342 then this BC should BECOME a zeroGradient and STAY that way even if the temperature falls"

This and other features of swak4Foam I'll explain during my talk at the Workshop at Penn State next month. I hear that they still accept registrations

Accessing "a scalar variable of the solver" from groovyBC would only be possible if it was exposed via the objectRegistry (and this is currently not implemented). Accessing a variable that is only defined as "scalar switchBC=0;" in the code is technically not possible

About feature wishes: I may sound like a broken record, but I tend to take these more seriously if they pop up in the BugReporting-Mantis of swak4foam (see the Wiki-page)

Bernhard
gschaider is offline   Reply With Quote

Old   May 5, 2011, 12:43
Default
  #6
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 10
benk is on a distinguished road
Thanks Berhard,

Quote:
Originally Posted by gschaider View Post
I don't quite get what you want to achieve? Do these 1s and 0s change during the simulation (by the solver or so) and therefor you can't use a plain fractionExpression? With "plain" groovyBC this would be hard (and your solution would be the only choice). With the groovyBC in swak you can achieve something similar if the switches depend on the state of the simulation: Using "external" variables you can say stuff like "if the maximum value of the temperature is above 342 then this BC should be a zeroGradient otherwise fixed"
I'm modelling batteries and I want to be able to switch between a constant current (which requires a fixedGradient BC) and a constant voltage (which requires a fixedValue BC) during the simulation. So I have a flag, defined as scalar flag = 0; During runtime, if a certain condition is met, I want to set the flag = 1; and switch between constant current to constant voltage (and vice-versa) and in groovyBC boundary condition, I would have something like:

Code:
fractionExpression "(flag > 0) ? 0 : 1"

Quote:
Originally Posted by gschaider View Post
This and other features of swak4Foam I'll explain during my talk at the Workshop at Penn State next month. I hear that they still accept registrations.
I can't go but I hope somehow this info will extend beyond the workshop.

Quote:
Originally Posted by gschaider View Post
Accessing "a scalar variable of the solver" from groovyBC would only be possible if it was exposed via the objectRegistry (and this is currently not implemented). Accessing a variable that is only defined as "scalar switchBC=0;" in the code is technically not possible
This is what I want to do. But I think a workaround of making a dummy volumeScalar field (as I explained above) and setting the fixedValue boundary condition to either 1 or 0 should work.
benk is offline   Reply With Quote

Reply

Tags
boundary condition, field types, fixednormalslip, imported fields

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
Can anyone give me some hint on how to make traction free boundary condition? poplar OpenFOAM 3 January 14, 2015 03:37
Boundary Conditions Thomas P. Abraham Main CFD Forum 20 July 7, 2013 05:05
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 to set boundary condition in Fluent for the fo Peiyong FLUENT 1 November 10, 2006 12:44


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