Referencing solution array when using MixedElement within MixedElement

Hello,

I have a problem with five unknowns; four being concentration values, one being an electric potential. The four concentrations have known Dirichlet conditions, while the electric potential has one Dirichlet and one non-zero Nuemann, which forces current to zero. To treat the Nuemann condition in the weak form, a separate subdomain from the four concentration subdomains is defined:

P1 = FiniteElement(‘CG’, triangle, 1)
element = MixedElement([P1, P1, P1, P1])
V = FunctionSpace(mesh, element)
V_phi = FunctionSpace(mesh, P1)
element2 = MixedElement([element, P1])
W = FunctionSpace(mesh, element2)

Although, now when trying to update the trial functions, using the assign function, I get the error:

AttributeError: ‘ListTensor’ object has no attribute ‘assign’

Also, when trying to access the solution array components using .vector() I get:

AttributeError: ‘ListTensor’ object has no attribute ‘vector’

So from here I attempt to extract dof values from the solution tensor indices and get:

AttributeError: ‘Indexed’ object has no attribute ‘vector’

Could someone please help me understand the situation here? Is there a certain way to go about handling MixedElement within MixedElement?

Thank you,

Please add the actual code that are causing your errors. Please strip out all code not needed to reproduce the error. Also use 3x` encapsulation of the code.

Sorry for not posting my code, as the problem has been resolved.

I had four unknowns with similar boundary conditions, then a fifth unknown with unique boundary conditions. It is from this that I assumed there needed to be some special treatment. I was confused in trying to lump the fifth unknown as a mixed element with the other unknowns. I simply defined it as it’s own space and problem to be solved in an alternating fashion with the other simultaneous weak forms.

Thank you for your time.

1 Like