Problems with meshing a certain geometry

For my bachelor thesis I want to create a model for a FEM calculation, but Cubit closes as soon as I try to mesh the model with the error message “Interrupt Detected. Cubit Exiting”. Another message does not appear because Cubit crashes immediately. I use Cubit version 2021.11 and Windows 11 as operating system.

Here is an excerpt from the journal file I use:

##############################################################
reset
#{height_brick =10}
#{width_brick =10}
#{length_brick =10}
#{radius_cell = 2}
#{number_cones = 6}
#{height_frustrum = 0.75}
#{radius_frustrum = 0.5}
#{thickness_membrane = 0.03} # nm
#{overlap = 0.3} um
#{mesh_size_membrane=0.3}
#{mesh_size_cell=1}
#{mesh_size_outerblock=1.3}

create sphere radius {radius_cell}
create frustum z {height_frustrum} major radius {radius_frustrum} minor radius {radius_frustrum} top radius 0
volume 2 move x 0 y z {radius_cell+height_frustrum/2-0.2}
volume 2 copy rotate {360/number_cones} about x repeat {number_cones}
volume 2 to {number_cones+2} copy rotate {360/number_cones} about z repeat {number_cones}
unite vol 1 to {1+(number_cones+1)*(number_cones+1)}

create sphere radius {radius_cell - thickness_membrane}
create frustum z {height_frustrum} major radius {radius_frustrum} minor radius {radius_frustrum} top radius 0
compress all
volume 3 move x 0 y z {radius_cell-thickness_membrane+height_frustrum/2-0.2}
volume 3 copy rotate {360/number_cones} about x repeat {number_cones}
volume 3 to {number_cones+3} copy rotate {360/number_cones} about z repeat {number_cones}
unite vol 2 to {2+(number_cones+1)*(number_cones+1)}

create sphere radius {radius_cell + overlap}
create frustum z {height_frustrum} major radius {radius_frustrum} minor radius {radius_frustrum} top radius 0
compress all
volume 4 move x 0 y z {radius_cell+overlap+height_frustrum/2-0.2}
volume 4 copy rotate {360/number_cones} about x repeat {number_cones}
volume 4 to {number_cones+3} copy rotate {360/number_cones} about z repeat {number_cones}
unite vol 3 to {3+(number_cones+1)*(number_cones+1)}

create sphere radius {radius_cell - overlap - thickness_membrane}
create frustum z {height_frustrum} major radius {radius_frustrum} minor radius {radius_frustrum} top radius 0
compress all
volume 5 move x 0 y z {radius_cell-overlap-thickness_membrane+height_frustrum/2-0.2}
volume 5 copy rotate {360/number_cones} about x repeat {number_cones}
volume 5 to {number_cones+3} copy rotate {360/number_cones} about z repeat {number_cones}
unite vol 4 to {4+(number_cones+1)*(number_cones+1)}

create sphere radius {radius_cell + overlap/2}
create frustum z {height_frustrum} major radius {radius_frustrum} minor radius {radius_frustrum} top radius 0
compress all
volume 6 move x 0 y z {radius_cell+overlap/2+height_frustrum/2-0.2}
volume 6 copy rotate {360/number_cones} about x repeat {number_cones}
volume 6 to {number_cones+3} copy rotate {360/number_cones} about z repeat {number_cones}
unite vol 5 to {5+(number_cones+1)*(number_cones+1)}

create sphere radius {radius_cell - overlap/2 - thickness_membrane}
create frustum z {height_frustrum} major radius {radius_frustrum} minor radius {radius_frustrum} top radius 0
compress all
volume 7 move x 0 y z {radius_cell-overlap/2-thickness_membrane+height_frustrum/2-0.2}
volume 7 copy rotate {360/number_cones} about x repeat {number_cones}
volume 7 to {number_cones+3} copy rotate {360/number_cones} about z repeat {number_cones}
unite vol 6 to {6+(number_cones+1)*(number_cones+1)}

create brick x {length_brick} y {width_brick} z {height_brick}
compress all

subtract body 5 from body 7
subtract body 1 from body 3 keep
subtract body 2 from body 1 keep
subtract body 4 from body 2 keep

compress all

vol all scheme tetmesh
vol 4 size {mesh_size_membrane}
vol 2 size {mesh_size_outer_block}
vol 1 size {mesh_size_cell}
mesh vol 4
mesh vol 1,2
mesh vol 3,5

##############################################################

As you can see I am trying to mesh multiple layers of this geometry, however the program crashes without a traceable error message. Do you have a solution how I can mesh the model with Cubit?

Does anyone know why this error occurs and how to fix it?

Prior to your meshing portion, try splitting periodic surfaces. Also, if you want a conforming (C^0) mesh you’ll want to also imprint and merge. For example:

compress all

split periodic volume all
imprint volume 1 2 3 4 5
merge volume 1 2 3 4 5

vol all scheme tetmesh
vol 4 size {mesh_size_membrane}
vol 2 size {mesh_size_outer_block}
vol 1 size {mesh_size_cell}
mesh vol 4
mesh vol 1,2
mesh vol 3,5

Also, you might want to verify which volumes you’re meshing (I based my imprint and merge commands on your later mesh commands). Here’s a cross-section showing the tet elements of the meshed volumes, there appear to be some overlapped volumes (rather than layers).

Did this via

draw tet all
graphics clip on

Hi Stefun,

You are trying to create concentric shells so you need to make sure you get your Boolean operations correct. I prefer to use the keep_tool option. It keeps the tool bodies but deletes original modified body. Otherwise, you have to make sure to delete the original body so you just have the shell. This is the root problem you are seeing.

Here is an example just using spheres. This is easiest from the outside in. You should be able to apply this to your example.

reset
sphere radius 1
sphere radius 1.5
sphere radius 2
sphere radius 2.5
sphere radius 3
subtract volume 4 from 5 keep_tool
subtract volume 3 from 4 keep_tool
subtract volume 2 from 3 keep_tool
subtract volume 1 from 2 keep_tool
imprint all
merge all
compress
vol all scheme tetmesh
mesh volume all
graphics clip on
graphics clip manip off
draw tet all


image