Hi everyone!
I want to get the coordinates of the cylinder’s surface.
I try
from fenics import *
from mshr import *
import numpy as np
from dolfin import *
import matplotlib.pyplot as plt
import math
y_h= 40
domain = channel - cylinder
mesh = generate_mesh(domain, 35)
cell_markers = MeshFunction("bool", mesh, mesh.topology().dim())
for c in cells(mesh):
if c.midpoint().y() < 9 and c.midpoint().y() > -9 and c.midpoint().x() < 24 and c.midpoint().x() > -9:
cell_markers[c] = True
else:
cell_markers[c] = False
mesh = refine(mesh, cell_markers)
cell_markers = MeshFunction("bool", mesh, mesh.topology().dim())
for c in cells(mesh):
if c.midpoint().y() < 3 and c.midpoint().y() > -3 and c.midpoint().x() < 12 and c.midpoint().x() > -3:
cell_markers[c] = True
else:
cell_markers[c] = False
class BoundaryCy(SubDomain):
def inside(self, x, on_boundary):
return on_boundary and x[0]>-0.55 and x[0]<0.55 and x[1]>-0.55 and x[1]<0.55
cy = BoundaryCy()
ipc=[]
xc=[]
yc=[]
for v in vertices(mesh):
x = v.point().x()
y = v.point().y()
if cy.inside([v.point().x(), v.point().y()],True):
ipc.append(v.index())
xc.append(x)
yc.append(y)
plt.plot(xc,yc,'p')
and obtain
not only the point of the cylinder…
Any suggestion?
Thank you!!