Issue with OCC geometries assigning correct material names using v. 6.2.2301.

More
1 year 9 months ago #4689 by JamesElgy
I wasn't sure where the best place to post this was, but when using the OCC geometries I've noticed a difference in the assigned material names between NGSolve versions 6.2.2204 and 6.2.2301.

For example, running the included code should print Materials = ('mat1', 'air'). Using version 6.2.2204, this is exactly what happens, but using version 6.2.2301 I get the output ('mat1', 'default').

Am I missing something, or is this a bug in the latest version?

For context I've been running these tests using Ubuntu 22.04.


Regards,
James

_________
from netgen.occ import *

material_name =

# setting radius
r = 1

# Generating OCC primative sphere centered at [0,0,0] with radius r:
sphere = Sphere(Pnt(0,0,0), r=r)

# My intention is to add boundary layer elements, but they are not needed to recreate the issue.
pos_sphere = sphere - Box(Pnt(0,100,100), Pnt(-100,-100,-100))
neg_sphere = sphere - Box(Pnt(0,100,100), Pnt(100,-100,-100))
sphere = pos_sphere + neg_sphere

# setting material and bc names:
sphere.bc('default')
sphere.mat(material_name[0])
sphere.maxh = 0.2

# Outer region
box = Box(Pnt(-1000, -1000, -1000), Pnt(1000,1000,1000))
box.mat('air')
box.bc('outer')
box.maxh=1000

# Joining the two meshes:
joined_object = Glue([sphere, box])

# Generating Mesh:
nmesh = OCCGeometry(joined_object).GenerateMesh()

from ngsolve import *
mesh = Mesh(nmesh)
print(f'Materials = {mesh.GetMaterials()}')
 
Time to create page: 0.091 seconds