How to check rank of form during debugging?

Hi everyone,
I am trying to debug my code, which works fine (I think) but when trying to separate the bilinear and linear forms, I get that I don’t have a bilinear form! I want to figure out why on my own, but I can’t seem to be able to just check the rank of a form… I am trying to use .rank(), as described in here but apparently the dolfin object does not have the property rank.

My question is, if I have a form, e.g.

a =  inner(grad(u), grad(v)) * dx - p*div(v)*dx + div(u)*q*dx 

is there a quick way to verify that that has rank 2 ? Something like a.rank(), or rank(a), etc…

Thanks!

Consider the following:

from dolfin import *

mesh = UnitSquareMesh(10, 10)
V = FunctionSpace(mesh, "CG", 1)
u, v = TrialFunction(V), TestFunction(V)

a = inner(u, v) * dx
L = inner(1, v) * dx
a_compiled = fem.form.Form(a)
L_compiled = fem.form.Form(L)
print(a_compiled.rank())
print(L_compiled.rank())
3 Likes