CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Pre-Processing (
-   -   FvSolution pRefCell and pRefValue (

maka October 17, 2005 04:54

Can any one explain a little a
Can any one explain a little about how to set pRefCell and pRefValue in fvSolution dictionary since they have been introduced in 1.2.

I changed the mesh for channelOodles and I got a warning message about pRefCell. Thanks.

nCorrectors 2;
nNonOrthogonalCorrectors 0;
pRefCell 1001;
pRefValue 0;


hjasak October 18, 2005 11:10

If you have an incompressible
If you have an incompressible flow in a domain where none of the boundaries uses a fixed value (or similar) boundary condition, the value of the pressure in the system is indeterminate to a constant. Iterative solvers dont like that because the solution can jump and down, so we need to do tricks to make sure it does not happen.

The way to do this is to specify the pressure level in one cell. Previously, this used to be cell zero with value zero and hard-coded in the solver, but this causes trouble when the cell is next to a coupled boundary. The new entries allow you to control in which cell the pressure is given and to which level.


suraj April 30, 2009 15:44

What is done with pdRefCell and pdRefValue when atleast one of the boundaries has a a fixed value of pressure specified? Is pdRefValue still used then?


Nicole October 15, 2014 05:19

Hi Suraj,

I see this is a very old post, but did you ever find an answer to your question bout the fixed boundary pressure?


ArathoN October 22, 2014 14:17


Originally Posted by Nicole (Post 514415)
Hi Suraj,

I see this is a very old post, but did you ever find an answer to your question bout the fixed boundary pressure?


You need to see the solver files and code. In the case of PIMPLE, they are first initialized to zero then it is used a look-up function to scrape their values from fvsolution

from createFields.H

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

Now if you look at the pEqn.H file, in the pressure corrector loop:

    fvScalarMatrix pEqn
        fvm::laplacian(rAUf, p) == fvc::div(phiHbyA)

    pEqn.setReference(pRefCell, pRefValue);


And here it is used the referenced pressure.

IMO if there is no declaration of pRefCell or pRefValue in pimple they will not created by createFields.H

setRefCell(p, mesh.solutionDict().subDict("PIMPLE"), pRefCell, pRefValue);
So in case of a well-conditioned problem with dirichlet (or mixed) pressure BC, the pRefValue should not be considered.

EDIT: at fvCFD.H included in pimplefoam you'll find the findRefCell.C where it is defined the serRefCell function:

if (fieldRef.needReference() || forceReference)

So if there is a need to define a reference pressure it will be used otherwise they are neglected.However i can't find where ".needReference()" is define, whis is the function that will tell the solver if it needs or not pRefCell. If i found out something i'll update the post.

EDIT2: I've found it, the function "needReference" is defined GeometricField.C as such:

bool Foam::GeometricField<Type, PatchField, GeoMesh>::needReference() const
  // Search all boundary conditions, if any are
  // fixed-value or mixed (Robin) do not set reference level for solution.
  bool needRef = true;
  forAll(boundaryField_, patchi)
  if (boundaryField_[patchi].fixesValue())
  needRef = false;
  reduce(needRef, andOp<bool>());
  return needRef;

Now you have the complete picture of how the "referencing process" works on OF.

Nicole February 17, 2015 04:00

Thank you so much for your well-explained response. Sorry for only replying now, but we did find your response very useful!


All times are GMT -4. The time now is 03:49.