Following the tutorial how to define subdomains in a mesh
LINK , they end up with a mesh that is refined around the parts where there is structure (left image)
Trying to do the same:
from fenics import *
from mshr import *
from math import sin, cos, pi
a = 1.0 # inner radius of iron cylinder
b = 1.2 # outer radius of iron cylinder
c_1 = 0.8 # radius for inner circle of copper wires
c_2 = 1.4 # radius for outer circle of copper wires
r = 0.1 # radius of copper wires
R = 5.0 # radius of domain
n = 10 # number of windings
# FIXME: Use 'domain' instead of 'geometry' in other examples
# Define geometry for background
domain = Circle(Point(0, 0), R)
# Define geometry for iron cylinder
cylinder = Circle(Point(0, 0), b) - Circle(Point(0, 0), a)
# Define geometry for wires (N = North (up), S = South (down))
angles_N = [i*2*pi/n for i in range(n)]
angles_S = [(i + 0.5)*2*pi/n for i in range(n)]
wires_N = [Circle(Point(c_1*cos(v), c_1*sin(v)), r) for v in angles_N]
wires_S = [Circle(Point(c_2*cos(v), c_2*sin(v)), r) for v in angles_S]
# Set subdomain for iron cylinder
domain.set_subdomain(1, cylinder)
# Set subdomains for wires
for (i, wire) in enumerate(wires_N):
domain.set_subdomain(2 + i, wire)
for (i, wire) in enumerate(wires_S):
domain.set_subdomain(2 + n + i, wire)
# Create mesh
mesh = generate_mesh(domain, 32)
I end up with a much less refined mesh around the interfaces between subdomains. (right image above)
As it is the same code: is this caused by default mshr parameters that changed between this code from 2016 and my docker image (created four weeks ago)? Or should I use something else to plot the mesh in the first place?
I see that a similar issue was discussed here, but I am confused as I expected when running the same code as in above tutorial that I would get the same results…
If someone could shed some light there that would be great,
Steffen