"ufl.log.UFLException: Invalid cell 1.0"

Hi everyone,

I’m very new to FEniCS. Assemble does not work properly getting some error in line writing likes this given below.

So, I modified the code, but I can’t solve this error. Help me~~


from dolfin import *
from ufl import *
import sys

class Forms(object):


def V0constrainedE(self):
    mesh = self.parameters["mesh"]
    u = self.parameters["displacement_variable"]
    ds = Measure('ds',subdomain_data = self.parameters["facetboundaries"])
    dsendo = ds(self.parameters["endoid"], domain = self.parameters["mesh"], subdomain_data = self.parameters["facetboundaries"])
    pendo = self.parameters["volconst_variable"]
    V0= self.parameters["constrained_vol"]
    
    X = SpatialCoordinate(mesh)
    x = u + X
    
    F = self.Fmat()
    N = self.parameters["facet_normal"]
    n = cofac(F)*N

    area = assemble(Constant(1.0) * dsendo)
    V_u = -Constant(1.0/3.0) * inner(x, n)
    Wvol = (Constant(1.0/area) * pendo  * V0 * dsendo) - (pendo * V_u *dsendo)
    
    return (Wvol)

rm: cannot remove '*.pvtu': No such file or directory
Invalid cell 1.0.
Traceback (most recent call last):
  File "LV_closed.py", line 172, in <module>
    Wvol = uflforms.V0constrainedE()
  File "/home/dmryu/FEniCS/forms.py", line 94, in V0constrainedE
    area = assemble(Constant(1.0) * dsendo)
  File "/usr/lib/python3/dist-packages/ufl/coefficient.py", line 125, in Constant
    domain = as_domain(domain)
  File "/usr/lib/python3/dist-packages/ufl/domain.py", line 296, in as_domain
    cell = as_cell(domain)
  File "/usr/lib/python3/dist-packages/ufl/cell.py", line 329, in as_cell
    error("Invalid cell %s." % cell)
  File "/usr/lib/python3/dist-packages/ufl/log.py", line 172, in error
    raise self._exception_type(self._format_raw(*message))
ufl.log.UFLException: Invalid cell 1.0.

You need to supply a minimal working example, as there is no way to reproduce your error. See Read before posting: How do I get my question answered? on guidelines for a minimal working example.