@@ -39,28 +39,28 @@ def __init__(self, E, K, n, K_p=None):
39
39
40
40
@property
41
41
def E (self ):
42
- ''' Young's Modulus'''
42
+ """ Young's Modulus"""
43
43
return self ._E
44
44
45
45
@property
46
46
def K (self ):
47
- ''' the strength coefficient'''
47
+ """ the strength coefficient"""
48
48
return self ._K
49
49
50
50
@property
51
51
def n (self ):
52
- ''' the strain hardening coefficient'''
52
+ """ the strain hardening coefficient"""
53
53
return self ._n
54
54
55
55
@property
56
56
def K_p (self ):
57
- ''' the shape factor (de: Traglastformzahl)'''
57
+ """ the shape factor (de: Traglastformzahl)"""
58
58
return self ._K_p
59
59
60
60
@property
61
61
def ramberg_osgood_relation (self ):
62
- ''' the Ramberg-Osgood relation object, i.e., an object of type RambergOsgood
63
- '''
62
+ """ the Ramberg-Osgood relation object, i.e., an object of type RambergOsgood
63
+ """
64
64
return self ._ramberg_osgood_relation
65
65
66
66
@K_p .setter
@@ -81,7 +81,7 @@ def K(self, value):
81
81
82
82
83
83
class ExtendedNeuber (NotchApproximationLawBase ):
84
- r''' Implementation of the extended Neuber notch approximation material relation.
84
+ r""" Implementation of the extended Neuber notch approximation material relation.
85
85
86
86
This notch approximation law is used for the P_RAM damage parameter in the FKM
87
87
nonlinear guideline (2019). Given an elastic-plastic stress (and strain) from a linear FE
@@ -106,13 +106,10 @@ class ExtendedNeuber(NotchApproximationLawBase):
106
106
-----
107
107
The equation implemented is described in the FKM nonlinear reference, chapter 2.5.7.
108
108
109
- '''
109
+ """
110
110
111
111
def stress (self , load , * , rtol = 1e-4 , tol = 1e-4 ):
112
- '''Calculate the stress of the primary path in the stress-strain diagram at a given
113
- elastic-plastic stress (load), from a FE computation.
114
- This is done by solving for the root of f(sigma) in eq. 2.5-45 of FKM nonlinear.
115
-
112
+ r"""Calculate the stress of the primary path in the stress-strain diagram at a given
116
113
117
114
Parameters
118
115
----------
@@ -132,7 +129,7 @@ def stress(self, load, *, rtol=1e-4, tol=1e-4):
132
129
-------
133
130
stress : array-like float
134
131
The resulting elastic-plastic stress according to the notch-approximation law.
135
- '''
132
+ """
136
133
stress = optimize .newton (
137
134
func = self ._stress_implicit ,
138
135
x0 = load ,
@@ -143,7 +140,7 @@ def stress(self, load, *, rtol=1e-4, tol=1e-4):
143
140
return stress
144
141
145
142
def strain (self , stress , load ):
146
- ''' Calculate the strain of the primary path in the stress-strain diagram at a given stress and load.
143
+ """ Calculate the strain of the primary path in the stress-strain diagram at a given stress and load.
147
144
The formula is given by eq. 2.5-42 of FKM nonlinear.
148
145
load / stress * self._K_p * e_star
149
146
@@ -158,12 +155,12 @@ def strain(self, stress, load):
158
155
-------
159
156
strain : array-like float
160
157
The resulting strain
161
- '''
158
+ """
162
159
163
160
return self ._ramberg_osgood_relation .strain (stress )
164
161
165
162
def load (self , stress , * , rtol = 1e-4 , tol = 1e-4 ):
166
- ''' Apply the notch-approximation law "backwards", i.e., compute the linear-elastic stress (called "load" or "L" in FKM nonlinear)
163
+ """ Apply the notch-approximation law "backwards", i.e., compute the linear-elastic stress (called "load" or "L" in FKM nonlinear)
167
164
from the elastic-plastic stress as from the notch approximation.
168
165
This backward step is needed for the pfp FKM nonlinear surface layer & roughness.
169
166
@@ -185,7 +182,7 @@ def load(self, stress, *, rtol=1e-4, tol=1e-4):
185
182
load : array-like float
186
183
The resulting load or lienar-elastic stress.
187
184
188
- '''
185
+ """
189
186
190
187
# self._stress_implicit(stress) = 0
191
188
# f(sigma) = sigma/E + (sigma/K')^(1/n') - (L/sigma * K_p * e_star) = 0
@@ -203,7 +200,7 @@ def load(self, stress, *, rtol=1e-4, tol=1e-4):
203
200
return load
204
201
205
202
def stress_secondary_branch (self , delta_load , * , rtol = 1e-4 , tol = 1e-4 ):
206
- ''' Calculate the stress on secondary branches in the stress-strain diagram at a given
203
+ """ Calculate the stress on secondary branches in the stress-strain diagram at a given
207
204
elastic-plastic stress (load), from a FE computation.
208
205
This is done by solving for the root of f(sigma) in eq. 2.5-46 of FKM nonlinear.
209
206
@@ -222,18 +219,18 @@ def stress_secondary_branch(self, delta_load, *, rtol=1e-4, tol=1e-4):
222
219
-------
223
220
delta_stress : array-like float
224
221
The resulting stress increment within the hysteresis
225
- '''
222
+ """
226
223
delta_stress = optimize .newton (
227
224
func = self ._stress_secondary_implicit ,
228
225
x0 = delta_load ,
229
226
fprime = self ._d_stress_secondary_implicit ,
230
- args = ([delta_load ]),
227
+ args = ([np . asarray ( delta_load , dtype = np . float64 ) ]),
231
228
rtol = rtol , tol = tol , maxiter = 20
232
229
)
233
230
return delta_stress
234
231
235
232
def strain_secondary_branch (self , delta_stress , delta_load ):
236
- ''' Calculate the strain on secondary branches in the stress-strain diagram at a given stress and load.
233
+ """ Calculate the strain on secondary branches in the stress-strain diagram at a given stress and load.
237
234
The formula is given by eq. 2.5-46 of FKM nonlinear.
238
235
239
236
Parameters
@@ -247,12 +244,12 @@ def strain_secondary_branch(self, delta_stress, delta_load):
247
244
-------
248
245
strain : array-like float
249
246
The resulting strain
250
- '''
247
+ """
251
248
252
249
return self ._ramberg_osgood_relation .delta_strain (delta_stress )
253
250
254
251
def load_secondary_branch (self , delta_stress , * , rtol = 1e-4 , tol = 1e-4 ):
255
- ''' Apply the notch-approximation law "backwards", i.e., compute the linear-elastic stress (called "load" or "L" in FKM nonlinear)
252
+ """ Apply the notch-approximation law "backwards", i.e., compute the linear-elastic stress (called "load" or "L" in FKM nonlinear)
256
253
from the elastic-plastic stress as from the notch approximation.
257
254
This backward step is needed for the pfp FKM nonlinear surface layer & roughness.
258
255
@@ -274,7 +271,7 @@ def load_secondary_branch(self, delta_stress, *, rtol=1e-4, tol=1e-4):
274
271
delta_load : array-like float
275
272
The resulting load or lienar-elastic stress.
276
273
277
- '''
274
+ """
278
275
279
276
# self._stress_implicit(stress) = 0
280
277
# f(sigma) = sigma/E + (sigma/K')^(1/n') - (L/sigma * K_p * e_star) = 0
@@ -466,6 +463,7 @@ def _d_load_secondary_implicit(self, delta_load, delta_stress):
466
463
return - 1 / delta_stress * self .K_p * self ._delta_e_star (delta_load ) \
467
464
- delta_load / delta_stress * self .K_p * self ._d_delta_e_star (delta_load )
468
465
466
+
469
467
class Binned :
470
468
"""Binning for notch approximation laws, as described in FKM nonlinear 2.5.8.2, p.55.
471
469
The implicitly defined stress function of the notch approximation law is precomputed
@@ -493,12 +491,12 @@ def __init__(self, notch_approximation_law, maximum_absolute_load, number_of_bin
493
491
494
492
@property
495
493
def ramberg_osgood_relation (self ):
496
- ''' The ramberg osgood relation object
497
- '''
494
+ """ The ramberg osgood relation object
495
+ """
498
496
return self ._notch_approximation_law .ramberg_osgood_relation
499
497
500
498
def stress (self , load , * , rtol = 1e-5 , tol = 1e-6 ):
501
- ''' The stress of the primary path in the stress-strain diagram at a given load
499
+ """ The stress of the primary path in the stress-strain diagram at a given load
502
500
by using the value of the look-up table.
503
501
504
502
.. note::
@@ -520,7 +518,7 @@ def stress(self, load, *, rtol=1e-5, tol=1e-6):
520
518
-------
521
519
stress : array-like float
522
520
The resulting stress
523
- '''
521
+ """
524
522
525
523
526
524
# FIXME consolidate theese methods (duplicated code)
@@ -569,6 +567,7 @@ def stress(self, load, *, rtol=1e-5, tol=1e-6):
569
567
570
568
# if the assessment is done only for one value, i.e. load is a scalar
571
569
else :
570
+
572
571
index = self ._lut_primary_branch .load .searchsorted (np .abs (load ))- 1 # "-1", transform to zero-based indices
573
572
574
573
# raise error if requested load is higher than initialized maximum absolute load
@@ -579,7 +578,7 @@ def stress(self, load, *, rtol=1e-5, tol=1e-6):
579
578
return sign * self ._lut_primary_branch .iloc [index + 1 ].stress # "+1", because the next higher class is used
580
579
581
580
def strain (self , stress , load ):
582
- ''' Get the strain of the primary path in the stress-strain diagram at a given stress and load
581
+ """ Get the strain of the primary path in the stress-strain diagram at a given stress and load
583
582
by using the value of the look-up table.
584
583
585
584
This method performs the task for for multiple points at once,
@@ -594,7 +593,7 @@ def strain(self, stress, load):
594
593
-------
595
594
strain : array-like float
596
595
The resulting strain
597
- '''
596
+ """
598
597
sign = np .sign (load )
599
598
600
599
# if the assessment is performed for multiple points at once, i.e. load is a DataFrame with values for every node
@@ -651,7 +650,7 @@ def strain(self, stress, load):
651
650
return sign * self ._lut_primary_branch .iloc [index + 1 ].strain # "+1", because the next higher class is used
652
651
653
652
def stress_secondary_branch (self , delta_load , * , rtol = 1e-5 , tol = 1e-6 ):
654
- ''' Get the stress on secondary branches in the stress-strain diagram at a given load
653
+ """ Get the stress on secondary branches in the stress-strain diagram at a given load
655
654
by using the value of the look-up table (lut).
656
655
657
656
This method performs the task for for multiple points at once,
@@ -672,7 +671,7 @@ def stress_secondary_branch(self, delta_load, *, rtol=1e-5, tol=1e-6):
672
671
-------
673
672
delta_stress : array-like float
674
673
The resulting stress increment within the hysteresis
675
- '''
674
+ """
676
675
677
676
sign = np .sign (delta_load )
678
677
@@ -730,7 +729,7 @@ def stress_secondary_branch(self, delta_load, *, rtol=1e-5, tol=1e-6):
730
729
return sign * self ._lut_secondary_branch .iloc [index + 1 ].delta_stress # "+1", because the next higher class is used
731
730
732
731
def strain_secondary_branch (self , delta_stress , delta_load ):
733
- ''' Get the strain on secondary branches in the stress-strain diagram at a given stress and load
732
+ """ Get the strain on secondary branches in the stress-strain diagram at a given stress and load
734
733
by using the value of the look-up table (lut).
735
734
The lut is a DataFrame with MultiIndex with levels class_index and node_id.
736
735
@@ -746,7 +745,7 @@ def strain_secondary_branch(self, delta_stress, delta_load):
746
745
-------
747
746
strain : array-like float
748
747
The resulting strain
749
- '''
748
+ """
750
749
#return self._notch_approximation_law.strain_secondary_branch(delta_stress, delta_load)
751
750
752
751
sign = np .sign (delta_load )
0 commit comments