Hi there,
Consider a unit disk. I need to apply a constant displacement vector gamma2 = Constant((2.0,1.0))
on the nodes on the boundary of the disk. I tagged the boundary with 1 and applied the boundary condition as
c_out = DirichletBC(V, gamma2, boundary_markers, 1)
This produces the following warning:
*** Warning: Found no facets matching domain for boundary condition.
Newton iteration 0: r (abs) = 3.272e-14 (tol = 1.000e-10) r (rel) = 1.000e+00 (tol = 1.000e-09)
Newton solver finished in 0 iterations and 0 linear solver iterations.
I have gone through some of the posts related to this issue but none of the suggestions there are working for my case.
Here is an MWE:
C1 = Circle(Point(0, 0),1)
class b1(SubDomain):
def inside(self, x, on_boundary):
return near(x[0]**2 + x[1]**2, 1, eps=1e-14) and on_boundary
class s1(SubDomain):
def inside(self, x, on_boundary):
return x[0]**2 + x[1]**2 < 1
mesh = generate_mesh(C1, 5)
boundary_markers = MeshFunction("size_t", mesh, mesh.topology().dim()-1, 0)
surface_markers = MeshFunction("size_t", mesh, mesh.topology().dim(), 0)
b1().mark(boundary_markers, 1)
s1().mark(surface_markers, 8)
ds = Measure('ds', domain=mesh, subdomain_data=boundary_markers)
dx = Measure('dx', domain=mesh, subdomain_data=surface_markers)
AB = assemble(Constant(1)*dx(8))
print('area before =', AB)
# Normal vector to the intima
n = FacetNormal(mesh)
# Create mesh and define function space
V = VectorFunctionSpace(mesh, "Lagrange", 1)
# Define boundary condition
# Define functions
du = TrialFunction(V) # Incremental displacement
v = TestFunction(V) # Test function
u = Function(V) # Displacement from previous iteration
u0 = Function(V)
P = Constant(12.0)
d = mesh.geometry().dim()
print(d)
I = Identity(d) # Identity tensor
F = I + grad(u)
J_e = det(F)
C_lumen = F.T*F
Ic_lumen = tr(C_lumen)
gamma2 = Constant((2.0,1.0))
alpha, mu_lumen = 11.1, 0.00000000000001
psi_lumen = (mu_lumen)*(Ic_lumen - 3) + (alpha)*(J_e-1)**2 + mu_lumen*ln(J_e)
Pi_lumen = (psi_lumen*dx(8))
F1 = derivative(Pi_lumen, u, v)
# Compute Jacobian of F
Ju = derivative(F1, u, du)
c_out = DirichletBC(V, gamma2, boundary_markers, 1)
bcs=[c_out]
# Solve variational problem
solve(F1 == 0, u, bcs,
form_compiler_parameters=ffc_options)
ALE.move(mesh,u)
plot(mesh)
plt.show()
I am not sure where I went wrong with my defining the boundary. Any suggestions would be extremely helpful.