Skip to content

Commit c34f641

Browse files
authored
MAINT: Update 24R2 (#207)
1 parent 1b46506 commit c34f641

15 files changed

+52
-126
lines changed

.github/workflows/ci_cd.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
runs-on: public-ubuntu-latest-8-cores
4848
timeout-minutes: 30
4949
container:
50-
image: ghcr.io/ansys/mechanical:24.1.0
50+
image: ghcr.io/ansys/mechanical:24.2.0
5151
options: --entrypoint /bin/bash
5252
needs: [style, doc-style]
5353

@@ -84,7 +84,7 @@ jobs:
8484
env:
8585
SPHINXOPTS: '-j auto'
8686
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
87-
ANSYSCL241_DIR: /install/ansys_inc/v241/licensingclient
87+
ANSYSCL242_DIR: /install/ansys_inc/v242/licensingclient
8888
ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }}
8989
ANSYS_WORKBENCH_LOGGING_FILTER_LEVEL: 0
9090
run: |

.github/workflows/ci_cd_nightly.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ on:
77

88
env:
99
MAIN_PYTHON_VERSION: '3.9'
10-
DEV_MAJOR_REV: '24'
11-
DEV_MINOR_REV: '2'
12-
DEV_REV: '24.2_candidate'
10+
DEV_MAJOR_REV: '25'
11+
DEV_MINOR_REV: '1'
12+
DEV_REV: '25.1_candidate'
1313

1414
concurrency:
1515
group: ${{ github.workflow }}-${{ github.ref }}
@@ -26,9 +26,9 @@ jobs:
2626
name: Save variations of revn
2727
runs-on: ubuntu-latest
2828
outputs:
29-
major: ${{ steps.save-versions.outputs.major }} # 24
30-
minor: ${{ steps.save-versions.outputs.minor }} # 2
31-
dev_docker_image_version: ${{ steps.save-versions.outputs.dev_docker_image_version }} # ghcr.io/ansys/mechanical:24.2_candidate
29+
major: ${{ steps.save-versions.outputs.major }} # 25
30+
minor: ${{ steps.save-versions.outputs.minor }} # 1
31+
dev_docker_image_version: ${{ steps.save-versions.outputs.dev_docker_image_version }} # ghcr.io/ansys/mechanical:25.1_candidate
3232
steps:
3333
- id: save-versions
3434
run: |
@@ -108,9 +108,9 @@ jobs:
108108
run: |
109109
find-mechanical
110110
111-
- name: Update PyMechanical version in examples for 242
111+
- name: Update PyMechanical version in examples for 251
112112
run: |
113-
find ./examples -type f -name "*.py" -exec sed -i 's/version=241/version=242/g' {} +
113+
find ./examples -type f -name "*.py" -exec sed -i 's/version=242/version=251/g' {} +
114114
115115
- name: Build docs
116116
env:

README.rst

+8-29
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,23 @@
11
PyMechanical Embedding Examples
2-
================
2+
===============================
33

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

6-
Code Style
7-
----------
8-
Code style can be checked by running:
9-
10-
.. code-block:: text
11-
12-
tox -e style
13-
14-
Previous command will run `pre-commit`_ for checking code quality.
7+
- Basic: Shows basic capabilities of Ansys Mechanical with different types of analyses.
8+
- Technology showcase: Demonstration of how Ansys Mechanical can be leveraged to solve real-world problems.
9+
These examples simulate and accurately solve interdisciplinary problems from a variety of industries and engineering fields
1510

1611

1712
Documentation
1813
-------------
19-
Documentation can be rendered by running:
14+
Documentation can be generated and inspected using your web browser by running:
2015

2116
.. code-block:: text
2217
2318
tox -e doc
24-
25-
The resultant HTML files can be inspected using your favorite web browser:
26-
27-
.. code-block:: text
28-
2919
<browser> .tox/doc_out_html/index.html
3020
31-
Previous will open the rendered documentation in the desired browser.
32-
33-
3421
.. LINKS AND REFERENCES
35-
.. _black: https://github.com/psf/black
36-
.. _flake8: https://flake8.pycqa.org/en/latest/
37-
.. _isort: https://github.com/PyCQA/isort
38-
.. _PyAnsys Developer's guide: https://dev.docs.pyansys.com/
3922
.. _pre-commit: https://pre-commit.com/
40-
.. _pytest: https://docs.pytest.org/en/stable/
41-
.. _Sphinx: https://www.sphinx-doc.org/en/master/
42-
.. _pip: https://pypi.org/project/pip/
43-
.. _tox: https://tox.wiki/
44-
.. _venv: https://docs.python.org/3/library/venv.html
23+
.. _pymechanical: https://mechanical.docs.pyansys.com/

doc/source/conf.py

+12-18
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
"""Sphinx documentation configuration file."""
22

33
from datetime import datetime
4-
import os
54

65
import ansys.mechanical.core
7-
from ansys_sphinx_theme import ansys_favicon
8-
from ansys_sphinx_theme import pyansys_logo_black as logo
9-
import numpy as np
6+
from ansys_sphinx_theme import ansys_favicon, pyansys_logo_black
107
import pyvista
8+
from pyvista.plotting.utilities.sphinx_gallery import DynamicScraper
119
from sphinx_gallery.sorting import FileNameSortKey
1210

1311
# Project information
@@ -17,7 +15,7 @@
1715
release = version = "0.1.dev0"
1816

1917
# Select desired logo, theme, and declare the html title
20-
html_logo = logo
18+
html_logo = pyansys_logo_black
2119
html_favicon = ansys_favicon
2220
html_theme = "ansys_sphinx_theme"
2321
html_short_title = html_title = "PyMechanical Embedding Examples"
@@ -38,6 +36,12 @@
3836
"icon": "fa fa-comment fa-fw",
3937
},
4038
],
39+
"cheatsheet": {
40+
"url": "https://cheatsheets.docs.pyansys.com/pymechanical_cheat_sheet.pdf",
41+
"title": "PyMechanical cheat sheet",
42+
"thumbnail": "https://cheatsheets.docs.pyansys.com/pymechanical_cheat_sheet.png",
43+
"needs_download": True,
44+
},
4145
}
4246

4347
# Sphinx extensions
@@ -54,6 +58,8 @@
5458
"sphinx_copybutton",
5559
"sphinx_gallery.gen_gallery",
5660
"sphinxemoji.sphinxemoji",
61+
"sphinx_design",
62+
"pyvista.ext.viewer_directive",
5763
]
5864

5965
# -- Sphinx Gallery Options ---------------------------------------------------
@@ -74,7 +80,7 @@
7480
"backreferences_dir": None,
7581
# Modules for which function level galleries are created. In
7682
"doc_module": "ansys.mechanical.core",
77-
"image_scrapers": ("pyvista", "matplotlib"),
83+
"image_scrapers": (DynamicScraper(), "matplotlib"),
7884
"ignore_pattern": "flycheck*",
7985
"thumbnail_size": (350, 350),
8086
# embed gif in gallery
@@ -118,18 +124,6 @@
118124
pyvista.OFF_SCREEN = True
119125
pyvista.BUILDING_GALLERY = True
120126

121-
# must be less than or equal to the XVFB window size
122-
try:
123-
pyvista.global_theme.window_size = np.array([1024, 768])
124-
except AttributeError:
125-
# for compatibility with pyvista < 0.40
126-
pyvista.rcParams["window_size"] = np.array([1024, 768])
127-
128-
# Save figures in specified directory
129-
pyvista.FIGURE_PATH = os.path.join(os.path.abspath("./images/"), "auto-generated/")
130-
if not os.path.exists(pyvista.FIGURE_PATH):
131-
os.makedirs(pyvista.FIGURE_PATH)
132-
133127
# configure pymechanical for embedding
134128
ansys.mechanical.core.BUILDING_GALLERY = True
135129

examples/basic/bolt_pretension.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# %%
2727
# Embed mechanical and set global variables
2828

29-
app = mech.App(version=241)
29+
app = mech.App(version=242)
3030
app.update_globals(globals())
3131
print(app)
3232

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

87-
ExtAPI.Graphics.Camera.SetFit()
88-
ExtAPI.Graphics.ExportImage(
89-
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
90-
)
91-
display_image("geometry.png")
87+
app.plot()
9288

9389
# %%
9490
# Download and import material

examples/basic/fracture_analysis_contact_debonding.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# %%
2626
# Embed mechanical and set global variables
2727

28-
app = mech.App(version=241)
28+
app = mech.App(version=242)
2929
app.update_globals(globals())
3030
print(app)
3131

@@ -86,11 +86,7 @@ def display_image(image_name):
8686
geometry_path, geometry_import_format, geometry_import_preferences
8787
)
8888

89-
ExtAPI.Graphics.Camera.SetFit()
90-
ExtAPI.Graphics.ExportImage(
91-
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
92-
)
93-
display_image("geometry.png")
89+
app.plot()
9490

9591
# %%
9692
# Material import, named selections, and connections

examples/basic/harmonic_acoustics.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# %%
2626
# Embed mechanical and set global variables
2727

28-
app = mech.App(version=241)
28+
app = mech.App(version=242)
2929
globals().update(mech.global_variables(app, True))
3030
print(app)
3131

@@ -101,11 +101,7 @@ def display_image(image_name):
101101
solid11.Suppressed = True
102102

103103

104-
ExtAPI.Graphics.Camera.SetFit()
105-
ExtAPI.Graphics.ExportImage(
106-
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
107-
)
108-
display_image("geometry.png")
104+
app.plot()
109105

110106
# %%
111107
# Store all Variables necessary for analysis

examples/basic/modal_acoustics_analysis.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# %%
3232
# Embed mechanical and set global variables
3333

34-
app = mech.App(version=241)
34+
app = mech.App(version=242)
3535
app.update_globals(globals())
3636
print(app)
3737

@@ -82,6 +82,7 @@ def display_image(image_name):
8282
geometry_import.Import(
8383
geometry_path, geometry_import_format, geometry_import_preferences
8484
)
85+
8586
ExtAPI.Graphics.Camera.SetFit()
8687
ExtAPI.Graphics.ExportImage(
8788
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p

examples/basic/steady_state_thermal_analysis.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# %%
2929
# Embed mechanical and set global variables
3030

31-
app = mech.App(version=241)
31+
app = mech.App(version=242)
3232
app.update_globals(globals())
3333
print(app)
3434

@@ -80,11 +80,7 @@ def display_image(image_name):
8080
geometry_path, geometry_import_format, geometry_import_preferences
8181
)
8282

83-
ExtAPI.Graphics.Camera.SetFit()
84-
ExtAPI.Graphics.ExportImage(
85-
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
86-
)
87-
display_image("geometry.png")
83+
app.plot()
8884

8985

9086
# %%

examples/basic/topology_optimization_cantilever_beam.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# %%
2323
# Embed Mechanical and set global variables
2424

25-
app = mech.App(version=241)
25+
app = mech.App(version=242)
2626
app.update_globals(globals())
2727
print(app)
2828

examples/basic/valve.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# %%
2323
# Embed mechanical and set global variables
2424

25-
app = mech.App(version=241)
25+
app = mech.App(version=242)
2626
app.update_globals(globals())
2727
print(app)
2828

@@ -72,11 +72,7 @@ def display_image(image_name):
7272
geometry_path, geometry_import_format, geometry_import_preferences
7373
)
7474

75-
ExtAPI.Graphics.Camera.SetFit()
76-
ExtAPI.Graphics.ExportImage(
77-
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
78-
)
79-
display_image("geometry.png")
75+
app.plot()
8076

8177
# %%
8278
# Assign materials and mesh the geometry

examples/technology_showcase/Rotor_Blade_Inverse_solve.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
# %%
5858
# Embed mechanical and set global variables
5959

60-
app = mech.App(version=241)
60+
app = mech.App(version=242)
6161
app.update_globals(globals())
6262
print(app)
6363

@@ -135,11 +135,7 @@ def display_image(image_name):
135135
geometry_path, geometry_import_format, geometry_import_preferences
136136
)
137137

138-
ExtAPI.Graphics.Camera.SetFit()
139-
ExtAPI.Graphics.ExportImage(
140-
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
141-
)
142-
display_image("geometry.png")
138+
app.plot()
143139

144140
# %%
145141
# Assign materials

examples/technology_showcase/conact_wear_simulation.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
# %%
3838
# Embed mechanical and set global variables
3939

40-
app = mech.App(version=241)
40+
app = mech.App(version=242)
4141
app.update_globals(globals())
4242
print(app)
4343

@@ -90,11 +90,7 @@ def display_image(image_name):
9090
geometry_path, geometry_import_format, geometry_import_preferences
9191
)
9292

93-
ExtAPI.Graphics.Camera.SetFit()
94-
ExtAPI.Graphics.ExportImage(
95-
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
96-
)
97-
display_image("geometry.png")
93+
app.plot()
9894

9995
# %%
10096
# Import materials

examples/technology_showcase/non_linear_analsis_rubber_boot_seal.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# %%
3131
# Embed mechanical and set global variables
3232

33-
app = mech.App(version=241)
33+
app = mech.App(version=242)
3434
app.update_globals(globals())
3535
print(app)
3636

@@ -90,11 +90,7 @@ def display_image(image_name):
9090
geometry_path, geometry_import_format, geometry_import_preferences
9191
)
9292

93-
ExtAPI.Graphics.Camera.SetFit()
94-
ExtAPI.Graphics.ExportImage(
95-
os.path.join(cwd, "geometry.png"), image_export_format, settings_720p
96-
)
97-
display_image("geometry.png")
93+
app.plot()
9894

9995
# %%
10096
# Setup the Analysis

0 commit comments

Comments
 (0)