Naming components of mixed function
Dear all, How can I name the components of a function in a mixed function space, so that I can then easily visualize the results based on their names? For example, say that I have V = FunctionSpace(mesh, "CG", 1) W = V*V w = Function(W) w1, w2 = split(w) output_file = File('results.pvd') output_file.write(w1, w2, time=t) I would like to give names to w1 and w2. Regards, Anna. -- Dr Anna Kalogirou Research Fellow School of Mathematics University of Leeds http://www1.maths.leeds.ac.uk/~matak/
On 14/06/16 14:00, Anna Kalogirou wrote:
Dear all,
How can I name the components of a function in a mixed function space, so that I can then easily visualize the results based on their names?
For example, say that I have
V = FunctionSpace(mesh, "CG", 1) W = V*V
w = Function(W) w1, w2 = split(w)
w1.rename("foo") w2.rename("bar") If you don't do this, we give you names like: w_name[cmpt-0], c_name[cmpt-1] which is not very helpful. When you first make a function you can do: w = Function(W, name="some_name") we could extend the API to allow you to pass a list of names that apply to the components. This would be easy to do if you'd like to try.
output_file = File('results.pvd') output_file.write(w1, w2, time=t)
I would like to give names to w1 and w2.
Lawrence
Thanks Lawrence, I should note that w1.rename("foo") w2.rename("bar") only works after a w1, w2 = w.split() command, but not after the split(w). I would indeed be helpful to apply names to the components using the "name" option of the function in the mixed space. Colin, I just didn't like the names function_8 etc that Paraview shows if you output multiple fields. Best, Anna. Dr Anna Kalogirou Research Fellow School of Mathematics University of Leeds http://www1.maths.leeds.ac.uk/~matak/ On 14/06/16 14:04, Lawrence Mitchell wrote:
On 14/06/16 14:00, Anna Kalogirou wrote:
Dear all,
How can I name the components of a function in a mixed function space, so that I can then easily visualize the results based on their names?
For example, say that I have
V = FunctionSpace(mesh, "CG", 1) W = V*V
w = Function(W) w1, w2 = split(w) w1.rename("foo") w2.rename("bar")
If you don't do this, we give you names like:
w_name[cmpt-0], c_name[cmpt-1] which is not very helpful.
When you first make a function you can do:
w = Function(W, name="some_name")
we could extend the API to allow you to pass a list of names that apply to the components. This would be easy to do if you'd like to try.
output_file = File('results.pvd') output_file.write(w1, w2, time=t)
I would like to give names to w1 and w2. Lawrence
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
participants (2)
- 
                
                Anna Kalogirou
- 
                
                Lawrence Mitchell