integral

Asked by eagle

i define volume as this instead of 1*dx

volume = assemble(Constant(1), mesh=mesh)
  dif = (g1+g2+2)/Constant(volume))*dx
but

Unable to convert object to a UFL form: Coefficient(FiniteElement('Discontinuous Lagrange', Cell(None, 1, Space(?)), 0), 5)
Traceback (most recent call last):
  File "3.py", line 86, in <module>
    volume = assemble(Constant(1) , mesh=mesh)
  File "/home/Mohseni/Work/FEniCS/lib/python2.6/site-packages/dolfin/fem/assemble.py", line 100, in assemble
    common_cell=common_cell)
  File "/home/Mohseni/Work/FEniCS/lib/python2.6/site-packages/dolfin/fem/form.py", line 34, in __init__
    (self._compiled_form, module, self.form_data) = jit(form, form_compiler_parameters, common_cell)
  File "/home/Mohseni/Work/FEniCS/lib/python2.6/site-packages/dolfin/compilemodules/jit.py", line 47, in mpi_jit
    return local_jit(*args, **kwargs)
  File "/home/Mohseni/Work/FEniCS/lib/python2.6/site-packages/dolfin/compilemodules/jit.py", line 114, in jit
    return jit_compile(form, parameters=p, common_cell=common_cell)
  File "/home/Mohseni/Work/FEniCS/lib/python2.6/site-packages/ffc/jitcompiler.py", line 64, in jit
    return jit_form(object, parameters, common_cell)
  File "/home/Mohseni/Work/FEniCS/lib/python2.6/site-packages/ffc/jitcompiler.py", line 72, in jit_form
    form = as_form(form)
  File "/home/Mohseni/Work/FEniCS/lib/python2.6/site-packages/ufl/algorithms/tuplenotation.py", line 83, in as_form
    error("Unable to convert object to a UFL form: %s" % repr(form))
  File "/home/Mohseni/Work/FEniCS/lib/python2.6/site-packages/ufl/log.py", line 124, in error
    raise UFLException(self._format_raw(*message))
ufl.log.UFLException: Unable to convert object to a UFL form: Coefficient(FiniteElement('Discontinuous Lagrange', Cell(None, 1, Space(?)), 0), 5)

Question information

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

On Saturday August 20 2011 06:15:45 eagle wrote:
> New question #168647 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/168647
>
> i define volume as this instead of 1*dx
>
> volume = assemble(Constant(1), mesh=mesh)

You can only assemble integrals. Sorry to missinform you in my previous
answer. This will work:

  volume = assemble(Constant(1)*dx, mesh=mesh)

I forgot to include the '*dx'

Johan

> dif = (g1+g2+2)/Constant(volume))*dx
> but
>
>
>
> Unable to convert object to a UFL form:
> Coefficient(FiniteElement('Discontinuous Lagrange', Cell(None, 1,
> Space(?)), 0), 5) Traceback (most recent call last):
> File "3.py", line 86, in <module>
> volume = assemble(Constant(1) , mesh=mesh)
> File
> "/home/Mohseni/Work/FEniCS/lib/python2.6/site-packages/dolfin/fem/assemble
> .py", line 100, in assemble common_cell=common_cell)
> File
> "/home/Mohseni/Work/FEniCS/lib/python2.6/site-packages/dolfin/fem/form.py"
> , line 34, in __init__ (self._compiled_form, module, self.form_data) =
> jit(form, form_compiler_parameters, common_cell) File
> "/home/Mohseni/Work/FEniCS/lib/python2.6/site-packages/dolfin/compilemodul
> es/jit.py", line 47, in mpi_jit return local_jit(*args, **kwargs)
> File
> "/home/Mohseni/Work/FEniCS/lib/python2.6/site-packages/dolfin/compilemodul
> es/jit.py", line 114, in jit return jit_compile(form, parameters=p,
> common_cell=common_cell) File
> "/home/Mohseni/Work/FEniCS/lib/python2.6/site-packages/ffc/jitcompiler.py"
> , line 64, in jit return jit_form(object, parameters, common_cell)
> File
> "/home/Mohseni/Work/FEniCS/lib/python2.6/site-packages/ffc/jitcompiler.py"
> , line 72, in jit_form form = as_form(form)
> File
> "/home/Mohseni/Work/FEniCS/lib/python2.6/site-packages/ufl/algorithms/tupl
> enotation.py", line 83, in as_form error("Unable to convert object to a UFL
> form: %s" % repr(form)) File
> "/home/Mohseni/Work/FEniCS/lib/python2.6/site-packages/ufl/log.py", line
> 124, in error raise UFLException(self._format_raw(*message))
> ufl.log.UFLException: Unable to convert object to a UFL form:
> Coefficient(FiniteElement('Discontinuous Lagrange', Cell(None, 1,
> Space(?)), 0), 5)

Can you help with this problem?

Provide an answer of your own, or ask eagle for more information if necessary.

To post a message you must log in.