# Bernolli's Boundary Condition

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

 July 6, 2020, 12:08 Bernolli's Boundary Condition #1 Senior Member   Guilherme Join Date: Apr 2017 Posts: 197 Rep Power: 8 Hello, I was reading a work of natural convection and the author performed a LES simulation using the OF and in one of the boundary conditions he comments that he used the ''Bernolli's boundary condition" and explaining that it occurs in the form of p = -0.5v². Could someone teach me how this can be set in OpenFOAM? OF5.0 solver: buoyantSimpleFoam Thanks

 July 7, 2020, 05:29 #2 Senior Member   Carlos Rubio Abujas Join Date: Jan 2018 Location: Spain Posts: 127 Rep Power: 8 It seems like a custom boundary condition. If you only need it once you can try with a codedFixedValue boundary. The following code should do the work. Code:  inlet { type codedFixedValue; value uniform 0; name BernoilliBC; code #{ const volVectorField& U = db().lookupObject("U"); const vectorField& U_p = U.boundaryField()[patch().index()]; // Set the equation on each face of the patch scalarField& field = *this; field = -0.5*magSqr(U_p)(); #}; } The code is pretty straight. It recovers the U field from the objectRegistry (a kind of library of the field employed) and then get the velocity field on the current patch. Then it just apply on each of the faces of the cell the formula you mentioned. magSqr will return the value of |U|². If you need to do more extensibe usage of this boundary condition you may want to create a custom BC with this code. I hope it this helps!

 July 8, 2020, 07:59 #3 Senior Member   Guilherme Join Date: Apr 2017 Posts: 197 Rep Power: 8 Thank you very much, I will test today. I believe that the idea of the work that I referred to is a mathematical/physical approach and not real... even because an inviscid flow is a hypothesis.

 July 10, 2020, 13:24 #4 Senior Member   Guilherme Join Date: Apr 2017 Posts: 197 Rep Power: 8 Hi, I have another question, ''The thermal boundary condition for the vertical wall is: −kf ∂T/∂n = hf (T − Tf )." Based on the information above, I could write BC similar to the way you taught me?

 July 10, 2020, 15:20 #5 Senior Member   Carlos Rubio Abujas Join Date: Jan 2018 Location: Spain Posts: 127 Rep Power: 8 I think this is a much more standard condition, so you don't need to code it yourself. Try with externalWallHeatFluxTemperature. Here I've attached an example for a 600k wall and h equals to 10 W/m2K. Code: wall1 { type externalWallHeatFluxTemperature; mode coefficient; // Other methods are: power and flux Ta constant 600; // Ambient temperature h uniform 10.0; // Value of the hfilm coefficient value uniform 300; // Default value kappaMethod fluidThermo; } gu1 likes this.

August 27, 2020, 10:38
#6
Senior Member

Guilherme
Join Date: Apr 2017
Posts: 197
Rep Power: 8
Quote:
 Originally Posted by crubio.abujas It seems like a custom boundary condition.
Hi Carlos,

I apologize for opening the topic again but you show to have a great facility with code implementation and I need a boundary condition for epsilon. According to the study I read, the BC is simple:

epsilon = nu1 * k1 / yn

where 'k1' and 'nu1' are the values of the turbulent kinetic energy and kinematic viscocity calculated at the first node of the mesh near the wall and 'yn' is the distance of the first node in relation to the wall.

I believe that when I set the Dirichlet BC (fixedValue) to 'k' on the wall, k1 is equal to that value (but I'm not sure I can say that). nu1 I leave the boundary condition of 'calculated'.

I tried to implement BC, but it didn't work... if you can help me.

Best.

 August 27, 2020, 13:47 #7 Senior Member   Carlos Rubio Abujas Join Date: Jan 2018 Location: Spain Posts: 127 Rep Power: 8 Hi again! What you're dealing with looks like a wall function. I am aware that OF have already implemented some functionalities to deal with this. You may want to check epsilonWallFunction boundary condition. In this boundary conditon two possible values of espilon are possible, depending on where the value of y+ is in the laminar region, or on the logarithmic one: One thing that shocks me in the expression you proposed is that the units associated to them don't seem to be consistent. If the units are: |epsilon| = m2/s3 |k| = m2/s2 |nu| = m2/s |y_n| = m On your expression you got that |epsilon| = m3/s3 which does not correspond with the original dimension of the field. Are you sure that the equation is correct? If you still want to apply it you may adapt the code under Foam::epsilonWallFunctionFvPatchScalarField::calcu late to your needs.

August 27, 2020, 14:14
#8
Senior Member

Guilherme
Join Date: Apr 2017
Posts: 197
Rep Power: 8
Quote:
 Originally Posted by crubio.abujas Hi again! What you're dealing with looks like a wall function. I am aware that OF have already implemented some functionalities to deal with this. You may want to check epsilonWallFunction boundary condition. In this boundary conditon two possible values of espilon are possible, depending on where the value of y+ is in the laminar region, or on the logarithmic one: One thing that shocks me in the expression you proposed is that the units associated to them don't seem to be consistent. If the units are: |epsilon| = m2/s3 |k| = m2/s2 |nu| = m2/s |y_n| = m On your expression you got that |epsilon| = m3/s3 which does not correspond with the original dimension of the field. Are you sure that the equation is correct? If you still want to apply it you may adapt the code under Foam::epsilonWallFunctionFvPatchScalarField::calcu late to your needs.
Sorry,

The correct equation is this:

But I didn't understand how I could adapt it (Foam::epsilonWallFunctionFvPatchScalarField::calcu), do you talk about creating a new wall function? If you can teach me.

 Tags boundaries condition, buoyantsimplefoam, openfoam 5.0