[Paraview] OpenFOAM Reader - Showing multiple velocity components simulaneously

Christian Butcher christian.butcher at oist.jp
Thu Nov 27 03:12:12 EST 2014


Dear ParaView list,

I'm currently trying to open multiple 'RenderView' windows so that I
can show, for example, U_x, U_y, and U_z along with U_Magnitude
simultaneously for the purpose of exporting an animation using
ParaView-v4.2.0.

Studying a Python trace whilst switching components using the Qt GUI
suggests this is not trivially possible using either the GUI or a
Python shell.

The Python trace shows these lines:
   uLUT = GetColorTransferFunction('U')
   uLUT.VectorMode = 'Magnitude'
and switching to, for example, U_y requires
   uLUT.VectorMode = 'Component'
   uLUT.VectorComponent = 0

Since the uLUT proxy is returned by the GetColorTransferFunction('U')
function, I'm unsure but doubting that I can duplicate this proxy and
set different values in different Views.

Duplicating data files allows the reading of a file multiple times,
but isn't really practicable given memory constraints etc.

Looking at the OpenFOAM reader in vtkOpenFOAMReader.{h,cxx} and
vtkPOpenFOAMReader.{h,cxx} suggests that the relevant function to
modify in the reader might be

    vtkFloatArray *vtkOpenFOAMReaderPrivate::FillField(vtkFoamEntry
*entryPtr, int nElements, vtkFoamIOobject *ioPtr, const vtkStdString
&fieldType)
.P
but since this has to return a (single) vtkFloatArray*, I'm unsure if
any modifications are likely to help me.

The 'U' field can be identified using statements like:
    if (ioPtr->GetObjectName() == "U") { // process here }
Individual components are accessible using:

    data = static_cast<vtkFloatArray *>(entry.Ptr());
    float *tuple = data->GetPointer(nComponents * tupleI);
    tuple[0] = xValueOfVelocityForCellReferedToByTupleI;

etc.

The function can be found around line 6480 in vtkOpenFOAMReader.cxx

Does anyone have an idea I could use to simultaneously display
different velocity components (and magnitude, if possible, but this
can be coded into a 4th component fairly easily I suspect, if only
individual components could be simultaneously shown)?

Best,

Christian Butcher


More information about the ParaView mailing list