ToM_Featured_Jan16

Tech Tip: Advanced Ansys Workbench Files (MEMS Example)

Workbench provides an incredible amount of organization and automation for all your simulation files behind the scenes. Whether you want to be more appreciative of all that Workbench does in the background or you want to customize it for advanced applications, it helps to be familiar with what is happening with your files.

The ANSYS Workbench file system for an ANSYS Mechanical project, including the temporary solution directory.

The ANSYS Workbench file system for an ANSYS Mechanical project, including the temporary solution directory.

The typical Workbench project will have, at the top level directory, a <project name>.wbpj file and a <project name>_files directory, as shown in the picture above. Inside of this directory is where all the mysterious and automatic stuff happens. For a single ANSYS Mechanical system (Static Structural, Thermal, Modal/Harmonic, etc…) your directory of interest will be in the MECH directory, at the very bottom of the diagram. This directory can easily be opened in the ANSYS Mechanical application by right clicking on Solution in the tree and selecting Open Solver Files Directory.

Get to the important MECH directory quickly and easily by right clicking on Solution and selecting the highlighted option.

Get to the important MECH directory quickly and easily by right clicking on Solution and selecting the highlighted option.

Inside the MECH directory is where all of the relevant files for the solution process are located. The mesh, loads and material properties are written to a text input file, ds.dat, and there may be several supporting files. The workflow here will be familiar to users of the old ANSYS Mechanical APDL interface (sometimes referred to as ANSYS Classic). This is where files needed for a solution process should be placed if they are not already handled by Workbench.

The actual solve does not happen here, however, it happens in the _ProjectScratch directory, located on the same top level project directory as the wbpj file. All the files in the MECH directory are moved here, the solve takes place and then the files are moved back. Workbench at this point will helpfully delete files that are unnecessary as per Analysis Settings (the MAPDL solver creates many files, see the documentation chapter File Management and Files under the MAPDL Basic Analysis Guide for a full listing). Note that any additional files that you may have manually placed in this directory are both automatically moved to the temporary solve directory and moved back. This also applies to new files created during the solution process, such as path results or images that are created by the /show command. So for a single analysis that needs non-standard support files, you can just drop your files in the MECH directory and they will available to the solver.

What if we need to deal with files that involve more than one analysis system? There are many ways in which two or more analysis systems could interact in a way that Workbench does not yet support. Examples include:

  • Updating a deformed geometry upstream (in R17 next week, this will be fully supported in Workbench)
  • Initial stresses or strains calculated in one analysis, written to an initial state file and applied to an upstream analysis through INISTATE
  • A common data file referenced by several analysis types
  • Any type of sequential coupled field analysis type

The user_files directory provides us with a common directory that we can use to store intermediate files. This allows us to avoid trying to predict the directory structure within Workbench or manually moving files each time it is solved. From the flowchart at the beginning of this post, this directory can easily be navigated to. It is also easy to find the path to the user files directory, along with other directories of interest, in APDL command snippets due to parameters automatically set in the solve process. See the beginning of the Solver Output file to find the following parameters:

_WB_PROJECTSCRATCH_DIR Absolute path to the temporary solution directory (Scr###)
_WB_SOLVERFILES_DIR Absolute path to the MECH directory
_WB_USERFILES_DIR Absolute path to the user_files directory for the project

We can construct paths using the APDL string or path manipulation commands and copy files between these directories easily. Here is an example of an APDL snippet that copies the result file to the user_files directory:

*dim,fname,STRING,128
fname(1)=strcat(_WB_USERFILES_DIR(1),'file')
/copy,file,rst,,fname(1),rst

For more information on the file operations commands available, see the File Management and Files section under the MAPDL Basic Analysis Guide. For more information on the string manipulation commands, see the very bottom of the Appendix B. GET Function Summary under the ANSYS Parametric Design Language Guide section in the documentation.

An example of the above input file is for a MEMS application. An electrostatic air gap is modeled and we are interested in measuring the capacitance as the gap deforms due to applied voltage. This could be a characterization for a Reduced Order Model (ROM), such as for the TRANS126 element. In Workbench, we can use the ACT MEMS extension set up both the deformed shape calculation and capacitance calculation in a Static Structural and Electric system, respectively. We can use the UPGEOM command to update the initial node positions of the electric analysis to the final deformed positions of the static structural analysis by referencing a result file in the user_files directory, copied there after the solve with the above command snippet. Because of our robust and automated setup, we can easily do a parametric analysis to automatically solve at several voltages:

Workbench System Layout, Deformation vs Capacitance/Voltage, solved deformation result of MEMS system.

Workbench System Layout, Deformation vs Capacitance/Voltage, solved deformation result of MEMS system.

Did you find this useful? Sign up for our newsletter below to receive tips like this and more every month:

Subscribe to Newsletter

  • This field is for validation purposes and should be left unchanged.