Skip to content

Commit

Permalink
MAINT: Update 24R2 (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
dipinknair authored Jul 15, 2024
1 parent 1b46506 commit c34f641
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 126 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
runs-on: public-ubuntu-latest-8-cores
timeout-minutes: 30
container:
image: ghcr.io/ansys/mechanical:24.1.0
image: ghcr.io/ansys/mechanical:24.2.0
options: --entrypoint /bin/bash
needs: [style, doc-style]

Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
env:
SPHINXOPTS: '-j auto'
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
ANSYSCL241_DIR: /install/ansys_inc/v241/licensingclient
ANSYSCL242_DIR: /install/ansys_inc/v242/licensingclient
ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }}
ANSYS_WORKBENCH_LOGGING_FILTER_LEVEL: 0
run: |
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/ci_cd_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:

env:
MAIN_PYTHON_VERSION: '3.9'
DEV_MAJOR_REV: '24'
DEV_MINOR_REV: '2'
DEV_REV: '24.2_candidate'
DEV_MAJOR_REV: '25'
DEV_MINOR_REV: '1'
DEV_REV: '25.1_candidate'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -26,9 +26,9 @@ jobs:
name: Save variations of revn
runs-on: ubuntu-latest
outputs:
major: ${{ steps.save-versions.outputs.major }} # 24
minor: ${{ steps.save-versions.outputs.minor }} # 2
dev_docker_image_version: ${{ steps.save-versions.outputs.dev_docker_image_version }} # ghcr.io/ansys/mechanical:24.2_candidate
major: ${{ steps.save-versions.outputs.major }} # 25
minor: ${{ steps.save-versions.outputs.minor }} # 1
dev_docker_image_version: ${{ steps.save-versions.outputs.dev_docker_image_version }} # ghcr.io/ansys/mechanical:25.1_candidate
steps:
- id: save-versions
run: |
Expand Down Expand Up @@ -108,9 +108,9 @@ jobs:
run: |
find-mechanical
- name: Update PyMechanical version in examples for 242
- name: Update PyMechanical version in examples for 251
run: |
find ./examples -type f -name "*.py" -exec sed -i 's/version=241/version=242/g' {} +
find ./examples -type f -name "*.py" -exec sed -i 's/version=242/version=251/g' {} +
- name: Build docs
env:
Expand Down
37 changes: 8 additions & 29 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,44 +1,23 @@
PyMechanical Embedding Examples
================
===============================

This repository holds `embedding` examples for PyMechanical.
This repository holds `embedding` examples for `PyMechanical <pymechanical_>`_.
These end-to-end examples are split into two sections.

Code Style
----------
Code style can be checked by running:

.. code-block:: text
tox -e style
Previous command will run `pre-commit`_ for checking code quality.
- Basic: Shows basic capabilities of Ansys Mechanical with different types of analyses.
- Technology showcase: Demonstration of how Ansys Mechanical can be leveraged to solve real-world problems.
These examples simulate and accurately solve interdisciplinary problems from a variety of industries and engineering fields


Documentation
-------------
Documentation can be rendered by running:
Documentation can be generated and inspected using your web browser by running:

.. code-block:: text
tox -e doc
The resultant HTML files can be inspected using your favorite web browser:

.. code-block:: text
<browser> .tox/doc_out_html/index.html
Previous will open the rendered documentation in the desired browser.


.. LINKS AND REFERENCES
.. _black: https://github.com/psf/black
.. _flake8: https://flake8.pycqa.org/en/latest/
.. _isort: https://github.com/PyCQA/isort
.. _PyAnsys Developer's guide: https://dev.docs.pyansys.com/
.. _pre-commit: https://pre-commit.com/
.. _pytest: https://docs.pytest.org/en/stable/
.. _Sphinx: https://www.sphinx-doc.org/en/master/
.. _pip: https://pypi.org/project/pip/
.. _tox: https://tox.wiki/
.. _venv: https://docs.python.org/3/library/venv.html
.. _pymechanical: https://mechanical.docs.pyansys.com/
30 changes: 12 additions & 18 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
"""Sphinx documentation configuration file."""

from datetime import datetime
import os

import ansys.mechanical.core
from ansys_sphinx_theme import ansys_favicon
from ansys_sphinx_theme import pyansys_logo_black as logo
import numpy as np
from ansys_sphinx_theme import ansys_favicon, pyansys_logo_black
import pyvista
from pyvista.plotting.utilities.sphinx_gallery import DynamicScraper
from sphinx_gallery.sorting import FileNameSortKey

# Project information
Expand All @@ -17,7 +15,7 @@
release = version = "0.1.dev0"

# Select desired logo, theme, and declare the html title
html_logo = logo
html_logo = pyansys_logo_black
html_favicon = ansys_favicon
html_theme = "ansys_sphinx_theme"
html_short_title = html_title = "PyMechanical Embedding Examples"
Expand All @@ -38,6 +36,12 @@
"icon": "fa fa-comment fa-fw",
},
],
"cheatsheet": {
"url": "https://cheatsheets.docs.pyansys.com/pymechanical_cheat_sheet.pdf",
"title": "PyMechanical cheat sheet",
"thumbnail": "https://cheatsheets.docs.pyansys.com/pymechanical_cheat_sheet.png",
"needs_download": True,
},
}

# Sphinx extensions
Expand All @@ -54,6 +58,8 @@
"sphinx_copybutton",
"sphinx_gallery.gen_gallery",
"sphinxemoji.sphinxemoji",
"sphinx_design",
"pyvista.ext.viewer_directive",
]

# -- Sphinx Gallery Options ---------------------------------------------------
Expand All @@ -74,7 +80,7 @@
"backreferences_dir": None,
# Modules for which function level galleries are created. In
"doc_module": "ansys.mechanical.core",
"image_scrapers": ("pyvista", "matplotlib"),
"image_scrapers": (DynamicScraper(), "matplotlib"),
"ignore_pattern": "flycheck*",
"thumbnail_size": (350, 350),
# embed gif in gallery
Expand Down Expand Up @@ -118,18 +124,6 @@
pyvista.OFF_SCREEN = True
pyvista.BUILDING_GALLERY = True

# must be less than or equal to the XVFB window size
try:
pyvista.global_theme.window_size = np.array([1024, 768])
except AttributeError:
# for compatibility with pyvista < 0.40
pyvista.rcParams["window_size"] = np.array([1024, 768])

# Save figures in specified directory
pyvista.FIGURE_PATH = os.path.join(os.path.abspath("./images/"), "auto-generated/")
if not os.path.exists(pyvista.FIGURE_PATH):
os.makedirs(pyvista.FIGURE_PATH)

# configure pymechanical for embedding
ansys.mechanical.core.BUILDING_GALLERY = True

Expand Down
8 changes: 2 additions & 6 deletions examples/basic/bolt_pretension.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# %%
# Embed mechanical and set global variables

app = mech.App(version=241)
app = mech.App(version=242)
app.update_globals(globals())
print(app)

Expand Down Expand Up @@ -84,11 +84,7 @@ def display_image(image_name):
assert str(geometry_import.ObjectState) == "Solved", "Geometry Import unsuccessful"
# sphinx_gallery_end_ignore

ExtAPI.Graphics.Camera.SetFit()
ExtAPI.Graphics.ExportImage(
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
)
display_image("geometry.png")
app.plot()

# %%
# Download and import material
Expand Down
8 changes: 2 additions & 6 deletions examples/basic/fracture_analysis_contact_debonding.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# %%
# Embed mechanical and set global variables

app = mech.App(version=241)
app = mech.App(version=242)
app.update_globals(globals())
print(app)

Expand Down Expand Up @@ -86,11 +86,7 @@ def display_image(image_name):
geometry_path, geometry_import_format, geometry_import_preferences
)

ExtAPI.Graphics.Camera.SetFit()
ExtAPI.Graphics.ExportImage(
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
)
display_image("geometry.png")
app.plot()

# %%
# Material import, named selections, and connections
Expand Down
8 changes: 2 additions & 6 deletions examples/basic/harmonic_acoustics.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# %%
# Embed mechanical and set global variables

app = mech.App(version=241)
app = mech.App(version=242)
globals().update(mech.global_variables(app, True))
print(app)

Expand Down Expand Up @@ -101,11 +101,7 @@ def display_image(image_name):
solid11.Suppressed = True


ExtAPI.Graphics.Camera.SetFit()
ExtAPI.Graphics.ExportImage(
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
)
display_image("geometry.png")
app.plot()

# %%
# Store all Variables necessary for analysis
Expand Down
3 changes: 2 additions & 1 deletion examples/basic/modal_acoustics_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# %%
# Embed mechanical and set global variables

app = mech.App(version=241)
app = mech.App(version=242)
app.update_globals(globals())
print(app)

Expand Down Expand Up @@ -82,6 +82,7 @@ def display_image(image_name):
geometry_import.Import(
geometry_path, geometry_import_format, geometry_import_preferences
)

ExtAPI.Graphics.Camera.SetFit()
ExtAPI.Graphics.ExportImage(
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
Expand Down
8 changes: 2 additions & 6 deletions examples/basic/steady_state_thermal_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# %%
# Embed mechanical and set global variables

app = mech.App(version=241)
app = mech.App(version=242)
app.update_globals(globals())
print(app)

Expand Down Expand Up @@ -80,11 +80,7 @@ def display_image(image_name):
geometry_path, geometry_import_format, geometry_import_preferences
)

ExtAPI.Graphics.Camera.SetFit()
ExtAPI.Graphics.ExportImage(
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
)
display_image("geometry.png")
app.plot()


# %%
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/topology_optimization_cantilever_beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# %%
# Embed Mechanical and set global variables

app = mech.App(version=241)
app = mech.App(version=242)
app.update_globals(globals())
print(app)

Expand Down
8 changes: 2 additions & 6 deletions examples/basic/valve.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# %%
# Embed mechanical and set global variables

app = mech.App(version=241)
app = mech.App(version=242)
app.update_globals(globals())
print(app)

Expand Down Expand Up @@ -72,11 +72,7 @@ def display_image(image_name):
geometry_path, geometry_import_format, geometry_import_preferences
)

ExtAPI.Graphics.Camera.SetFit()
ExtAPI.Graphics.ExportImage(
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
)
display_image("geometry.png")
app.plot()

# %%
# Assign materials and mesh the geometry
Expand Down
8 changes: 2 additions & 6 deletions examples/technology_showcase/Rotor_Blade_Inverse_solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
# %%
# Embed mechanical and set global variables

app = mech.App(version=241)
app = mech.App(version=242)
app.update_globals(globals())
print(app)

Expand Down Expand Up @@ -135,11 +135,7 @@ def display_image(image_name):
geometry_path, geometry_import_format, geometry_import_preferences
)

ExtAPI.Graphics.Camera.SetFit()
ExtAPI.Graphics.ExportImage(
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
)
display_image("geometry.png")
app.plot()

# %%
# Assign materials
Expand Down
8 changes: 2 additions & 6 deletions examples/technology_showcase/conact_wear_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# %%
# Embed mechanical and set global variables

app = mech.App(version=241)
app = mech.App(version=242)
app.update_globals(globals())
print(app)

Expand Down Expand Up @@ -90,11 +90,7 @@ def display_image(image_name):
geometry_path, geometry_import_format, geometry_import_preferences
)

ExtAPI.Graphics.Camera.SetFit()
ExtAPI.Graphics.ExportImage(
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
)
display_image("geometry.png")
app.plot()

# %%
# Import materials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# %%
# Embed mechanical and set global variables

app = mech.App(version=241)
app = mech.App(version=242)
app.update_globals(globals())
print(app)

Expand Down Expand Up @@ -90,11 +90,7 @@ def display_image(image_name):
geometry_path, geometry_import_format, geometry_import_preferences
)

ExtAPI.Graphics.Camera.SetFit()
ExtAPI.Graphics.ExportImage(
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
)
display_image("geometry.png")
app.plot()

# %%
# Setup the Analysis
Expand Down
Loading

0 comments on commit c34f641

Please sign in to comment.