Help with this mesh?

Hi,

Not sure if this forum is monitored very much anymore… but can someone help me fix this mesh?

I can’t quite get it to work, no matter how many webcuts I try. Here’s my script:

reset

inner set:

create vertex -0.05 -0.075 0
create vertex 0.05 -0.075 0
create vertex 0.075 -0.05 0
create vertex 0.075 0.05 0
create vertex 0.05 0.075 0
create vertex -0.05 0.075 0
create vertex -0.075 0.05 0
create vertex -0.075 -0.05 0

outer set:

create vertex -0.05 -0.1 0
create vertex 0.05 -0.1 0
create vertex 0.1 -0.05 0
create vertex 0.1 0.05 0
create vertex 0.05 0.1 0
create vertex -0.05 0.1 0
create vertex -0.1 0.05 0
create vertex -0.1 -0.05 0

Create straight lines:

inner

create curve vertex 1 2
create curve vertex 3 4
create curve vertex 5 6
create curve vertex 7 8

outer

create curve vertex 9 10
create curve vertex 11 12
create curve vertex 13 14
create curve vertex 15 16

Create circular arc (corners)

inner

create curve arc vertex 2 3 radius 0.025 normal 0 0 1
create curve arc vertex 4 5 radius 0.025 normal 0 0 1
create curve arc vertex 6 7 radius 0.025 normal 0 0 1
create curve arc vertex 8 1 radius 0.025 normal 0 0 1

outer

create curve arc vertex 10 11 radius 0.05 normal 0 0 1
create curve arc vertex 12 13 radius 0.05 normal 0 0 1
create curve arc vertex 14 15 radius 0.05 normal 0 0 1
create curve arc vertex 16 9 radius 0.05 normal 0 0 1

Now create surface

create surface curve all

Create volume:

sweep surface 1 direction 0 0 1 distance 0.1

Move down to centre it:

move Volume 1 x 0 y 0 z -0.05 include_merged

Create plate (with hole)

And move to position according to schematic (corner at 0 0 0)

brick x 0.294 y 0.294 z 0.019
brick x 0.108 y 0.108 z 0.019
move vol 2 location 0.147 0.147 0.0095
move vol 3 location 0.072 0.072 0.0095

Move coil

move vol 1 location 0.194 0.1 0.099

cut hole out

subtr vol 3 from 2 keep
del vol 2

Make webcuts to the plate with hole:

webcut vol 4 with plane surface 27
webcut vol 4 5 with plane surface 28

Create useful groups:

group ‘plate’ equals Volume 3 4 5 6 7
group ‘coil’ equals Volume 1

Now need to embed in an outer boundary.

brick x 3 y 3 z 0.749
move vol 8 location 0.147 0.147 0.0095

Cut inner parts from outer:

subtr group coil plate from 8 keep
del vol 8

imprint all
merge all

mesh vol all

Thanks

You might try decomposing vol 9 into sweepable volumes based on the inner volumes.

You may also need to set sizing because of the small size of our model.

Thanks for the suggestion, although I’d tried that decomposing that part a lot through webcuts and sweeping.

My latest attempt does produce a mesh, but it is of very poor quality (some elements have negative jacobians). I’m getting a little desperate so any help would be very welcome.

I’ve tried not cutting the plate up into as many parts, but this seems to break the sweep. I’ve tried bounding the region between the coil and plate with webcuts, to try to isolate the difficult region, but it doesn’t seem to help.

If you can point me to any resources on the hex meshing aspects of Trelis, then it’d be very helpful.

The other thing is that the program keeps crashing if I change the spacings even a little, so it’s making it very difficult to keep track of what’s going wrong.

Thanks,

Ross

Script here:

reset

Try with vertices:

inner set:

create vertex -0.05 -0.075 0
create vertex 0.05 -0.075 0
create vertex 0.075 -0.05 0
create vertex 0.075 0.05 0
create vertex 0.05 0.075 0
create vertex -0.05 0.075 0
create vertex -0.075 0.05 0
create vertex -0.075 -0.05 0

outer set:

create vertex -0.05 -0.1 0
create vertex 0.05 -0.1 0
create vertex 0.1 -0.05 0
create vertex 0.1 0.05 0
create vertex 0.05 0.1 0
create vertex -0.05 0.1 0
create vertex -0.1 0.05 0
create vertex -0.1 -0.05 0

Create straight lines:

inner

create curve vertex 1 2
create curve vertex 3 4
create curve vertex 5 6
create curve vertex 7 8

outer

create curve vertex 9 10
create curve vertex 11 12
create curve vertex 13 14
create curve vertex 15 16

Create circular arc (corners)

inner

create curve arc vertex 2 3 radius 0.025 normal 0 0 1
create curve arc vertex 4 5 radius 0.025 normal 0 0 1
create curve arc vertex 6 7 radius 0.025 normal 0 0 1
create curve arc vertex 8 1 radius 0.025 normal 0 0 1

outer

create curve arc vertex 10 11 radius 0.05 normal 0 0 1
create curve arc vertex 12 13 radius 0.05 normal 0 0 1
create curve arc vertex 14 15 radius 0.05 normal 0 0 1
create curve arc vertex 16 9 radius 0.05 normal 0 0 1

Now create surface

create surface curve all

Create volume:

sweep surface 1 direction 0 0 1 distance 0.1

Move down to centre it:

move Volume 1 x 0 y 0 z -0.05 include_merged

Move coil to correct position.

move vol 1 location 0.194 0.1 0.099

Create plate (with hole)

brick x 0.294 y 0.294 z 0.019
brick x 0.108 y 0.108 z 0.019

move to position according to schematic (corner at 0 0 0)

move vol 2 location 0.147 0.147 0.0095
move vol 3 location 0.072 0.072 0.0095

cut hole out

subtr vol 3 from 2 keep
del vol 2 3

imprint all
merge all

Make webcuts to the plate with hole:

This is to prevent issues on the thin corner.

webcut vol 4 with plane surface 31
webcut vol 4 5 with plane surface 32

Create useful groups:

group ‘plate’ equals Volume 4 5 6 7
group ‘coil’ equals Volume 1

Now have the conducting objects. Just need to embed them in a background mesh:

brick x 1 y 1 z 0.749
move vol 8 location 0.147 0.147 0.0095

Cut inner parts from outer:

subtr plate coil from 8 keep
del vol 8

imprint all
merge all

Now prepare for meshing, volume 11 is the problem (must be decomposed)

Divide the coil from the plate using webcut:

webcut vol all with zplane offset 0.049
webcut vol all with zplane offset 0.149

divide the top of the plate from the bottom of the volume:

webcut vol all with zplane offset 0.019

imprint all
merge all

smaller spacing on plate/coil (and region inside coil, vol 13):

plate size 0.02 # This produces a neat mesh on the plate alone.
coil size 0.02 # This produces a neat mesh on the coil alone.
vol 13 size 0.02 # to match with coil.

set multisweep on
vol 11 scheme sweep source surface 128 129 130 target 54 55 59 160 167 168

imprint all
merge all

mesh vol 11

mesh vol all

Ross,

Trelis and many other meshing tools use the pave and sweep approach for hex meshing. The attached journal file shows one way of creating sweepable volumes using surfaces on the coil and plate to webcut the other volumes. This ensures that there are good source and target surfaces throughout the model.

There weren’t any negative Jacobians.
coil2.jou (2.65 KB)

Thank you so much for the quick reply. Had just started to experiment with extending the surfaces but was feeling a bit lost!

My only issue now is that I was hoping for a mesh as few elements as possible. Using factor 4, I get around 8000 elements, which is usable but I’d rather have a finer mesh near the coil and plate and coarser outside.

Do you have any recommendations on how best to grade the mesh outwards towards the boundary?

Thanks again,

Ross

Ross,

You can adjust the sizing to get the number of elements you need. For example, the mesh can grow in size as it moves outwards by setting the outer surfaces to a larger size and the inner volumes to a smaller size.

The attached coil3.jou generates a mesh with 3058 hex elements and contains these sizing commands:

surface 211 253 216 252 217 256 210 255 243 244 247 248 size auto factor 8
vol 1 to 10 12 13 14 16 17 19 20 size auto factor 5

The mesh looks like this:

mesh.jpg
coil3.jou (2.52 KB)

That’s great. Thank you very much!