I have a numerical solution that I compute using Fenics called \vec{p} = (\eta, \mu)^T. I want to impose a zero Dirichlet condition only on the second component \mu.
I have reviewed other topics where the answer is a line of code as follows, provided we are searching for a solution in some function space “W” with the boundary of the domain called “boundary”.
bc = DirichletBC(W.sub(0).sub(1), Constant(0.0), boundary)
However, in all the examples I have found, no explanation on how to actually use this feature is given. What do you change to change which component you apply it to? Why are there two .sub() in the same command? Which .sub() is the component? Etc.
I don’t even know if the code line above would work in my case. I would be very grateful if someone could please explain to me the details of the implementation of the line above?
Hi, t
he example you are referring to concerns the case where W=V\times P is a mixed function space containing for instance a vectorial field u and a scalar field p as unknowns. I am not sure this is what you have, from what I understand your function space is only a vectorial function space.
In your case, W.sub(1) will refer to the second component \mu.
In the example you mentioned, the first W.sub(0) refers to the first “component” of the mixed space, namely V, the second .sub(1) then referes to the second component of V as it is a vectorial space.
So what you are saying is if the W.sub(0) or W.sub(1) is a scalar function there is no need for a second .sub()? Also, if either was in fact a vector function with two or more components, I could further restrict which sub-component got the Dirichlet condition with another .sub()? Does this process continue ad-infinitum? Specifically, so long as the component from the previous .sub() was a vector function .sub() would continue to extract components?
Okay, I understand now. But with that understanding comes another question.
Say you had a space
W = V_1 \times V_2 \times V_3 \times V_4
where V_i for i=1, 2, 3, 4 are vector spaces with two scalar components, say (\eta_i, \mu_i).
How would you go about applying zero Dirichlet boundary conditions for each of the \mu_i in a single DirichletBC() function call? Is this even possible?