Skip to content

Commit

Permalink
Merge pull request #10 from saullocastro/kassapoglou
Browse files Browse the repository at this point in the history
First version of Kassapoglou's module
  • Loading branch information
saullocastro authored Mar 15, 2024
2 parents 8975690 + f4fd747 commit f2beda3
Show file tree
Hide file tree
Showing 10 changed files with 595 additions and 52 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pytest_and_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:
run: |
python3 -m pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 ./composites --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
flake8 ./composites --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest and coverage report
if: env.USE_COVERAGE == 'true'
run: |
Expand Down
13 changes: 8 additions & 5 deletions composites/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
r"""
===================================================================
Methods to calculate composite plate properties (:mod:`composites`)
===================================================================
==================================
composites API (:mod:`composites`)
==================================
.. currentmodule::composites
The ``composites`` module includes functions used to calculate plate properties
for laminated composites and isotropic plates.
The ``composites`` module includes functions used to calculate properties and
perform analysis on laminated composites and isotropic plates.
Classical and first-order shear deformation theories are supported. For
classical plate theories or classical laminated plate theories (CLPT), the
Expand Down Expand Up @@ -54,6 +54,9 @@
.. automodule:: composites.utils
:members:
.. automodule:: composites.kassapoglou
:members:
"""
import os

Expand Down
7 changes: 4 additions & 3 deletions composites/core.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ cdef class Laminate:
cpdef void calc_scf(Laminate)
cpdef void calc_equivalent_properties(Laminate)
cpdef void calc_constitutive_matrix(Laminate)
cpdef void force_balanced(Laminate)
cpdef void force_orthotropic(Laminate)
cpdef void force_symmetric(Laminate)
cpdef void make_balanced(Laminate)
cpdef void make_orthotropic(Laminate)
cpdef void make_symmetric(Laminate)
cpdef void make_smeared(Laminate)
cpdef LaminationParameters calc_lamination_parameters(Laminate)

cdef class GradABDE:
Expand Down
73 changes: 53 additions & 20 deletions composites/core.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -616,52 +616,85 @@ cdef class Laminate:
self.E45 += ply.q45L*(hk - hk_1)
self.E55 += ply.q55L*(hk - hk_1)

cpdef void force_balanced(Laminate self):
r"""Force a balanced laminate

cpdef void make_balanced(Laminate self):
r"""Make a balanced laminate
The attributes `A_{16}`, `A_{26}`, `B_{16}`, `B_{26}` are set to zero
to force a balanced laminate.
to make a balanced laminate.
"""
if self.offset != 0.:
raise RuntimeError('Laminates with offset cannot be forced balanced!')
raise RuntimeError('Laminates with offset cannot be made balanced!')
self.A16 = 0.
self.A26 = 0.
self.B16 = 0.
self.B26 = 0.

cpdef void force_orthotropic(Laminate self):
r"""Force an orthotropic laminate

cpdef void make_orthotropic(Laminate self):
r"""Make an orthotropic laminate
The attributes `A_{16}`, `A_{26}`, `B_{16}`, `B_{26}`, `D_{16}`,
`D_{26}` are set to zero to force an orthotropic laminate.
`D_{26}` are set to zero to make an orthotropic laminate.
"""
if self.offset != 0.:
raise RuntimeError('Laminates with offset cannot be forced orthotropic!')
raise RuntimeError('Laminates with offset cannot be made orthotropic!')
self.A16 = 0.
self.A26 = 0.
self.B16 = 0.
self.B26 = 0.
self.D16 = 0.
self.D26 = 0.

cpdef void force_symmetric(Laminate self):
"""Force a symmetric laminate

cpdef void make_symmetric(Laminate self):
"""Make a symmetric laminate
The `B_{ij}` terms of the constitutive matrix are set to zero.
"""
if self.offset != 0.:
raise RuntimeError(
'Laminates with offset cannot be forced symmetric!')
'Laminates with offset cannot be made symmetric!')
self.B11 = 0
self.B12 = 0
self.B16 = 0
self.B22 = 0
self.B26 = 0
self.B66 = 0


cpdef void make_smeared(Laminate self):
r"""Make a laminated with smeared properties
The `B_{ij}` terms of the constitutive matrix are set to zero.
The `D_{ij}` terms are calculated from the membrane terms `A_{ij}`
according to `D_{ij} = (h^2 A_{ij})/12`, where `h` is the
laminate thickness.
"""
if self.offset != 0.:
raise NotImplementedError(
'Laminates with offset cannot be made smeared!')

self.B11 = 0
self.B12 = 0
self.B16 = 0
self.B22 = 0
self.B26 = 0
self.B66 = 0

self.D11 = self.h**2/12 * self.A11
self.D12 = self.h**2/12 * self.A12
self.D16 = self.h**2/12 * self.A16
self.D22 = self.h**2/12 * self.A22
self.D26 = self.h**2/12 * self.A26
self.D66 = self.h**2/12 * self.A66


cpdef LaminationParameters calc_lamination_parameters(Laminate self):
r"""Calculate the lamination parameters.
Expand Down Expand Up @@ -715,22 +748,22 @@ cdef class Laminate:
return lp


cpdef LaminationParameters force_balanced_LP(LaminationParameters lp):
r"""Force balanced lamination parameters
cpdef LaminationParameters make_balanced_LP(LaminationParameters lp):
r"""Make balanced lamination parameters
The lamination parameters `\xi_{A2}` and `\xi_{A4}` are set to null to
force a balanced laminate.
make a balanced laminate.
"""
lp.xiA2 = 0
lp.xiA4 = 0
return lp


cpdef LaminationParameters force_symmetric_LP(LaminationParameters lp):
r"""Force symmetric lamination parameters
cpdef LaminationParameters make_symmetric_LP(LaminationParameters lp):
r"""Make symmetric lamination parameters
The lamination parameters `\xi_{Bi}` are set to null to force a symmetric
The lamination parameters `\xi_{Bi}` are set to null to make a symmetric
laminate.
"""
Expand All @@ -741,11 +774,11 @@ cpdef LaminationParameters force_symmetric_LP(LaminationParameters lp):
return lp


cpdef LaminationParameters force_orthotropic_LP(LaminationParameters lp):
r"""Force orthotropic lamination parameters
cpdef LaminationParameters make_orthotropic_LP(LaminationParameters lp):
r"""Make orthotropic lamination parameters
The lamination parameters `\xi_{A2}`, `\xi_{A4}`, `\xi_{B2}`, `\xi_{B4}`,
`\xi_{D2}` and `\xi_{D4}` are set to null to force an orthotropic laminate.
`\xi_{D2}` and `\xi_{D4}` are set to null to make an orthotropic laminate.
The `\xi_{D2}` and `\xi_{D4}` are related to the bend-twist coupling and
become often very small for balanced laminates with a large amount of
plies.
Expand Down
Loading

0 comments on commit f2beda3

Please sign in to comment.