Merge branch 'development' into CCodeUse
This commit is contained in:
commit
e84e90448e
|
@ -53,7 +53,10 @@ if [ ! -z "$PS1" ]; then
|
||||||
[[ "x$SOLVER" != "x" ]] && echo "Spectral Solver $SOLVER"
|
[[ "x$SOLVER" != "x" ]] && echo "Spectral Solver $SOLVER"
|
||||||
[[ "x$PROCESSING" != "x" ]] && echo "Post Processing $PROCESSING"
|
[[ "x$PROCESSING" != "x" ]] && echo "Post Processing $PROCESSING"
|
||||||
echo "Multithreading DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS"
|
echo "Multithreading DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS"
|
||||||
[[ "x$PETSC_DIR" != "x" ]] && echo "PETSc location $PETSC_DIR"
|
if [ "x$PETSC_DIR" != "x" ]; then
|
||||||
|
echo "PETSc location $PETSC_DIR"
|
||||||
|
[[ `readlink -f $PETSC_DIR` == $PETSC_DIR ]] || echo " ~~> "`readlink -f $PETSC_DIR`
|
||||||
|
fi
|
||||||
[[ "x$PETSC_ARCH" != "x" ]] && echo "PETSc architecture $PETSC_ARCH"
|
[[ "x$PETSC_ARCH" != "x" ]] && echo "PETSc architecture $PETSC_ARCH"
|
||||||
echo "MSC.Marc/Mentat $MSC_ROOT"
|
echo "MSC.Marc/Mentat $MSC_ROOT"
|
||||||
echo
|
echo
|
||||||
|
|
|
@ -51,7 +51,10 @@ if [ ! -z "$PS1" ]; then
|
||||||
[[ "x$SOLVER" != "x" ]] && echo "Spectral Solver $SOLVER"
|
[[ "x$SOLVER" != "x" ]] && echo "Spectral Solver $SOLVER"
|
||||||
[[ "x$PROCESSING" != "x" ]] && echo "Post Processing $PROCESSING"
|
[[ "x$PROCESSING" != "x" ]] && echo "Post Processing $PROCESSING"
|
||||||
echo "Multithreading DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS"
|
echo "Multithreading DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS"
|
||||||
[[ "x$PETSC_DIR" != "x" ]] && echo "PETSc location $PETSC_DIR"
|
if [ "x$PETSC_DIR" != "x" ]; then
|
||||||
|
echo "PETSc location $PETSC_DIR"
|
||||||
|
[[ `readlink -f $PETSC_DIR` == $PETSC_DIR ]] || echo " ~~> "`readlink -f $PETSC_DIR`
|
||||||
|
fi
|
||||||
[[ "x$PETSC_ARCH" != "x" ]] && echo "PETSc architecture $PETSC_ARCH"
|
[[ "x$PETSC_ARCH" != "x" ]] && echo "PETSc architecture $PETSC_ARCH"
|
||||||
echo "MSC.Marc/Mentat $MSC_ROOT"
|
echo "MSC.Marc/Mentat $MSC_ROOT"
|
||||||
echo
|
echo
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
DAMASK_marc*.f90
|
DAMASK_marc*.f90
|
||||||
|
quit__genmod.f90
|
||||||
|
|
|
@ -329,7 +329,7 @@ program DAMASK_spectral
|
||||||
errorID = 838_pInt ! no rotation is allowed by stress BC
|
errorID = 838_pInt ! no rotation is allowed by stress BC
|
||||||
write(6,'(2x,a)') 'stress / GPa:'
|
write(6,'(2x,a)') 'stress / GPa:'
|
||||||
do i = 1_pInt, 3_pInt; do j = 1_pInt, 3_pInt
|
do i = 1_pInt, 3_pInt; do j = 1_pInt, 3_pInt
|
||||||
if(loadCases(currentLoadCase)%deformation%maskLogical(i,j)) then
|
if(loadCases(currentLoadCase)%P%maskLogical(i,j)) then
|
||||||
write(6,'(2x,f12.7)',advance='no') loadCases(currentLoadCase)%P%values(i,j)*1e-9_pReal
|
write(6,'(2x,f12.7)',advance='no') loadCases(currentLoadCase)%P%values(i,j)*1e-9_pReal
|
||||||
else
|
else
|
||||||
write(6,'(2x,12a)',advance='no') ' * '
|
write(6,'(2x,12a)',advance='no') ' * '
|
||||||
|
|
|
@ -184,14 +184,13 @@ subroutine plastic_isotropic_init(fileUnit)
|
||||||
if (IO_getTag(line,'[',']') /= '') then ! next section
|
if (IO_getTag(line,'[',']') /= '') then ! next section
|
||||||
phase = phase + 1_pInt ! advance section counter
|
phase = phase + 1_pInt ! advance section counter
|
||||||
if (phase_plasticity(phase) == PLASTICITY_ISOTROPIC_ID) then
|
if (phase_plasticity(phase) == PLASTICITY_ISOTROPIC_ID) then
|
||||||
instance = phase_plasticityInstance(phase)
|
instance = phase_plasticityInstance(phase) ! count instances of my constitutive law
|
||||||
|
allocate(param(instance)%outputID(phase_Noutput(phase))) ! allocate space for IDs of every requested output
|
||||||
endif
|
endif
|
||||||
cycle ! skip to next line
|
cycle ! skip to next line
|
||||||
endif
|
endif
|
||||||
if (phase > 0_pInt) then; if (phase_plasticity(phase) == PLASTICITY_ISOTROPIC_ID) then ! one of my phases. Do not short-circuit here (.and. between if-statements), it's not safe in Fortran
|
if (phase > 0_pInt) then; if (phase_plasticity(phase) == PLASTICITY_ISOTROPIC_ID) then ! one of my phases. Do not short-circuit here (.and. between if-statements), it's not safe in Fortran
|
||||||
instance = phase_plasticityInstance(phase) ! which instance of my plasticity is present phase
|
instance = phase_plasticityInstance(phase) ! which instance of my plasticity is present phase
|
||||||
allocate(param(instance)%outputID(phase_Noutput(phase))) ! allocate space for IDs of every requested output
|
|
||||||
chunkPos = IO_stringPos(line)
|
chunkPos = IO_stringPos(line)
|
||||||
tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key
|
tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key
|
||||||
extmsg = trim(tag)//' ('//PLASTICITY_ISOTROPIC_label//')' ! prepare error message identifier
|
extmsg = trim(tag)//' ('//PLASTICITY_ISOTROPIC_label//')' ! prepare error message identifier
|
||||||
|
|
|
@ -54,12 +54,12 @@ discrepancyPower_RGC 5.0
|
||||||
fixed_seed 0 # put any number larger than zero, integer, if you want to have a pseudo random distribution
|
fixed_seed 0 # put any number larger than zero, integer, if you want to have a pseudo random distribution
|
||||||
|
|
||||||
## spectral parameters ##
|
## spectral parameters ##
|
||||||
err_div_tolAbs 1.0e-3 # relative tolerance for fulfillment of stress equilibrium
|
err_div_tolAbs 1.0e-3 # absolute tolerance for fulfillment of stress equilibrium
|
||||||
err_div_tolRel 5.0e-4 # absolute tolerance for fulfillment of stress equilibrium
|
err_div_tolRel 5.0e-4 # relative tolerance for fulfillment of stress equilibrium
|
||||||
err_curl_tolAbs 1.0e-12 # relative tolerance for fulfillment of strain compatibility
|
err_curl_tolAbs 1.0e-12 # absolute tolerance for fulfillment of strain compatibility
|
||||||
err_curl_tolRel 5.0e-4 # absolute tolerance for fulfillment of strain compatibility
|
err_curl_tolRel 5.0e-4 # relative tolerance for fulfillment of strain compatibility
|
||||||
err_stress_tolrel 0.01 # relative tolerance for fulfillment of stress BC
|
err_stress_tolAbs 1.0e3 # absolute tolerance for fulfillment of stress BC
|
||||||
err_stress_tolabs 1.0e3 # absolute tolerance for fulfillment of stress BC
|
err_stress_tolRel 0.01 # relative tolerance for fulfillment of stress BC
|
||||||
fftw_timelimit -1.0 # timelimit of plan creation for FFTW, see manual on www.fftw.org, Default -1.0: disable timelimit
|
fftw_timelimit -1.0 # timelimit of plan creation for FFTW, see manual on www.fftw.org, Default -1.0: disable timelimit
|
||||||
rotation_tol 1.0e-12 # tolerance of rotation specified in loadcase, Default 1.0e-12: first guess
|
rotation_tol 1.0e-12 # tolerance of rotation specified in loadcase, Default 1.0e-12: first guess
|
||||||
fftw_plan_mode FFTW_PATIENT # reads the planing-rigor flag, see manual on www.fftw.org, Default FFTW_PATIENT: use patient planner flag
|
fftw_plan_mode FFTW_PATIENT # reads the planing-rigor flag, see manual on www.fftw.org, Default FFTW_PATIENT: use patient planner flag
|
||||||
|
|
|
@ -110,7 +110,7 @@ for name in filenames:
|
||||||
remarks = []
|
remarks = []
|
||||||
|
|
||||||
if table.label_dimension(options.coords) != 3: errors.append('coordinates {} are not a vector.'.format(options.coords))
|
if table.label_dimension(options.coords) != 3: errors.append('coordinates {} are not a vector.'.format(options.coords))
|
||||||
if not np.all(table.label_dimension(label) == dim): errors.append('input {} has wrong dimension {}.'.format(label,dim))
|
if not np.all(table.label_dimension(label) == dim): errors.append('input {} does not have dimension {}.'.format(label,dim))
|
||||||
else: column = table.label_index(label)
|
else: column = table.label_index(label)
|
||||||
|
|
||||||
if remarks != []: damask.util.croak(remarks)
|
if remarks != []: damask.util.croak(remarks)
|
||||||
|
|
|
@ -99,7 +99,7 @@ for name in filenames:
|
||||||
# ------------------------------------------ sanity checks ----------------------------------------
|
# ------------------------------------------ sanity checks ----------------------------------------
|
||||||
|
|
||||||
if not np.all(table.label_dimension(label) == dim):
|
if not np.all(table.label_dimension(label) == dim):
|
||||||
damask.util.croak('input {} has wrong dimension {}.'.format(label,dim))
|
damask.util.croak('input {} does not have dimension {}.'.format(label,dim))
|
||||||
table.close(dismiss = True) # close ASCIItable and remove empty file
|
table.close(dismiss = True) # close ASCIItable and remove empty file
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ for name in filenames:
|
||||||
errors = []
|
errors = []
|
||||||
remarks = []
|
remarks = []
|
||||||
|
|
||||||
if not np.all(table.label_dimension(label) == dim): errors.append('input {} has wrong dimension {}.'.format(label,dim))
|
if not np.all(table.label_dimension(label) == dim): errors.append('input {} does not have dimension {}.'.format(label,dim))
|
||||||
else: column = table.label_index(label)
|
else: column = table.label_index(label)
|
||||||
|
|
||||||
if remarks != []: damask.util.croak(remarks)
|
if remarks != []: damask.util.croak(remarks)
|
||||||
|
|
|
@ -101,7 +101,7 @@ for name in filenames:
|
||||||
errors = []
|
errors = []
|
||||||
remarks = []
|
remarks = []
|
||||||
|
|
||||||
if not np.all(table.label_dimension(label) == dim): errors.append('input {} has wrong dimension {}.'.format(label,dim))
|
if not np.all(table.label_dimension(label) == dim): errors.append('input {} does not have dimension {}.'.format(label,dim))
|
||||||
else: column = table.label_index(label)
|
else: column = table.label_index(label)
|
||||||
|
|
||||||
if remarks != []: damask.util.croak(remarks)
|
if remarks != []: damask.util.croak(remarks)
|
||||||
|
|
|
@ -1,100 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
|
||||||
|
|
||||||
import os,sys,numpy as np
|
|
||||||
from optparse import OptionParser
|
|
||||||
import damask
|
|
||||||
|
|
||||||
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
|
||||||
scriptID = ' '.join([scriptName,damask.version])
|
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------
|
|
||||||
# MAIN
|
|
||||||
# --------------------------------------------------------------------
|
|
||||||
|
|
||||||
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
|
|
||||||
Add Quaternions based on Crystal Frame Coordinates.
|
|
||||||
|
|
||||||
""", version = scriptID)
|
|
||||||
|
|
||||||
parser.add_option('-f','--frame',
|
|
||||||
dest='frame', nargs=4, type='string', metavar='<string string string string>',
|
|
||||||
help='heading of columns containing b* vector components and three frame vectors in that order')
|
|
||||||
parser.add_option('-s','--symmetry',
|
|
||||||
dest='crysym', nargs=1,type='string',metavar='<string>',
|
|
||||||
help='crystal symmetry definition')
|
|
||||||
parser.set_defaults(frame = None)
|
|
||||||
|
|
||||||
(options,filenames) = parser.parse_args()
|
|
||||||
|
|
||||||
if options.frame is None:
|
|
||||||
parser.error('no data column specified...')
|
|
||||||
|
|
||||||
datainfo = {'len':4,
|
|
||||||
'label':[]
|
|
||||||
}
|
|
||||||
|
|
||||||
if options.frame is not None: datainfo['label'] += options.frame
|
|
||||||
|
|
||||||
# --- loop over input files -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
if filenames == []: filenames = [None]
|
|
||||||
|
|
||||||
for name in filenames:
|
|
||||||
try:
|
|
||||||
table = damask.ASCIItable(name = name,
|
|
||||||
buffered = False)
|
|
||||||
except: continue
|
|
||||||
damask.util.report(scriptName,name)
|
|
||||||
|
|
||||||
table.head_read() # read ASCII header info
|
|
||||||
|
|
||||||
# --------------- figure out columns to process ---------------------------------------------------
|
|
||||||
active = []
|
|
||||||
column = {}
|
|
||||||
|
|
||||||
for label in datainfo['label']:
|
|
||||||
key = '1_'+label if datainfo['len'] > 1 else label # non-special labels have to start with '1_'
|
|
||||||
if key in table.labels:
|
|
||||||
active.append(label)
|
|
||||||
column[label] = table.labels.index(key) # remember columns of requested data
|
|
||||||
else:
|
|
||||||
damask.util.croak('column %s not found...'%label)
|
|
||||||
|
|
||||||
# ------------------------------------------ assemble header ---------------------------------------
|
|
||||||
|
|
||||||
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
|
||||||
table.labels_append(['Q_%i'%(i+1) for i in xrange(4)]) # extend ASCII header with new labels [1 real, 3 imaginary components]
|
|
||||||
table.head_write()
|
|
||||||
|
|
||||||
# ------------------------------------------ process data ------------------------------------------
|
|
||||||
outputAlive = True
|
|
||||||
while outputAlive and table.data_read(): # read next data line of ASCII table
|
|
||||||
vec = np.zeros([4,3])
|
|
||||||
for i,label in enumerate(active):
|
|
||||||
vec[i,:] = np.array(table.data[column[label]:
|
|
||||||
column[label]+3])
|
|
||||||
|
|
||||||
if sys.argv[1:][6]=='hexagonal': # Ensure Input matrix is orthogonal
|
|
||||||
M=np.dot(vec[0,:],vec[2,:])
|
|
||||||
vec[1,:]=vec[1,:]/np.linalg.norm(vec[1,:])
|
|
||||||
vec[2,:]=M*(vec[0,:]/np.linalg.norm(vec[0,:]))
|
|
||||||
vec[3,:]=vec[3,:]/np.linalg.norm(vec[3,:])
|
|
||||||
else:
|
|
||||||
vec[1,:]=vec[1,:]/np.linalg.norm(vec[1,:])
|
|
||||||
vec[2,:]=vec[2,:]/np.linalg.norm(vec[2,:])
|
|
||||||
vec[3,:]=vec[3,:]/np.linalg.norm(vec[3,:])
|
|
||||||
|
|
||||||
|
|
||||||
Ori=damask.Orientation(matrix=vec[1:,:],symmetry=sys.argv[1:][6])
|
|
||||||
|
|
||||||
table.data_append(np.asarray(Ori.asQuaternion()))
|
|
||||||
|
|
||||||
|
|
||||||
outputAlive = table.data_write() # output processed line
|
|
||||||
|
|
||||||
# ------------------------------------------ output result -----------------------------------------
|
|
||||||
outputAlive and table.output_flush() # just in case of buffered ASCII table
|
|
||||||
|
|
||||||
table.close() # close ASCII tables
|
|
|
@ -98,7 +98,7 @@ for name in filenames:
|
||||||
errors.append('column{} {} not found'.format('s' if len(missing_labels) > 1 else '',
|
errors.append('column{} {} not found'.format('s' if len(missing_labels) > 1 else '',
|
||||||
', '.join(missing_labels)))
|
', '.join(missing_labels)))
|
||||||
if table.label_dimension(options.label) != 3:
|
if table.label_dimension(options.label) != 3:
|
||||||
errors.append('column {} has wrong dimension'.format(options.label))
|
errors.append('column {} does not have dimension'.format(options.label))
|
||||||
|
|
||||||
if errors != []:
|
if errors != []:
|
||||||
damask.util.croak(errors)
|
damask.util.croak(errors)
|
||||||
|
|
|
@ -276,10 +276,10 @@ for name in filenames:
|
||||||
grid = np.vstack(meshgrid2(x, y, z)).reshape(3,-1).T
|
grid = np.vstack(meshgrid2(x, y, z)).reshape(3,-1).T
|
||||||
indices = laguerreTessellation(grid, coords, weights, grains, options.nonperiodic, options.cpus)
|
indices = laguerreTessellation(grid, coords, weights, grains, options.nonperiodic, options.cpus)
|
||||||
|
|
||||||
# --- write header ---------------------------------------------------------------------------------
|
# --- write header ------------------------------------------------------------------------
|
||||||
|
|
||||||
grainIDs = np.intersect1d(grainIDs,indices)
|
usedGrainIDs = np.intersect1d(grainIDs,indices)
|
||||||
info['microstructures'] = len(grainIDs)
|
info['microstructures'] = len(usedGrainIDs)
|
||||||
|
|
||||||
if info['homogenization'] == 0: info['homogenization'] = options.homogenization
|
if info['homogenization'] == 0: info['homogenization'] = options.homogenization
|
||||||
|
|
||||||
|
@ -292,13 +292,13 @@ for name in filenames:
|
||||||
])
|
])
|
||||||
|
|
||||||
config_header = []
|
config_header = []
|
||||||
formatwidth = 1+int(math.log10(info['microstructures']))
|
formatwidth = 1+int(math.log10(NgrainIDs))
|
||||||
|
|
||||||
phase = options.phase * np.ones(info['microstructures'],'i')
|
phase = options.phase * np.ones(NgrainIDs,'i')
|
||||||
if int(options.secondphase*info['microstructures']) > 0:
|
if int(options.secondphase*info['microstructures']) > 0:
|
||||||
phase[0:int(options.secondphase*info['microstructures'])] += 1
|
phase[0:int(options.secondphase*info['microstructures'])] += 1 # alter fraction 'options.secondphase' of used grainIDs
|
||||||
randomSeed = int(os.urandom(4).encode('hex'), 16) if options.randomSeed is None \
|
randomSeed = options.randomSeed if options.randomSeed \
|
||||||
else options.randomSeed # random seed for second phase
|
else int(os.urandom(4).encode('hex'), 16) # random seed for second phase
|
||||||
np.random.seed(randomSeed)
|
np.random.seed(randomSeed)
|
||||||
np.random.shuffle(phase)
|
np.random.shuffle(phase)
|
||||||
config_header += ['# random seed (phase shuffling): {}'.format(randomSeed)]
|
config_header += ['# random seed (phase shuffling): {}'.format(randomSeed)]
|
||||||
|
|
Loading…
Reference in New Issue