operation of MultiTensorField3D by dimensions

Hi everyone,

I defined a MultiTensorField3D<T,3> to store the velocity.
How can I operate the tensor by dimensions?
for example , I want to multiply the first dimension of one tensor and the second dimension of the second tensor and then store the result to the first dimension of the third tensor.

It seems that I can’t directly access the dimension like MultiTensorField3D[1]?
How should I operate it?

your best wishes


you can use the function extractComponent (located in src/dataProcessors/dataAnalysisWrappers3D.h,hh). It takes your MultiTensorField3D, the index of the dimension you want to extract, and if needed the bounding box and outputs a MultiScalarField3D.

Hope it helps,

Mr Orestis,
Thank you for your focus.

Yeah, I used extractComponent and it partly covered my problem.
extractComponent can extract one component of tensorfield to a new scalarfield.

But I want to operate the component of the tensorfield directly, which still makes the tensorfield intact.

For example, I thought the MultiTensorField3d doesn’t provide a method to access a component directly such as


best wishes,

The is no [ ] operator for the MultiTensorField that is correct. Still I am not sure what you want to achieve. Maybe with more details I can give you some better advice.


I’m also not sure what you want to do…
However, as last resource, you can write your own DataProcessor for performing the operations you need.

You can access the single component of a MultiTensorField3D using:


Of course, in this way, you need to access all the “cells” of the tensorField in a “for loop”. As you maybe know, you MUST do this in a DataProcessor.

Let’s now assume that you know how to write a DataProcessor which “contains” 3 tensorFields, you can write (inside the method process, inherithed from the class BoxProcessingFunctional):

tensor3.get(iX,iY,iZ)[0] = tensor1.get(iX,iY,iZ)[0]*tensor2.get(iX,iY,iZ)[1]

There are other things you should be aware, like offsets between the blocks and modifications, but essentially this will do the job.

Referring to what you wrote, you wanted to do:


As Malaspin said, you achive this using the the wrapper function extractComponent. Smth like:

extractComponent(tensor, scalar, 1);

This will take the second dimension of the MultiTensorField3D and load it in a MultiScalarField3D (the methid can take a Box3D domain if needed).

Hope this helps!

I’m sorry for confusing you.

Actually, I’m trying to calculate the Reynolds stress <u’v’>, <u’w’> and <v’w’>
For example, as you know, <u’v’>=-, where <> means time average.
to do that, first I have to get uv, which means the first component of velocity multiply the second component.

Therefore, I want to create a Multitensorfield, which three components are uv, uw, vw. I want to do this kind of calculation:

MultiTensorfield[0]=velocity[0] * velocity[1]
MultiTensorfield[1]=velocity[0] * velocity[2]
MultiTensorfield[2]=velocity[1] * velocity[2]

I hope I explained clearly.

best wishes,


actually there is a wrapper to do that.

It is called computeInstantaneousReynoldsStress normally. You need to create a MultiTensorField3d to store the average velocity field and fill it with UpdateAveTensorTransientStatistics3D.

Hope it helps

Mr Orestis,

Thanks a lot! This is just what I need.

best wishes,

Mr Orestis,

Though I got the Reynolds stress Tensor with computeInstantaneousReynoldsStress, I found a small problem .

When I wrote it to the vtk, the paraview shows the reynolds stress tensor as the order of “XX,YY,ZZ,XY,YZ,XZ”
But when I analyzed the data , I found that the real order was “XX, XY, XZ, YY, YZ, ZZ”.
That means the real stress is XY where it is shown as YY in the paraview.

Maybe its a bug with paraview or just I did somthing wrong.

best wishes,