EQ_IPDG_Linear_Elliptic' object has no attribute 'CellSize

class EQ_IPDG_Linear_Elliptic(AFEM_Base):
‘’’
This is the EQ_IPDG_Linear_Elliptic problem class
‘’’
def str(self):
return ‘EQ_IPDG_Linear_Elliptic’

def initialize(self):
    self.alpha = Constant(30000.0)
    self.mesh = self.Example.mesh
    self.VErrorSpace = FunctionSpace(self.mesh, "DG", int(self.k + 2))
    self.VecErrorSpace = VectorFunctionSpace(self.mesh, "DG", int(self.k + 1))
    self.grad_error = Function(self.VecErrorSpace)
    self.LocalSpace = FunctionSpace(self.mesh, "DG", 0)
    V = FunctionSpace(self.mesh, "DG", self.k)
    V_ = VectorFunctionSpace(self.mesh, "DG", self.k)
    Space = V
    while Space.dim() < self.MINIMUM_DOF:
        for i in range(2):
            markers = MeshFunction("bool", self.mesh, self.mesh.topology().dim())
            for c in cells(self.mesh):
                markers[c] = True
            self.mesh = refine(self.mesh, markers)
        V = FunctionSpace(self.mesh, "DG", self.k)
        V_ = VectorFunctionSpace(self.mesh, "DG", self.k)
        Space = V
    return None
    
def update(self):
    # Update Solution Space
    self.V = FunctionSpace(self.mesh, "DG", self.k)
    self.V_ = VectorFunctionSpace(self.mesh, "DG", self.k)
    self.SolutionSpace = FunctionSpace(self.mesh, "DG", self.k)
    self.CURRENT_DOF = self.SolutionSpace.dim()
    # Break Criteria
    if (self.CURRENT_DOF > self.MAXIMUM_DOF) \
            or (self.CURRENT_ERROR < self.MAXIMUM_ERROR):
        return True
    else:
        # Update Other Spaces
        self.ScalarErrorSpace = FunctionSpace(self.mesh, "DG", int(self.k + 2))
        self.VectorErrorSpace = VectorFunctionSpace(self.mesh, "DG", int(self.k + 1))
        self.ScalarRHSSpace = FunctionSpace(self.mesh, "DG", int(self.k + 1))
        self.VectorRHSSpace = VectorFunctionSpace(self.mesh, "DG", int(self.k + 1))
        self.LocalSpace = FunctionSpace(self.mesh, "DG", 0)
        # Update Mesh Elements
        #boundaries = FacetFunction('size_t', self.mesh)
        #boundaries = MeshFunction('size_t', self.mesh)
        boundaries = MeshFunction("size_t", self.mesh, self.mesh.topology().dim()-1, 0)
        Gamma_D1 = DirichletBoundary_top()
        Gamma_D1.mark(boundaries, 2)        
        Gamma_D2 = DirichletBoundary_bottom()
        Gamma_D2.mark(boundaries, 4)
        Gamma_N1 = NeumannBoundary_left()
        Gamma_N1.mark(boundaries, 1)
        Gamma_N2 = NeumannBoundary_right()
        Gamma_N2.mark(boundaries, 3)

aa = interpolate(m(),self.LocalSpace)

        self.alpha = Constant(self.alpha)
        self.h_T = CellSize(self.mesh)
        self.h_E = FacetArea(self.mesh)
        self.h_T_avg = (self.h_T('+') + self.h_T('-'))/2.0
        self.h_E_avg = (self.h_E('+') + self.h_E('-'))/2.0
        self.n = FacetNormal(self.mesh)
        return False

The code snippet above gives this error when executed
" self.h_T = self.CellSize(self.mesh)

AttributeError: ‘EQ_IPDG_Linear_Elliptic’ object has no attribute ‘CellSize’ "

Again, as in

You are mixing class attributes with imported functions.

This means that it should be

self.h_T = CellSize(self.mesh)

self.h_T = CellSize(self.mesh) this still gives error

" self.h_T = CellSize(self.mesh)
NameError: name ‘CellSize’ is not defined"

I would suggest reading the changelog;
https://bitbucket.org/fenics-project/dolfin/src/bd54183ed40f3597fe1187499c79c54eb4759f6d/ChangeLog.rst?at=master#ChangeLog.rst-71,292,869

  • Deprecate CellSize (equivalent to 2*Circumradius) in favour of new CellDiameter; add MinCellEdgeLengthand MaxCellEdgeLength