https://github.com/akaszynski/mapdl-archive

Read and write MAPDL archive files (*.cdb)

https://github.com/akaszynski/mapdl-archive

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.8%) to scientific vocabulary

Keywords from Contributors

parallel mesh archiving energy-system-model distributed transformers chart spacy-extension molecular-dynamics-simulation hydrology
Last synced: 11 months ago · JSON representation

Repository

Read and write MAPDL archive files (*.cdb)

Basic Info
  • Host: GitHub
  • Owner: akaszynski
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 4.91 MB
Statistics
  • Stars: 3
  • Watchers: 3
  • Forks: 0
  • Open Issues: 1
  • Releases: 7
Created almost 3 years ago · Last pushed about 1 year ago
Metadata Files
Readme Contributing License

README.rst

######################
 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
`_ without the binary reader.
It's been isolated to allow greater flexibility in development.

**************
 Installation
**************

Installation through pip:

.. code::

   pip install mapdl-archive

**********
 Examples
**********

Load and Plot an MAPDL Archive File
===================================

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

   # Sample *.cdb
   filename = examples.hexarchivefile

   # Read ansys archive file
   archive = Archive(filename)

   # Print raw data from cdb
   for key in archive.raw:
      print("%s : %s" % (key, archive.raw[key]))

   # Create an unstructured grid from the raw data and plot it
   grid = archive.parse_vtk(force_linear=True)
   grid.plot(color='w', show_edges=True)

   # write this as a vtk xml file
   grid.save('hex.vtu')

   # or as a vtk binary
   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
`_ or `VTK
`_.

.. 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

   # Read a sample archive file
   archive = mapdl_archive.Archive(examples.hexarchivefile)

   # Print various raw data from cdb
   print(archive.nnum, archive.nodes)

   # access a vtk unstructured grid from the raw data and plot it
   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)

   # parameters are stored as a dictionary
   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

   # load in a vtk unstructured grid
   grid = pv.UnstructuredGrid(examples.hexbeamfile)
   script_filename = '/tmp/grid.cdb'
   mapdl_archive.save_as_archive(script_filename, grid)

   # Optionally read in archive in PyMAPDL and generate cell shape
   # quality report
   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 %
   ------------------------------------------------------------------------------

Supported Elements
==================

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.

Owner

  • Name: Alex Kaszynski
  • Login: akaszynski
  • Kind: user

GitHub Events

Total
  • Create event: 11
  • Issues event: 1
  • Release event: 4
  • Delete event: 6
  • Issue comment event: 1
  • Push event: 13
  • Pull request review event: 1
  • Pull request event: 17
Last Year
  • Create event: 11
  • Issues event: 1
  • Release event: 4
  • Delete event: 6
  • Issue comment event: 1
  • Push event: 13
  • Pull request review event: 1
  • Pull request event: 17

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 66
  • Total Committers: 3
  • Avg Commits per committer: 22.0
  • Development Distribution Score (DDS): 0.318
Past Year
  • Commits: 14
  • Committers: 2
  • Avg Commits per committer: 7.0
  • Development Distribution Score (DDS): 0.143
Top Committers
Name Email Commits
Alex Kaszynski a****p@g****m 45
dependabot[bot] 4****] 17
pre-commit-ci[bot] 6****] 4

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 1
  • Total pull requests: 61
  • Average time to close issues: N/A
  • Average time to close pull requests: 11 days
  • Total issue authors: 1
  • Total pull request authors: 3
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.41
  • Merged pull requests: 49
  • Bot issues: 0
  • Bot pull requests: 35
Past Year
  • Issues: 1
  • Pull requests: 16
  • Average time to close issues: N/A
  • Average time to close pull requests: 5 days
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.06
  • Merged pull requests: 15
  • Bot issues: 0
  • Bot pull requests: 5
Top Authors
Issue Authors
  • akaszynski (2)
Pull Request Authors
  • dependabot[bot] (44)
  • akaszynski (34)
  • pre-commit-ci[bot] (10)
Top Labels
Issue Labels
Pull Request Labels
dependencies (22) github_actions (22)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 803 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 14
  • Total maintainers: 1
pypi.org: mapdl-archive

Pythonic interface to MAPDL archive files.

  • Versions: 14
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 803 Last month
Rankings
Dependent packages count: 7.5%
Forks count: 30.3%
Average: 36.7%
Stargazers count: 39.2%
Dependent repos count: 69.7%
Maintainers (1)
Last synced: 11 months ago

Dependencies

.github/workflows/testing-and-deployment.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • pypa/cibuildwheel v2.15.1 composite
  • pyvista/setup-headless-display-action v2 composite
  • softprops/action-gh-release v1 composite
pyproject.toml pypi
requirements/requirements_test.txt pypi
  • pytest ==7.4.0 test
  • pytest-cov ==4.1.0 test
setup.py pypi
  • pyvista >=0.41.1