← Back to team overview

dolfin team mailing list archive

Re: [Question #95908]: Error: Invalid value rank for coefficient 1

 

Question #95908 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/95908

    Status: Answered => Open

Phil Marinier is still having a problem:
I tried this:

element = FiniteElement("Lagrange", triangle, 1)
VE = VectorElement("Lagrange", triangle, 1)

v = TestFunction(element)
u = TrialFunction(element)
f = Function(element)
g = Function(VE)

a = inner(grad(v), grad(u))*dx
L = v*f*dx + v*g*ds(3)


This was the error message:


phil@wolf:~/Desktop/Domain Decomposition$ ffc -l dolfin -O Laplace.ufl
This is FFC, the FEniCS Form Compiler, version 0.7.1.
For further information, visit http://www.fenics.org/ffc/.

Trying to integrate expression of rank 1 with free indices ().
An exception occured during evaluation of form file.
To help you find the location of the error, a temporary script
'Laplace_debug.py'
has been created and will now be executed with debug output enabled:
Trying to integrate expression of rank 1 with free indices ().
Traceback (most recent call last):
  File "/home/claude/FEniCS/build/bin/ffc", line 153, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/home/claude/FEniCS/build/bin/ffc", line 130, in main
    ufd = load_ufl_file(filename)
  File "/home/claude/FEniCS/build/lib/python2.6/site-packages/ufl/algorithms/formfiles.py", line 91, in load_ufl_file
    m = __import__(basename)
  File "/home/phil/Desktop/Domain Decomposition/Laplace_debug.py", line 13, in <module>
    L = v*f*dx + v*g*ds(3)
  File "/home/claude/FEniCS/build/lib/python2.6/site-packages/ufl/integral.py", line 94, in __rmul__
    % (integrand.rank(), integrand.free_indices()))
  File "/home/claude/FEniCS/build/lib/python2.6/site-packages/ufl/assertions.py", line 20, in ufl_assert
    if not condition: error(*message)
  File "/home/claude/FEniCS/build/lib/python2.6/site-packages/ufl/log.py", line 106, in error
    raise UFLException(self._format_raw(*message))
ufl.log.UFLException: Trying to integrate expression of rank 1 with free indices ().


I assumed because of the "rank 1" in the error message that the problem was that I was using a vector valued element for g and that wasn't allowed. I know that I can't use VectorElements for my test and trial functions because it messes up the dot product. 

I guess my real question is how would I go about re writing the form
file to get a neumann boundary condition on one boundary that has both X
and Y components?

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.