Problem with output Cahn-Hilliard demo due to function names

Issue #335 resolved
Steven Vandekerckhove created an issue

When outputting part of a mixed formulation, e.g., file << (u.split()[0], t) in the cahn-Hilliard demo the split function gives new names to the output every time step.

That way the results can not be properly played in Paraview.

Comments (6)

  1. Patrick Farrell

    Try the following diff:

    diff --git site-packages/dolfin/functions/function.py site-packages/dolfin/functions/function.py
    index 5897875..a3b8d08 100644
    --- site-packages/dolfin/functions/function.py
    +++ site-packages/dolfin/functions/function.py
    @@ -362,9 +362,9 @@ class Function(ufl.Coefficient, cpp.Function):
    
             # Create and instantiate the Function
             if deepcopy:
    -            return Function(self.function_space().sub(i), cpp.Function.sub(self, i))
    +            return Function(self.function_space().sub(i), cpp.Function.sub(self, i), name='%s:%d' % (str(self), i))
             else:
    -            return Function(self, i)
    +            return Function(self, i, name='%s:%d' % (str(self), i))
    
         def assign(self, rhs):
             """
    

    Suggestions for naming scheme (e.g. should the first component of a function called 'z' be 'z:0', 'z.0', 'z-0', ..?) welcome.

  2. Log in to comment