CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Reference pressure (http://www.cfd-online.com/Forums/openfoam-programming-development/79298-reference-pressure.html)

OFU August 19, 2010 04:24

Reference pressure
 
Hello,

for my computations I need to set a reference pressure in one cell of the outer wall (named oustide) of my geometry. But how can I find out which cells are part of the outer wall und how they are numbered, so that I can choose one from these cells? I had a look in the five files boundary, faces, neighbour, owner, points, but that didn't help me.
And how can I set the reference value in one cell? By using pRefCell and pRefValue?

Would be nice, if anyone could help me.

Thanks,
Jennifer

akidess August 19, 2010 07:10

You can foamToVTK -time 0, then in paraview select the cell you want to set the pressure on, open the selection inspector, make the cell label visible and select cellID (not "Cell ID"). Then use pRefCell and pRefValue to set the reference.

aloeven August 30, 2010 16:06

I had the same problem when I was using different meshes for the same geometry. The cell with label 0 was on the farfield boundary on one mesh and on a wall in another mesh.

Now I use pRefPoint instead of pRefCell. Then the reference pressure is defined in the point you want, just give the x, y, and z coordinates:

pRefPoint (x y z);

instead of

pRefCell 0;

akidess August 31, 2010 04:01

Alex, does this also work for decomposed meshes?

aloeven August 31, 2010 05:34

I didn't think of that. But I performed parallel computations and observed no problems.

akidess August 31, 2010 09:37

Ok, good to know!

OFU September 15, 2010 05:19

I used Paraview to find the right cell and now it works with pRefCell and pRefValue. Thanks for your answer, Anton.
But then I tried to use pRefPoint, because I think it's the easier way to set the reference pressure at a special point. So I replaced pRefCell with pRefPoint, but it didn't work. Alex, can you explain me in detail how to use it? What must be written in which file? I want to use it with the solver rhoPisoFoam...

It would be nice, if you can help me.

aloeven September 15, 2010 05:35

In your system/fvSolution file there is something like:

SIMPLE
{
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}


Change this to the following if you want to specify 0 pressure at point (1,0,0.5):

SIMPLE
{
nNonOrthogonalCorrectors 0;
pRefPoint (1 0 0.5);
pRefValue 0;
}

OFU September 15, 2010 09:13

I changed pRefCell to pRefPoint in system/fvSolution, but it doesn't work. in the createFields.H file of rhoPisoFoam I added

scalar pRefValue = 0.0
label pRefCell = 0
setRefCell (p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue)

to use pRefCell and pRefValue and I think this causes ther error. I tried to use something like

point pRefPoint = (0 0 0)
label pRefCell = 0
setRefCell (p, mesh.solutionDict().subDict("SIMPLE"), pRefpoint, pRefValue)

but this also doesn't work. So what do I have to write in createFields.H that I can use pRefPoint? Do I have to integrate a special header-file or have I just to leave it out?

akidess September 15, 2010 09:24

Quote:

Originally Posted by OFU (Post 275300)
I changed pRefCell to pRefPoint in system/fvSolution, but it doesn't work. in the createFields.H file of rhoPisoFoam I added

[...]
to use pRefCell and pRefValue and I think this causes ther error. I tried to use something like

[...]
but this also doesn't work. So what do I have to write in createFields.H that I can use pRefPoint? Do I have to integrate a special header-file or have I just to leave it out?

You mention an error three times, yet don't tell us even once what error it is you are having. Makes it hard to guess a solution.

aloeven September 15, 2010 09:28

Sorry, I didn't notice in your previous post that you are using rhoPisoFoam.

The reference value for the pressure is only needed for the incompressible solvers like simpleFoam or pisoFoam. Since there the actual value of the pressure does not matter, but only the pressure gradient.

For simulations with rhoPisoFoam, you don't need to specify a reference pressure. Even if you specify it in the fvSolution file, it will not be used.

kaifu May 17, 2011 11:15

Hi Alex
Quote:

Originally Posted by aloeven (Post 275269)
SIMPLE
{
nNonOrthogonalCorrectors 0;
pRefPoint (1 0 0.5);
pRefValue 0;
}

how could i lookup a vector instead of a scalar?

If we want to lookup a scalar we use
Code:

int pRefValue(readInt(piso.lookup("pRefValue")));
And furthermore, if we made it, and how could we apply pRefPoint instead of pRefCell?
Code:

setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
I noticed that both in pisoFoam and simpleFoam, the codes is written as,
Code:

    label pRefCell = 0;
    scalar pRefValue = 0.0;
    setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);

@createFields.H

It seems that the value "pRefCell and pRefValue " read from system/fvSolution is useless since pRefCell and pRefValue is given in createFields.H.

// Kai


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