ufl team mailing list archive
-
ufl team
-
Mailing list archive
-
Message #02139
Re: [Question #227431]: UFL Exception : Found argument in Power(...)
Question #227431 on UFL changed:
https://answers.launchpad.net/ufl/+question/227431
Status: Open => Answered
Kristian B. Ølgaard proposed the following answer:
On 25 April 2013 11:06, imranal
<question227431@xxxxxxxxxxxxxxxxxxxxx>wrote:
> New question #227431 on FEniCS Project:
> https://answers.launchpad.net/fenics/+question/227431
>
> 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],0)
> def right(x,on_boundary):
> return on_boundary and near(x[0],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.
>
--
You received this question notification because you are a member of UFL
Team, which is an answer contact for UFL.