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/)
-   -   Access particle data in main function (http://www.cfd-online.com/Forums/openfoam-programming-development/90679-access-particle-data-main-function.html)

moritzhoefert July 18, 2011 12:20

Access particle data in main function
 
Hello,

I would like to write a post processing tool for Euler-Lagrange-Simulations that reads particle properties and stores for each cell the particle mass weighted velocity of all particles located in the respective cell.

I created a vector field:
Code:

   
volVectorField effU
    (  IOobject
        (  "effU",
            mesh.time().timeName(),
            U.mesh(),
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedVector("effU", dimensionSet(0,1,-1,0,0,0,0), vector(0,0,0))
    );

I was also able to create a loop through something that is related to the particles:
Code:

   
forAll(parcels, pI)
    { 
        Info << pI << endl;
    }

Within that loop I would like to do someting like this ("pseudocode")
Code:

forAll(parcels, pI)
{  Foam::label cellI = parcels[pI].cell();
  effU[cellI] += parcels[pI].Volume()*parcels[pI].rho()*parcels[parcelI].U();
  w[cellI] += parcels[pI].Volume()*parcels[pI].rho();
}
effU = effU/w;

How can I access particle velocities, diameters and IDs of the cells the particles are located in within the above loop or rather how can I make the above idea work in OF?

I am sorry that I ask such a basic question but I have never programmed on that level in OpenFOAM. Thank you for any help!

All the best,
Moritz

Remark:
The template solver for my post processing tool is porousExplicitSourceReactingParcelFoam from OF 2.0.x.


All times are GMT -4. The time now is 17:35.