This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

'if' loop never satisfied in marking mesh for refining in fenics 1.5?

0 votes

Hi, I am trying to solve a DG problem over a mesh and using custom error-estimators to refine the mesh in Dorfler kind of marking. my code used to work fine with fenics 1.4, but after updating to fenics 1.5 I get a message
" UnboundLocalError: local variable 'eta_min' referenced before assignment "
the 'if' loop is

for eta_item in marking_estimators:
    # Get a lower bound for estimator limit to refine
    eta_argsort = eta_item.argsort()
    eta_argsort_max = eta_argsort[::-1]
    eta_sum = sum(i for i in eta_item)
    eta_limit = theta * eta_sum
    eta_marked = 0.
    for i in eta_argsort_max:
        eta_marked += eta_item[i]
        if eta_marked > eta_limit:
            eta_min = eta_item[i]
            break
    # Mark according to lower bound
    for c in cells(mesh):
        dof_ind = LocalSpace.dofmap().cell_dofs(c.index())[0]
        bool_markers[c] = (eta_item[dof_ind] >= eta_min)

any help is appreciated.
Thank you.

asked Jul 7, 2015 by dndash FEniCS Novice (330 points)
edited Jul 15, 2015 by dndash
...