Is Dolfin - UFC interaction broken in dev version?

Asked by Luis Linares

Hello,

Before updating today to the dev version of Dolfin, i was able to run the following code:

element_type = "Nedelec 1st kind H(curl)"
element_order = 2
V_c = FunctionSpace(mesh, element_type, element_order) #mesh is in 3D, is read from a XML file
V = MixedFunctionSpace([V_c, V_c]) #Real part, imag. part
Er, Ei = TrialFunctions(V)
vr, vi = TestFunctions(V)

fr = Function(FunctionSpace(mesh, "DG", 0)) # Constant values throughout a cell
fi = Function(FunctionSpace(mesh, "DG", 0))
#Filled fr, fi somehow....

wf = -fr*(dot(Er, vr)+dot(Ei, vi))*dx + fi*(dot(Ei, vr) - dot(Er, vi))*dx \
    + dot(curl(Er), curl(vr))*dx + dot(curl(Ei), curl(vi))*dx

n = FacetNormal(mesh)
# Add surface term at excitation boundary
d_exc = some_integer_index
r_v = Expression(['x[{0:d}]'.format(i) for i in range(3)]) #This is to turn the position vector into an element for weak form
k_dir_c = Constant( k_dir.tolist() ) # k_dir is a 3-element numpy array ...
E0_c = Constant( E0.tolist() ) # ... and so is E0
# ... real part
#wf += dot(-k*cross(n, cross(Ei, n)) - k*sin(dot(k_dir_c, r_v))*cross(n, cross(E0_c, n-k_dir_c)), vr)*ds(d_exc)
## ... imaginary part
#wf += dot(k*cross(n, cross(Er, n)) - k*cos(dot(k_dir_c, r_v))*cross(n, cross(E0_c, n-k_dir_c)), vi)*ds(d_exc)

T = Function(V)
a, L = lhs(wf), rhs(wf)
problem = LinearVariationalProblem(a, L, T)

When running into the last line, the following output shows up:
Traceback (most recent call last):
  File "test_mx_9_post.py", line 112, in <module>
    problem = LinearVariationalProblem(wf, L, T)
  File "/usr/local/lib/python2.7/dist-packages/dolfin/fem/solving.py", line 80, in __init__
    a = Form(a, form_compiler_parameters=form_compiler_parameters)
  File "/usr/local/lib/python2.7/dist-packages/dolfin/fem/form.py", line 74, in __init__
    function_spaces)
  File "/usr/local/lib/python2.7/dist-packages/dolfin/fem/form.py", line 108, in _extract_function_spaces
    r = compiled_form.rank()
  File "/usr/lib/python2.7/dist-packages/ufc/ufc.py", line 262, in rank
    def rank(self): return _ufc.form_rank(self)
TypeError: in method 'form_rank', argument 1 of type 'ufc::form const *'

This is novel, as in the current ubuntu repo version it works fine. In a previous post, I indicated that to switch to the dev version, i just uninstalled dolfin, which also uninstalls the 'fenics' metapackage, leaving behind ffc, ufl, etc. untouched. Then I built dolfin and installed it in /usr/local. Build and installation were successful. What might have gone wrong here?

Thanks,

Luis.

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Johan Hake
Solved:
Last query:
Last reply:
Revision history for this message
Best Johan Hake (johan-hake) said :
#1

If you are not using the dev version of dolfin you also need the dev
version of the other FEniCS packages: at least UFL, FFC, UFC, instant,
but posibly also viper and FIAT.

Most probably not dev versions of the external dependencies.

Johan

On 06/06/2012 03:40 PM, Luis Linares wrote:
> New question #199589 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/199589
>
> Hello,
>
> Before updating today to the dev version of Dolfin, i was able to run the following code:
>
> element_type = "Nedelec 1st kind H(curl)"
> element_order = 2
> V_c = FunctionSpace(mesh, element_type, element_order) #mesh is in 3D, is read from a XML file
> V = MixedFunctionSpace([V_c, V_c]) #Real part, imag. part
> Er, Ei = TrialFunctions(V)
> vr, vi = TestFunctions(V)
>
> fr = Function(FunctionSpace(mesh, "DG", 0)) # Constant values throughout a cell
> fi = Function(FunctionSpace(mesh, "DG", 0))
> #Filled fr, fi somehow....
>
> wf = -fr*(dot(Er, vr)+dot(Ei, vi))*dx + fi*(dot(Ei, vr) - dot(Er, vi))*dx \
> + dot(curl(Er), curl(vr))*dx + dot(curl(Ei), curl(vi))*dx
>
> n = FacetNormal(mesh)
> # Add surface term at excitation boundary
> d_exc = some_integer_index
> r_v = Expression(['x[{0:d}]'.format(i) for i in range(3)]) #This is to turn the position vector into an element for weak form
> k_dir_c = Constant( k_dir.tolist() ) # k_dir is a 3-element numpy array ...
> E0_c = Constant( E0.tolist() ) # ... and so is E0
> # ... real part
> #wf += dot(-k*cross(n, cross(Ei, n)) - k*sin(dot(k_dir_c, r_v))*cross(n, cross(E0_c, n-k_dir_c)), vr)*ds(d_exc)
> ## ... imaginary part
> #wf += dot(k*cross(n, cross(Er, n)) - k*cos(dot(k_dir_c, r_v))*cross(n, cross(E0_c, n-k_dir_c)), vi)*ds(d_exc)
>
> T = Function(V)
> a, L = lhs(wf), rhs(wf)
> problem = LinearVariationalProblem(a, L, T)
>
> When running into the last line, the following output shows up:
> Traceback (most recent call last):
> File "test_mx_9_post.py", line 112, in<module>
> problem = LinearVariationalProblem(wf, L, T)
> File "/usr/local/lib/python2.7/dist-packages/dolfin/fem/solving.py", line 80, in __init__
> a = Form(a, form_compiler_parameters=form_compiler_parameters)
> File "/usr/local/lib/python2.7/dist-packages/dolfin/fem/form.py", line 74, in __init__
> function_spaces)
> File "/usr/local/lib/python2.7/dist-packages/dolfin/fem/form.py", line 108, in _extract_function_spaces
> r = compiled_form.rank()
> File "/usr/lib/python2.7/dist-packages/ufc/ufc.py", line 262, in rank
> def rank(self): return _ufc.form_rank(self)
> TypeError: in method 'form_rank', argument 1 of type 'ufc::form const *'
>
> This is novel, as in the current ubuntu repo version it works fine. In a previous post, I indicated that to switch to the dev version, i just uninstalled dolfin, which also uninstalls the 'fenics' metapackage, leaving behind ffc, ufl, etc. untouched. Then I built dolfin and installed it in /usr/local. Build and installation were successful. What might have gone wrong here?
>
> Thanks,
>
> Luis.
>

Revision history for this message
Johannes Ring (johannr) said :
#2

There is a PPA with packages for the dev versions here:

https://launchpad.net/~fenics-packages/+archive/fenics-dev

Revision history for this message
Luis Linares (luis-linares) said :
#3

Kudos again Johan!

The installation of the whole suite was surprisingly easy! I installed every single package of FeniCS (I guess SyFy is part of UFC?) and it works!

Cheers,

Luis.

Revision history for this message
Luis Linares (luis-linares) said :
#4

Thanks Johan Hake, that solved my question.

Revision history for this message
Luis Linares (luis-linares) said :
#5

Hi Johannes, thanks for the datum. I'll try that out next time!