CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   non reflective boundary conditions for incompresible flow (http://www.cfd-online.com/Forums/openfoam-programming-development/77260-non-reflective-boundary-conditions-incompresible-flow.html)

Pascal_doran June 17, 2010 18:20

non reflective boundary conditions for incompresible flow
 
Hi all,

I'm simulating incompressible wake vortices in ground effect and I need non reflective boundary conditions to minimize the deformation of my wake vortices when they come close to the boundary. (right now I'm using zero normal gradient for U and P)

1 - Does OF 1.6.x has any existing boundary conditions that could do this?
I looked in : /OpenFoam-1.6.x/src/finiteVolume/fields/fvPatchFields but found nothing.

2 - If I need to implement new boundary conditions which one should I use as starting point? i.e. which boundary conditions is the most similar to non reflective boundary conditions (I did not try all of them, but some of them)

3 - What the boundary conditions should do is something like this :
dU/dt + Un*dU/dn = 0

where U is the velocity vector
t is the time
Un is the velocity normal to the boundary
n is the normal vector to the boundary

Any ideas?

Thank you,

Pascal

Pascal_doran June 21, 2010 21:06

Hi all,

Here's what I tried to implement user's define boundary conditions in OF 1.6.x. I started by creating the following folder:

mkdir -p $WM_PROJECT_USER_DIR/src/finiteVolume/fields/fvPatchFields/derived

Then I tried to compile my boundary condition as a new dynamic library. My first try was using the existing BC `zeroGradient` found in :

$FOAM_SRC/finiteVolume/fields/fvPatchFields/

(I copied it in my $WM_PROJECT_USER_DIR/src/finiteVolume/fields/fvPatchFields/derived) Then I created the 'make' folder containing:

the 'files' file:
Code:

zeroGradientFvPatchField.C
LIB = $(FOAM_USER_LIBBIN)/libmyBCs

and the 'option' file:
Code:

EXE_INC = \
    -I$(LIB_SRC)/finiteVolume/lnInclude

LIB_LIBS = \

I got the error message:
Code:

ag74290@mec036470:~/OpenFOAM/ag74290-1.6.x/src/finiteVolume/fields/fvPatchFields/derived/zeroGradient$ wmake libso
make: *** No rule to make target `options', needed by `linux64GccDPOpt/options'.  Stop.
/home/ag74290/OpenFOAM/OpenFOAM-1.6.x/wmake/MakefileFiles:40: linux64GccDPOpt/options: No such file or directory
make: *** No rule to make target `linux64GccDPOpt/options'.  Stop.
wmake error: file 'Make/linux64GccDPOpt/objectFiles' could not be created

Advices will be greatly appreciate. Thank you,

Pascal

steph79 August 11, 2010 07:56

Hi, I'm currently looking for a solution to a similar problem. I want a non-reflecting boundary condition for an incompressible flow field without any temperature specification.

Have you made any progress with your search?

Thanks.

Pascal_doran August 11, 2010 11:13

Hi steph79,

Look at advective BC in :
/home/ag74290/OpenFOAM/OpenFOAM-1.6.x/src/finiteVolume/fields/fvPatchFields/derived/advective

It solves D(psi)/Dt = 0 where psi could be U, p, etc. (and probably T)

regards,

Pascal

steph79 August 11, 2010 12:40

Thanks for your reply!

I seen one of your follow-up posts where you explicitly wrote out the code you specified your boundary conditions through, notably the following;

Code:

    outlet
    {
        type            advective;
        phi            phi;
    }

Did you make any further modifications to this? I should point out we're using different OpenFOAM versions as I'm on v1.7.

Pascal_doran August 11, 2010 13:10

Hi,
I didn't have good result using advective BC, so I change the definition of parameter f which is called valueFraction in the source code (and needed by mixed BC). With f=0.75 I have very good result! (I'm using backward time scheme with Co=1.0)

So I use a modified version of advection (which I called : myAdvection) for U and p and I used f=0.75.

Code:

outlet
    {
        type            myAdvective;
        phi            phi;
    }

Hope this help,

Pascal

steph79 August 12, 2010 07:02

Ok, I can see the valueFraction parameter several times in the advectiveFvPatchField.C source code but I lack the experience in coding and compiling to replicate your success. I might ask for some more help but can I ask first what physical argument is this 0.75 value (or any value fraction) based on or is it just of case that it gives what you want, if you know what I mean?

I too would be using backward time-stepping to minimise numerical dissipation. Fluctuations in the flow field are what I'm ultimately interested in, hence the need for a pressure outlet which doesn't simultaneously act like a wall!

steph79 August 12, 2010 08:34

Quote:

Originally Posted by Pascal_doran (Post 271177)
Hi,
I didn't have good result using advective BC, so I change the definition of parameter f which is called valueFraction in the source code (and needed by mixed BC). With f=0.75 I have very good result! (I'm using backward time scheme with Co=1.0)

So I use a modified version of advection (which I called : myAdvection) for U and p and I used f=0.75.

Code:

outlet
    {
        type            myAdvective;
        phi            phi;
    }

Hope this help,

Pascal

Can't you just do the following? ...

Code:


    outlet
    {
        type            advective;
        valueFraction        0.75;
        phi            phi;
    }

... in line with the fixedValue and fixedGradient specs?

Pascal_doran August 12, 2010 11:49

Hi Stephanie,
Quote:

I can see the valueFraction parameter several times in the advectiveFvPatchField.C source code but I lack the experience in coding and compiling to replicate your success. I might ask for some more help but can I ask first what physical argument is this 0.75 value (or any value fraction) based on or is it just of case that it gives what you want, if you know what I mean?
This post will explain it :
http://www.cfd-online.com/Forums/ope...tml#post185688

The valueFraction is define differently depending on the time scheme you use and if you use linf = 0 or linf > 0

Quote:

Can't you just do the following? ...
You could try but I would be surprise if it works. BTW, it is very useful to learn how to modify/create your own BC. To do so, copy the source code there:
/home/ag74290/OpenFOAM/ag74290-1.6.x/src/finiteVolume/fields/fvPatchFields/derived/myAdvective

modify the source code everywhere : advective become myAdvective

In your Make/files :
Code:

myAdvectiveFvPatchFields.C
 LIB = $(FOAM_USER_LIBBIN)/libmyAdvective

In your Make/option :
Code:

EXE_INC = \
    -I$(LIB_SRC)/finiteVolume/lnInclude

LIB_LIBS = \
    -lfiniteVolume

Compile it with:
Code:

wmake libso
if everything went good you should find : libmyAdvective.so in:
/home/ag74290/OpenFOAM/ag74290-1.6.x/lib/linux64GccDPOpt

Now to use your new BC add this line at the end in your controlDic:
libs ("libOpenFOAM.so" "libmyAdvective.so");

Regards,
Pascal

steph79 August 12, 2010 12:16

That's a great help again and a detailed answer, thanks!

I *think* (subject to change) that the advection boundary condition specified in u and p does the trick because I can't see the reflections anymore and the remaining 'wiggles' can be attributed to the use of higher order spatial and temporal schemes. Is it correct to say that the advection BC is the equivalent of a pressure outlet with a target mass/volume flow rate?

Just wondering, have you been using probes to capture fluctuating velocities in your flow field? I can resolve the u,v and w components of the velocity vector at points using probes but that's more information than required, I would rather just have the magnitude alone. The output files are messy enough to handle! I guess that's another question, what's the best tool to post-process output files from probes? I'm not familiar with gnuplot but I've heard it mentioned in that context before.

Thanks.

Pascal_doran August 12, 2010 15:45

Quote:

Is it correct to say that the advection BC is the equivalent of a pressure outlet with a target mass/volume flow rate?
I don't know if it's equivalent. Maybe somebody else could help you on that. But, let me know if you find an answer :)

Quote:

Just wondering, have you been using probes to capture fluctuating velocities in your flow field?
No, I created my own utilities for post-processing the result then I write it into file. I have great flexibility doing it that way, especially for writing only the data I need into a file. Then using Matlab become very easy. Take a look at :
/home/ag74290/OpenFOAM/OpenFOAM-1.6.x/applications/utilities/postProcessing
You could find a good starting point for creating your own utility.

Regards,

Pascal

callumso April 1, 2013 20:56

Hi Pascal,

When you used the (my)advective boundary condition, did you use it for both p and U?

I am struggling to establish a compressible flow from a plenum through an orifice into a long duct. All my simulations blew up after keeping fluctuating for a long time.

I set up the conventional total p and total T at the plenum and fixed p at the outlet of the duct. I am not comfortable with the zero gradient outlet boundary for U.

Do you think I should use the advective boundary just for U or for both U and p and set the 'value' to the pressure I want for p? Could you give me some advice on this? Thank you in advance. :o

rabea matouk August 4, 2014 07:22

Hello every body
 
I'm interested in the same subject '' implement non reflecting boundary condition for an incompressible finite element code''
so could you please help me how to start ? if you have references to the subject it would be appreciated.

Pascal_doran August 4, 2014 17:06

Hi!

You could first take a look here :

/OpenFOAM/OpenFOAM-2.1.0/src/finiteVolume/fields/fvPatchFields/derived/advective

The advective BC is probably what you are looking for! If not it would be a good starting point.

Regard,
Pascal

rabea matouk August 6, 2014 05:57

Hi Pascal_doran,

Thanks for your answer.

I'll try to understand and then implement the advective BC.

Thank you

rabea matouk August 7, 2014 05:55

convective BC
 
Hi Pascal_doran,

I'm new in implementing BCs so could you please give me some advice to start?

my code is in-house finite elements/spectral code written in Fortran.

I've already implemented a new format and a new SGS model but not yet treating Boundary Conditions.


If you have a reference for the convective BC that will be great.

Regards,
Rabea


All times are GMT -4. The time now is 06:07.