Microstructure Mesh Size

Hello,

I generated a tessellation in Neper, and converted it into an SPN file. I am trying to create a mesh based on the SPN file using Parallel Sculpt. However, I am unable to specify the size of the mesh.

The following is the sculpt file I used.

image

I realise that cell_size should not be used with nelx, nely, and nelz, but I do not know any other way to specify the size of the mesh. Does anyone have a suggestion on how I can do this?

Hi,

I searched through the latest documentation and cell_size does not exist. It looks like what the GUI does with the cell size is take the bounding box extents and then calculate nelx, nely, and nelz.

Thanks for the response, Karl. Is there any way to define the cell_size for this type of mesh?

Hi,

I went digging deeper in the documentation. I found that the following works.

BEGIN SCULPT

  cell_size = 0.1
  mesh_void = only
  void_mat = 1
  exodus_file = sculpt_parallel.diatom_result
  diatom_file = sculpt_parallel.diatom

END SCULPT

How are you defining the variables in the .i file? I don’t see a single example of a .i file defining variables in the unittests.

Thanks,
Karl

Hello,

I tried this out by making the following changes:

BEGIN SCULPT
    cell_size = {VOLUME_LENGTH/NUM_VOXELS}
    nelx = {NUM_VOXELS}
    nely = {NUM_VOXELS}
    nelz = {NUM_VOXELS}
    mesh_void = only
    void_mat = 1

    pillow = 3
    smooth = 2
    
    laplacian_iters = 10
    max_opt_iters = 100
    adapt_type = 5
    adapt_levels = 3

    defeature = 1
    micro_shave = true
    remove_bad = 0.0
    
    input_spn = {SPN_FILE}
    exodus_file = {EXODUS_FILE}
END SCULPT

However, I seem to have only meshed a single grain. Did I do something wrong?

image

Also, I am running PSculpt through Python, so I am able to define the variables there :slight_smile:.

Note that my example I was not meshing the part, only the void surrounding the part. You may not want mesh_void = only. Also, you may not need to define void_mat = 1. I suspect this may be the problem.

You are right that you should not need to define NELX, NELY, NELZ. It is not an error, but you will get a warning about the number of cells that are changed.

I see.

When I use the following, I do get an error.

BEGIN SCULPT
    cell_size = {VOLUME_LENGTH/NUM_VOXELS}

    pillow = 3
    smooth = 2
    
    laplacian_iters = 10
    max_opt_iters = 100
    adapt_type = 5
    adapt_levels = 3

    defeature = 1
    micro_shave = true
    remove_bad = 0.0
    
    input_spn = {SPN_FILE}
    exodus_file = {EXODUS_FILE}
END SCULPT

Is there a way to scale all the elements of the volume after the mesh is complete?

What is your error?

You might be able to use a global refinement, but you have lost the geometry so the refinement will not conform to the original surfaces. Let me look into this a little more.

Karl

Here is a trivial example of a cube with some spheres scattered through it. The cube is 10 units on a size and the spheres have a radius of 1.

I created the model as follows:


reset
bri x 10
sphere radius 1
vol 2 copy move x -2 y -1.3
vol 2 copy move x -2 y 2.3 z 2
vol 2 copy move x 2 y -2.3 -z 2
vol 2 copy move x 3 y 3.3 z -3.5
subtract vol 2 to 20 from 1 keep_tool
merge all

# This runs sculpt from inside cubit and creates the diatom and .i file.
sculpt parallel volume all size 0.25 box location position -5.75 -5.75 -5.75 location position 5.75 5.75 5.75 no_clean

I then edited the .i file and added the cell_size parameter.

$ Input file created: Mon Nov 14 17:08:32 2022


BEGIN SCULPT

  cell_size = .25
  xmin = -5.750000
  ymin = -5.750000
  zmin = -5.750000
  xmax = 5.750000
  ymax = 5.750000
  zmax = 5.750000
  exodus_file = sculpt_parallel.diatom_result
  diatom_file = sculpt_parallel.diatom

END SCULPT

I then ran this from bash shell in Windows.

 /c/Program\ Files/Coreform\ Cubit\ 2022.11/bin/sculpt.exe -j 8 -i sculpt_parallel.i

You may have to write the exact cell size into the .i file with python.

Here is the result of doing draw block 2 to 6.
image

If I change the cell_size parameter, I get different mesh sizes as I would expect.

How does this differ from your process?

You can try doing a refine on the mesh after, but you lose the block information because the element ids change. I suggest that we try to figure out your error and get the process to work correctly.

Thanks,
Karl

Hi,

Thanks for your responses.

When I don’t assign proper values to nelx, nely, and nelz, they are assigned their default values (of 10), and it is assumed that there are 1000 data points in the SPN file. Since the number of data points in the SPN file is not actually 1000, an error is raised, and the sculpting process is terminated.

I have attached an example of this error.

image

When I define nelx, nely, and nelz, the value of cell_size seems to not affect the actual size of the cell. I think it works for your sphere example because you did not use nelx, nely, and nelz.

Note that I am using the coarse adaptive mesh (adapt_type = 5). This error does not occur when I use another adaptive mesh type (i.e., 1-4 and 6). However, I get the best mesh quality with the coarse adaptive mesh.

Hi,

Can you use your python code to find the size of the bounding box and then calculate your own nelx, nely, and nelz based on your desired element size?

Karl

Hello @karl,

I could, but that would affect the number of elements in the microstructure.

I was hoping to fix the number of elements, and scale the size of the all the elements by the same factor.

Regards,
Janzen

Just an update for anyone who comes across this post. Cubit has a scale option (Sculpt Mesh Transformation) that can be used to scale the size of the elements.