Skip to content

Commit 99c2c50

Browse files
committed
Added analytical model for hydrostatic flow dependence
1 parent c488572 commit 99c2c50

3 files changed

Lines changed: 26 additions & 10 deletions

File tree

src/pylabfea/basic.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@
2727
"""Tolerance: Plastic yielding if yield function > yf_tolerance"""
2828

2929

30+
def sig_hydro(sig):
31+
if isinstance(sig, list):
32+
sig = np.array(sig)
33+
dim = len(sig.shape) # determine whether sig is single stress tensor or array of tensors
34+
if dim == 1:
35+
return np.sum(sig[0:3]) / 3.
36+
else:
37+
return np.sum(sig[:, 0:3], axis=1) / 3.
38+
39+
3040
def sig_eq_j2(sig: np.ndarray):
3141
"""Calculate sj2 equivalent stress from any stress tensor
3242

src/pylabfea/data.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def __init__(self, source, path_data='./',
460460
self.lc_data = source
461461
self.parse_data(epl_crit, epl_start, epl_max, depl) # add data to mat_data
462462
elif isinstance(source, list) or isinstance(source, np.ndarray):
463-
print('WARNING: This data type will be no longer supported.')
463+
print('WARNING in initialization: Data of type list or ndarray will be no longer supported in future versions.')
464464
raw_data = np.array(source)
465465
self.convert_data(raw_data) # add data to mat_data
466466
else:
@@ -526,7 +526,7 @@ def read_data(self, data_File: str):
526526
except KeyError:
527527
print("No texture_index found in this Data_Base.json -> Assign default value of 0")
528528
if not self.mat_data['tx_data']:
529-
warnings.warn(f"WARNING: tx_data was set to false. I will just include qualitative texture info.")
529+
warnings.warn(f"WARNING in 'read_data': tx_data was set to false. I will just include qualitative texture info.")
530530
else:
531531
if 'GSH' in self.mat_data['tx_descriptor']:
532532
# JS: Use GSH coefficients
@@ -614,7 +614,7 @@ def read_data(self, data_File: str):
614614
f"Data must be provided either im MPa or in GPa.")
615615
else:
616616
sfct = 1.
617-
print('Warning: No units for stresses are given. Assuming MPa.')
617+
print('Warning in "read_data": No units for stresses are given. Assuming MPa.')
618618
Original_Stresses *= sfct
619619
seq_full = FE.sig_eq_j2(Original_Stresses)
620620
tens = [1]*6

src/pylabfea/material.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ def calc_seq(self, sig):
643643
d0 = np.zeros(3)
644644
else:
645645
hp = self.hill
646-
if self.lhs:
646+
if self.lhs is not None:
647647
d0 = self.lhs
648648
else:
649649
d0 = np.ones(3) * self.drucker
@@ -658,7 +658,7 @@ def calc_seq(self, sig):
658658
6. * hp[3] * np.square(sig[:, 3]) + \
659659
6. * hp[4] * np.square(sig[:, 4]) + \
660660
6. * hp[5] * np.square(sig[:, 5])
661-
I2 *= 0.5
661+
I2 *= 0.5 # corresponds to 3 * second invariant of stress deviator
662662
self.msg['equiv'] = '6-parameter Hill, full Voigt stress'
663663
# print('Full stress', np.sqrt(I2))
664664
else:
@@ -699,6 +699,10 @@ def calc_seqB(self, sv):
699699
np.abs(Stp1[1] - Stp2[0]) ** a + np.abs(Stp1[1] - Stp2[1]) ** a + np.abs(Stp1[1] - Stp2[2]) ** a + \
700700
np.abs(Stp1[2] - Stp2[0]) ** a + np.abs(Stp1[2] - Stp2[1]) ** a + np.abs(Stp1[2] - Stp2[2]) ** a
701701
seq = (0.25 * seq) ** (1. / a)
702+
if self.lhs is not None:
703+
d0 = self.lhs
704+
I1 = (sv[0] * d0[0] + sv[1] * d0[1] + sv[2] * d0[2]) / 3. # hydrostatic stress as 1st invariant
705+
seq += I1
702706
return seq
703707

704708
def calc_fgrad(self, sig, epl=None, seq=None,
@@ -827,7 +831,7 @@ def Jac(sig):
827831
h1 = self.hill[1]
828832
h2 = self.hill[2]
829833
if self.lhs is not None:
830-
d3 = self.lhs
834+
d3 = self.lhs / 3.
831835
else:
832836
d3 = np.ones(3) * self.drucker / 3.
833837
if seq is None:
@@ -2523,9 +2527,6 @@ def plasticity(self, sy=None, sdim=6, drucker=0., khard=0.,
25232527
self.sdim = sdim
25242528
if hill is None and rv is None:
25252529
hill = np.ones(self.sdim)
2526-
if lhs is not None:
2527-
raise ValueError('LHS parameters for anisotropic yield asymmetry provided, '
2528-
'but no anisotropy parameters for plastic yielding have been given.')
25292530
elif hill is None:
25302531
# compute Hill parameters from rv values
25312532
hill = np.ones(self.sdim)
@@ -2592,12 +2593,17 @@ def plasticity(self, sy=None, sdim=6, drucker=0., khard=0.,
25922593
self.barlat_exp = barlat_exp
25932594
else:
25942595
self.barlat = False
2596+
#if lhs is not None:
2597+
# print(f'Using LHS parameters: {lhs}')
2598+
# print(f'Using LHS with hill parameters: {hill}')
2599+
# if self.barlat:
2600+
# print(f'Using LHS with Barlat parameters: {barlat}')
25952601

25962602
def from_data(self, param):
25972603
"""Define material properties from data sets generated in module `Data`:
25982604
contains data on elastic and plastic behavior, including work hardening,
25992605
for different crystallographic textures. Possible to extend to grain sizes,
2600-
grain shapes and porosities. Will invoke definition of elastic and plastic
2606+
grain shapes and porosities. Subroutine invokes definition of elastic and plastic
26012607
parameters by calls to the methods `Material.elasticity` and `Material.plasticity`
26022608
with the parameters provided in the data set.
26032609
Also initializes current texture to first one in list and resets work hardening

0 commit comments

Comments
 (0)