exchanged location of "graincount" in user block.
now matches wiki entry: 1. homogenization block 2. grain block (grain count sub-block[s] of crystallite and constitutive)
This commit is contained in:
parent
e8f5996a96
commit
f685bbba0e
|
@ -558,25 +558,25 @@ subroutine materialpoint_postResults(dt)
|
||||||
integer(pInt) g,i,e,thePos,theSize,myNgrains,myCrystallite
|
integer(pInt) g,i,e,thePos,theSize,myNgrains,myCrystallite
|
||||||
|
|
||||||
!$OMP PARALLEL DO PRIVATE(myNgrains,myCrystallite,thePos,theSize)
|
!$OMP PARALLEL DO PRIVATE(myNgrains,myCrystallite,thePos,theSize)
|
||||||
do e = FEsolving_execElem(1),FEsolving_execElem(2) ! iterate over elements to be processed
|
do e = FEsolving_execElem(1),FEsolving_execElem(2) ! iterate over elements to be processed
|
||||||
myNgrains = homogenization_Ngrains(mesh_element(3,e))
|
myNgrains = homogenization_Ngrains(mesh_element(3,e))
|
||||||
myCrystallite = microstructure_crystallite(mesh_element(4,e))
|
myCrystallite = microstructure_crystallite(mesh_element(4,e))
|
||||||
do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e) ! iterate over IPs of this element to be processed
|
do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e) ! iterate over IPs of this element to be processed
|
||||||
thePos = 0_pInt
|
thePos = 0_pInt
|
||||||
|
|
||||||
materialpoint_results(thePos+1,i,e) = myNgrains ! tell number of grains at materialpoint
|
|
||||||
thePos = thePos + 1_pInt
|
|
||||||
|
|
||||||
theSize = homogenization_sizePostResults(i,e)
|
theSize = homogenization_sizePostResults(i,e)
|
||||||
materialpoint_results(thePos+1,i,e) = theSize ! tell size of homogenization results
|
materialpoint_results(thePos+1,i,e) = theSize ! tell size of homogenization results
|
||||||
thePos = thePos + 1_pInt
|
thePos = thePos + 1_pInt
|
||||||
|
|
||||||
if (theSize > 0_pInt) then ! any homogenization results to mention?
|
if (theSize > 0_pInt) then ! any homogenization results to mention?
|
||||||
materialpoint_results(thePos+1:thePos+theSize,i,e) = homogenization_postResults(i,e) ! tell homogenization results
|
materialpoint_results(thePos+1:thePos+theSize,i,e) = homogenization_postResults(i,e) ! tell homogenization results
|
||||||
thePos = thePos + theSize
|
thePos = thePos + theSize
|
||||||
endif
|
endif
|
||||||
|
|
||||||
do g = 1,myNgrains ! loop over all grains
|
materialpoint_results(thePos+1,i,e) = myNgrains ! tell number of grains at materialpoint
|
||||||
|
thePos = thePos + 1_pInt
|
||||||
|
|
||||||
|
do g = 1,myNgrains ! loop over all grains
|
||||||
theSize = (1 + crystallite_sizePostResults(myCrystallite)) + (1 + constitutive_sizePostResults(g,i,e))
|
theSize = (1 + crystallite_sizePostResults(myCrystallite)) + (1 + constitutive_sizePostResults(g,i,e))
|
||||||
materialpoint_results(thePos+1:thePos+theSize,i,e) = crystallite_postResults(dt,g,i,e) ! tell crystallite results
|
materialpoint_results(thePos+1:thePos+theSize,i,e) = crystallite_postResults(dt,g,i,e) ! tell crystallite results
|
||||||
thePos = thePos + theSize
|
thePos = thePos + theSize
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import pdb, os, sys, gc, math, re, threading, time, struct, string
|
import pdb, os, sys, gc, math, re, threading, time, struct, string
|
||||||
|
import msc_tools
|
||||||
from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP
|
from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP
|
||||||
|
|
||||||
|
|
||||||
fileExtensions = { \
|
fileExtensions = { \
|
||||||
'marc': ['.t16',],
|
'marc': ['.t16',],
|
||||||
'spectral': ['.spectralOut',],
|
'spectral': ['.spectralOut',],
|
||||||
|
@ -489,12 +491,15 @@ def ParseOutputFormat(filename,what,me):
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
def ParsePostfile(p,filename, outputFormat):
|
def ParsePostfile(p,filename, outputFormat, legacyFormat):
|
||||||
#
|
#
|
||||||
# parse postfile in order to get position and labels of outputs
|
# parse postfile in order to get position and labels of outputs
|
||||||
# needs "outputFormat" for mapping of output names to postfile output indices
|
# needs "outputFormat" for mapping of output names to postfile output indices
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
|
|
||||||
|
startVar = {True: 'GrainCount',
|
||||||
|
False:'HomogenizationCount'}
|
||||||
|
|
||||||
# --- build statistics
|
# --- build statistics
|
||||||
|
|
||||||
stat = { \
|
stat = { \
|
||||||
|
@ -529,47 +534,61 @@ def ParsePostfile(p,filename, outputFormat):
|
||||||
stat['IndexOfLabel'][label] = labelIndex
|
stat['IndexOfLabel'][label] = labelIndex
|
||||||
stat['LabelOfElementalTensor'][labelIndex] = label
|
stat['LabelOfElementalTensor'][labelIndex] = label
|
||||||
|
|
||||||
if 'User Defined Variable 1' in stat['IndexOfLabel']:
|
if 'User Defined Variable 1' in stat['IndexOfLabel']: # output format without dedicated names?
|
||||||
stat['IndexOfLabel']['GrainCount'] = stat['IndexOfLabel']['User Defined Variable 1']
|
stat['IndexOfLabel'][startVar[legacyFormat]] = stat['IndexOfLabel']['User Defined Variable 1'] # adjust first named entry
|
||||||
|
|
||||||
if 'GrainCount' in stat['IndexOfLabel']: # does the result file contain relevant user defined output at all?
|
if startVar[legacyFormat] in stat['IndexOfLabel']: # does the result file contain relevant user defined output at all?
|
||||||
startIndex = stat['IndexOfLabel']['GrainCount'] - 1
|
startIndex = stat['IndexOfLabel'][startVar[legacyFormat]]
|
||||||
|
stat['LabelOfElementalScalar'][startIndex] = startVar[legacyFormat]
|
||||||
|
|
||||||
# We now have to find a mapping for each output label as defined in the .output* files to the output position in the post file
|
# We now have to find a mapping for each output label as defined in the .output* files to the output position in the post file
|
||||||
# Since we know where the user defined outputs start ("startIndex"), we can simply assign increasing indices to the labels
|
# Since we know where the user defined outputs start ("startIndex"), we can simply assign increasing indices to the labels
|
||||||
# given in the .output* file
|
# given in the .output* file
|
||||||
|
|
||||||
offset = 2
|
offset = 1
|
||||||
stat['LabelOfElementalScalar'][startIndex + offset] = 'HomogenizationCount'
|
if legacyFormat:
|
||||||
for var in outputFormat['Homogenization']['outputs']:
|
stat['LabelOfElementalScalar'][startIndex + offset] = startVar[not legacyFormat] # add HomogenizationCount as second
|
||||||
if var[1] > 1:
|
offset += 1
|
||||||
for i in range(var[1]):
|
|
||||||
stat['IndexOfLabel']['%i_%s'%(i+1,var[0])] = startIndex + offset + (i+1)
|
for (name,N) in outputFormat['Homogenization']['outputs']:
|
||||||
else:
|
for i in range(N):
|
||||||
stat['IndexOfLabel']['%s'%(var[0])] = startIndex + offset + 1
|
label = {False: '%s'%( name),
|
||||||
offset += var[1]
|
True:'%i_%s'%(i+1,name)}[N > 1]
|
||||||
|
stat['IndexOfLabel'][label] = startIndex + offset
|
||||||
|
stat['LabelOfElementalScalar'][startIndex + offset] = label
|
||||||
|
offset += 1
|
||||||
|
|
||||||
|
if not legacyFormat:
|
||||||
|
stat['IndexOfLabel'][startVar[not legacyFormat]] = startIndex + offset
|
||||||
|
stat['LabelOfElementalScalar'][startIndex + offset] = startVar[not legacyFormat] # add GrainCount
|
||||||
|
offset += 1
|
||||||
|
|
||||||
if '(ngrains)' in outputFormat['Homogenization']['specials']:
|
if '(ngrains)' in outputFormat['Homogenization']['specials']:
|
||||||
for grain in range(outputFormat['Homogenization']['specials']['(ngrains)']):
|
for grain in range(outputFormat['Homogenization']['specials']['(ngrains)']):
|
||||||
stat['IndexOfLabel']['%i_CrystalliteCount'%(grain+1)] = startIndex + offset + 1
|
|
||||||
offset += 1
|
|
||||||
for var in outputFormat['Crystallite']['outputs']:
|
|
||||||
if var[1] > 1:
|
|
||||||
for i in range(var[1]):
|
|
||||||
stat['IndexOfLabel']['%i_%i_%s'%(grain+1,i+1,var[0])] = startIndex + offset + (i+1)
|
|
||||||
else:
|
|
||||||
stat['IndexOfLabel']['%i_%s'%(grain+1,var[0])] = startIndex + offset + 1
|
|
||||||
offset += var[1]
|
|
||||||
|
|
||||||
stat['IndexOfLabel']['%i_ConstitutiveCount'%(grain+1)] = startIndex + offset + 1
|
stat['IndexOfLabel']['%i_CrystalliteCount'%(grain+1)] = startIndex + offset # report crystallite count
|
||||||
|
stat['LabelOfElementalScalar'][startIndex + offset] = '%i_CrystalliteCount'%(grain+1) # add GrainCount
|
||||||
offset += 1
|
offset += 1
|
||||||
for var in outputFormat['Constitutive']['outputs']:
|
|
||||||
if var[1] > 1:
|
for (name,N) in outputFormat['Crystallite']['outputs']: # add crystallite outputs
|
||||||
for i in range(var[1]):
|
for i in range(N):
|
||||||
stat['IndexOfLabel']['%i_%i_%s'%(grain+1,i+1,var[0])] = startIndex + offset + (i+1)
|
label = {False: '%i_%s'%(grain+1, name),
|
||||||
else:
|
True:'%i_%i_%s'%(grain+1,i+1,name)}[N > 1]
|
||||||
stat['IndexOfLabel']['%i_%s'%(grain+1,var[0])] = startIndex + offset + 1
|
stat['IndexOfLabel'][label] = startIndex + offset
|
||||||
offset += var[1]
|
stat['LabelOfElementalScalar'][startIndex + offset] = label
|
||||||
|
offset += 1
|
||||||
|
|
||||||
|
stat['IndexOfLabel']['%i_ConstitutiveCount'%(grain+1)] = startIndex + offset # report constitutive count
|
||||||
|
stat['LabelOfElementalScalar'][startIndex + offset] = '%i_ConstitutiveCount'%(grain+1) # add GrainCount
|
||||||
|
offset += 1
|
||||||
|
|
||||||
|
for (name,N) in outputFormat['Constitutive']['outputs']: # add constitutive outputs
|
||||||
|
for i in range(N):
|
||||||
|
label = {False: '%i_%s'%(grain+1, name),
|
||||||
|
True:'%i_%i_%s'%(grain+1,i+1,name)}[N > 1]
|
||||||
|
stat['IndexOfLabel'][label] = startIndex + offset
|
||||||
|
stat['LabelOfElementalScalar'][startIndex + offset] = label
|
||||||
|
offset += 1
|
||||||
|
|
||||||
return stat
|
return stat
|
||||||
|
|
||||||
|
@ -619,6 +638,8 @@ of already processed data points for evaluation.
|
||||||
|
|
||||||
parser.add_option('-i','--info', action='store_true', dest='info', \
|
parser.add_option('-i','--info', action='store_true', dest='info', \
|
||||||
help='list contents of resultfile [%default]')
|
help='list contents of resultfile [%default]')
|
||||||
|
parser.add_option('-l','--legacy', action='store_true', dest='legacy', \
|
||||||
|
help='legacy user result block (starts with GrainCount) [%default]')
|
||||||
parser.add_option( '--prefix', dest='prefix', \
|
parser.add_option( '--prefix', dest='prefix', \
|
||||||
help='prefix to result file name [%default]')
|
help='prefix to result file name [%default]')
|
||||||
parser.add_option('-d','--dir', dest='dir', \
|
parser.add_option('-d','--dir', dest='dir', \
|
||||||
|
@ -676,6 +697,7 @@ 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)
|
||||||
parser.set_defaults(sloppy = False)
|
parser.set_defaults(sloppy = False)
|
||||||
parser.set_defaults(prefix = '')
|
parser.set_defaults(prefix = '')
|
||||||
parser.set_defaults(dir = 'postProc')
|
parser.set_defaults(dir = 'postProc')
|
||||||
|
@ -726,27 +748,12 @@ if options.filetype not in ['marc','spectral']:
|
||||||
parser.error('file type "%s" not supported...'%options.filetype)
|
parser.error('file type "%s" not supported...'%options.filetype)
|
||||||
|
|
||||||
if options.filetype == 'marc':
|
if options.filetype == 'marc':
|
||||||
try:
|
sys.path.append(msc_tools.MSC_TOOLS().libraryPath(sys.argv[0],'../../'))
|
||||||
file = open('%s/../MSCpath'%os.path.dirname(os.path.realpath(sys.argv[0])))
|
|
||||||
MSCpath = os.path.normpath(file.readline().strip())
|
|
||||||
file.close()
|
|
||||||
except:
|
|
||||||
MSCpath = '/msc'
|
|
||||||
|
|
||||||
for release,subdirs in sorted(releases.items(),reverse=True):
|
|
||||||
for subdir in subdirs:
|
|
||||||
libPath = '%s/mentat%s/shlib/%s'%(MSCpath,release,subdir)
|
|
||||||
if os.path.exists(libPath):
|
|
||||||
sys.path.append(libPath)
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
continue
|
|
||||||
break
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from py_post import *
|
from py_post import *
|
||||||
except:
|
except:
|
||||||
print('error: no valid Mentat release found in %s'%MSCpath)
|
print('error: no valid Mentat release found')
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
else:
|
else:
|
||||||
def post_open():
|
def post_open():
|
||||||
|
@ -803,7 +810,7 @@ for what in me:
|
||||||
bg.set_message('opening result file...')
|
bg.set_message('opening result file...')
|
||||||
p = OpenPostfile(filename+extension,options.filetype)
|
p = OpenPostfile(filename+extension,options.filetype)
|
||||||
bg.set_message('parsing result file...')
|
bg.set_message('parsing result file...')
|
||||||
stat = ParsePostfile(p, filename, outputFormat)
|
stat = ParsePostfile(p, filename, outputFormat,options.legacy)
|
||||||
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)
|
||||||
|
|
||||||
|
@ -824,7 +831,7 @@ for opt in ['nodalScalar','elemScalar','elemTensor','homogenizationResult','crys
|
||||||
|
|
||||||
if options.info:
|
if options.info:
|
||||||
if options.filetype == 'marc':
|
if options.filetype == 'marc':
|
||||||
print '\n\nMentat release %s'%release
|
print '\n\nMentat release %s'%msc_tools.MSC_TOOLS().version(sys.argv[0],'../../')
|
||||||
if options.filetype == 'spectral':
|
if options.filetype == 'spectral':
|
||||||
print '\n\n',p
|
print '\n\n',p
|
||||||
|
|
||||||
|
|
|
@ -105,14 +105,15 @@ for file in files:
|
||||||
print '\n'.join(map(lambda x:' '+x,outputFormat[what]['specials']['brothers']))
|
print '\n'.join(map(lambda x:' '+x,outputFormat[what]['specials']['brothers']))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
UserVars = ['GrainCount']
|
UserVars = ['HomogenizationCount']
|
||||||
|
|
||||||
UserVars += ['HomogenizationCount']
|
|
||||||
for var in outputFormat['Homogenization']['outputs']:
|
for var in outputFormat['Homogenization']['outputs']:
|
||||||
if var[1] > 1:
|
if var[1] > 1:
|
||||||
UserVars += ['%i_%s'%(i+1,var[0]) for i in range(var[1])]
|
UserVars += ['%i_%s'%(i+1,var[0]) for i in range(var[1])]
|
||||||
else:
|
else:
|
||||||
UserVars += ['%s'%(var[0]) for i in range(var[1])]
|
UserVars += ['%s'%(var[0]) for i in range(var[1])]
|
||||||
|
|
||||||
|
UserVars += ['GrainCount']
|
||||||
|
|
||||||
for grain in range(outputFormat['Homogenization']['specials']['(ngrains)']):
|
for grain in range(outputFormat['Homogenization']['specials']['(ngrains)']):
|
||||||
UserVars += ['%i_CrystalliteCount'%(grain+1)]
|
UserVars += ['%i_CrystalliteCount'%(grain+1)]
|
||||||
for var in outputFormat['Crystallite']['outputs']:
|
for var in outputFormat['Crystallite']['outputs']:
|
||||||
|
|
Loading…
Reference in New Issue