Merge branch 'development' of magit1.mpie.de:damask/DAMASK into development

This commit is contained in:
Philip Eisenlohr 2016-05-17 09:52:18 -04:00
commit 9103ee544b
160 changed files with 433 additions and 681 deletions

View File

@ -1,4 +1,3 @@
!--------------------------------------------------------------------------------------------------
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH !> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
!> @brief material subroutine for phenomenological crystal plasticity formulation using a powerlaw !> @brief material subroutine for phenomenological crystal plasticity formulation using a powerlaw
@ -60,6 +59,7 @@ module plastic_phenopowerlaw
plastic_phenopowerlaw_tau0_slip, & !< initial critical shear stress for slip (input parameter, per family) plastic_phenopowerlaw_tau0_slip, & !< initial critical shear stress for slip (input parameter, per family)
plastic_phenopowerlaw_tau0_twin, & !< initial critical shear stress for twin (input parameter, per family) plastic_phenopowerlaw_tau0_twin, & !< initial critical shear stress for twin (input parameter, per family)
plastic_phenopowerlaw_tausat_slip, & !< maximum critical shear stress for slip (input parameter, per family) plastic_phenopowerlaw_tausat_slip, & !< maximum critical shear stress for slip (input parameter, per family)
plastic_phenopowerlaw_H_int, & !< per family hardening activity(input parameter(optional), per family)
plastic_phenopowerlaw_nonSchmidCoeff, & plastic_phenopowerlaw_nonSchmidCoeff, &
plastic_phenopowerlaw_interaction_SlipSlip, & !< interaction factors slip - slip (input parameter) plastic_phenopowerlaw_interaction_SlipSlip, & !< interaction factors slip - slip (input parameter)
@ -197,29 +197,30 @@ subroutine plastic_phenopowerlaw_init(fileUnit)
source=0_pInt) source=0_pInt)
allocate(plastic_phenopowerlaw_output(maxval(phase_Noutput),maxNinstance)) allocate(plastic_phenopowerlaw_output(maxval(phase_Noutput),maxNinstance))
plastic_phenopowerlaw_output = '' plastic_phenopowerlaw_output = ''
allocate(plastic_phenopowerlaw_outputID(maxval(phase_Noutput),maxNinstance), source=undefined_ID) allocate(plastic_phenopowerlaw_outputID(maxval(phase_Noutput),maxNinstance),source=undefined_ID)
allocate(plastic_phenopowerlaw_Noutput(maxNinstance), source=0_pInt) allocate(plastic_phenopowerlaw_Noutput(maxNinstance), source=0_pInt)
allocate(plastic_phenopowerlaw_Nslip(lattice_maxNslipFamily,maxNinstance), source=0_pInt) allocate(plastic_phenopowerlaw_Nslip(lattice_maxNslipFamily,maxNinstance), source=0_pInt)
allocate(plastic_phenopowerlaw_Ntwin(lattice_maxNtwinFamily,maxNinstance), source=0_pInt) allocate(plastic_phenopowerlaw_Ntwin(lattice_maxNtwinFamily,maxNinstance), source=0_pInt)
allocate(plastic_phenopowerlaw_Ntrans(lattice_maxNtransFamily,maxNinstance), source=0_pInt) allocate(plastic_phenopowerlaw_Ntrans(lattice_maxNtransFamily,maxNinstance),source=0_pInt)
allocate(plastic_phenopowerlaw_totalNslip(maxNinstance), source=0_pInt) allocate(plastic_phenopowerlaw_totalNslip(maxNinstance), source=0_pInt)
allocate(plastic_phenopowerlaw_totalNtwin(maxNinstance), source=0_pInt) allocate(plastic_phenopowerlaw_totalNtwin(maxNinstance), source=0_pInt)
allocate(plastic_phenopowerlaw_totalNtrans(maxNinstance), source=0_pInt) allocate(plastic_phenopowerlaw_totalNtrans(maxNinstance), source=0_pInt)
allocate(plastic_phenopowerlaw_gdot0_slip(maxNinstance), source=0.0_pReal) allocate(plastic_phenopowerlaw_gdot0_slip(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_n_slip(maxNinstance), source=0.0_pReal) allocate(plastic_phenopowerlaw_n_slip(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_tau0_slip(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_phenopowerlaw_tau0_slip(lattice_maxNslipFamily,maxNinstance),source=0.0_pReal)
allocate(plastic_phenopowerlaw_tausat_slip(lattice_maxNslipFamily,maxNinstance),source=0.0_pReal) allocate(plastic_phenopowerlaw_tausat_slip(lattice_maxNslipFamily,maxNinstance),source=0.0_pReal)
allocate(plastic_phenopowerlaw_gdot0_twin(maxNinstance), source=0.0_pReal) allocate(plastic_phenopowerlaw_H_int(lattice_maxNslipFamily,maxNinstance),source=0.0_pReal)
allocate(plastic_phenopowerlaw_n_twin(maxNinstance), source=0.0_pReal) allocate(plastic_phenopowerlaw_gdot0_twin(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_tau0_twin(lattice_maxNtwinFamily,maxNinstance), source=0.0_pReal) allocate(plastic_phenopowerlaw_n_twin(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_spr(maxNinstance), source=0.0_pReal) allocate(plastic_phenopowerlaw_tau0_twin(lattice_maxNtwinFamily,maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_twinB(maxNinstance), source=0.0_pReal) allocate(plastic_phenopowerlaw_spr(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_twinC(maxNinstance), source=0.0_pReal) allocate(plastic_phenopowerlaw_twinB(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_twinD(maxNinstance), source=0.0_pReal) allocate(plastic_phenopowerlaw_twinC(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_twinE(maxNinstance), source=0.0_pReal) allocate(plastic_phenopowerlaw_twinD(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_h0_SlipSlip(maxNinstance), source=0.0_pReal) allocate(plastic_phenopowerlaw_twinE(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_h0_TwinSlip(maxNinstance), source=0.0_pReal) allocate(plastic_phenopowerlaw_h0_SlipSlip(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_h0_TwinTwin(maxNinstance), source=0.0_pReal) allocate(plastic_phenopowerlaw_h0_TwinSlip(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_h0_TwinTwin(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_interaction_SlipSlip(lattice_maxNinteraction,maxNinstance), & allocate(plastic_phenopowerlaw_interaction_SlipSlip(lattice_maxNinteraction,maxNinstance), &
source=0.0_pReal) source=0.0_pReal)
allocate(plastic_phenopowerlaw_interaction_SlipTwin(lattice_maxNinteraction,maxNinstance), & allocate(plastic_phenopowerlaw_interaction_SlipTwin(lattice_maxNinteraction,maxNinstance), &
@ -340,7 +341,7 @@ subroutine plastic_phenopowerlaw_init(fileUnit)
do j = 1_pInt, Nchunks_SlipFamilies do j = 1_pInt, Nchunks_SlipFamilies
plastic_phenopowerlaw_Nslip(j,instance) = IO_intValue(line,chunkPos,1_pInt+j) plastic_phenopowerlaw_Nslip(j,instance) = IO_intValue(line,chunkPos,1_pInt+j)
enddo enddo
case ('tausat_slip','tau0_slip') case ('tausat_slip','tau0_slip','H_int')
tempPerSlip = 0.0_pReal tempPerSlip = 0.0_pReal
do j = 1_pInt, Nchunks_SlipFamilies do j = 1_pInt, Nchunks_SlipFamilies
if (plastic_phenopowerlaw_Nslip(j,instance) > 0_pInt) & if (plastic_phenopowerlaw_Nslip(j,instance) > 0_pInt) &
@ -351,6 +352,8 @@ subroutine plastic_phenopowerlaw_init(fileUnit)
plastic_phenopowerlaw_tausat_slip(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) plastic_phenopowerlaw_tausat_slip(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies)
case ('tau0_slip') case ('tau0_slip')
plastic_phenopowerlaw_tau0_slip(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) plastic_phenopowerlaw_tau0_slip(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies)
case ('H_int')
plastic_phenopowerlaw_H_int(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies)
end select end select
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! parameters depending on number of twin families ! parameters depending on number of twin families
@ -967,7 +970,6 @@ subroutine plastic_phenopowerlaw_dotState(Tstar_v,ipc,ip,el)
offset_accshear_twin = nSlip + nTwin + 2_pInt + nSlip offset_accshear_twin = nSlip + nTwin + 2_pInt + nSlip
plasticState(ph)%dotState(:,of) = 0.0_pReal plasticState(ph)%dotState(:,of) = 0.0_pReal
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! system-independent (nonlinear) prefactors to M_Xx (X influenced by x) matrices ! system-independent (nonlinear) prefactors to M_Xx (X influenced by x) matrices
c_SlipSlip = plastic_phenopowerlaw_h0_SlipSlip(instance)*& c_SlipSlip = plastic_phenopowerlaw_h0_SlipSlip(instance)*&
@ -986,7 +988,7 @@ subroutine plastic_phenopowerlaw_dotState(Tstar_v,ipc,ip,el)
index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family
slipSystems1: do i = 1_pInt,plastic_phenopowerlaw_Nslip(f,instance) slipSystems1: do i = 1_pInt,plastic_phenopowerlaw_Nslip(f,instance)
j = j+1_pInt j = j+1_pInt
left_SlipSlip(j) = 1.0_pReal ! no system-dependent left part left_SlipSlip(j) = 1.0_pReal + plastic_phenopowerlaw_H_int(f,instance) ! modified no system-dependent left part
left_SlipTwin(j) = 1.0_pReal ! no system-dependent left part left_SlipTwin(j) = 1.0_pReal ! no system-dependent left part
right_SlipSlip(j) = abs(1.0_pReal-plasticState(ph)%state(j,of) / & right_SlipSlip(j) = abs(1.0_pReal-plasticState(ph)%state(j,of) / &
(plastic_phenopowerlaw_tausat_slip(f,instance)+ssat_offset)) & (plastic_phenopowerlaw_tausat_slip(f,instance)+ssat_offset)) &
@ -1013,6 +1015,7 @@ subroutine plastic_phenopowerlaw_dotState(Tstar_v,ipc,ip,el)
enddo slipFamilies1 enddo slipFamilies1
j = 0_pInt j = 0_pInt
twinFamilies1: do f = 1_pInt,lattice_maxNtwinFamily twinFamilies1: do f = 1_pInt,lattice_maxNtwinFamily
index_myFamily = sum(lattice_NtwinSystem(1:f-1_pInt,ph)) ! at which index starts my family index_myFamily = sum(lattice_NtwinSystem(1:f-1_pInt,ph)) ! at which index starts my family

View File

@ -1,4 +1,3 @@
### $Id$ ###
[all] [all]
(output) phase (output) phase
(output) texture (output) texture

View File

@ -1,2 +1 @@
### $Id$ ###
[none] [none]

View File

@ -1,4 +1,3 @@
### $Id$ ###
[aLittleSomething] [aLittleSomething]
(output) f (output) f
(output) p (output) p

View File

@ -1,4 +1,3 @@
### $Id$ ###
damage nonlocal damage nonlocal
initialDamage 1.0 initialDamage 1.0
(output) damage (output) damage

View File

@ -1,4 +1,3 @@
### $Id$ ###
hydrogenflux cahnhilliard hydrogenflux cahnhilliard
initialHydrogenConc 0.0 initialHydrogenConc 0.0
(output) hydrogenconc (output) hydrogenconc

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Parallel3] [Parallel3]
type isostrain type isostrain
Ngrains 3 Ngrains 3

View File

@ -1,4 +1,3 @@
### $Id$ ###
[SX] [SX]
type isostrain type isostrain
Ngrains 1 Ngrains 1

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Taylor2] [Taylor2]
type isostrain type isostrain
Ngrains 2 Ngrains 2

View File

@ -1,4 +1,3 @@
### $Id$ ###
[directSX] [directSX]
type none type none

View File

@ -1,3 +1,2 @@
### $Id$ ###
porosity phasefield porosity phasefield
(output) porosity (output) porosity

View File

@ -1,4 +1,3 @@
### $Id$ ###
[8Grains] [8Grains]
type RGC type RGC
Ngrains 8 Ngrains 8

View File

@ -1,4 +1,3 @@
### $Id$ ###
thermal conduction thermal conduction
initialT 300.0 initialT 300.0
(output) temperature (output) temperature

View File

@ -1,4 +1,3 @@
### $Id$ ###
vacancyflux cahnhilliard vacancyflux cahnhilliard
initialVacancyConc 1e-6 initialVacancyConc 1e-6
(output) vacancyconc (output) vacancyconc

View File

@ -1,4 +1,3 @@
### $Id$ ###
[SX] [SX]
type isostrain type isostrain
Ngrains 1 Ngrains 1

View File

@ -1,3 +1,2 @@
### $Id$ ###
(kinematics) vacancy_strain (kinematics) vacancy_strain
vacancy_strain_coeff 0.006 vacancy_strain_coeff 0.006

View File

@ -1,3 +1,2 @@
### $Id$ ###
(kinematics) thermal_expansion (kinematics) thermal_expansion
thermal_expansion11 0.00231 thermal_expansion11 0.00231

View File

@ -1,3 +1,2 @@
### $Id$ ###
(kinematics) hydrogen_strain (kinematics) hydrogen_strain
hydrogen_strain_coeff 0.06 hydrogen_strain_coeff 0.06

View File

@ -1,4 +1,3 @@
### $Id$ ###
[DP_Steel] [DP_Steel]
/elementhomogeneous/ /elementhomogeneous/
crystallite 1 crystallite 1

View File

@ -1,4 +1,3 @@
### $Id$ ###
[ElementHomogeneous] [ElementHomogeneous]
/elementhomogeneous/ # put this flag to set ips identical in one element (something like reduced integration) /elementhomogeneous/ # put this flag to set ips identical in one element (something like reduced integration)
crystallite 1 crystallite 1

View File

@ -1,3 +1,2 @@
### $Id$ ###
damage_diffusion11 1.0 damage_diffusion11 1.0
damage_mobility 0.001 damage_mobility 0.001

View File

@ -1,4 +1,3 @@
### $Id$ ###
[TWIP_Steel_FeMnC] [TWIP_Steel_FeMnC]
elasticity hooke elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Tungsten] [Tungsten]
elasticity hooke elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
hydrogenflux_diffusion11 1.0 hydrogenflux_diffusion11 1.0
hydrogenflux_mobility11 1.0 hydrogenflux_mobility11 1.0
hydrogenVolume 1e-28 hydrogenVolume 1e-28

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Aluminum_Isotropic] [Aluminum_Isotropic]
# Kuo, J. C., Mikrostrukturmechanik von Bikristallen mit Kippkorngrenzen. Shaker-Verlag 2004. http://edoc.mpg.de/204079 # Kuo, J. C., Mikrostrukturmechanik von Bikristallen mit Kippkorngrenzen. Shaker-Verlag 2004. http://edoc.mpg.de/204079

View File

@ -1,4 +1,3 @@
### $Id$ ###
[IsotropicVolumePreservation] [IsotropicVolumePreservation]
elasticity hooke elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Orthorombic] [Orthorombic]
elasticity hooke elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Aluminum] [Aluminum]
elasticity hooke elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Aluminum] [Aluminum]
elasticity hooke elasticity hooke
plasticity phenopowerlaw plasticity phenopowerlaw

View File

@ -1,4 +1,3 @@
### $Id$ ###
# Tasan et.al. 2015 Acta Materalia # Tasan et.al. 2015 Acta Materalia
# Tasan et.al. 2015 International Journal of Plasticity # Tasan et.al. 2015 International Journal of Plasticity
# Diehl et.al. 2015 Meccanica # Diehl et.al. 2015 Meccanica

View File

@ -1,4 +1,3 @@
### $Id$ ###
# Tasan et.al. 2015 Acta Materalia # Tasan et.al. 2015 Acta Materalia
# Tasan et.al. 2015 International Journal of Plasticity # Tasan et.al. 2015 International Journal of Plasticity
# Diehl et.al. 2015 Meccanica # Diehl et.al. 2015 Meccanica

View File

@ -1,4 +1,3 @@
### $Id$ ###
# parameters fitted by D. Ma to: # parameters fitted by D. Ma to:

View File

@ -1,4 +1,3 @@
### $Id$ ###
[cpTi-alpha] [cpTi-alpha]
plasticity phenopowerlaw plasticity phenopowerlaw
elasticity hooke elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Aluminum] [Aluminum]
elasticity hooke elasticity hooke
plasticity phenopowerlaw plasticity phenopowerlaw

View File

@ -1,3 +1,2 @@
### $Id$ ###
porosity_diffusion11 1.0 porosity_diffusion11 1.0
porosity_mobility 0.001 porosity_mobility 0.001

View File

@ -1,4 +1,3 @@
### $Id$ ###
thermal_conductivity11 237.0 thermal_conductivity11 237.0
specific_heat 910.0 specific_heat 910.0
mass_density 2700.0 mass_density 2700.0

View File

@ -1,4 +1,3 @@
### $Id$ ###
vacancyflux_diffusion11 1.0 vacancyflux_diffusion11 1.0
vacancyflux_mobility11 1.0 vacancyflux_mobility11 1.0
vacancyFormationEnergy 1e-19 vacancyFormationEnergy 1e-19

View File

@ -1,4 +1,3 @@
### $Id$ ###
(source) damage_isoBrittle (source) damage_isoBrittle
isobrittle_criticalStrainEnergy 1400000.0 isobrittle_criticalStrainEnergy 1400000.0
isobrittle_atol 0.01 isobrittle_atol 0.01

View File

@ -1,3 +1,2 @@
### $Id$ ###
(source) thermal_dissipation (source) thermal_dissipation
dissipation_ColdWorkCoeff 0.95 dissipation_ColdWorkCoeff 0.95

View File

@ -1,4 +1,3 @@
### $Id$ ###
(source) vacancy_irradiation (source) vacancy_irradiation
irradiation_cascadeprobability 0.00001 irradiation_cascadeprobability 0.00001
irradiation_cascadevolume 1000.0 irradiation_cascadevolume 1000.0

View File

@ -1,3 +1,2 @@
### $Id$ ###
(source) vacancy_phenoplasticity (source) vacancy_phenoplasticity
phenoplasticity_ratecoeff 0.01 phenoplasticity_ratecoeff 0.01

View File

@ -1,4 +1,3 @@
### $Id$ ###
[FiberExample] [FiberExample]
axes x y -z # model coordinate x-, y-, z-axes correspond to which axes during texture measurement? this was a left handed coordinate system! axes x y -z # model coordinate x-, y-, z-axes correspond to which axes during texture measurement? this was a left handed coordinate system!
# fiber axis in spherical coordinates: alpha crystal system, beta sample system # fiber axis in spherical coordinates: alpha crystal system, beta sample system

View File

@ -1,3 +1,2 @@
### $Id$ ###
[001] [001]
(gauss) phi1 0.000 Phi 0.000 phi2 0.000 scatter 0.000 fraction 1.000 (gauss) phi1 0.000 Phi 0.000 phi2 0.000 scatter 0.000 fraction 1.000

View File

@ -1,3 +1,2 @@
### $Id$ ###
[101] [101]
(gauss) phi1 0.000 Phi 45.000 phi2 90.000 scatter 0.000 fraction 1.000 (gauss) phi1 0.000 Phi 45.000 phi2 90.000 scatter 0.000 fraction 1.000

View File

@ -1,3 +1,2 @@
### $Id$ ###
[111] [111]
(gauss) phi1 0.000 Phi 54.7356 phi2 45.000 scatter 0.000 fraction 1.000 (gauss) phi1 0.000 Phi 54.7356 phi2 45.000 scatter 0.000 fraction 1.000

View File

@ -1,3 +1,2 @@
### $Id$ ###
[123] [123]
(gauss) phi1 209.805 Phi 29.206 phi2 63.435 scatter 0.000 fraction 1.000 (gauss) phi1 209.805 Phi 29.206 phi2 63.435 scatter 0.000 fraction 1.000

View File

@ -1,3 +1,2 @@
### $Id$ ###
[RandomSingleCrystals] [RandomSingleCrystals]
(random) scatter 0.000 fraction 1.000 (random) scatter 0.000 fraction 1.000

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Rolling] [Rolling]
hybridIA rollingTexture.linearODF hybridIA rollingTexture.linearODF
symmetry orthotropic # or monoclinic symmetry orthotropic # or monoclinic

View File

@ -1,4 +1,3 @@
### $Id$ ###
### debugging parameters ### ### debugging parameters ###
# example: # example:

View File

@ -1,4 +1,3 @@
### $Id$ ###
### numerical parameters ### ### numerical parameters ###
# The material.config file needs to specify five parts: # The material.config file needs to specify five parts:

View File

@ -1,4 +1,3 @@
### $Id$ ###
### numerical parameters ### ### numerical parameters ###
relevantStrain 1.0e-7 # strain increment considered significant (used by crystallite to determine whether strain inc is considered significant) relevantStrain 1.0e-7 # strain increment considered significant (used by crystallite to determine whether strain inc is considered significant)

View File

@ -1,7 +1,3 @@
#####################
# $Id$
#####################
#-------------------# #-------------------#
<homogenization> <homogenization>
#-------------------# #-------------------#

View File

@ -1,7 +1,3 @@
#####################
# $Id$
#####################
#-------------------# #-------------------#
<homogenization> <homogenization>
#-------------------# #-------------------#

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,glob,string,subprocess,shlex import os,sys,glob,subprocess,shlex
from damask import Environment from damask import Environment
from damask import version as DAMASKVERSION from damask import version as DAMASKVERSION
@ -47,9 +47,13 @@ compileOptions = ' -DSpectral -DFLOAT=8 -DINT=4 -I%s/lib -DDAMASKVERSION=\\\\\"\
#--- this saves the path of libraries to core.so, hence it is known during runtime ---------------- #--- this saves the path of libraries to core.so, hence it is known during runtime ----------------
if options['F90'] == 'gfortran': if options['F90'] == 'gfortran':
LDFLAGS = '-shared -Wl,-undefined,dynamic_lookup' # solved error: Undefined symbols for architecture x86_64: "_PyArg_ParseTupleAndKeywords" as found on https://lists.macosforge.org/pipermail/macports-dev/2013-May/022735.html # solved error: Undefined symbols for architecture x86_64: "_PyArg_ParseTupleAndKeywords"
# as found on https://lists.macosforge.org/pipermail/macports-dev/2013-May/022735.html
LDFLAGS = '-shared -Wl,-undefined,dynamic_lookup'
else: else:
LDFLAGS = ' -openmp -Wl' # some f2py versions/configurations compile with openMP, so linking against openMP is needed to prevent errors during loading of core module # some f2py versions/configurations compile with openMP, so linking against openMP is needed
# to prevent errors during loading of core module
LDFLAGS = ' -openmp -Wl'
#--- run path of for fftw during runtime ---------------------------------------------------------- #--- run path of for fftw during runtime ----------------------------------------------------------
LDFLAGS += ',-rpath,%s/lib,-rpath,%s/lib64'%(options['FFTW_ROOT'],options['FFTW_ROOT']) LDFLAGS += ',-rpath,%s/lib,-rpath,%s/lib64'%(options['FFTW_ROOT'],options['FFTW_ROOT'])

View File

@ -1,7 +1,6 @@
# #
# DAMASK Abaqus Environment File # DAMASK Abaqus Environment File
# #
# $Id$
# ------------------------------------ # ------------------------------------
# originally taken from Abaqus ver. 6.11.1 # originally taken from Abaqus ver. 6.11.1
# #

View File

@ -1,7 +1,6 @@
# #
# DAMASK Abaqus Environment File # DAMASK Abaqus Environment File
# #
# $Id$
# ------------------------------------ # ------------------------------------
# originally taken from Abaqus ver. 6.11.1 # originally taken from Abaqus ver. 6.11.1
# #

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# Makes postprocessing routines acessible from everywhere. # Makes postprocessing routines acessible from everywhere.

View File

@ -1,7 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
import os,sys import os,sys
import numpy as np import numpy as np
@ -27,7 +25,7 @@ class ASCIItable():
self.__IO__ = {'output': [], self.__IO__ = {'output': [],
'buffered': buffered, 'buffered': buffered,
'labeled': labeled, # header contains labels 'labeled': labeled, # header contains labels
'labels': [], # labels according to file info 'tags': [], # labels according to file info
'readBuffer': [], # buffer to hold non-advancing reads 'readBuffer': [], # buffer to hold non-advancing reads
'dataStart': 0, 'dataStart': 0,
} }
@ -51,7 +49,7 @@ class ASCIItable():
self.__IO__['out'] = outname self.__IO__['out'] = outname
self.info = [] self.info = []
self.labels = [] self.tags = []
self.data = [] self.data = []
self.line = '' self.line = ''
@ -141,10 +139,10 @@ class ASCIItable():
# ------------------------------------------------------------------ # ------------------------------------------------------------------
def head_read(self): def head_read(self):
""" """
get column labels by either reading get column labels
the first row or, if keyword "head[*]" is present, by either reading the first row or,
the last line of the header if keyword "head[*]" is present, the last line of the header
""" """
import re,shlex import re,shlex
@ -161,7 +159,7 @@ class ASCIItable():
if self.__IO__['labeled']: # table features labels if self.__IO__['labeled']: # table features labels
self.info = [self.__IO__['in'].readline().strip() for i in xrange(1,int(m.group(1)))] self.info = [self.__IO__['in'].readline().strip() for i in xrange(1,int(m.group(1)))]
self.labels = shlex.split(self.__IO__['in'].readline()) # store labels found in last line self.tags = shlex.split(self.__IO__['in'].readline()) # store tags found in last line
else: else:
@ -180,11 +178,11 @@ class ASCIItable():
else: break # last line of comments else: break # last line of comments
if self.__IO__['labeled']: # table features labels if self.__IO__['labeled']: # table features labels
self.labels = self.data # get labels from last line in "header"... self.tags = self.data # get tags from last line in "header"...
self.data_read() # ...and remove from buffer self.data_read() # ...and remove from buffer
if self.__IO__['labeled']: # table features labels if self.__IO__['labeled']: # table features tags
self.__IO__['labels'] = list(self.labels) # backup labels (make COPY, not link) self.__IO__['tags'] = list(self.tags) # backup tags (make COPY, not link)
try: try:
self.__IO__['dataStart'] = self.__IO__['in'].tell() # current file position is at start of data self.__IO__['dataStart'] = self.__IO__['in'].tell() # current file position is at start of data
@ -197,7 +195,7 @@ class ASCIItable():
"""write current header information (info + labels)""" """write current header information (info + labels)"""
head = ['{}\theader'.format(len(self.info)+self.__IO__['labeled'])] if header else [] head = ['{}\theader'.format(len(self.info)+self.__IO__['labeled'])] if header else []
head.append(self.info) head.append(self.info)
if self.__IO__['labeled']: head.append('\t'.join(map(self._quote,self.labels))) if self.__IO__['labeled']: head.append('\t'.join(map(self._quote,self.tags)))
return self.output_write(head) return self.output_write(head)
@ -261,19 +259,57 @@ class ASCIItable():
try: try:
for item in what: self.labels_append(item) for item in what: self.labels_append(item)
except: except:
self.labels += [self._removeCRLF(str(what))] self.tags += [self._removeCRLF(str(what))]
else: else:
self.labels += [self._removeCRLF(what)] self.tags += [self._removeCRLF(what)]
self.__IO__['labeled'] = True # switch on processing (in particular writing) of labels self.__IO__['labeled'] = True # switch on processing (in particular writing) of tags
if reset: self.__IO__['labels'] = list(self.labels) # subsequent data_read uses current labels as data size if reset: self.__IO__['tags'] = list(self.tags) # subsequent data_read uses current tags as data size
# ------------------------------------------------------------------ # ------------------------------------------------------------------
def labels_clear(self): def labels_clear(self):
"""delete existing labels and switch to no labeling""" """delete existing labels and switch to no labeling"""
self.labels = [] self.tags = []
self.__IO__['labeled'] = False self.__IO__['labeled'] = False
# ------------------------------------------------------------------
def labels(self,
tags = None,
raw = False):
"""
tell abstract labels.
"x" for "1_x","2_x",... unless raw output is requested.
operates on object tags or given list.
"""
from collections import Iterable
if tags is None: tags = self.tags
if isinstance(tags, Iterable) and not raw: # check whether list of tags is requested
id = 0
dim = 1
labelList = []
while id < len(tags):
if not tags[id].startswith('1_'):
labelList.append(tags[id])
else:
label = tags[id][2:] # get label
while id < len(tags) and tags[id] == '{}_{}'.format(dim,label): # check successors
id += 1 # next label...
dim += 1 # ...should be one higher dimension
labelList.append(label) # reached end --> store
id -= 1 # rewind one to consider again
id += 1
dim = 1
else:
labelList = self.tags
return labelList
# ------------------------------------------------------------------ # ------------------------------------------------------------------
def label_index(self, def label_index(self,
labels): labels):
@ -293,10 +329,10 @@ class ASCIItable():
idx.append(int(label)-1) # column given as integer number? idx.append(int(label)-1) # column given as integer number?
except ValueError: except ValueError:
try: try:
idx.append(self.labels.index(label)) # locate string in label list idx.append(self.tags.index(label)) # locate string in label list
except ValueError: except ValueError:
try: try:
idx.append(self.labels.index('1_'+label)) # locate '1_'+string in label list idx.append(self.tags.index('1_'+label)) # locate '1_'+string in label list
except ValueError: except ValueError:
idx.append(-1) # not found... idx.append(-1) # not found...
else: else:
@ -304,10 +340,10 @@ class ASCIItable():
idx = int(labels)-1 # offset for python array indexing idx = int(labels)-1 # offset for python array indexing
except ValueError: except ValueError:
try: try:
idx = self.labels.index(labels) idx = self.tags.index(labels)
except ValueError: except ValueError:
try: try:
idx = self.labels.index('1_'+labels) # locate '1_'+string in label list idx = self.tags.index('1_'+labels) # locate '1_'+string in label list
except ValueError: except ValueError:
idx = None if labels is None else -1 idx = None if labels is None else -1
@ -332,16 +368,16 @@ class ASCIItable():
try: # column given as number? try: # column given as number?
idx = int(label)-1 idx = int(label)-1
myDim = 1 # if found has at least dimension 1 myDim = 1 # if found has at least dimension 1
if self.labels[idx].startswith('1_'): # column has multidim indicator? if self.tags[idx].startswith('1_'): # column has multidim indicator?
while idx+myDim < len(self.labels) and self.labels[idx+myDim].startswith("%i_"%(myDim+1)): while idx+myDim < len(self.tags) and self.tags[idx+myDim].startswith("%i_"%(myDim+1)):
myDim += 1 # add while found myDim += 1 # add while found
except ValueError: # column has string label except ValueError: # column has string label
if label in self.labels: # can be directly found? if label in self.tags: # can be directly found?
myDim = 1 # scalar by definition myDim = 1 # scalar by definition
elif '1_'+label in self.labels: # look for first entry of possible multidim object elif '1_'+label in self.tags: # look for first entry of possible multidim object
idx = self.labels.index('1_'+label) # get starting column idx = self.tags.index('1_'+label) # get starting column
myDim = 1 # (at least) one-dimensional myDim = 1 # (at least) one-dimensional
while idx+myDim < len(self.labels) and self.labels[idx+myDim].startswith("%i_"%(myDim+1)): while idx+myDim < len(self.tags) and self.tags[idx+myDim].startswith("%i_"%(myDim+1)):
myDim += 1 # keep adding while going through object myDim += 1 # keep adding while going through object
dim.append(myDim) dim.append(myDim)
@ -351,16 +387,16 @@ class ASCIItable():
try: # column given as number? try: # column given as number?
idx = int(labels)-1 idx = int(labels)-1
dim = 1 # if found has at least dimension 1 dim = 1 # if found has at least dimension 1
if self.labels[idx].startswith('1_'): # column has multidim indicator? if self.tags[idx].startswith('1_'): # column has multidim indicator?
while idx+dim < len(self.labels) and self.labels[idx+dim].startswith("%i_"%(dim+1)): while idx+dim < len(self.tags) and self.tags[idx+dim].startswith("%i_"%(dim+1)):
dim += 1 # add as long as found dim += 1 # add as long as found
except ValueError: # column has string label except ValueError: # column has string label
if labels in self.labels: # can be directly found? if labels in self.tags: # can be directly found?
dim = 1 # scalar by definition dim = 1 # scalar by definition
elif '1_'+labels in self.labels: # look for first entry of possible multidim object elif '1_'+labels in self.tags: # look for first entry of possible multidim object
idx = self.labels.index('1_'+labels) # get starting column idx = self.tags.index('1_'+labels) # get starting column
dim = 1 # is (at least) one-dimensional dim = 1 # is (at least) one-dimensional
while idx+dim < len(self.labels) and self.labels[idx+dim].startswith("%i_"%(dim+1)): while idx+dim < len(self.tags) and self.tags[idx+dim].startswith("%i_"%(dim+1)):
dim += 1 # keep adding while going through object dim += 1 # keep adding while going through object
return np.array(dim) if isinstance(dim,Iterable) else dim return np.array(dim) if isinstance(dim,Iterable) else dim
@ -404,8 +440,8 @@ class ASCIItable():
def data_rewind(self): def data_rewind(self):
self.__IO__['in'].seek(self.__IO__['dataStart']) # position file to start of data section self.__IO__['in'].seek(self.__IO__['dataStart']) # position file to start of data section
self.__IO__['readBuffer'] = [] # delete any non-advancing data reads self.__IO__['readBuffer'] = [] # delete any non-advancing data reads
self.labels = list(self.__IO__['labels']) # restore label info found in header (as COPY, not link) self.tags = list(self.__IO__['tags']) # restore label info found in header (as COPY, not link)
self.__IO__['labeled'] = len(self.labels) > 0 self.__IO__['labeled'] = len(self.tags) > 0
# ------------------------------------------------------------------ # ------------------------------------------------------------------
def data_skipLines(self, def data_skipLines(self,
@ -432,8 +468,8 @@ class ASCIItable():
self.line = self.line.rstrip('\n') self.line = self.line.rstrip('\n')
if self.__IO__['labeled'] and respectLabels: # if table has labels if self.__IO__['labeled'] and respectLabels: # if table has labels
items = shlex.split(self.line)[:len(self.__IO__['labels'])] # use up to label count (from original file info) items = shlex.split(self.line)[:len(self.__IO__['tags'])] # use up to label count (from original file info)
self.data = items if len(items) == len(self.__IO__['labels']) else [] # take entries if label count matches self.data = items if len(items) == len(self.__IO__['tags']) else [] # take entries if label count matches
else: else:
self.data = shlex.split(self.line) # otherwise take all self.data = shlex.split(self.line) # otherwise take all
@ -470,7 +506,7 @@ class ASCIItable():
1)) 1))
use = np.array(columns) use = np.array(columns)
self.labels = list(np.array(self.labels)[use]) # update labels with valid subset self.tags = list(np.array(self.tags)[use]) # update labels with valid subset
self.data = np.loadtxt(self.__IO__['in'],usecols=use,ndmin=2) self.data = np.loadtxt(self.__IO__['in'],usecols=use,ndmin=2)
@ -545,8 +581,8 @@ class ASCIItable():
def datatype(item): def datatype(item):
return int(item) if type.lower() == 'i' else float(item) return int(item) if type.lower() == 'i' else float(item)
N = grid.prod() # expected number of microstructure indices in data N = grid.prod() # expected number of microstructure indices in data
microstructure = np.zeros(N,type) # initialize as flat array microstructure = np.zeros(N,type) # initialize as flat array
i = 0 i = 0
while i < N and self.data_read(): while i < N and self.data_read():
@ -557,7 +593,7 @@ class ASCIItable():
else: items = map(datatype,items) else: items = map(datatype,items)
else: items = map(datatype,items) else: items = map(datatype,items)
s = min(len(items), N-i) # prevent overflow of microstructure array s = min(len(items), N-i) # prevent overflow of microstructure array
microstructure[i:i+s] = items[:s] microstructure[i:i+s] = items[:s]
i += len(items) i += len(items)

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
import re import re
class Section(): class Section():

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
import os,subprocess,shlex import os,subprocess,shlex

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
import damask.geometry import damask.geometry

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
from .geometry import Geometry from .geometry import Geometry

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
from .geometry import Geometry from .geometry import Geometry

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
import numpy as np import numpy as np
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
from distutils.core import setup from distutils.core import setup

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
from .solver import Solver from .solver import Solver

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
from .solver import Solver from .solver import Solver

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
import damask.solver import damask.solver

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
from .solver import Solver from .solver import Solver

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
import os,sys,shutil import os,sys,shutil
import logging,logging.config import logging,logging.config
@ -41,7 +40,7 @@ class Test():
+'----------------------------------------------------------------') +'----------------------------------------------------------------')
self.dirBase = os.path.dirname(os.path.realpath(sys.modules[self.__class__.__module__].__file__)) self.dirBase = os.path.dirname(os.path.realpath(sys.modules[self.__class__.__module__].__file__))
self.parser = OptionParser( self.parser = OptionParser(
description = test_description+' (using class: $Id$)', description = test_description+' (using class: {})'.format(damask.version),
usage='./test.py [options]') usage='./test.py [options]')
self.updateRequested = False self.updateRequested = False
self.parser.add_option("-d", "--debug", action="store_true",\ self.parser.add_option("-d", "--debug", action="store_true",\

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os import os

View File

@ -1,4 +1,3 @@
#!/usr/bin/python
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import threading,os,string import threading,os,string

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,string,scipy import os,string,scipy

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,string,vtk import os,string,vtk

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import threading,time,os import threading,time,os

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,re,fnmatch,vtk import os,sys,re,fnmatch,vtk
@ -227,7 +227,7 @@ for filename in args:
locol = -1 locol = -1
for col,head in enumerate(headings): for col,head in enumerate(headings):
if head == {True:'1_ipinitialcoord',False:'1_nodeinitialcoord'}[options.cell]: if head == {True:'1_pos',False:'1_nodeinitialcoord'}[options.cell]:
locol = col locol = col
maxcol = max(maxcol,col+3) maxcol = max(maxcol,col+3)
break break
@ -430,4 +430,4 @@ for filename in args:
vtk = open(os.path.join(head,what+'_'+os.path.splitext(tail)[0]+'.vtk'), 'w') vtk = open(os.path.join(head,what+'_'+os.path.splitext(tail)[0]+'.vtk'), 'w')
output(out[what],{'filepointer':vtk},'File') output(out[what],{'filepointer':vtk},'File')
vtk.close() vtk.close()
print print

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys

View File

@ -10,16 +10,12 @@ import damask
scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptName = os.path.splitext(os.path.basename(__file__))[0]
scriptID = ' '.join([scriptName,damask.version]) scriptID = ' '.join([scriptName,damask.version])
def unravel(item):
if hasattr(item,'__contains__'): return ' '.join(map(unravel,item))
else: return str(item)
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# MAIN # MAIN
# -------------------------------------------------------------------- # --------------------------------------------------------------------
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
Add column(s) with derived values according to user-defined arithmetic operation between column(s). Add or alter column(s) with derived values according to user-defined arithmetic operation between column(s).
Column labels are tagged by '#label#' in formulas. Use ';' for ',' in functions. Column labels are tagged by '#label#' in formulas. Use ';' for ',' in functions.
Numpy is available as np. Numpy is available as np.
@ -37,6 +33,13 @@ parser.add_option('-f','--formula',
action = 'extend', metavar = '<string LIST>', action = 'extend', metavar = '<string LIST>',
help = '(list of) formulas corresponding to labels') help = '(list of) formulas corresponding to labels')
parser.add_option('-c','--condition',
dest = 'condition', metavar='string',
help = 'condition to filter rows')
parser.set_defaults(condition = None,
)
(options,filenames) = parser.parse_args() (options,filenames) = parser.parse_args()
if options.labels is None or options.formulas is None: if options.labels is None or options.formulas is None:
@ -53,7 +56,10 @@ if filenames == []: filenames = [None]
for name in filenames: for name in filenames:
try: try:
table = damask.ASCIItable(name = name, buffered = False) table = damask.ASCIItable(name = name,
buffered = False)
output = damask.ASCIItable(name = name,
buffered = False)
except: except:
continue continue
damask.util.report(scriptName,name) damask.util.report(scriptName,name)
@ -62,14 +68,41 @@ for name in filenames:
table.head_read() table.head_read()
# ------------------------------------------ build formulae ---------------------------------------- # -----------------------------------------------------------------------------------------------------
specials = { \ specials = { \
'_row_': 0, '_row_': 0,
} }
# ------------------------------------------ Evaluate condition ---------------------------------------
if options.condition:
interpolator = []
condition = options.condition # copy per file, since might be altered inline
breaker = False
for position,operand in enumerate(set(re.findall(r'#(([s]#)?(.+?))#',condition))): # find three groups
condition = condition.replace('#'+operand[0]+'#',
{ '': '{%i}'%position,
's#':'"{%i}"'%position}[operand[1]])
if operand[2] in specials: # special label
interpolator += ['specials["%s"]'%operand[2]]
else:
try:
interpolator += ['%s(table.data[%i])'%({ '':'float',
's#':'str'}[operand[1]],
table.label_index(operand[2]))] # ccould be generalized to indexrange as array lookup
except:
damask.util.croak('column "{}" not found.'.format(operand[2]))
breaker = True
if breaker: continue # found mistake in condition evaluation --> next file
evaluator_condition = "'" + condition + "'.format(" + ','.join(interpolator) + ")"
else: condition = ''
# ------------------------------------------ build formulae ----------------------------------------
evaluator = {} evaluator = {}
brokenFormula = {}
for label,formula in zip(options.labels,options.formulas): for label,formula in zip(options.labels,options.formulas):
for column in re.findall(r'#(.+?)#',formula): # loop over column labels in formula for column in re.findall(r'#(.+?)#',formula): # loop over column labels in formula
@ -82,15 +115,15 @@ for name in filenames:
elif dim > 1: # multidimensional input (vector, tensor, etc.) elif dim > 1: # multidimensional input (vector, tensor, etc.)
replacement = 'np.array(table.data[{}:{}],dtype=float)'.format(idx,idx+dim) # use (flat) array representation replacement = 'np.array(table.data[{}:{}],dtype=float)'.format(idx,idx+dim) # use (flat) array representation
else: else:
damask.util.croak('column {} not found...'.format(column)) damask.util.croak('column {} not found, skipping {}...'.format(column,label))
brokenFormula[label] = True options.labels.remove(label)
break break
formula = formula.replace('#'+column+'#',replacement) formula = formula.replace('#'+column+'#',replacement)
if label not in brokenFormula:
evaluator[label] = formula
evaluator[label] = formula
# ------------------------------------------ process data ------------------------------------------ # ------------------------------------------ process data ------------------------------------------
firstLine = True firstLine = True
@ -98,32 +131,53 @@ for name in filenames:
while outputAlive and table.data_read(): # read next data line of ASCII table while outputAlive and table.data_read(): # read next data line of ASCII table
specials['_row_'] += 1 # count row specials['_row_'] += 1 # count row
output.data_clear()
# ------------------------------------------ calculate one result to get length of labels --------- # ------------------------------------------ calculate one result to get length of labels ---------
if firstLine: if firstLine:
firstLine = False firstLine = False
labelDim = {} labelDim = {}
for label in [x for x in options.labels if x not in set(brokenFormula)]: for label in [x for x in options.labels]:
labelDim[label] = np.size(eval(evaluator[label])) labelDim[label] = np.size(eval(evaluator[label]))
if labelDim[label] == 0: brokenFormula[label] = True if labelDim[label] == 0: options.labels.remove(label)
# ------------------------------------------ assemble header --------------------------------------- # ------------------------------------------ assemble header ---------------------------------------
if label not in brokenFormula: output.labels_clear()
table.labels_append(['{}_{}'.format(i+1,label) for i in xrange(labelDim[label])] if labelDim[label] > 1 tabLabels = table.labels()
else label) for label in tabLabels:
dim = labelDim[label] if label in options.labels \
else table.label_dimension(label)
output.labels_append(['{}_{}'.format(i+1,label) for i in xrange(dim)] if dim > 1 else label)
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) for label in options.labels:
table.head_write() if label in tabLabels: continue
output.labels_append(['{}_{}'.format(i+1,label) for i in xrange(labelDim[label])]
if labelDim[label] > 1
else label)
output.info = table.info
output.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
output.head_write()
# ------------------------------------------ process data ------------------------------------------ # ------------------------------------------ process data ------------------------------------------
for label in [x for x in options.labels if x not in set(brokenFormula)]: for label in output.labels():
table.data_append(unravel(eval(evaluator[label]))) oldIndices = table.label_indexrange(label)
Nold = max(1,len(oldIndices)) # Nold could be zero for new columns
Nnew = len(output.label_indexrange(label))
output.data_append(eval(evaluator[label]) if label in options.labels and
(condition == '' or eval(eval(evaluator_condition)))
else np.tile([table.data[i] for i in oldIndices]
if label in tabLabels
else np.nan,
np.ceil(float(Nnew)/Nold))[:Nnew]) # spread formula result into given number of columns
outputAlive = table.data_write() # output processed line outputAlive = output.data_write() # output processed line
# ------------------------------------------ output finalization ----------------------------------- # ------------------------------------------ output finalization -----------------------------------
table.close() # close ASCII tables table.input_close() # close ASCII tables
output.close() # close ASCII tables

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys
@ -64,10 +64,12 @@ for name in filenames:
errors = [] errors = []
remarks = [] remarks = []
if table.label_dimension(options.pos) != 3: errors.append('coordinates {} are not a vector.'.format(options.pos)) if table.label_dimension(options.pos) != 3:
errors.append('coordinates "{}" are not a vector.'.format(options.pos))
else: colCoord = table.label_index(options.pos) else: colCoord = table.label_index(options.pos)
if table.label_dimension(options.defgrad) != 9: errors.append('deformation gradient {} is not a tensor.'.format(options.defgrad)) if table.label_dimension(options.defgrad) != 9:
errors.append('deformation gradient "{}" is not a tensor.'.format(options.defgrad))
else: colF = table.label_index(options.defgrad) else: colF = table.label_index(options.defgrad)
if remarks != []: damask.util.croak(remarks) if remarks != []: damask.util.croak(remarks)
@ -91,21 +93,21 @@ for name in filenames:
maxcorner = np.array(map(max,coords)) maxcorner = np.array(map(max,coords))
grid = np.array(map(len,coords),'i') grid = np.array(map(len,coords),'i')
size = grid/np.maximum(np.ones(3,'d'), grid-1.0) * (maxcorner-mincorner) # size from edge to edge = dim * n/(n-1) size = grid/np.maximum(np.ones(3,'d'), grid-1.0) * (maxcorner-mincorner) # size from edge to edge = dim * n/(n-1)
size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1])) # spacing for grid==1 set to smallest among other spacings size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1])) # grid==1 spacing set to smallest among other ones
N = grid.prod() N = grid.prod()
# --------------- figure out columns to process --------------------------------------------------- # --------------- figure out columns to process ---------------------------------------------------
key = '1_%s'%options.defgrad key = '1_'+options.defgrad
if key not in table.labels: if table.label_index(key) == -1:
file['croak'].write('column %s not found...\n'%key) damask.util.croak('column "{}" not found...'.format(key))
continue continue
else: else:
column = table.labels.index(key) # remember columns of requested data column = table.label_index(key) # remember columns of requested data
# ------------------------------------------ assemble header --------------------------------------- # ------------------------------------------ assemble header ---------------------------------------
if options.shape: table.labels_append(['shapeMismatch(%s)' %options.defgrad]) if options.shape: table.labels_append(['shapeMismatch({})'.format(options.defgrad)])
if options.volume: table.labels_append(['volMismatch(%s)'%options.defgrad]) if options.volume: table.labels_append(['volMismatch({})'.format(options.defgrad)])
table.head_write() table.head_write()
# ------------------------------------------ read deformation gradient field ----------------------- # ------------------------------------------ read deformation gradient field -----------------------

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,itertools import os,sys,itertools

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys,time,copy import os,sys,time,copy
import numpy as np import numpy as np

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os import os

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

Some files were not shown because too many files have changed in this diff Show More