Hi there,
I am new to FEniCS (2019.2.0.dev0) and I have encountered a simple problem (I think).
I have a square channel with a sphere (it is 2D, so circle is the right word, but let’s keep it as a sphere). I want to see how the sphere will deform subject to know differences on the two fluid properties. So basically they both move with the same background velocity, but I want to be able to track that and visualise it. I have not thought of yet the boundary conditions I need to impose there, but since it will move with the flow, the boundary velocity will be the same as the flow.
I have defined two geometries for that, the background flow (square) and the cell (sphere). I set the cell as the subdomain.
My question is how can I plot with e.g. red the outline/boundary of the cell domain? I can read the mesh coordinates but not sure you to plot both the background and the cell mesh with different colours.
At this point, I have to admit that I am very confused with the markers and MeshFunction commands…
Here is a sample of the code:
import dolfin
from fenics import *
from mshr import *
import numpy as np
import matplotlib.pyplot as plt
r = 0.25 # cell radius
# Define geometries
domain = Rectangle(Point(-1,0),Point(1,1))
cell = Circle(Point(-0.5,0.5),r)
# Set subdomains
domain.set_subdomain(1,cell)
# Create mesh
mesh=generate_mesh(domain,32)
# Mesh coordinates
coor = mesh.coordinates()
xcoor, ycoor = coor[:,0], coor[:,1]
#Plot mesh
plt.figure()
plot(mesh)
#plt.plot(xcoor,ycoor) #That doesn't work, since it connects essentially all the points
plt.show()
Thank you