
[Sponsors] 
July 5, 2006, 17:20 
Has anyone implemented a bound

#1 
Senior Member
Srinath Madhavan (a.k.a pUl)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 13 
Has anyone implemented a boundary condition of the following type in OpenFOAM?
Where (from Ferziger and Peric [page 273]): phi = any dependent variable (e.g. velocity, pressure etc.) U = A velocity that is independent of location on the outflow surface and is chosen so that overall conservation is maintained (i.e. it is the velocity required to make the outflow mass flux equal to the incoming mass flux). If nobody has done this, I would like to do it. However I would appreciate some guidelines. I am farily OK with C; C++ is fairly new to me. Any help in this regard is most appreciated. Thanks 

July 6, 2006, 02:34 
Hello
I also need that kind o

#2 
New Member
Aurelia Cure
Join Date: Mar 2009
Location: Lund, Sweden
Posts: 18
Rep Power: 9 
Hello
I also need that kind of boundary condition, so if you manage to write it, it would be nice to share ;) When I thought about writing it, I was told that the pressureTransmissive boundary condition ( even if it is for compressible flow), could help to begin with... Good luck Aurelia 

July 6, 2006, 08:57 
Thanks for the tip Aurelia. I'

#3 
Senior Member
Srinath Madhavan (a.k.a pUl)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 13 
Thanks for the tip Aurelia. I'll give it a shot. The only reason I chose OpenFOAM despite my 3year experience with Fluent is that it offers much more freedom to learn and share


July 7, 2006, 07:35 
First derive the discretised i

#4 
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 13 
First derive the discretised implementation of the BC using fluxes, face values, etc. If you can come up with something halfdecent, I will be glad to help you implement it )on the condition that you do the testing!).


July 7, 2006, 07:49 
Hi Eugene,
You're going to

#5 
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,779
Rep Power: 22 
Hi Eugene,
You're going to have fun trying to get the time derivative to be consistent with the temporal disretisation scheme (requires the change of the virtual function interface + you need to implement it in all the schemes). Apart from that, there's no derivation involved  it already tells you what to do. :) Have fun, Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk 

July 7, 2006, 09:29 
Aaarg! I didn't think that far

#6 
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 13 
Aaarg! I didn't think that far ahead.
Time centred was all I had in my head. I have been pining for this BC for quite some time though, so it might just be worth the effort (even if it takes up the rest of my discretionary time this year). (PS. I know it tells me what to do I just wanted some commitment from the OP!) 

July 7, 2006, 09:38 
If you want it, I can do it in

#7 
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,779
Rep Power: 22 
If you want it, I can do it in a few minutes, but you will need an updated version of the library  at least until the next release. Alternatively, you can get into my bad books and hack it with the firstorder ddt term :)
For all those interested Foamers out there, the b.c. will be a fixed gradient type and I get the gradient by rewriting the expression in the following form: d phi/d n = ddt \phi Sf / F with the stabilisation for zero flux. And that's it :) Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk 

July 7, 2006, 09:53 
In that case I retract my prev

#8 
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 13 
In that case I retract my previous offer!
Which classes require an updated interface for this to work? The description of U in the original post also leaves me slightly confused. 

July 7, 2006, 12:46 
Hrv: Indeed if you can do this

#9 
Senior Member
Srinath Madhavan (a.k.a pUl)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 13 
Hrv: Indeed if you can do this in a few minutes, it would be great. I am more than willing to test it as soon as possible
Eugene: The description of U is verbatim from the textbook. I have not bothered to get into the details yet PS: I wonder why Fluent does not have this B/C builtin (given the fact that Ferziger and Peric recommend this B/C, as it appears to work well for most unsteady cases). 

July 13, 2006, 13:23 
@Eugene:
I just pulled out

#10 
Senior Member
Srinath Madhavan (a.k.a pUl)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 13 
@Eugene:
I just pulled out an excerpt from a very recent paper in Journal of Computational Physics (Vol: 206, page 661), and I can see now what you mean by 'slightly confused'. "...The Convective Boundary Condition (CBC) has been used by Najjar and Vanka [4] and Najjar and Balachandran [5] in computing uniform flow past a normal flat plate. Cheng and Armfield [6] have employed it in computing uniform, twodimensional flow past a circular cylinder. It has also been employed by Pauley et al. [7], Arnal et al. [8], Sohankar et al. [9] and Biswas and coworkers [10] for the computations of uniform, twodimensional flow past a square cylinder. However, it is felt that the CBC lacks in a proper physical basis for elliptic and parabolic problems and it is also somewhat awkward to implement. The quantity U in the Equation is loosely defined in the literature as different authors have defined it in a different manner [4*7]. The value of U, which yields minimum distortion in the vorticity structure at the exit, has to be determined by trial..." 

September 29, 2006, 03:23 
hello
I need to use a convect

#11 
New Member
Aurelia Cure
Join Date: Mar 2009
Location: Lund, Sweden
Posts: 18
Rep Power: 9 
hello
I need to use a convective boundary and don't manage to make it work like discribed in the thread. According to Hrvoje, it should be easy... could you share it if you wrote such a boundary condition? Thanks aurelia 

October 4, 2006, 11:39 
No, I have not written it yet.

#12 
Senior Member
Srinath Madhavan (a.k.a pUl)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 13 
No, I have not written it yet. Hrv, if you've written it, can you post it on the forum? Thanks!


January 19, 2007, 22:35 
Hi again, I did a little math

#13 
Super Moderator
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 12 
Hi again, I did a little math and now I've got satisfactory results by applying a predictorcorrector method in patchnormal direction (not in usual temporal direction). The problem seems to be solved.
Regards, Takuya 

January 19, 2007, 22:37 
Takuya,
It would be nice if

#14 
Senior Member
Srinath Madhavan (a.k.a pUl)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 13 
Takuya,
It would be nice if you could post your code so others can test it as well. Thanks! 

January 20, 2007, 01:00 
Hi pUl,
Of course I could do

#15 
Super Moderator
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 12 
Hi pUl,
Of course I could do so but the code is currently a total gabage for CFD people because it can only handle scalar variables (= the velocity potential). To handle vectors I have to rewrite the whole code using C++ templates. My estimate is that it won't take so much effort but at least I need some test cases including unsteady outlet flows (I myself don't have any such cases in handy )  contribution welcome. And the most important is, please don't expect too much  I'm not sure if it works for CFD at all. Regards, Takuya 

January 29, 2007, 05:58 
Hi all,
Here's a generalized

#16 
Super Moderator
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 12 
Hi all,
Here's a generalized convectiveOutlet b. c. code which can handle vectors. convectiveOutlet20070130.tar.gz For a quick start write the initial field file (0/U etc.) as the following example. If you want to tweak the behavior of the code see the included README. boundaryField { outlet { type convectiveOutlet; // convectiveVelocity: the boundarynormal component of convective velocity convectiveVelocity uniform 343.704; snGradScheme upwind; ddtScheme Euler; } } Please don't blame me if the code doesn't work at all  as I stated above I don't have an appropreate test case in handy. Propose me a fix (or preferably a patch) instead. Thanks. Takuya 

February 7, 2007, 02:00 
Hi again and again,
I added a

#17 
Super Moderator
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 12 
Hi again and again,
I added a new option to snGradScheme called "normal" after doing a little elementaryschool algebra which seems to be the most straightforward and reasonable discretization to me (why hasn't the idea come to me first...?). This time the default for snGradScheme is this scheme and the other options are meant for backward compatibility and for cases where the default doesn't work. For a quick start write the initial field file (0/U etc.) as the following example. boundaryField { outlet { type convectiveOutlet; // convectiveVelocity: the boundarynormal component of convective velocity convectiveVelocity uniform 343.704; ddtScheme Euler; } } convectiveOutlet20070207.tar.gz Takuya 

February 8, 2007, 10:44 
Hi Takuya,
I will be testin

#18 
Senior Member
Srinath Madhavan (a.k.a pUl)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 13 
Hi Takuya,
I will be testing you new version soon. Will it work with Crank Nicholson? 

February 9, 2007, 06:41 
Hi pUl,
OK this time I tried

#19 
Super Moderator
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 12 
Hi pUl,
OK this time I tried implementation of a ddtScheme which is supposed to be an equivalent discretization to Crank Nicholson. boundaryField { outlet { type convectiveOutlet; // convectiveVelocity: the boundarynormal component of convective velocity convectiveVelocity uniform 343.704; ddtScheme CrankNicholson; } } To be honest, however, it's quite difficult to assure it to work in CFD (although it is giving the best results in linear acoustics  thanks to your suggestion) because in my CFD test I experienced some odd oscillations. Anyway I'd be grateful if you have patience to test the code. convectiveOutlet20070209.tar.gz Takuya 

February 13, 2007, 03:49 
I'm also trying to write a new

#20 
Member
Luca Gasparini
Join Date: Mar 2009
Location: Italy
Posts: 37
Rep Power: 9 
I'm also trying to write a new characteristicbased boundary condition for my compressible solver centralFoam.
I've taken as an example the pressureTrasmissive and compiled the new bc in a new library and added the new library to the "options" file of the solver. However I can't make the solver finding it at run time: instead the "default" bc is called. In the solver there's no reference to any of the bc functions so I think the library doesn't get linked actually. What am I missing ? Furthermore, in order to let FoamX know about the new bc type is it necessary to edit e.g. the "patchField/cfd.cfg" file in .OpenFOAM/apps/FoamX/types or is there a way to specify it in the FoamX folder of the application (as done for the application configuration files) ? That is, can the defined bc types be applicationdependent or they must be defined at a global level ? Regards, Luca 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Convective boundary condition  andrea_barbera  OpenFOAM Running, Solving & CFD  4  March 4, 2010 05:36 
convective boundary condition  Mani  CFX  7  February 2, 2008 17:25 
Convective Boundary Condition  garni  FLUENT  0  September 25, 2005 13:00 
Convective boundary condition  STN  Main CFD Forum  5  May 29, 2002 08:47 
convective boundary condition  frederic felten  Main CFD Forum  1  April 25, 2001 01:20 