CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   mass does not conserve in Openfoam (

conceptone September 23, 2012 19:40

mass does not conserve in Openfoam
2 Attachment(s)
Hi guys, right now I am running SprayFoam using C12H26. And I found the mass does not conserve(figure 1). So the liq+gas mass != injected mass. The input is mass flow rate data from Engine Combustion Network Website and the injected mass should be calculated by the data. However, actually the mass conserves, I mean I calculated the injected mass by using the mass flow rate data to integrate with time numerically by Matlab and found the two lines meet together!(figure 2) So actually the calculation for liq+gas mass is correct. I guess this should be caused by some coding bug problem, which is not correct for the injected mass calculation(the "Total mass injected" term in output file). Since I am not familiar with C++, I need this help for correcting the bug. Thanks!

niklas September 24, 2012 15:03

are you injecting into a closed volume?

what is the convergence criteria for the pressure solver?

conceptone September 24, 2012 20:05

Hi, right, I am injecting into a closed volume, which is a cuboid. I don't know what is the convergence criteria for pressure solver, where can I check this?

Today I plus some debug codes in openfoam's code, specifically in InjectionModel.C:
(first plus in line 479):

// Pad injection time if injection starts during this timestep
const scalar padTime = max(0.0, SOI_ - time0_);

//for Debug
Info<<"unsteady condition-newParcels:"<<newParcels<<endl;

// Introduce new parcels linearly across carrier phase timestep
for (label parcelI = 0; parcelI < newParcels; parcelI++)
(second plus in line 561)

if (pPtr->move(td, dt))
massAdded += pPtr->nParticle()*pPtr->mass();
Info<<"unsteady condition-massAdded:"<<massAdded<<endl;
(third plus in line 572):

Info<<"unsteady condition-Total massAdded:"<<massAdded<<endl<<endl;

postInjectCheck(parcelsAdded, massAdded);
And after I run the case again, the output file outputs:
unsteady condition-newParcels:96 (the number is varying,should be all right)
unsteady condition-Total massAdded:0 (the number is always 0, unusual!)
since massInjected += returnReduce (massAdded)=massAdded, and the output injected mass is massInjected term, there should be some fatal problem here.

pushkaraj January 10, 2013 02:18

hi conceptone

i am also trying to use sprayfoam for the spray A data given on ECN network...

I f you have solved the issue can you share me your files regarding dodecane specially spraycloud properties??
i am unable to determine the mass flow rate profile data.... how did u determine that?


conceptone February 3, 2013 17:14

hi, sorry for the delay
you can tell me your email address, I will send you the file

pushkaraj February 8, 2013 04:35

my email id:

thanks in advance

All times are GMT -4. The time now is 00:41.