elasticipy 3.0.0__py3-none-any.whl → 4.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Elasticipy/FourthOrderTensor.py +16 -1779
- Elasticipy/StressStrainTensors.py +16 -138
- Elasticipy/ThermalExpansion.py +9 -246
- Elasticipy/gui.py +3 -3
- Elasticipy/interfaces/FEPX.py +119 -0
- Elasticipy/interfaces/PRISMS.py +103 -0
- Elasticipy/{Plasticity.py → plasticity.py} +35 -2
- Elasticipy/{PoleFigure.py → polefigure.py} +21 -0
- Elasticipy/{SphericalFunction.py → spherical_function.py} +3 -15
- Elasticipy/tensors/__init__.py +0 -0
- Elasticipy/tensors/elasticity.py +1748 -0
- Elasticipy/tensors/fourth_order.py +662 -0
- Elasticipy/tensors/mapping.py +44 -0
- Elasticipy/{SecondOrderTensor.py → tensors/second_order.py} +113 -9
- Elasticipy/tensors/stress_strain.py +154 -0
- Elasticipy/tensors/thermal_expansion.py +249 -0
- {elasticipy-3.0.0.dist-info → elasticipy-4.1.0.dist-info}/METADATA +26 -8
- elasticipy-4.1.0.dist-info/RECORD +23 -0
- {elasticipy-3.0.0.dist-info → elasticipy-4.1.0.dist-info}/WHEEL +1 -1
- elasticipy-3.0.0.dist-info/RECORD +0 -15
- /Elasticipy/{CrystalSymmetries.py → crystal_symmetries.py} +0 -0
- {elasticipy-3.0.0.dist-info → elasticipy-4.1.0.dist-info/licenses}/LICENSE +0 -0
- {elasticipy-3.0.0.dist-info → elasticipy-4.1.0.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import numpy as np
|
|
2
|
-
from Elasticipy.
|
|
2
|
+
from Elasticipy.tensors.stress_strain import StrainTensor, StressTensor
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class IsotropicHardening:
|
|
6
6
|
"""
|
|
7
7
|
Template class for isotropic hardening plasticity models
|
|
8
8
|
"""
|
|
9
|
+
type = "Isotropic"
|
|
10
|
+
name = 'Generic'
|
|
11
|
+
|
|
9
12
|
def __init__(self, criterion='von Mises'):
|
|
10
13
|
"""
|
|
11
14
|
Create an instance of a plastic model, assuming isotropic hardening
|
|
@@ -27,6 +30,12 @@ class IsotropicHardening:
|
|
|
27
30
|
self.criterion = criterion
|
|
28
31
|
self.plastic_strain = 0.0
|
|
29
32
|
|
|
33
|
+
def __repr__(self):
|
|
34
|
+
return (('{} plasticity model\n'.format(self.name) +
|
|
35
|
+
' type: {}\n'.format(self.type)) +
|
|
36
|
+
' criterion: {}\n'.format(self.criterion.name) +
|
|
37
|
+
' current strain: {}'.format(self.plastic_strain))
|
|
38
|
+
|
|
30
39
|
def flow_stress(self, strain, **kwargs):
|
|
31
40
|
pass
|
|
32
41
|
|
|
@@ -67,9 +76,14 @@ class IsotropicHardening:
|
|
|
67
76
|
|
|
68
77
|
|
|
69
78
|
class JohnsonCook(IsotropicHardening):
|
|
79
|
+
"""
|
|
80
|
+
Special case of isotropic hardening with an underlying Johnson Cook hardening evolution rule
|
|
81
|
+
"""
|
|
82
|
+
name = "Johnson-Cook"
|
|
83
|
+
|
|
70
84
|
def __init__(self, A, B, n, C=None, eps_dot_ref=1.0, m=None, T0=25, Tm=None, criterion='von Mises'):
|
|
71
85
|
"""
|
|
72
|
-
Constructor for a
|
|
86
|
+
Constructor for a Johnson-Cook (JC) model.
|
|
73
87
|
|
|
74
88
|
The JC model is an exponential-law strain hardening model, which can take into account strain-rate sensibility
|
|
75
89
|
and temperature-dependence (although they are not mandatory). See notes for details.
|
|
@@ -235,6 +249,11 @@ class JohnsonCook(IsotropicHardening):
|
|
|
235
249
|
|
|
236
250
|
|
|
237
251
|
class PlasticityCriterion:
|
|
252
|
+
"""
|
|
253
|
+
Template class for plasticity criteria
|
|
254
|
+
"""
|
|
255
|
+
name = 'generic'
|
|
256
|
+
|
|
238
257
|
@staticmethod
|
|
239
258
|
def eq_stress(stress, **kwargs):
|
|
240
259
|
"""
|
|
@@ -271,6 +290,10 @@ class PlasticityCriterion:
|
|
|
271
290
|
pass
|
|
272
291
|
|
|
273
292
|
class VonMisesPlasticity(PlasticityCriterion):
|
|
293
|
+
"""
|
|
294
|
+
von Mises plasticity criterion, with associated normality rule
|
|
295
|
+
"""
|
|
296
|
+
name = 'von Mises'
|
|
274
297
|
@staticmethod
|
|
275
298
|
def eq_stress(stress, **kwargs):
|
|
276
299
|
return stress.vonMises()
|
|
@@ -283,6 +306,11 @@ class VonMisesPlasticity(PlasticityCriterion):
|
|
|
283
306
|
return StrainTensor(3 / 2 * gradient_tensor.matrix)
|
|
284
307
|
|
|
285
308
|
class TrescaPlasticity(PlasticityCriterion):
|
|
309
|
+
"""
|
|
310
|
+
Tresca plasticity criterion, with associated normality rule
|
|
311
|
+
"""
|
|
312
|
+
name = 'Tresca'
|
|
313
|
+
|
|
286
314
|
@staticmethod
|
|
287
315
|
def eq_stress(stress, **kwargs):
|
|
288
316
|
return stress.Tresca()
|
|
@@ -305,6 +333,11 @@ class TrescaPlasticity(PlasticityCriterion):
|
|
|
305
333
|
return strain / strain.eq_strain()
|
|
306
334
|
|
|
307
335
|
class DruckerPrager(PlasticityCriterion):
|
|
336
|
+
"""
|
|
337
|
+
Drucker-Prager pressure-dependent plasticity criterion, with associated normality rule
|
|
338
|
+
"""
|
|
339
|
+
name = 'Drucker-Prager'
|
|
340
|
+
|
|
308
341
|
def __init__(self, alpha):
|
|
309
342
|
"""
|
|
310
343
|
Create a Drucker-Prager (DG) plasticity criterion.
|
|
@@ -101,6 +101,27 @@ class LambertScale(mscale.ScaleBase):
|
|
|
101
101
|
mscale.register_scale(LambertScale)
|
|
102
102
|
|
|
103
103
|
def add_polefigure(fig, *args, projection='stereographic', **kwargs):
|
|
104
|
+
"""
|
|
105
|
+
Add a pole figure to the figure object.
|
|
106
|
+
|
|
107
|
+
Parameters
|
|
108
|
+
----------
|
|
109
|
+
fig : matplotlib.figure.Figure
|
|
110
|
+
Handle to an existing figure
|
|
111
|
+
args : list
|
|
112
|
+
Positional arguments to pass to the subplot constructor
|
|
113
|
+
projection : str, optional
|
|
114
|
+
Projection to use. I can be 'stereographic' (default), 'equal area' or 'lambert' (which is equivalent to equal
|
|
115
|
+
area).
|
|
116
|
+
|
|
117
|
+
kwargs : dict
|
|
118
|
+
Keyword arguments to pass to the subplot constructor
|
|
119
|
+
|
|
120
|
+
Returns
|
|
121
|
+
-------
|
|
122
|
+
matplotlib.axes._subplots.AxesSubplot
|
|
123
|
+
Handle to the added axes
|
|
124
|
+
"""
|
|
104
125
|
if projection.lower() == 'equal area':
|
|
105
126
|
projection = 'lambert'
|
|
106
127
|
ax = fig.add_subplot(*args, projection='polar', **kwargs)
|
|
@@ -4,7 +4,7 @@ from matplotlib.colors import Normalize
|
|
|
4
4
|
from numpy import cos, sin
|
|
5
5
|
from scipy import integrate as integrate
|
|
6
6
|
from scipy import optimize
|
|
7
|
-
from Elasticipy.
|
|
7
|
+
from Elasticipy.polefigure import add_polefigure
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def sph2cart(*args):
|
|
@@ -541,8 +541,6 @@ class SphericalFunction:
|
|
|
541
541
|
u, evals = self.evaluate_on_spherical_grid((n_phi, n_theta), return_in_spherical=False, use_symmetry=False)
|
|
542
542
|
ax = _plot3D(new_fig, u, evals, **kwargs)
|
|
543
543
|
ax.axis('equal')
|
|
544
|
-
if fig is None:
|
|
545
|
-
plt.show()
|
|
546
544
|
return new_fig, ax
|
|
547
545
|
|
|
548
546
|
def plot_xyz_sections(self, n_theta=500, fig=None, axs=None, **kwargs):
|
|
@@ -590,12 +588,10 @@ class SphericalFunction:
|
|
|
590
588
|
r = self.eval_spherical(angles)
|
|
591
589
|
ax.plot(theta_polar, r, **kwargs)
|
|
592
590
|
axs_new.append(ax)
|
|
593
|
-
if fig is None:
|
|
594
|
-
new_fig.show()
|
|
595
591
|
return new_fig, axs_new
|
|
596
592
|
|
|
597
593
|
def plot_as_pole_figure(self, n_theta=50, n_phi=200, projection='lambert',
|
|
598
|
-
fig=None, plot_type='imshow',
|
|
594
|
+
fig=None, plot_type='imshow', title=None,
|
|
599
595
|
subplot_args=(), subplot_kwargs=None, **kwargs):
|
|
600
596
|
"""
|
|
601
597
|
Plots a pole figure visualization of spherical data using specified parameters and plot types.
|
|
@@ -617,7 +613,7 @@ class SphericalFunction:
|
|
|
617
613
|
plot_type : str, optional
|
|
618
614
|
The type of plot to generate: 'imshow', 'contourf', or 'contour', by default 'imshow'.
|
|
619
615
|
title : str, optional
|
|
620
|
-
Title to add to the current axis.
|
|
616
|
+
Title to add to the current axis. Default is None.
|
|
621
617
|
subplot_args : tuple
|
|
622
618
|
List of arguments to pass to the subplot function, by default ()
|
|
623
619
|
subplot_kwargs : dict
|
|
@@ -656,8 +652,6 @@ class SphericalFunction:
|
|
|
656
652
|
ax.set_rlim(*self.domain[1])
|
|
657
653
|
ax.set_title(title)
|
|
658
654
|
new_fig.colorbar(sc)
|
|
659
|
-
if show:
|
|
660
|
-
plt.show()
|
|
661
655
|
return new_fig, ax
|
|
662
656
|
|
|
663
657
|
|
|
@@ -886,8 +880,6 @@ class HyperSphericalFunction(SphericalFunction):
|
|
|
886
880
|
else:
|
|
887
881
|
r_grid = np.mean(values, axis=2)
|
|
888
882
|
ax = _plot3D(new_fig, u[:, :, 0, :], r_grid, **kwargs)
|
|
889
|
-
if fig is None:
|
|
890
|
-
plt.show()
|
|
891
883
|
return new_fig, ax
|
|
892
884
|
|
|
893
885
|
def plot_xyz_sections(self, n_theta=500, n_psi=100, color_minmax='blue', alpha_minmax=0.2, color_mean='red',
|
|
@@ -950,8 +942,6 @@ class HyperSphericalFunction(SphericalFunction):
|
|
|
950
942
|
handles.extend([line, area])
|
|
951
943
|
labels.extend([line.get_label(), area.get_label()])
|
|
952
944
|
new_fig.legend(handles, labels, loc='upper center', ncol=2, bbox_to_anchor=(0.5, 0.95))
|
|
953
|
-
if fig is None:
|
|
954
|
-
new_fig.show()
|
|
955
945
|
return new_fig, axs
|
|
956
946
|
|
|
957
947
|
def plot_as_pole_figure(self, n_theta=50, n_phi=200, n_psi=50, which='mean', projection='lambert', fig=None,
|
|
@@ -1033,6 +1023,4 @@ class HyperSphericalFunction(SphericalFunction):
|
|
|
1033
1023
|
ax.set_rlim(*self.domain[1])
|
|
1034
1024
|
ax.set_title(title)
|
|
1035
1025
|
fig.colorbar(sc)
|
|
1036
|
-
if show:
|
|
1037
|
-
plt.show()
|
|
1038
1026
|
return fig, ax
|
|
File without changes
|