2D Model in Sculpt

Hi Team,

I’m trying to create a 2D model of a microstructure from the attached .spn file (please change the extension from .txt to .spn) using Sculpt, but I’m running into difficulties. I initially tried setting “nelz = 0,” but that caused Sculpt to end with an error. I also attempted setting “nelz = 1” and “zscale = 0,” but that didn’t result in a successful model generation either.

Below is my Sculpt script, but it still produces a 2.5D model with some thickness, which I want to avoid. I’m looking for a way to generate a true 2D model with no thickness. Any advice or guidance would be greatly appreciated!

Many thanks,
Ondrej

voxels1.txt (59.3 KB)

BEGIN SCULPT

# Dimensions
nelx = 185
nely = 79
nelz = 1
# Scales
xscale = 1.981982e+01
yscale = 1.974684e+01
zscale = 1

# Fixed mesh improvement
smooth = 3
defeature = 1
pillow_curves = true
pillow_boundaries = true
micro_shave = true
#mesh_void = 1

# Variable mesh improvement
opt_threshold = 0.7
pillow_curve_layers = 3
pillow_curve_thresh = 0.3

# Solver
laplacian_iters = 5
max_opt_iters = 50

# Output
input_spn = voxels1.spn
exodus_file = mesh.e

END SCULPT

Hi Ondrej,

Sculpt produces 3D models. It does not create 2D meshes. You could just create a 2D grid and assign the material numbers.

Does this work? Note that it does take a couple of minutes to assign all the quad faces individually.

#!cubit

reset
create surface rectangle width 1

#
# For some reason python reads this file all as one line. I anticipated
# being able to get the number of rows and columns. I'm guessing here from
# the factorization of the number of entries. 79 * 185 = 14615
curve 1 interval 79
curve 2 interval 185
mesh surface 1

print("Starting . . .")
#!python
with open(r"C:\Users\kgmer\Downloads\voxels1.txt", "r") as fp:
    line = fp.readlines()
    
materials = line[0].split()
print(len(materials), materials[0])

for i, m in enumerate(materials):
    result = cubit.cmd(f'block {m} add face {i+1}')

#!cubit
draw block all

image

Karl

The other idea would be to create the 2.5-dimensional model in sculpt and then just export the surface mesh. If we assume that you create a unit cube centered at the origin, the front face will be at z = 0.5. You should be able to something like the code below to just extract the 2D elements out of the existing mesh.

I will warn you that this is the idea, but I didn’t run your model or test the script below.

Karl

#!python
# add a tolerance on the z coordinate
front_surfaces = cubit.parse_cubit_list('surface', 'with z_coord > 0.49') 
for surf in front_surfaces:
    # I don't know how sculpt names the blocks/underlying volumes
    # but, you could be more sophisticated than this for assigning block ids
    block_id = cubit.get_next_block_id()
    cubit.cmd(f'block {block_id} add surface {surf}')
    # assuming you want a 2D element set the type to QUAD
    cubit.cmd('block {block_id} element type QUAD') 

#! cubit
export mesh 'mesh.e' overwrite