I am still relatively new to creating meshes and NGSolve as a whole. As the title says I am trying to make a mesh with multiple objects such that I would be able to model a scattering problem that is more complex than just one simple shape, so far I have written this
Code:
geo = SplineGeometry()
s = 0.2
Points = [(-s/2,-sqrt(3)/6*s), (s/2,-sqrt(3)/6*s), (0,sqrt(3)/3*s)]
for pnt in Points:
geo.AddPoint(*pnt)
for pids in [[0,1],[1,2],[2,0]]:
geo.Append(["line"]+pids,leftdomain=1,rightdomain=2,bc="scat1")
geo.AddCircle( (0.5,0.5), .35, leftdomain=1, rightdomain=2, bc="scat2")
geo.AddCircle( (0,0), 1.75, leftdomain=3, rightdomain=0, bc="outer")
geo.AddCircle( (0,0), 1, leftdomain=2, rightdomain=3, bc="innerbnd")
geo.SetMaterial(1, "inner")
geo.SetMaterial(2, "mid")
geo.SetMaterial(3, "outer")
mesh = Mesh(geo.GenerateMesh (maxh=0.1))
mesh.Curve(3)
mesh.SetPML(pml.Radial(rad=1.5,alpha=1j,origin=(0,0)), "pmlregion")
omega_0 = 54
omega_tilde = 51
domain_values = {'inner': omega_tilde, 'mid': omega_0, 'outer': omega_0}
values_list = [domain_values[mat] for mat in mesh.GetMaterials()]
omega = CoefficientFunction(values_list)
Draw(omega, mesh, 'piecewise')
But running this causes my machine to loop and it does not finish executing the cell in the notebook, I have tried defining the scat2 circle to have a different material then the scat1 triangle but this doesn't help matters (though if possible I would like them to be the same material)