Confused about the data structure using in Fenics, like what is VectorFunctionSpace really like?
>>> mesh = UnitSquareMesh(2,2) >>> V = FunctionSpace(mesh,'P',2) >>> Q = FunctionSpace(mesh,'P',1) >>> W = VectorFunctionSpace(mesh,"Lagrange",2) >>> print W <Function space of dimension 50 (<Lagrange vector element of degree 2 on a <Domain built from <triangle cell in 2D> with label dolfin_mesh_with_id_0>: 2 x <CG2 on a <Domain built from <triangle cell in 2D> with label dolfin_mesh_with_id_0>>>)> >>> print V <Function space of dimension 25 (<CG2 on a <Domain built from <triangle cell in 2D> with label dolfin_mesh_with_id_0>>)> >>> print Q <Function space of dimension 9 (<CG1 on a <Domain built from <triangle cell in 2D> with label dolfin_mesh_with_id_0>>)> >>> plot(V)
I could imagine that Q has dimension 9 is because of 9 vertices? but what about 25 for V and 50 for W?
Also I once want to found the boundary nodes by
>>> def boundary(x, on_boundary): ... return on_boundary ... >>> bc=boundary >>> print bc <function boundary at 0x7fc7104932a8>
when I want to check what information contains in bc, it shows <function boundary at 0x7fc7104932a8>, which I have no idea how to use this information...
As well as other function spaces like when I interpolate, and what I got after solve a PDE, what do those f_12,f_31,v_1,v_0 mean .....Sorry to be troublesome here, and I think there are more similar structure like this that I don't know how to use......
>>> u_D = Expression('1 + x*x + x*x', ... degree=2) >>> print u_D f_12 >>>solve(self.A1, self.u_.vector(), self.b1, 'bicgstab', 'hypre_amg') >>> print self.u_ f_31 >>> mesh = UnitSquareMesh(2,2) >>> V = FunctionSpace(mesh,'P',1) >>> u = TrialFunction(V) >>> v = TestFunction(V) >>> print u v_1 >>> print v v_0
Thanks for reading to here, and the last thing is... after I solve the Navier-Stokes equation with VectorFunctionSpace W mentioned above, and got the output of the velocity like this
[ 0.13574608 0.13574609 0.08672074 0.0867046 0.08670469 0.08672081
0.16026276 0.16026278 -0.04619293 -0.04619698 -0.04619677 -0.04619277
0.089828 0.08982803 -0.0117363 -0.01173628 0.22652239 0.22652233
0.11595966 0.11603627 -0.17270809 -0.17274629 0.11603613 0.11595949
0.08982807 0.08982807 0.22652242 0.22652243 -0.17274639 -0.17270802
0.08670454 0.08672064 0.11603618 0.11595965 -0.17274629 -0.17270798
0.08672065 0.0867046 0.16026281 0.16026274 0.1159595 0.11603611
-0.17270802 -0.17274634 0.13574614 0.13574608 -0.04619696 -0.04619295
-0.04619293 -0.0461968 ]
what does this means? the first two [ 0.13574608 0.13574609 ] is the velocity of the first element of our mesh?
I agree with Ovais. It is better if you read the related chapters from the manual.
Regarding of your first question: Q,V and W represents your FE space, so they are degree of freedoms. For Q since you are using linear tetra elements it is 9, for V since the element order is quadratic then you have 25 DOF. W (VectorFunctionSpace) represents the vectorial quantities (not scalar). Since you are dealing with 2D case, it has 50 DOF (25x2).