CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Temperature inlet/outlet boundary conditions (https://www.cfd-online.com/Forums/openfoam/76677-temperature-inlet-outlet-boundary-conditions.html)

ozzythewise June 1, 2010 15:15

Temperature inlet/outlet boundary conditions
 
3 Attachment(s)
Hello all,

I am new to openfoam and so am just trying out a bunch of simple cases to get practice with the program. Right now I am simulating a heated plate at 400K in air at 300K to try and see what happens. I am having a problem in that before about 1 second of simulation time my entire control volume jumps up to 400K uniformly. I have attached pictures of my CV at 3 different time steps. I think the problem is in my temperature boundary condition. The way I want it is to simulate as if the heated plate was in atmosphere, so the 3 boundary conditions that aren't the heated plate would be inlets and outlets, these boundaries are the top, left and right patches on the pictures. The way I have it setup right now is that they are all zeroGradient in my 0/T file, but I know this is wrong. What other boundary condition should I use for my 0/T file for the patches that I want to act as an atmospheric inlet/outlet?

Thanks a lot!

ozzythewise June 2, 2010 07:46

Oh also, I am using the solver buoyantBoussinesqPisoFoam and the attached picture is a temperature plot.

Thanks

skarnani June 2, 2010 22:24

I think I ran in to a similar issue. It is the boundary conditions. By keeping the side walls at a zeroGradient, the volume will remain adiabatic.

I think the way to solve this would be to change the boundary conditions to inletOutlet or outletInlet. This way depending on the direction of the flow the boundary condition will change between zeroGradient and fixedValue.

I'm still trying to figure it all out, but this might point you in the right direction.

Best,
Sunny

ozzythewise June 3, 2010 07:47

Hi Skarnani,

Thanks for the advice, yeah I know for sure it's the boundary conditions I just don't know exact how to specify that the boundaries are suppose to be dispelling into the atmosphere. I'll give inletOutlet and outletInlet a shot (what's the difference between the two?) and let you know how that works.

Thanks again.

skarnani June 3, 2010 13:01

Hi Jeff,
The OpenFOAM user guide describes the function of inletOutlet and outletInlet as the following:

Switches U and p between fixedValue and zeroGradient depending on direction of U

I take it to mean, the first stated function will have a fixedValue and the second zeroGradient.

inletOutlet -- when functioning as an inlet, the boundary will have a fixed value; as an outlet, the boundary will have a zeroGradient.

I may not be the best person to ask. I'm having troubles assigning appropriate boundary conditions for temperature, too.

Sunny

ozzythewise June 3, 2010 13:07

I actually was able to get it to work perfectly with inletOutlet. I will post my solution in a little while, it's actually simulating right now, I'm trying to increase my mesh size enough so that my solution converges. The only thing I had to change was my 0/U file and that all I did was change the atmospheric boundaries to:

type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);

I kept all my other 0 files (including the 0/T file) exactly the same with zeroGradient as the boundary conditions to the atmosphere. The results are exactly what I wanted, upwards velocity in the centre of the heated plate, and downwards velocity near the sides to act like the air around it is boiling, just like a pot of water. It's really awesome, but again I'll post my solution and 0 files once I finish my simulation. Should be later today.

Thanks for the help

ozzythewise June 3, 2010 19:54

1 Attachment(s)
Hi,

Below are my 0/U, 0/T and 0/p files for you to take a look at. I have also attached a picture of my velocity field to show you what the results I got looked like:

0/U:

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

internalField uniform (0 0 0);

boundaryField
{
heatedPlate
{
type freestream;
freestreamValue uniform (0 0 0);
}
leftsideatmosphere
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);
}
rightsideatmosphere
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);
}
topatmosphere
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);
}
frontAndBack
{
type empty;
}
}

0/T:


dimensions [0 0 0 1 0 0 0];

internalField uniform 300; //300k

boundaryField
{
heatedPlate
{
type fixedValue;
value uniform 400; //400K
}
leftsideatmosphere
{
type zeroGradient;
}
rightsideatmosphere
{
type zeroGradient;
}
topatmosphere
{
type zeroGradient;
}

frontAndBack
{
type empty;
}
}

0/p:

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

internalField uniform 0;

boundaryField
{

heatedPlate
{
type buoyantPressure;
rho rhok;
value uniform 0;
}
topatmosphere
{
type buoyantPressure;
rho rhok;
value uniform -1.138941; //-rho*g*h
}
leftsideatmosphere
{
type uniformDensityHydrostaticPressure;
rho 1.161;
pRefValue 101325;
pRefPoint (0 0 0);
value $internalField;
}
rightsideatmosphere
{
type uniformDensityHydrostaticPressure;
rho 1.161;
pRefValue 101325;
pRefPoint (0.1 0 0);
value $internalField;
}
frontAndBack
{
type empty;
}

}

I hope these help. If you need to know anything else just let me know.

-J

skarnani June 3, 2010 20:35

Thanks, I think the result looks great. Based on your advice from the posts have helped a lot. I was running into an issue where based on my boundary conditions (I used an inletOutlet when defining temperature), temperatures in my domain would fall below 200K with an exothermic chemically reacting flow.

Long story short, following your lead in defining 0/U and 0/T, looks like my problem is solved.

skarnani June 3, 2010 20:40

BTW, looking at your 0/p file, correct me if I'm wrong, but the something doesn't seem right about the dimensions. Shouldn't it be [1 -1 -2 0 0 0 0]?

ozzythewise June 4, 2010 07:54

Yeah the pressure file is in units of pressure/unit density. I'm not sure why it doses this but I've run into this before, it all depends on what type of solver you use. In this case buoyantBoussinesqPisoFoam needs p/rho, weird I know.

poplar June 11, 2010 02:06

Hi,jeff.

based on your B.C.:
rightsideatmosphere
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);
}

Inward velocity should be inletValue,i.e. zero. at right/left sides. Basically, inletOutlet is zero gradient unless the flow is inward in which case it is fixed value (inletValue). But your uploaded pic showed inward volicities occured at right/left sides, allthough which was what you hoped, it was an expected result of the imposed B.C.

I think outletInlet maybe more appropriate to you , as outletInlet is zero gradient if the flow is inward and fixed value (outletValue) if the flow is outward

kriz June 11, 2010 02:34

1 Attachment(s)
Quote:

Originally Posted by ozzythewise (Post 261663)
Yeah the pressure file is in units of pressure/unit density.

So when postprocessing the value p after using the buoyantBoussinesqPisoFoam solver, I get p/rho and not p?

I have an interesting issue here: Using a room, wall at all sides, using a gravity acceleration of g=10m/s^s I am expecting a pressure increase of rho*g*h according to Bernoulli.

My room is 5m in height, so I would expect a pressure difference of 5*10=50 m^2/s^2, but I get about 100? m^2/s^2?

Plus: is there any place/necessity to specify the density of the fluid for the buoyantBoussinesqPisoFoam solver?

poplar June 11, 2010 03:20

Quote:

Originally Posted by kriz (Post 262558)
Plus: is there any place/necessity to specify the density of the fluid for the buoyantBoussinesqPisoFoam solver?

Density is not required for buoyantBoussinesqPiso/SimpleFoam solver.

Governing eqns.:
continuity, div(u)=0
momentum Du/Dt=-Grad(p)/rho+Div(nyu_eff*Grad(u))+beta*g*(T-T0)

let P=p/rho, then rho vanish from mom-eqn.

anyway,P and p are not real pressure. They are simplified by p=p_real-rho*g*h. In Rans model, 2/3K is also included in p.

kriz June 11, 2010 03:48

Quote:

Originally Posted by poplar (Post 262569)
anyway,P and p are not real pressure. They are simplified by p=p_real-rho*g*h. In Rans model, 2/3K is also included in p.

Thank you, there is also a great explanation of the solver by mchurchf I just found:
http://www.cfd-online.com/Forums/ope...planation.html

However, I have switched the turbulence model to laminar so I expect p~ to decrease hydrostatically with g*z, having no fluid flow, but it doesnt:

http://www.bilder-space.de/show_img....&size=original

I have set g to 10 m/s^2, the room is 5m in height, so the p~ difference should be 50 m^2/s^2, but it is around 90 instead.

ozzythewise June 11, 2010 09:17

Kriz,

Can you post your 0/p file. From the looks of your plot (http://www.bilder-space.de/show_img....&size=original) it looks like you have a different boundary conditions for your pressure on the left side of your control volume than you do on the right side. Judging by the picture I'm guessing you have maybe fixedValue on the right side, and then the left side is the properly set BC.

-J

poplar June 11, 2010 21:59

Hi,jeff.

"value uniform -1.138941; //-rho*g*h"
"rho 1.161;"

Perhaps these should be :
"value uniform -1.138941/1.161; //-rho*g*h"
"rho 1.161/1.161;"

in BuoyantBoussnesq*, the pressures are devided by rho.
e.g., rhok=1-beta*dT*g, si also devided by rho.

the pressrure boundaries calculated from 1.16, may cause a stronger pressure gradient, even it doesnt change the results pattern, velocities will be a bit faster.

poplar June 11, 2010 22:49

Quote:

Originally Posted by kriz (Post 262574)

http://www.bilder-space.de/show_img....&size=original

I have set g to 10 m/s^2, the room is 5m in height, so the p~ difference should be 50 m^2/s^2, but it is around 90 instead.

Your right Boundary was set as a fixed pressure =0?
Appropriate setting is: pd=0,or p=p_top-g*h
pd=0 is a easy way

kriz June 13, 2010 06:53

Quote:

Originally Posted by poplar (Post 262705)
Your right Boundary was set as a fixed pressure =0?
Appropriate setting is: pd=0,or p=p_top-g*h
pd=0 is a easy way

Correct, I was having issues using zeroGradient, but the problem was the zeroGradient BC at the bottom and the top, where the pressure gradient is not zero - Long story short - Yes, I do have p=0 at the right side boundary, but the problem with my calculation seems to be the zeroGradient BC at top and bottom, therefore the faulty values. I changed all to buoyantPressure and now it works fine.

What is pd and where can I set it instead of p~? Or were you referring to my BC as I used it?

The change the BC to p_top-g*h I will have to do some coding work - Can you tell me where the sources lie, what compiler I do need and how I do compile them? Hopefully it's possible to explain it in a short way? Up to now I was only heavily into Matlab programming and I therefore did not have to bother about compiler, where the source files lie, what the heck a makefile is? a.s.o.

poplar June 13, 2010 23:47

kriz.

For buoyancy case, use buoyantPressure at all walls .At inlet, buoyantPressure seems better than zeroGradient. At outlet, zeroGradient fot velocity and specific value for pressure.

If you have one outlet and the outlet perpendicular to gravity, simply specify a fixed value zero for pressure. If not,you have to specify the static pressure p in version 1.6, pd(=p-rho*h*x) in 1.5. Setting pd=0 is a easy way, I am not sure whether 1.6 supports pd. In 1.6, it seems that uniformDensityHydrostaticPressure is supposed to facilitate the transition from pd to p by specifying an equivalent to constant pd.
you may try the bellow p at outlet (it works for me):

{
type uniformDensityHydrostaticPressure;
rho 1.0;
pRefValue 0;
pRefPoint (lower right corner location or upper right corner location);
value $internalField;
}

Linse August 16, 2010 09:09

Thanks a lot to all of you!
Until I found this thread, the use of the inletOutlet boundary conditions was nothing more but questionmarks to me! Now at least I know the syntax and what they are supposed to do! ;-)
Thanks again!

Wolle April 13, 2011 08:44

Hi all!

Quote:

Originally Posted by poplar (Post 262838)
If you have one outlet and the outlet perpendicular to gravity, simply specify a fixed value zero for pressure. If not,you have to specify the static pressure p in version 1.6, pd(=p-rho*h*x) in 1.5. Setting pd=0 is a easy way, I am not sure whether 1.6 supports pd. In 1.6, it seems that uniformDensityHydrostaticPressure is supposed to facilitate the transition from pd to p by specifying an equivalent to constant pd.

Refering to the above example and running it in OF1.7,wouldn't this mean to set p_rgh to zero? What to set for p then? How to apply the uniformDensityHydrostaticPressure BC correctly? I just can't get it right with this p/p_rgh distinction... :(

In all setups I tried, setting p_rgh to zero lead to an immediate abort of the solver at timestep 0.

Cheers
Wolle

P.S.: Does anyone have a copy of the complete case discussed above by any chance?

Peter88 August 8, 2011 09:15

Temperature problem
 
4 Attachment(s)
I am trying to do a natural convection case. I got some weird low temperature under the cilinder and pressure stripes at my boundaries Somebody can help me out? See attachment for pictures. The cilinder is 400K and the internal field 300K. If somebody want to see some 0 files, tell me.

ravikanthmannem July 20, 2016 16:06

Heat transfer in turbulent pipe flow
 
Hi, can anybody tell me what has to be the temperature boundary condition of pipe wall and pipe outlet in a turbulent pipe flow where there is uniform heat flux(37.5 W/m^2) at wall and fluid entering at 300K

Mondal131211 January 29, 2019 23:55

Quote:

Originally Posted by ozzythewise (Post 261604)
Hi,

Below are my 0/U, 0/T and 0/p files for you to take a look at. I have also attached a picture of my velocity field to show you what the results I got looked like:

0/U:

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

internalField uniform (0 0 0);

boundaryField
{
heatedPlate
{
type freestream;
freestreamValue uniform (0 0 0);
}
leftsideatmosphere
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);
}
rightsideatmosphere
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);
}
topatmosphere
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);
}
frontAndBack
{
type empty;
}
}

0/T:


dimensions [0 0 0 1 0 0 0];

internalField uniform 300; //300k

boundaryField
{
heatedPlate
{
type fixedValue;
value uniform 400; //400K
}
leftsideatmosphere
{
type zeroGradient;
}
rightsideatmosphere
{
type zeroGradient;
}
topatmosphere
{
type zeroGradient;
}

frontAndBack
{
type empty;
}
}

0/p:

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

internalField uniform 0;

boundaryField
{

heatedPlate
{
type buoyantPressure;
rho rhok;
value uniform 0;
}
topatmosphere
{
type buoyantPressure;
rho rhok;
value uniform -1.138941; //-rho*g*h
}
leftsideatmosphere
{
type uniformDensityHydrostaticPressure;
rho 1.161;
pRefValue 101325;
pRefPoint (0 0 0);
value $internalField;
}
rightsideatmosphere
{
type uniformDensityHydrostaticPressure;
rho 1.161;
pRefValue 101325;
pRefPoint (0.1 0 0);
value $internalField;
}
frontAndBack
{
type empty;
}

}

I hope these help. If you need to know anything else just let me know.

-J

Hi ozzythewise,

Though you have posted this thread a long time ago, I hope you can solve my problem easily. can you please look at this link and make any comment for my problem? I am really struggling with this problem.

https://www.cfd-online.com/Forums/op...en-cavity.html

Raza Javed May 19, 2019 06:14

1 Attachment(s)
Hello Everyone,


I am using chtMultiRegionSimpleFoam and my Openfoam version is 4.1.


I have created geometry in Salome and and then imported the UNV file to Openfoam.


My geometry consists of a pipe and three rectangular plates, and all these things are in one box.



The rectangular plates are acting as a heat source which I made using fvOption.


Now, the fluid will flow from the pipe, and due to these hot rectangular plates, the temperature of the fluid will change inside the pipe.


At the inlet, I need to put the flow-rate of 5 litres/minutes.



At the inltet, temperature could be room temperature.


Now, My task is to see the temperature change at the outlet.



I have put some boundary conditions for Velocity, Temperature and Pressure, at inlet, outlet and at the walls of pipe.


But my solver is not converging.



I am not getting which boundary conditions to use.


I have tried putting flowRateInletVelocity, but I don't know which boundary conditions to put at other boundaries in this case?


I am putting my geometry and boundary conditions with this post.


I shall be very thankful, is someone can help me out in this.


Thank you


Code:

boundary
{
    inlet
    {
        type            patch;
    }
    outlet
    {
        type            patch;
    }

}
U
{
    internalField  uniform (0 1e-3 0);

    boundaryField
    {
        inlet
        {
            type                flowRateInletVelocity;//pressureInletVelocity;//fixedValue;
            volumetricFlowRate  0.066;
            extrapolateProfile  yes;
            value              $internalField;//uniform (0 1e-3 0);
        }

        outlet
        {
            type                zeroGradient;
            //value          uniform (0 0 0);//$internalField;
        }
        "fluid_to_box"
        {
            type            noSlip;
        }
    }
}

T
{
    internalField  uniform 300;

    boundaryField
    {
        inlet
        {
            type            fixedValue;
            value          uniform 450;//$internalField;
           
        }

        outlet
        {
            type            inletOutlet;
            value          $internalField;
            inletValue      $internalField;
        }

        "fluid_to_box"
        {
            type            compressible::turbulentTemperatureCoupledBaffleMixed;
            Tnbr            T;
            kappaMethod    fluidThermo;
            value          uniform 300;
        }
    }
}


epsilon
{
    internalField  uniform 0.01;

    boundaryField
    {
        inlet
        {
            type            fixedValue;
            value          uniform 0.01;
        }

        outlet
        {
            type            inletOutlet;
            inletValue      uniform 0.01;
        }

        ".*"
        {
            type            epsilonWallFunction;
            value          uniform 0.01;
        }
    }
}

k
{
    internalField  uniform 0.1;

    boundaryField
    {
        inlet
        {
            type            inletOutlet;
            inletValue      uniform 0.1;
        }

        outlet
        {
            type            zeroGradient;
            value          uniform 0.1;
        }

        ".*"
        {
            type            kqRWallFunction;
            value          uniform 0.1;
        }
    }
}


p_rgh
{
    internalField  uniform 0;

    boundaryField
    {
        inlet
        {
            type            fixedFluxPressure;//zeroGradient;
            value          uniform 0;
        }

        outlet
        {
            type            fixedValue;
            value          uniform 0;
        }

        ".*"
        {
            type            fixedFluxPressure;
            value          uniform 0;
        }
    }
}

p
{
    internalField  uniform 0;

    boundaryField
    {
        ".*"
        {
            type            calculated;
            //value          uniform 0;
        }
    }
}


bhavin_1906 June 11, 2021 14:07

I have a hot plate coinciding with the bottom of my Domain and I want to simulate the natural convection. The problem is that here I do not know which is my inlet and which one is outlet. I have my boundaries as TOP, SIDES, BOOTTOM & PLATETOP. I have used the inletoutlet conditions of the top & sides and zeroGradient for the bottom. But, it seems that the air isn't moving out of the domain, as the temperature continously goes on increasing and never stabilizes. I have a uniform heat source as the BC for the plate. Can someone help me with this problem?


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