CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Writing particle properties to the grid cells they are in (http://www.cfd-online.com/Forums/openfoam-programming-development/98257-writing-particle-properties-grid-cells-they.html)

piccinini March 6, 2012 19:46

Writing particle properties to the grid cells they are in
 
Hello,

I've used the code bellow in dieselFoam.C of dieselFoam 1.7.1 to write some particle properties to the grid cells particles are in. The code compiles and runs in serial, but hangs when running in parallel mode. Anybody could help me?

Quote:


if (runTime.write())
{

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Output parcel properties to grid cells
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

drop_m= 0.0*drop_m;
drop_T= 0.0*drop_T;
drop_smd= 0.0*drop_smd;
drop_U= 0.0*drop_U;

spray::iterator mol(dieselSpray.begin());

for (mol = dieselSpray.begin(); mol != dieselSpray.end(); ++mol)
{
label cellI=mol().cell();
drop_m[cellI]+=mol().m();
}

for (mol = dieselSpray.begin(); mol != dieselSpray.end(); ++mol)
{
label cellI=mol().cell();
drop_T[cellI]+=mol().m()*mol().T()/drop_m[cellI];
drop_U[cellI]+=mol().m()*mol().U()/drop_m[cellI];
drop_smd[cellI]=dieselSpray.smdcell(cellI);
}


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

drop_m.write();
drop_U.write();
drop_T.write();
drop_smd.write();
}
thanks

piccinini March 6, 2012 21:49

it seems to hang in this function:

Quote:

scalar spray::smdcell(const label thisCell) const
{
scalar numerator = 0.0, denominator = VSMALL;

for
(
spray::const_iterator elmnt = begin();
elmnt != end();
++elmnt
)
{
label celli = elmnt().cell();
if (thisCell == celli)
{
scalar Pc = p()[celli];
scalar T = elmnt().T();
scalar rho = fuels_->rho(Pc, T, elmnt().X());

scalar tmp = elmnt().N(rho)*pow(elmnt().d(), 2.0);
numerator += tmp*elmnt().d();
denominator += tmp;
}

}

reduce(numerator, sumOp<scalar>());
reduce(denominator, sumOp<scalar>());

return numerator/denominator;
}

as the problem disappeared when I commented it out.


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