Hi,
I'm computing electric field vectors (dim=3) at Gauss points QGauss<3>(2) within FE_Q<3>(1) elements and I'd like to visualise the electric field in ParaView. My first attempt was to take the average over all Gauss points such that I get one electric field vector per cell. If I store the electric field components in different global vectors for each space dimension, I can add them to the output via
data_out.add_data_vector(output_E_x, "E_field_x");
data_out.add_data_vector(output_E_y, "E_field_y");
...
This is working, however, in ParaView I can then access the values only as scalar values and not as vectors. Hence, I cannot display the magnitude or visualise the electric field as a Glyph with arrows.
My next try was to add the cell data as vector values with a global electric field vector containing all components for all cells and do something like
std::vector< DataComponentInterpretation::DataComponentInterpretation >
electric_field_interpretation
(3, DataComponentInterpretation::component_is_part_of_vector);
std::vector< std::string > electric_field_solution_names (3, "E_field");
data_out.add_data_vector ( output_E_vec, electric_field_solution_names,
DataOut<3>::type_cell_data,
electric_field_interpretation );
Unfortunately, this is not working. An ExcDimensionMismatch is thrown saying add_data_vector() expects a vector of the size n=n_active_cells() but in my case it is 3*n.
Is it in general not possible to have vector valued cell data, or am I doing something wrong here?
As an alternative, is it correct that I can create several FE_DGQ<3>(1) elements for each component of my field vectors, create a new dof handler for output, then use compute_projection_from_quadrature_points_matrix() to project the Gauss point components onto support points and output them? Is there anything easier?
Tristan