CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   fanPressure BC (http://www.cfd-online.com/Forums/openfoam/91630-fanpressure-bc.html)

Sylvain August 17, 2011 10:54

fanPressure BC
 
Hi everybody,

I'm now looking in using the new fanPressure BC introduced in 2.0.0 as I'm not satisfied with the classical fan BC. As far as I have understood this BC prescribes a total pressure jump based on the averaged velocity and pressure over the whole BC surface. I think that it would yield to a much more stable BC than the classical fan BC.

I have tested it in two configurations:

1) I make two cyclic patches using the createBaffle utility like for a classical fan condition. When I run simpleFoam the code says:

--> FOAM FATAL IO ERROR:
inconsistent patch and patchField types for
patch type cyclic and patchField type fanPressure


Indeed if you look into the code, the fanPressure BC is derived from the totalPressure BC which is a type patch. :rolleyes: So I moved for the second configuraiton, with two distinct patches fan_upstrem and fan_downstream.

Then, when i run the code it says:

--> FOAM FATAL ERROR:
Attempt to cast type patch to type lduInterface


OK, but if one searches for lduInterface in your favorite CFD forum, one can find that this error means that your patches have to be declared as cyclic..... :confused:


So is FanPressure a cyclic BC like fan, or a patch BC like totaPressure? Is anybody succeed in using this BC?

Thanks ahead for your comments

Sylvain

Sylvain August 17, 2011 11:58

I've found my mistakes... actually I forgot to modify the other variables (U, k, omega) which were still defined as cyclic... which explains the FATAL ERROR. Sorry to bother you with such a lack of focus from me.

So for the record, the fanPressure BC works exactly as the totalPressure BC. I copied the totalPressure BC setup from the pimpleFoam/TJunction Tutorial. only the p file as to be modified with the example given in the .H file of the source code.

Warning: the code will ask you for the gamma constant ( totalPressure legacy ?)


fan_uptream

{
type fanPressure;
patchType totalPressure;
fileName "./constant/fanCurve"; // Fan curve file name
outOfBounds clamp; // (error|warn|clamp|repeat)
direction out; // Direction of flow through fan
p0 uniform 0; // Environmental total pressure
value uniform 0; // Initial pressure
gamma 1;
}

fan_downstream
{
type fanPressure;
patchType totalPressure;
fileName "./constant/fanCurve"; // Fan curve file name
outOfBounds clamp; // (error|warn|clamp|repeat)
direction in; // Direction of flow through fan
p0 uniform 0; // Environmental total pressure
value uniform 0; // Initial pressure
gamma 1;
}


Results look nice!!!

Thanks everybody for all your work posted in this forum.

Cheers

Sylvain

claco August 23, 2011 09:06

Hi Sylvain,

can You please explain me exactly what is the format of the "fanCurve" file? What have I to insert into this file?

Yours Sincerely,

Claudio

Sylvain August 24, 2011 05:15

Hi,

The fan curve is a table which links the delta_p to your averaged velocity through the fan...

Here is an example of what I have prescribed in my example

5 // five points in the table
(
(5 100) //(velocity pressure_jump)
(10 400)
(20 600)
(30 400)
(40 50)
)

I put this file into the constant folder.

I am thinking about this BC compared to the classic fan one. Its main advantage is that it is more "stable' than the classic one and that you can prescribe other BCs for the other variables such as k or omega.

From what I understood it is clearly designed as an "outlet" and "inlet" BC of your domain, and not as a "baffle" BC like in your case (and mine), which is the purpose of the classic fan BC.

However from my tests it looks like it also working well as a "baffle BC" provided you have only one single fan in the domain. If you have more than one fan, it is not working any longer as the inlet and outlet patch are not "connected" together. As a consequence you don't have the mass conservation through one fan (but you got it through the whole array of fan, of course, kind of redistribution of the mass flux between the fans)

I'm really interested in any feedback about those fan conditions. From my tests, you obtain results which are very differents when switching from one BC to another...

from my point of view, it would be nice to have the best of both worlds... a more constrain cyclic BC with specs on the variables and prescription of the pressure jump on the whole patch instead of each cells... to be continued...

Sylvain

claco August 24, 2011 05:23

Thank You,

the problem is that I have to prescribe a deltaP for each cell (that is, the deltaP varies radially according to a variation law). Moreover, this deltaP is independent from the velocity, it is constant, a value which remains fixed during the simulation. I know for each cell of the patch the deltaP, but I cannot understand how to specify those values (a nonUniform list).

Claudio

Sylvain August 24, 2011 05:40

well I think you may have two solutions using a total pressure BC :

1) you are prescribing the ptot profile using using groovyBC

2) you program a little utility which "map" a non uniform ptot on the you patch

Sylvain

claco August 24, 2011 08:56

Quote:

Originally Posted by Sylvain (Post 321335)
well I think you may have two solutions using a total pressure BC :

1) you are prescribing the ptot profile using using groovyBC

2) you program a little utility which "map" a non uniform ptot on the you patch

Sylvain


Sorry,

but I meant a delta of static pressure, non a jump of totalPressure. In the fanPressure, do I have to impose a delta(static)P, or a delta(Total)P?. Because I only know the jump of static pressure, I have no infos about total pressure variation through the fan.

Claudio

maddalena October 26, 2011 10:57

Hello Sylvain and thank you for your contribution!

Quote:

Originally Posted by Sylvain (Post 320496)
fan_uptream

{
type fanPressure;
patchType totalPressure;
fileName "./constant/fanCurve"; // Fan curve file name
outOfBounds clamp; // (error|warn|clamp|repeat)
direction out; // Direction of flow through fan
p0 uniform 0; // Environmental total pressure
value uniform 0; // Initial pressure
gamma 1;
}

fan_downstream
{
type fanPressure;
patchType totalPressure;
fileName "./constant/fanCurve"; // Fan curve file name
outOfBounds clamp; // (error|warn|clamp|repeat)
direction in; // Direction of flow through fan
p0 uniform 0; // Environmental total pressure
value uniform 0; // Initial pressure
gamma 1;
}

Quote:

Originally Posted by Sylvain (Post 321328)
Hi,

The fan curve is a table which links the delta_p to your averaged velocity through the fan...

Here is an example of what I have prescribed in my example

5 // five points in the table
(
(5 100) //(velocity pressure_jump)
(10 400)
(20 600)
(30 400)
(40 50)
)

I put this file into the constant folder.

I am wandering what the BC should be on U on the boundaries declared as fanPressure. I cannot use fixedValue, since this would set the massflow, which should be selected according to fanCurve. zeroGradient is not ok as well, since it will not keep the velocity on the downwind side of the fan. Thus? what I should specify?

thank you!


mad

Sylvain October 26, 2011 12:16

Hello Maddelana,

here is what I prescribed for U:

Code:

 
 fan_aval
  {
        type            pressureInletOutletVelocity;
        value          uniform (0 0 0);
    }
    fan_amont
  {
        type            inletOutlet;
        inletValue      uniform (0 0 0);
        value          uniform (0 0 0);

I have to admit I didn't look too deep inside the code for the "pressureInletOutletVelocity", as far as i understand it prescribes a flow rate which depends of the delta_p at the (inlet/outlet). Maybe I should have prescribed the same at the outlet. I didn't tried it yet.

Let me know if it worked for you


hope it'll be helpful


Sylvain

dhruv October 31, 2011 09:33

Hello Sylvian,
 
Hi Sylvian,

I am also doing some simulation involving a fan in the wind tunnel. I was hoping to use the fanPressure BC that you have described here. However, when I used them for pressure inlet and outlet patch , these BC is not recongnized in OF 2.0.0. OF throws a list of BCs, which has fan but not fanPressure.

Can you please tell me how you did it?
Regards,
Dhruv.

Quote:

Originally Posted by Sylvain (Post 320496)
I've found my mistakes... actually I forgot to modify the other variables (U, k, omega) which were still defined as cyclic... which explains the FATAL ERROR. Sorry to bother you with such a lack of focus from me.

So for the record, the fanPressure BC works exactly as the totalPressure BC. I copied the totalPressure BC setup from the pimpleFoam/TJunction Tutorial. only the p file as to be modified with the example given in the .H file of the source code.

Warning: the code will ask you for the gamma constant ( totalPressure legacy ?)


fan_uptream

{
type fanPressure;
patchType totalPressure;
fileName "./constant/fanCurve"; // Fan curve file name
outOfBounds clamp; // (error|warn|clamp|repeat)
direction out; // Direction of flow through fan
p0 uniform 0; // Environmental total pressure
value uniform 0; // Initial pressure
gamma 1;
}

fan_downstream
{
type fanPressure;
patchType totalPressure;
fileName "./constant/fanCurve"; // Fan curve file name
outOfBounds clamp; // (error|warn|clamp|repeat)
direction in; // Direction of flow through fan
p0 uniform 0; // Environmental total pressure
value uniform 0; // Initial pressure
gamma 1;
}


Results look nice!!!

Thanks everybody for all your work posted in this forum.

Cheers

Sylvain


Curico November 10, 2011 08:21

Hi Sylvian,

quisiera saber como utilizas el createBaffle para crear el parche interno a la malla. podrias tu darme un ejemplo que hallas realizado para poder revisarlo por favor ?

saludos

Curico November 10, 2011 08:22

Hi Sylvian,

I would like to know how to use to create the patch createBaffle internal to the mesh. could you give me an example to review Hall on please?

regards

Sylvain November 15, 2011 03:06

Hola Curico

Voy a escribir en ingles porque es mas facil para mi :) Mi espanol es un poquito viejo

to create an internal baffle, the trick is to define empty patches in blockMesh, so:

1) you add those lines in BlockMeshDict

Code:

    fan_amont
    {
        type cyclic;
        faces ();
        neighbourPatch fan_aval;
    }

    fan_aval
    {
        type cyclic;
        faces ();
        neighbourPatch fan_amont;
    }

Then you go on with your meshing procedure as usual. if you mesh with an another software than openFoam, your add those empty patches in the constant/polyMesh/boundary file

2) you have then to "mark" the faces which will form your baffles. You have to use the TopoSet tool. The easier way to use it according to me is to use a TopoSetDict file placed in the system folder. Here is an example of my toposetdict file

Code:

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

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

actions
(
//------------------------------------------------------------------------------------
    {
        name    cyclicfanFaces;
        type    faceSet;
        action  new;
        source  boxToFace;
        sourceInfo
        {
            box (-1.52 -11 -1)(-1.47 -6.5 3);//bien réglé à la frontiere de deux faces verticales
        }
    }
//------------------------------------------------------------------------------------
    {
        name    cyclicfanFacesSlaveCells;
        type    cellSet;
        action  new;
        source  boxToCell;
        sourceInfo
        {
            box (-1.5 -11 -1)(6 -6.5 3);
        }
    }
//------------------------------------------------------------------------------------
    {
        name    cyclicfanZoneFaces;
        type    faceZoneSet;
        action  new;
        source  setsToFaceZone;
        sourceInfo
        {
            faceSet cyclicfanFaces;
            cellSet cyclicfanFacesSlaveCells;
        }
    }
//--------------------------------------------------------------------------- 
);

// ************************************************************************* //

The first piece of code select the set of faces of the baffle, the second a select a set of cells upstream your baffle. this set of baffles actually define the direction of your fan!! The third combine the two first pieces into a face zone

3) the last part is to use your brand new facezone to actually create the baffle

here is the command line for my example
Code:

createBaffles cyclicfanZoneFaces '(fan_amont fan_aval)' -internalFacesOnly
Now if you run parafoam you should see your baffle.

According to me, the most tricky part is to select the cells with toposet, especially if you mesh with snappy, is quite difficult to setup the appropriate box which select only the faces in the baffle

Hope it will be usefull, keep me in touch

Sylvain

aujamal20 December 10, 2012 13:18

Dear
I am using topoSetDict to creat fluid and solid regions and facing problems. BlockMesh work properly and give the mesh while topoSet run with no error but causing no affect.

BlockMeshDict
Quote:

FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices
(
(0 0 0.01)
(0.5 0 0.01)
( 0.5 0 -0.01)
(0 0 -0.01)
(0 1 0.01)
(0.5 1 0.01)
(0.5 1 -0.01)
(0 1 -0.01)
);

blocks
(
hex (0 1 2 3 4 5 6 7) (50 3 100) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
minX
{
type patch;
faces
(
(0 4 7 3)
);
}

maxX
{
type wall;
faces
(
(2 6 5 1)
);
}

minY
{
type wall;
faces
(
(0 3 2 1)
);
}
maxY
{
type wall;
faces
(
(4 5 6 7)
);
}

// frontAndBack
// {
// type empty;
// faces
// (
// (1 5 4 0)
// (3 7 6 2)
// );
// }

front
{
type wall;
faces
(
(0 1 5 4)
);
}

back
{
type wall;
faces
(
(3 7 6 2)
);
}
);

mergePatchPairs
(
);

// ************************************************** *********************** //
and topoSetDict is

Quote:

FoamFile
{
version 2.0;
format ascii;
class dictionary;
object topoSetDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

actions
(
// solid
{
name Solid;
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (0 0 0.01)(0.5 0.1 -0.01);
}
}
{
name Solid;
type cellSet;
action add;
source boxToCell;
sourceInfo
{
box (0.4 0.1 0.01)(0.5 0.9 -0.01);
}
}
{
name Solid;
type cellSet;
action add;
source boxToCell;
sourceInfo
{
box (0 0.9 0.01)(0.5 1 -0.01);
}
}
{
name Solid;
type cellSet;
action add;
source boxToCell;
sourceInfo
{
box (0 0.1 0.01)(0.1 0.9 -0.01);
}
}
{
name Solid;
type cellSet;
action add;
source boxToCell;
sourceInfo
{
box (0 0.3 0.01)(0.1 0.7 -0.01);
}
}
{
name Solid;
type cellSet;
action add;
source boxToCell;
sourceInfo
{
box (0 0.8 0.01)(0.1 0.9 -0.01);
}
}
{
name Solid;
type cellZoneSet;
action new;
source setToCellZone;
sourceInfo
{
set Solid; // name of cellSet
}
}

// fluid
{
name Fluid;
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (0.1 0.1 0.01)(0.4 0.9 -0.01);
}
}
{
name Fluid;
type cellSet;
action add;
source boxToCell;
sourceInfo
{
box (0 0.2 0.01)(0.1 0.3 -0.01);
}
}
{
name Fluid;
type cellSet;
action add;
source boxToCell;
sourceInfo
{
box (0 0.7 0.01)(0.1 0.8 -0.01);
}
}
{
name Fluid;
type cellZoneSet;
action new;
source setToCellZone;
sourceInfo
{
set Fluid;
}
}

);

// ************************************************** *********************** //
is there any special arrangment for adding box to give same region properties.

Regards
Jamal


All times are GMT -4. The time now is 17:01.