CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Strange results from interFoam solution converges but sum of all forces not equal to zero (

nicasch April 15, 2008 02:01

Dear users of OpenFOAM, the be
Dear users of OpenFOAM, the best CFD-software in the world,

I have a "simple" question. While calculating the standard damBreak case from the tutorial, I want to compute various forces acting on fluids in each cell. After adding volumetric fields to the solver for every force separately, I noticed a very big disagreement in their sum.
What I mean is the following:
When the momentum equation converges in every time step, it means that the left hand side of the equation is equal to the right hand side, up to the residual level, i.e.:

(inertial force) = (all acting forces) + (small residual).

Now, if I want to compute the difference of these forces, it should be like this:

(inertial force) - (all acting forces) = (small residual).

After I added the following code to the interFoam solver, just before the end of the time loop:

volVectorField sumAllForces
fvc::ddt(rho, U)
+ fvc::div(rhoPhi, U)
- fvc::laplacian(muf, U)
- (fvc::grad(U) & fvc::grad(muf))
- fvc::reconstruct
fvc::interpolate(interface.sigmaK())*fvc::snGrad(g amma)
- ghf*fvc::snGrad(rho)
- fvc::snGrad(pd)
) * mesh.magSf()

the problem is that I obtain very high values for sumAllForces, in some cells on the order of 100, although the value for sumAllForces should be very small?! How can this be?! Something in the above field seems to be calculated wrong. But the field sumAllForces is practically nothing else but the difference of the terms from the momentum equation. I also tried this after the solution was obtained, by writing a post-processing utility, and I obtained values which were even greater (on the order of 10000!?)
Why is this happening? Every term in the code above is discretized using the same schemes from the case as in the momentum equation itself. Yet the sum of all forces is never nearly equal to zero?!
I would be very very grateful if someone of you would have a solution for this.

Many thanks in advance and Best Regards.

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