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

Boundary conditions for internal flow

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 30, 2014, 11:21
Default Boundary conditions for internal flow
  #1
New Member
 
kamil
Join Date: Jun 2014
Posts: 11
Rep Power: 12
zaripov is on a distinguished road
I want to compare FLUENT calculation results and openFOAM results.
I have calculations got from FLUENT, so I need now apply correct BC for openFOAM.
In FLUENT it needs only total pressure and temperature for inlet and static pressure for outlet.

How sets up similar BC in openFOAM?

The case geometry is simple pipe. Solver is rhoSimplecFoam;

I have tried to apply follow BC:
Pressure:
Code:
internalField   uniform 1.9e5;
boundaryField
{
	front
    {
        type 			wedge;
    }

    back
    {
        type 			wedge;
    }

    inlet
    {
    	type            totalPressure;
    	U               U;
 		phi             phi;
 		rho             none;
 		psi             none;
		p0				2e5;
		gamma			1.4;
    }
    outlet
    {
    	type            fixedValue;
        value			uniform 1.8e5;
    }

    bottom
    {
        type            zeroGradient;
    }

    top
    {
        type            zeroGradient;
    }
}
Velocity:
Code:
internalField   uniform (0 0 0);
boundaryField
{
	front
    {
        type 			wedge;
    }

    back
    {
        type 			wedge;
    }

    inlet
    {
        type			zeroGradient;
    }
    outlet
    {
		type			zeroGradient;
    }

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

    top
    {
        type            fixedValue;
        value           uniform (0 0 0);
    }
}
Temperature:
Code:
internalField   uniform 300;

boundaryField
{
	front
    {
        type            wedge;
    }
    back
    {
        type            wedge;
    }
    bottom
    {
        type            fixedValue;
        value			uniform 300;
    }
    outlet
    {
        type            zeroGradient;
    }
    inlet
    {
        type            fixedValue;
        value           uniform 300;
    }
    top
    {
        type            fixedValue;
        value			uniform 300;
    }
}
But after about 20 steps it returns error:
Code:
Floating point exception
Where in my boundary conditions have I make a mistake?

P. S. Sorry for my English.
zaripov is offline   Reply With Quote

Old   July 1, 2014, 03:59
Default
  #2
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 647
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi,

For the inlet in U file you may want to use:

Code:
type         pressureInletVelocity;
value        uniform (0 0 0);
Regards,
Tom
tomf is offline   Reply With Quote

Old   July 1, 2014, 05:38
Default
  #3
New Member
 
kamil
Join Date: Jun 2014
Posts: 11
Rep Power: 12
zaripov is on a distinguished road
Tom,

Thank you for advice.
The error appears much farther, but it appears anyway. I found out that in the first steps develops very strange flow at inlet:


I think that it isn't normal, and it may be reason of the problem.
Maybe I should apply another variant of BC?
zaripov is offline   Reply With Quote

Old   July 1, 2014, 06:06
Default
  #4
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 647
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi,

Please explain what is the inlet and what is the outlet in this picture? I think it would also help if you can show your mesh. Please also use the cell data when looking at results for debugging, not the interpolated point data. Are your wedges defined correctly?

Maybe you should also use this for your totalPressure on the inlet in the p file?

Code:
inlet
{
    type            totalPressure;
    U                U;
    phi              phi;
    rho             rho;
    psi              psi;
    p0              2e5;
    gamma        1.4;
}
Regards,
Tom
tomf is offline   Reply With Quote

Old   July 1, 2014, 06:45
Default
  #5
New Member
 
kamil
Join Date: Jun 2014
Posts: 11
Rep Power: 12
zaripov is on a distinguished road
Yes, of course. That is correct image:

Two visible patches are top and front. (Top patch is above and front patch in the front)

Larger part of corner:


Here is my mesh:


Lareger left part of mesh


The case archive:
http://tuqaiyurts.com/case.zip

P. S. If I set
Code:
inlet
{
	type	totalPressure;
	U		U;
	phi		phi;
	rho		rho;
	psi		psi;
	p0		2e5;
	gamma	1.4;
}
The follow error will appear:
Code:
--> FOAM FATAL ERROR: 
 rho or psi set inconsistently, rho = rho, psi = psi.
    Set either rho or psi or neither depending on the definition of total pressure.
    Set the unused variable(s) to 'none'.
    on patch inlet of field p in file "/home/kamil/cases/alphaTest2/0/p"

    From function totalPressureFvPatchScalarField::updateCoeffs()
    in file fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C at line 210.
zaripov is offline   Reply With Quote

Old   July 1, 2014, 07:08
Default
  #6
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 647
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Ok, I found this in src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H:

Code:
    
The modes of operation are set via the combination of \c phi, \c rho, and
    \c psi entries:
    \table
        Mode                    | phi   | rho   | psi
        incompressible subsonic | phi   | none  | none
        compressible subsonic   | phi   | rho   | none
        compressible transonic  | phi   | none  | psi
        compressible supersonic | phi   | none  | psi
    \endtable
So use I would assume you would need the second version (rho rho and psi none).

From your figures it seems like you want to have a radial inflow? But I do not really see walls that are wedge shaped. Is this correct? Or do you want to have a straight 2D flow? In that case you must use empty and not wedge.
tomf is offline   Reply With Quote

Old   July 1, 2014, 08:06
Default
  #7
New Member
 
kamil
Join Date: Jun 2014
Posts: 11
Rep Power: 12
zaripov is on a distinguished road
Yes, I want to simulate radial inflow. It seems hard to understand geometry, so I draw it:

So geometry is the pipe with 0.2m inner radius and 0.21m outer radius, and gas flows between them.

So mesh is wedge with 1º corner.

In the picture with meshes I forget to include patches front and back with wedge boundary condition. So you can see them in this picture:

From tho other side:

I hope that it will help you.

I try to run case with follow BC for pressure, but I got the same result:
Code:
Floating point exception
zaripov is offline   Reply With Quote

Old   July 1, 2014, 09:04
Default
  #8
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 647
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi,

It is getting clear now, I assumed it was just one complete cylinder, not two concentric cylinders.

My guess would be that you can best ramp the total pressure on the inlet in a couple of iterations, or alternatively ramp down the static pressure on the outlet. That way there is no discontinuity in the pressure field, that can cause problems.

I am not completely sure about the syntax, but I believe you can find it on the forum as well.

Good luck,
Tom
tomf is offline   Reply With Quote

Old   July 1, 2014, 09:30
Default
  #9
New Member
 
kamil
Join Date: Jun 2014
Posts: 11
Rep Power: 12
zaripov is on a distinguished road
My English isn't so good, so think that I don't understand you completely. I have to ask you one more time.

Do you suggest me to decrease pressure difference between inlet and outlet for several iterations?
zaripov is offline   Reply With Quote

Old   July 1, 2014, 10:27
Default
  #10
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 647
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Yes that is what I meant, start with everything fixed at 1.8e5, than linearly increase total pressure @ inlet to 2e6 in say 500 iterations.
tomf is offline   Reply With Quote

Old   July 1, 2014, 11:21
Default
  #11
New Member
 
kamil
Join Date: Jun 2014
Posts: 11
Rep Power: 12
zaripov is on a distinguished road
I have try it, but results is bad: calculation is going very slowly(about 1 min for each iteration) and finally appears error.

Moreover, to test your idea I have run case with follow test boundary and initial conditions:
Pressure:
inlet - 1.1e5 (static)
outlet - 1e5 (static)
initial field - using (funkySetFields -field p -expression '11000-pos().x*1000' -time 0) I have set up linear gradient of pressure

Velocity:
inlet - zero gradient
outlet - zero gradient
initial field - I have approximate mean velocity for this case, and set initial field as (25 0 0)

In this case there is no discontinuity of pressure, and minimum discontinuity of velocity.

The results of calculation is better, but after about 100 iteration it returns Floating point exception and the fields is very strange at the last iteration:
pressure:



velocity:


a few steps before near inlet:



Why pressure and velocity fields have so great gradient near inlet even when initial discontinuity of fields is small?
zaripov is offline   Reply With Quote

Old   July 1, 2014, 11:34
Default
  #12
New Member
 
kamil
Join Date: Jun 2014
Posts: 11
Rep Power: 12
zaripov is on a distinguished road
I think it will be good to show test case with several last steps:
http://tuqaiyurts.com/testCase.zip
zaripov is offline   Reply With Quote

Old   July 2, 2014, 05:04
Default
  #13
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 647
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi,

I had a short look at your case. It looks like you are using OpenFOAM version 2.0.1? I think you should consider upgrading to the latest version (2.3.x). There have been many bug fixes since than, which may or may not be related to your problems.

Besides that, I found two things which may help you.

First you have in fvSolution, SIMPLE subdict:
Code:
 
transonic       yes;
With your pressure range I would not expect any transonic flow, so just put it at no.

Next, you have used stable, bounded schemes, but maybe you want to limit the gradients by using this:

Code:
gradSchemes
{
    default             cellLimited Gauss linear 1;
}
Additionally, you may also want to check your yplus values, I am not sure if they are in the log range as you would need for the k-epsilon model. It may be better to use a continuous wall function for mut, not sure what the name was for version 2.0.1, but either mutUSpaldingWallFunction or mutSpalartAllmarasWallFunction. Or you could use a low Re turbulence model instead of standard k-epsilon.

I think these are all the things I can come up with right now.

Good luck,
Tom
tomf is offline   Reply With Quote

Old   July 2, 2014, 07:22
Default
  #14
New Member
 
kamil
Join Date: Jun 2014
Posts: 11
Rep Power: 12
zaripov is on a distinguished road
Thank you very much, Tom.

I will check it.

Kamil.
zaripov is offline   Reply With Quote

Old   July 2, 2014, 11:30
Default
  #15
New Member
 
kamil
Join Date: Jun 2014
Posts: 11
Rep Power: 12
zaripov is on a distinguished road
Almost everything is ok.

At least there is no error and the flow is look realistic.

I don't know what changes is solve problem, but I think that it was openfoam update or changing epsilon and k wall function values in the inlet patch.

There is one problem, but it isn't connected with this topic.

One more time thanks to Tom.

Kamil.
zaripov is offline   Reply With Quote

Reply

Tags
boundary conditions, internal flow


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
Boundary conditions low Mach number flow lost.identity Main CFD Forum 0 November 28, 2010 05:44
3-D Compressible Flow Boundary Conditions Tyler FLUENT 4 February 5, 2009 20:58
boundary conditions for boundary layer flow A. Al-zoubi CFX 0 November 3, 2007 08:11
Internal flow simulation boundary conditions Kishore FLUENT 1 July 10, 2007 12:42
Please help with flow around car modelling! Tudor Miron CFX 17 March 19, 2004 20:23


All times are GMT -4. The time now is 13:47.