CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Sudden contration

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 1, 2018, 09:48
Default Sudden contration
  #1
Member
 
Anders Dyhr Nørløv
Join Date: Aug 2018
Posts: 32
Rep Power: 8
MrAndersDk is on a distinguished road
Hello

I'm trying to learn to use OpenFOAM. For that purpose I tried to simulate a sudden contration of a circular pipe. I go from 80 mm to 40 mm see image below (clipped trough the half), where the inlet is the 80 mm.

geometry.PNG

When i run it runs fine, but when i check the results in paraview I get a pressure drop of 50. Converting it to bar using the density of water of 998, I get a pressure drop of 0.5 bar. When I try to calculate the pressure drop in a manual way (fx. using http://www.pressure-drop.mobi/0303.html) i get a pressure drop of 0.13 bar.

Changing the inlet velocity I always get roughly a factor of 4 between the two methods. I suspect that I'm doing something completely wrong in my simulation, but I don't know what it is.

I know one of the difficult things with CFD is to choose sensible parameters, so maybe that is where i'm going wrong. Any help is much appreciated.

Iøve created teh mesh with salome and used ideasUnvToFoam to create the mesh in OpenFOAM, you can see my mesh here (I know it is a bit coarse, but I thought it would still give a sensible result):

mesh.PNG

I've tried to setup the simpleFoam solver with the following parameters:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1806                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (0 0 0);

boundaryField
{
    channel_closed_solid_inlet
    {
        type            fixedValue;
        value           uniform (0 2 0);
    }

    channel_closed_solid_outlet
    {
        type            zeroGradient;
    }

    channel_closed_solid_walls
    {
        type            fixedValue;
		value			uniform (0 0 0);
    }
}

// ************************************************************************* //
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1806                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    channel_closed_solid_inlet
    {
        type            zeroGradient;
    }

    channel_closed_solid_outlet
    {
        type            fixedValue;
        value           uniform 0;
    }

    channel_closed_solid_walls
    {
        type            zeroGradient;
    }
}

// ************************************************************************* //
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1806                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    location    "0";
    object      k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 0.024576;

boundaryField
{
    channel_closed_solid_inlet
    {
        type            fixedValue;
        value           uniform 0.024576;
    }
    channel_closed_solid_outlet
    {
        type            zeroGradient;
    }
    channel_closed_solid_walls
    {
        type            kqRWallFunction;
        value           uniform 0.024576;
    }
}


// ************************************************************************* //
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1806                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    location    "0";
    object      epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 2 -3 0 0 0 0];

internalField   uniform 0.113;

boundaryField
{
    channel_closed_solid_inlet
    {
        type            fixedValue;
        value           uniform 0.113;
    }
    channel_closed_solid_outlet
    {
        type            zeroGradient;
    }
    channel_closed_solid_walls
    {
        type            epsilonWallFunction;
        value           uniform 0.113;
    }
}


// ************************************************************************* //
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1806                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    location    "0";
    object      nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 2 -1 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    channel_closed_solid_inlet
    {
        type            calculated;
        value           uniform 0;
    }
    channel_closed_solid_outlet
    {
        type            calculated;
        value           uniform 0;
    }
    channel_closed_solid_walls
    {
        type            nutkWallFunction;
        value           uniform 0;
    }
}


// ************************************************************************* //
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1806                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

simulationType RAS;

RAS
{
    // Tested with kEpsilon, realizableKE, kOmega, kOmegaSST, v2f,
    // ShihQuadraticKE, LienCubicKE.
    RASModel        kEpsilon;

    turbulence      on;

    printCoeffs     on;
}


// ************************************************************************* //
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1806                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

transportModel  Newtonian;

nu              nu [0 2 -1 0 0 0 0] 1e-6;

CrossPowerLawCoeffs
{
	nu0		nu0 [0 2 -1 0 0 0 0] 1e-6;
	nuInf	nuInf [0 2 -1 0 0 0 0 ] 1e-6;
	m		m [0 0 1 0 0 0 0] 1;
	n		n [0 0 0 0 0 0 0] 1;
}

BirdCarreuCoeffs
{
	nu0		nu0 [0 2 -1 0 0 0 0] 1e-6;
	nuInf	nuInf [0 2 -1 0 0 0 0 ] 1e-6;
	k		k [0 0 1 0 0 0 0] 0;
	n		n [0 0 0 0 0 0 0] 1;
}

// ************************************************************************* //
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1806                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     simpleFoam;

startFrom       latestTime;

startTime       0;

stopAt          endTime;

endTime         2000;

deltaT          1;

writeControl    timeStep;

writeInterval   100;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


// ************************************************************************* //
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1806                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

ddtSchemes
{
    default         steadyState;
}

gradSchemes
{
    default         Gauss linear;
}

divSchemes
{
    default         	none;
    div(phi,U)      	Gauss upwind;
    div(phi,k)      	Gauss upwind;
    div(phi,epsilon) 	Gauss upwind;
    div(phi,R)     		Gauss upwind;
    div(R)				Gauss linear;
	div(phi,nuTilda)	Gauss upwind;
	div((nuEff*dev2(T(grad(U)))))	Gauss linear;
}

laplacianSchemes
{
    default         Gauss linear corrected;
}

interpolationSchemes
{
    default         linear;
}

snGradSchemes
{
    default         corrected;
}

wallDist
{
    method meshWave;
}


// ************************************************************************* //
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1806                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
    p
    {
        solver          GAMG;
        tolerance       1e-06;
        relTol          1e-06;
        smoother        GaussSeidel;
		nPreSweeps		0;
		nPostSweeps		2;
		cacheAgglomeration on;
		nCellsInCoarsestLevel 10;
		mergeLevelse	1;
    }

    "(U|k|epsilon|R|nuTilda)"
    {
        solver          smoothSolver;
        smoother        symGaussSeidel;
        tolerance       1e-06;
        relTol          1e-06;
    }
}

SIMPLE
{
    nNonOrthogonalCorrectors 0;
}

relaxationFactors
{
    fields
	{
		p	0.3;
	}
		
	equations
	{
		U 		0.3;
		k 		0.3;
		epsilon 0.3;
		R 		0.3;
		nuTilda 0.3;
	}
}


// ************************************************************************* //
MrAndersDk is offline   Reply With Quote

Old   October 2, 2018, 05:03
Default
  #2
Senior Member
 
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28
GerhardHolzinger will become famous soon enoughGerhardHolzinger will become famous soon enough
Check whether your y+ values at the walls are in the appropriate range. Being off can cause a faulty prediction of the pressure loss. Alternatively, you could try running the case using the kOmega model.

Furthermore, the mesh is not all that beautiful.
Tobi likes this.
GerhardHolzinger is offline   Reply With Quote

Old   October 2, 2018, 05:23
Default
  #3
Member
 
Anders Dyhr Nørløv
Join Date: Aug 2018
Posts: 32
Rep Power: 8
MrAndersDk is on a distinguished road
Thanks for the suggestions. I checked the yPlus values (didn't know about them, thanks for that), and they are way to high. Also I agree that the mesh is not good.

I use salome to mesh, and I'm also new using that. I tried to make the mesh better. What do you think about this new mesh? Looks better?

mesh_fine.jpg
MrAndersDk is offline   Reply With Quote

Old   October 2, 2018, 07:20
Default
  #4
Senior Member
 
piu58's Avatar
 
Uwe Pilz
Join Date: Feb 2017
Location: Leipzig, Germany
Posts: 744
Rep Power: 15
piu58 is on a distinguished road
If a model allows manual meshing you should go that way. In you case it is straightforward.

If you look closely at the meshes the have strange regions both.

But I don't believe that your problem depends on that.

~

Which Re number did you use? May be there is a problem with the turbulence calculation. Pressure drops differ widely between laminar and turbulent flow.
__________________
Uwe Pilz
--
Die der Hauptbewegung überlagerte Schwankungsbewegung ist in ihren Einzelheiten so hoffnungslos kompliziert, daß ihre theoretische Berechnung aussichtslos erscheint. (Hermann Schlichting, 1950)
piu58 is offline   Reply With Quote

Old   October 2, 2018, 07:27
Default
  #5
Member
 
Anders Dyhr Nørløv
Join Date: Aug 2018
Posts: 32
Rep Power: 8
MrAndersDk is on a distinguished road
The Reynolds number is very high. I think in the region of 200000 - 300000. You don't mean that it should be set somewhere in OpenFOAM do you? Or do you mean when I calculated the k and epsilon values?

Not sure what you mean by manual mesh? How do I do that?
MrAndersDk is offline   Reply With Quote

Old   October 2, 2018, 08:11
Default
  #6
Member
 
Anders Dyhr Nørløv
Join Date: Aug 2018
Posts: 32
Rep Power: 8
MrAndersDk is on a distinguished road
Should I actually calculate different k and epsilon for the pipe walls with the large diameter and the small diameter?
MrAndersDk is offline   Reply With Quote

Old   October 2, 2018, 13:09
Default
  #7
Senior Member
 
piu58's Avatar
 
Uwe Pilz
Join Date: Feb 2017
Location: Leipzig, Germany
Posts: 744
Rep Power: 15
piu58 is on a distinguished road
> Reynolds number is very high...200000 - 300000

I recommend starting with lower Re numbers and looking what happens.

> what you mean by manual mesh? How do I do that?

blockMesh.
__________________
Uwe Pilz
--
Die der Hauptbewegung überlagerte Schwankungsbewegung ist in ihren Einzelheiten so hoffnungslos kompliziert, daß ihre theoretische Berechnung aussichtslos erscheint. (Hermann Schlichting, 1950)
piu58 is offline   Reply With Quote

Old   October 3, 2018, 04:13
Default
  #8
Member
 
Anders Dyhr Nørløv
Join Date: Aug 2018
Posts: 32
Rep Power: 8
MrAndersDk is on a distinguished road
The reason I used Salome to do the mesh, was because I'm investigation how a OpenFOAM workflow can be implemented at our company, and in general the geometries will be very complex.

I tried going down to a speed of 0.1 m/s, and a Re below 20000.

I still get a factor of 4 between the manual calculation and OpenFOAM.

I think my convergence and yPlus is OK?

Code:
smoothSolver:  Solving for Ux, Initial residual = 1.22094e-07, Final residual = 1.22094e-07, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 1.6853e-08, Final residual = 1.6853e-08, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 1.25779e-07, Final residual = 1.25779e-07, No Iterations 0
GAMG:  Solving for p, Initial residual = 8.73275e-07, Final residual = 8.73275e-07, No Iterations 0
GAMG:  Solving for p, Initial residual = 8.73275e-07, Final residual = 8.73275e-07, No Iterations 0
time step continuity errors : sum local = 2.53288e-06, global = 5.52101e-08, cumulative = -6.2634e-06
smoothSolver:  Solving for epsilon, Initial residual = 7.9535e-07, Final residual = 7.9535e-07, No Iterations 0
smoothSolver:  Solving for k, Initial residual = 9.04923e-07, Final residual = 9.04923e-07, No Iterations 0
ExecutionTime = 264.54 s  ClockTime = 265 s
Code:
patch channel_closed_solid_walls_large y+ : min = 0.482836, max = 14.916, average = 4.53306
    patch channel_closed_solid_walls_small y+ : min = 6.79218, max = 48.9457, average = 23.8934
MrAndersDk is offline   Reply With Quote

Old   October 3, 2018, 06:38
Default
  #9
Senior Member
 
piu58's Avatar
 
Uwe Pilz
Join Date: Feb 2017
Location: Leipzig, Germany
Posts: 744
Rep Power: 15
piu58 is on a distinguished road
> ecause I'm investigation how a OpenFOAM workflow can be implemented at our company

I don't think that it works that way. OF (and other cfd software) is not some kind of advanced pocket computer. You need experience how to work with it. This includes a strategy to ensure the correctness of your results.
__________________
Uwe Pilz
--
Die der Hauptbewegung überlagerte Schwankungsbewegung ist in ihren Einzelheiten so hoffnungslos kompliziert, daß ihre theoretische Berechnung aussichtslos erscheint. (Hermann Schlichting, 1950)
piu58 is offline   Reply With Quote

Old   October 3, 2018, 07:01
Default
  #10
Member
 
Anders Dyhr Nørløv
Join Date: Aug 2018
Posts: 32
Rep Power: 8
MrAndersDk is on a distinguished road
Yeah, I agree. This is a preliminary study to see how one can work with OpenFOAM. I think it is possible to study the workflow. That is how will we take a given component from design, to mesh, to solving, and if this is a viable way of working (or we need to invest in expensive commercial programs). I think my conclusion is that it is definetely possible to use OpenFOAM, and I like the fact that it is open source and c++, because as a physicists and c++ programmer, I see the possibility to program special cases important for our company in the future.

If we see that that is possible, and we find that it is worth investing money and time in it, we will start getting help from the outside, in form of courses and support, to gain more experience in these kind of simulations. I'm fully aware that it is not hard to get OpenFOAM up and running, but it is very difficult to make correct assumptions and interpretations of the results. Something we have to invest a lot of time in to be able to do.

My question here was more if someone could see why I didn't get my results to match, my simple calculations made by empiric formulas (formulas we have seen match experiments very well). If it is not possible to do so, and we need more training and experience to do it correctly, we will take that into considerations. Justed hoped that someone maybe had experience with simulating a contraction, and knew how to simulate it, or knew if precise results could be expected.

It could be that with CFD you can not expect to get results more precise than within a factor of 5, and that my simulation was succesfull (hope not ). If that is the case that is also fine, but then we need to take that into considerations.
MrAndersDk is offline   Reply With Quote

Old   October 3, 2018, 08:41
Default
  #11
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
Hello,


did you try the have prism layers close to the wall? Usually tetrahedra are too diffusive to accurately solve the wall shear stress close to the wall. Besides this they introduce an additional diffusion due to the fact that the flow is not normal to the cell face.


So I strongly advise to use a high quality mesh close to the wall to accurately resolve the transport phenomena which are leading to the two recirculation regions in front upwind and downwind of the contraction.


In addition it is best practice (if the computational costs allows it) to have a y+ ~ 1 at the wall in order to avoid the usage of wall function which are known to not correctly reproduce separated flows.


Best



Michael
mAlletto is offline   Reply With Quote

Old   October 3, 2018, 09:35
Default
  #12
Member
 
Anders Dyhr Nørløv
Join Date: Aug 2018
Posts: 32
Rep Power: 8
MrAndersDk is on a distinguished road
Hello

If I don't use wallfunctions what should i use for type in the k and epsilon files?
MrAndersDk is offline   Reply With Quote

Old   October 3, 2018, 09:56
Default
  #13
Senior Member
 
piu58's Avatar
 
Uwe Pilz
Join Date: Feb 2017
Location: Leipzig, Germany
Posts: 744
Rep Power: 15
piu58 is on a distinguished road
> It could be that with CFD you can not expect to get results more precise than within a factor of 5

You may expect much better results.

Start with a simple geometry, a simple physics (low to medium Re) and an straightforward mesh. Look what happens and change one variable after the other.

You try
- without experience
- using a mesh of doubtful quality
- consisting of tetraeder elements (instead of heaxaeder)
- to calculate an example withe high Reynolds number.

Too much complications for the start.
__________________
Uwe Pilz
--
Die der Hauptbewegung überlagerte Schwankungsbewegung ist in ihren Einzelheiten so hoffnungslos kompliziert, daß ihre theoretische Berechnung aussichtslos erscheint. (Hermann Schlichting, 1950)
piu58 is offline   Reply With Quote

Old   October 3, 2018, 17:12
Default
  #14
Member
 
Geir Karlsen
Join Date: Nov 2013
Location: Norway
Posts: 59
Rep Power: 14
gkarlsen is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
Hello,


did you try the have prism layers close to the wall? Usually tetrahedra are too diffusive to accurately solve the wall shear stress close to the wall. Besides this they introduce an additional diffusion due to the fact that the flow is not normal to the cell face.


So I strongly advise to use a high quality mesh close to the wall to accurately resolve the transport phenomena which are leading to the two recirculation regions in front upwind and downwind of the contraction.


In addition it is best practice (if the computational costs allows it) to have a y+ ~ 1 at the wall in order to avoid the usage of wall function which are known to not correctly reproduce separated flows.


Best



Michael
What he said... And to reach that goal while still starting from Salome. I would recommend that you take a look at the most excellent youtube series content posted by Tobi (https://www.youtube.com/user/HolzmannCFD/videos). The manifold videos by Tobi basically outlines the workflow that you are looking into. In short it will teach you how to triangulate your geometry and then make a nice hex-mesh by using SnappyHexMesh (cfMesh could also be used of course)
Tobi likes this.
gkarlsen is offline   Reply With Quote

Old   October 4, 2018, 03:02
Default
  #15
Member
 
Anders Dyhr Nørløv
Join Date: Aug 2018
Posts: 32
Rep Power: 8
MrAndersDk is on a distinguished road
Thanks for the great link. I was actually looking into using hex mesh. I guess the work flow will then be to prepare stl files in salome, and then use snappyHexMesh to create the mesh.
MrAndersDk is offline   Reply With Quote

Old   October 4, 2018, 03:12
Default
  #16
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi Karlsen,
thank you very much for mentioning my screencast in that way. I feel honored. An additional information to the screencasts:
Quote:
The training videos offer a broad and intensive insight into the OpenFOAM® framework. The videos will guide you through all different kinds of OpenFOAM® related topics such as »Design preparation«, »Surface Triangulation«, »Meshing with snappyHexMesh«, »Setting up the Numerical Case for OpenFOAM®«, »Boundary Conditions« as well as »Advanced Boundary Conditions«. During the videos, plenty of tricks and hacks are given which one allows understanding the toolbox better while user mistakes can be significantly reduced. Learning to use the command line will improve your Linux level, increase your speed drastically and allow you to use the powerful scripting languages bash / csh / python in combination with OpenFOAM® such as combining OpenFOAM® and DAKOTA®.

More than 4.000 people all over the world evaluated the screencast already. Based on this lecture, these people could run their projects in OpenFOAM® and increased their skills drastically.

The screencast was recorded for OpenFOAM-4.x. Based on ongoing developments, code maintenance, sustainability and performance improvements, classes and functions can be named differently in newer releases. If you have any problems related to the videos and the newer releases, do not hesitate to write Holzmann CFD your inquiry (advancedMaterial@Holzmann-cfd.de).
Addition hints to the problem you are solving:
  • The boundary layer has to establish first, using a fixedValue will not give you a boundary layer. Thus, this layer has to be established first (I am not sure if this will influence the results drastically). However, it is worth to know that your inlet boundary condition can influence the phenomenon you are interested in; a rule of thumb is, e.g., for the pipe diameter of 100 mm, the pipe inlet - before the contraction - should be at least 300 mm away.
  • Related to the hint mentioned above, a parabolic inlet profile would be recommended.
  • Change the inlet values for k and epsilon to turbulentKinetic... and mixingLength....
  • The outlet should have a characteristic length to avoid influence to the internal field. E.g., if the outlet is 10 mm behind the contraction, it will influence the whole behavior of the system based on the fact, that the outlet pipe (in reality) will not stop here.
  • During my master study, we made such tests too. However, after the contraction, we had the expansion immediately and recorded the pressure drop before and behind the contraction. The comparison to the analytical solution was 99.99%. Therefore, I expect that there is something wrong in your set-up.
  • For Tetraeder meshes, the numerical schemes could be changed.
  • Furthermore, you should be aware of your first order scheme.
  • Summing up, there are still plenty of things you can consider improving your simulation. However, a discrepancy of 2.5 bar is a bit too high.
  • What comes into my mind, please be aware of the pressure you set. It is not the real pressure. The differences \Delta p are fine but absolute values are different.

Good luck & as Karlsen mentioned, hex-dominant meshes are much better in a numerical sense. E.g., second order linear scheme and tet meshes for pure convection: https://www.youtube.com/watch?v=C0CcN7l37Fg
Additionally, as Gerhard said, the turbulence model can influence your solution (I am not a turbulence guy; therefore I cannot give you any feedback).


A few hints for open source software in general (if one is interested - valid for everybody) - the above content is not related to the topic
================================================== =======================================
Furthermore, I want to make one statement to OpenFOAM and Open Source software that many people do not or don´t want to recognize.
I published my material for more than five years for free till mid of 2018. Therefore I know the following circumstances:
  • Based on the continuous increase of my content, I was not able to spend more and more of my private time keeping the material up to date.
  • Sure, the community was always happy about my work and especially the screencasts and my book were successful, which was an honor to me.
  • However, the time I spend (several thousand hours) for preparing, re-organizing and re-building the material was not in relation to what I got back.
  • Summing up, I got 19 voluntary donations; most of them were between 5€ to 10€ - that is totally fine and very welcomed. But 19 people who give value to my free material compared to the statistics - the book was downloaded more than 20.000 times; screencasts were watched more than 6.000 times; tutorials were downloaded (summing all 40 single cases) more than 50.000 times - it is the infinite element, no one can see.
  • Moreover, considering my fix costs for server stuff and so one ... ... ... - yep, I provided material for free and I pay for that

In other words, doing a CFD analysis with 19 cells will not make sense at all. However, if you have 76.000 cells, you can do pretty cool things, don´t you? Okay, some people think they need 600.000.000 cells for their problems

It sounds a bit of advertising to donate to OpenFOAM, to my work or other open source software but it is not. I want to make you sensitive, that it is not naturally that open source software is free forever.

My wish for the future would be: If people are using open source software, they should give something back regarding:
  • own developments
  • bug reports
  • contributing to that software
  • or donating an amount of money you think is worth

An excellent example that people thought a natural free material is forever free is my material - it´s closed now (most of the stuff); You don´t believe how many emails I got, questioning when it is available again

================================================== =======================================

Enough of my talk. I hope that the hints at the beginning help to resolve the problem. Another option is that you post your case that we can check out the stuff in more detail. Additionally, the equation and reference to the equation would be beautiful to have; I expect that you use simple Bernoulli equation?

Further information for OpenFOAM
  • wiki.openfoam.com
  • openfoamwiki.net
  • József Nagy YouTube Channel
  • The blog of our Chine colleague
  • Chalmers CFD courses
  • OpenFOAM Workshop material
  • PFAU Meetings
There are many more, but these sources exist for a long time and
new things are added from time to time.
__________________
Keep foaming,
Tobias Holzmann

Last edited by Tobi; October 4, 2018 at 06:38.
Tobi is offline   Reply With Quote

Old   October 4, 2018, 03:32
Default
  #17
Member
 
Anders Dyhr Nørløv
Join Date: Aug 2018
Posts: 32
Rep Power: 8
MrAndersDk is on a distinguished road
Thank you so much for taking your time to help me with such a detailed answer.

Just a couple of questions:

The boundary layer has to establish first, using a fixedValue will not give you a boundary layer. Thus, this layer has to be established first (I am not sure if this will influence the results drastically). However, it is worth to know that your inlet boundary condition can influence the phenomenon you are interested in; a rule of thumb is, e.g., for the pipe diameter of 100 mm, the pipe inlet - before the contraction - should be at least 300 mm away.
Related to the hint mentioned above, a parabolic inlet profile would be recommended.


I will try to extend the length of the pipe before and after the contraction to give time to make the flow develop. Not sure about the fixedValue thing, should I change the boundary condition, or will the extended pipe length with the fixedValue boundary condition, develop a boundary layer?

Change the inlet values for k and epsilon to turbulentKinetic... and mixingLength....

I will try this.

During my master study, we made such tests too. However, after the contraction, we had the expansion immediately and recorded the pressure drop before and behind the contraction. The comparison to the analytical solution was 99.99%. Therefore, I expect that there is something wrong in your set-up.

Great news


Furthermore, you should be aware of your first order scheme.

Not sure what you mean by this?

Summing up, there are still plenty of things you can consider improving your simulation. However, a discrepancy of 2.5 bar is a bit too high.
What comes into my mind, please be aware of the pressure you set. It is not the real pressure. The differences \delta p are fine but absolute values are different.


As far as I understand it is the pressure divided by density? Or do you mean that the pressures are not the absolute pressure, because I set my reference at the outlet to zero?
MrAndersDk is offline   Reply With Quote

Old   October 4, 2018, 04:29
Default
  #18
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
Quote:
Originally Posted by MrAndersDk View Post
Hello

If I don't use wallfunctions what should i use for type in the k and epsilon files?
you can find a good discussion about wall function in this thread:

Wall function usage
Tobi likes this.
mAlletto is offline   Reply With Quote

Old   October 4, 2018, 06:38
Default
  #19
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Quote:
Originally Posted by MrAndersDk View Post
Furthermore, you should be aware of your first order scheme.

Not sure what you mean by this?
To calculate different quantities such as the pressure, or fluxes at the faces, we need discretization schemes (system/fvSchemes). You can adjust them according to your needs.

Quote:
Summing up, there are still plenty of things you can consider improving your simulation. However, a discrepancy of 2.5 bar is a bit too high.
What comes into my mind, please be aware of the pressure you set. It is not the real pressure. The differences \Delta p are , but absolute values are different.


As far as I understand it is the pressure divided by density? Or do you mean that the pressures are not the absolute pressure because I set my reference at the outlet to zero?
Correct. The pressure difference \delta p can be compared directly, but if you compare the pressure value with another pressure (Pa), you have to multiply it with the density.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   October 9, 2018, 06:29
Default
  #20
Member
 
Anders Dyhr Nørløv
Join Date: Aug 2018
Posts: 32
Rep Power: 8
MrAndersDk is on a distinguished road
Thanks for all the suggestions.

I've tried to use the suggestions. First of all I've tried learning some snappyHexMesh to genererate a better hexagonal mesh, and elongated the pipe length. I now have the following mesh:

grid.PNG

gridzoom1.PNG

gridzoom2.PNG

As you can see the grid is much finer especially at the walls. However, there are still some strange cell's, don't know if that is a problem. The finer mesh is generating more of the expected turbulence in the corners and just after the contraction. However, i still get a too high pressure drop over the contraction compared to the empirical formula.

result.PNG

As you can see the pressure drop is between 3.8 to 3.2 coresponding to 32 mbar and 38 mbar for water. The empirical formula suggest 8 mbar for a flow of 0.5 m/s.

I've also tried using the suggestied boundary conditions

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1806                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    location    "0";
    object      epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 2 -3 0 0 0 0];

internalField   uniform 0.00031185580835531597;

boundaryField
{
    inlet
    {
        type            turbulentMixingLengthDissipationRateInlet;
        mixingLength    0.05;
		value           1;
    }
    outlet
    {
        type            zeroGradient;
    }
    wall_large
    {
		//type			  zeroGradient;
        type            epsilonWallFunction;
        value           uniform 0.0000031185580835531597;
    }
	wall_small
    {
		//type			  zeroGradient;
        type            epsilonWallFunction;
        value           uniform 0.000008088538952456775;
    }
}


// ************************************************************************* //
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1806                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    location    "0";
    object      k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 0.000040603056516117657;

boundaryField
{
    inlet
    {
        type            turbulentIntensityKineticEnergyInlet;
        intensity   	0.05;
		value       	1;
    }
    outlet
    {
        type            zeroGradient;
    }
    wall_large
    {
		//type			  zeroGradient;
        type            kqRWallFunction;
        value           uniform 0.000040603056516117657;
    }
	wall_small
    {
		//type			  zeroGradient;
        type            kqRWallFunction;
        value           uniform 0.00004828544369982472;
    }
}


// ************************************************************************* //
maybe the wall functions are still wrong? Also tried the zero gradient condition on the walls, but that didn't seem to help.

So all in all I like the new grid, and the ability to see turbulence effects with flow lines, but the pressure drop is still just as much off.

More suggestions how to improve my simulation?
MrAndersDk is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANSYS Meshing] pipe with different diameters (steady and sudden expansion) Raiz ANSYS Meshing & Geometry 0 October 12, 2015 07:18
Interface between a stator-rotor with sudden change in flowpath of the turbine mitra22 CFX 2 May 19, 2015 05:07
how to apply an sudden displacement or Force of a cylinder with solid solver? allenfieldin OpenFOAM Running, Solving & CFD 11 February 15, 2015 21:37
Sudden crash caused by k-epsilon vainilreb OpenFOAM Running, Solving & CFD 23 August 20, 2013 16:09
sudden perturbations adarsh Main CFD Forum 0 June 11, 2002 13:08


All times are GMT -4. The time now is 03:56.