Introducing Design Days: Free engineering consultation for Startups

PADT_StartUpLabs-1PADT and CEI are teaming up to answer any startup’s questions about engineering and manufacturing for their physical product. Over the years we have found lots of early stage companies who benefited from spending a little bit of time with an experienced product development engineer. Finding time for them to stop by PADT was always difficult to schedule and never seemed worked out. Or we would meet people at events and try and talk in a corner, still not good.cei_logo

So last month during Phoenix StartupWeek CEI and PADT tried having some time where people could stop by and talk. It went really well for everyone involved, so Design Days was born.

Our first one will be held on April 14, 2016 at CEI’s offices in Phoenix.  The idea is simple, you get one hour with an experienced mechanical engineer to talk about whatever you want. We can spend the time talking about:

  • Suggestions for how to properly design your product
  • Get contacts at local resources that can help you
  • Brainstorm solutions to technical problems
  • Discuss the weather (it’s your hour)
  • Get an idea of what it would take to design and prototype your product
  • Answer questions about software and hardware tools you may need
  • Bounce ideas off someone new
  • Review manufacturing options
  • Get advice on the next steps you should be taking
  • Or whatever else you want to discuss

You don’t have to be an existing CEI client, a new company or an old one. You just need to want to talk to our engineers.

 

Sign up for one of the available one hour slots here.   Our plan is to do this once a month, and if it works, try some other incubators as well.

Here is some basic information you should be aware of:

  • Do not ask for Non-Disclosure Agreement (NDA). PADT engineers operate under a strict company code of ethics; therefore no additional NDA is required.
  • This is meant for companies developing physical products, not software.
  • It is open to companies at ANY stage of development, not just startups. Entrepreneurs of any age, including students, are also welcome.
  • This is not a discussion about funding nor is it a sales pitch (from either side)
  • Do not expect a functioning prototype or design nor will PADT engineers solve your technical problems. To fully engage in PADT’s design, prototyping and simulation services, there will be a cost involved to be agreed upon by both parties.

    padt-cei-design-days
    Our impromptu trial “Design Days” session during Phoenix StartupWeek.

Additive Manufacturing and the Navy SBIR Program – brought to you by RevAZ, AZ Commerce Authority, and PADT

RevAZ-ACA-PADT-Logos-1

Learn more about the Navy Sea SBIR Program from Jonathan Leggett, the NAVSEA SBIR Program Manager, about how AZ Manufacturers can use SBIR Grants to assist in funding R&D early stage innovation.  Jonathan will also review the Navy’s roadmap on additive manufacturing and 3D printing.  There will be 15 minute one-on-one sessions from 1:30 – 4:00 to answer your specific questions with:

  • Jonathan Leggett, NAVSEA SBIR Outreach Program Manager
  • Dave Garafano, ACA Executive Director of RevAZ
  • Jill HowardAllen, ACA Manger of Technology Commercialization & SBIR Programming

Register Now!

Who Should Attend?

  • Small to Medium Sized Businesses – (500 or less)manufacturers interested in learning how the SBIR/STTR program may assist them in commercializing their early stage innovation.
  • Large & Medium Sized Businesses and/or 3rd Party Investors – Those seeking to partners with the SBIR/STTR small businesses to (a) establish the requirements and specification for the proposed outcomes; and (b) provide financial resources and collaboration for commercializing the results
  • University/Institute Faculty and Staff – Those seeking consulting and partnering opportunities with the small business on the SBIR/STTR grant

When: April 7
10:00-12:00 – Navy SBIR Overview & Navy
Additive Manufacturing Technology Roadmap
1:30- 4:00 – 15 Minute 1:1 Sessions with Jonathan Leggett

Where: PADT
7755 S Research Dr.
Suite 120
Tempe, AZ 85284

Please Register to Reserve your Spot!

Direct any questions to Jill HowardAllen at JillH@azcommerce.com or call 602 845 1291.

PADT is honored to be hosting the event and taking part in the training.

Ovid: A Teaching Tool for 3D Printing

ovid-1-1Meet Ovid.  He is a very simple character that we use to explain 3D Printing to kids. Explaining how 3D Printing works to anyone without a technical background can be tough. To help out PADT has created a collection of resources that shows how it is done, including a hands on model for younger kids, that feature Ovid as the object being printed.

Let’s start by getting technical.  3D Printing is a common term for a class of manufacturing methods referred to as Additive Manufacturing.  In 3D Printing you take a computer model and you print it out to get a real world three dimensional object. The way we do it is that we slice the computer model into thin layers, then build up material in the 3D printer one layer at a time.  Here is a simple GIF showing the most common process:

FDM-Animation.gif

This is Fused Deposition Modeling, or FDM. If a classroom has a 3D Printer it is most likely an FDM printer.

The idea behind these resources is to show the process:

  1. Start with a 3D Computer model
  2. Slice it
  3. Build it one layer at a time

The materials below can be used by parents or teachers to explain things to kids, K-8. Please use freely and share!

Presentation

This PowerPoint has slides that explain the 3D Printing process and the video is of the slides being presented, with our narration.

PowerPoint: Ovid-Presentation-3D_Printing

Making a Hands-On Ovid

ovid-model-3Our fun little plexiglass model of Ovid is an example of a manual 3D printing process. Students can stack up the layers to “3D Print” their own Ovid by hand, reinforcing the layered manufacturing process.

We did everything the same as a real 3D Printer, but instead of automatically stacking the layers, we cut each layer on a laser cutter and the students do the cutting.

Here is a video showing the laser cutting.

And this is a zip file containing the geometry we used to make Ovid in STEP, IGES, Parasolid, and SAT.

To put it all together we created a triangular rod with a base and height that are identical.  Figure out the size you need once you have scaled the geometry for your version of Ovid. we glued the rod to a base.

ovid-model-1 ovid-model-4 ovid-model-2

Files for 3D Printing and Other Information

If you have access to a 3D Printer, you can print your own Ovid.  Here is an STL and a Parasolid: Ovid-PADT-3D_Printing-1

We also have a video showing how the software for the printer slices the geometry and makes the tool path for each layer:

And to round things out, here is a few minutes of Ovid being made in one of our Stratasys FDM printers:

MD+DI: 3-D Printing Applications Changing Healthcare

md+di-logo-13-D Printing is having a significant impact on healthcare technology. In “3-D Printing Applications Changing Healthcare” PADT’s Dhruv Bhate gives real world examples of how this technology is enabling never-before-seen breakthroughs.

 

Phoenix Business Journal: 5 reasons why nerds celebrate Pi Day

pbj-phoenix-business-journal-logo

Have you heard? It’s Pi Day! This post, “5 reasons why nerds celebrate Pi Day” shares the reasons why those of us in the know like Pi day so much.
pie-pi

New Tricks for an Old Dog: Eric Learns ANSYS SpaceClaim – Post 1

ANSYS-SpaceClaim-Learning-00-00Thirty-one.  That is the number of years that I have been using CAD software. CADAM was the tool, 1985 was the year.  As some of our engineers like to point out, they were not even born then.

Twenty-one. that is the number of years that I have been using SolidEdge.  This classifies me as an old dog, a very old dog. As PADT has grown the amount of CAD I do has gone way down, but every once in a while I need to get in there and make some geometry happen. I’m usually in a hurry so I just pop in to SolidEdge and without really thinking, I get things done.

Then ANSYS, Inc. had to go and buy SpaceClaim. It rocks.  It is not just another solid modeler, it is a better way to create, repair, and modify CAD.  I watch our engineers and customers do some amazing things with it. I’m still faster in SolidEdge because I have more years of practice than they have been adults. But this voice in my head has been whispering “think how fast you would be in SpaceClaim if you took the time to learn it.” Then that other voice (I have several) would say “you’re too old to learn something new, stick with what you know. You might break your hip”

I had used SpaceClaim a bit when they created a version that worked with ANSYS Mechanical four or five years ago, but nothing serious.  Last month I attended some webinars on R17 and saw how great the tool is, and had to accept that it was time.  That other voice be damned – this old dog needs to get comfortable and learn this tool.  And while I’m at it, it seemed like a good idea to bring some others along with me.

These posts will be a tutorial for others who want to learn SpaceClaim.  Unlike those older tools, it does not require five days of structured training with workshops.  The program comes with teaching material and tutorials.  The goal is to guide the reader through the process, pointing out things I learned along the way, as I learn them.

A link to the table of contents is here.

Getting Started

The product I’m learning is ANSYS SpaceClaim Direct Modeler, a version of SpaceClaim that is built into the ANSYS simulation product suite. There is a stand alone SpaceClaim product but since most of our readers are ANSYS users, I’m going to stick with this version of the tool.

This is what you see when you start it up:

ANSYS-SpaceClaim-Learning-01-01

I’ve been using the same basic layout for 20 years, so this is a bit daunting for me. I like to start on a new program by getting to know what different areas of the user interface do. The “Welcome to ANSYS SCDM” kind of anticipates that and gives me some options.

Under “Getting Started” you will see a Quick Reference Card, Introduction, and Tutorials. Open up the Quick Reference and print it out. Don’t bother with it right now, but it will come in handy, especially if you are not going to use SpaceClaim every day.

The Introduction button is a video that gets you oriented with the GUI. Just what we need. It is a lot of information presented fast, so you are not going to learn everything the first viewing, but it will get you familiar with things.

File Mar 11, 3 53 54 PM

Here I am watching the video.  Notice how attentive I am.

Once that is done you should sort of know the basic lay of the land. Kind of like walking into a room and looking around. You know where the couch is, the window, and the shelf on one wall.  Now it is time to explore the room.

It is kind of old school, but I like user guides.  You can open the SpaceClaim User Guide from the Help line in the “Welcome” window.  I leave it open and use it as a reference.

The Interface

The best place to learn where things are in the interface is to look at the interface section in the manual. It has this great graphic:

ANSYS-SpaceClaim-Learning-01-03

The top bit is pretty standard, MS office like. You have your application menu, quick access toolbar, and Ribbon Bar.  The Ribbon Bar is where all the operations sit.  We used to call these commands but in an object oriented world, they are more properly referred to as operations – do something to objects, operate on them.  I’ll come back and explore those later. Over on the left there are panels, the thing we need to explore first because they are a view into our model just like the graphics window.

ANSYS-SpaceClaim-Learning-01-04

The Structure Panel is key.  This is where your model is shown in tree form, just like in most ANSYS products.  In SpaceClaim your model is collection of objects, and they are shown in the tree in the order you added them. You can turn visibility on and off, select objects, and act on objects (using the right mouse button) using the tree. At this point I just had one solid, so pretty boring.  I’m sure it will do more later.

Take a look at the bottom of the Structure Panel and you will find some tabs. These give access to Layers, Selection, Groups, and Views.  All handy ways to organize and interact with your model.  I felt like I needed to come back to these later when I had something to interact with.

TIP: If you are like me, you probably tried to drag these panels around and hosed up your interface. Go to File > SpaceClaim Options (button at the bottom) > Appearance and click the “Reset Docking Layout” button in the upper right of the window.  Back to normal. 

The options panel changes dynamically as you choose things from the ribbon. If you click on the Design > Line you get this:

ANSYS-SpaceClaim-Learning-01-05

And if you click on Pull you get this:

ANSYS-SpaceClaim-Learning-01-06

Keeps the clutter down and makes the commands much more capable.

Below that is the Properties Panel.  If the Options panel is how you control an operation, then the Properties panel is how you view and control an object in your model.  No point in exploring that till we have objects to play with.  It does have an appearance tab as well, and this controls your graphics window.

At the bottom is the Status Bar. Now I’m a big believer in status bars, and SpaceClaim uses theirs well.  It tells you what is going on and/or what to do next.  It also has info on what you have selected and short cut icons for selection and graphics tools. Force yourself to read and use the status bar, big time saver.

The last area of the interface is the graphics window. It of course shows you your geometry, your model.  In addition there are floating tools that show up in the graphics window based upon what you are doing.  Grrr. #olddogproblem_1.  I’m not a fan of these, cluttering up my graphics. But almost all modern interfaces work this way now and I will have to overcome my anger and learn to deal.

Make Something

For most of the 30+ years that I’ve been doing this CAD thing, I’ve always started with the same object: A block with a hole in it.  So that is what we will do next.  I have to admit I’m a little nervous.

I’m nervous because I’m a history based guy.  If you have used most CAD tools like SolidWorks or ANSYS DesignModeler you know what history based modeling is like. You make a sketch then you add or subtract material and it keeps track of your operations. SpaceClaim is not history based. You operate on objects and it doesn’t track the steps, it just modifies your objects.  SolidEdge has done this for over ten years, but I never got up the nerve to learn how to use it.  So here goes, new territory.

Things start the same way. But instead of a sketch you make some curves.  The screen looks like this when you start:

ANSYS-SpaceClaim-Learning-01-07

The default plane is good enough, so I’ll make my curves on that. Under Design>Sketch click on the Rectangle icon then move your mouse on to the grid. You will notice it snaps to the grid. Click in the Upper Left and the Lower Right to make a rectangle then enter 25mm in to each text box, making a 25 x 25 square:

ANSYS-SpaceClaim-Learning-01-08

Next we want to make our block.  In most tools you would find an extrude operation. But in SpaceClaim they have combined the huge multitude of operations into a few operation types, and then use context or options to give you the functionality you want. That is why the next thing we want to do is click on Pull on the Edit group.

But first, notice something important. If you look at the model tree you will notice that you have only one object in your design, Curves. When you click Pull it gets out of sketch mode and into 3D mode. It also automatically turns your curves into a surface. Look at the tree again.

ANSYS-SpaceClaim-Learning-01-09    ANSYS-SpaceClaim-Learning-01-10

This is typical of SpaceClaim and why it can be so efficient. It knows what you need to do and does it for you.

Move you mouse over your newly created surface and notice that it will show arrows. Move around and put it over a line, it shows what object will be selected if you click.  Go to the inside of your surface and click. It selects the surface and shows you some options right there.

ANSYS-SpaceClaim-Learning-01-11

Drag your mouse over the popup menu and you can see that you can set options like add material, subtract material, turn off merging (it will make a separate solid instead of combining with any existing ones), pull both directions, get a ruler, or specify that you are going to pull up to something.  For now, we are just going to take the default and pull up.

As you do this the program tells you how far you are pulling. You can type in a value if you want.  I decided to be boring and I put in 25 mm.  Geometry has been created, no one has been hurt, and I have not lost feeling in any limbs. Yay.

ANSYS-SpaceClaim-Learning-01-12

On the status bar, click on the little menu next to the magnifying glass and choose Zoom Extents.  That centers the block. Whew. That makes me feel better.

Now for the hole. It is the same process except simpler than in most tools.  Click on the circle tool in Sketch. The grid comes back and you can use that to sketch, or you can just click on the top of the block. Let’s do that. The grid snaps up there.  To make the circle click in the middle of the grid and drag it out.  Put 10 in for the diameter. A circle is born.

Take a look at your tree. You have a solid and a set of curves.  ANSYS-SpaceClaim-Learning-01-13

Now choose Pull from the Edit section. There is only a Solid now?

ANSYS-SpaceClaim-Learning-01-14

SpaceClaim went ahead and split that top surface into two surfaces. Saving a step again.

Click on the circle surface and drag it up and down. If you go up, it adds a cylinder, if you go down, it automatically subtracts.  Go ahead and pull it down and through the block and let go. Done.  Standard first part created. Use the File>Save command to save your awesome geometry.

ANSYS-SpaceClaim-Learning-01-15

That is it for the getting started part.  In the next post we will use this geometry to explore SpaceClaim more, now that we have an object to work on.  As you were building this you probably saw lots of options and input and maybe even played with some of it. This is just a first look at the power inside SpaceClaim.

Click here for Post 2 where the Pull command is explored.

Phoenix Business Journal: 6 tips for conducting a technical meeting over the Internet

pbj-phoenix-business-journal-logoOnline meeting are great.  Sharing your work in real time with others makes a huge difference. In “6 tips for conducting a technical meeting over the Internet” we share advice on how to make those online meeting even more productive.

Keypad Shortcuts for Quick Views in Workbench

keypad1Hey, did you know that you can access predefined views in both ANSYS Mechanical and DesignModeler using your numeric keypad? You can! Assuming the front view is looking down the +Z-axis at the X-Y plane, here are the various views you can access via your numeric keypad.

For this to work, make sure you’ve clicked within the graphics window itself—not on the top window bar, or one of the tool bars, but right in the region where the model is displayed. You may need to turn off Num Lock, though it works for me on both my laptop and desktop with Num Lock on or off.

With that out of the way, here are the views:

0) Isometric view, a bit more zoomed in than the standard auto-fit isometric view. This is my preferred level of zoom while still being able to see the whole model, to be honest.

image

1) Front view (looking down the +Z-axis)

image

2) Bottom view (looking down the -Y-axis)

image

3) Right view (looking down the +X-axis)

image

4) Back up to the previous view

5) Isometric view, standard autofit (I don’t like the standard auto-fit—too much empty space. I prefer the keypad 0 level of zoom.)

image

6) Go forward to the next view in the cache

7) Left view (looking down the -X-axis)

image

8) Top view (looking down the +Y-axis)

image

9) Back view (looking down the -Z-axis)

image

Here’s a handy-dandy chart you can print out to refer to when using the numeric keypad to change views in Mechanical or DesignModeler. Share it with your friends.

image

Phoenix Business Journal: ​Finding hope at a technology open house

pbj-phoenix-business-journal-logoSometimes you hold an event as a way to educate the community, and then it comes back and educates you. This posting “​Finding hope at a technology open house” shares what we learned at our SciTech Festival open house this year.

Support Design and Removal for 3D Printed ULTEM-9085 (Case Study: Intake Manifold)

ULTEM-9085 is one of my favorite materials to 3D-print: one of the reasons is it is a high performance polymer that can and has been used for end part manufacturing (see my blog post about ULTEM in functional aerospace parts), but the other is because it is a demanding material to print, in ways that ABS, Polycarbonate and even Nylon are not. What makes it demanding is primarily that ULTEM supports are not soluble and need to be removed mechanically. An additional challenge comes from the fact that the support is best removed when the part is at a high temperature (175-195 C), which requires the use of gloves and reduces the user’s dexterity. For complex geometries with internal channels, this is particularly challenging and occasionally results in an inability to print a certain part in ULTEM-9085, which runs contrary to the design freedom this technology otherwise enables.

In this post, I accumulate what I have learned through working (and failing) on many an ULTEM-9085 job, as well as through discussions with other users, and share this here in terms of design and process guidelines. To demonstrate these guidelines, I use a recent geometry that we printed for the Arizona State University’s (ASU) SAE team for an engine intake manifold. These guidelines apply to the Stratasys Fortus platform (for Fused Deposition Modeling, or FDM) using the Insight software that accompanies these tools. The screen shots are from Insight 10.6, and a Fortus 400 was used to print the parts shown.

Summary of Guidelines:

  1. Orient the part to eliminate supports in regions where you cannot remove them
  2. Use the box support style
  3. Optimize parameter settings (support angle, contour width, layer thickness)
  4. Remove the supports as soon as the part comes out of the build chamber
  5. Other observations: the interface of separation

1. Part Orientation

The single most important factor in simplifying support removal is part orientation. Most users of the FDM process know that part orientation determines the amount of support material consumed and also impacts the time to build the part. When working with ULTEM-9085, the additional challenge is that it is possible to design in supports that cannot be removed and will require you to scrap the job. This is especially true of internal features. While the automatic orientation feature in Insight allows you to minimize supports, it does not account for the difficulty of removing them. Thus when you are dealing with internal features, you may need to manually orient your part such that the internal features are aligned as close to the vertical as possible, and above the support angle (to be covered later).

As shown in Figure 1, for the intake manifold, I oriented the internal pipe structure close to the vertical and had to iterate a few times and verify that I had no support in the hard-to-reach areas. While I did have supports internally, they were limited to areas that were easy to access.

Figure 1. Engine intake manifold, to be printed out of ULTEM-9085
Figure 1. Engine intake manifold, to be printed out of ULTEM-9085
Figure 2. Part orientation to avoid any internal supports
Figure 2. Part orientation to avoid any internal supports in inaccessible regions

2. Box Supports

In a recent software upgrade, Insight added the ability to create box supports. The support structures consist of adjacent boxes instead of a continuous raster, which has the effect of allowing for easier separation of the support, though does slow down the build time. In my experience this support strategy does help with removal – the one parameter to consider here is the “Perforations” setting, though the default values were used for this part. The perforation is a layer of model material that is inserted into the support to make for easier breaking off of the support material. All cleavage surfaces in Fig. 3 are at perforation edges and you can see the building like construction with each floor distinguished by a layer of model material. When you have supports in hard to access regions, consider increasing the interval height so as to ensure you get separation at the model-support interface on the part before it occurs within the support on a perforation layer.

Figure Box Supports
Figure 3. Box Supports after removal from an ULTEM-9085 part

3. Optimize Process Parameters

While orientation will have the most significant impact on the support you need, another variable to be aware of is the “Self-Support Angle” parameter. This angle is measured from the horizontal, and represents the minimum angle of the part wall that will be built without supports. As a result, to reduce support requirements, you want this number to be as low as possible so that a greater volume of the part can be self-supported. Stratasys recommends default values, but these scale as a function of the contour width, and layer thickness, as shown in Fig. 4. The values bottom out at 40 degrees for the 0.013″ layer thickness and 43 degrees for the 0.010″ layer thickness. Thus, all other things being equal, you will be able to reduce the support needed by choosing a 0.013″ layer thickness and a 0.026″ or larger contour width. Note that both of these will impact your ability to resolve thin walls and fine features, so ensure you scan through all the tool-paths to validate that the geometry is accurately filled in.

Figure 4. Graph showing how the default values of the self-support angle vary as a function of contour width for the two layer thickness options available for ULTEM. Lower the angle, less the support needed.

4. Remove Supports Immediately

Supports are best removed when the model-support interface is hot. The best time to do this is right after you remove the parts from the print chamber, which is held at 195 C for ULTEM-9085. Ensure you have safety glasses on, work with thermal gloves and have a plier handy to pull out the support. In theory the parts can be re-heated again (175 C is a reasonable value for the oven), but Stratasys suggests that each re-heat cycle actually strengthens the interface, making it harder to remove. As a result, the best time to remove the supports is immediately out of the printer. Figure 5 shows the results of support removal for the intake manifold parts, including the build sheet.

Figure 5. Support removal can be a messy affair as you beat the clock against the cooling parts. Ensure you have gloves, a plier and safety glasses on.
Figure 5. Support removal can be a messy affair as you beat the clock against the cooling parts. Ensure you have gloves, a plier and safety glasses on.

5. Other Observations: the Interface of Separation

It helps to visualize what we are trying to do when we remove supports. There are two interfaces in question here, as shown in Figure 6. One is the model-support interface, the other is the support-box structure interface. We need separation at the model-support interface since removing the thin piece of interface material can prove challenging if the box supports have broken off (as happened for the piece below). What this means is as you remove support, you need to not just pull the supports but also add some peeling force that creates the separation. Once you create separation at the correct interface, you can pull the supports and should have proper cleavage.

Figure 6. (top) Support-model interface surface, and (bottom) support structure interface - it is important to get separation at the former interface
Figure 6. (top) Support-model interface surface, and (bottom) support structure interface – it is important to get separation at the former interface

One final point to keep in mind is that in some cases, eliminating internal supports may be impossible, as shown for a different part in Figure 7 below. The point is to eliminate the support in places you cannot reach with your pliers and get enough peeling force applied to. In the case below, I chose to have supports at the wide opening since I had adequate access to them. With practice, you will get a better sense of what supports can and cannot be removed and use that intuition to better shape your design and process layout decisions before you print.

Figure 6. Support in internal features are alright as long as you have access to them
Figure 7. Support in internal features are alright as long as you have access to them
Figure 7. The final part!
Figure 8. The final part
The ULTEM intake manifold runner and plenum being put through its paces at the ASU Formula SAE test rig
Figure 9. The ULTEM intake manifold runner along with a plenum that we also printed, both being put through their paces at the ASU Formula SAE test rig (Photo Ack: Michael Conard)

Show your support for ASU’s Formula SAE team at their Facebook page and see a video about the endeavor here.

Phoenix Business Journal: ​For tech companies, ‘green’ is all about efficiency, stupid

pbj-phoenix-business-journal-logoEngineers see the serious problems of climate change, lost habitat, pollution, and sustainability differently. This article, “For tech companies, ‘green’ is all about efficiency, stupid” is about how tech companies need to ignore the rhetoric and noise and focus on using science to produce solutions.

Kids, Pizza, Engineering – A Fantastic SciTech Festival Open House at PADT

ScitechFestivalLogoWe thought we would open PADT’s doors to families and maybe a few people would stop by. Over 250 people did just that.  What a great evening of smiling kids and adults enjoying the excitement of engineering.  Exciting engineering? Yes, we know enough to not talk about quality system protocols, matrix inversions, and non-linear turbulence model convergence. We stuck to 3D Printing, elephants on skateboards, and 3D scanners. And we fed everyone pizza.

FullSizeRenderIt was a great evening where everyone learned something.  The focus was on exposing what engineers do, what PADT does, to people who may not be technical. Mostly kids but we also saw it as a way for engineers to show their family members and friends what engineering is about.  The results far exceeded our expectation, mostly because of how great everyone who showed up was.

Some of the quotes from people who have emailed to thank us are:

“Thank you for opening up your office to me.  What a cool place!  Even though I have been familiar with and worked with 3D printing for 20+ years, it is always nice to see the new technology, products, and the output of the products. “

“… to see my son and all of the other kids so excited and amazed was truly awesome. Mason told me it was the best night of his life! And this morning his first words to me where thanking me for taking him to the event and when can we go back.”

“This is such a great opportunity for me to show my grandkids what I spent my life doing, and seeing them get so excited about it is wonderful”  

The best part of the event for most of us here at PADT were the fantastic questions.  As one of our engineers said “for 2 hours I was just lost in the joy of positive human interaction.”  We do love what we do here, but it was nice to share it with other people.

Below are some pictures from the evening.  Make sure you sign up for PADT’s email list to get invites to future events.

IMG_9051
We were pleased to be named a AZ SciTech Festival Signature Event

 

At several points in the evening, the line was headed out the door.
At several points in the evening, the line was headed out the door.

 

The Demo room was full of 3D Printers and the kids loved handling the parts.
The Demo room was full of 3D Printers and the kids loved handling the parts.
IMG_6080
Our office robot was a huge hit.
IMG_9042
The seminar room was turned into a hands-on lab for everyone to touch and feel the engineering tools we use.
IMG_5977
Some of the youngest attendees were able to give ANSYS AIM a literal spin and model the effect of a kid, a dad, and an elephant standing on a skateboard.
IMG_9045
Some people just took to a given tool, even advanced simulation.
Students with exposure to engineering were able to ask our experts in-depth questions about technologies.
IMG_6064
The haptic device was a huge hit. It give real feedback as you edit and probe an object on the computer. Needless to say, kids adapted to it far faster than the adults.
IMG_6109
Engineering students were able to dive deep into the mechanics behind 3D Printing as well as its real world applications in industry.
IMG_9039
This is Ovid. He is PADT’s new mascot. We hope to use him more in the future to help explain what we do here.
IMG_9037
This station shows how 3D Printing works, by stacking layers of material. Ovid doesn’t look as good in low resolution.
IMG_6150
Scanning was a great way for everyone to see how we inspect and reverse engineer objects.

Reading ANSYS Mechanical Result Files (.RST) from C/C++ (Part 3)

ansys-fortran-to-c-cpp-1-00In the last post of this series I illustrated how I handled the nested call structure of the procedural interface to ANSYS’ BinLib routines.  If you recall, any time you need to extract some information from an ANSYS result file, you have to bracket the function call that extracts the information with a *Begin and *End set of function calls.  These two functions setup and tear down internal structures needed by the FORTRAN library.  I showed how I used RAII principles in C++ along with a stack data structure to manage this pairing implicitly.  However, I have yet to actually read anything truly useful off of the result file!  This post centers on the design of a set of C++ iterators that are responsible for actually reading data off of the file.  By taking the time to write iterators, we expose the ANSYS RST library to many of the algorithms available within the standard template library (STL), and we also make our own job of writing custom algorithms that consume result file data much easier.  So, I think the investment is worthwhile.

If you’ve programmed in C++ within the last 10 years, you’ve undoubtedly been exposed to the standard template library.  The design of the library is really rather profound.  This image represents the high level design of the library in a pictorial fashion:

ansys-fortran-to-c-cpp-3-01

On one hand, the library provides a set of generic container objects that provide a robust implementation of many of the classic data structures available within the field of computer science.  The collection of containers includes things like arbitrarily sized contiguous arrays (vectors), linked lists, associative arrays, which are implemented as either binary trees or as a hash container, as well as many more.  The set of containers alone make the STL quite valuable for most programmers.

On the other hand, the library provides a set of generic algorithms that encompass a whole suite of functionality defined in classic computer science.  Sorting, searching, rearranging, merging, etc… are just a handful of the algorithms provided by the library.  Furthermore, extreme care has been taken within the implementation of these algorithms such that an average programmer would hard pressed to produce something safer and more efficient on their own.

However, the real gem of the standard library are iterators.  Iterators bridge the gap between generic containers on one side and the generic algorithms on the other side.  Need to sort a vector of integers, or a double ended queue of strings?  If so, you just call the same sort function and pass it a set of iterators.  These iterators “know” how to traverse their parent container.  (Remember containers are the data structures.)

So, what if we could write a series of iterators to access data from within an ANSYS result file?  What would that buy us?  Well, depending upon which concepts our iterators model, having them available would open up access to at least some of the STL suite of algorithms.  That’s good.  Furthermore, having iterators defined would open up the possibility of providing range objects.  If we can provide range objects, then all of the sudden range based for loops are possible.  These types of loops are more than just syntactic sugar.  By encapsulating the bounds of iteration within a range, and by using iterators in general to perform the iteration, the burden of a correct implementation is placed on the iterators themselves.  If you spend the time to get the iterator implementation correct, then any loop you write after that using either the iterators or better yet the range object will implicitly be correct from a loop construct standpoint.  Range based for loops also make your code cleaner and easier to reason about locally.

Now for the downside…  Iterators are kind of hard to write.  The price for the flexibility they offer is paid for in the amount of code it takes to write them.  Again, though, the idea is that you (or, better yet somebody else) writes these iterators once and then you have them available to use from that point forward.

Because of their flexibility, standard conformant iterators come in a number of different flavors.  In fact, they are very much like an ice cream Sunday where you can pick and choose what features to mix in or add on top.  This is great, but again it makes implementing them a bit of a chore.  Here are some of the design decisions you have to answer when implementing an iterator:

Decision Options Choice for RST Reader Iterators
Dereference Data Type Anything you want Special structs for each type of iterator.
Iteration Category 1.       Forward iterator
2.       Single pass iterator
3.       Bidirectional iterator
4.       Random access iterator
Forward, Single Pass

Iterators syntactically function much like pointers in C or C++.  That is, like a pointer you can increment an iterator with the ++ operator, you can dereference an iterator with the * operator and you can compare two iterators for equality.  We will talk more about incrementing and comparisons in a minute, but first let’s focus on dereferencing.  One thing we have to decide is what type of data the client of our iterator will receive when they dereference it.  My choice is to return a simple C++ structure with data members for each piece of data.  For example, when we are iterating over the nodal geometry, the RST file contains the node number, the nodal coordinates and the nodal rotations.  To represent this data, I create a structure like this:ansys-fortran-to-c-cpp-3-02

I think this is pretty self-explanatory.  Likewise, if we are iterating over the element geometry section of an RST file, there is quite a bit of useful information for each element.  The structure I use in that case looks like this:

ansys-fortran-to-c-cpp-3-03

 

Again, pretty self-explanatory.  So, when I’m building a node geometry iterator, I’m going to choose the NodalCoordinateData structure as my dereference type.

The next decision I have to make is what “kind” of iterator I’m going to create.  That is, what types of “iteration” will it support?  The C++ standard supports a variety of iterator categories.  You may be wondering why anyone would ever care about an “iteration category”?  Well, the reason is fundamental to the design of the STL.   Remember that the primary reason iterators exist is to provide a bridge between generic containers and generic algorithms.  However, any one particular algorithm may impose certain requirements on the underlying iterator for the algorithm to function appropriately.

Take the algorithm “sort” for example.  There are, in fact, lots of different “sort” algorithms.  The most efficient versions of the “sort” algorithm require that an iterator be able to jump around randomly in constant time within the container.  If the iterator supports jumping around (a.k.a. random access) then you can use it within the most efficient sort algorithm.   However, there are certain kinds of iterators that don’t support jumping around.  Take a linked list container as an example.  You cannot randomly jump around in a linked list in constant time.  To get to item B from item A you have to follow the links, which means you have to jump from link to link to link, where each jump takes some amount of processing time.  This means, for example, there is no easy way to cut a linked list exactly in half even if you know how many items in total are in the list.  To cut it in half you have to start at the beginning and follow the links until you’ve followed size/2 number of links.  At that point you are at the “center” of the list.  However, with an array, you simply choose an index equal to size/2 and you automatically get to the center of the array in one step.  Many sort algorithms, as an example, obtain their efficiency by effectively chopping the container into two equal pieces and recursively sorting the two pieces.  You lose all that efficiency if you have to walk out to the center.

If you look at the “types” of iterators in the table above you will see that they build upon one another.  That is, at the lowest level, I have to answer the question, can I just move forward one step?  If I can’t even do that, then I’m not an iterator at all.  After that, assuming I can move forward one step, can I only go through the range once, or can I go over the range multiple times?  If I can only go over the range once, I’m a single pass iterator.  Truthfully, the forward iterator concept and the single pass iterator concept form level 1A and 1B of the iterator hierarchy.  The next higher level of functionality is a bidirectional iterator.  This type of iterator can go forward and backwards one step in constant time.  Think of a doubly linked list.  With forward and backward links, I can go either direction one step in constant time.  Finally, the most flexible iterator is the random access iterator.  These are iterators that really are like raw pointers.  With a pointer you can perform pointer arithmetic such that you can add an arbitrary offset to a base pointer and end up at some random location in a range.  It’s up to you to make sure that you stay within bounds.  Certain classes of iterators provide this level of functionality, namely those associated with vectors and deques.

So, the question is what type of iterator should we support?  Perusing through the FORTRAN code shipped with ANSYS, there doesn’t appear to be an inherent limitation within the functions themselves that would preclude random access.  But, my assumption is that the routines were designed to access the data sequentially.  (At least, if I were the author of the functions that is what I would expect clients to do.)  So, I don’t know how well they would be tested regarding jumping around.  Furthermore, disk controllers and disk subsystems are most likely going to buffer the data as it is read, and they very likely perform best if the data access is sequential.  So, even if it is possible to randomly jump around on the result file, I’m not sold on it being a good idea from a performance standpoint.  Lastly, I explicitly want to keep all of the data on the disk, and not buffer large chunks of it into RAM within my library.  So, I settled on expressing my iterators as single pass, forward iterators.  These are fairly restrictive in nature, but I think they will serve the purpose of reading data off of the file quite nicely.

Regarding my choice to not buffer the data, let me pause for a minute and explain why I want to keep the data on the disk. First, in order to buffer the data from disk into RAM you have to read the data off of the disk one time to fill the buffer.  So, that process automatically incurs one disk read.  Therefore, if you only ever need to iterate over the data once, perhaps to load it into a more specialized data structure, buffering it first into an intermediate RAM storage will actually slow you down, and consume more RAM.  The reason for this is that you would first iterate over the data stored on the disk and read it into an intermediate buffer.  Then, you would let your client know the data is ready and they would iterate over your internal buffer to access the data.  They might as well just read the data off the disk themselves! If the end user really wants to buffer the data, that’s totally fine.  They can choose to do that themselves, but they shouldn’t have to pay for it if they don’t need it.

Finally, we are ready to implement the iterators themselves.  To do this I rely on a very high quality open source library called Boost.  Boost has within it a library called iterator_facade that takes care of supplying most all of the boilerplate code needed to create a conformant iterator.  Using it has proven to be a real time saver.  To define the actual iterator, you derive your iterator class from iterator_facade and pass it a few template parameters.  One is the category defining the type of iterator you are creating.  Here is the definition for the nodal geometry iterator:

ansys-fortran-to-c-cpp-3-04

You can see that there are a few private functions here that actually do all of the work.  The function “increment” is responsible for moving the iterator forward one spot.  The function “equal” is responsible for determining if two different iterators are in fact equal.  And the function “dereference” is used to return the data associated with the current iteration spot.  You will also notice that I locally buffer the single piece of data associated with the current location in the iteration space inside the iterator.  This is stored in the pData member function.  I also locally store the current index.   Here are the implementations of the functions just mentioned:

ansys-fortran-to-c-cpp-3-05

First you can see that testing iterator equality is easy.  All we do is just look to see if the two iterators are pointing to the same index.  If they are, we define them as equal. (Note, an important nuance of this is that we don’t test to see if their buffered data is equal, just their index.  This is important later on.)  Likewise, increment is easy to understand as well.  We just increase the index by one, and then buffer the new data off of disk into our local storage.  Finally, dereference is easy too.  All we do here is just return a reference to the local data store that holds this one node’s data.  The only real work occurs in the readData() function.  Inside that function you will see the actual call to the CResRdNode() function.  We pass that function our current index and it populates an array of 6 doubles with data and returns the actual node number.  After we have that, we simply parse out of that array of 6 doubles the coordinates and rotations, storing them in our local storage.  That’s all there is to it.  A little more work, but not bad.

With these handful of operations, the boost iterator_facade class can actually build up a fully conformant iterator will all the proper operator overloads, etc… It just works.  Now that we have iterators, we need to provide a “begin” and “end” function just like the standard containers do.  These functions should return iterators that point to the beginning of our data set and to one past the end of our data set.  You may be thinking to yourself, wait a minute, how to we provide an “end” iterator without reading the whole set of nodes?  The reality is, we just need to provide an iterator that “equality tests” to be equal to the end of our iteration space?  What does that mean?  Well, what it means is that we just need to provide an iterator that, when compared to another iterator which has walked all the way to the end, it passes the “equal” test.  Look at the “equal” function above.  What do two iterators need to have in common to be considered equal?  They need to have the same index.  So, the “end” iterator simply has an index equal to one past the end of the iteration space.  We know how big our iteration space is because that is one of the pieces of metadata supplied by those ResRd*Begin functions.  So, here are our begin/end functions to give us a pair of conformant iterators.

ansys-fortran-to-c-cpp-3-06

Notice, that the nodes_end() function creates a NodeIterator and passes it an index that is one past the maximum number of nodes that have coordinate data stored on file.  You will also notice, that it does not have a second Boolean argument associated with it.  I use that second argument to determine if I should immediately read data off of the disk when the iterator is constructed.  For the begin iterator, I need to do that.  For the end iterator, I don’t actually need to cache any data.  In fact, no data for that node is defined on disk.  I just need a sentinel iterator that is one past the iteration space.

So, there you have it.  Iterators are defined that implicitly walk over the rst file pulling data off as needed and locally buffering one piece of it.  These iterators are standard conformant and thus can be used with any STL algorithm that accepts a single pass, read only, forward iterator.  They are efficient in time and storage.  There is, though, one last thing that would be nice.  That is to provide a range object so that we can have our cake and eat it too.  That is, so we can write these C++11 range based for loops.  Like this:ansys-fortran-to-c-cpp-3-07

To do that we need a bit of template magic.  Consider this template and type definition:

ansys-fortran-to-c-cpp-3-08

There is a bit of machinery that is going on here, but the concept is simple.  I just want the compiler to stamp out a new type that has a “begin()” and “end()” member function that actually call my “nodes_begin()” and “nodes_end()” functions.  That is what this template will do.  I can also create a type that will call my “elements_begin()” and “elements_end()” function.  Once I have those types, creating range objects suitable for C++11 range based for loops is a snap.  You just make a function like this:

ansys-fortran-to-c-cpp-3-09

 

This function creates one of these special range types and passes in a pointer to our RST reader.  When the compiler then sees this code:

ansys-fortran-to-c-cpp-3-10

It sees a range object as the return type of the “nodes()” function.  That range object is compatible with the semantics of range based for loops, and therefore the compiler happily generates code for this construction.

Now, after all of this work, the client of the RST reader library can open a result file, select something of interest, and start looping over the items in that category; all in three lines of code.  There is no need to understand the nuances of the binlib functions.  But best of all, there is no appreciable performance hit for this abstraction.  At the end of the day, we’re not computationally doing anything more than what a raw use of the binlib functions would perform.  But, we’re adding a great deal of type safety, and, in my opinion, readability to the code.  But, then again, I’m only slightly partial to C++.  Your mileage may vary…

Phoenix Business Journal: When did starting a new company become about funding?

pbj-phoenix-business-journal-logoRaising money is critical, but at some point it became what startups were about. In “When did starting a new company become about funding?” I take a look at this phenomenon and offer some reasons why we should focus more on the product or service.

Reading ANSYS Mechanical Result Files (.RST) from C/C++ (Part 2)

ansys-fortran-to-c-cpp-1-00In the last post in this series I illustrated how you can interface C code with FORTRAN code so that it is possible to use the ANSYS, Inc. BinLib routines to read data off of an ANSYS result file within a C or C++ program.  If you recall, the routines in BinLib are written in FORTRAN, and my solution was to use the interoperability features of the Intel FORTRAN compiler to create a shim library that sits between my C++ code and the BinLib code. In essence, I replicated all of the functions in the original BinLib library, but gave them a C interface. I call this library CBinLib.

You may remember from the last post that I wanted to add a more C++ friendly interface on top of the CBinLib functions.  In particular, I showed this piece of code, and alluded to an explanation of how I made this happen.  This post covers the first half of what it takes to make the code below possible.

ansys-fortran-to-c-cpp-2-01

What you see in the code above is the use of C++11 range based “for loops” to iterate over the nodes and elements stored on the result file.  To accomplish this we need to create conformant STL style iterators and ranges that iterate over some space.  I’ll describe the creation of those in a subsequent post.  In this post, however, we have to tackle a different problem.  The solution to the problem is hidden behind the “select” function call shown in the code above.  In order to provide some context for the problem, let me first show you the calling sequence for the procedural interface to BinLib.  This is how you would use BinLib if you were programming in FORTRAN or if you were directly using the CBinLib library described in the previous post.  Here is the recommended calling sequence:

ansys-fortran-to-c-cpp-2-02

You can see the design pattern clearly in this skeleton code.  You start by calling ResRdBegin, which gives you a bunch of useful data about the contents of the file in general.  Then, if you want to read geometric data, you need to call ResRdGeomBegin, which gives you a little more useful metadata.  After that, if you want to read the nodal coordinate data you call ResRdNodeBegin followed by a loop over nodes calling ResRdNode, which gives you the actual data about individual nodes, and then finally call ResRdNodeEnd.  If at that point you are done with reading geometric data, you then call ResRdGeomEnd.  And, if you are done with the file you call ResRdEnd.

Now, one thing jumps off the page immediately.  It looks like it is important to pair up the *Begin and*End calls.  In fact, if you peruse the ResRd.F FORTRAN file included with the ANSYS distribution you will see that in many of the *End functions, they release resources that were allocated and setup in the corresponding *Begin function.

So, if you forget to call the appropriate *End, you might leak resources.  And, if you forget to call the appropriate *Begin, things might not be setup properly for you to iterate.  Therefore, in either case, if you fail to call the right function, things are going to go badly for you.

This type of design pattern where you “construct” some scaffolding, do some work, and then “destruct” the scaffolding is ripe for abstracting away in a C++ type.  In fact, one of the design principles of C++ known as RAII (Resource Acquisition Is Initialization) maps directly to this problem.  Imagine that we create a class in which in the constructor of the class we call the corresponding *Begin function.  Likewise, in the destructor of the class we call the corresponding *End function.  Now, as long as we create an instance of the class before we begin iterating, and then hang onto that instance until we are done iterating, we will properly match up the *Begin, *End calls.  All we have to do is create classes for each of these function pairs and then create an instance of that class before we start iterating.  As long as that instance is still alive until we are finished iterating, we are good.

Ok, so abstracting the *Begin and *End function pairs away into classes is nice, but how does that actually help us?  You would still have to create an instance of the class, hold onto it while you are iterating, and then destroy it when you are done.  That sounds like more work than just calling the *Begin, *End directly.  Well, at first glance it is, but let’s see if we can use the paradigm more intelligently.  For the rest of this article, I’ll refer to these types of classes as BeginEnd classes, though I call them something different in the code.

First, what we really want is to fire and forget with these classes.  That is, we want to eliminate the need to manually manage the lifetime of these BeginEnd classes.  If I don’t accomplish this, then I’ve failed to reduce the complexity of the *Begin and *End requirements.  So, what I would like to do is to create the appropriate BeginEnd class when I’m ready to extract a certain type of data off of the file, and then later on have it magically delete itself (and thus call the appropriate *End function) at the right time.  Now, one more complication.  You will notice that these *Begin and*End function pairs are nested.  That is, I need to call ResRdGeomBegin before I call ResRdNodeBegin.  So, not only do I want a solution that allows me to fire and forget, but I want a solution that manages this nesting.

Whenever you see nesting, you should think of a stack data structure.  To increase the nesting level, you push an item onto the stack.  To decrease the nesting level, you pop and item off of the stack.  So, we’re going to maintain a stack of these BeginEnd classes.  As an added benefit, when we introduce a container into the design space, we’ve introduced something that will control object lifetime for us.  So, this stack is going to serve two functions for us.  It’s going to ensure we call the *Begin’s and *End’s in the right nested order, and second, it’s going to maintain the BeginEnd object lifetimes for us implicitly.

To show some code, here is the prototype for my pure virtual class that serves as a base class for all of the BeginEnd classes.  (In my code, I call these classes FileSection classes)

ansys-fortran-to-c-cpp-2-03

You can see that it is an interface class by noting the pure virtual function getLevel.  You will also notice that this function returns a ResultFileSectionLevel.  This is just an enum over file section types.  I like to use an enum as opposed to relying on RTTI.  Now, for each BeginEnd pair, I create an appropriate derived class from this base ResultFileSection class.  Within the destructor of each of the derived classes I call the appropriate *End function.  Finally, here is my stack data structure definition:

ansys-fortran-to-c-cpp-2-03p5

 

You can see that it is just a std::stack holding objects of the type SectionPtrT.  A SectionPtrT is a std::unique_ptr for objects convertible to my base section class.  This will enable the stack to hold polymorphic data, and the std::unique_ptr will manage the lifetime of the objects appropriately.   That is, when we pop and object off of the stack, the std::unique_ptr will make sure to call delete, which will call the destructor.  The destructor calls the appropriate *End function as we’ve mentioned before.

At this point, we’ve reduced our problem to managing items on a stack.  We’re getting closer to making our lives easier, trust me!  Let’s look at a couple of different functions to show how we pull these pieces together.  The first function is called reduceToLevelOrBegin(level).  See the code below:ansys-fortran-to-c-cpp-2-04

The operation of this function is fairly straightforward, yet it serves an integral role in our BeginEnd management infrastructure.   What this function does is it iteratively pops items off of our section stack until it either reaches the specified level, or it reaches the topmost ResRdBegin level.  Again, through the magic of C++ polymorphism, when an item gets popped off of the stack, eventually its destructor is called and that in turn calls the appropriate *End function.  So, what this function accomplishes is it puts us at a known level in the nested section hierarchy and, while doing so, ensures that any necessary *End functions are called appropriately to free resources on the FORTRAN side of things.  Notice that all of that happens automatically because of the type system in C++.  By popping items off of the stack, I implicitly clean up after myself.

The second function to consider is one of a family of similar functions.  We will look at the function that prepares the result file reader to read element geometry data off of the file.  Here it is:

ansys-fortran-to-c-cpp-2-05

You will notice that we start by reducing the nested level to either the “Geometry” level or the “Begin” level.  Effectively what this does is unwind any nesting we have done previously.  This is the machinery that makes “fire and forget” possible.  That is, whenever in ages past that we requested something to be read off of the result file, we would have pushed onto the stack a series of objects to represent the level needed to read the data in question.  Now that we wish to read something else, we unwind any previously existing nested Begin calls before doing so.   That is, we clean up after ourselves only when we ask to read a different set of data.  By waiting until we ask to read some new set of data to unwind the stack, we implicitly allow the lifetime of our BeginEnd classes to live beyond iteration.

At this point we have the stack in a known state; either it is at the Begin level or the Geometry level.  So, we simply call the appropriate *Begin functions depending on what level we are at, and push the appropriate type of BeginEnd objects onto the stack to record our traversal for later cleanup.  At this point, we are ready to begin iterating.  I’ll describe the process of creating iterators in the next post.  Clearly, there are lots of different select*** functions within my class.  I have chosen to make all of them private and have a single select function that takes an enum descriptor of what to select and some additional information for specifying result data.

One last thing to note with this design.  Closing the result file is easy. All that is required is that we simply fully unwind the stack.  That will ensure all of the appropriate FORTRAN cleanup code is called in the right order.  Here is the close function:

ansys-fortran-to-c-cpp-2-06

As you can see, cleanup is handled automatically.  So, to summarize, we use a stack of polymorphic data to manage the BeginEnd function calls that are necessary in the FORTRAN interface.  By doing this we ensure a level of safety in our class design.  Also, this moves us one step closer to this code:

ansys-fortran-to-c-cpp-2-07

In the next post I will show how I created iterators and range objects to enable clean for loops like the ones shown above.