integrateProcessingFunctional for MultiLevelCoupling3D

Hello everyone,

I’m trying the integrateProcessingFunctional for the MultiLevelCoupling3D. For example, I’d like to compute velocity and then use the velocity to compute other quantities every step. Therefore, I learned the gridrefinment3d cases and set my cases as:

  std::auto_ptr<MultiLevelTensorField3D<T, 3>> velocity = generateMultiLevelTensorField3D<T, 3>(lattices.getOgs(), coarsestBoundingBox, levelOfDomain, Array<T, 3>(0.0, 0.0, 0.0));

  std::map<plint, bool> useExecuteInternalProcessors;
  for (plint iLevel = 0; iLevel <= param.finestLevel; iLevel++)
      useExecuteInternalProcessors[iLevel] = false;
  std::vector<std::vector<plint>> ids;
  std::vector<std::vector<std::vector<T>>> results(param.finestLevel + 1);
  const plint statsId = -200;
  bool computeStats = false;

// main loop
for (plint iT = iniIter; iT < iniIter+1000; ++iT)
     lattices.collideAndStream(0, useExecuteInternalProcessors, extProcFunIds, computeStats, statsId, ids, results);
     if (iT == iniIter + 1)
        plint compFields = -100;
        new BoxVelocityFunctional3D<T, DESCRIPTOR>(), coarsestBoundingBox, 0, lattices, *velocity, compFields);

But it did not work. The velocity is always zero. It seems that the integrateProcessingFunctional was not implemented.
I don’t know what’s the problem.

And, in the gridrefinement3d case, I don’t know why compFields = -100? I think that compFields is the level for integrateProcessingFunctional, but the user guide says that the level should be no less than 0.

About other parameters in the collideAndStream, I think extProcFunIds are the vector of the level ID of the integrateProcessingFunctional, that should be implemented. Is that right? And what does computeStats, statsId, ids, results mean?

Thank you.
best wishes,


I have temporarily solved the above problem by setting the level as default 0 so that it can be implemented automatically without the extProcFunIds.:joy:

But I have another question that does any applyProcessingFunction can be transformed into integrateProcessingFunction?

For example, by checking the code of
computeVelocity(MultiLevelCoupling3D, MultiLevelTensorField3D, Box3D domain, plint levelOfDomain)

I know it is nothing but
applyProcessingFunctional (new BoxVelocityFunctional3D<T,Descriptor>(), domain, levelOfDomain, lattices, velocities )

So I try to transform it into
integrateProcessingFunctional(new BoxVelocityFunctional3D<T, DESCRIPTOR>(), domain, levelOfDomain, lattices, velocity, iLevel=0)
to get velocity at every step. And it works well.

But next, when I want to implement “extractComponent”
I found the code for it is just
applyProcessingFunctional ( new ExtractTensorComponentFunctional3D<T,nDim>(iComponent), domain, levelOfDomain, component, tensorField )

So I try
integrateProcessingFunctional(new ExtractTensorComponentFunctional3D<T, 3>(1), domain, levelOfDomain, uComponent, velocity, ILevel=0)

This does not work. uComponent is always zero. But if I change it into

applyProcessingFunctional(new ExtractTensorComponentFunctional3D<T, 3>(1), domain, levelOfDomain, uComponent, velocity)

It works immediately, there are data in the uComponent.

So I wonder whether any function used for applyProcessingFunctional that are built in Palabos can be used for integrateProcessingFunctional directly?

Thank you.
wish best wishes,


Hi steed188,

I am not sure to understand, but it seems you confuse the function of apply integrateProcessingFuncional with applyProcessingFunctional. They have different functions, “integrate” adds an internal processor, while apply “execute” an external defined processor. Internal processors are automatically executed at the collide&stream time.
I think it can help to check the user guide here



Hi mars,
Thank you for your reply. I want to do some data-processing functions after every collideAndStream. Therefore, I want to use integrateProcessing.
But actually, I found that not every data-processing function that provided in Palabos has both integrateProcessing and applyProcessing version.
For example, if I want to compute velocity and extract a component after every collideAndSream step. Usually, we do

computeVelocity(lattice, velocity);
extractComponent(velocity, iDim);

I have many data operations similar to these. But if I do these every step, the efficiency will be low. Therefore, I try to use integrateProcessing functions.
To compute velocity, I found that BoxVelocityFunction3D can be used for both integrateProcessing and applyProcessing, therefore the following code works well

integrateProcessingFunctional(new BoxVelocityFunctional3D<T, DESCRIPTOR>(), domain, levelOfDomain, lattices, velocity, iDim)

But next, if I try to extract a component of the velocity, I found that “ExtractTensorComponentFunctional3D” can only be used for applyProcessing, and it doesn’t work in integrateProcessing. I cannot use the following code

integrateProcessingFunctional(new ExtractTensorComponentFunctional3D<T, 3>(1), domain, levelOfDomain, uComponent, velocity, IDim)

And many other data-processing functions suffer the same problem. Like, to compute strainRate and vorticity, I found their code function is “BoxBulkStrainRateFunctional3D” and “BoxVorticityFunctional3D”. But none of them can be used for integrateProcessing.

Thank you
with best wishes.

1 Like

Why do you say that extract component cannot be used in an integrated way? I think it’s not a problem at all. Do you have a simple example where it’s not working?