### Found different Arguments with same number and part.

252
views
1
8 months ago by

Hi all,

I'm looking to move to FEniCS as my main solver for Navier-Stokes systems. So far I've modified the fully working ft07_navier_stokes_channel.py example and inserted a (stationary) NS system. It is however giving me an error that I can't make any sense of:
Found different Arguments with same number and part.
Did you combine test or trial functions from different spaces?
The Arguments found are:
v_1
v_0
v_1
v_0

Can someone please explain what that means? As far as I can tell the trial and test functions are in the right spaces and it seems to be wanting an initial value for the test function.

I stripped out almost all parameters and Expressions to arrive at this minimal working example, which is also failing with the same error:

from fenics import *

# Create mesh and define function spaces
mesh = UnitSquareMesh(16, 16)
V = VectorFunctionSpace(mesh, 'P', 1)
Q = FunctionSpace(mesh, 'P', 1)

# Define boundaries
walls   = 'near(x[1], 0) || near(x[1], 1)'

# Define boundary conditions
bcu_noslip  = DirichletBC(V, Constant((0, 0)), walls)
bcu = [bcu_noslip]

# Define trial and test functions
u = TrialFunction(V)
v = TestFunction(V)
p = TrialFunction(Q)
q = TestFunction(Q)

# Define expressions used in variational forms
g = Expression( ('0.0', '-exp(x[1])'), degree=3 )
f = Expression( 'exp(x[1])' , degree=3)

F = - p*div(v)*dx \
+ div(u)*q*dx \
+ dot(u,g)*q*dx \
- dot(g,v)*dx \
- f*q*dx

a, L = lhs(F), rhs(F)

U = Function(V)
solve( a == L, U, bcu)

Full error output is:

Found different Arguments with same number and part.
Did you combine test or trial functions from different spaces?
The Arguments found are:
v_1
v_0
v_1
v_0
Traceback (most recent call last):
File "melt_VQspace.py", line 38, in <module>
a, L = lhs(F), rhs(F)
File "/usr/lib/python2.7/dist-packages/ufl/formoperators.py", line 82, in lhs
return compute_form_lhs(form)
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py", line 375, in compute_form_lhs
return compute_form_with_arity(form, 2)
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py", line 319, in compute_form_with_arity
arguments = form.arguments()
File "/usr/lib/python2.7/dist-packages/ufl/form.py", line 225, in arguments
self._analyze_form_arguments()
File "/usr/lib/python2.7/dist-packages/ufl/form.py", line 451, in _analyze_form_arguments
arguments, coefficients = extract_arguments_and_coefficients(self)
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/analysis.py", line 132, in extract_arguments_and_coefficients
error(msg)
File "/usr/lib/python2.7/dist-packages/ufl/log.py", line 171, in error
raise self._exception_type(self._format_raw(*message))
ufl.log.UFLException: Found different Arguments with same number and part.
Did you combine test or trial functions from different spaces?
The Arguments found are:
v_1
v_0
v_1
v_0
Aborted (core dumped)


python-dolfin is version 2016.2.0-5build3. python-ufl is 2016.2.0-2.

Thanks for the help.

Community: FEniCS Project

You have to setup the problem on MixedElement.
The solution function, U, must be from a mixed space (i.e. V x Q) and test and trial functions must be properly extracted from
Exactly. You indeed combine test and trial functions from different spaces V and Q. The demo is functional because the system is decoupled there.