Thanks Christopher
First, yes the code is running without inclusion.
It seem the subdomains are not being recognized after adding the circle to the periodic square, when I call the them with mesh.GetMaterials is shows: KeyError: ‘default’
from math import pi
from ngsolve import *
from netgen.geom2d import SplineGeometry
from ngsolve.internal import *
from netgen.meshing import MeshingParameters
from math import pi
# Creating Geometry
# Unite cell set-up
l = 1
ST = l*l
vf = 0.2
Sf = vf*ST
r = sqrt(Sf/pi)
# Creating Periodic Geometry
periodic = SplineGeometry()
pnts = [ (-0.5*l,-0.5*l), (0.5*l,-0.5*l), (0.5*l,0.5*l), (-0.5*l,0.5*l) ]
pnums = [periodic.AppendPoint(*p) for p in pnts]
lright = periodic.Append ( ["line", pnums[1], pnums[2]], bc="periodicx")
lsup = periodic.Append ( ["line", pnums[2], pnums[3]],bc="periodicy")
periodic.Append ( ["line", pnums[0], pnums[3]], leftdomain=0, rightdomain=1, copy=lright, bc="periodicx")
periodic.Append ( ["line", pnums[1], pnums[0]], leftdomain=0, rightdomain=1, copy=lsup, bc="periodicy")
periodic.AddCircle(c=(0,0), r=r, bc="circle", leftdomain=2, rightdomain=1)
mesh = Mesh(periodic.GenerateMesh(maxh=0.1, quad_dominated=False))
order = 2
periodic.SetMaterial (1, "outer")
periodic.SetMaterial (2, "inner")
domain_values = {'inner': -1, 'outer': 1}
values_list = [domain_values[mat]
for mat in mesh.GetMaterials()]
I don’t know if could be the definition of periodic.SetMaterial … or the definitions in left-right domain. Thank you so much by advance for your help.
Best regards