Using Command Snippets in Solution (And a cool new ACT Extension to make life easier)

Categories:

So you have results for a job that took several hours to run, or several days, and now you realize that you need to use a post-processing command snippet. In the past, prior to version 14.5, this would be a huge problem, because just adding the command snippet in the Solution branch would trigger a resolve. So, in those cases, we would usually just jump over to MAPDL to do the post-processing.  In version 14.5, however, ANSYS allowed you to add the snippet to the Solution branch without triggering a resolve.

When you hit “Evaluate All Results”, Mechanical will copy the files to a scratch directory and start a separate MAPDL session. This leads to a secondary problem. Often you need to select nodes or elements to use during your snippet. This is usually done with a Named Selection, or a material ID that you saved to a parameter in a Geometry command snippet.  The problem is that the Named Selections, or components in MAPDL, are not saved in the RST file, neither are parameters. They are stored in the DB file. If you thought ahead, then in the Analysis Settings, you set the ‘Save DB file’ option to ‘Yes’ before you solved. In your post-processing command snippet you could then use the RESUME command to bring the database back to the state that it was just before the solve – having all your Named Selections and parameters. But since the default is to not save the DB file, odds are that you don’t have it.  It’s okay, though. There are still some options.

The first thing I recommend is that you save the solved project, and then do a ‘Save As’ to make a copy from which to work, just in case something goes wrong.

Method 1:

When you hit the Solve button in Mechanical, it writes out a ‘ds.dat’ file that then gets run in a batch MAPDL run.

If you have all of your needed Named Selections setup prior to the Solve, then you can open an MAPDL session and use the File>Read Input From… command to read in the ds.dat file.  In interactive mode, the file stops just before the Solve command, so you can then save the database file at that point.  You then need to right-click on the Solution branch in Mechanical and hit “Open Solution Directory”, in to which you need to copy the new “file.db” file.  Then you can resume the file.db in your post-processing command snippet. 

If you need to add a new Named  Selection, you can add a new one, even in 14.5, without triggering a resolve, but then you will have to write out a new input file. To do this, highlight the Solution branch in the tree, go to Tools>Write Input File…, and then follow the procedure above.  

Method 2:

If you are using version 17.1 or later, you have another option. You can Right-click on a Name Selection and choose “Create a Nodal Named Selection”. Then right-click that new nodal named selection and hit “Export Selections to CDB File”.  You can select several Nodal Named Selections to export, and the export will all go to one file. Include that text in your snippet.

padt command snippets solution f01
padt command snippets solution f02
padt command snippets solution f03

Method 3:

In R19.2, the Named Selections are now stored in the RST file. If you don’t need to add a new Named Selection, then can you access the Named Selections that were created prior to the solution run.  After a SET command in your snippet, you can just use the name in the NSEL command, as I did in the picture above, with no need to include the CMBLOCK from the CDB file.  If you need a new Named Selection, however, then you have to use Methods 1 or 2 above.

Pitfalls:

Now that all sounds somewhat difficult, and it actually gets worse. With Method 1, you have to know at least enough MAPDL to open it and read in the input file, and then save the database file.

With Method 2 and 3, the parameters are still not saved in the RST file. So if you need parameters that were created in earlier command snippets, then you have to go back to Method 1.

But there’s hope!!

Method 4:  Oh, Joy!!!

padt command snippets solution f04

There is one other thing that you can do, and this is my favorite method. (Probably because I wrote it. J)  There is now a new free ACT extension in the ANSYS App store. It is called SAVE_DB, and was written because yours truly got tired of dealing with the other three methods above.  SAVE_DB allows you to save the MAPDL database file without having to solve the Mechanical model, or cause a resolve. SAVE_DB will automatically change the Analysis Settings > Analysis Data Management > Save MAPDL DB value to “Yes” so that future resolves are also saved. MAPDL will be run in the background on the same version as the Workbench project, and the “file.db” will be saved to the Solver Files Directory.  Now any new Named Selections that you add will be ready at the push of a button. This one:

padt command snippets solution f05

This is the first of many helpful tools planned for a PADT_Toolkit. I will post another plug, I mean ‘blog’, when I get more tools added and the PADT_Toolkit uploaded to the APP Store.  Until then enjoy SAVE_DB!

Categories

Get Your Ansys Products & Support from the Engineers who Contribute to this Blog.

Technical Expertise to Enable your Additive Manufacturing Success.

PADT’s Pulse Newsletter

Keep up to date on what is going on at PADT by subscribing to our newsletter.


By submitting this form, you are consenting to receive marketing emails from: . You can revoke your consent to receive emails at any time by using the SafeUnsubscribe® link, found at the bottom of every email. Emails are serviced by Constant Contact

Share this post:

Upcoming Events

03/28/2024

SAF Blue Carpet Event

03/28/2024

2024 Arizona Space Summit

04/03/2024

Low Frequency Updates in Ansys 2024 R1 - Webinar

04/03/2024

Venture Madness Conference Reception + Expo

04/03/2024

Stratasys F3300: Game Changing Throughput - Webinar

04/08/2024

39th Space Symposium

04/09/2024

39th Space Symposium

04/10/2024

Discovery Updates in Ansys 2024 R1 - Webinar

04/10/2024

39th Space Symposium

04/11/2024

39th Space Symposium

04/22/2024

Experience Stratasys Truck Tour: Houston, TX

04/24/2024

Structures Updates in Ansys 2024 R1 (2)

04/24/2024

Experience Stratasys Truck Tour: Houston, TX

05/07/2024

Experience Stratasys Truck Tour: Albuquerque, NM

05/08/2024

Fluent Materials Processing Updates in Ansys 2024 R1 - Webinar

05/09/2024

Experience Stratasys Truck Tour: Los Alamos, NM

05/14/2024

Simulation World 2024

05/15/2024

Simulation World 2024

05/16/2024

Simulation World 2024

05/22/2024

Optics Updates in Ansys 2024 R1 - Webinar

06/12/2024

Connect Updates in Ansys 2024 R1 - Webinar

06/26/2024

Structures Updates in Ansys 2024 R1 (3) - Webinar

06/27/2024

E-Mobility and Clean Energy Summit

07/10/2024

Fluids Updates in Ansys 2024 R1 - Webinar

08/05/2024

2024 CEO Leadership Retreat

10/23/2024

PADT30 | Nerdtoberfest 2024

Search in PADT site

Contact Us

Most of our customers receive their support over the phone or via email. Customers who are close by can also set up a face-to-face appointment with one of our engineers.

For most locations, simply contact us: