How to visualise the simulation output in vtk format on a one dimensional mesh?

30 views
Skip to first unread message

Krishnakumar Gopalakrishnan

unread,
Mar 15, 2020, 3:50:39 PM3/15/20
to deal.II User Group
Using deal.ii, I got the results of a time-dependent 1D diffusion equation written to disk as a set of .vtu files (one per time-step).

It looks like both paraview and VTK can only visualise 2D/3D meshes? What's the best way to visualise 1D outputs?

Regards,
Krishna


Wolfgang Bangerth

unread,
Mar 15, 2020, 8:22:15 PM3/15/20
to dea...@googlegroups.com
On 3/15/20 1:50 PM, Krishnakumar Gopalakrishnan wrote:
>
> It looks like both paraview and VTK can only visualise 2D/3D meshes? What's
> the best way to visualise 1D outputs?

Same as before -- have you actually tried this? Because I think they do just
fine with 1d solutions!

Best
W.


--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Krishnakumar Gopalakrishnan

unread,
Mar 16, 2020, 11:04:21 AM3/16/20
to dea...@googlegroups.com
Same as before -- have you actually tried this? Because I think they do just fine with 1d solutions!

  • Yes. Nothing shows up on the viewport. I thought it might be because I have just a 1D mesh.  Then looking at Paraview's official tutorial/documentation, the very first sentence of Chapter 1 Introduction says  "ParaView is an open-source application for visualizing two- and three- dimensional data sets."
This raises doubts in one's head that 1D meshes are not supported. This is why I posted my question here. I haven't still been able to visualize my 1D simulation results.

Regards,
Krishna


--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "deal.II User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/AFeah4OhYe8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/6d6325ea-0384-03f1-6d03-758535579247%40colostate.edu.

Praveen C

unread,
Mar 16, 2020, 11:16:14 AM3/16/20
to Deal. II Googlegroup, Krishnakumar Gopalakrishnan
For 1d, you can save data in gnuplot format

Krishnakumar Gopalakrishnan

unread,
Mar 16, 2020, 11:21:41 AM3/16/20
to Deal. II Googlegroup
Hi Praveen,

Thanks for your reply. Yes, I had success with gnuplot, but the following were the difficulties.
  1. Weirdly, the x-axis co-ordinates of the mesh are not sorted in a particular order (they appear rather randomly, arranged in  groups of 2 rows with blank lines between them).
  2. The time-animation is not easy to visualize.  Paraview has a nice animation player for such sets of .vtu files.
Is there some trick to visualize time-series of 1D spatial data?


Regards,
Krishna



Krishnakumar Gopalakrishnan

unread,
Mar 16, 2020, 11:37:57 AM3/16/20
to Deal. II Googlegroup
Hi Praveen,

Thank you.  That really helps. I shall definitely check it out and report back.  I just have standard Q1 linear elements in a unit (0,1) domain, solving a standard 1D diffusion problem.

Are we all agreeing that sophisticated VisIT and Paraview cannot produce simple 1D visualizations/animations? If so, there must be an Assert() pre-condition check for the DataOut::write_vtk() and DataOut::write_vtu() functions of the library which return an exception with "dimension not implemented" error. 

Regards,
Krishna



On Mon, 16 Mar 2020 at 15:31, Praveen C <pra...@tifrbng.res.in> wrote:
I have a 1d example here


The blank lines in the output file denote different elements. It is not necessary to sort if you use gnuplot to plot it. gnuplot makes one curve for the solution in each element. If the FE space is continuous, you will get a plot which is globally continuous.

Best
praveen

Bruno Turcksin

unread,
Mar 16, 2020, 11:51:38 AM3/16/20
to deal.II User Group
Krishna,

VisIt and Paraview are just two of many visualization software that can read .vtk and .vtu files. Some people also use vtk to transfer data between programs. Why should we restrict the output because two visualization tools don't support 1D?

Best,

Bruno

Krishnakumar Gopalakrishnan

unread,
Mar 16, 2020, 12:15:05 PM3/16/20
to Deal. II Googlegroup
Hi Bruno,

Thanks for this information.

I am genuinely curious to know about these other programs that are capable of reading .vtk and .vtu files.  Everyone says that these files are so standard, and claim that there are a lot of tools that can read them.   I could not find really find any general purpose visualisation software outside of VisIT and Paraview that reads these files.  There are also couple of medical simulation visualizers/toolkits that again come out of kitware stables.  For an open-source framework like the VTK with a business -riendly BSD license, it is rather surprising that no other company or university has built a competing product. 


Some people also use vtk to transfer data between programs.

What could be examples of such work flow, especially in a 1D context?  For all practical purposes, 1D .vtu/.vtk files seem useless.  At least could we have a warning/note block of text in the write_vtu() and write_vtk() pages of the documentation that 1D visualisation using .vtk is a non-starter?  I have seen many such notes calling for the readers' attention.  I spent nearly two days under the belief that a 1D simulation shoud just be a walk in the park for the two vtk-based heavyweights.


Regards,
Krishna




--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "deal.II User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/AFeah4OhYe8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.

Bruno Turcksin

unread,
Mar 16, 2020, 12:30:05 PM3/16/20
to dea...@googlegroups.com

Krishna,

I am not an expert on visualization but I know mayavi (https://docs.enthought.com/mayavi/mayavi/) can read vtk and vtu. This is more geared towards python users though. If you think that the documentation is lacking, feel free to open a pull request ;-)

Best,

Bruno

Krishnakumar Gopalakrishnan

unread,
Mar 16, 2020, 12:40:12 PM3/16/20
to Deal. II Googlegroup
Confusingly, there are two versions of MayaVi.  MayaVi 1 and MayaVi2.  They didn't have a brew cask, so I didn't look at it so far.  I also don't want to learn yet another full-blown python library commands just for a one-off visualization exercise.  I really like Praveen's solution, but again gnuplot is yet another plotting language that I need to learn.

Can matplotlib import .vtk files and produce time-step animations?  What an irony that 1D visualisation is harder than 2D (for non-technical reasons)  :).
 
Regards,
Krishna

Wolfgang Bangerth

unread,
Mar 16, 2020, 1:00:57 PM3/16/20
to dea...@googlegroups.com
On 3/16/20 9:37 AM, Krishnakumar Gopalakrishnan wrote:
>
> Are we all agreeing that sophisticated VisIT and Paraview cannot produce
> simple 1D visualizations/animations?

No, we definitely do not agree :-) Attached is a visualization of the output
when replacing all occurrences of <2> by <1> in step-3, using visit. I'm
showing the solution in color, elevated by the value of the solution.


> If so, there must be anAssert()
> pre-condition check for the DataOut::write_vtk() and DataOut::write_vtu()
> functions of the library which return an exception with "dimension not
> implemented" error.

As others have pointed out, there are other reasons to output in these file
formats that may not include visualization with Paraview only.
visit0001.png

Bruno Blais

unread,
Mar 16, 2020, 9:56:23 PM3/16/20
to deal.II User Group
I concur with Wolfgang.
The same can be done with Paraview also. I have found that using the plot over line tool of paraview in 1D allows to obtain animation of 1D results in a very beautiful and user friendly fashion.
There is a Python VTK library by the way which allows easy (relatively) opening of vtk file and conversion into numpy arrays. It can be pretty handy, although the documentation is poor.

:)!

Krishnakumar Gopalakrishnan

unread,
Mar 17, 2020, 11:12:12 AM3/17/20
to Deal. II Googlegroup
Hi,

Thanks a lot to everyone who offered valuable help on this.

Finally, I could get Paraview to plot the 1D set of .vtu files.  Turns out that the default viewport is set to render, and the correct one to use is the "plot" filter which sets up a new view pane.

Krishna




--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "deal.II User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/AFeah4OhYe8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages