clarified fixed expression
This commit is contained in:
parent
1180c8bb88
commit
4a627161d5
|
@ -1,87 +1,74 @@
|
||||||
# sets up an environment for DAMASK on zsh
|
# sets up an environment for DAMASK on bash
|
||||||
# usage: source DAMASK_env.zsh
|
# usage: source DAMASK_env.sh
|
||||||
|
|
||||||
DAMASK_ROOT=${0:a:h}
|
if [ "$OSTYPE" = "linux-gnu" ] || [ "$OSTYPE" = 'linux' ]; then
|
||||||
|
DAMASK_ROOT=$(readlink -f "`dirname ${(%):-%N}`")
|
||||||
# defining set() allows to source the same file for tcsh and zsh, with and without space around =
|
else
|
||||||
set() {
|
print 'Not done yet'
|
||||||
export $1$2$3
|
|
||||||
}
|
|
||||||
source $DAMASK_ROOT/CONFIG
|
|
||||||
unset -f set
|
|
||||||
|
|
||||||
# add DAMASK_BIN if present but not yet in $PATH
|
|
||||||
MATCH=`echo ":$PATH:" | grep $DAMASK_BIN:`
|
|
||||||
if [[ ( "x$DAMASK_BIN" != "x" ) && ( "x$MATCH" = "x" ) ]]; then
|
|
||||||
export PATH=$DAMASK_BIN:$PATH
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[[ -f $HOME/.damask/damask.conf ]] && source $HOME/.damask/damask.conf || source /etc/damask.conf
|
||||||
|
|
||||||
|
# if DAMASK_BIN is present and not in $PATH, add it
|
||||||
|
#if [[ [[ "x$DAMASK_BIN" != "x" ]] && ! `echo ":$PATH:" | grep $DAMASK_BIN:` ]]; then
|
||||||
|
export PATH=$DAMASK_BIN:$PATH
|
||||||
|
#fi
|
||||||
|
|
||||||
SOLVER=`which DAMASK_spectral 2>/dev/null`
|
SOLVER=`which DAMASK_spectral 2>/dev/null`
|
||||||
|
if [ "x$SOLVER" = "x" ]; then
|
||||||
|
export SOLVER='Not found!'
|
||||||
|
fi
|
||||||
PROCESSING=`which postResults 2>/dev/null`
|
PROCESSING=`which postResults 2>/dev/null`
|
||||||
if [ "x$DAMASK_NUM_THREADS" = "x" ]; then
|
if [ "x$PROCESSING" = "x" ]; then
|
||||||
DAMASK_NUM_THREADS=1
|
export PROCESSING='Not found!'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# according to http://software.intel.com/en-us/forums/topic/501500
|
# according to http://software.intel.com/en-us/forums/topic/501500
|
||||||
# this seems to make sense for the stack size
|
# this seems to make sense for the stack size
|
||||||
if [ "`which free 2>/dev/null`" != "free not found" ]; then
|
#FREE=`which free 2>/dev/null`
|
||||||
freeMem=`free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}'`
|
#if [ "x$FREE" != "x" ]; then
|
||||||
|
# freeMem=`free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}'`
|
||||||
# http://superuser.com/questions/220059/what-parameters-has-ulimit
|
# heap=`expr $freeMem / 2`
|
||||||
ulimit -s `expr $freeMem / $DAMASK_NUM_THREADS / 2` 2>/dev/null # maximum stack size (kB)
|
# stack=`expr $freeMem / 2`
|
||||||
ulimit -d `expr $freeMem / 2` 2>/dev/null # maximum heap size (kB)
|
#
|
||||||
fi
|
# # http://superuser.com/questions/220059/what-parameters-has-ulimit
|
||||||
ulimit -v unlimited 2>/dev/null # maximum virtual memory size
|
# ulimit -s $stack 2>/dev/null # maximum stack size (kB)
|
||||||
|
# ulimit -d $heap 2>/dev/null # maximum heap size (kB)
|
||||||
|
#fi
|
||||||
|
#ulimit -c 2000 2>/dev/null # core file size (512-byte blocks)
|
||||||
|
#ulimit -v unlimited 2>/dev/null # maximum virtual memory size
|
||||||
ulimit -m unlimited 2>/dev/null # maximum physical memory size
|
ulimit -m unlimited 2>/dev/null # maximum physical memory size
|
||||||
|
|
||||||
# disable output in case of scp
|
# disable output in case of scp
|
||||||
if [ ! -z "$PS1" ]; then
|
if [ ! -z "$PS1" ]; then
|
||||||
echo
|
echo
|
||||||
echo Düsseldorf Advanced Materials Simulation Kit --- DAMASK
|
echo Düsseldorf Advanced Materials Simulation Kit - DAMASK
|
||||||
echo Max-Planck-Institut für Eisenforschung GmbH, Düsseldorf
|
echo Max-Planck-Institut für Eisenforschung, Düsseldorf
|
||||||
echo https://damask.mpie.de
|
echo http://damask.mpie.de
|
||||||
echo
|
echo
|
||||||
echo "Using environment with ..."
|
echo Using environment with ...
|
||||||
echo "DAMASK $DAMASK_ROOT"
|
echo "DAMASK $DAMASK_ROOT"
|
||||||
echo "Spectral Solver $SOLVER"
|
[[ "x$SOLVER" != "x" ]] && echo "Spectral Solver $SOLVER"
|
||||||
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"
|
||||||
if [ "x$PETSC_DIR" != "x" ]; then
|
if [ "x$PETSC_DIR" != "x" ]; then
|
||||||
echo "PETSc location $PETSC_DIR"
|
echo "PETSc location $PETSC_DIR"
|
||||||
[[ $(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$PETSC_DIR") == $PETSC_DIR ]] \
|
[[ `readlink -f $PETSC_DIR` == $PETSC_DIR ]] || echo " ~~> "`readlink -f $PETSC_DIR`
|
||||||
|| echo " ~~> "$(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$PETSC_DIR")
|
|
||||||
fi
|
fi
|
||||||
[[ "x$PETSC_ARCH" == "x" ]] \
|
[[ "x$PETSC_ARCH" != "x" ]] && echo "PETSc architecture $PETSC_ARCH"
|
||||||
|| echo "PETSc architecture $PETSC_ARCH"
|
|
||||||
echo "MSC.Marc/Mentat $MSC_ROOT"
|
echo "MSC.Marc/Mentat $MSC_ROOT"
|
||||||
echo
|
echo
|
||||||
echo -n "heap size "
|
echo -n "heap size/MiB "; echo "`ulimit -d`/1024" | bc
|
||||||
[[ "$(ulimit -d)" == "unlimited" ]] \
|
echo -n "stack size/MiB "; echo "`ulimit -s`/1024" | bc
|
||||||
&& echo "unlimited" \
|
|
||||||
|| echo $(python -c \
|
|
||||||
"import math; \
|
|
||||||
size=$(( 1024*$(ulimit -d) )); \
|
|
||||||
print('{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \
|
|
||||||
['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0]))")
|
|
||||||
echo -n "stack size "
|
|
||||||
[[ "$(ulimit -s)" == "unlimited" ]] \
|
|
||||||
&& echo "unlimited" \
|
|
||||||
|| echo $(python -c \
|
|
||||||
"import math; \
|
|
||||||
size=$(( 1024*$(ulimit -s) )); \
|
|
||||||
print('{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \
|
|
||||||
['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0]))")
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export DAMASK_NUM_THREADS
|
export DAMASK_NUM_THREADS
|
||||||
export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH
|
export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH
|
||||||
|
|
||||||
for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN MATCH; do
|
for var in BASE STAT SOLVER PROCESSING FREE; do
|
||||||
unset "${var}"
|
unset "${var}"
|
||||||
done
|
done
|
||||||
for var in DAMASK MSC; do
|
for var in DAMASK IMKL ACML LAPACK MSC FFTW HDF5; do
|
||||||
unset "${var}_ROOT"
|
unset "${var}_ROOT"
|
||||||
done
|
done
|
||||||
for var in ABAQUS MARC; do
|
|
||||||
unset "${var}_VERSION"
|
|
||||||
done
|
|
||||||
|
|
|
@ -99,15 +99,14 @@ for name in filenames:
|
||||||
|
|
||||||
|
|
||||||
for smoothIter in xrange(options.N):
|
for smoothIter in xrange(options.N):
|
||||||
boundary = np.zeros(microstructure.shape)
|
interfaceEnergy = np.zeros(microstructure.shape)
|
||||||
for i in (-1,0,1):
|
for i in (-1,0,1):
|
||||||
for j in (-1,0,1):
|
for j in (-1,0,1):
|
||||||
for k in (-1,0,1):
|
for k in (-1,0,1):
|
||||||
# assign interfacial energy to all voxels that have a differing neighbor (in Moore neighborhood)
|
# assign interfacial energy to all voxels that have a differing neighbor (in Moore neighborhood)
|
||||||
boundary = np.maximum(boundary,
|
interfaceEnergy = np.maximum(interfaceEnergy,
|
||||||
interfacialEnergy(microstructure,np.roll(np.roll(np.roll(
|
interfacialEnergy(microstructure,np.roll(np.roll(np.roll(
|
||||||
microstructure,i,axis=0), j,axis=1), k,axis=2)))
|
microstructure,i,axis=0), j,axis=1), k,axis=2)))
|
||||||
interfaceEnergy = boundary
|
|
||||||
|
|
||||||
# periodically extend interfacial energy array by half a grid size in positive and negative directions
|
# periodically extend interfacial energy array by half a grid size in positive and negative directions
|
||||||
periodic_interfaceEnergy = np.tile(interfaceEnergy,(3,3,3))[grid[0]/2:-grid[0]/2,
|
periodic_interfaceEnergy = np.tile(interfaceEnergy,(3,3,3))[grid[0]/2:-grid[0]/2,
|
||||||
|
|
Loading…
Reference in New Issue