Dear NGSolve community,
As a new NGSolve user, I have recently been looking into the possibility of marking regions of a domain to indicate different materials. I have successfully been able to mark regions of a 2D domain, but I am experiencing some (to me) surprising behavior in 3D. As a MWE, I consider two stacked cubes, where I want to mark the bottom cube as ‘steel’ and the top cube as ‘foam’. For this I use the following code:
[code]
import ngsolve as ng
import netgen.csg as csg
from ngsolve.webgui import Draw
brick1 = csg.OrthoBrick(csg.Pnt(0,0,0), csg.Pnt(1,1,1)).mat(“steel”)
brick2 = csg.OrthoBrick(csg.Pnt(0,0,1), csg.Pnt(1,1,2)).mat(“foam”)
geo = csg.CSGeometry()
geo.Add(brick1)
geo.Add(brick2)
mesh = ng.Mesh(geo.GenerateMesh(maxh=0.2))
cf = mesh.RegionCF(ng.VOL, {“steel”:1, “foam”:2})
Draw(cf, mesh)
[\code]
Given the definition of my coefficient function, I expected the output visualization to show that one cube with value 1 and one cube with value 2. However, in the actual output (see attachment or link below), one cube face has value 1, another has value 2, and the rest of the domain has value 0.
I do not understand why my coefficient function behaves this way. Is it because of a bug, or have a just set up things incorrectly? If the latter, any tips that could point me in the right direction for fixing my code would be greatly appreciated.
Link to output (since I am not sure my attachment uploaded correctly): https://github.com/blakseth/images/blob/main/output.PNG
Best regards,
Sindre