Meshing a torus inside a cube/cylinder?

Hi,

I’m having trouble generating a hex mesh of a small torus inside a box. I’m unsure of which scheme to use.

I’d also like to use a finer spacing inside the torus and then have it grad outwards towards the cube boundary, but don’t seem to be having much success.

Here’s my attempt… I was trying to do use symmetry and then reflect at the end:

reset
brick x 0.5
torus major radius 0.02 minor radius 0.01
rotate volume 2 angle 90 about y
subtr vol 2 from 1 keep
del vol 1

webcut volume all with plane xplane offset 0
webcut volume all with plane yplane offset 0
webcut volume all with plane zplane offset 0

del vol 4 to 17
imprint all
merge all

vol 2 scheme sweep source surface 34 target surface 77
vol 2 size 0.005
vol 3 scheme poly
vol 3 size 0.01
mesh vol all

but this fails to mesh the cube part of the domain

Thanks for any help!

This seems to have done it, but I’d be interested if I could do this more cleanly:

reset
brick x 0.5
torus major radius 0.02 minor radius 0.01
rotate volume all angle 90 about y
subtr vol 2 from 1 keep
del vol 1

Core with cylinder

webcut volume all with cylinder radius 0.005 axis x

Cut into quarters

webcut volume all with plane yplane offset 0
webcut volume all with plane zplane offset 0

Use symmetry, so disgard all but 1 quarter

del vol 5 to 13
imprint all
merge all

Meshing options:

surf 52 size 0.005
mesh vol 2

vol 4 scheme sweep source surface 65 target surface 35
vol 2 scheme sweep source surface 21 target surface 51
vol 3 size 0.01
vol 4 size 0.05
mesh vol all

Reflect the quarter to create the complete model.

vol all copy reflect y
vol all copy reflect z

Make sure all reflected interfaces are merged.

merge vol all

Thanks

Ross