Assigning Block ID from Variable

Hi all,
I have been trying to use the sculpt feature in Cubit to smooth boundaries between microstructures and have run into a slight issue. As it is shown in the Cubit tutorial lecture 21 example 7, it should be a relatively smooth process to go from cartesian grid to a conformal mesh with smooth interfaces. Unfortunately in my case, my exodus mesh has my grain IDs stored as elemental variables, whereas the sample mesh used in the example (micro_2D.e) has its block IDs identifying different grains. Is there a way to read in my variable have it assign BlockID based on the variable? Has anyone had to do a similar thing?

Thanks for your time.
P.S. I can provide a sample mesh upon request (but am a new user so I couldn’t upload it here).

Sculpt supports element variables as volume fractions. From the documentation:

Sculpt can optionally take an exodus file containing volume fraction data stored as element variables. Normally the exodus file has initially been written using the --volfrac_file (-vf) option. Since the exodus file will be a Cartesian grid spread across multiple processors, the base filename for the parallel series of exodus files is used as the argument for this command. The input volume fraction file(s) would be used instead of an STL or diatom file. Since computing volume fractions from geometry can be time consuming, precomputing the volume fractions and reading them from a file can be advantageous if multiple meshes are to be generated from the same volume fraction data.

A little further clarification comes from this description.

Element Variables: The geometry may also be described by element
variables in the Exodus file. Element variables should represent material
volume fractions where the sum of element variables for any one cell should
be between 0.0 and 1.0. Any number of element variables may be used where
each unique variable defined will describe an element block in the final
Exodus mesh produced. if the sum of element variables is less than 1.0 for
any one element, a void material will be assumed and removed from the base
mesh unless the mesh_void option is used.

That doesn’t sound like what you have.

You may have to manipulate the exodus file so that the elements with an element variable are in a block. I have been told that many people at Sandia National Labs use pyexodus to manipulate the exodus file. I have never used the tool, but I found that it can be installed from PyPI with just a pip install pyexodus
pyexodus · PyPI

Here is the pyexodus documentation: pyexodus — pyexodus 0.1.1-3-g52b9 documentation (salvushub.github.io).

I hope this helps point you in the right direction.