Merge branch 'development' into DADF5_point_calculations-2
This commit is contained in:
commit
f6c921e811
|
@ -66,7 +66,7 @@ if filenames == []: filenames = [None]
|
|||
|
||||
for name in filenames:
|
||||
try:
|
||||
table = damask.ASCIItable(name = name, buffered = False)
|
||||
table = damask.ASCIItable(name = name)
|
||||
except IOError:
|
||||
continue
|
||||
damask.util.report(scriptName,name)
|
||||
|
|
|
@ -61,8 +61,8 @@ if filenames == []: filenames = [None]
|
|||
|
||||
for name in filenames:
|
||||
try:
|
||||
table = damask.ASCIItable(name = name, buffered = False)
|
||||
except:
|
||||
table = damask.ASCIItable(name = name)
|
||||
except IOError:
|
||||
continue
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
|
|
|
@ -47,9 +47,7 @@ if options.link is None:
|
|||
|
||||
if options.asciitable is not None and os.path.isfile(options.asciitable):
|
||||
|
||||
linkedTable = damask.ASCIItable(name = options.asciitable,
|
||||
buffered = False,
|
||||
readonly = True)
|
||||
linkedTable = damask.ASCIItable(name = options.asciitable, readonly = True)
|
||||
linkedTable.head_read() # read ASCII header info of linked table
|
||||
linkDim = linkedTable.label_dimension(options.link[1]) # dimension of linking column
|
||||
|
||||
|
@ -72,9 +70,10 @@ else:
|
|||
if filenames == []: filenames = [None]
|
||||
|
||||
for name in filenames:
|
||||
try: table = damask.ASCIItable(name = name,
|
||||
buffered = False)
|
||||
except: continue
|
||||
try:
|
||||
table = damask.ASCIItable(name = name)
|
||||
except IOError:
|
||||
continue
|
||||
damask.util.report(scriptName,"{} {} <== {} {}".format(name,damask.util.deemph('@ '+options.link[0]),
|
||||
options.asciitable,damask.util.deemph('@ '+options.link[1])))
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ if filenames == []: filenames = [None]
|
|||
|
||||
for name in filenames:
|
||||
try:
|
||||
table = damask.ASCIItable(name = name, buffered = False)
|
||||
table = damask.ASCIItable(name = name)
|
||||
except IOError:
|
||||
continue
|
||||
damask.util.report(scriptName,name)
|
||||
|
|
|
@ -182,9 +182,10 @@ slip_normal /= np.tile(np.linalg.norm(slip_normal ,axis=1),(3,1)).T
|
|||
if filenames == []: filenames = [None]
|
||||
|
||||
for name in filenames:
|
||||
try: table = damask.ASCIItable(name = name,
|
||||
buffered = False)
|
||||
except: continue
|
||||
try:
|
||||
table = damask.ASCIItable(name = name)
|
||||
except IOError:
|
||||
continue
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
# ------------------------------------------ read header ------------------------------------------
|
||||
|
|
|
@ -90,13 +90,14 @@ if options.weight is not None: labels += [options.weight]
|
|||
if filenames == []: filenames = [None]
|
||||
|
||||
for name in filenames:
|
||||
try: table = damask.ASCIItable(name = name,
|
||||
outname = os.path.join(os.path.dirname(name),
|
||||
'binned-{}-{}_'.format(*options.data) +
|
||||
('weighted-{}_'.format(options.weight) if options.weight else '') +
|
||||
os.path.basename(name)) if name else name,
|
||||
buffered = False)
|
||||
except: continue
|
||||
try:
|
||||
table = damask.ASCIItable(name = name,
|
||||
outname = os.path.join(os.path.dirname(name),
|
||||
'binned-{}-{}_'.format(*options.data) +
|
||||
('weighted-{}_'.format(options.weight) if options.weight else '') +
|
||||
os.path.basename(name)) if name else name)
|
||||
except IOError:
|
||||
continue
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
# ------------------------------------------ read header ------------------------------------------
|
||||
|
|
|
@ -21,7 +21,7 @@ def sortingList(labels,whitelistitems):
|
|||
names = []
|
||||
|
||||
for label in labels:
|
||||
if re.match('^\d+_',label):
|
||||
if re.match(r'^\d+_',label):
|
||||
indices.append(int(label.split('_',1)[0]))
|
||||
names.append(label.split('_',1)[1])
|
||||
else:
|
||||
|
@ -66,9 +66,10 @@ parser.set_defaults(condition = None,
|
|||
if filenames == []: filenames = [None]
|
||||
|
||||
for name in filenames:
|
||||
try: table = damask.ASCIItable(name = name,
|
||||
buffered = False)
|
||||
except: continue
|
||||
try:
|
||||
table = damask.ASCIItable(name = name)
|
||||
except IOError:
|
||||
continue
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
# ------------------------------------------ assemble info ---------------------------------------
|
||||
|
@ -143,7 +144,7 @@ for name in filenames:
|
|||
try:
|
||||
table.data_readArray(positions+1) # read desired columns (indexed 1,...)
|
||||
table.data_writeArray() # directly write out
|
||||
except:
|
||||
except Exception:
|
||||
table.data_rewind()
|
||||
atOnce = False # data contains items that prevent array chunking
|
||||
|
||||
|
|
|
@ -11,11 +11,12 @@ import damask
|
|||
|
||||
|
||||
def periodicAverage(coords, limits):
|
||||
"""Centroid in periodic domain, see https://en.wikipedia.org/wiki/Center_of_mass#Systems_with_periodic_boundary_conditions"""
|
||||
"""Centroid in periodic domain, see https://en.wikipedia.org/wiki/Center_of_mass#Systems_with_periodic_boundary_conditions."""
|
||||
theta = 2.0*np.pi * (coords - limits[0])/(limits[1] - limits[0])
|
||||
theta_avg = np.pi + np.arctan2(-np.sin(theta).mean(axis=0), -np.cos(theta).mean(axis=0))
|
||||
return limits[0] + theta_avg * (limits[1] - limits[0])/2.0/np.pi
|
||||
|
||||
|
||||
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
||||
scriptID = ' '.join([scriptName,damask.version])
|
||||
|
||||
|
@ -73,7 +74,7 @@ try:
|
|||
globals().get(funcModule) or
|
||||
__import__(funcModule),
|
||||
funcName)
|
||||
except:
|
||||
except Exception:
|
||||
mapFunction = None
|
||||
|
||||
if options.label is []:
|
||||
|
@ -87,9 +88,10 @@ if not hasattr(mapFunction,'__call__'):
|
|||
if filenames == []: filenames = [None]
|
||||
|
||||
for name in filenames:
|
||||
try: table = damask.ASCIItable(name = name,
|
||||
buffered = False)
|
||||
except: continue
|
||||
try:
|
||||
table = damask.ASCIItable(name = name)
|
||||
except IOError:
|
||||
continue
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
# ------------------------------------------ sanity checks ---------------------------------------
|
||||
|
|
|
@ -76,10 +76,10 @@ else:
|
|||
if filenames == []: filenames = [None]
|
||||
|
||||
for name in filenames:
|
||||
try: table = damask.ASCIItable(name = name,
|
||||
buffered = False,
|
||||
readonly = True)
|
||||
except: continue
|
||||
try:
|
||||
table = damask.ASCIItable(name = name, readonly = True)
|
||||
except IOError:
|
||||
continue
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
# ------------------------------------------ read header ------------------------------------------
|
||||
|
|
|
@ -117,11 +117,9 @@ if filenames == []: filenames = [None]
|
|||
|
||||
for name in filenames:
|
||||
try:
|
||||
table = damask.ASCIItable(name = name,
|
||||
buffered = False,
|
||||
labeled = options.label is not None,
|
||||
readonly = True)
|
||||
except: continue
|
||||
table = damask.ASCIItable(name = name, labeled = options.label is not None, readonly = True)
|
||||
except IOError:
|
||||
continue
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
# ------------------------------------------ read header ------------------------------------------
|
||||
|
|
|
@ -114,11 +114,10 @@ if filenames == []: filenames = [None]
|
|||
|
||||
for name in filenames:
|
||||
try:
|
||||
table = damask.ASCIItable(name = name,
|
||||
buffered = False,
|
||||
labeled = options.label is not None,
|
||||
readonly = True)
|
||||
except: continue
|
||||
table = damask.ASCIItable(name = name, readonly = True,
|
||||
labeled = options.label is not None)
|
||||
except IOError:
|
||||
continue
|
||||
table.report_name(scriptName,name)
|
||||
|
||||
# ------------------------------------------ read header ------------------------------------------
|
||||
|
|
|
@ -82,11 +82,10 @@ if filenames == []: filenames = [None]
|
|||
|
||||
for name in filenames:
|
||||
try:
|
||||
table = damask.ASCIItable(name = name,
|
||||
buffered = False,
|
||||
labeled = options.label is not None,
|
||||
readonly = True)
|
||||
except: continue
|
||||
table = damask.ASCIItable(name = name, readonly = True,
|
||||
labeled = options.label is not None)
|
||||
except IOError:
|
||||
continue
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
# ------------------------------------------ read header ------------------------------------------
|
||||
|
|
|
@ -51,8 +51,7 @@ if filenames == []: filenames = [None]
|
|||
|
||||
for name in filenames:
|
||||
try:
|
||||
table = damask.ASCIItable(name = name,
|
||||
buffered = False)
|
||||
table = damask.ASCIItable(name = name)
|
||||
except IOError:
|
||||
continue
|
||||
damask.util.report(scriptName,name)
|
||||
|
|
|
@ -52,9 +52,9 @@ if filenames == []: filenames = [None]
|
|||
|
||||
for name in filenames:
|
||||
try:
|
||||
table = damask.ASCIItable(name = name,
|
||||
buffered = False)
|
||||
except: continue
|
||||
table = damask.ASCIItable(name = name)
|
||||
except IOError:
|
||||
continue
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
# --- interpret header ----------------------------------------------------------------------------
|
||||
|
|
|
@ -60,9 +60,9 @@ if filenames == []: filenames = [None]
|
|||
|
||||
for name in filenames:
|
||||
try:
|
||||
table = damask.ASCIItable(name = name,
|
||||
buffered = False, labeled = options.labeled, readonly = True)
|
||||
except: continue
|
||||
table = damask.ASCIItable(name = name, labeled = options.labeled, readonly = True)
|
||||
except IOError:
|
||||
continue
|
||||
details = ', '.join(
|
||||
(['header'] if options.table else []) +
|
||||
(['info'] if options.head or options.info else []) +
|
||||
|
|
|
@ -234,7 +234,7 @@ if filenames == []: filenames = [None]
|
|||
|
||||
for name in filenames:
|
||||
try:
|
||||
table = damask.ASCIItable(name = name, buffered = False, readonly=True)
|
||||
table = damask.ASCIItable(name = name, readonly=True)
|
||||
except IOError:
|
||||
continue
|
||||
damask.util.report(scriptName,name)
|
||||
|
|
|
@ -966,9 +966,7 @@ if any(output in options.output for output in ['spectral','mentat']):
|
|||
if 'spectral' in options.output:
|
||||
fftdata = fftbuild(rcData, options.size, options.xmargin, options.ymargin, options.grid, options.extrusion)
|
||||
|
||||
table = damask.ASCIItable(outname = myName+'_'+str(int(fftdata['grid'][0]))+'.geom',
|
||||
labeled = False,
|
||||
buffered = False)
|
||||
table = damask.ASCIItable(outname = myName+'_'+str(int(fftdata['grid'][0]))+'.geom', labeled = False)
|
||||
table.labels_clear()
|
||||
table.info_clear()
|
||||
table.info_append([
|
||||
|
|
|
@ -14,7 +14,7 @@ scriptID = ' '.join([scriptName,damask.version])
|
|||
# ------------------------------------------ aux functions ---------------------------------
|
||||
|
||||
def kdtree_search(cloud, queryPoints):
|
||||
"""Find distances to nearest neighbor among cloud (N,d) for each of the queryPoints (n,d)"""
|
||||
"""Find distances to nearest neighbor among cloud (N,d) for each of the queryPoints (n,d)."""
|
||||
n = queryPoints.shape[0]
|
||||
distances = np.zeros(n,dtype=float)
|
||||
tree = spatial.cKDTree(cloud)
|
||||
|
@ -23,7 +23,8 @@ def kdtree_search(cloud, queryPoints):
|
|||
distances[i], index = tree.query(queryPoints[i])
|
||||
|
||||
return distances
|
||||
|
||||
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# MAIN
|
||||
# --------------------------------------------------------------------
|
||||
|
@ -132,9 +133,10 @@ random.seed(options.randomSeed)
|
|||
if filenames == []: filenames = [None]
|
||||
|
||||
for name in filenames:
|
||||
try: table = damask.ASCIItable(outname = name,
|
||||
buffered = False)
|
||||
except: continue
|
||||
try:
|
||||
table = damask.ASCIItable(outname = name)
|
||||
except IOError:
|
||||
continue
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
# --- sanity checks -------------------------------------------------------------------------
|
||||
|
|
|
@ -148,7 +148,7 @@ class Geom():
|
|||
"""
|
||||
if microstructure is not None:
|
||||
if len(microstructure.shape) != 3:
|
||||
raise ValueError('Invalid microstructure shape {}'.format(*microstructure.shape))
|
||||
raise ValueError('Invalid microstructure shape {}'.format(microstructure.shape))
|
||||
elif microstructure.dtype not in np.sctypes['float'] + np.sctypes['int']:
|
||||
raise TypeError('Invalid data type {} for microstructure'.format(microstructure.dtype))
|
||||
else:
|
||||
|
@ -169,7 +169,7 @@ class Geom():
|
|||
self.size = grid/np.max(grid)
|
||||
else:
|
||||
if len(size) != 3 or any(np.array(size)<=0):
|
||||
raise ValueError('Invalid size {}'.format(*size))
|
||||
raise ValueError('Invalid size {}'.format(size))
|
||||
else:
|
||||
self.size = np.array(size)
|
||||
|
||||
|
@ -185,7 +185,7 @@ class Geom():
|
|||
"""
|
||||
if origin is not None:
|
||||
if len(origin) != 3:
|
||||
raise ValueError('Invalid origin {}'.format(*origin))
|
||||
raise ValueError('Invalid origin {}'.format(origin))
|
||||
else:
|
||||
self.origin = np.array(origin)
|
||||
|
||||
|
@ -297,7 +297,7 @@ class Geom():
|
|||
i += len(items)
|
||||
|
||||
if i != grid.prod():
|
||||
raise TypeError('Invalid file: expected {} entries,found {}'.format(grid.prod(),i))
|
||||
raise TypeError('Invalid file: expected {} entries, found {}'.format(grid.prod(),i))
|
||||
|
||||
microstructure = microstructure.reshape(grid,order='F')
|
||||
if not np.any(np.mod(microstructure.flatten(),1) != 0.0): # no float present
|
||||
|
@ -458,7 +458,7 @@ class Geom():
|
|||
if not all(isinstance(d, str) for d in directions):
|
||||
raise TypeError('Directions are not of type str.')
|
||||
elif not set(directions).issubset(valid):
|
||||
raise ValueError('Invalid direction specified {}'.format(*set(directions).difference(valid)))
|
||||
raise ValueError('Invalid direction specified {}'.format(set(directions).difference(valid)))
|
||||
|
||||
limits = [None,None] if reflect else [-2,0]
|
||||
ms = self.get_microstructure()
|
||||
|
|
|
@ -189,10 +189,10 @@ end function IO_isBlank
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
pure function IO_getTag(string,openChar,closeChar)
|
||||
|
||||
character(len=:), allocatable :: IO_getTag
|
||||
character(len=*), intent(in) :: string !< string to check for tag
|
||||
character, intent(in) :: openChar, & !< indicates beginning of tag
|
||||
closeChar !< indicates end of tag
|
||||
character(len=:), allocatable :: IO_getTag
|
||||
|
||||
character(len=*), parameter :: SEP=achar(32)//achar(9)//achar(10)//achar(13) ! whitespaces
|
||||
integer :: left,right
|
||||
|
@ -222,8 +222,8 @@ end function IO_getTag
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
pure function IO_stringPos(string)
|
||||
|
||||
integer, dimension(:), allocatable :: IO_stringPos
|
||||
character(len=*), intent(in) :: string !< string in which chunk positions are searched for
|
||||
integer, dimension(:), allocatable :: IO_stringPos
|
||||
|
||||
character(len=*), parameter :: SEP=achar(44)//achar(32)//achar(9)//achar(10)//achar(13) ! comma and whitespaces
|
||||
integer :: left, right
|
||||
|
|
|
@ -57,7 +57,6 @@ module crystallite
|
|||
crystallite_Li0, & !< intermediate velocitiy grad at start of FE inc
|
||||
crystallite_partionedLi0 !< intermediate velocity grad at start of homog inc
|
||||
real(pReal), dimension(:,:,:,:,:), allocatable :: &
|
||||
crystallite_subS0, & !< 2nd Piola-Kirchhoff stress vector at start of crystallite inc
|
||||
crystallite_invFp, & !< inverse of current plastic def grad (end of converged time step)
|
||||
crystallite_subFp0,& !< plastic def grad at start of crystallite inc
|
||||
crystallite_invFi, & !< inverse of current intermediate def grad (end of converged time step)
|
||||
|
@ -136,7 +135,6 @@ subroutine crystallite_init
|
|||
allocate(crystallite_S0(3,3,cMax,iMax,eMax), source=0.0_pReal)
|
||||
allocate(crystallite_partionedS0(3,3,cMax,iMax,eMax), source=0.0_pReal)
|
||||
allocate(crystallite_S(3,3,cMax,iMax,eMax), source=0.0_pReal)
|
||||
allocate(crystallite_subS0(3,3,cMax,iMax,eMax), source=0.0_pReal)
|
||||
allocate(crystallite_P(3,3,cMax,iMax,eMax), source=0.0_pReal)
|
||||
allocate(crystallite_F0(3,3,cMax,iMax,eMax), source=0.0_pReal)
|
||||
allocate(crystallite_partionedF0(3,3,cMax,iMax,eMax), source=0.0_pReal)
|
||||
|
@ -351,7 +349,6 @@ function crystallite_stress(dummyArgumentToPreventInternalCompilerErrorWithGCC)
|
|||
crystallite_subFi0(1:3,1:3,c,i,e) = crystallite_partionedFi0(1:3,1:3,c,i,e)
|
||||
crystallite_subLi0(1:3,1:3,c,i,e) = crystallite_partionedLi0(1:3,1:3,c,i,e)
|
||||
crystallite_subF0(1:3,1:3,c,i,e) = crystallite_partionedF0(1:3,1:3,c,i,e)
|
||||
crystallite_subS0(1:3,1:3,c,i,e) = crystallite_partionedS0(1:3,1:3,c,i,e)
|
||||
crystallite_subFrac(c,i,e) = 0.0_pReal
|
||||
crystallite_subStep(c,i,e) = 1.0_pReal/num%subStepSizeCryst
|
||||
crystallite_todo(c,i,e) = .true.
|
||||
|
@ -397,7 +394,6 @@ function crystallite_stress(dummyArgumentToPreventInternalCompilerErrorWithGCC)
|
|||
crystallite_subLi0(1:3,1:3,c,i,e) = crystallite_Li (1:3,1:3,c,i,e)
|
||||
crystallite_subFp0(1:3,1:3,c,i,e) = crystallite_Fp (1:3,1:3,c,i,e)
|
||||
crystallite_subFi0(1:3,1:3,c,i,e) = crystallite_Fi (1:3,1:3,c,i,e)
|
||||
crystallite_subS0 (1:3,1:3,c,i,e) = crystallite_S (1:3,1:3,c,i,e)
|
||||
!if abbrevation, make c and p private in omp
|
||||
plasticState( material_phaseAt(c,e))%subState0(:,material_phaseMemberAt(c,i,e)) &
|
||||
= plasticState(material_phaseAt(c,e))%state( :,material_phaseMemberAt(c,i,e))
|
||||
|
|
Loading…
Reference in New Issue