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

This commit is contained in:
Franz Roters 2017-10-04 17:18:57 +02:00
commit 5011e201d6
5 changed files with 90 additions and 69 deletions

@ -1 +1 @@
Subproject commit 5e97c9ac2fa4f7748a1bc040c15889623a3afd1f Subproject commit 55a263fc30c40c16ef337be050f8901dd2747390

View File

@ -1 +1 @@
v2.0.1-924-ge1bfde9 v2.0.1-941-g05bb3c1

View File

@ -451,9 +451,9 @@ def mapIncremental(label, mapping, N, base, new):
# ----------------------------- # -----------------------------
def OpenPostfile(name,type,nodal = False): def OpenPostfile(name,type,nodal = False):
"""Open postfile with extrapolation mode 'translate'""" """Open postfile with extrapolation mode 'translate'"""
p = {\ p = {
'spectral': MPIEspectral_result,\ 'spectral': MPIEspectral_result,
'marc': post_open,\ 'marc': post_open,
}[type](name) }[type](name)
p.extrapolation({True:'linear',False:'translate'}[nodal]) p.extrapolation({True:'linear',False:'translate'}[nodal])
p.moveto(1) p.moveto(1)
@ -512,19 +512,19 @@ def ParsePostfile(p,filename, outputFormat):
needs "outputFormat" for mapping of output names to postfile output indices needs "outputFormat" for mapping of output names to postfile output indices
""" """
stat = { \ stat = {
'IndexOfLabel': {}, \ 'IndexOfLabel': {},
'Title': p.title(), \ 'Title': p.title(),
'Extrapolation': p.extrapolate, \ 'Extrapolation': p.extrapolate,
'NumberOfIncrements': p.increments(), \ 'NumberOfIncrements': p.increments(),
'NumberOfNodes': p.nodes(), \ 'NumberOfNodes': p.nodes(),
'NumberOfNodalScalars': p.node_scalars(), \ 'NumberOfNodalScalars': p.node_scalars(),
'LabelOfNodalScalar': [None]*p.node_scalars() , \ 'LabelOfNodalScalar': [None]*p.node_scalars(),
'NumberOfElements': p.elements(), \ 'NumberOfElements': p.elements(),
'NumberOfElementalScalars': p.element_scalars(), \ 'NumberOfElementalScalars': p.element_scalars(),
'LabelOfElementalScalar': [None]*p.element_scalars() , \ 'LabelOfElementalScalar': [None]*p.element_scalars(),
'NumberOfElementalTensors': p.element_tensors(), \ 'NumberOfElementalTensors': p.element_tensors(),
'LabelOfElementalTensor': [None]*p.element_tensors(), \ 'LabelOfElementalTensor': [None]*p.element_tensors(),
} }
# --- find labels # --- find labels
@ -671,6 +671,9 @@ parser.add_option('-m','--map', dest='func',
parser.add_option('-p','--type', dest='filetype', parser.add_option('-p','--type', dest='filetype',
metavar = 'string', metavar = 'string',
help = 'type of result file [auto]') help = 'type of result file [auto]')
parser.add_option('-q','--quiet', dest='verbose',
action = 'store_false',
help = 'suppress verbose output')
group_material = OptionGroup(parser,'Material identifier') group_material = OptionGroup(parser,'Material identifier')
@ -711,24 +714,26 @@ parser.add_option_group(group_material)
parser.add_option_group(group_general) parser.add_option_group(group_general)
parser.add_option_group(group_special) parser.add_option_group(group_special)
parser.set_defaults(info = False) parser.set_defaults(info = False,
parser.set_defaults(legacy = False) verbose = True,
parser.set_defaults(nodal = False) legacy = False,
parser.set_defaults(prefix = '') nodal = False,
parser.set_defaults(suffix = '') prefix = '',
parser.set_defaults(dir = 'postProc') suffix = '',
parser.set_defaults(filetype = None) dir = 'postProc',
parser.set_defaults(func = 'avg') filetype = None,
parser.set_defaults(homog = '1') func = 'avg',
parser.set_defaults(cryst = '1') homog = '1',
parser.set_defaults(phase = '1') cryst = '1',
parser.set_defaults(filter = '') phase = '1',
parser.set_defaults(sep = []) filter = '',
parser.set_defaults(sort = []) sep = [],
parser.set_defaults(inc = False) sort = [],
parser.set_defaults(time = False) inc = False,
parser.set_defaults(separateFiles = False) time = False,
parser.set_defaults(getIncrements= False) separateFiles = False,
getIncrements= False,
)
(options, files) = parser.parse_args() (options, files) = parser.parse_args()
@ -797,8 +802,9 @@ options.sep.reverse()
# --- start background messaging # --- start background messaging
bg = damask.util.backgroundMessage() if options.verbose:
bg.start() bg = damask.util.backgroundMessage()
bg.start()
# --- parse .output and .t16 files # --- parse .output and .t16 files
@ -816,7 +822,7 @@ me = {
'Constitutive': options.phase, 'Constitutive': options.phase,
} }
bg.set_message('parsing .output files...') if options.verbose: bg.set_message('parsing .output files...')
for what in me: for what in me:
outputFormat[what] = ParseOutputFormat(filename, what, me[what]) outputFormat[what] = ParseOutputFormat(filename, what, me[what])
@ -824,9 +830,10 @@ for what in me:
print("\nsection '{}' not found in <{}>".format(me[what], what)) print("\nsection '{}' not found in <{}>".format(me[what], what))
print('\n'.join(map(lambda x:' [%s]'%x, outputFormat[what]['specials']['brothers']))) print('\n'.join(map(lambda x:' [%s]'%x, outputFormat[what]['specials']['brothers'])))
bg.set_message('opening result file...') if options.verbose: bg.set_message('opening result file...')
p = OpenPostfile(filename+extension,options.filetype,options.nodal) p = OpenPostfile(filename+extension,options.filetype,options.nodal)
bg.set_message('parsing result file...') if options.verbose: bg.set_message('parsing result file...')
stat = ParsePostfile(p, filename, outputFormat) stat = ParsePostfile(p, filename, outputFormat)
if options.filetype == 'marc': if options.filetype == 'marc':
stat['NumberOfIncrements'] -= 1 # t16 contains one "virtual" increment (at 0) stat['NumberOfIncrements'] -= 1 # t16 contains one "virtual" increment (at 0)
@ -870,8 +877,7 @@ if options.info:
elementsOfNode = {} elementsOfNode = {}
for e in range(stat['NumberOfElements']): for e in range(stat['NumberOfElements']):
if e%1000 == 0: if options.verbose and e%1000 == 0: bg.set_message('connect elem %i...'%e)
bg.set_message('connect elem %i...'%e)
for n in map(p.node_sequence,p.element(e).items): for n in map(p.node_sequence,p.element(e).items):
if n not in elementsOfNode: if n not in elementsOfNode:
elementsOfNode[n] = [p.element_id(e)] elementsOfNode[n] = [p.element_id(e)]
@ -893,8 +899,7 @@ memberCount = 0
if options.nodalScalar: if options.nodalScalar:
for n in range(stat['NumberOfNodes']): for n in range(stat['NumberOfNodes']):
if n%1000 == 0: if options.verbose and n%1000 == 0: bg.set_message('scan node %i...'%n)
bg.set_message('scan node %i...'%n)
myNodeID = p.node_id(n) myNodeID = p.node_id(n)
myNodeCoordinates = [p.node(n).x, p.node(n).y, p.node(n).z] myNodeCoordinates = [p.node(n).x, p.node(n).y, p.node(n).z]
myElemID = 0 myElemID = 0
@ -928,8 +933,7 @@ if options.nodalScalar:
else: else:
for e in range(stat['NumberOfElements']): for e in range(stat['NumberOfElements']):
if e%1000 == 0: if options.verbose and e%1000 == 0: bg.set_message('scan elem %i...'%e)
bg.set_message('scan elem %i...'%e)
myElemID = p.element_id(e) myElemID = p.element_id(e)
myIpCoordinates = ipCoords(p.element(e).type, map(lambda node: [node.x, node.y, node.z], myIpCoordinates = ipCoords(p.element(e).type, map(lambda node: [node.x, node.y, node.z],
map(p.node, map(p.node_sequence, p.element(e).items)))) map(p.node, map(p.node_sequence, p.element(e).items))))
@ -995,7 +999,7 @@ if 'none' not in map(str.lower, options.sort):
theKeys.append('x[0][%i]'%where[criterium]) theKeys.append('x[0][%i]'%where[criterium])
sortKeys = eval('lambda x:(%s)'%(','.join(theKeys))) sortKeys = eval('lambda x:(%s)'%(','.join(theKeys)))
bg.set_message('sorting groups...') if options.verbose: bg.set_message('sorting groups...')
groups.sort(key = sortKeys) # in-place sorting to save mem groups.sort(key = sortKeys) # in-place sorting to save mem
@ -1014,7 +1018,7 @@ standard = ['inc'] + \
# --------------------------- loop over positions -------------------------------- # --------------------------- loop over positions --------------------------------
bg.set_message('getting map between positions and increments...') if options.verbose: bg.set_message('getting map between positions and increments...')
incAtPosition = {} incAtPosition = {}
positionOfInc = {} positionOfInc = {}
@ -1075,7 +1079,7 @@ for incCount,position in enumerate(locations): # walk through locations
member += 1 member += 1
if member%1000 == 0: if member%1000 == 0:
time_delta = ((len(locations)*memberCount)/float(member+incCount*memberCount)-1.0)*(time.time()-time_start) time_delta = ((len(locations)*memberCount)/float(member+incCount*memberCount)-1.0)*(time.time()-time_start)
bg.set_message('(%02i:%02i:%02i) processing point %i of %i from increment %i (position %i)...' if options.verbose: bg.set_message('(%02i:%02i:%02i) processing point %i of %i from increment %i (position %i)...'
%(time_delta//3600,time_delta%3600//60,time_delta%60,member,memberCount,increments[incCount],position)) %(time_delta//3600,time_delta%3600//60,time_delta%60,member,memberCount,increments[incCount],position))
newby = [] # current member's data newby = [] # current member's data

View File

@ -3084,35 +3084,49 @@ logical function crystallite_stateJump(ipc,ip,el)
implicit none implicit none
integer(pInt), intent(in):: & integer(pInt), intent(in):: &
el, & ! element index el, & ! element index
ip, & ! integration point index ip, & ! integration point index
ipc ! grain index ipc ! grain index
integer(pInt) :: & integer(pInt) :: &
c, & c, &
p, & p, &
mySource, & mySource, &
myOffsetPlasticDeltaState, &
myOffsetSourceDeltaState, &
mySizePlasticDeltaState, & mySizePlasticDeltaState, &
mySizeSourceDeltaState mySizeSourceDeltaState
c= phasememberAt(ipc,ip,el) c = phasememberAt(ipc,ip,el)
p = phaseAt(ipc,ip,el) p = phaseAt(ipc,ip,el)
call constitutive_collectDeltaState(crystallite_Tstar_v(1:6,ipc,ip,el), crystallite_Fe(1:3,1:3,ipc,ip,el), ipc,ip,el) call constitutive_collectDeltaState(crystallite_Tstar_v(1:6,ipc,ip,el), crystallite_Fe(1:3,1:3,ipc,ip,el), ipc,ip,el)
mySizePlasticDeltaState = plasticState(p)%sizeDeltaState
if( any(IEEE_is_NaN(plasticState(p)%deltaState(:,c)))) then ! NaN occured in deltaState myOffsetPlasticDeltaState = plasticState(p)%offsetDeltaState
mySizePlasticDeltaState = plasticState(p)%sizeDeltaState
if( any(IEEE_is_NaN(plasticState(p)%deltaState(1:mySizePlasticDeltaState,c)))) then ! NaN occured in deltaState
crystallite_stateJump = .false. crystallite_stateJump = .false.
return return
endif endif
plasticState(p)%state(1:mySizePlasticDeltaState,c) = plasticState(p)%state(1:mySizePlasticDeltaState,c) + &
plasticState(p)%deltaState(1:mySizePlasticDeltaState,c) plasticState(p)%state(myOffsetPlasticDeltaState + 1_pInt : &
myOffsetPlasticDeltaState + mySizePlasticDeltaState,c) = &
plasticState(p)%state(myOffsetPlasticDeltaState + 1_pInt : &
myOffsetPlasticDeltaState + mySizePlasticDeltaState,c) + &
plasticState(p)%deltaState(1:mySizePlasticDeltaState,c)
do mySource = 1_pInt, phase_Nsources(p) do mySource = 1_pInt, phase_Nsources(p)
mySizeSourceDeltaState = sourceState(p)%p(mySource)%sizeDeltaState myOffsetSourceDeltaState = sourceState(p)%p(mySource)%offsetDeltaState
if( any(IEEE_is_NaN(sourceState(p)%p(mySource)%deltaState(:,c)))) then ! NaN occured in deltaState mySizeSourceDeltaState = sourceState(p)%p(mySource)%sizeDeltaState
if (any(IEEE_is_NaN(sourceState(p)%p(mySource)%deltaState(1:mySizeSourceDeltaState,c)))) then ! NaN occured in deltaState
crystallite_stateJump = .false. crystallite_stateJump = .false.
return return
endif endif
sourceState(p)%p(mySource)%state(1:mySizeSourceDeltaState,c) = & sourceState(p)%p(mySource)%state(myOffsetSourceDeltaState + 1_pInt : &
sourceState(p)%p(mySource)%state(1:mySizeSourceDeltaState,c) + & myOffsetSourceDeltaState + mySizeSourceDeltaState,c) = &
sourceState(p)%p(mySource)%state(myOffsetSourceDeltaState + 1_pInt : &
myOffsetSourceDeltaState + mySizeSourceDeltaState,c) + &
sourceState(p)%p(mySource)%deltaState(1:mySizeSourceDeltaState,c) sourceState(p)%p(mySource)%deltaState(1:mySizeSourceDeltaState,c)
enddo enddo
@ -3123,7 +3137,9 @@ logical function crystallite_stateJump(ipc,ip,el)
.or. .not. iand(debug_level(debug_crystallite), debug_levelSelective) /= 0_pInt)) then .or. .not. iand(debug_level(debug_crystallite), debug_levelSelective) /= 0_pInt)) then
write(6,'(a,i8,1x,i2,1x,i3, /)') '<< CRYST >> update state at el ip ipc ',el,ip,ipc write(6,'(a,i8,1x,i2,1x,i3, /)') '<< CRYST >> update state at el ip ipc ',el,ip,ipc
write(6,'(a,/,(12x,12(e12.5,1x)),/)') '<< CRYST >> deltaState', plasticState(p)%deltaState(1:mySizePlasticDeltaState,c) write(6,'(a,/,(12x,12(e12.5,1x)),/)') '<< CRYST >> deltaState', plasticState(p)%deltaState(1:mySizePlasticDeltaState,c)
write(6,'(a,/,(12x,12(e12.5,1x)),/)') '<< CRYST >> new state', plasticState(p)%state (1:mySizePlasticDeltaState,c) write(6,'(a,/,(12x,12(e12.5,1x)),/)') '<< CRYST >> new state', &
plasticState(p)%state(myOffsetSourceDeltaState + 1_pInt : &
myOffsetSourceDeltaState + mySizeSourceDeltaState,c)
endif endif
#endif #endif

View File

@ -39,20 +39,21 @@ module prec
!http://stackoverflow.com/questions/3948210/can-i-have-a-pointer-to-an-item-in-an-allocatable-array !http://stackoverflow.com/questions/3948210/can-i-have-a-pointer-to-an-item-in-an-allocatable-array
type, public :: tState type, public :: tState
integer(pInt) :: & integer(pInt) :: &
sizeState = 0_pInt , & !< size of state sizeState = 0_pInt, & !< size of state
sizeDotState = 0_pInt, & !< size of dot state, i.e. parts of the state that are integrated sizeDotState = 0_pInt, & !< size of dot state, i.e. state(1:sizeDot) follows time evolution by dotState rates
sizeDeltaState = 0_pInt, & !< size of delta state, i.e. parts of the state that have discontinuous rates offsetDeltaState = 0_pInt, & !< offset of delta state
sizePostResults = 0_pInt !< size of output data sizeDeltaState = 0_pInt, & !< size of delta state, i.e. state(offset+1:offset+sizeDot) follows time evolution by deltaState increments
sizePostResults = 0_pInt !< size of output data
real(pReal), pointer, dimension(:), contiguous :: & real(pReal), pointer, dimension(:), contiguous :: &
atolState atolState
real(pReal), pointer, dimension(:,:), contiguous :: & ! a pointer is needed here because we might point to state/doState. However, they will never point to something, but are rather allocated and, hence, contiguous real(pReal), pointer, dimension(:,:), contiguous :: & ! a pointer is needed here because we might point to state/doState. However, they will never point to something, but are rather allocated and, hence, contiguous
state0, &
state, & !< state state, & !< state
dotState, & !< state rate dotState, & !< rate of state change
state0 deltaState !< increment of state change
real(pReal), allocatable, dimension(:,:) :: & real(pReal), allocatable, dimension(:,:) :: &
partionedState0, & partionedState0, &
subState0, & subState0, &
deltaState, &
previousDotState, & !< state rate of previous xxxx previousDotState, & !< state rate of previous xxxx
previousDotState2, & !< state rate two xxxx ago previousDotState2, & !< state rate two xxxx ago
RK4dotState RK4dotState