CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Post-Processing (
-   -   Check mass continuity (

andimb March 22, 2006 06:42

Hi! Is there an easy way to

Is there an easy way to check the mass continuity (incompressible) at the Inlet compared to the Outlet? I never wrote something in C++, so it would be hard to write some code. I'm just used to FORTRAN and Java.

If there's now easy way I could use the liftDrag tool as example, right? This is quit near to this.

The mass continuity for an incompressible flow is defined as div U = 0. Could I use that for a check.


andimb March 22, 2006 09:11

Hi! I found the button in p

I found the button in paraView to integrate over surfaces. So it is ok


hjasak March 23, 2006 07:39

Write a little code and do a s
Write a little code and do a sum of the fluxes, e.g.


Remember, the flux going out is positive and the one going in is negative.

The local and global continuity data also gets reported during the run - have a look at your log file or the implementation. For incompressible flows src/cfdTools/incompressible/continuityErrs.H does the sum over all cells:

scalar sumLocalContErr = runTime.deltaT().value()*
mag(fvc::div(phi))().weightedAverage(mesh.V()).val ue();

scalar globalContErr = runTime.deltaT().value()*
cumulativeContErr += globalContErr;

Info<< "time step continuity errors : sum local = " << sumLocalContErr
<< ", global = " << globalContErr
<< ", cumulative = " << cumulativeContErr
<< endl;



tak April 13, 2006 11:20

Hi, I have calculate a tuto

I have calculate a tutorial case "pitzDaily" with transports of chmical species (H2,O2,N2....) by means of reactingFoam (no reaction).
Could you please teach me how to calculate the material balances of chemical species ?

Now, I can calculate mass flow rates at the inlet and outlet like this:
label inletPatchi = mesh.boundaryMesh().findPatchID("inlet");
scalar inFlux = sum(phi.boundaryField()[inletPatchi]);
But I can't calculate mass flow rates of chemical species at the inlet and outlet.

Thanking you in advance for your help,


tak April 14, 2006 03:02

Sorry, it's so easy to calcula
Sorry, it's so easy to calculate mass flow rate of chemical specie Y[i] at an inlet.

scalar inFlux =
* sum(rho.boundaryField()[inletPatchi]
* Y[i];


suredross June 4, 2008 05:28

Hi all, i can see that phi(fl
Hi all,
i can see that phi(flux)is calculated for each time step and has entries for each comes the question:how does one verify that mass continuity and or conservation is achieved?is it by looking at the entries in the phi file and making sure that they are the same,taking into account the + and - signs correspond to outlet and inlet values?or am i totally wrong?
thanks for the help.


All times are GMT -4. The time now is 01:21.