Displacement of mesh operator in ParaView

While going through the visualization manual of a software, I encountered the following documentation for visualizing in Visit. Is there anything equivalent in ParaView?

Also related is perhaps this: 4.3.8. Displace operator — VisIt User Manual 2.11 documentation (visit-sphinx-github-user-manual.readthedocs.io)

Sounds like the wrap by vector filter.

This is Chombo hdf5 data and whenever I load it, the wrap by vector filter is unavailable. However, I could do this in VisIt using the instructions in the manual I shared.

This is possible if there’s no 3-component field in the dataset. Assuming that the displacement field is being loaded, is the displacement vector being loaded as three 1-component arrays? If so, you can use the Calculator filter to create a 3-compoment vector out of it.

If you have sample dataset to share, that’ll make it easier to confirm why Warp by Vector may not be available.

I’m unable to find the displacement in ParaView. However, that is available from in VisIt.
I’m sharing one such file: data.0000.hdf5 - Google Drive
@utkarsh.ayachit Please have a look at this and let me know.

Attached is the state file generated with >5.11.0.
warp-by-vector.pvsm (515.9 KB)

2 Likes

I don’t see the displacement field anywhere in ParaView but it gets shown in VisIt on loading the same data. Using velocity to morph doesn’t cause the correct geometry of the simulation (spherical in this case) to be produced. I’m attaching what I get in VisIt for your reference. Things become even messier as turbulence develops in the velocity fields.

For the dataset you shared, there read is not detecting any field named displacement. The only field that resembled a vector field was v? and hence I used that for illustration purposes. It’s possible that the Chombo reader in ParaView needs to be updated to read the displacement field, if it is indeed present in the file. Sounds like a bug. I’d recommend reporting an issue on the issue tracker so the development team can track it down.

In that case, I think probably somehow the Chombo reader on ParaView is missing out the displacement field. This is because the same data on VisIt gets to know this field. Any quick way you can suggest to get this done in ParaView? Can you also direct me where I can post an issue regarding this?

The issue tracker is here: https://gitlab.kitware.com/paraview/paraview/-/issues
I’ll let the dev team comment on prioritization etc.

1 Like

Is there any way how I can read and separately pass the displacement field to ParaView somehow for the time being?
Issue raised here: Chombo reader cannot read displacement field to deal with non-cartesian geometries (#21801) · Issues · ParaView / ParaView · GitLab (kitware.com)

The Displacement field is not stored in the Chombo dataset. It is instead evaluated at read-time, based on “Expressions” stored in the file:

h5dump -g /Expressions data.0000.hdf5 will give you

HDF5 "data.0000.hdf5" {
GROUP "/Expressions" {
   ATTRIBUTE "scalar Phi" {
      DATATYPE  H5T_STRING {
         STRSIZE 84;
         STRPAD H5T_STR_NULLTERM;
         CSET H5T_CSET_ASCII;
         CTYPE H5T_C_S1;
      }
      DATASPACE  SCALAR
      DATA {
      (0): "nodal_constant(Mesh,2.400000e-02)*coords(Mesh)[2]+nodal_constant(Mesh,-1.200000e-01)"
      }
   }
   ATTRIBUTE "scalar R" {
      DATATYPE  H5T_STRING {
         STRSIZE 49;
         STRPAD H5T_STR_NULLTERM;
         CSET H5T_CSET_ASCII;
         CTYPE H5T_C_S1;
      }
      DATASPACE  SCALAR
      DATA {
      (0): "coords(Mesh)[0]+nodal_constant(Mesh,3.500000e+01)"
      }
   }
   ATTRIBUTE "scalar Theta" {
      DATATYPE  H5T_STRING {
         STRSIZE 83;
         STRPAD H5T_STR_NULLTERM;
         CSET H5T_CSET_ASCII;
         CTYPE H5T_C_S1;
      }
      DATASPACE  SCALAR
      DATA {
      (0): "nodal_constant(Mesh,2.500000e-02)*coords(Mesh)[1]+nodal_constant(Mesh,1.450000e+00)"
      }
   }
   ATTRIBUTE "scalar X" {
      DATATYPE  H5T_STRING {
         STRSIZE 21;
         STRPAD H5T_STR_NULLTERM;
         CSET H5T_CSET_ASCII;
         CTYPE H5T_C_S1;
      }
      DATASPACE  SCALAR
      DATA {
      (0): "R*sin(Theta)*cos(Phi)"
      }
   }
   ATTRIBUTE "scalar Y" {
      DATATYPE  H5T_STRING {
         STRSIZE 21;
         STRPAD H5T_STR_NULLTERM;
         CSET H5T_CSET_ASCII;
         CTYPE H5T_C_S1;
      }
      DATASPACE  SCALAR
      DATA {
      (0): "R*sin(Theta)*sin(Phi)"
      }
   }
   ATTRIBUTE "scalar Z" {
      DATATYPE  H5T_STRING {
         STRSIZE 12;
         STRPAD H5T_STR_NULLTERM;
         CSET H5T_CSET_ASCII;
         CTYPE H5T_C_S1;
      }
      DATASPACE  SCALAR
      DATA {
      (0): "R*cos(Theta)"
      }
   }
   ATTRIBUTE "vector Displacement" {
      DATATYPE  H5T_STRING {
         STRSIZE 20;
         STRPAD H5T_STR_NULLTERM;
         CSET H5T_CSET_ASCII;
         CTYPE H5T_C_S1;
      }
      DATASPACE  SCALAR
      DATA {
      (0): "{X,Y,Z}-coords(Mesh)"
      }
   }
}
}

this is of course Visit-specific syntax. It is not difficult to translate that into a Python Programmable Filter. Of course the result of warping your AMR collection of regular cartesian grids would be an AMR collection of structured grids, which ParaView does not support. A quick hack is to convert your data to MultiBlock, then merge it into a single unstructured grid, which can be easily warped by ‘Displacement’. Visit’s Expression would be translated to the following code:

coords = inputs[0].Points 
Phi = 2.400000e-02 * coords[:,2] -1.200000e-01
R = coords[:,0] + 3.500000e+01
Theta = 2.500000e-02 * coords[:,1] + 1.450000e+00
X = R*sin(Theta)*cos(Phi)
Y = R*sin(Theta)*sin(Phi)
Z = R*cos(Theta)
Displacement = make_vector(X,Y,Z) - coords
output.PointData.append(Displacement, "Displacement")
output.PointData.append(mag(Displacement), "Displacement_magnitude")

P.S. This is a proof-of-concept. A proper solution would be to conserve the multiblock structure in the Python programmable filter.

warp-by-vector+Expression.pvsm (997.1 KB)

3 Likes

@jfavre Wow! This is extremely detailed. Thanks a lot for taking so much time to look into this. This works although I get an error message. For a larger dataset (around 13 GB). Most probably MergeBlocks take forever and ParaView crashes maybe due to RAM overflow.
On loading the state and choosing the file, I get this error.

EDIT:
I was able to run larger data with pvserver on a cluster. While VisIt was able to do this on my PC ParaView needed a cluster. This is probably because the filter is unable to the AMR grid directly on ParaView. Comparison of slice with VisIt is not exact but they are very close and can do a decent job for the time being.

How can one write something like this?

A working solution for the multi-block structure is available in the state file attached.
warp-by-vector+Expression.1.pvsm (325.7 KB)

2 Likes

@jfavre Thanks a lot. This is awesome. It is working and is much more responsive and much less memory demanding with larger data compared to the previous one you shared.

Can you please share some article/resources that has documentation and tutorials on using these custom Programmable filters?

Now for the larger dataset, I didn’t need a cluster and I could do it in my PC with just ParaView client. Also, the VisIt and ParaView dumps are identical.

1 Like

https://docs.paraview.org/en/latest/ReferenceManual/pythonProgrammableFilter.html#

1 Like