Releases: ansys/pymapdl
Patch Ignored Commands
Certain element checks within the solve
command result in errors that are actually warnings and do not halt the solve. This release implements a patch that ignores those element distortion errors and instead passes them as a Python warning.
Refactored MAPDL Launcher
These release notes cover a variety of new features and bug fixes that have occured in the past year.
New Features
- Exchange vectors and arrays from numpy to MAPDL through the
Mapdl
class - Better cyclic result processing, including cyclic strain, stress, temperature, etc.
- Element result plotting
- Support for newer ANSYS MAPDL releases (i.e. up to 2020R2)
- Support all element types in the result file.
- Interactive geometry plotting (e.g.
KPLOT
,APLOT
,VPLOT
) withinpyansys
using VTK. No reason to useopen_gui
for geometry scripting. - Add support for Python 3.8
- Add sparse result file reading (necessary for latest ANSYS releases)
Bug fixes
- Element components are properly supported in result files
- Fix CORBA interface for ANSYS 2019R1
- Fix VTK 9 compatibility issues
- Fix various archive file formatting issues when reading.
- Fix negative/positive cyclic rotation issues.
- Correctly apply euler angles.
- Fix MAPDL executable finder.
API Changes
There's been a variety of API changes since the last release, and it's past time to list those changes and some of the reasoning behind those changes.
Use launch_mapdl
instead of Mapdl
This is a bit more straightforward in terms of launching MAPDL since there are two methods for communicating with MAPDL at the moment, and it opens up MAPDL for additional interfaces
Remove uppercase methods from Mapdl
This was a necessary change to make the Mapdl
class PEP8 compliant. While annoying to change, it's way better to provide a consistent interface like to other popular modules (numpy
, scipy
, matplotlib
...)
Improved pyansys Interface and Translation
Added ability to translate scripts ANSYS input scripts directly to python scripts. See:
https://pyansys.readthedocs.io/en/latest/ansys_control.html#translating-scripts
Verified compatibility with ANSYS versions 15, 17, and 18.2 for
- Archive files
- Nodal results
- Element results
Bug with inaccurate nodal stress results for mixed nodes has been patched. pyansys
now includes unit and functional testing to verify accuracy with ANSYS results.
See https://pyansys.readthedocs.io/en/latest/ for the latest documentation.
Added ANSYS Interface
Now able to spawn and control an instance of ANSYS. See the documentation below for more details:
http://pyansys.readthedocs.io/en/latest/ansys_control.html
Quick example:
import time
import pyansys
ansys = pyansys.ANSYS()
# create a square area using keypoints
ansys.Prep7()
ansys.K(1, 0, 0, 0)
ansys.K(2, 1, 0, 0)
ansys.K(3, 1, 1, 0)
ansys.K(4, 0, 1, 0)
ansys.L(1, 2)
ansys.L(2, 3)
ansys.L(3, 4)
ansys.L(4, 1)
ansys.Al(1, 2, 3, 4)
# Start a non-interactive plotting window
ansys.Show()
ansys.Menu('grph')
ansys.View(1, 1, 1, 1) # sets the view to "isometric"
# Plot geometry while waiting between plots
ansys.Pnum('kp', 1) # enable keypoint numbering
ansys.Pnum('line', 1) # enable line numbering
ansys.Aplot()
time.sleep(1) # could also use ansys.Wait(1)
ansys.Lplot()
time.sleep(1)
ansys.Kplot()
ansys.Save()
ansys.Exit()
Improved Full Reader
Mass and stiffness matrices from the full reader before 0.24 needed to have their constrained degrees of freedom removed from the arrays if they were constrained within ANSYS. These constrained degrees of freedom are now automatically removed.
The sort option has been added back. Sorting is disabled by default. See the latest release notes:
http://pyansys.readthedocs.io/en/latest/loading_km.html
Added single precision mesh quality check
Prior version needed to convert to double before checking cell quality.
Principal Stress Computation
Added principal stress computation and plotting. Example is in documentation and below:
pstress = result.PrincipalNodalStress(0)
result.PlotPrincipalNodalStress(0, 'SEQV')
See updated documentation at:
http://pyansys.readthedocs.io/en/latest/loading_results.html
Garbage Collection Fix and Updated Documentation
Due to limitations with vtkInterface
, object were not being garbage collected when deleted. That's fixed now, along with the outdated documentation and examples.
Archive File Code Streamlining
ParseFEM
has been removed entirely from the archive reader and new archive files can be read in and displayed with VTK using:
import pyansys
archive = pyansys.ReadArchive('tiny.cdb')
grid = archive.ParseVTK()
grid.Plot() # plot
This approach simplifies much of the code and eliminates an unnecessary function. Information about the ansys archive file is now contained within the unstructured grid and can be accessed using the GetPointScalars
function. See vtkInterface
.
ParseVTK
also allows you to specify element types to read in. See the doc_string
of ParseVTK
below:
Parses raw data from cdb file to VTK format.
Parameters
----------
force_linear : bool, optional
This parser creates quadradic elements if available. Set this to
True to always create linear elements. Defaults to False.
allowable_types : list, optional
Allowable element types. Defaults to:
['45', '95', '185', '186', '92', '187']
Can include:
['45', '95', '185', '186', '92', '187', '154']
Returns
-------
uGrid : vtk.vtkUnstructuredGrid
VTK unstructured grid from archive file.
Added Cyclic Plotting Results and Output to Paraview
See the documentation at https://pyansys.readthedocs.io/en/latest/loading_results.html#results-from-a-cyclic-analysis to plot cyclic results.
Also see https://pyansys.readthedocs.io/en/latest/loading_results.html#exporting-to-paraview for the steps to export and convert rst files to paraview.