# Difference between split() and sub() in mixed formulation

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.

Hi. Just a regular user here. You have no idea how many posts the managers of the forum have to answer (you could count them ; ) ). If I were you, I would be kind to them: carefully Read before posting: How do I get my question answered?

2 Likes

For a time dependent problem, you have initial conditions. You start by assigning these to u_n. Then, secondly, you solve for the current time step and reassig the solution of the current step to `u_n`. See
http://jsdokken.com/FEniCS23-tutorial/src/form_compilation.html#form-compilation
for an example