CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Time step continuity error unit (https://www.cfd-online.com/Forums/openfoam-post-processing/179818-time-step-continuity-error-unit.html)

tdog November 8, 2016 03:53

Time step continuity error unit
 
Hello
I am trying to figure out the unit of the global time step continuity error. Is it in percent, in decimal percent, or something else entirely?

I hope someone can help :-)

tdog November 14, 2016 08:18

No one knows?

tdog December 1, 2016 08:01

Anybody knows?

decah December 2, 2016 14:55

Hi Thomas

It's a scalar field representing the sum of all the deviations in the continuity equation (grad.u=0) over all cells. Therefore it is representing flux, not percentages!

Take a look a the continuityErrs.H file in
Code:

src/finiteVolume/cfdTools/incompressible/continuityErrs.H
and also this post:
http://www.cfd-online.com/Forums/ope...tml#post201896

tdog December 5, 2016 08:33

Quote:

Originally Posted by decah (Post 628019)
Hi Thomas

It's a scalar field representing the sum of all the deviations in the continuity equation (grad.u=0) over all cells. Therefore it is representing flux, not percentages!

Take a look a the continuityErrs.H file in
Code:

src/finiteVolume/cfdTools/incompressible/continuityErrs.H
and also this post:
http://www.cfd-online.com/Forums/ope...tml#post201896

Hi, thanks for replying :-)
Ok, so flux, but in what unit? I saw that in the post linked it was for incompressible flow, I'm running rhoSimplecFoam, which is for compressible flows, so the the continuity error file looks like this instead:

{
dimensionedScalar totalMass = fvc::domainIntegrate(rho);

scalar sumLocalContErr =
(fvc::domainIntegrate(mag(rho - thermo.rho()))/totalMass).value();

scalar globalContErr =
(fvc::domainIntegrate(rho - thermo.rho())/totalMass).value();

cumulativeContErr += globalContErr;

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

If using SI units, the difference between rho and thermo.rho must be in kg/m^3, right? And the total mass is a volume integral over rho, so that must be in kg? I am unsure what value value() takes, but according to the thread it's usually 1, but in what unit?

So that means the unit of globalContErr is 1/m^3 is that correct? How do I then normalise this so I can get it in percentage?

decah December 5, 2016 21:20

I don't work with compressible flows myself, but after running an incompressible simulation I can go to any one of the time directories in the case folder and look at the phi file. Near the top I find: dimensions [0 3 -1 0 0 0 0]; which tells me the units of phi (and therefore units of the time step continuity error in my case) is m3/s (i.e. volume flux).

So you can double check your rho files for the units but it looks to me like your units are rho/mass = (kg/m3)/(kg) = m-3.

tdog December 6, 2016 10:12

Hey decah, thanks for replying.

Ok, from that it seems like my flux is mass flow with units kg/s. Do I need to compute the mass flux at the inlets in order to normalise the continuity errors?

decah December 6, 2016 15:21

I'm not sure what you mean by 'normalise' the errors, but if you want to compute mass flux at inlet you can run

Code:

postProcess -funcs '(flowRatePatch(name=inlet))’

tdog December 9, 2016 09:58

Quote:

Originally Posted by decah (Post 628546)
I'm not sure what you mean by 'normalise' the errors, but if you want to compute mass flux at inlet you can run

Code:

postProcess -funcs '(flowRatePatch(name=inlet))’

Okay, so if the continuity error is a deviation between what comes into the system and what comes out, then by calculating the flux of the inlet, I should be able to find the global error in percentage by the following formula:

globalContErr/flux_inlet*100

?


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