lgietz
April 11, 2023, 2:33pm
#1
Hello Team,
i have a mesh refinement question: In the attached picture you can see my problem. I want to refine the Hex-mesh from left (size 7.5) to right (size 2.5). For this I would like to use the option “5.6.11.3.4 Directional Refinement” from the online documentation to keep the mesh structured. However, I want to refine only in the plane and not in the thickness. In the thickness the interval size should be 1.
How can I do this?
I am thankful for your support and help.
Here is the script:
cubit.cmd('reset')
# parameter
cubit.cmd(' #{L = 700} ')
cubit.cmd(' #{H = 150} ')
cubit.cmd(' #{T = 150} ')
cubit.cmd(' #{a = 100}')
cubit.cmd(' #{kh = 25}')
cubit.cmd(' #{kb = 5}')
cubit.cmd(' #{pb1 = 10}')
cubit.cmd(' #{ph1 = 15}')
cubit.cmd(' #{pb2 = 20}')
cubit.cmd(' #{ph2 = 15}')
cubit.cmd(' #{grenz = 30}')
#Verticies
cubit.cmd('create vertex 0 0 0 ')
cubit.cmd('create vertex 0 {kh} 0 ')
cubit.cmd('create vertex 0 {H} 0 ')
cubit.cmd('create vertex {a-pb1/2} 0 0 ')
cubit.cmd('create vertex {a-pb1/2} {kh} 0 ')
cubit.cmd('create vertex {a-pb1/2} {H} 0 ')
cubit.cmd('create vertex {a} {-ph1} 0 ')
cubit.cmd('create vertex {a+pb1/2} 0 0 ')
cubit.cmd('create vertex {a+pb1/2} {kh} 0 ')
cubit.cmd('create vertex {a+pb1/2} {H} 0 ')
cubit.cmd('create vertex {L/2-pb2/2-grenz} 0 0 ')
cubit.cmd('create vertex {L/2-pb2/2-grenz} {kh} 0 ')
cubit.cmd('create vertex {L/2-pb2/2-grenz} {H} 0 ')
cubit.cmd('create vertex {L/2-pb2/2} 0 0 ')
cubit.cmd('create vertex {L/2-pb2/2} {kh} 0 ')
cubit.cmd('create vertex {L/2-pb2/2} {H} 0 ')
cubit.cmd('create vertex {L/2-kb/2} 0 0 ')
cubit.cmd('create vertex {L/2-kb/2} {kh} 0 ')
cubit.cmd('create vertex {L/2-kb/2} {H} 0 ')
cubit.cmd('create vertex {L/2} {kh} 0 ')
cubit.cmd('create vertex {L/2} {H} 0 ')
cubit.cmd('create vertex {L/2} {H+ph2} 0 ')
# Surfaces
cubit.cmd('create surface Vertex 1 2 5 4 ')
cubit.cmd('create surface Vertex 2 3 6 5')
cubit.cmd('create surface Vertex 4 8 7')
cubit.cmd('create surface Vertex 4 5 9 8')
cubit.cmd('create surface Vertex 5 6 10 9')
cubit.cmd('create surface Vertex 8 9 12 11')
cubit.cmd('create surface Vertex 9 10 13 12')
cubit.cmd('create surface Vertex 11 12 15 14')
cubit.cmd('create surface Vertex 12 13 16 15')
cubit.cmd('create surface Vertex 14 15 18 17')
cubit.cmd('create surface Vertex 15 16 19 18')
cubit.cmd('create surface Vertex 18 19 21 20')
cubit.cmd('create surface Vertex 16 22 21 19')
#Volume
cubit.cmd('sweep surface all perpendicular distance {T/2} switch side')
#merge and compress all
cubit.cmd(' merge all ')
cubit.cmd(' compress all ')
# ---------------------------------------------------------------------
cubit.cmd('curve 73 interval {1}')
cubit.cmd('volume 10 11 12 13 size 2.5')
cubit.cmd('mesh volume 10 11 12 13')
cubit.cmd('curve 57 interval {1}')
cubit.cmd('volume 1 to 7 size 7.5')
cubit.cmd('mesh volume 1 to 7')
Hi @lgietz ,
Unfortunately, I don’t believe Cubit is able to perform the type of refinement that you’re asking it to do after you’ve meshed the volumes. Instead, what you’ll want to do is:
Merge the volumes
Mesh the transition surfaces at the coarsest mesh size
Perform the refinement on the transition surfaces (by refining the fine curves)
Sweep mesh the transition volumes (to maintain 1 element through the thickness)
Note: It’s important to set redistribute nodes on
for these volumes to retain the node spacing through the sweep
Mesh the remaining volumes
This is what this looks like in a script (note that I’ve done a little bit of rearranging of commands, meaning that IDs are likely different between our two scripts, so see the full script at the end of this post):
# Build refined mesh region
cubit.cmd( "merge all" )
cubit.cmd( "mesh surface 8 9" )
cubit.cmd( "refine curve 109 117 numsplit 2 bias 1 depth 1" )
cubit.cmd( "volume 8 9 redistribute nodes on" )
cubit.cmd( "volume 8 9 scheme Sweep Vector 0 0 -1 sweep transform least squares" )
cubit.cmd( "volume 8 9 autosmooth target on fixed imprints off smart smooth off" )
cubit.cmd( "mesh volume 8 9" )
# Mesh remaining volumes
cubit.cmd( "mesh vol all" )
Let me know if this works for you, or if you have additional questions.
P.S. Full script:
cubit.cmd('reset')
# parameter
cubit.cmd(' #{L = 700} ')
cubit.cmd(' #{H = 150} ')
cubit.cmd(' #{T = 150} ')
cubit.cmd(' #{a = 100}')
cubit.cmd(' #{kh = 25}')
cubit.cmd(' #{kb = 5}')
cubit.cmd(' #{pb1 = 10}')
cubit.cmd(' #{ph1 = 15}')
cubit.cmd(' #{pb2 = 20}')
cubit.cmd(' #{ph2 = 15}')
cubit.cmd(' #{grenz = 30}')
#Verticies
cubit.cmd('create vertex 0 0 0 ')
cubit.cmd('create vertex 0 {kh} 0 ')
cubit.cmd('create vertex 0 {H} 0 ')
cubit.cmd('create vertex {a-pb1/2} 0 0 ')
cubit.cmd('create vertex {a-pb1/2} {kh} 0 ')
cubit.cmd('create vertex {a-pb1/2} {H} 0 ')
cubit.cmd('create vertex {a} {-ph1} 0 ')
cubit.cmd('create vertex {a+pb1/2} 0 0 ')
cubit.cmd('create vertex {a+pb1/2} {kh} 0 ')
cubit.cmd('create vertex {a+pb1/2} {H} 0 ')
cubit.cmd('create vertex {L/2-pb2/2-grenz} 0 0 ')
cubit.cmd('create vertex {L/2-pb2/2-grenz} {kh} 0 ')
cubit.cmd('create vertex {L/2-pb2/2-grenz} {H} 0 ')
cubit.cmd('create vertex {L/2-pb2/2} 0 0 ')
cubit.cmd('create vertex {L/2-pb2/2} {kh} 0 ')
cubit.cmd('create vertex {L/2-pb2/2} {H} 0 ')
cubit.cmd('create vertex {L/2-kb/2} 0 0 ')
cubit.cmd('create vertex {L/2-kb/2} {kh} 0 ')
cubit.cmd('create vertex {L/2-kb/2} {H} 0 ')
cubit.cmd('create vertex {L/2} {kh} 0 ')
cubit.cmd('create vertex {L/2} {H} 0 ')
cubit.cmd('create vertex {L/2} {H+ph2} 0 ')
# Surfaces
cubit.cmd('create surface Vertex 1 2 5 4 ')
cubit.cmd('create surface Vertex 2 3 6 5')
cubit.cmd('create surface Vertex 4 8 7')
cubit.cmd('create surface Vertex 4 5 9 8')
cubit.cmd('create surface Vertex 5 6 10 9')
cubit.cmd('create surface Vertex 8 9 12 11')
cubit.cmd('create surface Vertex 9 10 13 12')
cubit.cmd('create surface Vertex 11 12 15 14')
cubit.cmd('create surface Vertex 12 13 16 15')
cubit.cmd('create surface Vertex 14 15 18 17')
cubit.cmd('create surface Vertex 15 16 19 18')
cubit.cmd('create surface Vertex 18 19 21 20')
cubit.cmd('create surface Vertex 16 22 21 19')
#Volume
cubit.cmd('sweep surface all perpendicular distance {T/2} switch side')
# Compress IDS
cubit.cmd(' compress all ')
# ---------------------------------------------------------------------
cubit.cmd('curve 62 64 53 69 72 54 70 56 58 66 61 94 92 96 102 83 78 86 84 75 88 80 76 91 99 104 100 interval {1}')
cubit.cmd('volume 1 to 7 size 7.5')
cubit.cmd('curve 120 115 116 118 112 110 107 108 interval {1}')
cubit.cmd('volume 8 9 size 7.5')
cubit.cmd('curve 124 136 139 140 142 144 134 152 126 147 148 150 131 123 128 132 interval {1}')
cubit.cmd('volume 10 11 12 13 size 2.5')
# Build refined mesh region
cubit.cmd( "merge all" )
cubit.cmd( "mesh surface 8 9" )
cubit.cmd( "refine curve 109 117 numsplit 2 bias 1 depth 1" )
cubit.cmd( "volume 8 9 redistribute nodes on" )
cubit.cmd( "volume 8 9 scheme Sweep Vector 0 0 -1 sweep transform least squares" )
cubit.cmd( "volume 8 9 autosmooth target on fixed imprints off smart smooth off" )
cubit.cmd( "mesh volume 8 9" )
# Mesh remaining volumes
cubit.cmd( "mesh vol all" )