CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   help with velocity boundary condition potentialFoam (http://www.cfd-online.com/Forums/openfoam-solving/102650-help-velocity-boundary-condition-potentialfoam.html)

 hfc May 30, 2012 18:44

help with velocity boundary condition potentialFoam

Hi,

I am new to the forum and not a CFD specialist. I am interested in the potentialFoam solver of OpenFOAM because I want to solve the Poisson equation with given velocity boundary conditions. I am currently trying to apply the potentialFoam solver on a rectangular domain. I would like to define velocity boundary conditions on two opposing faces of the rectangle and zero gradient on the other two. I have set up the U and p input files as follow:

p input file:
-----------

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

internalField uniform 0;

boundaryField
{
inflow
{
type calculated;
}

outflow
{
type calculated;
}

side
{
}

defaultFaces
{
type empty;
}
}

U input file:
-----------

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

internalField uniform (0 0 0);

boundaryField
{
inflow
{
type fixedValue;
value uniform (0.707 0.707 0);
}

outflow
{
type fixedValue;
value uniform (0.707 0.707 0);
}

side
{
}

defaultFaces
{
type empty;
}
}

where 'inflow' and 'outflow' are the opposing faces with velocity BC. I tried to solve this case, but I get the following error:

FOAM FATAL ERROR:

gradientInternalCoeffs cannot be called for a calculatedFvPatchField on patch outflow of field p in file "/home/user/Projects/Foam/case/block_test1/0/p"
You are probably trying to solve for a field with a default boundary condition.

From function calculatedFvPatchField<Type>::gradientInternalCoef fs() const in file /opt/openfoam210/src/finiteVolume/lnInclude/calculatedFvPatchField.C at line 186.

I also tried setting the pressure boundary conditions on 'inflow' and 'outflow' to zeroGradient instead of calculated, which works, but the resulting velocity field is always perpendicular to these boundaries, even if the boundary velocities that I impose are not.

Does anybody have a suggestion to correct this? Maybe I am not using the right type of boundary conditions for the problem that I have in mind. If so, which other boundary condition should I use?

thanks,
Hon Fai

 kmooney May 31, 2012 09:17

Perhaps give this a try on the inflow and outflow patches. I don't have much experience with potentialFoam however. For most of the incompressible PISO solvers you need to have pressure defined somewhere to make the solution unique.

Code:

```inflow     {         type zeroGradient;     }     outflow     {         type fixedValue; value uniform 0;     }```

 hfc May 31, 2012 19:52

Hi,

Thanks for the suggestion. I have tried what you suggested, but the output velocity does not match the boundary values that I input. The pressure distribution stays uniform across the 'inflow' boundary, and the velocities remain perpendicular to the boundary. From what I understand, the velocity is not explicitly solved for in potentialFoam, but only corrected with the calculated pressure. So perhaps I need to reformulate the Poisson equation in a mixed approach that explicitly solves for the velocity and the pressure? I haven't figured out yet how to do this.

thanks,
Hon Fai

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