Skip to content

Commit 6529ab4

Browse files
committed
Update CI, CD scripts and README
1 parent b44d6e6 commit 6529ab4

File tree

5 files changed

+121
-35
lines changed

5 files changed

+121
-35
lines changed

.github/workflows/cd.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Github Actions script to produce binary wheels.
2+
#
3+
# * One build to create all wheels (cross-platform universal wheel).
4+
# * One build (with matrix) test the wheels on a selection of platforms.
5+
# * One build to publish the wheels on GitHub and Pypi.
6+
7+
name: CD
8+
9+
on:
10+
workflow_dispatch:
11+
push:
12+
tags:
13+
- 'v*'
14+
pull_request:
15+
branches:
16+
- main
17+
18+
jobs:
19+
20+
build-wheels:
21+
name: Build all wheels
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.12'
29+
- name: Install dev dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install -U -e .[build]
33+
mkdir dist
34+
- name: Build wheels (and sdist)
35+
run: |
36+
cd dist
37+
python -m build ../
38+
cd ../
39+
- name: Twine check
40+
run: |
41+
twine check dist/*
42+
- name: Upload distributions
43+
uses: actions/upload-artifact@v4
44+
with:
45+
path: dist
46+
name: all_wheels
47+
48+
publish:
49+
name: Publish to Github and Pypi
50+
runs-on: ubuntu-latest
51+
needs: [build-wheels]
52+
if: success() && startsWith(github.ref, 'refs/tags/v')
53+
steps:
54+
- uses: actions/checkout@v4
55+
- name: Set up Python
56+
uses: actions/setup-python@v5
57+
with:
58+
python-version: '3.12'
59+
- name: Download assets
60+
uses: actions/download-artifact@v4
61+
with:
62+
path: dist
63+
- name: Flatten dist dir
64+
run: |
65+
find dist -mindepth 2 -type f -exec mv -f '{}' dist/ ';'
66+
rm -rf dist/*/
67+
- name: Set version from git ref
68+
run: echo "PYCCX_PY_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
69+
- name: Upload Release Assets
70+
uses: softprops/action-gh-release@v2
71+
with:
72+
tag_name: ${{ env.PYCCX_PY_VERSION }}
73+
name: ${{ env.PYCCX_PY_VERSION }}
74+
token: ${{ secrets.GITHUB_TOKEN }}
75+
files: |
76+
dist/*.tar.gz
77+
dist/*.whl
78+
body: |
79+
Autogenerated wheels for PyCCX
80+
draft: false
81+
prerelease: false
82+
- name: Publish to PyPI
83+
uses: pypa/gh-action-pypi-publish@release/v1
84+
with:
85+
user: __token__
86+
password: ${{ secrets.PYPI_PASSWORD }}

.github/workflows/ci.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- name: Set up Python
4444
uses: actions/setup-python@v5
4545
with:
46-
python-version: 3.12
46+
python-version: 3.11
4747
- name: Install calculix dependencies
4848
run: |
4949
sudo apt-get update -y -qq
@@ -88,7 +88,7 @@ jobs:
8888
if: matrix.os == 'ubuntu-latest'
8989
run: |
9090
sudo apt-get update -y -qq
91-
sudo apt-get install -qq -y calculix-ccx
91+
sudo apt-get install -qq -y calculix-ccx libglu1-mesa gmsh
9292
- name: Install package and dev dependencies
9393
run: |
9494
python -m pip install --upgrade pip
@@ -197,9 +197,6 @@ jobs:
197197
# don't run tests, we just want to know if the sdist can be installed
198198
pip uninstall -y pyccx
199199
git reset --hard HEAD
200-
- name: Twine check
201-
run: |
202-
twine check dist/*
203200
- name: Upload distributions
204201
uses: actions/upload-artifact@v4
205202
with:

README.rst

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,30 @@ PyCCX - Python Library for Calculix
1717

1818
PyCCX - a library for creating and running 3D FEA simulations using the opensource Calculix FEA Package.
1919

20-
The aims of this project was to provide a simple framework for implemented 3D FEA Analysis using the opensource
20+
The aim of this project was to provide a framework for implemented 3D FEA Analysis using the opensource
2121
`Calculix <http://www.calculix.de>`_ solver. The analysis is complimented by use of the recent introduction of the
2222
`GMSH-SDK <http://https://gitlab.onelab.info/gmsh/gmsh/api>`_ , an extension to `GMSH <http://gmsh.info/>`_ to provide
2323
API bindings for different programming languages by the project authors to provide sophisticated 3D FEA mesh
2424
generation outside of the GUI implementation.
2525

2626
This project aims to provide an integrated approach for generating full
27-
2D and 3D structural and thermal FEA analysis for use in research, development and prototyping in a Python environment.
28-
The aim is to support automated scripted approaches for performing FEA simulations, in particular for use in
29-
optimisation of engineering designs and assessing the sensitivity of design and material inputs on the structural
30-
response of a system. This intends to remove requirement to setup each analysis manually using a GUI such as prepromax
31-
or GMSH.
27+
2D and 3D structural and thermal FEA analysis for use in research, development and prototyping all inside a
28+
Python environment. The functionality targets the delivery of automated scripted approaches for performing FEA simulations,
29+
in particular for use assessing the sensitivity of design and material inputs on the response of a system structure, that
30+
can be used as part of parametric optimisation studies.
3231

33-
Along with setting up and processing the analysis, convenience functions are included to consistently interface between both
34-
the Calculix and GMSH functionality within a single python environment.
32+
This intends to remove requirement to setup each analysis manually using a GUI such as prepromax or GMSH.
33+
34+
Along with setting up and processing the analysis, numerous convenience functions are included to consistently interface
35+
between both the Calculix and GMSH functionality within a single python environment.
3536

3637
Structure
3738
##############
3839

3940
PyCCX framework consists of classes for specifying common components on the pre-processing phase, including the following
4041
common simulation features:
4142

42-
* Generation of both 2D and 3D compatible analysis meeshes for use with Calculix using GMSH
43+
* Generation of both 2D and 3D compatible analysis meshes for use with Calculix via GMSH
4344
* Creation and assignment of thermal and mechanical boundary conditions for use in analyses
4445
* Creation of multiple time (in)-dependent load cases
4546
* Creation and assignment of multiple material models and element types through a single analysis
@@ -49,9 +50,9 @@ common simulation features:
4950
A meshing class provides an interface with GMSH for performing the meshing routines and for associating
5051
boundary conditions with the elements/faces generated from geometrical CAD entities.
5152

52-
The provided simulation class assembles, the mesh and corresponding mesh identifier sets (Element, Nodal and Surfaces)
53+
The simulation class assembles the mesh and corresponding mesh identifier sets (Element, Nodal and Surfaces)
5354
in conjunction with the applied boundary conditions for each specified load-case within an analysis. The analysis
54-
is then exported into the Calculix input deck, and then performs the execution to the Calculix solver. The simulation
55+
is then exported as a Calculix input deck, and then performs the execution to the Calculix solver. The simulation
5556
can be additionally monitored within the Python environment.
5657

5758
The results obtained upon completion of the analysis can be processes, to extract individual nodal and elemental quantities
@@ -68,10 +69,11 @@ Meshing:
6869
---------
6970
Meshing is performed using the GMSH-SDK, which provides a Python interface to the GMSH meshing library. The features
7071
within pyccx provided higher-level functionality building across existing GMSH functionality. The library mainly
71-
facilitates setting up the analysis consistently within a single environment.
72+
facilitates setting up the analysis consistently within a single environment, such as mapping geometrical FE elements
73+
into compatible Calculix types with consistent nodal ordering. Additional features available for meshing include:
7274

7375
* Integration with GMSH for generation 3D FEA Meshes
74-
* Cleanign and merging of CAD assemblies using internal functionality provided by GMSH
76+
* Cleaning and merging of CAD assemblies using internal functionality provided by GMSH
7577
* Creation and assignment of NodeSet, ElementSet, SurfaceSet from mesh features applied for boundary conditions
7678
* Attachment of boundary conditions to geometrical CAD entities via GMSH (native .step import supported via OCC)
7779

@@ -94,8 +96,8 @@ Results Processing:
9496

9597
Installation
9698
*************
97-
Installation is currently supported on Windows, all this further support will be added for Linux environments. PyCCX
98-
can be installed along with dependencies for GMSH automatically using
99+
PyCCX is multi-platform as a source based package. This can be installed along with dependencies for GMSH automatically
100+
using the following commands:
99101

100102
.. code:: bash
101103
@@ -110,20 +112,20 @@ alternatively, the package can be installed using the uv library:
110112
uv pip install pyccx
111113
112114
Calculix Solver
113-
*************
115+
*****************
114116

115117
Depending on your environment, you will need to install the latest version of Calculix. This can be done through
116-
the conda-forge `calculix package <https://anaconda.org/conda-forge/calculix>`_ in the Anaconda distribution,
118+
conda-forge `calculix package <https://anaconda.org/conda-forge/calculix>`_ in the Anaconda distribution,
117119

118120
.. code:: bash
119121
120122
conda install -c conda-forge calculix
121123
122-
However, the most reliable mode is downloading the package directly.
124+
However, it is suggested that the most reliable mode is downloading the latest distribution of Calculix directly.
123125

124126
**Windows:**
125127

126-
The solver be seperately obtained from within the distribution of `prepromax <https://prepomax.fs.um.si>`_
128+
The solver be separately obtained from within the distribution of `prepromax <https://prepomax.fs.um.si>`_
127129

128130
**Linux:**
129131

@@ -138,10 +140,15 @@ compiler environment to be installed. Once this is done, Calculix can be install
138140
brew tap costerwi/homebrew-calculix
139141
brew install calculix-ccx
140142
141-
The Calculix solver executable needs to be available in the system path, or the path to the executable needs to be manually
142-
specified.
143+
The path of the installed Calculix solver executable should be obtained, which is dependent on the configuration of the
144+
brew installation.
145+
146+
Usage
147+
*************
143148

144-
Across all platforms the direct path of the calculix solver executable needs to be initialised before any further use.
149+
The Calculix solver executable needs to be available in the system path, or the path to the executable needs to be manually
150+
specified. Across all platforms the direct path of the calculix solver executable needs to be initialised before any
151+
further use.
145152

146153
.. code:: python
147154
@@ -151,11 +158,8 @@ Across all platforms the direct path of the calculix solver executable needs to
151158
Simulation.setCalculixPath('Path')
152159
153160
154-
Usage
155-
*************
156-
157-
The following code excerpt shows an example for creating and running a steady state thermal analysis of model using PyCCX
158-
of an existing mesh generated using the pyccx.mesh.mesher class.
161+
The following code excerpt shows part of an example for creating and running a steady state thermal analysis of model
162+
using PyCCX of an existing mesh generated using the `pyccx.mesh.mesher` class.
159163

160164
.. code:: python
161165

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ docs = [
4949
'furo',
5050
'sphinx-autodoc-typehints',
5151
'autodocsumm',
52-
'm2r2',
53-
'docutils==0.20',
52+
'm2r2==0.3.4',
53+
'docutils==0.21.2',
5454
'pypandoc',
5555
'autodocsumm',
5656
'mock',

tests/core/test_core.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import pytest
55
import pyccx
6-
import trimesh
76
import numpy as np
87

98
class TestBasic:

0 commit comments

Comments
 (0)