CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Boundary condition setting for adding gravity in simpleFoam (https://www.cfd-online.com/Forums/openfoam-programming-development/112945-boundary-condition-setting-adding-gravity-simplefoam.html)

norkistar February 8, 2013 06:51

Boundary condition setting for adding gravity in simpleFoam
 
Hi Foamers,

I am just starting simulation water flow in a horizontal circular pipe. Without adding gravity, it works well. With adding gravity, it can't converge. The result diverse and become unbelievable. I think problem might due to the boundary condition setting for p. I will list the step that I did for adding the gravity. Your kindly attention would be much appreciated.

1 I add g in the createFields.H as follows
Info<< "Reading g\n" << endl;
uniformDimensionedVectorField g
(
IOobject
(
"g",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);

2 I make change to UEqn.H
eqnResidual = solve
(
UEqn() == -fvc::grad(p)+g
).initialResidual();

3 I make change to pEqn.H
U -= (fvc::grad(p)-g)/AU;

After that, I wmake to make these changes take effect.

In the constant folder, the g file is listed as follow
dimensions [0 1 -2 0 0 0 0];
value ( 0 0 -9.81 );

In the 0 folder, the p is setting as previous simulation which is without gravity
dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
inlet
{
type zeroGradient;
}
tubewall
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
plane
{
type symmetryPlane;
}
}

ziemowitzima February 14, 2013 11:59

I would suggest you to look into solvers where gravity is implemented, such as:
multiphase and heat transfer solvers.

norkistar February 15, 2013 19:06

Thanks for your kind attention. I have looked into the heat transfer solvers and I use buoyantSimpleFoam now it works

Mahmoud Abbaszadeh June 15, 2022 04:20

Quote:

Originally Posted by norkistar (Post 408142)
Thanks for your kind attention. I have looked into the heat transfer solvers and I use buoyantSimpleFoam now it works



Hi,

Could you please share with us what you have done? Many thanks.


All times are GMT -4. The time now is 04:36.