# slip or noslip U BC in openfoam?

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

 September 8, 2018, 18:46 slip or noslip U BC in openfoam? #1 Member     Federico Agustín Caccia Join Date: Jun 2015 Location: Buenos Aires, Argentina Posts: 55 Rep Power: 11 I'm modeling head loss in a pipe using openfoam. I'm using k-epsilon turbulence model. Since I don't want to model the viscous layer, I'm using wall law, for k and epsilon (so I use kqRWallFunction and epsilonWallFunction). Should I use slip or noSlip BC for U on walls? (I know from the theory we should apply a tangential stress to U instead of a fixed 0 value, but I don't know how it's implemented on OpenFoam).

 September 9, 2018, 14:01 #2 Senior Member   Michael Alletto Join Date: Jun 2018 Location: Bremen Posts: 615 Rep Power: 16 Hello Federico, in oder to apply wall functions in OF you have to set the velocity to uniform (0 0 0) at the walls. The wall function is applied through nut. so in the nut boundary condition you have to choose a wall function. For smooth wall nutkWallFunction is a good choice. see https://github.com/OpenFOAM/OpenFOAM...hScalarField.C fede32 likes this.

September 9, 2018, 17:04
#3
Member

Federico Agustín Caccia
Join Date: Jun 2015
Location: Buenos Aires, Argentina
Posts: 55
Rep Power: 11
Quote:
 Originally Posted by mAlletto Hello Federico, in oder to apply wall functions in OF you have to set the velocity to uniform (0 0 0) at the walls. The wall function is applied through nut. so in the nut boundary condition you have to choose a wall function. For smooth wall nutkWallFunction is a good choice. see https://github.com/OpenFOAM/OpenFOAM...hScalarField.C
Thanks for your repply! I'm using a k-epsilon model so I have BC for U, p, k, nut and epsilon:

In the walls:
k: kqRWallFunction
epsilon: epsilonWallFunction
nut: nutkWallFunction
U: ?

Why do you say that I should use noSlip BC for U? In that case, U is fixed to zero in the wall, but what I really want is to eliminate the viscous layer from my domain, and replace its influence with a law function. In the theory, what we do is to replace the Dirichlet condition for the velocity with a tangential stress (which comes from the wall law)

 September 9, 2018, 17:55 #4 Senior Member   Michael Alletto Join Date: Jun 2018 Location: Bremen Posts: 615 Rep Power: 16 you have an example in tutorials/incompressible/simpleFoam/pitzDaily. Actually since the Navier Stokes equations are second order in U you need two boundary condition for each component of the velocity. For the walls that means you need the velocity and the stresses at the wall. If you think on the discretization of the derivative of the stress tensor in the framework of a finite volume method you sum up the contributions of the stresses over the cell faces. At the wall you need to calculate the wall shear stress. If you do not have any wall function you multiply the velocity gradient with the viscosity to get the wall shear stress. If you have wall functions you multiply the turbulent viscosity nut with the velocity gradient. In order to get the correct wall shear stress in order to get the correct velocity at the cell centre close to the wall you need a wall function for nut. Hope this helps a bit. Michael fede32 and backscatter like this.

September 9, 2018, 18:28
#5
Member

Federico Agustín Caccia
Join Date: Jun 2015
Location: Buenos Aires, Argentina
Posts: 55
Rep Power: 11
Quote:
 Originally Posted by mAlletto you have an example in tutorials/incompressible/simpleFoam/pitzDaily. Actually since the Navier Stokes equations are second order in U you need two boundary condition for each component of the velocity. For the walls that means you need the velocity and the stresses at the wall. If you think on the discretization of the derivative of the stress tensor in the framework of a finite volume method you sum up the contributions of the stresses over the cell faces. At the wall you need to calculate the wall shear stress. If you do not have any wall function you multiply the velocity gradient with the viscosity to get the wall shear stress. If you have wall functions you multiply the turbulent viscosity nut with the velocity gradient. In order to get the correct wall shear stress in order to get the correct velocity at the cell centre close to the wall you need a wall function for nut. Hope this helps a bit. Michael
You are right Michael. I used to calculate with finite element method previously, and in that case you only need one BC for each U component because the formulation reduce one order of derivation.

Anyway, I'm calculating pressure drop in a pipe. Using the noSlip BC for U the results are better, but the pressure that I calculate is still much lower than the pressure drop that I have to validate. Do you have any suggestion? (I'm using simpleFoam because I'm not interested in transient patterns. I have also tried using kOmeggaSST instead of kepsilon turbulence model).

 September 10, 2018, 07:29 #6 Senior Member   Michael Alletto Join Date: Jun 2018 Location: Bremen Posts: 615 Rep Power: 16 If the pressure drop is too low that means that the wall shear stress is not calculated correctly (at least for a straight pipe with no secondary flows). So I presume that either your did not correctly choose the wall boundary conditions or maybe the resolution is too coarse. If you provide some figures this may help. fede32 likes this.

September 10, 2018, 13:53
#7
Member

Federico Agustín Caccia
Join Date: Jun 2015
Location: Buenos Aires, Argentina
Posts: 55
Rep Power: 11
Quote:
 Originally Posted by mAlletto If the pressure drop is too low that means that the wall shear stress is not calculated correctly (at least for a straight pipe with no secondary flows). So I presume that either your did not correctly choose the wall boundary conditions or maybe the resolution is too coarse. If you provide some figures this may help.

My geometry consists in a pipe with an inlet, an elbow, and then a T junction which divides into two branches. Each branch has several outlets.

My patchs are: inlet, outlet (all the outlets), and walls (the rest of the faces).

These are the BC I'm using:

U
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
Inlet
{
type fixedValue;
value uniform (9.18937 0 0);
}
Outlet
{
inletValue uniform (0 0 0);
value uniform (0 0 0);
}
Walls
{
type noSlip;
}
}

p
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
Inlet
{
}
Outlet
{
type totalPressure;
rho none;
p0 uniform 0;
value uniform 0;
// Optional entries
U U;
phi phi;
}
Walls
{
}
}

k
dimensions [0 2 -2 0 0 0 0];
internalField uniform 1.215;

boundaryField
{
Inlet
{
type turbulentIntensityKineticEnergyInlet;
intensity 0.05; // 5% turbulent intensity
value \$internalField;
}
Outlet
{
type inletOutlet;
inletValue \$internalField;
}
Walls
{
type kqRWallFunction;
value \$internalField;
}
}

epsilon
dimensions [0 2 -3 0 0 0 0];
internalField uniform 1.497;

boundaryField
{
Inlet
{
type turbulentMixingLengthDissipationRateInlet;
mixingLength 0.08; // -half channel height
value \$internalField;
}
Outlet
{
type inletOutlet;
inletValue \$internalField;
}
Walls
{
type epsilonWallFunction;
value \$internalField;
}
}

omega (when using KOmegaSST)

dimensions [0 0 -1 0 0 0 0];
internalField uniform 153.4;
boundaryField
{
Inlet
{
type fixedValue;
value uniform 153.4;
}
Outlet
{
type inletOutlet;
inletValue \$internalField;
}
Walls
{
type omegaWallFunction;
value \$internalField;
}
}

nut

dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
Inlet
{
type calculated;
value uniform 0;
}
Outlet
{
type calculated;
value uniform 0;
}
Walls
{
type nutkWallFunction;
value uniform 0;
}
}

 September 11, 2018, 03:48 #8 Senior Member   Michael Alletto Join Date: Jun 2018 Location: Bremen Posts: 615 Rep Power: 16 Ok I see. The boundary conditions applied seem ok. But without exact geometry and maybe a figure which describes the experiment and also the comparison between the experiment and the simulation it is difficult to find out what is going wrong. Generally applying wall functions in flows where you expect separation (in T-junction you get some for sure) is no good idea since they are known to not correctly reproduce recirculation regions). In your case if you have too low pressure drop I suppose the recirculation regions are not captured correctly (I hope you applied boundary conditions which match the one used in the experiment). But in general the problem you describe is a rather standard one and with a bit of google search I guess you would find someone which simulated a similar flow.

September 11, 2018, 08:40
#9
Member

Federico Agustín Caccia
Join Date: Jun 2015
Location: Buenos Aires, Argentina
Posts: 55
Rep Power: 11
Quote:
 Originally Posted by mAlletto Ok I see. The boundary conditions applied seem ok. But without exact geometry and maybe a figure which describes the experiment and also the comparison between the experiment and the simulation it is difficult to find out what is going wrong. Generally applying wall functions in flows where you expect separation (in T-junction you get some for sure) is no good idea since they are known to not correctly reproduce recirculation regions). In your case if you have too low pressure drop I suppose the recirculation regions are not captured correctly (I hope you applied boundary conditions which match the one used in the experiment). But in general the problem you describe is a rather standard one and with a bit of google search I guess you would find someone which simulated a similar flow.

I was searching a lot on google but I couldn't find too much help. Do you suggest me any particular site?

I attach you the geometry of the problem. The inlet is in the upper side, and the 20 outlets are in the branches below. The Reynolds is ~300K. (Air at 10m/s).

I made simulations using 300K tetrahedras, and I increased the resolution until 3 million, and the pressure loss hardly improved.

Instead of using wall law's, do you have another idea? I think I can't try to capture the viscous layer due to the high resolution requirements.

Thank you very much for all your help!

 September 11, 2018, 15:48 #10 Senior Member   Michael Alletto Join Date: Jun 2018 Location: Bremen Posts: 615 Rep Power: 16 maybe you should try to add some prims layers at the wall. maybe this helps. What is the pressure loss measured? fede32 likes this.

 September 11, 2018, 15:51 #11 Senior Member   Michael Alletto Join Date: Jun 2018 Location: Bremen Posts: 615 Rep Power: 16 In general for wall bounded flows it is important to have a fine resolution close to the wall in order to resolve the steep gradients happening at the wall correctly fede32 likes this.

September 11, 2018, 16:53
#12
Member

Federico Agustín Caccia
Join Date: Jun 2015
Location: Buenos Aires, Argentina
Posts: 55
Rep Power: 11
Quote:
 Originally Posted by mAlletto In general for wall bounded flows it is important to have a fine resolution close to the wall in order to resolve the steep gradients happening at the wall correctly

Perfect, I have analyzed a fine mesh but I would increase more the resolution in the walls. The pressure loss meassured in the experiment is more than twice the pressure I'm calculating (which is converged in the meshes I used).

 September 12, 2018, 04:12 #13 Senior Member   Gerhard Holzinger Join Date: Feb 2012 Location: Austria Posts: 341 Rep Power: 28 I recently had a similar issue: computing the pressure loss of a straight pipe using a 2D simulation. In my case it turned out, I was using kEpsilon with way too small y+ values at the wall, thus refining the mesh did deterioriate the results. I remedied the issue by using a mesh resolution that led to approriate y+ values, or using the kOmega turbulence model. The velocity profiles were rather independent of the mesh fineness, or the turbulence model. However, the pressure loss was very sensitive to mesh resolution and turbulence modelling. fede32 and Harish Selvam like this.

September 12, 2018, 09:29
#14
Member

Federico Agustín Caccia
Join Date: Jun 2015
Location: Buenos Aires, Argentina
Posts: 55
Rep Power: 11
Quote:
 Originally Posted by GerhardHolzinger I recently had a similar issue: computing the pressure loss of a straight pipe using a 2D simulation. In my case it turned out, I was using kEpsilon with way too small y+ values at the wall, thus refining the mesh did deterioriate the results. I remedied the issue by using a mesh resolution that led to approriate y+ values, or using the kOmega turbulence model. The velocity profiles were rather independent of the mesh fineness, or the turbulence model. However, the pressure loss was very sensitive to mesh resolution and turbulence modelling.

Great! Thanks for sharing your experience, I'm going to recompute the y+ and mesh accordly. I was using the kOmega turbulence model with a little improve.

September 12, 2018, 14:41
#15
Senior Member

Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 16
Quote:
 Originally Posted by GerhardHolzinger I recently had a similar issue: computing the pressure loss of a straight pipe using a 2D simulation. In my case it turned out, I was using kEpsilon with way too small y+ values at the wall, thus refining the mesh did deterioriate the results. I remedied the issue by using a mesh resolution that led to approriate y+ values, or using the kOmega turbulence model. The velocity profiles were rather independent of the mesh fineness, or the turbulence model. However, the pressure loss was very sensitive to mesh resolution and turbulence modelling.

That's interesting. I always thought that if y+ is in the range of approximately 40 to 300 (the range of the log layer in a wall bounded flow) the wall shear stress computed is roughly independent of the cell size close to the wall if wall functions are applied.

If the y+ values are close to 1 or less and no wall functions are applied (in the viscous sub layer) also in this case the wall shear stress should be correctly computed.

If y+ values are between 5 and 40 (buffer layer) the standard wall functions are not appropriate.

October 3, 2018, 07:45
#16
Senior Member

Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 16
Quote:
 Originally Posted by fede32 I was searching a lot on google but I couldn't find too much help. Do you suggest me any particular site? I attach you the geometry of the problem. The inlet is in the upper side, and the 20 outlets are in the branches below. The Reynolds is ~300K. (Air at 10m/s). https://drive.google.com/open?id=16-...CMJU4-spI6pKzb I made simulations using 300K tetrahedras, and I increased the resolution until 3 million, and the pressure loss hardly improved. Instead of using wall law's, do you have another idea? I think I can't try to capture the viscous layer due to the high resolution requirements. Thank you very much for all your help!

did you achieve the get the correct pressure drop?

October 3, 2018, 08:16
#17
Member

Federico Agustín Caccia
Join Date: Jun 2015
Location: Buenos Aires, Argentina
Posts: 55
Rep Power: 11
Quote:
 Originally Posted by mAlletto did you achieve the get the correct pressure drop?

I'm working on this. Now I made a mesh with hexaedras and I refined the mesh in the boundary layer, trying to obtain y+<50 in all my geometry.
Using yplus openfoam tool, the postprocessing says me that the av y+ is 34 and the max is 450, using kwSST.
I get better values in pressure drop, but I'm not having a stable solution to the problem. Solving with SIMPLE, results have a +/- 40% variation and never converges.
I'm going to analyze better the under-relaxation. Thanks

 October 4, 2018, 03:40 #18 Senior Member   Michael Alletto Join Date: Jun 2018 Location: Bremen Posts: 615 Rep Power: 16 For your geometry it is not suppressing you don't get a steady solution because of the number of sharp corners you have. I think it is quite ok if you averaged you pressure drop. fede32 likes this.

October 4, 2018, 14:06
#19
Member

Federico Agustín Caccia
Join Date: Jun 2015
Location: Buenos Aires, Argentina
Posts: 55
Rep Power: 11
Quote:
 Originally Posted by mAlletto For your geometry it is not suppressing you don't get a steady solution because of the number of sharp corners you have. I think it is quite ok if you averaged you pressure drop.

Thanks for your idea. Is there a justification for why the average should be the right one, and not the value of one of the extremes for example?

 October 5, 2018, 03:52 #20 Senior Member   Michael Alletto Join Date: Jun 2018 Location: Bremen Posts: 615 Rep Power: 16 It reflects what you are doing in reality. In reality you don't have either a steady flow and you have to average over a longer time to obtain meaningful values fede32 likes this.

 Tags head loss, kepsilon, pipe, slip, wall law