3 – An update on outputting results in Ansys Mechanical: Making Videos

To support some new marketing efforts I had to make some different types of results output from models in Ansys Mechanical:

  • A 3D plot on a webpage
    Post 5
  • A physical printout on our 3D Printer
    Post 6

All of the posts are here.

This post is the third of six and it is an update on making videos of results animations with Ansys Mechanical. A lot of improvements have been made in recent releases and you can get good quality videos that are very useful for sharing results with others.

Getting a video of what you see on the screen

In most cases, you can get the video you need by using the animation tools built into Ansys Mechanical. By default, the animation tool shows up at the top of the animation window. If it is not there, go to Home > Layout > Reset Layout. Or add it with Home > Layout > Manage > Graph.

The key thing to know about making videos of results in Ansys Mechanical is that the “save to file” commands do a screengrab of what you see on the screen. So the size, orientation, and resolution are what is in front of you. There are lot of things can be done easily with the help of ecdel.

The Export Video File button is how you save the animation to a file.

As the tip in the image shows, the command supports AVI, MP4, WMV, and GIF formats. We will discuss the formats below and improving quality in the next section. Most of the time, you should pick MP4 and save the file.

But first, you should know that there are four things you can animate and save to a video file: modal results, static results, results over time, and motion of the camera (keyframe).

Plotting Mode Shapes

Modal results are the simplest. In our example impeller, you need to pick the mode you want to view, get the orientation you want, and then click the play button. When you are ready to make your video file, click the”Export Video File” button and save it.

Now is a good time to explore the different formats. For the sample model I’m using, the file size for the three video formats is pretty much the same:

MP41,139 KB
WMV1,320 KB
AVI1,120 KB
GIF29,072 KB

The Animated GIF is much larger, and it turns out, a much lower quality format. We will cover that in the next article, let’s just ignore GIF for now.

Taking a look at the 3 videos, I’m not sure I can tell a difference. Note, you need to download them and play them on your desktop to see any differences. If we upload to a streaming service then the format gets changed by the service.

And here it is embedded as a YouTube Video, which we will do for all the other examples. I used the MP4 format because I think it might look a little better.

Static Results

This one is very simple and is identical to mode shapes. It plots one result from initial conditions to the final result. Although in our example, it’s not so useful, for complex bending with lots of different loads, it can be handy.

Results Over Time/Steps

The most common use for animation is looking at results over time or over multiple load steps. I was too lazy to build a transient example, so I just put some strange acceleration loads on our impeller and varied them over 5 timesteps.

This gave some movement of the rotor (we will cover changing deflection exaggeration in the next section) so you can see what is going on.

To get your animation, select the result you want from the tree and orient things in a way that shows what you need to show. Push play to view. Tweak as needed then save as we did with modal results. This is what you get:

With the default settings, it creates the specified number of frames across the whole result set. This uses the “Distributed” setting, the green icon. If you watch the vertical line as it animates, you can see it linearly interpolating results between result steps.

If you don’t want this, then click the blue icon to get one frame per solution on the result file. This is a good idea, and even critical, for many transient runs or nonlinear runs where linear interpolation is not correct. Notice how the field for specifying frames is grayed out and set to 5. That is because we have 5 result sets.

To show the difference, including the graph at the bottom, I actually did a screen recording, which we will cover in the last section.

It really is simple. Get what you want going on your screen, then save it to a file.

Making it better

The default settings are great for most situations, but you can get better results with a few small changes.

Distortion

For any type of mechanical simulation, you are solving for deflection, and you usually want the distorted shape to show up in your animation. Most of the time the program calculated exaggeration is just fine. But if you need to change it, use Result > Display and the drop-down for the Deformation Scale Factor. Change it and see what happens.

Background

The first thing I always do is get rid of the blue gradient background. One reason for this is that the compression algorithms that various video formats use can cause the background gradient to shift slightly over the video. Or it might reduce the colors. Having a solid background gets rid of that. And, if you ask me, it just looks better.

You can set your preferences for images to always have a white background, but you can’t do that in Animation. So you need to change the Workbench background.

Go to Workbench > Tools> Options…

Then select Appearance. Set Background Style to Uniform and the first color to the color you want. I use White.

But a rich purple is kind of cool and makes the other colors stand out:

Remember to change this back when you are done making your animations. If you are working debugging a really tricky model, that purple will burn a hole in your head.

Size

Remember, Mechanical is just doing a screen capture in the background, so the size of your plot on your computer screen determines the output. Sometimes you may want a small video, sometimes a big one. Let’s look at getting the highest resolution possible.

The graphics window size is determined by everything around it. By default, the graphics window is embedded, but with a little trick, you can set it free.

Here is the default on my monitor, my rotor is 584 pixels tall. (my screen is 1080 pixels high.

  1. Go into full-screen mode by pressing F11 or clicking Home > Layout > Full Screen
  2. Then click the X Tabular data windows to remove it.
  3. Grab the blue strip on the Graph window and drag it to pull it out of the window. You need to keep that window to save your animation.
  4. Press CTRL-O to get rid of the outline
  5. Press CTRL-D to remove the details window.

That gives you a nice big window of your results. Now my impeller is 911 pixels tall. And I can zoom in a little to get it a bit bigger.

But you will notice the screen is wide. If I animate now, for my geometry, I’m wasting a lot of bits storing the background. Click on the “Restore Down” button in the upper right of your window to get it out of windows full screen. Then drag the edges to get the size and shape that are just big enough to show your results.

If you want another 20 pixels (now we are getting greedy) you can get rid of the toolbar at the top. Click on the tiny down arrow on the far right of the toolbar. Then click Add or Remove Buttons > Customize. Then uncheck “Graphics.”

Now run your animation. Then, when you are happy, save it. You can bring the outline back with CTRL+O if you need it. If you need more pixels, get a higher resolution monitor or stretch the graphics window over multiple monitors.

I’m working on a Microsoft Surface, and I’ve been doing my animations on my portable monitor, which is only 1080 pixels high. To get the best image, I moved over to the main screen, which is 1824 high.

So with all the tricks and on my highest resolution monitor, I get a video that is 1785 pixels high, and it looks pretty good, even after YouTube compresses it:

Here is the file to view on your own machine:

Important! To get back hit F11 then Home > Layout > Reset Layout. You may have to also do Home > Layout > Manage > Tabular Data to get that window back and Home > Layout > Manage > Graphics Toolbar to add that back to the top of the graphics window

Frames & Time

The last thing to play with is the number of frames and the length. A good rule of thumb is to not have less than 10 frames per second. And greater than 20 is good. Set it to 5 Frames and 5 Seconds to see blocky. Then 100 Frames and 5 Seconds (20 frames/sec) to see everything smooth.

Moving the object with Keyframe animation

If you want the object to move during an animation, you can use what is called Keyframe animation. To be honest, I am not sure I’m using it right in the program, but I got it to work somewhat, so I’ll share what I did. I’m also only going to cover the basics, see the documentation for more.

First, open the Keyframe Animation tool with Home > Tools > Keyframe Animation.

Orient your parts the way you want them, and click the add Keyframe button. The one with the green plus.

Now pick your second orientation, and add it to the list. Keep going till you have all your orientations in there. Set the time to somehting like 4 or 5 seconds, and hit play.

Now, getting a little fancy, you can add pauses at any Keyframe if you want. Do this by double-clickingon the Keyframe step to orient the part, then click the Insert Keyframe icon (top row, 4th from the left) to make a copy. You now how two keyframes at the same orientation so your part won’t move.

This window has a save animation button as well, so save it. When I used it, this is what I got:

This spins the final distorted shape, not the animated shape.

If you look at results that are not from a modal run, you will see that you can animate the results over time by clicking on the Keyframe icon in the animation bar:

The first icon, red circle, tells the program to change the orientation as defined in the Keyframe Animation Window while it animates your results. Click on the second icon, green circle, to use the frame counts you have specified in your Keyframe Animation Window.

This is what the multi-step results look like over the motion:

What about modal? Well in theory you can’t plot a mode shape with keyframe animation. But… if you set up a keyframe for a non-modal result, run it. Then move to a modal result, it works, sort of. The results animate if you have two keyframes that are the same next to each other. This is not a documented feature and may even be a bug. But here is how it looks:

When all else fails, make your own recording

Sometimes you can’t get what you need saved to a file, but you can see it on the screen. Including the Graph window is a good example. Rotating a modal result, since Keyframe really doesn’t work with modal, is another good example. Now that we all have learned to use online meeting software through COVID-19, we know how to do a screen capture of the animation. I use MS Teams and it works just fine.

But, the quality is OK and you get artifacts from the meeting, like my icon on the bottom for attendees. Those can be edited out, but not ideal. Here is a sample:

If you need better quality, a dedicated screen capture program may be better.

And it turns out that Windows 10 had a built-in screen recorder. It’s called XBOX Game Bar, and it works pretty well. Here is a link on how to use it.

And I get a nice full screen video:

Play, but not too much, and RTM.

The last bit of advice we can give on animating in Ansys Mechanical is that if you want something beyond the defaults, set aside some time to play. There are a lot of options, many we have not even looked at. But at the same time, in your quest for an Oscar, you may be spending time on something that is not going to make a difference. So use your time wisely.

And as always, Read the Manual. There is a wealth of detailed information there.

Getting the right Animated GIF

Now that we have covered creating various video formats, what about making an animation that doesn’t need some sort of player? The next post, “4 – An update on outputting results in Ansys Mechanical: Animated GIFs” explains how to do that.