# UFL Exception : Found argument in Power(...)

My question is as following : What does this error message tell me? (Error message has been added after the code.)

I was trying to solve the nonlinear Falkner-Skan equation through the following code :

"""
We solve the non-linear differential equation :

f''' + f*f'' + beta*(1 - (f')^2) = 0,

beta = 2*m/(1+m)

with the boundary conditions :

f'(0) = f(0) = 0, f'(inf) = 1,

also known as the Falkner-Skan equation.

This is a generalization of the Blasius boundary layer f,g
by considering a wedge at an angle of attack beta from
uniform velocity U.

The outer flow is of the form :

u_e(x) = U(x/L)^m
"""

from dolfin import *

N = 50
beta = Constant(2)
n = Constant(7) # value of "infinity"

mesh = UnitInterval(N)
V = FunctionSpace(mesh,"CG",2)
VV = V*V
gh = TrialFunction(VV)
g,h = split(gh)
vg,vh = TestFunctions(VV)

def left(x,on_boundary):
return on_boundary and near(x,0)
def right(x,on_boundary):
return on_boundary and near(x,1)

bc0 = DirichletBC(VV.sub(0), 0, left)
bc1 = DirichletBC(VV.sub(1), 0, left)
bc2 = DirichletBC(VV.sub(1), 1, right)
bcs = [bc0,bc1,bc2]

gh_ = Function(VV)
a = (-h.dx(0)*vh - n*n*h*g*vh + n*n*beta*(1 - h*h)*vg)*dx # Weak fomulation
L = Constant(0)*vg*dx
A,b = assemble_system(a,L,bcs)

The final line produces the following error message :

$python falk_skan_solver.py Traceback (most recent call last): File "falk_skan_solver.py", line 49, in <module> A,b = Assemble(a,L,bcs) NameError: name 'Assemble' is not defined crackhead@Crack:~/Programming/mek4300/mek4300_assignment/assignment2$ python falk_skan_solver.py
Calling FFC just-in-time (JIT) compiler, this may take some time.
Found Argument in Power(Indexed(Argument(MixedElement(*[FiniteElement('Lagrange', Cell('interval', Space(1)), 2, None), FiniteElement('Lagrange', Cell('interval', Space(1)), 2, None)], **{'value_shape': (2,) }), 1), MultiIndex((FixedIndex(1),), {})), IntValue(2, (), (), {})), this is an invalid expression.
Traceback (most recent call last):
File "falk_skan_solver.py", line 49, in <module>
A,b = assemble_system(a,L,bcs)
File "/usr/lib/python2.7/dist-packages/dolfin/fem/assembling.py", line 248, in assemble_system
subdomains, form_compiler_parameters)
File "/usr/lib/python2.7/dist-packages/dolfin/fem/form.py", line 54, in __init__
common_cell)
File "/usr/lib/python2.7/dist-packages/dolfin/compilemodules/jit.py", line 66, in mpi_jit
return local_jit(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/dolfin/compilemodules/jit.py", line 154, in jit
return jit_compile(form, parameters=p, common_cell=common_cell)
File "/usr/lib/python2.7/dist-packages/ffc/jitcompiler.py", line 73, in jit
return jit_form(ufl_object, parameters, common_cell)
File "/usr/lib/python2.7/dist-packages/ffc/jitcompiler.py", line 130, in jit_form
common_cell=common_cell)
File "/usr/lib/python2.7/dist-packages/ffc/compiler.py", line 150, in compile_form
analysis = analyze_forms(forms, object_names, parameters, common_cell)
File "/usr/lib/python2.7/dist-packages/ffc/analysis.py", line 64, in analyze_forms
common_cell) for form in forms)
File "/usr/lib/python2.7/dist-packages/ffc/analysis.py", line 64, in <genexpr>
common_cell) for form in forms)
File "/usr/lib/python2.7/dist-packages/ffc/analysis.py", line 151, in _analyze_form
ffc_assert(len(compute_form_arities(preprocessed_form)) == 1,
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py", line 332, in compute_form_arities
parts = compute_form_with_arity(form, arity)
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py", line 317, in compute_form_with_arity
res = transform_integrands(form, _transform)
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py", line 837, in transform_integrands
integrand = transform(itg.integrand())
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py", line 313, in _transform
e, provides = pe.visit(e)
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py", line 160, in visit
r = h(o)
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py", line 138, in sum
part, term_provides = self.visit(term)
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py", line 156, in visit
r = h(o, *map(self.visit, o.operands()))
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py", line 156, in visit
r = h(o, *map(self.visit, o.operands()))
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py", line 160, in visit
r = h(o)
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py", line 138, in sum
part, term_provides = self.visit(term)
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py", line 156, in visit
r = h(o, *map(self.visit, o.operands()))
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py", line 160, in visit
r = h(o)
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py", line 68, in expr
error("Found Argument in %s, this is an invalid expression." % repr(x))
File "/usr/lib/python2.7/dist-packages/ufl/log.py", line 148, in error
raise self._exception_type(self._format_raw(*message))
ufl.log.UFLException: Found Argument in Power(Indexed(Argument(MixedElement(*[FiniteElement('Lagrange', Cell('interval', Space(1)), 2, None), FiniteElement('Lagrange', Cell('interval', Space(1)), 2, None)], **{'value_shape': (2,) }), 1), MultiIndex((FixedIndex(1),), {})), IntValue(2, (), (), {})), this is an invalid expression.

## Question information

Language:
English Edit question
Status:
Solved
For:
UFL Edit question
Assignee:
No assignee Edit question
Solved by:
Kristian B. Ølgaard
Solved:
Last query:
 Revision history for this message  Kristian B. Ølgaard (k.b.oelgaard) said on 2013-04-25: #1

On 25 April 2013 11:06, imranal <email address hidden>wrote:

> New question #227431 on FEniCS Project:
>
> My question is as following : What does this error message tell me? (Error
> message has been added after the code.)
>
> I was trying to solve the nonlinear Falkner-Skan equation through the
> following code :
>
> """
> We solve the non-linear differential equation :
>
> f''' + f*f'' + beta*(1 - (f')^2) = 0,
>
> beta = 2*m/(1+m)
>
> with the boundary conditions :
>
> f'(0) = f(0) = 0, f'(inf) = 1,
>
> also known as the Falkner-Skan equation.
>
> This is a generalization of the Blasius boundary layer f,g
> by considering a wedge at an angle of attack beta from
> uniform velocity U.
>
> The outer flow is of the form :
>
> u_e(x) = U(x/L)^m
> """
>
> from dolfin import *
>
> N = 50
> beta = Constant(2)
> n = Constant(7) # value of "infinity"
>
> mesh = UnitInterval(N)
> V = FunctionSpace(mesh,"CG",2)
> VV = V*V
> gh = TrialFunction(VV)
> g,h = split(gh)
> vg,vh = TestFunctions(VV)
>
> def left(x,on_boundary):
> return on_boundary and near(x,0)
> def right(x,on_boundary):
> return on_boundary and near(x,1)
>
> bc0 = DirichletBC(VV.sub(0), 0, left)
> bc1 = DirichletBC(VV.sub(1), 0, left)
> bc2 = DirichletBC(VV.sub(1), 1, right)
> bcs = [bc0,bc1,bc2]
>
> gh_ = Function(VV)
> a = (-h.dx(0)*vh - n*n*h*g*vh + n*n*beta*(1 - h*h)*vg)*dx # Weak fomulation
>

Here you have a term h*h, so your bilinear form is not linear.
You will also run into a similar issue with the term h*g.
Finally the term n*n*beta*vg does not contain a trial function so it should
be in L not a.

L = Constant(0)*vg*dx
> A,b = assemble_system(a,L,bcs)
>
> The final line produces the following error message :
>
> $python falk_skan_solver.py > Traceback (most recent call last): > File "falk_skan_solver.py", line 49, in <module> > A,b = Assemble(a,L,bcs) > NameError: name 'Assemble' is not defined > crackhead@Crack:~/Programming/mek4300/mek4300_assignment/assignment2$
> python falk_skan_solver.py
> Calling FFC just-in-time (JIT) compiler, this may take some time.
> Found Argument in
> Power(Indexed(Argument(MixedElement(*[FiniteElement('Lagrange',
> Cell('interval', Space(1)), 2, None), FiniteElement('Lagrange',
> Cell('interval', Space(1)), 2, None)], **{'value_shape': (2,) }), 1),
> MultiIndex((FixedIndex(1),), {})), IntValue(2, (), (), {})), this is an
> invalid expression.
> Traceback (most recent call last):
> File "falk_skan_solver.py", line 49, in <module>
> A,b = assemble_system(a,L,bcs)
> File "/usr/lib/python2.7/dist-packages/dolfin/fem/assembling.py", line
> 248, in assemble_system
> subdomains, form_compiler_parameters)
> File "/usr/lib/python2.7/dist-packages/dolfin/fem/form.py", line 54, in
> __init__
> common_cell)
> File "/usr/lib/python2.7/dist-packages/dolfin/compilemodules/jit.py",
> line 66, in mpi_jit
> return local_jit(*args, **kwargs)
> File "/usr/lib/python2.7/dist-packages/dolfin/compilemodules/jit.py",
> line 154, in jit
> return jit_compile(form, parameters=p, common_cell=common_cell)
> File "/usr/lib/python2.7/dist-packages/ffc/jitcompiler.py", line 73, in
> jit
> return jit_form(ufl_object, parameters, common_cell)
> File "/usr/lib/python2.7/dist-packages/ffc/jitcompiler.py", line 130, in
> jit_form
> common_cell=common_cell)
> File "/usr/lib/python2.7/dist-packages/ffc/compiler.py", line 150, in
> compile_form
> analysis = analyze_forms(forms, object_names, parameters, common_cell)
> File "/usr/lib/python2.7/dist-packages/ffc/analysis.py", line 64, in
> analyze_forms
> common_cell) for form in forms)
> File "/usr/lib/python2.7/dist-packages/ffc/analysis.py", line 64, in
> <genexpr>
> common_cell) for form in forms)
> File "/usr/lib/python2.7/dist-packages/ffc/analysis.py", line 151, in
> _analyze_form
> ffc_assert(len(compute_form_arities(preprocessed_form)) == 1,
> File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py",
> line 332, in compute_form_arities
> parts = compute_form_with_arity(form, arity)
> File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py",
> line 317, in compute_form_with_arity
> res = transform_integrands(form, _transform)
> File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py", line
> 837, in transform_integrands
> integrand = transform(itg.integrand())
> File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py",
> line 313, in _transform
> e, provides = pe.visit(e)
> File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py", line
> 160, in visit
> r = h(o)
> File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py",
> line 138, in sum
> part, term_provides = self.visit(term)
> File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py", line
> 156, in visit
> r = h(o, *map(self.visit, o.operands()))
> File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py", line
> 156, in visit
> r = h(o, *map(self.visit, o.operands()))
> File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py", line
> 160, in visit
> r = h(o)
> File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py",
> line 138, in sum
> part, term_provides = self.visit(term)
> File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py", line
> 156, in visit
> r = h(o, *map(self.visit, o.operands()))
> File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py", line
> 160, in visit
> r = h(o)
> File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py",
> line 68, in expr
> error("Found Argument in %s, this is an invalid expression." % repr(x))
> File "/usr/lib/python2.7/dist-packages/ufl/log.py", line 148, in error
> raise self._exception_type(self._format_raw(*message))
> ufl.log.UFLException: Found Argument in
> Power(Indexed(Argument(MixedElement(*[FiniteElement('Lagrange',
> Cell('interval', Space(1)), 2, None), FiniteElement('Lagrange',
> Cell('interval', Space(1)), 2, None)], **{'value_shape': (2,) }), 1),
> MultiIndex((FixedIndex(1),), {})), IntValue(2, (), (), {})), this is an
> invalid expression.
>
> --
> You received this question notification because you are a member of
> FEniCS Team, which is an answer contact for FEniCS Project.
>

 Revision history for this message Martin Sandve Alnæs (martinal) said on 2013-04-25: #2

You can't take something to the power of a test or trial function (== Argument).

 Revision history for this message Johan Hake (johan-hake) said on 2013-04-25: #3

A small sigh...

The error message is pretty confusing. One _really_ need to know what
FEniCS mean with "argument" for it to make any sense. Using arguments
for basis function does not really work for me.

Johan

On 04/25/2013 11:41 AM, Martin Sandve Alnæs wrote:
> Question #227431 on UFL changed:
>
> Martin Sandve Alnæs proposed the following answer:
> You can't take something to the power of a test or trial function (==
> Argument).
>

 Revision history for this message Jan Blechta (blechta) said on 2013-04-25: #4

On Thu, 25 Apr 2013 09:06:39 -0000
> New question #227431 on FEniCS Project:
>
> My question is as following : What does this error message tell me?
> (Error message has been added after the code.)
>
> I was trying to solve the nonlinear Falkner-Skan equation through the
> following code :
>
> """
> We solve the non-linear differential equation :
>
> f''' + f*f'' + beta*(1 - (f')^2) = 0,
>
> beta = 2*m/(1+m)
>
> with the boundary conditions :
>
> f'(0) = f(0) = 0, f'(inf) = 1,
>
> also known as the Falkner-Skan equation.
>
> This is a generalization of the Blasius boundary layer f,g
> by considering a wedge at an angle of attack beta from
> uniform velocity U.
>
> The outer flow is of the form :
>
> u_e(x) = U(x/L)^m
> """
>
> from dolfin import *
>
> N = 50
> beta = Constant(2)
> n = Constant(7) # value of "infinity"
>
> mesh = UnitInterval(N)
> V = FunctionSpace(mesh,"CG",2)
> VV = V*V
> gh = TrialFunction(VV)
> g,h = split(gh)
> vg,vh = TestFunctions(VV)
>
> def left(x,on_boundary):
> return on_boundary and near(x,0)
> def right(x,on_boundary):
> return on_boundary and near(x,1)
>
> bc0 = DirichletBC(VV.sub(0), 0, left)
> bc1 = DirichletBC(VV.sub(1), 0, left)
> bc2 = DirichletBC(VV.sub(1), 1, right)
> bcs = [bc0,bc1,bc2]
>
> gh_ = Function(VV)
> a = (-h.dx(0)*vh - n*n*h*g*vh + n*n*beta*(1 - h*h)*vg)*dx # Weak

Clearly this is not bilinear form. You need to solve it as nonlinear
problem - by Newton solver, SNES solver or Picard (fixed-point)
iteration.

> fomulation L = Constant(0)*vg*dx
> A,b = assemble_system(a,L,bcs)
>
> The final line produces the following error message :
>
> $python falk_skan_solver.py > Traceback (most recent call last): > File "falk_skan_solver.py", line 49, in <module> > A,b = Assemble(a,L,bcs) > NameError: name 'Assemble' is not defined > crackhead@Crack:~/Programming/mek4300/mek4300_assignment/assignment2$
> python falk_skan_solver.py Calling FFC just-in-time (JIT) compiler,
> this may take some time. Found Argument in
> Power(Indexed(Argument(MixedElement(*[FiniteElement('Lagrange',
> Cell('interval', Space(1)), 2, None), FiniteElement('Lagrange',
> Cell('interval', Space(1)), 2, None)], **{'value_shape': (2,) }), 1),
> MultiIndex((FixedIndex(1),), {})), IntValue(2, (), (), {})), this is
> an invalid expression. Traceback (most recent call last): File
> "falk_skan_solver.py", line 49, in <module> A,b =
> assemble_system(a,L,bcs) File
> "/usr/lib/python2.7/dist-packages/dolfin/fem/assembling.py", line
> 248, in assemble_system subdomains, form_compiler_parameters) File
> "/usr/lib/python2.7/dist-packages/dolfin/fem/form.py", line 54, in
> __init__ common_cell) File
> "/usr/lib/python2.7/dist-packages/dolfin/compilemodules/jit.py", line
> 66, in mpi_jit return local_jit(*args, **kwargs) File
> "/usr/lib/python2.7/dist-packages/dolfin/compilemodules/jit.py", line
> 154, in jit return jit_compile(form, parameters=p,
> common_cell=common_cell) File
> "/usr/lib/python2.7/dist-packages/ffc/jitcompiler.py", line 73, in
> jit return jit_form(ufl_object, parameters, common_cell) File
> "/usr/lib/python2.7/dist-packages/ffc/jitcompiler.py", line 130, in
> jit_form common_cell=common_cell) File
> "/usr/lib/python2.7/dist-packages/ffc/compiler.py", line 150, in
> compile_form analysis = analyze_forms(forms, object_names,
> parameters, common_cell) File
> "/usr/lib/python2.7/dist-packages/ffc/analysis.py", line 64, in
> analyze_forms common_cell) for form in forms) File
> "/usr/lib/python2.7/dist-packages/ffc/analysis.py", line 64, in
> <genexpr> common_cell) for form in forms) File
> "/usr/lib/python2.7/dist-packages/ffc/analysis.py", line 151, in
> _analyze_form ffc_assert(len(compute_form_arities(preprocessed_form))
> == 1, File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py",
> line 332, in compute_form_arities parts =
> compute_form_with_arity(form, arity) File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py",
> line 317, in compute_form_with_arity res = transform_integrands(form,
> _transform) File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py",
> line 837, in transform_integrands integrand =
> transform(itg.integrand()) File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py",
> line 313, in _transform e, provides = pe.visit(e) File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py",
> line 160, in visit r = h(o) File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py",
> line 138, in sum part, term_provides = self.visit(term) File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py",
> line 156, in visit r = h(o, *map(self.visit, o.operands())) File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py",
> line 156, in visit r = h(o, *map(self.visit, o.operands())) File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py",
> line 160, in visit r = h(o) File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py",
> line 138, in sum part, term_provides = self.visit(term) File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py",
> line 156, in visit r = h(o, *map(self.visit, o.operands())) File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/transformations.py",
> line 160, in visit r = h(o) File
> "/usr/lib/python2.7/dist-packages/ufl/algorithms/formtransformations.py",
> line 68, in expr error("Found Argument in %s, this is an invalid
> expression." % repr(x)) File
> "/usr/lib/python2.7/dist-packages/ufl/log.py", line 148, in error
> raise self._exception_type(self._format_raw(*message))
> ufl.log.UFLException: Found Argument in
> Power(Indexed(Argument(MixedElement(*[FiniteElement('Lagrange',
> Cell('interval', Space(1)), 2, None), FiniteElement('Lagrange',
> Cell('interval', Space(1)), 2, None)], **{'value_shape': (2,) }), 1),
> MultiIndex((FixedIndex(1),), {})), IntValue(2, (), (), {})), this is
> an invalid expression.
>

 Revision history for this message imranal (imranal) said on 2013-04-25: #5

Thanks Kristian, managed to move the relevant term to the right hand side. The equation is nonlinear, hence I will use Newton¨s Method to solve the problem (had not gotten that far - if I am not mistaken, by deafult that is what the solver uses).

Martin are you referring to the h^2 term in the weak formulation ?

I corrected as Kristian instructed, and got another error message.

The error message :

\$ python falk_skan_solver.py
Calling FFC just-in-time (JIT) compiler, this may take some time.
Unable to extract all indices.
Traceback (most recent call last):
File "falk_skan_solver.py", line 49, in <module>
A,b = assemble_system(a,L,bcs)
File "/usr/lib/python2.7/dist-packages/dolfin/fem/assembling.py", line 248, in assemble_system
subdomains, form_compiler_parameters)
File "/usr/lib/python2.7/dist-packages/dolfin/fem/form.py", line 54, in __init__
common_cell)
File "/usr/lib/python2.7/dist-packages/dolfin/compilemodules/jit.py", line 66, in mpi_jit
return local_jit(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/dolfin/compilemodules/jit.py", line 154, in jit
return jit_compile(form, parameters=p, common_cell=common_cell)
File "/usr/lib/python2.7/dist-packages/ffc/jitcompiler.py", line 73, in jit
return jit_form(ufl_object, parameters, common_cell)
File "/usr/lib/python2.7/dist-packages/ffc/jitcompiler.py", line 130, in jit_form
common_cell=common_cell)
File "/usr/lib/python2.7/dist-packages/ffc/compiler.py", line 155, in compile_form
ir = compute_ir(analysis, parameters, common_cell)
File "/usr/lib/python2.7/dist-packages/ffc/representation.py", line 83, in compute_ir
for (i, fd) in enumerate(form_datas)]
File "/usr/lib/python2.7/dist-packages/ffc/representation.py", line 214, in _compute_integral_ir
common_cell)
File "/usr/lib/python2.7/dist-packages/ffc/tensor/tensorrepresentation.py", line 84, in compute_integral_ir
common_cell)
File "/usr/lib/python2.7/dist-packages/ffc/tensor/tensorrepresentation.py", line 136, in _compute_terms
common_cell)
File "/usr/lib/python2.7/dist-packages/ffc/tensor/referencetensor.py", line 59, in __init__
self.primary_multi_index = create_multiindex(primary_indices)
File "/usr/lib/python2.7/dist-packages/ffc/tensor/multiindex.py", line 54, in create_multiindex
error("Unable to extract all indices.")
File "<string>", line 1, in <lambda>
File "/usr/lib/python2.7/dist-packages/ufl/log.py", line 148, in error
raise self._exception_type(self._format_raw(*message))
Exception: Unable to extract all indices.

This time I managed to locate the possible cause :

According to http://fenicsproject.org/documentation/tutorial/misc.html , there are apparently three reasons for the error :

1. missing either the TrialFunction or the TestFunction object,
2. no terms without TrialFunction objects.
3. mathematically invalid operations in the variational form.

Here is the changed code :

a = (-h.dx(0)*vh - n*n*h*g*vh - n*n*beta*h*h*vg)*dx
L = -n*n*vg*dx
A,b = assemble_system(a,L,bcs)

I am inclining towards the third option here. But I can¨t seem to find this invalid operation.

 Revision history for this message imranal (imranal) said on 2013-04-25: #6

Ops did not mean to reopen the problem, but wanted to add a followup question.

 Revision history for this message imranal (imranal) said on 2013-04-25: #7

On the second thought I will repost the new error on a separate thread. Would sure love to delete that post.

 Revision history for this message imranal (imranal) said on 2013-04-25: #8

Thanks Kristian B. Ølgaard, that solved my question.

 Revision history for this message imranal (imranal) said on 2013-04-25: #9

For the last issue I was having, I found a relevant post :

 Revision history for this message Jan Blechta (blechta) said on 2013-04-25: #10

You need to subclass NonlinearProblem to use NewtonSolver (check Cahn-Hilliard demo) or define NonlinearVariationalProblem and NonlinearVariationSolver would use Newton or SNES solver automatically:

gh = Function(VV) # not TrialFunction!
g, h = gh, gh
F = (-h.dx(0)*vh - n*n*h*g*vh + n*n*beta*(1 - h*h)*vg)*dx
J = derivative(F, gh)
problem = NonlinearVariationalProblem(F, gh, bcs, J=J)
solver = NonlinearVariationalSolver(problem)
solver.solve()

You can't assemble your form a! It is not valid bilinear form because it depends in quadratic way on trial function h. You can't express such a form by application of some matrix to basis functions:
a(v_i, v_j) = inner(v_i, A*v_j)

 Revision history for this message Jan Blechta (blechta) said on 2013-04-25: #11

Of course last line should be:
a(v_i, v_j) = A[i, j]

 Revision history for this message imranal (imranal) said on 2013-04-25: #12

Its funny, because I was reading the Cahn-Hilliard demo before I saw your post :)

http://fenicsproject.org/documentation/dolfin/1.2.0/python/demo/pde/cahn-hilliard/python/documentation.html

Thanks Jan!