LLNL / conduit

Simplified Data Exchange for HPC Simulations
https://software.llnl.gov/conduit/
Other
209 stars 64 forks source link

Document zone and node ordering for uniform meshes #1033

Open adayton1 opened 1 year ago

adayton1 commented 1 year ago

I'm attempting to use Conduit's mesh blueprint protocol in an application, and I was wondering what order is implied by uniform meshes as it relates to a field array.

It's probably easier to explain what I mean with some drawings (pretend each number is the ID of a zone, left/right is the x axis, and up/down is the y axis).

Order by x, then y 6 7 8 3 4 5 0 1 2

Order by y, then x 2 5 8 1 4 7 0 3 6

I would image the order affects the layout of the field arrays.

cyrush commented 1 year ago

Yes, we should document - but the quickest answer is to view it in VisIt to see how field values vary with the logical mesh

adayton1 commented 1 year ago

Thanks for the tip!

adayton1 commented 1 year ago

Is there a way to say certain indices in a field array correspond to ghost data? Or do I just need to allocate a new array with only the data on the current domain?

cyrush commented 1 year ago

check out the strided structured example:

https://github.com/LLNL/conduit/blob/56bee65f4f5db1c1d0cfba5b062484ff2870c409/src/libs/blueprint/conduit_blueprint_mesh_examples.hpp#L57

This is a newer concept -- the striding isn't yet supported in VisIt.

In many use cases we use a field that identifies ghosts and then use that field to threshold when we want to get rid of ghosts.

cyrush commented 1 year ago

Here is a python example you can use to see the order:

import conduit

yaml = """
    coordsets: 
      coords: 
        type: "uniform"
        dims: 
          i: 4
          j: 4
    topologies: 
      topo: 
        type: "uniform"
        coordset: "coords"
    fields: 
      id: 
        association: "element"
        topology: "topo"
        values: [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]
"""
data = conduit.Node()
data.parse(yaml,"yaml");
conduit.relay.io.blueprint.save_mesh(data,"example","hdf5");

Screen Shot 2022-11-02 at 5 12 34 PM

adayton1 commented 1 year ago

The strided example I think is just what I need! Is there any time frame for when this might be supported in VisIt? Or when you write the data out to a file can you transform it to a format VisIt expects?

I have a couple more clarifying questions:

What happens if I just include ghost information (so basically the same zone shows up in two different subdomains of a mesh)? Can VisIt handle that? Will the only consequence be zone numbering that is off?

I saw a section in the documentation on Adjacency Sets. Is that a way of specifying neighbors that a domain shares ghosts with? Or is that meant for something else like collocated meshes?

adayton1 commented 1 year ago

An interesting idea I just thought of is if a conduit::Node could accept a view in the call to set_external (e.g. RAJA::View), since a view could handle offsets and strides. But perhaps that would get way too complicated. The strided example above should work just fine.