CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Temperature inlet/outlet boundary conditions (http://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!


All times are GMT -4. The time now is 14:51.