worked on phenopowerlaw test, made material.config writer case insensitive, polished lattice, removed deprecated part of documentation

This commit is contained in:
Martin Diehl 2014-06-16 13:11:26 +00:00
parent e8be3b871b
commit 488927a231
3 changed files with 107 additions and 109 deletions

View File

@ -996,9 +996,15 @@ subroutine lattice_initializeStructure(myPhase,CoverA)
myNslip, myNtwin myNslip, myNtwin
lattice_C66(1:6,1:6,myPhase) = lattice_symmetrizeC66(lattice_structure(myPhase),lattice_C66(1:6,1:6,myPhase)) lattice_C66(1:6,1:6,myPhase) = lattice_symmetrizeC66(lattice_structure(myPhase),lattice_C66(1:6,1:6,myPhase))
lattice_mu(myPhase) = 0.2_pReal * (lattice_C66(1,1,myPhase) - lattice_C66(1,2,myPhase) + 3.0_pReal*lattice_C66(4,4,myPhase)) ! (C11iso-C12iso)/2 with C11iso=(3*C11+2*C12+4*C44)/5 and C12iso=(C11+4*C12-2*C44)/5 lattice_mu(myPhase) = 0.2_pReal *( lattice_C66(1,1,myPhase) &
lattice_nu(myPhase) = (lattice_C66(1,1,myPhase) + 4.0_pReal*lattice_C66(1,2,myPhase) - 2.0_pReal*lattice_C66(4,4,myPhase)) & - lattice_C66(1,2,myPhase) &
/ (4.0_pReal*lattice_C66(1,1,myPhase) + 6.0_pReal*lattice_C66(1,2,myPhase) + 2.0_pReal*lattice_C66(4,4,myPhase)) ! C12iso/(C11iso+C12iso) with C11iso=(3*C11+2*C12+4*C44)/5 and C12iso=(C11+4*C12-2*C44)/5 + 3.0_pReal*lattice_C66(4,4,myPhase)) ! (C11iso-C12iso)/2 with C11iso=(3*C11+2*C12+4*C44)/5 and C12iso=(C11+4*C12-2*C44)/5
lattice_nu(myPhase) = ( lattice_C66(1,1,myPhase) &
+ 4.0_pReal*lattice_C66(1,2,myPhase) &
- 2.0_pReal*lattice_C66(4,4,myPhase)) &
/( 4.0_pReal*lattice_C66(1,1,myPhase) &
+ 6.0_pReal*lattice_C66(1,2,myPhase) &
+ 2.0_pReal*lattice_C66(4,4,myPhase))! C12iso/(C11iso+C12iso) with C11iso=(3*C11+2*C12+4*C44)/5 and C12iso=(C11+4*C12-2*C44)/5
lattice_C3333(1:3,1:3,1:3,1:3,myPhase) = math_Voigt66to3333(lattice_C66(1:6,1:6,myPhase)) ! Literature data is Voigt lattice_C3333(1:3,1:3,1:3,1:3,myPhase) = math_Voigt66to3333(lattice_C66(1:6,1:6,myPhase)) ! Literature data is Voigt
lattice_C66(1:6,1:6,myPhase) = math_Mandel3333to66(lattice_C3333(1:3,1:3,1:3,1:3,myPhase)) ! DAMASK uses Mandel lattice_C66(1:6,1:6,myPhase) = math_Mandel3333to66(lattice_C3333(1:3,1:3,1:3,1:3,myPhase)) ! DAMASK uses Mandel
@ -1009,11 +1015,11 @@ subroutine lattice_initializeStructure(myPhase,CoverA)
case (LATTICE_fcc_ID) case (LATTICE_fcc_ID)
myNslip = lattice_fcc_Nslip myNslip = lattice_fcc_Nslip
myNtwin = lattice_fcc_Ntwin myNtwin = lattice_fcc_Ntwin
do i = 1_pInt,lattice_fcc_Nslip ! assign slip system vectors do i = 1_pInt,myNslip ! assign slip system vectors
sd(1:3,i) = lattice_fcc_systemSlip(1:3,i) sd(1:3,i) = lattice_fcc_systemSlip(1:3,i)
sn(1:3,i) = lattice_fcc_systemSlip(4:6,i) sn(1:3,i) = lattice_fcc_systemSlip(4:6,i)
enddo enddo
do i = 1_pInt,lattice_fcc_Ntwin ! assign twin system vectors and shears do i = 1_pInt,myNtwin ! assign twin system vectors and shears
td(1:3,i) = lattice_fcc_systemTwin(1:3,i) td(1:3,i) = lattice_fcc_systemTwin(1:3,i)
tn(1:3,i) = lattice_fcc_systemTwin(4:6,i) tn(1:3,i) = lattice_fcc_systemTwin(4:6,i)
ts(i) = lattice_fcc_shearTwin(i) ts(i) = lattice_fcc_shearTwin(i)
@ -1021,21 +1027,17 @@ subroutine lattice_initializeStructure(myPhase,CoverA)
lattice_NslipSystem(1:lattice_maxNslipFamily,myPhase) = lattice_fcc_NslipSystem lattice_NslipSystem(1:lattice_maxNslipFamily,myPhase) = lattice_fcc_NslipSystem
lattice_NtwinSystem(1:lattice_maxNtwinFamily,myPhase) = lattice_fcc_NtwinSystem lattice_NtwinSystem(1:lattice_maxNtwinFamily,myPhase) = lattice_fcc_NtwinSystem
lattice_NnonSchmid(myPhase) = lattice_fcc_NnonSchmid lattice_NnonSchmid(myPhase) = lattice_fcc_NnonSchmid
lattice_interactionSlipSlip(1:myNslip,1:myNslip,myPhase) = & lattice_interactionSlipSlip(1:myNslip,1:myNslip,myPhase) = lattice_fcc_interactionSlipSlip
lattice_fcc_interactionSlipSlip lattice_interactionSlipTwin(1:myNslip,1:myNtwin,myPhase) = lattice_fcc_interactionSlipTwin
lattice_interactionSlipTwin(1:myNslip,1:myNtwin,myPhase) = & lattice_interactionTwinSlip(1:myNtwin,1:myNslip,myPhase) = lattice_fcc_interactionTwinSlip
lattice_fcc_interactionSlipTwin lattice_interactionTwinTwin(1:myNtwin,1:myNtwin,myPhase) = lattice_fcc_interactionTwinTwin
lattice_interactionTwinSlip(1:myNtwin,1:myNslip,myPhase) = &
lattice_fcc_interactionTwinSlip
lattice_interactionTwinTwin(1:myNtwin,1:myNtwin,myPhase) = &
lattice_fcc_interactionTwinTwin
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! bcc ! bcc
case (LATTICE_bcc_ID) case (LATTICE_bcc_ID)
myNslip = lattice_bcc_Nslip myNslip = lattice_bcc_Nslip
myNtwin = lattice_bcc_Ntwin myNtwin = lattice_bcc_Ntwin
do i = 1_pInt,lattice_bcc_Nslip ! assign slip system vectors do i = 1_pInt,myNslip ! assign slip system vectors
sd(1:3,i) = lattice_bcc_systemSlip(1:3,i) sd(1:3,i) = lattice_bcc_systemSlip(1:3,i)
sn(1:3,i) = lattice_bcc_systemSlip(4:6,i) sn(1:3,i) = lattice_bcc_systemSlip(4:6,i)
sdU = sd(1:3,i) / math_norm3(sd(1:3,i)) sdU = sd(1:3,i) / math_norm3(sd(1:3,i))
@ -1057,7 +1059,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA)
sns(1:3,1:3,1,6,i) = math_tensorproduct(sdU, sdU) sns(1:3,1:3,1,6,i) = math_tensorproduct(sdU, sdU)
sns(1:3,1:3,2,6,i) = math_tensorproduct(-sdU, -sdU) sns(1:3,1:3,2,6,i) = math_tensorproduct(-sdU, -sdU)
enddo enddo
do i = 1_pInt,lattice_bcc_Ntwin ! assign twin system vectors and shears do i = 1_pInt,myNtwin ! assign twin system vectors and shears
td(1:3,i) = lattice_bcc_systemTwin(1:3,i) td(1:3,i) = lattice_bcc_systemTwin(1:3,i)
tn(1:3,i) = lattice_bcc_systemTwin(4:6,i) tn(1:3,i) = lattice_bcc_systemTwin(4:6,i)
ts(i) = lattice_bcc_shearTwin(i) ts(i) = lattice_bcc_shearTwin(i)
@ -1065,31 +1067,29 @@ subroutine lattice_initializeStructure(myPhase,CoverA)
lattice_NslipSystem(1:lattice_maxNslipFamily,myPhase) = lattice_bcc_NslipSystem lattice_NslipSystem(1:lattice_maxNslipFamily,myPhase) = lattice_bcc_NslipSystem
lattice_NtwinSystem(1:lattice_maxNtwinFamily,myPhase) = lattice_bcc_NtwinSystem lattice_NtwinSystem(1:lattice_maxNtwinFamily,myPhase) = lattice_bcc_NtwinSystem
lattice_NnonSchmid(myPhase) = lattice_bcc_NnonSchmid lattice_NnonSchmid(myPhase) = lattice_bcc_NnonSchmid
lattice_interactionSlipSlip(1:lattice_bcc_Nslip,1:lattice_bcc_Nslip,myPhase) = & lattice_interactionSlipSlip(1:myNslip,1:myNslip,myPhase) = lattice_bcc_interactionSlipSlip
lattice_bcc_interactionSlipSlip lattice_interactionSlipTwin(1:myNslip,1:myNtwin,myPhase) = lattice_bcc_interactionSlipTwin
lattice_interactionSlipTwin(1:lattice_bcc_Nslip,1:lattice_bcc_Ntwin,myPhase) = & lattice_interactionTwinSlip(1:myNtwin,1:myNslip,myPhase) = lattice_bcc_interactionTwinSlip
lattice_bcc_interactionSlipTwin lattice_interactionTwinTwin(1:myNtwin,1:myNtwin,myPhase) = lattice_bcc_interactionTwinTwin
lattice_interactionTwinSlip(1:lattice_bcc_Ntwin,1:lattice_bcc_Nslip,myPhase) = &
lattice_bcc_interactionTwinSlip
lattice_interactionTwinTwin(1:lattice_bcc_Ntwin,1:lattice_bcc_Ntwin,myPhase) = &
lattice_bcc_interactionTwinTwin
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! hex (including conversion from miller-bravais (a1=a2=a3=c) to miller (a, b, c) indices) ! hex (including conversion from miller-bravais (a1=a2=a3=c) to miller (a, b, c) indices)
case (LATTICE_hex_ID) case (LATTICE_hex_ID)
myNslip = lattice_hex_Nslip myNslip = lattice_hex_Nslip
myNtwin = lattice_hex_Ntwin myNtwin = lattice_hex_Ntwin
do i = 1_pInt,lattice_hex_Nslip ! assign slip system vectors do i = 1_pInt,myNslip ! assign slip system vectors
sd(1,i) = lattice_hex_systemSlip(1,i)*1.5_pReal ! direction [uvtw]->[3u/2 (u+2v)*sqrt(3)/2 w*(c/a)] sd(1,i) = lattice_hex_systemSlip(1,i)*1.5_pReal ! direction [uvtw]->[3u/2 (u+2v)*sqrt(3)/2 w*(c/a)]
sd(2,i) = (lattice_hex_systemSlip(1,i)+2.0_pReal*lattice_hex_systemSlip(2,i))*(0.5_pReal*sqrt(3.0_pReal)) sd(2,i) = (lattice_hex_systemSlip(1,i)+2.0_pReal*lattice_hex_systemSlip(2,i))*&
(0.5_pReal*sqrt(3.0_pReal))
sd(3,i) = lattice_hex_systemSlip(4,i)*CoverA sd(3,i) = lattice_hex_systemSlip(4,i)*CoverA
sn(1,i) = lattice_hex_systemSlip(5,i) ! plane (hkil)->(h (h+2k)/sqrt(3) l/(c/a)) sn(1,i) = lattice_hex_systemSlip(5,i) ! plane (hkil)->(h (h+2k)/sqrt(3) l/(c/a))
sn(2,i) = (lattice_hex_systemSlip(5,i)+2.0_pReal*lattice_hex_systemSlip(6,i))/sqrt(3.0_pReal) sn(2,i) = (lattice_hex_systemSlip(5,i)+2.0_pReal*lattice_hex_systemSlip(6,i))/sqrt(3.0_pReal)
sn(3,i) = lattice_hex_systemSlip(8,i)/CoverA sn(3,i) = lattice_hex_systemSlip(8,i)/CoverA
enddo enddo
do i = 1_pInt,lattice_hex_Ntwin ! assign twin system vectors and shears do i = 1_pInt,myNtwin ! assign twin system vectors and shears
td(1,i) = lattice_hex_systemTwin(1,i)*1.5_pReal td(1,i) = lattice_hex_systemTwin(1,i)*1.5_pReal
td(2,i) = (lattice_hex_systemTwin(1,i)+2.0_pReal*lattice_hex_systemTwin(2,i))*(0.5_pReal*sqrt(3.0_pReal)) td(2,i) = (lattice_hex_systemTwin(1,i)+2.0_pReal*lattice_hex_systemTwin(2,i))*&
(0.5_pReal*sqrt(3.0_pReal))
td(3,i) = lattice_hex_systemTwin(4,i)*CoverA td(3,i) = lattice_hex_systemTwin(4,i)*CoverA
tn(1,i) = lattice_hex_systemTwin(5,i) tn(1,i) = lattice_hex_systemTwin(5,i)
tn(2,i) = (lattice_hex_systemTwin(5,i)+2.0_pReal*lattice_hex_systemTwin(6,i))/sqrt(3.0_pReal) tn(2,i) = (lattice_hex_systemTwin(5,i)+2.0_pReal*lattice_hex_systemTwin(6,i))/sqrt(3.0_pReal)
@ -1108,14 +1108,10 @@ subroutine lattice_initializeStructure(myPhase,CoverA)
lattice_NslipSystem(1:lattice_maxNslipFamily,myPhase) = lattice_hex_NslipSystem lattice_NslipSystem(1:lattice_maxNslipFamily,myPhase) = lattice_hex_NslipSystem
lattice_NtwinSystem(1:lattice_maxNtwinFamily,myPhase) = lattice_hex_NtwinSystem lattice_NtwinSystem(1:lattice_maxNtwinFamily,myPhase) = lattice_hex_NtwinSystem
lattice_NnonSchmid(myPhase) = lattice_hex_NnonSchmid lattice_NnonSchmid(myPhase) = lattice_hex_NnonSchmid
lattice_interactionSlipSlip(1:lattice_hex_Nslip,1:lattice_hex_Nslip,myPhase) = & lattice_interactionSlipSlip(1:myNslip,1:myNslip,myPhase) = lattice_hex_interactionSlipSlip
lattice_hex_interactionSlipSlip lattice_interactionSlipTwin(1:myNslip,1:myNtwin,myPhase) = lattice_hex_interactionSlipTwin
lattice_interactionSlipTwin(1:lattice_hex_Nslip,1:lattice_hex_Ntwin,myPhase) = & lattice_interactionTwinSlip(1:myNtwin,1:myNslip,myPhase) = lattice_hex_interactionTwinSlip
lattice_hex_interactionSlipTwin lattice_interactionTwinTwin(1:myNtwin,1:myNtwin,myPhase) = lattice_hex_interactionTwinTwin
lattice_interactionTwinSlip(1:lattice_hex_Ntwin,1:lattice_hex_Nslip,myPhase) = &
lattice_hex_interactionTwinSlip
lattice_interactionTwinTwin(1:lattice_hex_Ntwin,1:lattice_hex_Ntwin,myPhase) = &
lattice_hex_interactionTwinTwin
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! orthorombic and isotropic (no crystal plasticity) ! orthorombic and isotropic (no crystal plasticity)

View File

@ -3,9 +3,7 @@
#-------------------# #-------------------#
[SX] [SX]
type isostrain type none
Ngrains 1
#-------------------# #-------------------#
<crystallite> <crystallite>

View File

@ -64,10 +64,12 @@ class Texture(Section):
if 'scatter' not in map(str.lower,properties.keys()): if 'scatter' not in map(str.lower,properties.keys()):
scatter = 0.0 scatter = 0.0
else: scatter = properties['scatter'] else:
scatter = properties['scatter']
if 'fraction' not in map(str.lower,properties.keys()): if 'fraction' not in map(str.lower,properties.keys()):
fraction = 1.0 fraction = 1.0
else: fraction = properties['fraction'] else:
fraction = properties['fraction']
multiKey = theType.lower() multiKey = theType.lower()
@ -144,6 +146,7 @@ class Material():
for line in content: for line in content:
line = line.split('#')[0].strip() # kill comments and extra whitespace line = line.split('#')[0].strip() # kill comments and extra whitespace
line = line.split('#')[0].strip() # kill comments and extra whitespace line = line.split('#')[0].strip() # kill comments and extra whitespace
line = line.lower() # be case insensitive
if line: # content survives... if line: # content survives...
match_part = re_part.match(line) match_part = re_part.match(line)
if match_part: # found <part> separator if match_part: # found <part> separator
@ -189,28 +192,30 @@ class Material():
f.close() f.close()
return saveFile return saveFile
def add_section(self, part=None, section=None, object=None, merge = False): def add_section(self, part=None, section=None, initialData=None, merge = False):
'''adding/updating''' '''adding/updating'''
part = part.lower()
section = section.lower()
if part not in self.parts: raise Exception('invalid part %s'%part) if part not in self.parts: raise Exception('invalid part %s'%part)
if type(object) is dict: data = object if type(initialData) is not dict:
else: data = object.data() initialData = initialData.data()
if section not in self.data[part]: self.data[part]['__order__'] += [section] if section not in self.data[part]: self.data[part]['__order__'] += [section]
if section in self.data[part] and merge: if section in self.data[part] and merge:
for existing in self.data[part][section]['__order__']: # replace existing for existing in self.data[part][section]['__order__']: # replace existing
if existing in data['__order__']: if existing in initialData['__order__']:
if existing.startswith('(') and existing.endswith(')'): # multiple (key) if existing.startswith('(') and existing.endswith(')'): # multiple (key)
self.data[part][section][existing] += data[existing] # add new multiple entries to existing ones self.data[part][section][existing] += initialData[existing] # add new multiple entries to existing ones
else: # regular key else: # regular key
self.data[part][section][existing] = data[existing] # plain replice self.data[part][section][existing] = initialData[existing] # plain replice
for new in data['__order__']: # merge new content for new in initialData['__order__']: # merge new content
if new not in self.data[part][section]['__order__']: if new not in self.data[part][section]['__order__']:
self.data[part][section][new] = data[new] self.data[part][section][new] = initialData[new]
self.data[part][section]['__order__'] += [new] self.data[part][section]['__order__'] += [new]
else: else:
self.data[part][section] = data self.data[part][section] = initialData
@ -244,11 +249,10 @@ class Material():
value = '%s'%value value = '%s'%value
value = [value] value = [value]
newlen = len(value) newlen = len(value)
oldval = self.data[part][section][key] oldval = self.data[part.lower()][section.lower()][key.lower()]
oldlen = len(oldval) oldlen = len(oldval)
print('changing %s:%s:%s:%s'%(part,section,key,oldval)) print('changing %s:%s:%s from %s to %s '%(part.lower(),section.lower(),key.lower(),oldval,value))
self.data[part][section][key] = value self.data[part.lower()][section.lower()][key.lower()] = value
print('new: %s'%self.data[part][section][key])
if newlen is not oldlen: if newlen is not oldlen:
print('Length of value was changed from %i to %i!'%(oldlen,newlen)) print('Length of value was changed from %i to %i!'%(oldlen,newlen))