As having data on mesh nodes is equivalent of having a CG 1 FunctionSpace, only certain functions are nicely visualized on nodes.
You can Get nodal values in the same order as mesh nodes by using compute_vertex_values
Thanks a lot. It worked.
I guess for strain and stress, the code will
strain_list = []
stress_list = []
for i in range(9):
strain_list.append(strain.sub(i,deepcopy=True).compute_vertex_values())
stress_list.append(stress.sub(i,deepcopy=True).compute_vertex_values())
As stress and strain is based on taking the derivative of CG functions, They should really be represented as DG functions, and is not very suitable for vertex (CG-1) representation.
Why do you use csv and not XDMF and write_checkpoint, as it can visualize DG functions?
However, I am warning you that exporting a discontinuous function as a continuous function is a slippery slope if you want to use it as input for another computation. I cases Where the strain is actually discontinuous between cells, the nodal value is not uniquely defined.
As this is very dependent of your Fortran code, and how it can handle such data, there isn’t much I can do.
You can Get the components of each stress and strain by projecting them to the appropriate DG space, and Get their coordinates by using tabulate dof coordinates.
The first question is what function space do you use for computation of deformation in your code.
As the data is connected to cells not nodes, you Need to make a cell mapping (should match the mesh topology in the case of DG 0), i.e. Cell 0 had value 0, cell 1 has value 1 etc, as long as you run it in serial. It gets more complicated If you run it in parallel