CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Sponge layer for outflow BC (

irc July 25, 2006 08:52

Given that the convective boun
Given that the convective boundary condition hasn't yet been coded up (thread, can anyone provide guidance on how to implement a "sponge layer" in for example the last ten rows of cells before a zero-gradient outflow boundary? In this layer I'd want to either drop the differencing scheme to UD and/or add in additional viscosity to smear out gradients before the outflow BC.

The application that I have in mind initially is incompressible flow past a 2D cylinder, where I want the vortex street to be whisked out of the domain without upsetting things upstream (I want a short domain).

eugene July 25, 2006 09:03

The easiest way to do this is
The easiest way to do this is to use the localBlended differencing scheme. To do this create a surfaceScalarField called UblendingFactor in your top level code and set the value to zero everywhere except in the region you want to use UD, where you set it to 1. Then for div(phi, U) use "localBlended linear upwind;"

(I might be wrong on the details above, but you get the general idea.)

irc July 25, 2006 09:09

Ingenious! I'll need to do so
Ingenious! I'll need to do some reading up to figure out how to createt the surfaceScalarField. Thanks.

hjasak July 25, 2006 09:33

Hi Ian, I have to admit tha
Hi Ian,

I have to admit that even in a good code like OpenFOAM, new boundary conditions do not appear when they are discussed at the User Forum. If you really need the convective boundary condition, you have 3 options:
- do it yourself (this is what I always do) :-)
- find someone to help you implement it. For a commercial user like your company, the obvious way is a support contract
- get someone to do it for you.

I would be quite happy to get involved if you are serious about this.


eugene July 25, 2006 10:12

Like this: surfaceScalarFie
Like this:

surfaceScalarField UblendingFactor
dimensionedScalar("UblendingFactor", dimless, 1.0)

irc July 25, 2006 14:22

Hrv - I appreciate that users
Hrv - I appreciate that users of an open source code should expect to roll their sleeves up and try/work things out for themselves, and then contribute their findings to the rest of the forum. It's my belief that that's the best way to learn. However, don't underestimate the difficulty that a new user of Openfoam has in getting to grips with the package - especially if they have a Fortran background (showing my age) and are new to C++. I appreciate the offer of training etc - my interest is only personal at the moment though since for my business we are still slaves to the commercial codes.

Eugene - thanks for the pointer; I'll give it a go.

hjasak July 25, 2006 14:34

No probs. As you can probably
No probs. As you can probably see from the forum, I ma here to help the people get up to speed and will offer substantial help where appropriate. Please don't let this stop you asking questions - people who do CFD and OpenFOAM on their own time and invest the effort out of their interest or through academic research have always proven to be very beneficial to the project.



irc August 6, 2006 09:44

Eugene - works just fine. Tha
Eugene - works just fine. Thanks for your suggestion. Had to write a small bit of code to set & visualise the surfaceScalarField blending factor, since the setFields utility doesn't work for surface fields. My coding is freely available for anyone who wishes it ...

eugene August 7, 2006 04:26

Great. How many layers of upwi
Great. How many layers of upwind to you need to prevent reflection?

irc August 11, 2006 04:14

We're running some cases now t
We're running some cases now to test it out. Incidentally, when setting up the surfaceScalarField, I looped over all the cell faces of the internal mesh:

forAll(mesh.Cf(), cellfi)
UBlendingFactor[cellfi] = ...

Are the cell faces on the boundary patches included in this loop, or are they held separately, meaning that I need to do another similar loop with e.g. mesh.boundary()?

4xF April 7, 2009 12:12

It seems that further development was done since then and as far as I can see in OpenFOAM v1.5 and 1.5.x, using the localBlended scheme, requires to perform the following:
  1. define a surfaceScalarField UBlendingFactor which sets the local blending factor for the variable U. From localBlended.C, it appears that one can define as well local blending factor for other field variable (such as k for instance, which would become kBleningFactor).
  2. use div(phi,U) localBlended linear upwind. Apparently, you can also use other higher order schemes than linear, but needs to be confirmed.
  3. a local value of 1.0 for UBlendingFactor means 100% linear, a local value of 0.0 means 100%UD.
Hope this helps.

ivan_cozza April 7, 2009 17:16

Hi Forum,
localBlended scheme is also available for OF 1.5 or only in the 1.5.x version?

4xF April 8, 2009 04:03


Originally Posted by ivan_cozza (Post 212255)
localBlended scheme is also available for OF 1.5 or only in the 1.5.x version?

The answer is both. Check out $WM_PROJECT_INST_DIR/OpenFOAM-1.5/src/finiteVolume/interpolation/surfaceInterpolation/schemes/localBlended

ivan_cozza April 8, 2009 04:18

Thanks Frank,
I will take a look soon on it!

All times are GMT -4. The time now is 01:30.