Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
###################### MAPDL Archive Reader ######################
|pypi| |GH-CI| |MIT|
.. |pypi| image:: https://img.shields.io/pypi/v/mapdl-archive.svg?logo=python&logoColor=white :target: https://pypi.org/project/mapdl-archive/
.. |GH-CI| image:: https://github.com/akaszynski/mapdl-archive/actions/workflows/testing-and-deployment.yml/badge.svg :target: https://github.com/akaszynski/mapdl-archive/actions/workflows/testing-and-deployment.yml
.. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg :target: https://opensource.org/licenses/MIT
Read blocked Ansys MAPDL archive files written from MAPDL using
CDWRITE
.
This is effectively pymapdl-reader <https://github.com/ansys/pymapdl-reader>
_ without the binary reader.
It's been isolated to allow greater flexibility in development.
Installation
Installation through pip:
.. code::
pip install mapdl-archive
Examples
ANSYS archive files containing solid elements (both legacy and modern), can be loaded using Archive and then converted to a VTK object.
.. code:: python
from mapdl_archive import Archive, examples
filename = examples.hexarchivefile
archive = Archive(filename)
for key in archive.raw: print("%s : %s" % (key, archive.raw[key]))
grid = archive.parse_vtk(force_linear=True) grid.plot(color='w', show_edges=True)
grid.save('hex.vtu')
grid.save('hex.vtk')
.. figure:: https://github.com/akaszynski/mapdl-archive/blob/main/doc/hexbeam_small.png :alt: Hexahedral beam
You can then load this vtk file using PyVista <https://docs.pyvista.org/version/stable/>
_ or VTK <https://vtk.org/>
_.
.. code:: python
import pyvista as pv grid = pv.UnstructuredGrid('hex.vtu') grid.plot()
Reading ANSYS Archives
MAPDL archive *.cdb
and *.dat
files containing elements (both
legacy and modern) can be loaded using Archive and then converted to a
vtk
object:
.. code:: python
import mapdl_archive from mapdl_archive import examples
archive = mapdl_archive.Archive(examples.hexarchivefile)
print(archive.nnum, archive.nodes)
grid = archive.grid archive.plot(color='w', show_edges=True)
You can also optionally read in any stored parameters within the archive
file by enabling the read_parameters
parameter.
.. code:: python
import mapdl_archive archive = mapdl_archive.Archive('mesh.cdb', read_parameters=True)
archive.parameters
Writing MAPDL Archives
Unstructured grids generated using VTK can be converted to ANSYS APDL
archive files and loaded into any version of ANSYS using
mapdl_archive.save_as_archive
in Python followed by CDREAD
in
MAPDL. The following example using the built-in archive file
demonstrates this capability.
.. code:: python
import pyvista as pv from pyvista import examples import mapdl_archive
grid = pv.UnstructuredGrid(examples.hexbeamfile) script_filename = '/tmp/grid.cdb' mapdl_archive.save_as_archive(script_filename, grid)
from ansys.mapdl.core import launch_mapdl mapdl = launch_mapdl() mapdl.cdread('db', script_filename) mapdl.prep7() mapdl.shpp('SUMM')
Resulting ANSYS quality report:
.. code::
<<<<<< SHAPE TESTING SUMMARY >>>>>>
<<<<<< FOR ALL SELECTED ELEMENTS >>>>>>
--------------------------------------
| Element count 40 SOLID185 |
--------------------------------------
Test Number tested Warning count Error count Warn+Err %
---- ------------- ------------- ----------- ----------
Aspect Ratio 40 0 0 0.00 %
Parallel Deviation 40 0 0 0.00 %
Maximum Angle 40 0 0 0.00 %
Jacobian Ratio 40 0 0 0.00 %
Warping Factor 40 0 0 0.00 %
Any 40 0 0 0.00 %
At the moment, only solid elements are supported by the
save_as_archive
function, to include:
vtk.VTK_TETRA
vtk.VTK_QUADRATIC_TETRA
vtk.VTK_PYRAMID
vtk.VTK_QUADRATIC_PYRAMID
vtk.VTK_WEDGE
vtk.VTK_QUADRATIC_WEDGE
vtk.VTK_HEXAHEDRON
vtk.VTK_QUADRATIC_HEXAHEDRON
Linear element types will be written as SOLID185, quadratic elements will be written as SOLID186, except for quadratic tetrahedrals, which will be written as SOLID187.
License and Acknowledgments
The mapdl-archive
library is licensed under the MIT license.
FAQs
Pythonic interface to MAPDL archive files.
We found that mapdl-archive demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.