This is a neat little automation that could be used in all sorts of scenarios.įor example, you could use it to report the maximum depth in a multiphase simulation, or the mean temperature of a component in a heat transfer case. You might need a more complex function, especially if your slice doesn’t have a constant X, Y or Z co-ordinate, but you get the idea □ Give it a go? The "Location is % 6.2f m" bit is just some old-style string formatting to print the co-ordinate value (to two decimal places, with space for a minus sign) plus the additional text.whereas Points would grab the Y-coordinate & Points would grab the Z-coordinate.Points grabs the X-coordinate of its first data point.inputs refers to the object that the filter was applied to (in this case, my slice plane).The one-liner I used in my Python Annotation was: You can see it at the top of this example, using some questionable data from the motorBike tutorial □ I use a Python Annotation to query the location of the slice from its co-ordinates, then I format it nicely, add some extra text & display it in the scene. My preference is to export the slices from OpenFOAM (using the sample function object) & then use ParaView to create the images (it really flies when it doesn’t have to do the actual slicing). I make X, Y & Z-normal slice movies of static & total pressure coefficient, for every simulation I run. Sweeping a planar slice (coloured by an interesting field) through your domain, is a great way to figure out what’s going on inside the flow. I love a slice movie □ one of the least-exciting (but most informative) post-pro techniques that you’ll ever use. That said, we can do a lot with one line, here’s a simple example… Location annotation for an animation Note: If you must use more than a single line of code (&/or you want to use some external Python modules) then you should check out the raw scripting power of the Programmable Annotation instead. It updates whenever the data or the time step change, so we can set it & forget it, confident that it will always be up-to-date. With that one line we can grab data from our model, do all manner of calculations, combine it with other strings & format it to our liking, before writing the output into the scene as a regular text object. The Python Annotation sits somewhere in-between, blessing us with a single line of Python code to create our annotation. There are a bunch of ways to annotate your scene in ParaView, from a simple text source, all the way up to “beast-mode” a.k.a. Let’s get into it & then you can go and give it a try… Python Annotation So, whether you’re looking to annotate a property in an animation, or you want a label that’s synced to your current dataset, then this filter has you covered. It’s a quick introduction to ParaView’s Python Annotation filter, a neat (but not new) way to create dynamic annotations that are always up to date. It’s Robin from CFD Engine & if you’ve ever had to re-do an image (or a series of images) because you forgot to update an annotation □♂️ then this email’s for you.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |