Problem with paraview and vector functions
Dear all, I encountered a problem when visualizing a function of a vector function space in paraview, if the order of the finite element is higher than 1. For example, if I run the following code, paraview shows the error message: "Cell type UnknownClass(69) is not a 3D cell. Missing original point id arrays. " mesh = UnitSquareMesh(10, 10) V = VectorFunctionSpace(mesh, "CG", 2) v = Function(V) outfile = File("test.pvd") outfile.write(v) If I replace the instruction "V = VectorFunctionSpace(mesh, "CG", 2)" with "V = VectorFunctionSpace(mesh, "CG", 1)", then I can visualize correctly the function in paraview. Could you please explain me which is my mistake? As temporary solution I have defined an additional space V_2 = VectorFunctionSpace(mesh, "CG", 1), on which I interpolate the function v, although I am not really satisfied with the outcome. Thank you in advance for the help, Best regards, Luca -- Dr. Luca Mechelli Wissenschaftlicher Mitarbeiter Arbeitsgruppe Numerik Fachbereich Mathematik und Statistik Universität Konstanz Fach D 198 D-78464 Konstanz Telefon: +49-(0) 7531-88-3646
Dear Luca,
On 12 Mar 2021, at 10:37, luca.mechelli@uni-konstanz.de wrote:
Dear all,
I encountered a problem when visualizing a function of a vector function space in paraview, if the order of the finite element is higher than 1. For example, if I run the following code, paraview shows the error message: "Cell type UnknownClass(69) is not a 3D cell. Missing original point id arrays. "
mesh = UnitSquareMesh(10, 10) V = VectorFunctionSpace(mesh, "CG", 2) v = Function(V) outfile = File("test.pvd") outfile.write(v)
If I replace the instruction "V = VectorFunctionSpace(mesh, "CG", 2)" with "V = VectorFunctionSpace(mesh, "CG", 1)", then I can visualize correctly the function in paraview. Could you please explain me which is my mistake?
As temporary solution I have defined an additional space V_2 = VectorFunctionSpace(mesh, "CG", 1), on which I interpolate the function v, although I am not really satisfied with the outcome.
I suspect this is because your version of paraview is a bit old. For quadratic (and higher degree) elements, we write VTU files using Paraview's (relatively) recent native support for these elements [this kitware post describes things https://blog.kitware.com/modeling-arbitrary-order-lagrange-finite-elements-i...]. See also https://www.firedrakeproject.org/visualisation.html#visualising-high-order-d... I think support for this was introduced in Paraview 5.5, so if your version is older then things won't work. One way around this is to interpolate the solution to the low order space. You can have the File object manage this by saying: outfile = File("test.pvd", target_degree=1) but this will lose information. Thanks, Lawrence
Dear Lawrence, Il giorno Venerdi, Marzo 12, 2021 11:47 CET, Lawrence Mitchell <wence@gmx.li> ha scritto:
Dear Luca,
On 12 Mar 2021, at 10:37, luca.mechelli@uni-konstanz.de wrote:
Dear all,
I encountered a problem when visualizing a function of a vector function space in paraview, if the order of the finite element is higher than 1. For example, if I run the following code, paraview shows the error message: "Cell type UnknownClass(69) is not a 3D cell. Missing original point id arrays. "
mesh = UnitSquareMesh(10, 10) V = VectorFunctionSpace(mesh, "CG", 2) v = Function(V) outfile = File("test.pvd") outfile.write(v)
If I replace the instruction "V = VectorFunctionSpace(mesh, "CG", 2)" with "V = VectorFunctionSpace(mesh, "CG", 1)", then I can visualize correctly the function in paraview. Could you please explain me which is my mistake?
As temporary solution I have defined an additional space V_2 = VectorFunctionSpace(mesh, "CG", 1), on which I interpolate the function v, although I am not really satisfied with the outcome.
I suspect this is because your version of paraview is a bit old. For quadratic (and higher degree) elements, we write VTU files using Paraview's (relatively) recent native support for these elements [this kitware post describes things https://blog.kitware.com/modeling-arbitrary-order-lagrange-finite-elements-i...]. See also https://www.firedrakeproject.org/visualisation.html#visualising-high-order-d...
I think support for this was introduced in Paraview 5.5, so if your version is older then things won't work.
You are right, my Paraview version was too old (5.4). Updating it has fixed the problem (sometimes I forget the simplest solution :D sorry!)
One way around this is to interpolate the solution to the low order space. You can have the File object manage this by saying:
outfile = File("test.pvd", target_degree=1)
but this will lose information.
Thanks,
Lawrence
Thank you for the help, Luca
participants (2)
- 
                
                Lawrence Mitchell
- 
                
                luca.mechelli@uni-konstanz.de