Hello everyone,

I am quite new to FEnicsx and I am confused between split() and sub() functions in mixed formulation. I want to create a mixed formulation. I have some understanding of the split() and sub() functions but not very clear about them. Here u is displacement and p is pressure.

Blockquote

u_el = ufl.VectorElement(“CG”, domain.ufl_cell(), 2) # u quad element

p_el = ufl.FiniteElement(“CG”, domain.ufl_cell(), 1) # p linear element

element = ufl.MixedElement([u_el, p_el]) # Mixed Element

V = fem.FunctionSpace(domain, element) # Mixed Function space

up = fem. Function(V)

Blockquote

Until this point is clear. However, I want to understand the difference between the following 3 cases for creating spaces:

Case 1

Blockquote

u_sp = fem.FunctionSpace(domain,u_el)

p_sp = fem.FunctionSpace(domain, p_el)

Blockquote

Case 2

Blockquote

u, p = ufl.split(up)

Blockquote

Case 3:

Blockquote

Vu, Vu_to_V = V.sub(0).collapse()

u_sub = fem. Function(Vu)

Vp, Vp_to_V = V.sub(1).collapse()

p_sub = fem. Function(Vp)

Blockquote

Also, if I want to define velocity using the time derivative of u, how does one obtain the value of u_n in (u - u_n)/dt.

Thank you in advance!