Skip to content

Commit

Permalink
Merge pull request #9 from saullocastro/lp_gradients
Browse files Browse the repository at this point in the history
LP gradients and maintenance updates
  • Loading branch information
saullocastro authored Feb 28, 2024
2 parents 101b868 + 624a1f3 commit 77a1ddc
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 42 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/auto_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/auto_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Release
uses: softprops/action-gh-release@v1
8 changes: 4 additions & 4 deletions .github/workflows/pytest_and_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ jobs:
strategy:
matrix:
runs-on: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.8, 3.9, '3.10', '3.11']
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']
runs-on: ${{ matrix.runs-on }}
env:
USE_COVERAGE: ${{ matrix.runs-on == 'ubuntu-latest' && matrix.python-version == '3.11' }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
run: |
pytest tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_UPLOAD_TOKEN }}
fail_ci_if_error: true
Expand Down
30 changes: 16 additions & 14 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ jobs:
strategy:
matrix:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.8, 3.9, '3.10', '3.11']
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
if: matrix.runs-on == 'windows-latest' || (matrix.runs-on == 'ubuntu-latest' && matrix.python-version == '3.11') || (matrix.runs-on == 'macos-latest')
if: matrix.runs-on == 'windows-latest' || (matrix.runs-on == 'ubuntu-latest') || (matrix.runs-on == 'macos-latest')
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade setuptools wheel twine
python3 -m pip install -r ci_requirements.txt
- name: Upload source code
if: matrix.runs-on == 'ubuntu-latest' && matrix.python-version == '3.11'
if: matrix.runs-on == 'ubuntu-latest' && matrix.python-version == '3.12'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
Expand All @@ -43,16 +43,18 @@ jobs:
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python3 -m twine upload dist/*.whl
- name: Build manylinux Python wheels
if: matrix.runs-on == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: RalfG/[email protected]_x86_64
with:
python-versions: 'cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311'
build-requirements: 'pip cython numpy setuptools wheel twine'
- name: Publish manylinux Python wheels
if: matrix.runs-on == 'ubuntu-latest' && matrix.python-version == '3.11'
- name: Build Linux Python wheels, install cibuildwheel
if: matrix.runs-on == 'ubuntu-latest'
run: |
python -m pip install cibuildwheel==2.16.5
- name: Build Linux Python wheels
if: matrix.runs-on == 'ubuntu-latest'
run: |
python -m cibuildwheel --output-dir dist
- name: Publish Linux Python wheels
if: matrix.runs-on == 'ubuntu-latest'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python3 -m twine upload dist/*-manylinux*.whl
python3 -m twine upload dist/*linux*.whl
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
version.py
core.cpp

# Build related
build
dist
.coverage
.pytest_cache
*.egg-info
*.so

# Temp files
.ipynb_checkpoints
tmp*
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ authors:
given-names: "Saullo G. P."
orcid: "https://orcid.org/0000-0001-9711-0991"
title: "Methods to calculate composite plate properties"
version: 0.5.25
version: 0.6.0
doi: 10.5281/zenodo.2871782
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2012-2023, Saullo G. P. Castro ([email protected]).
Copyright (c) 2012-2024, Saullo G. P. Castro ([email protected]).
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,29 @@ Methods to calculate composite plate properties
High-performance module to calculate properties of laminated composite
materials. Usually, this module is used to calculate:

- A, B, D, E plane-stress stiffness matrices for plates
-- A, B, D, for classical plate theory (CLT, or CLPT)
-- E for first-order shear deformation theory (FSDT)
- Material invariants, trace-normalized or not
- Lamination parameters based on material invariants
- Stiffness matrices (ABDE) based on lamination parameters
* A, B, D, E plane-stress stiffness matrices for plates
- A, B, D, for classical plate theory (CLT, or CLPT)
- E for first-order shear deformation theory (FSDT)

* Material invariants, trace-normalized or not

* Lamination parameters based on material invariants

* Stiffness matrices (ABDE) based on lamination parameters


Citing this repository
----------------------

Castro, S. G. P. Methods to calculate composite plate properties (Version
0.5.25) [Computer software]. 2023. https://doi.org/10.5281/zenodo.2871782
0.6.0) [Computer software]. 2024. https://doi.org/10.5281/zenodo.2871782

Bibtex :

@misc{composites2023,
@misc{composites2024,
author = {Castro, Saullo G. P.},
doi = {10.5281/zenodo.2871782},
title = {{Methods to calculate composite plate properties (Version 0.5.25) [Computer software]. 2023}}
title = {{Methods to calculate composite plate properties (Version 0.6.0) [Computer software]. 2024}}
}

Documentation
Expand Down
1 change: 1 addition & 0 deletions ci_requirements_doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ cython
numpy
sphinx
numpydoc
pydata-sphinx-theme
11 changes: 4 additions & 7 deletions composites/core.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -950,15 +950,13 @@ cdef class GradABDE:
cdef double h
cdef double [:, ::1] gradinv

gradinv = np.zeros((6, 4), dtype=DOUBLE)
h = thickness

gradinv = np.array([[mat.u2, 0, mat.u3, 0],
[0, 0, -mat.u3, 0],
[0, mat.u2/2., 0, mat.u3],
[-mat.u2, 0, mat.u3, 0],
[0, mat.u2/2., 0, -mat.u3],
[0, 0, -mat.u3, 0]])
[0, 0, -mat.u3, 0]], dtype=DOUBLE)

# d(A11 A12 A16 A22 A26 A66) / dh
self.gradAij[0, 0] = (mat.u1 + mat.u2*lp.xiA1 + 0*lp.xiA2 + mat.u3*lp.xiA3 + 0*lp.xiA4)
Expand Down Expand Up @@ -1005,8 +1003,7 @@ cdef class GradABDE:
self.gradEij[2, 0] = (mat.u6 + (-1)*mat.u7*lp.xiE1 + 0*lp.xiE2)

# d(E11 E12 E16 E22 E26 E66) / d(xiE1, xiE2)
self.gradEij[0, 1:] = h*np.array([mat.u7, 0])
self.gradEij[1, 1:] = h*np.array([0, -mat.u7])
self.gradEij[2, 1:] = h*np.array([-mat.u7, 0])

self.gradEij[0, 0] = h*mat.u7
self.gradEij[1, 1] = h*(-mat.u7)
self.gradEij[2, 0] = h*(-mat.u7)

5 changes: 3 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

project = 'composites'
author = 'Saullo G. P. Castro'
copyright = '2012-2022, ' + author
copyright = '2012-2024, ' + author

# The full version, including alpha/beta/rc tags
from composites.version import __version__
Expand Down Expand Up @@ -54,7 +54,8 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'default'
#html_theme = 'default'
html_theme = 'pydata_sphinx_theme'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
38 changes: 38 additions & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,44 @@
Documentation for the ``composites`` module
===========================================

High-performance module to calculate properties of laminated composite
materials. Usually, this module is used to calculate:

* A, B, D, E plane-stress stiffness matrices for plates
- A, B, D, for classical plate theory (CLT, or CLPT)
- E for first-order shear deformation theory (FSDT)

* Material invariants, trace-normalized or not

* Lamination parameters based on material invariants

* Stiffness matrices (ABDE) based on lamination parameters


Code repository
---------------

https://github.com/saullocastro/composites


Citing this library
-------------------

Castro, S. G. P. Methods to calculate composite plate properties (Version
0.6.0) [Computer software]. 2024. https://doi.org/10.5281/zenodo.2871782

Bibtex :

@misc{composites2024,
author = {Castro, Saullo G. P.},
doi = {10.5281/zenodo.2871782},
title = {{Methods to calculate composite plate properties (Version 0.6.0) [Computer software]. 2024}}
}


Classes and functions
---------------------

.. automodule:: composites
:members:

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,13 @@ def read(fname):
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
License :: OSI Approved :: BSD License
"""

is_released = True
version = '0.5.25'
version = '0.6.0'

fullversion = write_version_py(version, is_released)

Expand Down

0 comments on commit 77a1ddc

Please sign in to comment.