This is a second attempt at this posting. The first attempt got 60% of the way done, then I rebooted my machine before I saved the posting… Doh. So let’s try this again:
Every once in a while I feel the need to stop exploring all the new and cool stuff in the world of workbench and do a deep dive into something that involves names which are restricted to eight characters or less. Something that involves a script rather than a GUI click. Something that requires you to look at a real equation, something with an integral sign in it:
I want to learn about something that uses comma delimited commands.
So, up comes ANSYS Help, dive down into the release notes for Mechanical APDL and look for something obscure but useful. New elements… Aha! HSFLD21 – now that is a name to make any I-only-use-the-GUI-and-manuals-with-equations-but-without-color-animations-make-me-nervous user cringe. Hydrostatic. I like that word. It reads:
This 2-D hydrostatic fluid element models fluids that are fully enclosed by 2-D planar and axisymmetric solids. This element is well suited for modeling fluid-solid interaction with incompressible or compressible fluids under uniform pressure. It can be used in geometrically linear as well as nonlinear static and transient dynamic analyses.
Now I have something I can sink my teeth in.
The Basics on the HSFLD241 and HSFLD242
New at R13, these elements are used to model compressible or incompressible fluids that are surrounded by solids. The key assumption to be aware of is deserving of its own line:
The fluid volume has uniform pressure, temperature, and density without any gradients
So no sloshing, variation due to gravity, etc.. Take a look at FLUID80 if you want these things… maybe a future article topic.
HSFLD241 is the 2D and axisymetric version, and HSFLD242 is the 3D version. If you look at the element pictures from the manual at the top of the posting you’ll see that they are a surface effect element with an extra node, called a pressure node. You use ESURF to apply the element to the inside face of your enclosing volume, and you link all the faces that make up the volume by making them share a node (L or Q). The fact that they all share the same node tells the solver that they make a volume. Besides sharing the node, they must share the same material and real number.
When you use ESURF to make the elements, it automatically makes them a positive volume by the order it defines the face nodes with. But sometimes you may want to create a negative volume inside your positive. Say you are modeling a tire (what this element was added for actually) and you will find that the pressure node is outside of the volume. The calculated volume is not correct. You need to subtract volume for the elements that are actually not in your volume. Here is a cross section to try and make more sense of it.
The purple parts are the fluid. So this is not right. You need to go in and create negative elements on any faces that face away from the origin. You do this in two steps: Mesh using ESURF like you normally would, then grab the elements you want to turn into negative elements and issue the ESURF,pnode,REVERSE command. This will turn those elements into negative volumes. The key hear is to create your geometry in a way so that you can easily select faces that point away from the center of your volume. If you don’t, you will need to write a macro that loops through the elements, checks the vector from the face centroid to the center of you volume and if it facing out, swap the element normal. Not hard, just tedious. In our example, the negative element will look like this (color changed for clarity):
The elements have displacement (UX,UY and UX,UY,UZ) Degrees of Freedom on the face part of the element, the part that sits on your structural elements. The pressure node has a DOF of HDSP or hydrostatic pressure by default, and both PRES and HDSP if you set KEYOPT(1) = 1. This is so you can hook the node to other elements that have PRES DOF’s like the FLUID116.
For real properties you have the ability to specify a thickness (defaults to 1) on the 2D element so the program can calculate volume correctly. Both versions have a real constant of PREF, the reference pressure. Simple enough.
If you opt for an incompressible fluid, just specify a density and coefficient of thermal expansion for your material. But if you are modeling a compressible fluid, you use a new material property table to specify the material properties: TB,FLUID. Within the FLUID model you have three options: a model for liquids, a model for gases, or you can provide pressure-volume data. It is recommended that you read the theory manual on these three to understand the difference and how to use them, as well as the standard command information for the TB.
For TB,FLUID,,,,LIQUID the model is basically a squishy solid. You give a bulk modulus, coefficient of thermal expansion, and an initial density over up to 20 temperatures.
For TB,FLUID,,,,GAS you simply give a Density. The program then simply uses the Ideal Gas Law… you remember that from freshman physics? Or was it chemistry. I kind of remember it… sort of:
If you have a compressible fluid that does not follow the idea gas law, then you can supply your own pressure vs. volume table with TB,FLUID,,,,PVDATA.
KEYOPT(1) controls the DOF’s on the pressure node. By default the uniform pressure for the solid is stored as HDSP. If you set KEYOPT(1) to 1, then a PRES DOF is added and is set to be equal to HDSP. This is so you can hook a FLUID116 up to it and flow out of your volume… more below.
KEYOPT(3) is used on the HSFLD241 element to say if it is Planer (0) or Axisymmetric (1)
Use KEYOPT(5) to turn on mass effects for the elements. Remember, this is a uniform mass. But if you have gravity or you are doing a modal analysis, you need this turned on.
Turn compressibility off by setting KEYOPT(1) to 1.
Other Basic Info
Give the manual page a read on the element. There are a lot of output options besides the DOF solution. Stuff like Volume, Mass, and mass flow rate.
(Want to know how I made this animation… that will be next weeks article.
I used a program called GIF Movie Gear, best $29.95 I’ve spent in a while…)
So, having waded through the boring bits, let’s build a model. Our first example is simply a 2D hollow rectangle that we apply a pressure to. Here is the macro. Take a look at the comments and follow the process.
One key thing to note in the code is the ESURF command. Notice how you specify the common node as the first argument in the command. This is pretty useful and avoids making you go through and specify. You can download the macro here.
The help on this element is pretty cool, and it even includes an example of how to build a piston. Unfortunately it does not include the part that solves it. So I’ve added that made some other changes, including an animation and a short trip into POST26 to get pressure and volume of the fluid over time. The code is below. The most obvious thing when looking at this animation is the funny triangle thingy. that is a negative element that deals with the fact that the volume is changing over time. It is not 100% accurate but basically says any fluid above the piston needs to be subtracted. In the image on the right, the solid geometry mesh, you can imagine that your fluid volume can be anywhere inside the piston, from the top of the yellow line to the whole length of the green. The red dot shows the bottom corner of the piston. If you make an element from the red dot to the top and bottom of the yellow line, no mater where the piston goes you will subtract the volume of any part of the total volume that is above the piston. I found that kind of slick and clever of the ANSYS developers. It doesn’t plot so cool, but it gets the job done.
Here is the code:
Here is the graph of the results. Not very exciting.
Download the Macro here.
Other things to know
OK, this was a lot more involved than planned, and there is still more to learn. But I’ve got HR paperwork to fill out so we will wrap it up.
You should go through the verification problem for this element: VM209
- You can connect different volumes with FLUID116 elements. This allows some pretty fancy system modeling. Add in some control elements and electromagnetics and you can really capture some complex systems.
- Be very aware of the negative volume issues when modeling tires and such.
- After I started on this article I found out that we are in the middle of a project for a customer who is modeling an optical device that has a fluid core. It is working very well for them. I wish I could show the model, but I would be shot by the customer. I can say that we are getting much better results than when we modeled the volume with solids.
- The FLUID80 is a solid fluid volume element that does take into account non-uniform pressure, mass, etc… Take a look at it if these guys don’t do what you need.
- Can you do this in Workbench? Sort of. You should be able to write a macro that uses a component to create your hydrostatic elements and define the material properties. You won’t be able to post process the results but you can at least set it up and bring back plots. (check out this presentation, slide 41)