Hi,
I want to solve for the potential outside a metallic cylinder (circle since it is 2D) kept at fixed potential (dirichlet bc). Just to learn how to use subdomains, I surround the said cylinder with a “dummy” cylinder with larger radius. Since I do not change the permittivity anywhere, the presence of this dummy cylinder should not change the physics. However, I get a result in which the potential becomes discontinuous across the dummy cylinder:
Notice the change in color (yellow to blue) across the dummy interface. I suspect I am not getting the mesh right but I am really now sure how. If it helps, I am only trying to adapt the following tutorial example:
https://jorgensd.github.io/dolfinx-tutorial/chapter3/subdomains.html
The mesh is being generated as follows:
r1, r2, fov_r = 5, 10, 20
def generate_annulus_mesh(r1, r2, fov_r, output_file_name):
‘’‘Generates a mesh of annulus’’’
gmsh.initialize()
gdim = 2
inner_disk = gmsh.model.occ.addDisk(0, 0, 0, r1, r1)
outer_disk = gmsh.model.occ.addDisk(0, 0, 0, r2, r2)
# let us now cut the two geometries to have an annulus
# for some reason there is touple repetition. The first index of the touple represents dimension while the
# the second one is object number that we want
annulus_capacitor = gmsh.model.occ.cut([(gdim, outer_disk)],
[(gdim, inner_disk)])
gmsh.model.occ.synchronize()
# now create the area for air as well
fov_r_disk = gmsh.model.occ.addDisk(0, 0, 0, fov_r, fov_r)
# gmsh.model.occ.synchronize()
outer_disk2 = gmsh.model.occ.addDisk(0, 0, 0, r2, r2)
annulus_air = gmsh.model.occ.cut([(gdim, fov_r_disk)],
[(gdim, outer_disk2)])
gmsh.model.occ.synchronize()
complete_geom = gmsh.model.occ.fragment([annulus_air[0][0]], [annulus_capacitor[0][0]])
# complete_geometry = gmsh.model.occ.removeAllDuplicates()
# let us ignore the niceties and jump to generate the mesh directly
# get all the entities present in 2d
geom_surfaces = gmsh.model.getEntities(dim=gdim)
# add both surfaces to separate physical group
for j, surface in enumerate(geom_surfaces):
gmsh.model.addPhysicalGroup(surface[0], [surface[1]], j) # create the main group/node
# # # let us create the mesh
gmsh.option.setNumber("Mesh.CharacteristicLengthMin", 0.1)
gmsh.option.setNumber("Mesh.CharacteristicLengthMax", 0.5)
gmsh.model.mesh.generate(gdim)
gmsh.write('output/'+output_file_name+'.msh')
gmsh.finalize()
I will sincerely appreciate help on this. If the mesh is all good, please let me know and I will share any necessary segment of the code.
Thanks a lot!