CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

IcoFoam strange behaviour when gravity is included

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 2 Post By hjasak

Reply
 
LinkBack Thread Tools Display Modes
Old   April 4, 2008, 02:56
Default Dear OpenFoamers, after som
  #1
New Member
 
nicasch
Join Date: Mar 2009
Posts: 23
Rep Power: 8
nicasch is on a distinguished road
Dear OpenFoamers,

after some time spent in unsuccessfully trying to implement a relatively simple thing (like gravity) into a relatively simple application (like icoFoam), I decided to post this message.
I want to simulate laminar 2D fluid column at rest in a closed cavity, in order to obtain a hydrostatic pressure distribution with no velocity. I use icoFoam with the standard cavity tutorial. I changed the application and included gravity force into momentum equation. I also changed things for the PISO to account for the additional source in calculating pressure. The code looks like this:

fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)
);

solve(UEqn == -fvc::grad(p) + gC); // gC is volVectorField (0 -9.81 0)

// --- PISO loop

for (int corr=0; corr<nCorr; corr++)
{
volScalarField rUA = 1.0/UEqn.A();

U = rUA*UEqn.H();

phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi)
+ (fvc::interpolate(rUA*gC) & mesh.Sf()); // gC added to interpolated UEqn.H()

adjustPhi(phi, U, p);

for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::laplacian(rUA, p) == fvc::div(phi)
);

pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();

if (nonOrth == nNonOrthCorr)
{
phi -= pEqn.flux();
}
}

# include "continuityErrs.H"

U -= rUA*(fvc::grad(p));
U.correctBoundaryConditions();
}

The application compiles, but after running on cavity-case I always obtain very strange results of 2 kind:

1. BC: velocity fixedValue = (0 0 0), pressure zeroGradient at all walls. After a couple of time steps I obtain a message of continuity errors ?!

--> FOAM FATAL ERROR : Continuity error cannot be removed by adjusting the outflow.
Please check the velocity boundary conditions and/or run potentialFoam to initialise the outflow.
Specified mass inflow : 3.23118e-06
Specified mass outflow : 3.23187e-06
Difference : 6.90589e-10
Adjustable mass outflow : 0

2. When I change pressure BC on the top Wall to totalPresure, I obtain a suspiciously looking pressure distribution and, more interesting, there is some flow within closed cavity of zero velocity at walls?!



I wonder if anyone would know why this happens? I believe that the implementation of gravity is OK, or not?

Best Regards.
nicasch is offline   Reply With Quote

Old   April 4, 2008, 03:12
Default here are pressure and velocity
  #2
New Member
 
nicasch
Join Date: Mar 2009
Posts: 23
Rep Power: 8
nicasch is on a distinguished road
here are pressure and velocity distributions after 5 seconds

pressure



velocity


nicasch is offline   Reply With Quote

Old   April 4, 2008, 03:48
Default No, not that easy. The closes
  #3
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,757
Rep Power: 21
hjasak will become famous soon enough
No, not that easy. The closest simple solver I can show you is boussinesqBuoyantFoam:

http://openfoam-extend.svn.sourceforge.net/viewvc/openfoam-extend/trunk/Core/Ope nFOAM-1.4.1-dev/applications/solvers/heatTransfer/boussinesqBuoyantFoam/boussine sqBuoyantFoam.C?view=markup


If you start from there and get rid of the energy equation, you will see what happens.

Basically, if you add gravity in incompressible flows in this way, you only added body force and there is no density gradient to counter-act the effect. For example, if you have a closed box with gravity, why would there be flow at all?

Hrv
Tushar@cfd and mgg like this.
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   April 4, 2008, 04:29
Default Hmmm... Thank You Hrv. Well y
  #4
New Member
 
nicasch
Join Date: Mar 2009
Posts: 23
Rep Power: 8
nicasch is on a distinguished road
Hmmm... Thank You Hrv.
Well yes, of course, there should not be any flow in such situation, that is what bothers me.
I disabled TEqn in boussinesqBuoyantFoam, but it still behaves like icoFoam without gravity. P and U are zero overall.
What I need is a simple static fluid with hydrostatic pressure distribution. I saw in my email-client that I didnot receive the whole message I've posted, there are some parts missing. If you look at the post, the things in my modified icoFoam are (I believe) the same as in boussinesqBuoyantFoam, except that I added the g-term into UEgn and into interpolated UEqn.H() needed by the PISO.
It must be possible to obtain a fine hydrostatic pressure distribution in a closed cavity for incompressible fluid without density gradient.
I must miss something really bad (
nicasch is offline   Reply With Quote

Old   June 24, 2009, 09:45
Default
  #5
Member
 
Julien Schaguene
Join Date: Apr 2009
Location: France
Posts: 55
Rep Power: 8
Schag is on a distinguished road
Hello nicasch,

I wonder if you found the solution to implement such a solver. I'm at the time trying to do quite the same thing with turbFoam, but I need gravity to simulate a flow through a dam.
I don't want to use a multiphase solver because I want to minimise the control volume (and by the way the mesh...).

So, did you found something?

Best regards
Schag is offline   Reply With Quote

Old   August 29, 2014, 10:09
Default
  #6
New Member
 
rama13's Avatar
 
Damiano Natali
Join Date: Mar 2013
Location: Genova, Italy
Posts: 10
Rep Power: 4
rama13 is on a distinguished road
Don't know if it can help, but I found it easier to start from interFoam and taking away all dependencies on alpha
rama13 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange behaviour when using LienCubicKE and NonlinearKEShih hani OpenFOAM Running, Solving & CFD 20 March 6, 2013 11:06
buoyantFoam OF15 very strange behaviour in hotRoom andrea_barbera OpenFOAM Running, Solving & CFD 4 July 30, 2009 09:06
Strange multicomponent source behaviour Zitron CFX 4 July 12, 2007 15:32
Strange Behaviour in CFX-Mesh Kasper CFX 0 May 14, 2007 08:24
Strange behaviour in Coffus Luis Filipe Fabiani Phoenics 0 June 1, 2006 11:23


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