multimaterial data, NaNs and Catalyst V2

Hello

I have a simulation that has multiple materials. So, I’m thinking that the easiest way to handle this is to put NANs in the cells for which there is no data for that material. That seems to work, and the NAN cells are being displayed as yellow. Is there a way to threshold out the NAN cells and not show them at all in ParaView?

What is the recommended way to handle multi material in Catalyst 2?

Pascal

Threshold should remove them but you can also make them transparent using NaN opacity.

What is the recommended way to handle multi material in Catalyst 2?

@nicolas.vuaille @Lucas_Givord @Francois_Mazen

I just saw the NaN opacity which I am now setting to transparent. That seems to be doing it for me.

So, the NaN opacity actually does not work correctly. There are values that are not NaN that get hidden thus producing the wrong results. I found that out by looking at the spreadsheet; there are values that not NaNs in the csv view but are not visible in the rendered view.

What actually seems to work is to use the threshold filter and set the values of min and max to the minimum allowed and maximum allowed threshold values respectively.

So, is there a bug in the NaN opacity filter?

Please share a screenshot of the issue.

Below is an example that I made. The correct one is the thresholded one.

Original:

Setting opacity to 0 for nan; a face is missing:

Thresholding:

The thresholded version is correct.

Sample code:

// Vertices:                    0  1  2  3  4     5 
    std::vector<float> _coordsX = { 0, 0, 1, 1, 0.5,  0.5};
    std::vector<float> _coordsY = { 0, 0, 0, 0, 1,   -1};
    std::vector<float> _coordsZ = { 0, 1, 0, 1, 0.5,  0.5};


    //                                       0       1     2      3      4     5      6     7      8       9     10     11     12
    // Faces                                 A       B     C      D      E     F      G     H      I       J     K       L      M
    std::vector<int> _faceConnectivity = {0,1,2, 0,1,4, 1,2,4, 0,2,4, 1,3,4, 3,2,4, 2,1,4, 3,2,1, 0,1,5, 1,5,2, 0,5,2, 1,5,3, 3,5,2};    
    std::vector<int> _faceSize =   {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3};
    std::vector<int> _faceOffset = {0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36};

    std::vector<int> _tetConnectivity = {0,1,2,3,  4,5,6,7, 0,8,9,10, 7,11,12,9}; 
    std::vector<int> _tetSize = {4, 4, 4, 4};
    std::vector<int> _tetOffset = {0, 4, 8, 12};

    float nan = std::nanf("1");
    std::vector<float> _valuesFaces = {10, 20, nan, 40};
    std::vector<float> _valuesVertex = {5, 10, 15, 20, 25,30};


    // create an explicit coordinate set
    mesh["coordsets/coords/type"].set("explicit");

    mesh["coordsets/coords/values/x"].set_external(&_coordsX[0], _coordsX.size());
    mesh["coordsets/coords/values/y"].set_external(&_coordsY[0], _coordsY.size());
    mesh["coordsets/coords/values/z"].set_external(&_coordsZ[0], _coordsZ.size());



    // add an unstructured topology
    mesh["topologies/mesh/type"].set("unstructured");
    mesh["topologies/mesh/coordset"].set("coords");

    mesh["topologies/mesh/elements/shape"].set("polyhedral");
    mesh["topologies/mesh/elements/connectivity"].set_external(&_tetConnectivity[0], _tetConnectivity.size());
    mesh["topologies/mesh/elements/sizes"].set_external(&_tetSize[0], _tetSize.size());
    mesh["topologies/mesh/elements/offsets"].set_external(&_tetOffset[0], _tetOffset.size());

    mesh["topologies/mesh/subelements/shape"].set("polygonal");
    mesh["topologies/mesh/subelements/connectivity"].set_external(&_faceConnectivity[0], _faceConnectivity.size());
    mesh["topologies/mesh/subelements/sizes"].set_external(&_faceSize[0], _faceSize.size());
    mesh["topologies/mesh/subelements/offsets"].set_external(&_faceOffset[0], _faceOffset.size());


    // add the data
    auto fields = mesh["fields"];

    fields["sim_valv/association"].set("vertex");
    fields["sim_valv/topology"].set("mesh");
    fields["sim_valv/volume_dependent"].set("false");
    fields["sim_valv/values"].set_external(&_valuesVertex[0], _valuesVertex.size());

    fields["sim_valf/association"].set("element");
    fields["sim_valf/topology"].set("mesh");
    fields["sim_valf/volume_dependent"].set("false");
    fields["sim_valf/values"].set_external(&_valuesFaces[0], _valuesFaces.size());

Could you share the data ?

Here you go:
sample_data.tar.gz (39.3 KB)

The data was generated by the code above as a test. In the dataset, each of the 4 ranks are outputting exactly the same data but in the simulation, each would output a section. You can see the issue from loading the vtpd file or just one vtu file.

This is expected because the internal faces are hidden, even when there is opacity. You can use Shrink with a factor of 1 to separate each cell.

I did not know about this. Thanks!

1 Like