Skip to content

Commit

Permalink
Merge pull request #757 from ansys/maint/release_0.1.0
Browse files Browse the repository at this point in the history
Release 0.1.0
  • Loading branch information
greschd authored Jan 10, 2025
2 parents 71c8f19 + df52dc2 commit b4e0bd1
Show file tree
Hide file tree
Showing 222 changed files with 1,123 additions and 1,043 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# Owners will be requested for review when someone opens a PR.
* @greschd @janvonrickenbach @roosre
* @greschd @roosre @SRaimondi
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ repos:
hooks:
- id: codespell
additional_dependencies: ["tomli"] # needed to parse pyproject.toml
exclude: '^poetry\.lock|pyproject\.toml$'
exclude: '^poetry\.lock|pyproject\.toml|.*\.svg$'

- repo: https://github.com/python-poetry/poetry/
rev: "1.8.0"
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
## Project Lead

* [Dominik Gresch](https://github.com/greschd)
* [Jan von Rickenbach](https://github.com/janvonrickenbach)
* [René Roos](https://github.com/roosre)
* [Simone Raimondi](https://github.com/SRaimondi)

## Individual Contributors

Expand All @@ -15,3 +15,4 @@
* [René Roos](https://github.com/roosre)
* [Revathy Venugopal](https://github.com/Revathyvenugopal162)
* [Roberto Pastor Muela](https://github.com/RobPasMue)
* [Simone Raimondi](https://github.com/SRaimondi)
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
Copyright (c) 2022 - 2025 ANSYS, Inc. and/or its affiliates.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
PyACP
=====
.. image:: https://github.com/ansys/pyacp/blob/feat/pyacp_logo/doc/source/_static/pyacp.svg
:width: 400
:alt: PyACP Logo
:align: center

|pyansys| |python| |pypi| |GH-CI| |codecov| |MIT| |black|

.. |pyansys| image:: https://img.shields.io/badge/Py-Ansys-ffc107.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABDklEQVQ4jWNgoDfg5mD8vE7q/3bpVyskbW0sMRUwofHD7Dh5OBkZGBgW7/3W2tZpa2tLQEOyOzeEsfumlK2tbVpaGj4N6jIs1lpsDAwMJ278sveMY2BgCA0NFRISwqkhyQ1q/Nyd3zg4OBgYGNjZ2ePi4rB5loGBhZnhxTLJ/9ulv26Q4uVk1NXV/f///////69du4Zdg78lx//t0v+3S88rFISInD59GqIH2esIJ8G9O2/XVwhjzpw5EAam1xkkBJn/bJX+v1365hxxuCAfH9+3b9/+////48cPuNehNsS7cDEzMTAwMMzb+Q2u4dOnT2vWrMHu9ZtzxP9vl/69RVpCkBlZ3N7enoDXBwEAAA+YYitOilMVAAAAAElFTkSuQmCC
Expand Down Expand Up @@ -33,9 +36,6 @@ PyACP

A Python client for Ansys Composite PrepPost (ACP).

Overview
--------

Installation
------------

Expand Down
6 changes: 6 additions & 0 deletions doc/source/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import "../ansys-sphinx-theme.css";

.sphx-glr-thumbcontainer img {
max-height: 100% !important;
max-width: 100% !important;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions doc/source/_static/pyacp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def _signature(
"exclude_implicit_doc": {"ansys\\.acp\\.core\\._.*"}, # ignore private submodules
"image_scrapers": (DynamicScraper(), "matplotlib"),
"ignore_pattern": r"__init__\.py",
"thumbnail_size": (350, 350),
"thumbnail_size": (320, 240),
"remove_config_comments": True,
}

Expand All @@ -318,6 +318,10 @@ def _signature(
# static path
html_static_path = ["_static"]

# Custom CSS files
# These paths are either relative to html_static_path or fully qualified paths (eg. https://...)
html_css_files = ["custom.css"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

Expand Down
8 changes: 6 additions & 2 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
contributing


PyACP
-----
.. image:: ../source/_static/pyacp.svg
:width: 400
:alt: PyACP Logo
:align: center

.. title:: PyACP

PyACP enables modelling continuous-fiber composite structures from within your
Python environment. It provides access to the features of Ansys Composite
Expand Down
7 changes: 7 additions & 0 deletions doc/source/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ The following example imports a CDB file.
See :class:`.FeFormat` for a list of supported FE formats. Check out the
:ref:`input_file_for_pyacp` section to see how input files can be created.

.. danger::
When working on Windows, be careful of backslashes in paths: These may correspond to
`escape sequences <https://docs.python.org/3/reference/lexical_analysis.html#escape-sequences>`_, resulting in errors.
To avoid issues, make sure to quote the backslashes (by using ``\\``) or use a
`raw string literal <https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals>`_ by prefixing your string with **r**,
like ``model = acp.import_model(r"path\to\your\model.acph5")``.


Start modelling
~~~~~~~~~~~~~~~
Expand Down
2 changes: 2 additions & 0 deletions doc/source/user_guide/security_considerations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ File up- and downloads

The :py:meth:`.ACPInstance.upload_file` and :py:meth:`.ACPInstance.download_file` methods create files
on the local or remote machine, without any validation of the file content or path.
The same is true for file load / save methods if the ``auto_transfer_files`` parameter is set to
``True`` in :func:`.launch_acp`.

When exposing these methods to untrusted users, it is important to validate that
only files that are safe to be uploaded or downloaded are processed.
1 change: 1 addition & 0 deletions doc/styles/config/vocabularies/ANSYS/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ API
untrusted
DPF
2025R1
PyDPF - Composites
2 changes: 1 addition & 1 deletion examples/modeling_features/001-materials.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion examples/modeling_features/002-rosettes-ply-directions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion examples/modeling_features/003-simple-selection-rules.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion examples/modeling_features/004-advanced-selection-rules.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
6 changes: 3 additions & 3 deletions examples/modeling_features/005-ply-direction-lookup-table.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down Expand Up @@ -176,7 +176,7 @@
# Compute a correction angle to define circular fiber paths.
correction_angle = np.arctan2(xx.ravel(), zz.ravel()) * 180 / np.pi
angle_column_1 = lookup_table.create_column(
data=correction_angle,
data=correction_angle, # type: ignore
physical_dimension=PhysicalDimension.DIMENSIONLESS,
value_type=LookUpTableColumnValueType.SCALAR,
)
Expand All @@ -186,7 +186,7 @@
shear_angle = -30
transverse_correction_angle = correction_angle + shear_angle
angle_column_2 = lookup_table.create_column(
data=transverse_correction_angle,
data=transverse_correction_angle, # type: ignore
physical_dimension=PhysicalDimension.DIMENSIONLESS,
value_type=LookUpTableColumnValueType.SCALAR,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion examples/modeling_features/007-sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion examples/modeling_features/010-sandwich-panel-layup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion examples/modeling_features/020-solid_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion examples/modeling_features/030-imported-plies.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion examples/modeling_features/031-imported-solid-model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion examples/modeling_features/050-composite_cae_h5.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion examples/pymechanical_with_shim/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
6 changes: 3 additions & 3 deletions examples/pymechanical_with_shim/embedded_workflow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down Expand Up @@ -40,10 +40,10 @@
* Export composite definitions and material data from PyACP
* Import lay-up and material in PyMechanical (imported plies)
* Define boundary condition in PyMechanical
* Postprocess results with PyDPF Composites (using the materials file and the RST
* Postprocess results with PyDPF - Composites (using the materials file and the RST
file generated by PyMechanical)
The workflow currently uses a Docker container for PyACP and PyDPF Composites. For PyMechanical,
The workflow currently uses a Docker container for PyACP and PyDPF - Composites. For PyMechanical,
the local installer is used. There is no known issue preventing you from using the PyMechanical
container. This was just not yet implemented due to time restrictions.
"""
Expand Down
2 changes: 1 addition & 1 deletion examples/pymechanical_with_shim/generate_mesh.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion examples/pymechanical_with_shim/postprocess_results.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion examples/pymechanical_with_shim/remote_workflow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion examples/pymechanical_with_shim/set_bc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion examples/pymechanical_with_shim/setup_acp_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
7 changes: 5 additions & 2 deletions examples/use_cases/01-optimizing-ply-angles.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down Expand Up @@ -233,7 +233,7 @@ def solve_cdb(*, mapdl, cdb_file, workdir):
rst_file = solve_cdb(mapdl=mapdl, cdb_file=cdb_file_path, workdir=workdir)

# %%
# The ``get_max_irf()`` function uses PyDPF Composites to calculate the maximum
# The ``get_max_irf()`` function uses PyDPF - Composites to calculate the maximum
# inverse reserve factor (IRF) for a given RST, composite definitions,
# or materials file.
#
Expand Down Expand Up @@ -493,3 +493,6 @@ def get_max_irf_for_parameters(

plt.tight_layout()
plt.show()

# Close MAPDL instance
mapdl.exit()
17 changes: 10 additions & 7 deletions examples/workflows/01-pymapdl-workflow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down Expand Up @@ -27,7 +27,7 @@
================
This example shows how to define a composite lay-up with PyACP, solve the resulting model with PyMAPDL, and
run a failure analysis with PyDPF Composites.
run a failure analysis with PyDPF - Composites.
"""

# %%
Expand All @@ -38,8 +38,8 @@
# boundary conditions. For more information on creating input files, see :ref:`input_file_for_pyacp`.
# Then, you import the DAT file into PyACP to define the composite lay-up. Finally, you export the
# resulting model from PyACP to PyMAPDL. Once the results are available, the RST file is loaded in
# PyDPF Composites for analysis. The additional input files (``material.xml`` and
# ``ACPCompositeDefinitions.h5``) can also be stored with PyACP and passed to PyDPF Composites.
# PyDPF - Composites for analysis. The additional input files (``material.xml`` and
# ``ACPCompositeDefinitions.h5``) can also be stored with PyACP and passed to PyDPF - Composites.

# %%
# Import modules
Expand Down Expand Up @@ -216,11 +216,11 @@
mapdl.download(rstfile_name, str(WORKING_DIR))

# %%
# Postprocessing with PyDPF Composites
# ------------------------------------
# Postprocessing with PyDPF - Composites
# --------------------------------------
#
# To postprocess the results, you must configure the imports, connect to the
# PyDPF Composites server, and load its plugin.
# PyDPF - Composites server, and load its plugin.

from ansys.dpf.composites.composite_model import CompositeModel
from ansys.dpf.composites.constants import FailureOutput
Expand Down Expand Up @@ -270,3 +270,6 @@
# %%
# Release the composite model to close the open streams to the result file.
composite_model = None # type: ignore

# Close MAPDL instance
mapdl.exit()
19 changes: 11 additions & 8 deletions examples/workflows/02-advanced-pymapdl-workflow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down Expand Up @@ -27,13 +27,13 @@
=========================
This example shows how to define a composite lay-up with PyACP, solve the resulting
model with PyMAPDL, and run a failure analysis with PyDPF Composites.
model with PyMAPDL, and run a failure analysis with PyDPF - Composites.
Begin with an MAPDL CDB file that contains the mesh, material data, and
boundary conditions. Import the file to PyACP to define the lay-up, and then export the
resulting model to PyMAPDL. Once the results are available, the RST file is loaded in
PyDPF Composites for postprocessing. The additional input files (``material.xml``
and ``ACPCompositeDefinitions.h5``) can also be stored with PyACP and passed to PyDPF Composites.
PyDPF - Composites for postprocessing. The additional input files (``material.xml``
and ``ACPCompositeDefinitions.h5``) can also be stored with PyACP and passed to PyDPF - Composites.
"""

Expand Down Expand Up @@ -292,7 +292,7 @@ def add_ply(mg, name, ply_material, angle, oss):
# %%
# Save the model as a CDB file for solving with PyMAPDL.
model.export_analysis_model(working_dir_path / cdb_filename_out)
# Export the shell lay-up and material file for PyDPF Composites.
# Export the shell lay-up and material file for PyDPF - Composites.
model.export_shell_composite_definitions(working_dir_path / composite_definition_h5_filename)
model.export_materials(working_dir_path / matml_filename)

Expand Down Expand Up @@ -329,11 +329,11 @@ def add_ply(mg, name, ply_material, angle, oss):
mapdl.download(rstfile_name, working_dir_path)

# %%
# Postprocessing with PyDPF Composites
# ------------------------------------
# Postprocessing with PyDPF - Composites
# --------------------------------------
#
# To postprocess the results, you must configure the imports, connect to the
# PyDPF Composites server, and load its plugin.
# PyDPF - Composites server, and load its plugin.

from ansys.dpf.composites.composite_model import CompositeModel
from ansys.dpf.composites.constants import FailureOutput
Expand Down Expand Up @@ -390,3 +390,6 @@ def add_ply(mg, name, ply_material, angle, oss):
# Query and plot the results.
irf_field = output_all_elements.get_field({"failure_label": FailureOutput.FAILURE_VALUE})
irf_field.plot()

# Close MAPDL instance
mapdl.exit()
Loading

0 comments on commit b4e0bd1

Please sign in to comment.