Merge remote-tracking branch 'origin/development' into 56-parallel-hdf5
This commit is contained in:
commit
1192f16582
|
@ -158,12 +158,12 @@ Post_AverageDown:
|
||||||
- master
|
- master
|
||||||
- release
|
- release
|
||||||
|
|
||||||
#Post_General:
|
Post_General:
|
||||||
# stage: postprocessing
|
stage: postprocessing
|
||||||
# script: PostProcessing/test.py
|
script: PostProcessing/test.py
|
||||||
# except:
|
except:
|
||||||
# - master
|
- master
|
||||||
# - release
|
- release
|
||||||
|
|
||||||
Post_GeometryReconstruction:
|
Post_GeometryReconstruction:
|
||||||
stage: postprocessing
|
stage: postprocessing
|
||||||
|
@ -373,12 +373,12 @@ Phenopowerlaw_singleSlip:
|
||||||
- master
|
- master
|
||||||
- release
|
- release
|
||||||
|
|
||||||
#TextureComponents:
|
TextureComponents:
|
||||||
# stage: spectral
|
stage: spectral
|
||||||
# script: TextureComponents/test.py
|
script: TextureComponents/test.py
|
||||||
# except:
|
except:
|
||||||
# - master
|
- master
|
||||||
# - release
|
- release
|
||||||
|
|
||||||
|
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
|
@ -477,27 +477,24 @@ AbaqusStd:
|
||||||
script:
|
script:
|
||||||
- module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel $Doxygen
|
- module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel $Doxygen
|
||||||
- $DAMASKROOT/PRIVATE/documenting/runDoxygen.sh $DAMASKROOT abaqus
|
- $DAMASKROOT/PRIVATE/documenting/runDoxygen.sh $DAMASKROOT abaqus
|
||||||
except:
|
only:
|
||||||
- master
|
- development
|
||||||
- release
|
|
||||||
|
|
||||||
Marc:
|
Marc:
|
||||||
stage: createDocumentation
|
stage: createDocumentation
|
||||||
script:
|
script:
|
||||||
- module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel $Doxygen
|
- module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel $Doxygen
|
||||||
- $DAMASKROOT/PRIVATE/documenting/runDoxygen.sh $DAMASKROOT marc
|
- $DAMASKROOT/PRIVATE/documenting/runDoxygen.sh $DAMASKROOT marc
|
||||||
except:
|
only:
|
||||||
- master
|
- development
|
||||||
- release
|
|
||||||
|
|
||||||
Spectral:
|
Spectral:
|
||||||
stage: createDocumentation
|
stage: createDocumentation
|
||||||
script:
|
script:
|
||||||
- module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel $Doxygen
|
- module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel $Doxygen
|
||||||
- $DAMASKROOT/PRIVATE/documenting/runDoxygen.sh $DAMASKROOT spectral
|
- $DAMASKROOT/PRIVATE/documenting/runDoxygen.sh $DAMASKROOT spectral
|
||||||
except:
|
only:
|
||||||
- master
|
- development
|
||||||
- release
|
|
||||||
|
|
||||||
##################################################################################################
|
##################################################################################################
|
||||||
backupData:
|
backupData:
|
||||||
|
|
|
@ -79,7 +79,7 @@ ls $PETSC_DIR/lib
|
||||||
|
|
||||||
firstLevel "Python"
|
firstLevel "Python"
|
||||||
DEFAULT_PYTHON=python3
|
DEFAULT_PYTHON=python3
|
||||||
for executable in python python2 python3 python2.7; do
|
for executable in python python3; do
|
||||||
getDetails $executable '--version'
|
getDetails $executable '--version'
|
||||||
done
|
done
|
||||||
secondLevel "Details on $DEFAULT_PYTHON:"
|
secondLevel "Details on $DEFAULT_PYTHON:"
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
||||||
Copyright 2011-18 Max-Planck-Institut für Eisenforschung GmbH
|
Copyright 2011-19 Max-Planck-Institut für Eisenforschung GmbH
|
||||||
|
|
||||||
DAMASK is free software: you can redistribute it and/or modify
|
DAMASK is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -7,11 +7,11 @@ all: spectral FEM processing
|
||||||
|
|
||||||
.PHONY: spectral
|
.PHONY: spectral
|
||||||
spectral: build/spectral
|
spectral: build/spectral
|
||||||
@(cd build/spectral;make --no-print-directory -ws all install;)
|
@(cd build/spectral;make -j4 --no-print-directory -ws all install;)
|
||||||
|
|
||||||
.PHONY: FEM
|
.PHONY: FEM
|
||||||
FEM: build/FEM
|
FEM: build/FEM
|
||||||
@(cd build/FEM; make --no-print-directory -ws all install;)
|
@(cd build/FEM; make -j4 --no-print-directory -ws all install;)
|
||||||
|
|
||||||
.PHONY: build/spectral
|
.PHONY: build/spectral
|
||||||
build/spectral:
|
build/spectral:
|
||||||
|
|
2
PRIVATE
2
PRIVATE
|
@ -1 +1 @@
|
||||||
Subproject commit e9f93abaecafbfbf11072ae70bca213a7201ed38
|
Subproject commit 59b0cbe899f272476fb6f00f0f8860428e6ceba3
|
|
@ -7,6 +7,11 @@ set DAMASK_ROOT=`python -c "import os,sys; print(os.path.realpath(os.path.expand
|
||||||
|
|
||||||
source $DAMASK_ROOT/CONFIG
|
source $DAMASK_ROOT/CONFIG
|
||||||
|
|
||||||
|
# add BRANCH if DAMASK_ROOT is a git repository
|
||||||
|
cd $DAMASK_ROOT >/dev/null
|
||||||
|
set BRANCH = `git branch 2>/dev/null| grep -E '^\* ')`
|
||||||
|
cd - >/dev/null
|
||||||
|
|
||||||
# if DAMASK_BIN is present
|
# if DAMASK_BIN is present
|
||||||
if ( $?DAMASK_BIN) then
|
if ( $?DAMASK_BIN) then
|
||||||
set path = ($DAMASK_BIN $path)
|
set path = ($DAMASK_BIN $path)
|
||||||
|
@ -41,7 +46,7 @@ if ( $?prompt ) then
|
||||||
echo https://damask.mpie.de
|
echo https://damask.mpie.de
|
||||||
echo
|
echo
|
||||||
echo Using environment with ...
|
echo Using environment with ...
|
||||||
echo "DAMASK $DAMASK_ROOT"
|
echo "DAMASK $DAMASK_ROOT $BRANCH"
|
||||||
echo "Spectral Solver $SOLVER"
|
echo "Spectral Solver $SOLVER"
|
||||||
echo "Post Processing $PROCESSING"
|
echo "Post Processing $PROCESSING"
|
||||||
if ( $?PETSC_DIR) then
|
if ( $?PETSC_DIR) then
|
||||||
|
@ -59,7 +64,7 @@ endif
|
||||||
|
|
||||||
setenv DAMASK_NUM_THREADS $DAMASK_NUM_THREADS
|
setenv DAMASK_NUM_THREADS $DAMASK_NUM_THREADS
|
||||||
if ( ! $?PYTHONPATH ) then
|
if ( ! $?PYTHONPATH ) then
|
||||||
setenv PYTHONPATH $DAMASK_ROOT/lib
|
setenv PYTHONPATH $DAMASK_ROOT/python
|
||||||
else
|
else
|
||||||
setenv PYTHONPATH $DAMASK_ROOT/lib:$PYTHONPATH
|
setenv PYTHONPATH $DAMASK_ROOT/python:$PYTHONPATH
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -30,6 +30,9 @@ set() {
|
||||||
source $DAMASK_ROOT/CONFIG
|
source $DAMASK_ROOT/CONFIG
|
||||||
unset -f set
|
unset -f set
|
||||||
|
|
||||||
|
# add BRANCH if DAMASK_ROOT is a git repository
|
||||||
|
cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd - >/dev/null
|
||||||
|
|
||||||
# add DAMASK_BIN if present
|
# add DAMASK_BIN if present
|
||||||
[ "x$DAMASK_BIN" != "x" ] && PATH=$DAMASK_BIN:$PATH
|
[ "x$DAMASK_BIN" != "x" ] && PATH=$DAMASK_BIN:$PATH
|
||||||
|
|
||||||
|
@ -59,7 +62,7 @@ if [ ! -z "$PS1" ]; then
|
||||||
echo https://damask.mpie.de
|
echo https://damask.mpie.de
|
||||||
echo
|
echo
|
||||||
echo Using environment with ...
|
echo Using environment with ...
|
||||||
echo "DAMASK $DAMASK_ROOT"
|
echo "DAMASK $DAMASK_ROOT $BRANCH"
|
||||||
echo "Spectral Solver $SOLVER"
|
echo "Spectral Solver $SOLVER"
|
||||||
echo "Post Processing $PROCESSING"
|
echo "Post Processing $PROCESSING"
|
||||||
if [ "x$PETSC_DIR" != "x" ]; then
|
if [ "x$PETSC_DIR" != "x" ]; then
|
||||||
|
@ -92,9 +95,9 @@ if [ ! -z "$PS1" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export DAMASK_NUM_THREADS
|
export DAMASK_NUM_THREADS
|
||||||
export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH
|
export PYTHONPATH=$DAMASK_ROOT/python:$PYTHONPATH
|
||||||
|
|
||||||
for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN; do
|
for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN BRANCH; do
|
||||||
unset "${var}"
|
unset "${var}"
|
||||||
done
|
done
|
||||||
for var in DAMASK MSC; do
|
for var in DAMASK MSC; do
|
||||||
|
|
|
@ -21,16 +21,19 @@ set() {
|
||||||
source $DAMASK_ROOT/CONFIG
|
source $DAMASK_ROOT/CONFIG
|
||||||
unset -f set
|
unset -f set
|
||||||
|
|
||||||
|
# add BRANCH if DAMASK_ROOT is a git repository
|
||||||
|
cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd - >/dev/null
|
||||||
|
|
||||||
# add DAMASK_BIN if present
|
# add DAMASK_BIN if present
|
||||||
[ "x$DAMASK_BIN != x" ] && PATH=$DAMASK_BIN:$PATH
|
[[ "x$DAMASK_BIN" != "x" ]] && PATH=$DAMASK_BIN:$PATH
|
||||||
|
|
||||||
SOLVER=$(which DAMASK_spectral || true 2>/dev/null)
|
SOLVER=$(which DAMASK_spectral || true 2>/dev/null)
|
||||||
[ "x$SOLVER" = "x" ] && SOLVER=$(blink 'Not found!')
|
[[ "x$SOLVER" == "x" ]] && SOLVER=$(blink 'Not found!')
|
||||||
|
|
||||||
PROCESSING=$(which postResults || true 2>/dev/null)
|
PROCESSING=$(which postResults || true 2>/dev/null)
|
||||||
[ "x$PROCESSING" = "x" ] && PROCESSING=$(blink 'Not found!')
|
[[ "x$PROCESSING" == "x" ]] && PROCESSING=$(blink 'Not found!')
|
||||||
|
|
||||||
[ "x$DAMASK_NUM_THREADS" = "x" ] && DAMASK_NUM_THREADS=1
|
[[ "x$DAMASK_NUM_THREADS" == "x" ]] && DAMASK_NUM_THREADS=1
|
||||||
|
|
||||||
# currently, there is no information that unlimited causes problems
|
# currently, there is no information that unlimited causes problems
|
||||||
# still, http://software.intel.com/en-us/forums/topic/501500 suggest to fix it
|
# still, http://software.intel.com/en-us/forums/topic/501500 suggest to fix it
|
||||||
|
@ -50,16 +53,16 @@ if [ ! -z "$PS1" ]; then
|
||||||
echo https://damask.mpie.de
|
echo https://damask.mpie.de
|
||||||
echo
|
echo
|
||||||
echo "Using environment with ..."
|
echo "Using environment with ..."
|
||||||
echo "DAMASK $DAMASK_ROOT"
|
echo "DAMASK $DAMASK_ROOT $BRANCH"
|
||||||
echo "Spectral Solver $SOLVER"
|
echo "Spectral Solver $SOLVER"
|
||||||
echo "Post Processing $PROCESSING"
|
echo "Post Processing $PROCESSING"
|
||||||
if [ "x$PETSC_DIR" != "x" ]; then
|
if [ "x$PETSC_DIR" != "x" ]; then
|
||||||
echo -n "PETSc location "
|
echo -n "PETSc location "
|
||||||
[ -d $PETSC_DIR ] && echo $PETSC_DIR || blink $PETSC_DIR
|
[ -d $PETSC_DIR ] && echo $PETSC_DIR || blink $PETSC_DIR
|
||||||
[[ $(canonicalPath "$PETSC_DIR") == $PETSC_DIR ]] \
|
[[ $(canonicalPath "$PETSC_DIR") == $PETSC_DIR ]] \
|
||||||
|| echo " ~~> "$(canonicalPath "$PETSC_DIR")
|
|| echo " ~~> "$(canonicalPath "$PETSC_DIR")
|
||||||
fi
|
fi
|
||||||
[[ "x$PETSC_ARCH" == "x" ]] \
|
[[ "x$PETSC_ARCH" == "x" ]] \
|
||||||
|| echo "PETSc architecture $PETSC_ARCH"
|
|| echo "PETSc architecture $PETSC_ARCH"
|
||||||
echo -n "MSC.Marc/Mentat "
|
echo -n "MSC.Marc/Mentat "
|
||||||
[ -d $MSC_ROOT ] && echo $MSC_ROOT || blink $MSC_ROOT
|
[ -d $MSC_ROOT ] && echo $MSC_ROOT || blink $MSC_ROOT
|
||||||
|
@ -85,9 +88,9 @@ if [ ! -z "$PS1" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export DAMASK_NUM_THREADS
|
export DAMASK_NUM_THREADS
|
||||||
export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH
|
export PYTHONPATH=$DAMASK_ROOT/python:$PYTHONPATH
|
||||||
|
|
||||||
for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN; do
|
for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN BRANCH; do
|
||||||
unset "${var}"
|
unset "${var}"
|
||||||
done
|
done
|
||||||
for var in DAMASK MSC; do
|
for var in DAMASK MSC; do
|
||||||
|
|
|
@ -6,7 +6,6 @@ plasticity phenopowerlaw
|
||||||
(output) shearrate_slip
|
(output) shearrate_slip
|
||||||
(output) resolvedstress_slip
|
(output) resolvedstress_slip
|
||||||
(output) accumulated_shear_slip
|
(output) accumulated_shear_slip
|
||||||
(output) totalshear
|
|
||||||
|
|
||||||
lattice_structure fcc
|
lattice_structure fcc
|
||||||
Nslip 12 # per family
|
Nslip 12 # per family
|
||||||
|
|
|
@ -19,4 +19,3 @@ tausat_slip 222.e6 412.7e6 # per family, optimization long
|
||||||
h0_slipslip 1000.0e6
|
h0_slipslip 1000.0e6
|
||||||
interaction_slipslip 1 1 1.4 1.4 1.4 1.4
|
interaction_slipslip 1 1 1.4 1.4 1.4 1.4
|
||||||
w0_slip 2.0
|
w0_slip 2.0
|
||||||
(output) totalshear
|
|
||||||
|
|
|
@ -19,4 +19,3 @@ tausat_slip 872.9e6 971.2e6 # per family
|
||||||
h0_slipslip 563.0e9
|
h0_slipslip 563.0e9
|
||||||
interaction_slipslip 1 1 1.4 1.4 1.4 1.4
|
interaction_slipslip 1 1 1.4 1.4 1.4 1.4
|
||||||
a_slip 2.0
|
a_slip 2.0
|
||||||
(output) totalshear
|
|
||||||
|
|
|
@ -14,11 +14,9 @@ plasticity phenopowerlaw
|
||||||
(output) resistance_slip
|
(output) resistance_slip
|
||||||
(output) shearrate_slip
|
(output) shearrate_slip
|
||||||
(output) resolvedstress_slip
|
(output) resolvedstress_slip
|
||||||
(output) totalshear
|
|
||||||
(output) resistance_twin
|
(output) resistance_twin
|
||||||
(output) shearrate_twin
|
(output) shearrate_twin
|
||||||
(output) resolvedstress_twin
|
(output) resolvedstress_twin
|
||||||
(output) totalvolfrac_twin
|
|
||||||
|
|
||||||
lattice_structure fcc
|
lattice_structure fcc
|
||||||
Nslip 12 # per family
|
Nslip 12 # per family
|
||||||
|
|
|
@ -9,11 +9,9 @@ elasticity hooke
|
||||||
(output) resistance_slip
|
(output) resistance_slip
|
||||||
(output) shearrate_slip
|
(output) shearrate_slip
|
||||||
(output) resolvedstress_slip
|
(output) resolvedstress_slip
|
||||||
(output) totalshear
|
|
||||||
(output) resistance_twin
|
(output) resistance_twin
|
||||||
(output) shearrate_twin
|
(output) shearrate_twin
|
||||||
(output) resolvedstress_twin
|
(output) resolvedstress_twin
|
||||||
(output) totalvolfrac_twin
|
|
||||||
|
|
||||||
lattice_structure hex
|
lattice_structure hex
|
||||||
covera_ratio 1.62350 # from Tromans 2011, Elastic Anisotropy of HCP Metal Crystals and Polycrystals
|
covera_ratio 1.62350 # from Tromans 2011, Elastic Anisotropy of HCP Metal Crystals and Polycrystals
|
||||||
|
|
|
@ -5,11 +5,9 @@ elasticity hooke
|
||||||
# (output) resistance_slip
|
# (output) resistance_slip
|
||||||
# (output) shearrate_slip
|
# (output) shearrate_slip
|
||||||
# (output) resolvedstress_slip
|
# (output) resolvedstress_slip
|
||||||
# (output) totalshear
|
|
||||||
# (output) resistance_twin
|
# (output) resistance_twin
|
||||||
# (output) shearrate_twin
|
# (output) shearrate_twin
|
||||||
# (output) resolvedstress_twin
|
# (output) resolvedstress_twin
|
||||||
# (output) totalvolfrac_twin
|
|
||||||
|
|
||||||
lattice_structure hex
|
lattice_structure hex
|
||||||
covera_ratio 1.587
|
covera_ratio 1.587
|
||||||
|
|
|
@ -6,12 +6,10 @@ plasticity phenopowerlaw
|
||||||
(output) shearrate_slip
|
(output) shearrate_slip
|
||||||
(output) resolvedstress_slip
|
(output) resolvedstress_slip
|
||||||
(output) accumulated_shear_slip
|
(output) accumulated_shear_slip
|
||||||
(output) totalshear
|
|
||||||
(output) resistance_twin
|
(output) resistance_twin
|
||||||
(output) shearrate_twin
|
(output) shearrate_twin
|
||||||
(output) resolvedstress_twin
|
(output) resolvedstress_twin
|
||||||
(output) accumulated_shear_twin
|
(output) accumulated_shear_twin
|
||||||
(output) totalvolfrac_twin
|
|
||||||
|
|
||||||
lattice_structure fcc
|
lattice_structure fcc
|
||||||
Nslip 12 # per family
|
Nslip 12 # per family
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python2.7
|
#!/usr/bin/env python3
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
import os,sys
|
import os,sys
|
||||||
|
@ -19,55 +19,50 @@ Transform X,Y,Z,F APS BeamLine 34 coordinates to x,y,z APS strain coordinates.
|
||||||
|
|
||||||
""", version = scriptID)
|
""", version = scriptID)
|
||||||
|
|
||||||
parser.add_option('-f','--frame', dest='frame', nargs=4, type='string', metavar='string string string string',
|
parser.add_option('-f',
|
||||||
help='APS X,Y,Z coords, and depth F')
|
'--frame',
|
||||||
parser.set_defaults(frame = None)
|
dest='frame',
|
||||||
|
metavar='string',
|
||||||
|
help='APS X,Y,Z coords')
|
||||||
|
parser.add_option('--depth',
|
||||||
|
dest='depth',
|
||||||
|
metavar='string',
|
||||||
|
help='depth')
|
||||||
|
|
||||||
(options,filenames) = parser.parse_args()
|
(options,filenames) = parser.parse_args()
|
||||||
|
|
||||||
if options.frame is None:
|
if options.frame is None:
|
||||||
parser.error('no data column specified...')
|
parser.error('frame not specified')
|
||||||
|
if options.depth is None:
|
||||||
|
parser.error('depth not specified')
|
||||||
|
|
||||||
|
# --- loop over input files ------------------------------------------------------------------------
|
||||||
|
|
||||||
datainfo = {'len':3,
|
if filenames == []: filenames = [None]
|
||||||
'label':[]
|
|
||||||
}
|
|
||||||
|
|
||||||
datainfo['label'] += options.frame
|
|
||||||
|
|
||||||
# --- loop over input files -------------------------------------------------------------------------
|
|
||||||
if filenames == []:
|
|
||||||
filenames = ['STDIN']
|
|
||||||
|
|
||||||
for name in filenames:
|
for name in filenames:
|
||||||
if name == 'STDIN':
|
try: table = damask.ASCIItable(name = name,
|
||||||
file = {'name':'STDIN', 'input':sys.stdin, 'output':sys.stdout, 'croak':sys.stderr}
|
buffered = False)
|
||||||
file['croak'].write('\033[1m'+scriptName+'\033[0m\n')
|
except: continue
|
||||||
else:
|
damask.util.report(scriptName,name)
|
||||||
if not os.path.exists(name): continue
|
|
||||||
file = {'name':name, 'input':open(name), 'output':open(name+'_tmp','w'), 'croak':sys.stderr}
|
# ------------------------------------------ read header ------------------------------------------
|
||||||
file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n')
|
|
||||||
|
table.head_read()
|
||||||
|
|
||||||
|
# ------------------------------------------ sanity checks -----------------------------------------
|
||||||
|
errors = []
|
||||||
|
if table.label_dimension(options.frame) != 3:
|
||||||
|
errors.append('input {} does not have dimension 3.'.format(options.frame))
|
||||||
|
if table.label_dimension(options.depth) != 1:
|
||||||
|
errors.append('input {} does not have dimension 1.'.format(options.depth))
|
||||||
|
if errors != []:
|
||||||
|
damask.util.croak(errors)
|
||||||
|
table.close(dismiss = True)
|
||||||
|
continue
|
||||||
|
|
||||||
table = damask.ASCIItable(file['input'],file['output'],buffered=False) # make unbuffered ASCII_table
|
|
||||||
table.head_read() # read ASCII header info
|
|
||||||
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
||||||
|
|
||||||
# --------------- figure out columns to process ---------------------------------------------------
|
|
||||||
active = []
|
|
||||||
column = {}
|
|
||||||
columnMissing = False
|
|
||||||
|
|
||||||
for label in datainfo['label']:
|
|
||||||
key = label
|
|
||||||
if key in table.labels(raw = True):
|
|
||||||
active.append(label)
|
|
||||||
column[label] = table.labels.index(key) # remember columns of requested data
|
|
||||||
else:
|
|
||||||
file['croak'].write('column %s not found...\n'%label)
|
|
||||||
columnMissing = True
|
|
||||||
|
|
||||||
if columnMissing: continue
|
|
||||||
|
|
||||||
# ------------------------------------------ assemble header ---------------------------------------
|
# ------------------------------------------ assemble header ---------------------------------------
|
||||||
table.labels_append(['%i_coord'%(i+1) for i in range(3)]) # extend ASCII header with new labels
|
table.labels_append(['%i_coord'%(i+1) for i in range(3)]) # extend ASCII header with new labels
|
||||||
table.head_write()
|
table.head_write()
|
||||||
|
@ -77,21 +72,15 @@ for name in filenames:
|
||||||
RotMat2TSL=np.array([[1., 0., 0.],
|
RotMat2TSL=np.array([[1., 0., 0.],
|
||||||
[0., np.cos(theta), np.sin(theta)], # Orientation to account for -135 deg
|
[0., np.cos(theta), np.sin(theta)], # Orientation to account for -135 deg
|
||||||
[0., -np.sin(theta), np.cos(theta)]]) # rotation for TSL convention
|
[0., -np.sin(theta), np.cos(theta)]]) # rotation for TSL convention
|
||||||
vec = np.zeros(4)
|
|
||||||
|
|
||||||
outputAlive = True
|
outputAlive = True
|
||||||
while outputAlive and table.data_read(): # read next data line of ASCII table
|
while outputAlive and table.data_read(): # read next data line of ASCII table
|
||||||
for i,label in enumerate(active):
|
coord = list(map(float,table.data[table.label_index(options.frame):table.label_index(options.frame)+3]))
|
||||||
vec[i] = table.data[column[label]]
|
depth = float(table.data[table.label_index(options.depth)])
|
||||||
|
|
||||||
table.data_append(np.dot(RotMat2TSL,np.array([-vec[0], -vec[1],-vec[2]+vec[3]])))
|
table.data_append(np.dot(RotMat2TSL,np.array([-coord[0],-coord[1],-coord[2]+depth])))
|
||||||
|
|
||||||
outputAlive = table.data_write() # output processed line
|
outputAlive = table.data_write() # output processed line
|
||||||
|
|
||||||
# ------------------------------------------ output result -----------------------------------------
|
# ------------------------------------------ output finalization -----------------------------------
|
||||||
outputAlive and table.output_flush() # just in case of buffered ASCII table
|
|
||||||
|
|
||||||
table.input_close() # close input ASCII table (works for stdin)
|
table.close() # close ASCII tables
|
||||||
table.output_close() # close output ASCII table (works for stdout)
|
|
||||||
if file['name'] != 'STDIN':
|
|
||||||
os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new
|
|
||||||
|
|
|
@ -149,7 +149,6 @@ for name in filenames:
|
||||||
|
|
||||||
errors = []
|
errors = []
|
||||||
remarks = []
|
remarks = []
|
||||||
column = {}
|
|
||||||
|
|
||||||
if not 3 >= table.label_dimension(options.pos) >= 1:
|
if not 3 >= table.label_dimension(options.pos) >= 1:
|
||||||
errors.append('coordinates "{}" need to have one, two, or three dimensions.'.format(options.pos))
|
errors.append('coordinates "{}" need to have one, two, or three dimensions.'.format(options.pos))
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python2.7
|
#!/usr/bin/env python3
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
import os,sys,time,copy
|
import os,sys,copy
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import damask
|
import damask
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
@ -29,49 +29,28 @@ parser.add_option('-d',
|
||||||
parser.add_option('-s',
|
parser.add_option('-s',
|
||||||
'--symmetry',
|
'--symmetry',
|
||||||
dest = 'symmetry',
|
dest = 'symmetry',
|
||||||
type = 'string', metavar = 'string',
|
metavar = 'string',
|
||||||
help = 'crystal symmetry [%default]')
|
help = 'crystal symmetry [%default]')
|
||||||
parser.add_option('-e',
|
parser.add_option('-o',
|
||||||
'--eulers',
|
'--orientation',
|
||||||
dest = 'eulers',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'label of Euler angles')
|
|
||||||
parser.add_option('--degrees',
|
|
||||||
dest = 'degrees',
|
|
||||||
action = 'store_true',
|
|
||||||
help = 'Euler angles are given in degrees [%default]')
|
|
||||||
parser.add_option('-m',
|
|
||||||
'--matrix',
|
|
||||||
dest = 'matrix',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'label of orientation matrix')
|
|
||||||
parser.add_option('-a',
|
|
||||||
dest = 'a',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'label of crystal frame a vector')
|
|
||||||
parser.add_option('-b',
|
|
||||||
dest = 'b',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'label of crystal frame b vector')
|
|
||||||
parser.add_option('-c',
|
|
||||||
dest = 'c',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'label of crystal frame c vector')
|
|
||||||
parser.add_option('-q',
|
|
||||||
'--quaternion',
|
|
||||||
dest = 'quaternion',
|
dest = 'quaternion',
|
||||||
type = 'string', metavar = 'string',
|
metavar = 'string',
|
||||||
help = 'label of quaternion')
|
help = 'label of crystal orientation given as unit quaternion [%default]')
|
||||||
parser.add_option('-p',
|
parser.add_option('-p',
|
||||||
'--pos', '--position',
|
'--pos', '--position',
|
||||||
dest = 'pos',
|
dest = 'pos',
|
||||||
type = 'string', metavar = 'string',
|
metavar = 'string',
|
||||||
help = 'label of coordinates [%default]')
|
help = 'label of coordinates [%default]')
|
||||||
|
parser.add_option('--quiet',
|
||||||
|
dest='verbose',
|
||||||
|
action = 'store_false',
|
||||||
|
help = 'hide status bar (useful when piping to file)')
|
||||||
|
|
||||||
parser.set_defaults(disorientation = 5,
|
parser.set_defaults(disorientation = 5,
|
||||||
|
verbose = True,
|
||||||
|
quaternion = 'orientation',
|
||||||
symmetry = 'cubic',
|
symmetry = 'cubic',
|
||||||
pos = 'pos',
|
pos = 'pos',
|
||||||
degrees = False,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
(options, filenames) = parser.parse_args()
|
(options, filenames) = parser.parse_args()
|
||||||
|
@ -79,22 +58,6 @@ parser.set_defaults(disorientation = 5,
|
||||||
if options.radius is None:
|
if options.radius is None:
|
||||||
parser.error('no radius specified.')
|
parser.error('no radius specified.')
|
||||||
|
|
||||||
input = [options.eulers is not None,
|
|
||||||
options.a is not None and \
|
|
||||||
options.b is not None and \
|
|
||||||
options.c is not None,
|
|
||||||
options.matrix is not None,
|
|
||||||
options.quaternion is not None,
|
|
||||||
]
|
|
||||||
|
|
||||||
if np.sum(input) != 1: parser.error('needs exactly one input format.')
|
|
||||||
|
|
||||||
(label,dim,inputtype) = [(options.eulers,3,'eulers'),
|
|
||||||
([options.a,options.b,options.c],[3,3,3],'frame'),
|
|
||||||
(options.matrix,9,'matrix'),
|
|
||||||
(options.quaternion,4,'quaternion'),
|
|
||||||
][np.where(input)[0][0]] # select input label that was requested
|
|
||||||
toRadians = np.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians
|
|
||||||
cos_disorientation = np.cos(np.radians(options.disorientation/2.)) # cos of half the disorientation angle
|
cos_disorientation = np.cos(np.radians(options.disorientation/2.)) # cos of half the disorientation angle
|
||||||
|
|
||||||
# --- loop over input files -------------------------------------------------------------------------
|
# --- loop over input files -------------------------------------------------------------------------
|
||||||
|
@ -118,9 +81,9 @@ for name in filenames:
|
||||||
|
|
||||||
if not 3 >= table.label_dimension(options.pos) >= 1:
|
if not 3 >= table.label_dimension(options.pos) >= 1:
|
||||||
errors.append('coordinates "{}" need to have one, two, or three dimensions.'.format(options.pos))
|
errors.append('coordinates "{}" need to have one, two, or three dimensions.'.format(options.pos))
|
||||||
if not np.all(table.label_dimension(label) == dim):
|
if not np.all(table.label_dimension(options.quaternion) == 4):
|
||||||
errors.append('input "{}" does not have dimension {}.'.format(label,dim))
|
errors.append('input "{}" does not have dimension 4.'.format(options.quaternion))
|
||||||
else: column = table.label_index(label)
|
else: column = table.label_index(options.quaternion)
|
||||||
|
|
||||||
if remarks != []: damask.util.croak(remarks)
|
if remarks != []: damask.util.croak(remarks)
|
||||||
if errors != []:
|
if errors != []:
|
||||||
|
@ -131,34 +94,18 @@ for name in filenames:
|
||||||
# ------------------------------------------ assemble header ---------------------------------------
|
# ------------------------------------------ assemble header ---------------------------------------
|
||||||
|
|
||||||
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
||||||
table.labels_append('grainID_{}@{:g}'.format('+'.join(label)
|
table.labels_append('grainID_{}@{:g}'.format(options.quaternion,options.disorientation)) # report orientation source and disorientation
|
||||||
if isinstance(label, (list,tuple))
|
|
||||||
else label,
|
|
||||||
options.disorientation)) # report orientation source and disorientation
|
|
||||||
table.head_write()
|
table.head_write()
|
||||||
|
|
||||||
# ------------------------------------------ process data ------------------------------------------
|
|
||||||
|
|
||||||
# ------------------------------------------ build KD tree -----------------------------------------
|
# ------------------------------------------ build KD tree -----------------------------------------
|
||||||
|
|
||||||
# --- start background messaging
|
|
||||||
|
|
||||||
bg = damask.util.backgroundMessage()
|
|
||||||
bg.start()
|
|
||||||
|
|
||||||
bg.set_message('reading positions...')
|
|
||||||
|
|
||||||
table.data_readArray(options.pos) # read position vectors
|
table.data_readArray(options.pos) # read position vectors
|
||||||
grainID = -np.ones(len(table.data),dtype=int)
|
grainID = -np.ones(len(table.data),dtype=int)
|
||||||
|
Npoints = table.data.shape[0]
|
||||||
start = tick = time.clock()
|
|
||||||
bg.set_message('building KD tree...')
|
|
||||||
kdtree = spatial.KDTree(copy.deepcopy(table.data))
|
kdtree = spatial.KDTree(copy.deepcopy(table.data))
|
||||||
|
|
||||||
# ------------------------------------------ assign grain IDs --------------------------------------
|
# ------------------------------------------ assign grain IDs --------------------------------------
|
||||||
|
|
||||||
tick = time.clock()
|
|
||||||
|
|
||||||
orientations = [] # quaternions found for grain
|
orientations = [] # quaternions found for grain
|
||||||
memberCounts = [] # number of voxels in grain
|
memberCounts = [] # number of voxels in grain
|
||||||
p = 0 # point counter
|
p = 0 # point counter
|
||||||
|
@ -169,26 +116,11 @@ for name in filenames:
|
||||||
table.data_rewind()
|
table.data_rewind()
|
||||||
while table.data_read(): # read next data line of ASCII table
|
while table.data_read(): # read next data line of ASCII table
|
||||||
|
|
||||||
if p > 0 and p % 1000 == 0:
|
if options.verbose and Npoints > 100 and p%(Npoints//100) == 0: # report in 1% steps if possible and avoid modulo by zero
|
||||||
|
damask.util.progressBar(iteration=p,total=Npoints)
|
||||||
|
|
||||||
time_delta = (time.clock()-tick) * (len(grainID) - p) / p
|
o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4]))),
|
||||||
bg.set_message('(%02i:%02i:%02i) processing point %i of %i (grain count %i)...'\
|
symmetry = options.symmetry).reduced()
|
||||||
%(time_delta//3600,time_delta%3600//60,time_delta%60,p,len(grainID),np.count_nonzero(memberCounts)))
|
|
||||||
|
|
||||||
if inputtype == 'eulers':
|
|
||||||
o = damask.Orientation(Eulers = np.array(map(float,table.data[column:column+3]))*toRadians,
|
|
||||||
symmetry = options.symmetry).reduced()
|
|
||||||
elif inputtype == 'matrix':
|
|
||||||
o = damask.Orientation(matrix = np.array(map(float,table.data[column:column+9])).reshape(3,3).transpose(),
|
|
||||||
symmetry = options.symmetry).reduced()
|
|
||||||
elif inputtype == 'frame':
|
|
||||||
o = damask.Orientation(matrix = np.array(map(float,table.data[column[0]:column[0]+3] + \
|
|
||||||
table.data[column[1]:column[1]+3] + \
|
|
||||||
table.data[column[2]:column[2]+3])).reshape(3,3),
|
|
||||||
symmetry = options.symmetry).reduced()
|
|
||||||
elif inputtype == 'quaternion':
|
|
||||||
o = damask.Orientation(quaternion = np.array(map(float,table.data[column:column+4])),
|
|
||||||
symmetry = options.symmetry).reduced()
|
|
||||||
|
|
||||||
matched = False
|
matched = False
|
||||||
alreadyChecked = {}
|
alreadyChecked = {}
|
||||||
|
@ -233,13 +165,12 @@ for name in filenames:
|
||||||
|
|
||||||
outputAlive = True
|
outputAlive = True
|
||||||
p = 0
|
p = 0
|
||||||
|
damask.util.progressBar(iteration=1,total=1)
|
||||||
while outputAlive and table.data_read(): # read next data line of ASCII table
|
while outputAlive and table.data_read(): # read next data line of ASCII table
|
||||||
table.data_append(1+packingMap[grainID[p]]) # add (condensed) grain ID
|
table.data_append(1+packingMap[grainID[p]]) # add (condensed) grain ID
|
||||||
outputAlive = table.data_write() # output processed line
|
outputAlive = table.data_write() # output processed line
|
||||||
p += 1
|
p += 1
|
||||||
|
|
||||||
bg.set_message('done after {} seconds'.format(time.clock()-start))
|
|
||||||
|
|
||||||
# ------------------------------------------ output finalization -----------------------------------
|
# ------------------------------------------ output finalization -----------------------------------
|
||||||
|
|
||||||
table.close() # close ASCII tables
|
table.close() # close ASCII tables
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
import os,sys,math
|
import os,sys
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import damask
|
import damask
|
||||||
|
@ -18,66 +18,29 @@ Add RGB color value corresponding to TSL-OIM scheme for inverse pole figures.
|
||||||
|
|
||||||
""", version = scriptID)
|
""", version = scriptID)
|
||||||
|
|
||||||
parser.add_option('-p', '--pole',
|
parser.add_option('-p',
|
||||||
|
'--pole',
|
||||||
dest = 'pole',
|
dest = 'pole',
|
||||||
type = 'float', nargs = 3, metavar = 'float float float',
|
type = 'float', nargs = 3, metavar = 'float float float',
|
||||||
help = 'lab frame direction for inverse pole figure [%default]')
|
help = 'lab frame direction for inverse pole figure [%default]')
|
||||||
parser.add_option('-s', '--symmetry',
|
parser.add_option('-s',
|
||||||
|
'--symmetry',
|
||||||
dest = 'symmetry',
|
dest = 'symmetry',
|
||||||
type = 'choice', choices = damask.Symmetry.lattices[1:], metavar='string',
|
type = 'choice', choices = damask.Symmetry.lattices[1:], metavar='string',
|
||||||
help = 'crystal symmetry [%default] {{{}}} '.format(', '.join(damask.Symmetry.lattices[1:])))
|
help = 'crystal symmetry [%default] {{{}}} '.format(', '.join(damask.Symmetry.lattices[1:])))
|
||||||
parser.add_option('-e', '--eulers',
|
parser.add_option('-o',
|
||||||
dest = 'eulers',
|
'--orientation',
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'Euler angles label')
|
|
||||||
parser.add_option('-d', '--degrees',
|
|
||||||
dest = 'degrees',
|
|
||||||
action = 'store_true',
|
|
||||||
help = 'Euler angles are given in degrees [%default]')
|
|
||||||
parser.add_option('-m', '--matrix',
|
|
||||||
dest = 'matrix',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'orientation matrix label')
|
|
||||||
parser.add_option('-a',
|
|
||||||
dest = 'a',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'crystal frame a vector label')
|
|
||||||
parser.add_option('-b',
|
|
||||||
dest = 'b',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'crystal frame b vector label')
|
|
||||||
parser.add_option('-c',
|
|
||||||
dest = 'c',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'crystal frame c vector label')
|
|
||||||
parser.add_option('-q', '--quaternion',
|
|
||||||
dest = 'quaternion',
|
dest = 'quaternion',
|
||||||
type = 'string', metavar = 'string',
|
metavar = 'string',
|
||||||
help = 'quaternion label')
|
help = 'label of crystal orientation given as unit quaternion [%default]')
|
||||||
|
|
||||||
parser.set_defaults(pole = (0.0,0.0,1.0),
|
parser.set_defaults(pole = (0.0,0.0,1.0),
|
||||||
|
quaternion = 'orientation',
|
||||||
symmetry = damask.Symmetry.lattices[-1],
|
symmetry = damask.Symmetry.lattices[-1],
|
||||||
degrees = False,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
(options, filenames) = parser.parse_args()
|
(options, filenames) = parser.parse_args()
|
||||||
|
|
||||||
input = [options.eulers is not None,
|
|
||||||
options.a is not None and \
|
|
||||||
options.b is not None and \
|
|
||||||
options.c is not None,
|
|
||||||
options.matrix is not None,
|
|
||||||
options.quaternion is not None,
|
|
||||||
]
|
|
||||||
|
|
||||||
if np.sum(input) != 1: parser.error('needs exactly one input format.')
|
|
||||||
|
|
||||||
(label,dim,inputtype) = [(options.eulers,3,'eulers'),
|
|
||||||
([options.a,options.b,options.c],[3,3,3],'frame'),
|
|
||||||
(options.matrix,9,'matrix'),
|
|
||||||
(options.quaternion,4,'quaternion'),
|
|
||||||
][np.where(input)[0][0]] # select input label that was requested
|
|
||||||
toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians
|
|
||||||
pole = np.array(options.pole)
|
pole = np.array(options.pole)
|
||||||
pole /= np.linalg.norm(pole)
|
pole /= np.linalg.norm(pole)
|
||||||
|
|
||||||
|
@ -98,12 +61,12 @@ for name in filenames:
|
||||||
|
|
||||||
# ------------------------------------------ sanity checks ----------------------------------------
|
# ------------------------------------------ sanity checks ----------------------------------------
|
||||||
|
|
||||||
if not np.all(table.label_dimension(label) == dim):
|
if not table.label_dimension(options.quaternion) == 4:
|
||||||
damask.util.croak('input {} does not have dimension {}.'.format(label,dim))
|
damask.util.croak('input {} does not have dimension 4.'.format(options.quaternion))
|
||||||
table.close(dismiss = True) # close ASCIItable and remove empty file
|
table.close(dismiss = True) # close ASCIItable and remove empty file
|
||||||
continue
|
continue
|
||||||
|
|
||||||
column = table.label_index(label)
|
column = table.label_index(options.quaternion)
|
||||||
|
|
||||||
# ------------------------------------------ assemble header ---------------------------------------
|
# ------------------------------------------ assemble header ---------------------------------------
|
||||||
|
|
||||||
|
@ -115,20 +78,8 @@ for name in filenames:
|
||||||
|
|
||||||
outputAlive = True
|
outputAlive = True
|
||||||
while outputAlive and table.data_read(): # read next data line of ASCII table
|
while outputAlive and table.data_read(): # read next data line of ASCII table
|
||||||
if inputtype == 'eulers':
|
o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4]))),
|
||||||
o = damask.Orientation(Eulers = np.array(list(map(float,table.data[column:column+3])))*toRadians,
|
symmetry = options.symmetry).reduced()
|
||||||
symmetry = options.symmetry).reduced()
|
|
||||||
elif inputtype == 'matrix':
|
|
||||||
o = damask.Orientation(matrix = np.array(list(map(float,table.data[column:column+9]))).reshape(3,3).transpose(),
|
|
||||||
symmetry = options.symmetry).reduced()
|
|
||||||
elif inputtype == 'frame':
|
|
||||||
o = damask.Orientation(matrix = np.array(list(map(float,table.data[column[0]:column[0]+3] + \
|
|
||||||
table.data[column[1]:column[1]+3] + \
|
|
||||||
table.data[column[2]:column[2]+3]))).reshape(3,3),
|
|
||||||
symmetry = options.symmetry).reduced()
|
|
||||||
elif inputtype == 'quaternion':
|
|
||||||
o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4]))),
|
|
||||||
symmetry = options.symmetry).reduced()
|
|
||||||
|
|
||||||
table.data_append(o.IPFcolor(pole))
|
table.data_append(o.IPFcolor(pole))
|
||||||
outputAlive = table.data_write() # output processed line
|
outputAlive = table.data_write() # output processed line
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python2.7
|
#!/usr/bin/env python3
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#!/usr/bin/env python2.7
|
#!/usr/bin/env python3
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
import os,sys,math
|
import os,sys,math
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
from collections import OrderedDict
|
||||||
import damask
|
import damask
|
||||||
|
|
||||||
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
||||||
|
@ -63,10 +64,10 @@ for name in filenames:
|
||||||
|
|
||||||
# ------------------------------------------ sanity checks ----------------------------------------
|
# ------------------------------------------ sanity checks ----------------------------------------
|
||||||
|
|
||||||
items = {
|
items = OrderedDict([
|
||||||
'strain': {'dim': 9, 'shape': [3,3], 'labels':options.strain, 'active':[], 'column': []},
|
('strain', {'dim': 9, 'shape': [3,3], 'labels':options.strain, 'active':[], 'column': []}),
|
||||||
'stress': {'dim': 9, 'shape': [3,3], 'labels':options.stress, 'active':[], 'column': []},
|
('stress', {'dim': 9, 'shape': [3,3], 'labels':options.stress, 'active':[], 'column': []})
|
||||||
}
|
])
|
||||||
errors = []
|
errors = []
|
||||||
remarks = []
|
remarks = []
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
import os,sys,math
|
import os,sys
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import damask
|
import damask
|
||||||
|
@ -9,6 +9,31 @@ import damask
|
||||||
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
||||||
scriptID = ' '.join([scriptName,damask.version])
|
scriptID = ' '.join([scriptName,damask.version])
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------
|
||||||
|
# convention conformity checks
|
||||||
|
# --------------------------------------------------------------------
|
||||||
|
|
||||||
|
def check_Eulers(eulers):
|
||||||
|
if np.any(eulers < 0.0) or np.any(eulers > 2.0*np.pi) or eulers[1] > np.pi: # Euler angles within valid range?
|
||||||
|
raise ValueError('Euler angles outside of [0..2π],[0..π],[0..2π].\n{} {} {}.'.format(*eulers))
|
||||||
|
return eulers
|
||||||
|
|
||||||
|
def check_quaternion(q):
|
||||||
|
if q[0] < 0.0: # positive first quaternion component?
|
||||||
|
raise ValueError('quaternion has negative first component.\n{}'.format(q[0]))
|
||||||
|
if not np.isclose(np.linalg.norm(q), 1.0): # unit quaternion?
|
||||||
|
raise ValueError('quaternion is not of unit length.\n{} {} {} {}'.format(*q))
|
||||||
|
return q
|
||||||
|
|
||||||
|
def check_matrix(M):
|
||||||
|
if not np.isclose(np.linalg.det(M),1.0): # proper rotation?
|
||||||
|
raise ValueError('matrix is not a proper rotation.\n{}'.format(M))
|
||||||
|
if not np.isclose(np.dot(M[0],M[1]), 0.0) \
|
||||||
|
or not np.isclose(np.dot(M[1],M[2]), 0.0) \
|
||||||
|
or not np.isclose(np.dot(M[2],M[0]), 0.0): # all orthogonal?
|
||||||
|
raise ValueError('matrix is not orthogonal.\n{}'.format(M))
|
||||||
|
return M
|
||||||
|
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
# MAIN
|
# MAIN
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
|
@ -21,58 +46,64 @@ Additional (globally fixed) rotations of the lab frame and/or crystal frame can
|
||||||
|
|
||||||
""", version = scriptID)
|
""", version = scriptID)
|
||||||
|
|
||||||
outputChoices = ['quaternion','rodrigues','eulers']
|
outputChoices = {
|
||||||
parser.add_option('-o', '--output',
|
'quaternion': ['quat',4],
|
||||||
|
'rodrigues': ['rodr',3],
|
||||||
|
'eulers': ['eulr',3],
|
||||||
|
'matrix': ['mtrx',9],
|
||||||
|
'angleaxis': ['aaxs',4],
|
||||||
|
}
|
||||||
|
|
||||||
|
parser.add_option('-o',
|
||||||
|
'--output',
|
||||||
dest = 'output',
|
dest = 'output',
|
||||||
action = 'extend', metavar = '<string LIST>',
|
action = 'extend', metavar = '<string LIST>',
|
||||||
help = 'output orientation formats {{{}}}'.format(', '.join(outputChoices)))
|
help = 'output orientation formats {{{}}}'.format(', '.join(outputChoices)))
|
||||||
parser.add_option('-s', '--symmetry',
|
parser.add_option('-d',
|
||||||
dest = 'symmetry',
|
'--degrees',
|
||||||
type = 'choice', choices = damask.Symmetry.lattices[1:], metavar='string',
|
|
||||||
help = 'crystal symmetry [%default] {{{}}} '.format(', '.join(damask.Symmetry.lattices[1:])))
|
|
||||||
parser.add_option('-d', '--degrees',
|
|
||||||
dest = 'degrees',
|
dest = 'degrees',
|
||||||
action = 'store_true',
|
action = 'store_true',
|
||||||
help = 'angles are given in degrees [%default]')
|
help = 'all angles in degrees')
|
||||||
parser.add_option('-R', '--labrotation',
|
parser.add_option('-R',
|
||||||
|
'--labrotation',
|
||||||
dest='labrotation',
|
dest='labrotation',
|
||||||
type = 'float', nargs = 4, metavar = ' '.join(['float']*4),
|
type = 'float', nargs = 4, metavar = ' '.join(['float']*4),
|
||||||
help = 'angle and axis of additional lab frame rotation')
|
help = 'angle and axis of additional lab frame rotation')
|
||||||
parser.add_option('-r', '--crystalrotation',
|
parser.add_option('-r',
|
||||||
|
'--crystalrotation',
|
||||||
dest='crystalrotation',
|
dest='crystalrotation',
|
||||||
type = 'float', nargs = 4, metavar = ' '.join(['float']*4),
|
type = 'float', nargs = 4, metavar = ' '.join(['float']*4),
|
||||||
help = 'angle and axis of additional crystal frame rotation')
|
help = 'angle and axis of additional crystal frame rotation')
|
||||||
parser.add_option( '--eulers',
|
parser.add_option('--eulers',
|
||||||
dest = 'eulers',
|
dest = 'eulers',
|
||||||
type = 'string', metavar = 'string',
|
metavar = 'string',
|
||||||
help = 'Euler angles label')
|
help = 'Euler angles label')
|
||||||
parser.add_option( '--rodrigues',
|
parser.add_option('--rodrigues',
|
||||||
dest = 'rodrigues',
|
dest = 'rodrigues',
|
||||||
type = 'string', metavar = 'string',
|
metavar = 'string',
|
||||||
help = 'Rodrigues vector label')
|
help = 'Rodrigues vector label')
|
||||||
parser.add_option( '--matrix',
|
parser.add_option('--matrix',
|
||||||
dest = 'matrix',
|
dest = 'matrix',
|
||||||
type = 'string', metavar = 'string',
|
metavar = 'string',
|
||||||
help = 'orientation matrix label')
|
help = 'orientation matrix label')
|
||||||
parser.add_option( '--quaternion',
|
parser.add_option('--quaternion',
|
||||||
dest = 'quaternion',
|
dest = 'quaternion',
|
||||||
type = 'string', metavar = 'string',
|
metavar = 'string',
|
||||||
help = 'quaternion label')
|
help = 'quaternion label')
|
||||||
parser.add_option('-a',
|
parser.add_option('-x',
|
||||||
dest = 'a',
|
dest = 'x',
|
||||||
type = 'string', metavar = 'string',
|
metavar = 'string',
|
||||||
help = 'crystal frame a vector label')
|
help = 'label of lab x vector (expressed in crystal coords)')
|
||||||
parser.add_option('-b',
|
parser.add_option('-y',
|
||||||
dest = 'b',
|
dest = 'y',
|
||||||
type = 'string', metavar = 'string',
|
metavar = 'string',
|
||||||
help = 'crystal frame b vector label')
|
help = 'label of lab y vector (expressed in crystal coords)')
|
||||||
parser.add_option('-c',
|
parser.add_option('-z',
|
||||||
dest = 'c',
|
dest = 'z',
|
||||||
type = 'string', metavar = 'string',
|
metavar = 'string',
|
||||||
help = 'crystal frame c vector label')
|
help = 'label of lab z vector (expressed in crystal coords)')
|
||||||
|
|
||||||
parser.set_defaults(output = [],
|
parser.set_defaults(output = [],
|
||||||
symmetry = damask.Symmetry.lattices[-1],
|
|
||||||
labrotation = (0.,1.,1.,1.), # no rotation about 1,1,1
|
labrotation = (0.,1.,1.,1.), # no rotation about 1,1,1
|
||||||
crystalrotation = (0.,1.,1.,1.), # no rotation about 1,1,1
|
crystalrotation = (0.,1.,1.,1.), # no rotation about 1,1,1
|
||||||
degrees = False,
|
degrees = False,
|
||||||
|
@ -86,9 +117,9 @@ if options.output == [] or (not set(options.output).issubset(set(outputChoices))
|
||||||
|
|
||||||
input = [options.eulers is not None,
|
input = [options.eulers is not None,
|
||||||
options.rodrigues is not None,
|
options.rodrigues is not None,
|
||||||
options.a is not None and \
|
options.x is not None and \
|
||||||
options.b is not None and \
|
options.y is not None and \
|
||||||
options.c is not None,
|
options.z is not None,
|
||||||
options.matrix is not None,
|
options.matrix is not None,
|
||||||
options.quaternion is not None,
|
options.quaternion is not None,
|
||||||
]
|
]
|
||||||
|
@ -97,13 +128,14 @@ if np.sum(input) != 1: parser.error('needs exactly one input format.')
|
||||||
|
|
||||||
(label,dim,inputtype) = [(options.eulers,3,'eulers'),
|
(label,dim,inputtype) = [(options.eulers,3,'eulers'),
|
||||||
(options.rodrigues,3,'rodrigues'),
|
(options.rodrigues,3,'rodrigues'),
|
||||||
([options.a,options.b,options.c],[3,3,3],'frame'),
|
([options.x,options.y,options.z],[3,3,3],'frame'),
|
||||||
(options.matrix,9,'matrix'),
|
(options.matrix,9,'matrix'),
|
||||||
(options.quaternion,4,'quaternion'),
|
(options.quaternion,4,'quaternion'),
|
||||||
][np.where(input)[0][0]] # select input label that was requested
|
][np.where(input)[0][0]] # select input label that was requested
|
||||||
toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians
|
|
||||||
r = damask.Quaternion().fromAngleAxis(toRadians*options.crystalrotation[0],options.crystalrotation[1:]) # crystal frame rotation
|
toRadians = np.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians
|
||||||
R = damask.Quaternion().fromAngleAxis(toRadians*options. labrotation[0],options. labrotation[1:]) # lab frame rotation
|
r = damask.Quaternion.fromAngleAxis(toRadians*options.crystalrotation[0],options.crystalrotation[1:]) # crystal frame rotation
|
||||||
|
R = damask.Quaternion.fromAngleAxis(toRadians*options. labrotation[0],options. labrotation[1:]) # lab frame rotation
|
||||||
|
|
||||||
# --- loop over input files ------------------------------------------------------------------------
|
# --- loop over input files ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -137,32 +169,31 @@ for name in filenames:
|
||||||
|
|
||||||
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
||||||
for output in options.output:
|
for output in options.output:
|
||||||
if output == 'quaternion': table.labels_append(['{}_{}_{}({})'.format(i+1,'quat',options.symmetry,label) for i in range(4)])
|
if output in outputChoices:
|
||||||
elif output == 'rodrigues': table.labels_append(['{}_{}_{}({})'.format(i+1,'rodr',options.symmetry,label) for i in range(3)])
|
table.labels_append(['{}_{}({})'.format(i+1,outputChoices[output][0],label) \
|
||||||
elif output == 'eulers': table.labels_append(['{}_{}_{}({})'.format(i+1,'eulr',options.symmetry,label) for i in range(3)])
|
for i in range(outputChoices[output][1])])
|
||||||
table.head_write()
|
table.head_write()
|
||||||
|
|
||||||
# ------------------------------------------ process data ------------------------------------------
|
# ------------------------------------------ process data ------------------------------------------
|
||||||
|
|
||||||
outputAlive = True
|
outputAlive = True
|
||||||
while outputAlive and table.data_read(): # read next data line of ASCII table
|
while outputAlive and table.data_read(): # read next data line of ASCII table
|
||||||
if inputtype == 'eulers':
|
if inputtype == 'eulers':
|
||||||
o = damask.Orientation(Eulers = np.array(list(map(float,table.data[column:column+3])))*toRadians,
|
|
||||||
symmetry = options.symmetry).reduced()
|
o = damask.Orientation(Eulers = check_Eulers(np.array(list(map(float,table.data[column:column+3])))*toRadians))
|
||||||
elif inputtype == 'rodrigues':
|
elif inputtype == 'rodrigues':
|
||||||
o = damask.Orientation(Rodrigues= np.array(list(map(float,table.data[column:column+3]))),
|
o = damask.Orientation(Rodrigues = np.array(list(map(float,table.data[column:column+3]))))
|
||||||
symmetry = options.symmetry).reduced()
|
|
||||||
elif inputtype == 'matrix':
|
elif inputtype == 'matrix':
|
||||||
o = damask.Orientation(matrix = np.array(list(map(float,table.data[column:column+9]))).reshape(3,3).transpose(),
|
|
||||||
symmetry = options.symmetry).reduced()
|
o = damask.Orientation(matrix = check_matrix(np.array(list(map(float,table.data[column:column+9]))).reshape(3,3)))
|
||||||
elif inputtype == 'frame':
|
elif inputtype == 'frame':
|
||||||
o = damask.Orientation(matrix = np.array(list(map(float,table.data[column[0]:column[0]+3] + \
|
M = np.array(list(map(float,table.data[column[0]:column[0]+3] + \
|
||||||
table.data[column[1]:column[1]+3] + \
|
table.data[column[1]:column[1]+3] + \
|
||||||
table.data[column[2]:column[2]+3]))).reshape(3,3),
|
table.data[column[2]:column[2]+3]))).reshape(3,3).T
|
||||||
symmetry = options.symmetry).reduced()
|
o = damask.Orientation(matrix = check_matrix(M/np.linalg.norm(M,axis=0)))
|
||||||
elif inputtype == 'quaternion':
|
elif inputtype == 'quaternion':
|
||||||
o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4]))),
|
|
||||||
symmetry = options.symmetry).reduced()
|
o = damask.Orientation(quaternion = check_quaternion(np.array(list(map(float,table.data[column:column+4])))))
|
||||||
|
|
||||||
o.quaternion = r*o.quaternion*R # apply additional lab and crystal frame rotations
|
o.quaternion = r*o.quaternion*R # apply additional lab and crystal frame rotations
|
||||||
|
|
||||||
|
@ -170,6 +201,8 @@ for name in filenames:
|
||||||
if output == 'quaternion': table.data_append(o.asQuaternion())
|
if output == 'quaternion': table.data_append(o.asQuaternion())
|
||||||
elif output == 'rodrigues': table.data_append(o.asRodrigues())
|
elif output == 'rodrigues': table.data_append(o.asRodrigues())
|
||||||
elif output == 'eulers': table.data_append(o.asEulers(degrees=options.degrees))
|
elif output == 'eulers': table.data_append(o.asEulers(degrees=options.degrees))
|
||||||
|
elif output == 'matrix': table.data_append(o.asMatrix())
|
||||||
|
elif output == 'angleaxis': table.data_append(o.asAngleAxis(degrees=options.degrees,flat=True))
|
||||||
outputAlive = table.data_write() # output processed line
|
outputAlive = table.data_write() # output processed line
|
||||||
|
|
||||||
# ------------------------------------------ output finalization -----------------------------------
|
# ------------------------------------------ output finalization -----------------------------------
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python2.7
|
#!/usr/bin/env python3
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
import os,sys,math
|
import os,sys
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import damask
|
import damask
|
||||||
|
@ -14,70 +14,32 @@ scriptID = ' '.join([scriptName,damask.version])
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
|
|
||||||
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
|
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
|
||||||
Add x,y coordinates of stereographic projection of given direction (pole) in crystal frame.
|
Add coordinates of stereographic projection of given direction (pole) in crystal frame.
|
||||||
|
|
||||||
""", version = scriptID)
|
""", version = scriptID)
|
||||||
|
|
||||||
parser.add_option('-p', '--pole',
|
parser.add_option('-p',
|
||||||
|
'--pole',
|
||||||
dest = 'pole',
|
dest = 'pole',
|
||||||
type = 'float', nargs = 3, metavar = 'float float float',
|
type = 'float', nargs = 3, metavar = 'float float float',
|
||||||
help = 'crystal frame direction for pole figure [%default]')
|
help = 'crystal frame direction for pole figure [%default]')
|
||||||
parser.add_option('--polar',
|
parser.add_option('--polar',
|
||||||
dest = 'polar',
|
dest = 'polar',
|
||||||
action = 'store_true',
|
action = 'store_true',
|
||||||
help = 'output polar coordinates r,phi [%default]')
|
help = 'output polar coordinates (r,φ) instead of Cartesian coordinates (x,y)')
|
||||||
parser.add_option('-e', '--eulers',
|
parser.add_option('-o',
|
||||||
dest = 'eulers',
|
'--orientation',
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'Euler angles label')
|
|
||||||
parser.add_option('-d', '--degrees',
|
|
||||||
dest = 'degrees',
|
|
||||||
action = 'store_true',
|
|
||||||
help = 'Euler angles are given in degrees [%default]')
|
|
||||||
parser.add_option('-m', '--matrix',
|
|
||||||
dest = 'matrix',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'orientation matrix label')
|
|
||||||
parser.add_option('-a',
|
|
||||||
dest = 'a',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'crystal frame a vector label')
|
|
||||||
parser.add_option('-b',
|
|
||||||
dest = 'b',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'crystal frame b vector label')
|
|
||||||
parser.add_option('-c',
|
|
||||||
dest = 'c',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'crystal frame c vector label')
|
|
||||||
parser.add_option('-q', '--quaternion',
|
|
||||||
dest = 'quaternion',
|
dest = 'quaternion',
|
||||||
type = 'string', metavar = 'string',
|
metavar = 'string',
|
||||||
help = 'quaternion label')
|
help = 'label of crystal orientation given as unit quaternion [%default]')
|
||||||
|
|
||||||
parser.set_defaults(pole = (1.0,0.0,0.0),
|
parser.set_defaults(pole = (1.0,0.0,0.0),
|
||||||
degrees = False,
|
quaternion = 'orientation',
|
||||||
polar = False,
|
polar = False,
|
||||||
)
|
)
|
||||||
|
|
||||||
(options, filenames) = parser.parse_args()
|
(options, filenames) = parser.parse_args()
|
||||||
|
|
||||||
input = [options.eulers is not None,
|
|
||||||
options.a is not None and \
|
|
||||||
options.b is not None and \
|
|
||||||
options.c is not None,
|
|
||||||
options.matrix is not None,
|
|
||||||
options.quaternion is not None,
|
|
||||||
]
|
|
||||||
|
|
||||||
if np.sum(input) != 1: parser.error('needs exactly one input format.')
|
|
||||||
|
|
||||||
(label,dim,inputtype) = [(options.eulers,3,'eulers'),
|
|
||||||
([options.a,options.b,options.c],[3,3,3],'frame'),
|
|
||||||
(options.matrix,9,'matrix'),
|
|
||||||
(options.quaternion,4,'quaternion'),
|
|
||||||
][np.where(input)[0][0]] # select input label that was requested
|
|
||||||
toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians
|
|
||||||
pole = np.array(options.pole)
|
pole = np.array(options.pole)
|
||||||
pole /= np.linalg.norm(pole)
|
pole /= np.linalg.norm(pole)
|
||||||
|
|
||||||
|
@ -98,18 +60,13 @@ for name in filenames:
|
||||||
|
|
||||||
# ------------------------------------------ sanity checks ----------------------------------------
|
# ------------------------------------------ sanity checks ----------------------------------------
|
||||||
|
|
||||||
errors = []
|
if not table.label_dimension(options.quaternion) == 4:
|
||||||
remarks = []
|
damask.util.croak('input {} does not have dimension 4.'.format(options.quaternion))
|
||||||
|
table.close(dismiss = True) # close ASCIItable and remove empty file
|
||||||
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)
|
|
||||||
|
|
||||||
if remarks != []: damask.util.croak(remarks)
|
|
||||||
if errors != []:
|
|
||||||
damask.util.croak(errors)
|
|
||||||
table.close(dismiss = True)
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
column = table.label_index(options.quaternion)
|
||||||
|
|
||||||
# ------------------------------------------ assemble header ---------------------------------------
|
# ------------------------------------------ assemble header ---------------------------------------
|
||||||
|
|
||||||
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
||||||
|
@ -119,16 +76,7 @@ for name in filenames:
|
||||||
# ------------------------------------------ process data ------------------------------------------
|
# ------------------------------------------ process data ------------------------------------------
|
||||||
outputAlive = True
|
outputAlive = True
|
||||||
while outputAlive and table.data_read(): # read next data line of ASCII table
|
while outputAlive and table.data_read(): # read next data line of ASCII table
|
||||||
if inputtype == 'eulers':
|
o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4]))))
|
||||||
o = damask.Orientation(Eulers = np.array(list(map(float,table.data[column:column+3])))*toRadians)
|
|
||||||
elif inputtype == 'matrix':
|
|
||||||
o = damask.Orientation(matrix = np.array(list(map(float,table.data[column:column+9]))).reshape(3,3).transpose())
|
|
||||||
elif inputtype == 'frame':
|
|
||||||
o = damask.Orientation(matrix = np.array(list(map(float,table.data[column[0]:column[0]+3] + \
|
|
||||||
table.data[column[1]:column[1]+3] + \
|
|
||||||
table.data[column[2]:column[2]+3]))).reshape(3,3))
|
|
||||||
elif inputtype == 'quaternion':
|
|
||||||
o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4]))))
|
|
||||||
|
|
||||||
rotatedPole = o.quaternion*pole # rotate pole according to crystal orientation
|
rotatedPole = o.quaternion*pole # rotate pole according to crystal orientation
|
||||||
(x,y) = rotatedPole[0:2]/(1.+abs(pole[2])) # stereographic projection
|
(x,y) = rotatedPole[0:2]/(1.+abs(pole[2])) # stereographic projection
|
||||||
|
|
|
@ -109,64 +109,42 @@ Add columns listing Schmid factors (and optional trace vector of selected system
|
||||||
""", version = scriptID)
|
""", version = scriptID)
|
||||||
|
|
||||||
latticeChoices = ('fcc','bcc','hex')
|
latticeChoices = ('fcc','bcc','hex')
|
||||||
parser.add_option('-l','--lattice',
|
parser.add_option('-l',
|
||||||
|
'--lattice',
|
||||||
dest = 'lattice', type = 'choice', choices = latticeChoices, metavar='string',
|
dest = 'lattice', type = 'choice', choices = latticeChoices, metavar='string',
|
||||||
help = 'type of lattice structure [%default] {}'.format(latticeChoices))
|
help = 'type of lattice structure [%default] {}'.format(latticeChoices))
|
||||||
parser.add_option('--covera',
|
parser.add_option('--covera',
|
||||||
dest = 'CoverA', type = 'float', metavar = 'float',
|
dest = 'CoverA', type = 'float', metavar = 'float',
|
||||||
help = 'C over A ratio for hexagonal systems')
|
help = 'C over A ratio for hexagonal systems')
|
||||||
parser.add_option('-f', '--force',
|
parser.add_option('-f',
|
||||||
|
'--force',
|
||||||
dest = 'force',
|
dest = 'force',
|
||||||
type = 'float', nargs = 3, metavar = 'float float float',
|
type = 'float', nargs = 3, metavar = 'float float float',
|
||||||
help = 'force direction in lab frame [%default]')
|
help = 'force direction in lab frame [%default]')
|
||||||
parser.add_option('-n', '--normal',
|
parser.add_option('-n',
|
||||||
|
'--normal',
|
||||||
dest = 'normal',
|
dest = 'normal',
|
||||||
type = 'float', nargs = 3, metavar = 'float float float',
|
type = 'float', nargs = 3, metavar = 'float float float',
|
||||||
help = 'stress plane normal in lab frame [%default]')
|
help = 'stress plane normal in lab frame, per default perpendicular to the force')
|
||||||
parser.add_option('-e', '--eulers',
|
parser.add_option('-o',
|
||||||
dest = 'eulers',
|
'--orientation',
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'Euler angles label')
|
|
||||||
parser.add_option('-d', '--degrees',
|
|
||||||
dest = 'degrees',
|
|
||||||
action = 'store_true',
|
|
||||||
help = 'Euler angles are given in degrees [%default]')
|
|
||||||
parser.add_option('-m', '--matrix',
|
|
||||||
dest = 'matrix',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'orientation matrix label')
|
|
||||||
parser.add_option('-a',
|
|
||||||
dest = 'a',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'crystal frame a vector label')
|
|
||||||
parser.add_option('-b',
|
|
||||||
dest = 'b',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'crystal frame b vector label')
|
|
||||||
parser.add_option('-c',
|
|
||||||
dest = 'c',
|
|
||||||
type = 'string', metavar = 'string',
|
|
||||||
help = 'crystal frame c vector label')
|
|
||||||
parser.add_option('-q', '--quaternion',
|
|
||||||
dest = 'quaternion',
|
dest = 'quaternion',
|
||||||
type = 'string', metavar = 'string',
|
metavar = 'string',
|
||||||
help = 'quaternion label')
|
help = 'label of crystal orientation given as unit quaternion [%default]')
|
||||||
|
|
||||||
parser.set_defaults(force = (0.0,0.0,1.0),
|
parser.set_defaults(force = (0.0,0.0,1.0),
|
||||||
|
quaternion='orientation',
|
||||||
normal = None,
|
normal = None,
|
||||||
lattice = latticeChoices[0],
|
lattice = latticeChoices[0],
|
||||||
CoverA = math.sqrt(8./3.),
|
CoverA = math.sqrt(8./3.),
|
||||||
degrees = False,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
(options, filenames) = parser.parse_args()
|
(options, filenames) = parser.parse_args()
|
||||||
|
|
||||||
toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians
|
|
||||||
|
|
||||||
force = np.array(options.force)
|
force = np.array(options.force)
|
||||||
force /= np.linalg.norm(force)
|
force /= np.linalg.norm(force)
|
||||||
|
|
||||||
if options.normal:
|
if options.normal is not None:
|
||||||
normal = np.array(options.normal)
|
normal = np.array(options.normal)
|
||||||
normal /= np.linalg.norm(normal)
|
normal /= np.linalg.norm(normal)
|
||||||
if abs(np.dot(force,normal)) > 1e-3:
|
if abs(np.dot(force,normal)) > 1e-3:
|
||||||
|
@ -174,22 +152,6 @@ if options.normal:
|
||||||
else:
|
else:
|
||||||
normal = force
|
normal = force
|
||||||
|
|
||||||
input = [options.eulers is not None,
|
|
||||||
options.a is not None and \
|
|
||||||
options.b is not None and \
|
|
||||||
options.c is not None,
|
|
||||||
options.matrix is not None,
|
|
||||||
options.quaternion is not None,
|
|
||||||
]
|
|
||||||
|
|
||||||
if np.sum(input) != 1: parser.error('needs exactly one input format.')
|
|
||||||
|
|
||||||
(label,dim,inputtype) = [(options.eulers,3,'eulers'),
|
|
||||||
([options.a,options.b,options.c],[3,3,3],'frame'),
|
|
||||||
(options.matrix,9,'matrix'),
|
|
||||||
(options.quaternion,4,'quaternion'),
|
|
||||||
][np.where(input)[0][0]] # select input label that was requested
|
|
||||||
|
|
||||||
slip_direction = np.zeros((len(slipSystems[options.lattice]),3),'f')
|
slip_direction = np.zeros((len(slipSystems[options.lattice]),3),'f')
|
||||||
slip_normal = np.zeros_like(slip_direction)
|
slip_normal = np.zeros_like(slip_direction)
|
||||||
|
|
||||||
|
@ -227,13 +189,12 @@ for name in filenames:
|
||||||
table.head_read()
|
table.head_read()
|
||||||
|
|
||||||
# ------------------------------------------ sanity checks ----------------------------------------
|
# ------------------------------------------ sanity checks ----------------------------------------
|
||||||
|
if not table.label_dimension(options.quaternion) == 4:
|
||||||
if not np.all(table.label_dimension(label) == dim):
|
damask.util.croak('input {} does not have dimension 4.'.format(options.quaternion))
|
||||||
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
|
||||||
|
|
||||||
column = table.label_index(label)
|
column = table.label_index(options.quaternion)
|
||||||
|
|
||||||
# ------------------------------------------ assemble header ---------------------------------------
|
# ------------------------------------------ assemble header ---------------------------------------
|
||||||
|
|
||||||
|
@ -251,17 +212,7 @@ for name in filenames:
|
||||||
|
|
||||||
outputAlive = True
|
outputAlive = True
|
||||||
while outputAlive and table.data_read(): # read next data line of ASCII table
|
while outputAlive and table.data_read(): # read next data line of ASCII table
|
||||||
if inputtype == 'eulers':
|
o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4]))))
|
||||||
o = damask.Orientation(Eulers = np.array(list(map(float,table.data[column:column+3])))*toRadians,)
|
|
||||||
elif inputtype == 'matrix':
|
|
||||||
o = damask.Orientation(matrix = np.array(list(map(float,table.data[column:column+9]))).reshape(3,3).transpose(),)
|
|
||||||
elif inputtype == 'frame':
|
|
||||||
o = damask.Orientation(matrix = np.array(list(map(float,table.data[column[0]:column[0]+3] + \
|
|
||||||
table.data[column[1]:column[1]+3] + \
|
|
||||||
table.data[column[2]:column[2]+3]))).reshape(3,3),)
|
|
||||||
elif inputtype == 'quaternion':
|
|
||||||
o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4]))),)
|
|
||||||
|
|
||||||
|
|
||||||
table.data_append( np.abs( np.sum(slip_direction * (o.quaternion * force) ,axis=1) \
|
table.data_append( np.abs( np.sum(slip_direction * (o.quaternion * force) ,axis=1) \
|
||||||
* np.sum(slip_normal * (o.quaternion * normal),axis=1)))
|
* np.sum(slip_normal * (o.quaternion * normal),axis=1)))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python2.7
|
#!/usr/bin/env python3
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
import os,sys
|
import os,sys
|
||||||
|
@ -118,10 +118,9 @@ for name in filenames:
|
||||||
minmax[c] = np.log(minmax[c]) # change minmax to log, too
|
minmax[c] = np.log(minmax[c]) # change minmax to log, too
|
||||||
|
|
||||||
delta = minmax[:,1]-minmax[:,0]
|
delta = minmax[:,1]-minmax[:,0]
|
||||||
|
|
||||||
(grid,xedges,yedges) = np.histogram2d(table.data[:,0],table.data[:,1],
|
(grid,xedges,yedges) = np.histogram2d(table.data[:,0],table.data[:,1],
|
||||||
bins=options.bins,
|
bins=options.bins,
|
||||||
range=minmax,
|
range=minmax[:2],
|
||||||
weights=None if options.weight is None else table.data[:,2])
|
weights=None if options.weight is None else table.data[:,2])
|
||||||
|
|
||||||
if options.normCol:
|
if options.normCol:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python2.7
|
#!/usr/bin/env python3
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
import os,sys
|
import os,sys
|
||||||
|
@ -21,18 +21,19 @@ scriptID = ' '.join([scriptName,damask.version])
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
|
|
||||||
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
|
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
|
||||||
Apply a user-specified function to condense all rows for which column 'label' has identical values into a single row.
|
Apply a user-specified function to condense into a single row all those rows for which columns 'label' have identical values.
|
||||||
Output table will contain as many rows as there are different (unique) values in the grouping column.
|
Output table will contain as many rows as there are different (unique) values in the grouping column(s).
|
||||||
Periodic domain averaging of coordinate values is supported.
|
Periodic domain averaging of coordinate values is supported.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
For grain averaged values, replace all rows of particular 'texture' with a single row containing their average.
|
For grain averaged values, replace all rows of particular 'texture' with a single row containing their average.
|
||||||
""", version = scriptID)
|
{name} --label texture --function np.average data.txt
|
||||||
|
""".format(name = scriptName), version = scriptID)
|
||||||
|
|
||||||
parser.add_option('-l','--label',
|
parser.add_option('-l','--label',
|
||||||
dest = 'label',
|
dest = 'label',
|
||||||
type = 'string', metavar = 'string',
|
action = 'extend', metavar = '<string LIST>',
|
||||||
help = 'column label for grouping rows')
|
help = 'column label(s) for grouping rows')
|
||||||
parser.add_option('-f','--function',
|
parser.add_option('-f','--function',
|
||||||
dest = 'function',
|
dest = 'function',
|
||||||
type = 'string', metavar = 'string',
|
type = 'string', metavar = 'string',
|
||||||
|
@ -40,7 +41,7 @@ parser.add_option('-f','--function',
|
||||||
parser.add_option('-a','--all',
|
parser.add_option('-a','--all',
|
||||||
dest = 'all',
|
dest = 'all',
|
||||||
action = 'store_true',
|
action = 'store_true',
|
||||||
help = 'apply mapping function also to grouping column')
|
help = 'apply mapping function also to grouping column(s)')
|
||||||
|
|
||||||
group = OptionGroup(parser, "periodic averaging", "")
|
group = OptionGroup(parser, "periodic averaging", "")
|
||||||
|
|
||||||
|
@ -57,6 +58,7 @@ parser.add_option_group(group)
|
||||||
|
|
||||||
parser.set_defaults(function = 'np.average',
|
parser.set_defaults(function = 'np.average',
|
||||||
all = False,
|
all = False,
|
||||||
|
label = [],
|
||||||
boundary = [0.0, 1.0])
|
boundary = [0.0, 1.0])
|
||||||
|
|
||||||
(options,filenames) = parser.parse_args()
|
(options,filenames) = parser.parse_args()
|
||||||
|
@ -71,7 +73,7 @@ try:
|
||||||
except:
|
except:
|
||||||
mapFunction = None
|
mapFunction = None
|
||||||
|
|
||||||
if options.label is None:
|
if options.label is []:
|
||||||
parser.error('no grouping column specified.')
|
parser.error('no grouping column specified.')
|
||||||
if not hasattr(mapFunction,'__call__'):
|
if not hasattr(mapFunction,'__call__'):
|
||||||
parser.error('function "{}" is not callable.'.format(options.function))
|
parser.error('function "{}" is not callable.'.format(options.function))
|
||||||
|
@ -89,13 +91,20 @@ for name in filenames:
|
||||||
|
|
||||||
# ------------------------------------------ sanity checks ---------------------------------------
|
# ------------------------------------------ sanity checks ---------------------------------------
|
||||||
|
|
||||||
|
remarks = []
|
||||||
|
errors = []
|
||||||
|
|
||||||
table.head_read()
|
table.head_read()
|
||||||
if table.label_dimension(options.label) != 1:
|
grpColumns = table.label_index(options.label)[::-1]
|
||||||
damask.util.croak('column {} is not of scalar dimension.'.format(options.label))
|
grpColumns = grpColumns[np.where(grpColumns>=0)]
|
||||||
table.close(dismiss = True) # close ASCIItable and remove empty file
|
|
||||||
|
if len(grpColumns) == 0: errors.append('no valid grouping column present.')
|
||||||
|
|
||||||
|
if remarks != []: damask.util.croak(remarks)
|
||||||
|
if errors != []:
|
||||||
|
damask.util.croak(errors)
|
||||||
|
table.close(dismiss=True)
|
||||||
continue
|
continue
|
||||||
else:
|
|
||||||
grpColumn = table.label_index(options.label)
|
|
||||||
|
|
||||||
# ------------------------------------------ assemble info ---------------------------------------
|
# ------------------------------------------ assemble info ---------------------------------------
|
||||||
|
|
||||||
|
@ -108,10 +117,9 @@ for name in filenames:
|
||||||
indexrange = table.label_indexrange(options.periodic) if options.periodic is not None else []
|
indexrange = table.label_indexrange(options.periodic) if options.periodic is not None else []
|
||||||
rows,cols = table.data.shape
|
rows,cols = table.data.shape
|
||||||
|
|
||||||
table.data = table.data[np.lexsort([table.data[:,grpColumn]])] # sort data by grpColumn
|
table.data = table.data[np.lexsort(table.data[:,grpColumns].T)] # sort data by grpColumn(s)
|
||||||
|
values,index = np.unique(table.data[:,grpColumns], axis=0, return_index=True) # unique grpColumn values and their positions
|
||||||
values,index = np.unique(table.data[:,grpColumn], return_index = True) # unique grpColumn values and their positions
|
index = sorted(np.append(index,rows)) # add termination position
|
||||||
index = np.append(index,rows) # add termination position
|
|
||||||
grpTable = np.empty((len(values), cols)) # initialize output
|
grpTable = np.empty((len(values), cols)) # initialize output
|
||||||
|
|
||||||
for i in range(len(values)): # iterate over groups (unique values in grpColumn)
|
for i in range(len(values)): # iterate over groups (unique values in grpColumn)
|
||||||
|
@ -119,7 +127,7 @@ for name in filenames:
|
||||||
grpTable[i,indexrange] = \
|
grpTable[i,indexrange] = \
|
||||||
periodicAverage(table.data[index[i]:index[i+1],indexrange],options.boundary) # apply periodicAverage mapping function
|
periodicAverage(table.data[index[i]:index[i+1],indexrange],options.boundary) # apply periodicAverage mapping function
|
||||||
|
|
||||||
if not options.all: grpTable[i,grpColumn] = table.data[index[i],grpColumn] # restore grouping column value
|
if not options.all: grpTable[i,grpColumns] = table.data[index[i],grpColumns] # restore grouping column value
|
||||||
|
|
||||||
table.data = grpTable
|
table.data = grpTable
|
||||||
|
|
||||||
|
|
|
@ -121,12 +121,8 @@ class MPIEspectral_result: # mimic py_post result object
|
||||||
self._logscales = self._keyedPackedArray('logscales',count=self.N_loadcases,type='i')
|
self._logscales = self._keyedPackedArray('logscales',count=self.N_loadcases,type='i')
|
||||||
|
|
||||||
self.size = self._keyedPackedArray('size:',count=3,type='d')
|
self.size = self._keyedPackedArray('size:',count=3,type='d')
|
||||||
if self.size == [None,None,None]: # no 'size' found, try legacy alias 'dimension'
|
|
||||||
self.size = self._keyedPackedArray('dimension',count=3,type='d')
|
|
||||||
|
|
||||||
self.grid = self._keyedPackedArray('grid:',count=3,type='i')
|
self.grid = self._keyedPackedArray('grid:',count=3,type='i')
|
||||||
if self.grid == [None,None,None]: # no 'grid' found, try legacy alias 'resolution'
|
|
||||||
self.grid = self._keyedPackedArray('resolution',count=3,type='i')
|
|
||||||
|
|
||||||
self.N_nodes = (self.grid[0]+1)*(self.grid[1]+1)*(self.grid[2]+1)
|
self.N_nodes = (self.grid[0]+1)*(self.grid[1]+1)*(self.grid[2]+1)
|
||||||
self.N_elements = self.grid[0] * self.grid[1] * self.grid[2]
|
self.N_elements = self.grid[0] * self.grid[1] * self.grid[2]
|
||||||
|
@ -142,13 +138,8 @@ class MPIEspectral_result: # mimic py_post result object
|
||||||
|
|
||||||
# parameters for file handling depending on output format
|
# parameters for file handling depending on output format
|
||||||
|
|
||||||
if options.legacy:
|
self.tagLen=0
|
||||||
self.tagLen=8
|
|
||||||
self.fourByteLimit = 2**31 -1 -8
|
|
||||||
else:
|
|
||||||
self.tagLen=0
|
|
||||||
self.expectedFileSize = self.dataOffset+self.N_increments*(self.tagLen+self.N_elements*self.N_element_scalars*8)
|
self.expectedFileSize = self.dataOffset+self.N_increments*(self.tagLen+self.N_elements*self.N_element_scalars*8)
|
||||||
if options.legacy: self.expectedFileSize+=self.expectedFileSize//self.fourByteLimit*8 # add extra 8 bytes for additional headers at 4 GB limits
|
|
||||||
if self.expectedFileSize != self.filesize:
|
if self.expectedFileSize != self.filesize:
|
||||||
print('\n**\n* Unexpected file size. Incomplete simulation or file corrupted!\n**')
|
print('\n**\n* Unexpected file size. Incomplete simulation or file corrupted!\n**')
|
||||||
|
|
||||||
|
@ -280,42 +271,16 @@ class MPIEspectral_result: # mimic py_post result object
|
||||||
return self.N_element_scalars
|
return self.N_element_scalars
|
||||||
|
|
||||||
def element_scalar(self,e,idx):
|
def element_scalar(self,e,idx):
|
||||||
if not options.legacy:
|
incStart = self.dataOffset \
|
||||||
incStart = self.dataOffset \
|
+ self.position*8*self.N_elements*self.N_element_scalars
|
||||||
+ self.position*8*self.N_elements*self.N_element_scalars
|
where = (e*self.N_element_scalars + idx)*8
|
||||||
where = (e*self.N_element_scalars + idx)*8
|
try:
|
||||||
try:
|
self.file.seek(incStart+where)
|
||||||
self.file.seek(incStart+where)
|
value = struct.unpack('d',self.file.read(8))[0]
|
||||||
value = struct.unpack('d',self.file.read(8))[0]
|
except:
|
||||||
except:
|
print('seeking {}'.format(incStart+where))
|
||||||
print('seeking {}'.format(incStart+where))
|
print('e {} idx {}'.format(e,idx))
|
||||||
print('e {} idx {}'.format(e,idx))
|
sys.exit(1)
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
else:
|
|
||||||
self.fourByteLimit = 2**31 -1 -8
|
|
||||||
# header & footer + extra header and footer for 4 byte int range (Fortran)
|
|
||||||
# values
|
|
||||||
incStart = self.dataOffset \
|
|
||||||
+ self.position*8*( 1 + self.N_elements*self.N_element_scalars*8//self.fourByteLimit \
|
|
||||||
+ self.N_elements*self.N_element_scalars)
|
|
||||||
|
|
||||||
where = (e*self.N_element_scalars + idx)*8
|
|
||||||
try:
|
|
||||||
if where%self.fourByteLimit + 8 >= self.fourByteLimit: # danger of reading into fortran record footer at 4 byte limit
|
|
||||||
data=''
|
|
||||||
for i in range(8):
|
|
||||||
self.file.seek(incStart+where+(where//self.fourByteLimit)*8+4)
|
|
||||||
data += self.file.read(1)
|
|
||||||
where += 1
|
|
||||||
value = struct.unpack('d',data)[0]
|
|
||||||
else:
|
|
||||||
self.file.seek(incStart+where+(where//self.fourByteLimit)*8+4)
|
|
||||||
value = struct.unpack('d',self.file.read(8))[0]
|
|
||||||
except:
|
|
||||||
print('seeking {}'.format(incStart+where+(where//self.fourByteLimit)*8+4))
|
|
||||||
print('e {} idx {}'.format(e,idx))
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
return [elemental_scalar(node,value) for node in self.element(e).items]
|
return [elemental_scalar(node,value) for node in self.element(e).items]
|
||||||
|
|
||||||
|
@ -645,8 +610,6 @@ 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')
|
help='list contents of resultfile')
|
||||||
parser.add_option('-l','--legacy', action='store_true', dest='legacy',
|
|
||||||
help='data format of spectral solver is in legacy format (no MPI out)')
|
|
||||||
parser.add_option('-n','--nodal', action='store_true', dest='nodal',
|
parser.add_option('-n','--nodal', action='store_true', dest='nodal',
|
||||||
help='data is extrapolated to nodal value')
|
help='data is extrapolated to nodal value')
|
||||||
parser.add_option( '--prefix', dest='prefix',
|
parser.add_option( '--prefix', dest='prefix',
|
||||||
|
@ -673,10 +636,7 @@ parser.add_option('-p','--type', dest='filetype',
|
||||||
help = 'type of result file [auto]')
|
help = 'type of result file [auto]')
|
||||||
parser.add_option('-q','--quiet', dest='verbose',
|
parser.add_option('-q','--quiet', dest='verbose',
|
||||||
action = 'store_false',
|
action = 'store_false',
|
||||||
help = 'suppress verbose output')
|
help = 'hide status bar (useful when piping to file)')
|
||||||
parser.add_option('--verbose', dest='verbose',
|
|
||||||
action = 'store_true',
|
|
||||||
help = 'enable verbose output')
|
|
||||||
|
|
||||||
group_material = OptionGroup(parser,'Material identifier')
|
group_material = OptionGroup(parser,'Material identifier')
|
||||||
|
|
||||||
|
@ -718,9 +678,8 @@ 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,
|
||||||
verbose = False,
|
|
||||||
legacy = False,
|
|
||||||
nodal = False,
|
nodal = False,
|
||||||
|
verbose = True,
|
||||||
prefix = '',
|
prefix = '',
|
||||||
suffix = '',
|
suffix = '',
|
||||||
dir = 'postProc',
|
dir = 'postProc',
|
||||||
|
@ -747,6 +706,8 @@ if files == []:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
parser.error('no file specified...')
|
parser.error('no file specified...')
|
||||||
|
|
||||||
|
damask.util.report(scriptName,files[0])
|
||||||
|
|
||||||
if not os.path.exists(files[0]):
|
if not os.path.exists(files[0]):
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
parser.error('invalid file "%s" specified...'%files[0])
|
parser.error('invalid file "%s" specified...'%files[0])
|
||||||
|
@ -803,12 +764,6 @@ if not options.constitutiveResult: options.constitutiveResult = []
|
||||||
options.sort.reverse()
|
options.sort.reverse()
|
||||||
options.sep.reverse()
|
options.sep.reverse()
|
||||||
|
|
||||||
# --- start background messaging
|
|
||||||
|
|
||||||
if options.verbose:
|
|
||||||
bg = damask.util.backgroundMessage()
|
|
||||||
bg.start()
|
|
||||||
|
|
||||||
# --- parse .output and .t16 files
|
# --- parse .output and .t16 files
|
||||||
|
|
||||||
if os.path.splitext(files[0])[1] == '':
|
if os.path.splitext(files[0])[1] == '':
|
||||||
|
@ -825,18 +780,13 @@ me = {
|
||||||
'Constitutive': options.phase,
|
'Constitutive': options.phase,
|
||||||
}
|
}
|
||||||
|
|
||||||
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])
|
||||||
if '_id' not in outputFormat[what]['specials']:
|
if '_id' not in outputFormat[what]['specials']:
|
||||||
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'])))
|
||||||
|
|
||||||
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)
|
||||||
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)
|
||||||
|
@ -879,8 +829,10 @@ if options.info:
|
||||||
# --- build connectivity maps
|
# --- build connectivity maps
|
||||||
|
|
||||||
elementsOfNode = {}
|
elementsOfNode = {}
|
||||||
for e in range(stat['NumberOfElements']):
|
Nelems = stat['NumberOfElements']
|
||||||
if options.verbose and e%1000 == 0: bg.set_message('connect elem %i...'%e)
|
for e in range(Nelems):
|
||||||
|
if options.verbose and Nelems >= 50 and e%(Nelems//50) == 0: # report in 2% steps if possible and avoid modulo by zero
|
||||||
|
damask.util.progressBar(iteration=e,total=Nelems,prefix='1/3: connecting elements')
|
||||||
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)]
|
||||||
|
@ -899,10 +851,13 @@ index = {}
|
||||||
groups = []
|
groups = []
|
||||||
groupCount = 0
|
groupCount = 0
|
||||||
memberCount = 0
|
memberCount = 0
|
||||||
|
damask.util.progressBar(iteration=1,total=1,prefix='1/3: connecting elements')
|
||||||
|
|
||||||
if options.nodalScalar:
|
if options.nodalScalar:
|
||||||
for n in range(stat['NumberOfNodes']):
|
Npoints = stat['NumberOfNodes']
|
||||||
if options.verbose and n%1000 == 0: bg.set_message('scan node %i...'%n)
|
for n in range(Npoints):
|
||||||
|
if options.verbose and Npoints >= 50 and e%(Npoints//50) == 0: # report in 2% steps if possible and avoid modulo by zero
|
||||||
|
damask.util.progressBar(iteration=n,total=Npoints,prefix='2/3: scanning nodes ')
|
||||||
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
|
||||||
|
@ -911,32 +866,35 @@ if options.nodalScalar:
|
||||||
|
|
||||||
# generate an expression that is only true for the locations specified by options.filter
|
# generate an expression that is only true for the locations specified by options.filter
|
||||||
filter = substituteLocation(options.filter, [myElemID,myNodeID,myIpID,myGrainID], myNodeCoordinates)
|
filter = substituteLocation(options.filter, [myElemID,myNodeID,myIpID,myGrainID], myNodeCoordinates)
|
||||||
if filter != '' and not eval(filter): # for all filter expressions that are not true:...
|
if filter != '' and not eval(filter): # for all filter expressions that are not true:...
|
||||||
continue # ... ignore this data point and continue with next
|
continue # ... ignore this data point and continue with next
|
||||||
|
|
||||||
# --- group data locations
|
# --- group data locations
|
||||||
# generate a unique key for a group of separated data based on the separation criterium for the location
|
# generate a unique key for a group of separated data based on the separation criterium for the location
|
||||||
grp = substituteLocation('#'.join(options.sep), [myElemID,myNodeID,myIpID,myGrainID], myNodeCoordinates)
|
grp = substituteLocation('#'.join(options.sep), [myElemID,myNodeID,myIpID,myGrainID], myNodeCoordinates)
|
||||||
|
|
||||||
if grp not in index: # create a new group if not yet present
|
if grp not in index: # create a new group if not yet present
|
||||||
index[grp] = groupCount
|
index[grp] = groupCount
|
||||||
groups.append([[0,0,0,0,0.0,0.0,0.0]]) # initialize with avg location
|
groups.append([[0,0,0,0,0.0,0.0,0.0]]) # initialize with avg location
|
||||||
groupCount += 1
|
groupCount += 1
|
||||||
|
|
||||||
groups[index[grp]][0][:4] = mapIncremental('','unique',
|
groups[index[grp]][0][:4] = mapIncremental('','unique',
|
||||||
len(groups[index[grp]])-1,
|
len(groups[index[grp]])-1,
|
||||||
groups[index[grp]][0][:4],
|
groups[index[grp]][0][:4],
|
||||||
[myElemID,myNodeID,myIpID,myGrainID]) # keep only if unique average location
|
[myElemID,myNodeID,myIpID,myGrainID]) # keep only if unique average location
|
||||||
groups[index[grp]][0][4:] = mapIncremental('','avg',
|
groups[index[grp]][0][4:] = mapIncremental('','avg',
|
||||||
len(groups[index[grp]])-1,
|
len(groups[index[grp]])-1,
|
||||||
groups[index[grp]][0][4:],
|
groups[index[grp]][0][4:],
|
||||||
myNodeCoordinates) # incrementally update average location
|
myNodeCoordinates) # incrementally update average location
|
||||||
groups[index[grp]].append([myElemID,myNodeID,myIpID,myGrainID,0]) # append a new list defining each group member
|
groups[index[grp]].append([myElemID,myNodeID,myIpID,myGrainID,0]) # append a new list defining each group member
|
||||||
memberCount += 1
|
memberCount += 1
|
||||||
|
damask.util.progressBar(iteration=1,total=1,prefix='2/3: scanning nodes ')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
for e in range(stat['NumberOfElements']):
|
Nelems = stat['NumberOfElements']
|
||||||
if options.verbose and e%1000 == 0: bg.set_message('scan elem %i...'%e)
|
for e in range(Nelems):
|
||||||
|
if options.verbose and Nelems >= 50 and e%(Nelems//50) == 0: # report in 2% steps if possible and avoid modulo by zero
|
||||||
|
damask.util.progressBar(iteration=e,total=Nelems,prefix='2/3: scanning elements ')
|
||||||
myElemID = p.element_id(e)
|
myElemID = p.element_id(e)
|
||||||
myIpCoordinates = ipCoords(p.element(e).type, list(map(lambda node: [node.x, node.y, node.z],
|
myIpCoordinates = ipCoords(p.element(e).type, list(map(lambda node: [node.x, node.y, node.z],
|
||||||
list(map(p.node, map(p.node_sequence, p.element(e).items))))))
|
list(map(p.node, map(p.node_sequence, p.element(e).items))))))
|
||||||
|
@ -976,6 +934,7 @@ else:
|
||||||
myIpCoordinates[n]) # incrementally update average location
|
myIpCoordinates[n]) # incrementally update average location
|
||||||
groups[index[grp]].append([myElemID,myNodeID,myIpID,myGrainID,n]) # append a new list defining each group member
|
groups[index[grp]].append([myElemID,myNodeID,myIpID,myGrainID,n]) # append a new list defining each group member
|
||||||
memberCount += 1
|
memberCount += 1
|
||||||
|
damask.util.progressBar(iteration=1,total=1,prefix='2/3: scanning elements ')
|
||||||
|
|
||||||
|
|
||||||
# --------------------------- sort groups --------------------------------
|
# --------------------------- sort groups --------------------------------
|
||||||
|
@ -1002,7 +961,6 @@ 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)))
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
|
@ -1021,8 +979,6 @@ standard = ['inc'] + \
|
||||||
|
|
||||||
# --------------------------- loop over positions --------------------------------
|
# --------------------------- loop over positions --------------------------------
|
||||||
|
|
||||||
if options.verbose: bg.set_message('getting map between positions and increments...')
|
|
||||||
|
|
||||||
incAtPosition = {}
|
incAtPosition = {}
|
||||||
positionOfInc = {}
|
positionOfInc = {}
|
||||||
|
|
||||||
|
@ -1048,8 +1004,8 @@ increments = [incAtPosition[x] for x in locations] # build list of increments to
|
||||||
|
|
||||||
time_start = time.time()
|
time_start = time.time()
|
||||||
|
|
||||||
|
Nincs = len([i for i in locations])
|
||||||
for incCount,position in enumerate(locations): # walk through locations
|
for incCount,position in enumerate(locations): # walk through locations
|
||||||
|
|
||||||
p.moveto(position+offset_pos) # wind to correct position
|
p.moveto(position+offset_pos) # wind to correct position
|
||||||
|
|
||||||
# --------------------------- file management --------------------------------
|
# --------------------------- file management --------------------------------
|
||||||
|
@ -1075,16 +1031,14 @@ for incCount,position in enumerate(locations): # walk through locations
|
||||||
# --------------------------- read and map data per group --------------------------------
|
# --------------------------- read and map data per group --------------------------------
|
||||||
|
|
||||||
member = 0
|
member = 0
|
||||||
for group in groups:
|
Ngroups = len(groups)
|
||||||
|
for j,group in enumerate(groups):
|
||||||
|
f = incCount*Ngroups + j
|
||||||
|
if options.verbose and (Ngroups*Nincs) >= 50 and f%((Ngroups*Nincs)//50) == 0: # report in 2% steps if possible and avoid modulo by zero
|
||||||
|
damask.util.progressBar(iteration=f,total=Ngroups*Nincs,prefix='3/3: processing points ')
|
||||||
N = 0 # group member counter
|
N = 0 # group member counter
|
||||||
for (e,n,i,g,n_local) in group[1:]: # loop over group members
|
for (e,n,i,g,n_local) in group[1:]: # loop over group members
|
||||||
member += 1
|
member += 1
|
||||||
if member%1000 == 0:
|
|
||||||
time_delta = ((len(locations)*memberCount)/float(member+incCount*memberCount)-1.0)*(time.time()-time_start)
|
|
||||||
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))
|
|
||||||
|
|
||||||
newby = [] # current member's data
|
newby = [] # current member's data
|
||||||
|
|
||||||
if options.nodalScalar:
|
if options.nodalScalar:
|
||||||
|
@ -1133,7 +1087,7 @@ for incCount,position in enumerate(locations): # walk through locations
|
||||||
['Crystallite']*len(options.crystalliteResult) +
|
['Crystallite']*len(options.crystalliteResult) +
|
||||||
['Constitutive']*len(options.constitutiveResult)
|
['Constitutive']*len(options.constitutiveResult)
|
||||||
):
|
):
|
||||||
outputIndex = (list(zip(*outputFormat[resultType]['outputs']))[0]).index(label) # find the position of this output in the outputFormat
|
outputIndex = (list(zip(*outputFormat[resultType]['outputs']))[0]).index(label) # find the position of this output in the outputFormat
|
||||||
length = int(outputFormat[resultType]['outputs'][outputIndex][1])
|
length = int(outputFormat[resultType]['outputs'][outputIndex][1])
|
||||||
thisHead = heading('_',[[component,''.join( label.split() )] for component in range(int(length>1),length+int(length>1))])
|
thisHead = heading('_',[[component,''.join( label.split() )] for component in range(int(length>1),length+int(length>1))])
|
||||||
if assembleHeader: header += thisHead
|
if assembleHeader: header += thisHead
|
||||||
|
@ -1172,6 +1126,7 @@ for incCount,position in enumerate(locations): # walk through locations
|
||||||
group[0] + \
|
group[0] + \
|
||||||
mappedResult)
|
mappedResult)
|
||||||
)) + '\n')
|
)) + '\n')
|
||||||
|
damask.util.progressBar(iteration=1,total=1,prefix='3/3: processing points ')
|
||||||
|
|
||||||
if fileOpen:
|
if fileOpen:
|
||||||
file.close()
|
file.close()
|
||||||
|
|
|
@ -18,19 +18,15 @@ Rotate vector and/or tensor column data by given angle around given axis.
|
||||||
|
|
||||||
""", version = scriptID)
|
""", version = scriptID)
|
||||||
|
|
||||||
parser.add_option('-v','--vector',
|
parser.add_option('-d', '--data',
|
||||||
dest = 'vector',
|
dest = 'data',
|
||||||
action = 'extend', metavar = '<string LIST>',
|
action = 'extend', metavar = '<string LIST>',
|
||||||
help = 'column heading of vector(s) to rotate')
|
help = 'vector/tensor value(s) label(s)')
|
||||||
parser.add_option('-t','--tensor',
|
|
||||||
dest = 'tensor',
|
|
||||||
action = 'extend', metavar = '<string LIST>',
|
|
||||||
help = 'column heading of tensor(s) to rotate')
|
|
||||||
parser.add_option('-r', '--rotation',
|
parser.add_option('-r', '--rotation',
|
||||||
dest = 'rotation',
|
dest = 'rotation',
|
||||||
type = 'float', nargs = 4, metavar = ' '.join(['float']*4),
|
type = 'float', nargs = 4, metavar = ' '.join(['float']*4),
|
||||||
help = 'angle and axis to rotate data [%default]')
|
help = 'angle and axis to rotate data [%default]')
|
||||||
parser.add_option('-d', '--degrees',
|
parser.add_option('--degrees',
|
||||||
dest = 'degrees',
|
dest = 'degrees',
|
||||||
action = 'store_true',
|
action = 'store_true',
|
||||||
help = 'angles are given in degrees [%default]')
|
help = 'angles are given in degrees [%default]')
|
||||||
|
@ -41,7 +37,7 @@ parser.set_defaults(rotation = (0.,1.,1.,1.),
|
||||||
|
|
||||||
(options,filenames) = parser.parse_args()
|
(options,filenames) = parser.parse_args()
|
||||||
|
|
||||||
if options.vector is None and options.tensor is None:
|
if options.data is None:
|
||||||
parser.error('no data column specified.')
|
parser.error('no data column specified.')
|
||||||
|
|
||||||
toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians
|
toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians
|
||||||
|
@ -59,27 +55,24 @@ for name in filenames:
|
||||||
except: continue
|
except: continue
|
||||||
damask.util.report(scriptName,name)
|
damask.util.report(scriptName,name)
|
||||||
|
|
||||||
# ------------------------------------------ read header ------------------------------------------
|
# --- interpret header ----------------------------------------------------------------------------
|
||||||
|
|
||||||
table.head_read()
|
table.head_read()
|
||||||
|
|
||||||
# ------------------------------------------ sanity checks ----------------------------------------
|
|
||||||
|
|
||||||
items = {
|
|
||||||
'tensor': {'dim': 9, 'shape': [3,3], 'labels':options.tensor, 'active':[], 'column': []},
|
|
||||||
'vector': {'dim': 3, 'shape': [3], 'labels':options.vector, 'active':[], 'column': []},
|
|
||||||
}
|
|
||||||
errors = []
|
errors = []
|
||||||
remarks = []
|
remarks = []
|
||||||
column = {}
|
active = {'vector':[],'tensor':[]}
|
||||||
|
|
||||||
for type, data in items.items():
|
for i,dim in enumerate(table.label_dimension(options.data)):
|
||||||
for what in data['labels']:
|
label = options.data[i]
|
||||||
dim = table.label_dimension(what)
|
if dim == -1:
|
||||||
if dim != data['dim']: remarks.append('column {} is not a {}.'.format(what,type))
|
remarks.append('"{}" not found...'.format(label))
|
||||||
else:
|
elif dim == 3:
|
||||||
items[type]['active'].append(what)
|
remarks.append('adding vector "{}"...'.format(label))
|
||||||
items[type]['column'].append(table.label_index(what))
|
active['vector'].append(label)
|
||||||
|
elif dim == 9:
|
||||||
|
remarks.append('adding tensor "{}"...'.format(label))
|
||||||
|
active['tensor'].append(label)
|
||||||
|
|
||||||
if remarks != []: damask.util.croak(remarks)
|
if remarks != []: damask.util.croak(remarks)
|
||||||
if errors != []:
|
if errors != []:
|
||||||
|
@ -95,20 +88,14 @@ for name in filenames:
|
||||||
# ------------------------------------------ process data ------------------------------------------
|
# ------------------------------------------ process data ------------------------------------------
|
||||||
outputAlive = True
|
outputAlive = True
|
||||||
while outputAlive and table.data_read(): # read next data line of ASCII table
|
while outputAlive and table.data_read(): # read next data line of ASCII table
|
||||||
|
for v in active['vector']:
|
||||||
datatype = 'vector'
|
column = table.label_index(v)
|
||||||
|
table.data[column:column+3] = q * np.array(list(map(float,table.data[column:column+3])))
|
||||||
for column in items[datatype]['column']: # loop over all requested labels
|
for t in active['tensor']:
|
||||||
table.data[column:column+items[datatype]['dim']] = \
|
column = table.label_index(t)
|
||||||
q * np.array(list(map(float,table.data[column:column+items[datatype]['dim']])))
|
table.data[column:column+9] = \
|
||||||
|
np.dot(R,np.dot(np.array(list(map(float,table.data[column:column+9]))).reshape((3,3)),
|
||||||
datatype = 'tensor'
|
R.transpose())).reshape((9))
|
||||||
|
|
||||||
for column in items[datatype]['column']: # loop over all requested labels
|
|
||||||
table.data[column:column+items[datatype]['dim']] = \
|
|
||||||
np.dot(R,np.dot(np.array(list(map(float,table.data[column:column+items[datatype]['dim']]))).\
|
|
||||||
reshape(items[datatype]['shape']),R.transpose())).reshape(items[datatype]['dim'])
|
|
||||||
|
|
||||||
outputAlive = table.data_write() # output processed line
|
outputAlive = table.data_write() # output processed line
|
||||||
|
|
||||||
# ------------------------------------------ output finalization -----------------------------------
|
# ------------------------------------------ output finalization -----------------------------------
|
||||||
|
|
|
@ -61,7 +61,14 @@ for name in filenames:
|
||||||
table = damask.ASCIItable(name = name,
|
table = damask.ASCIItable(name = name,
|
||||||
buffered = False, labeled = options.labeled, readonly = True)
|
buffered = False, labeled = options.labeled, readonly = True)
|
||||||
except: continue
|
except: continue
|
||||||
damask.util.report(scriptName,name)
|
details = ', '.join(
|
||||||
|
(['header'] if options.table else []) +
|
||||||
|
(['info'] if options.head or options.info else []) +
|
||||||
|
(['labels'] if options.head or options.labels else []) +
|
||||||
|
(['data'] if options.data else []) +
|
||||||
|
[]
|
||||||
|
)
|
||||||
|
damask.util.report(scriptName,name + ('' if details == '' else ' -- '+details))
|
||||||
|
|
||||||
# ------------------------------------------ output head ---------------------------------------
|
# ------------------------------------------ output head ---------------------------------------
|
||||||
|
|
|
@ -323,12 +323,13 @@ for name in filenames:
|
||||||
]
|
]
|
||||||
if hasEulers:
|
if hasEulers:
|
||||||
config_header += ['<texture>']
|
config_header += ['<texture>']
|
||||||
|
theAxes = [] if options.axes is None else ['axes\t{} {} {}'.format(*options.axes)]
|
||||||
for ID in grainIDs:
|
for ID in grainIDs:
|
||||||
eulerID = np.nonzero(grains == ID)[0][0] # find first occurrence of this grain id
|
eulerID = np.nonzero(grains == ID)[0][0] # find first occurrence of this grain id
|
||||||
config_header += ['[Grain{}]'.format(str(ID).zfill(formatwidth)),
|
config_header += ['[Grain{}]'.format(str(ID).zfill(formatwidth)),
|
||||||
'(gauss)\tphi1 {:g}\tPhi {:g}\tphi2 {:g}\tscatter 0.0\tfraction 1.0'.format(*eulers[eulerID])
|
'(gauss)\tphi1 {:g}\tPhi {:g}\tphi2 {:g}\tscatter 0.0\tfraction 1.0'.format(*eulers[eulerID])
|
||||||
]
|
] + theAxes
|
||||||
if options.axes is not None: config_header.append('axes\t{} {} {}'.format(*options.axes))
|
config_header += ['<!skip>']
|
||||||
|
|
||||||
table.labels_clear()
|
table.labels_clear()
|
||||||
table.info_clear()
|
table.info_clear()
|
||||||
|
|
|
@ -60,8 +60,6 @@ eulers = np.array(damask.orientation.Orientation(
|
||||||
degrees = options.degrees,
|
degrees = options.degrees,
|
||||||
).asEulers(degrees=True))
|
).asEulers(degrees=True))
|
||||||
|
|
||||||
damask.util.croak('{} {} {}'.format(*eulers))
|
|
||||||
|
|
||||||
# --- loop over input files -------------------------------------------------------------------------
|
# --- loop over input files -------------------------------------------------------------------------
|
||||||
|
|
||||||
if filenames == []: filenames = [None]
|
if filenames == []: filenames = [None]
|
||||||
|
|
|
@ -13,7 +13,7 @@ from .asciitable import ASCIItable # noqa
|
||||||
|
|
||||||
from .config import Material # noqa
|
from .config import Material # noqa
|
||||||
from .colormaps import Colormap, Color # noqa
|
from .colormaps import Colormap, Color # noqa
|
||||||
from .orientation import Quaternion, Rodrigues, Symmetry, Orientation # noqa
|
from .orientation import Quaternion, Symmetry, Orientation # noqa
|
||||||
|
|
||||||
#from .block import Block # only one class
|
#from .block import Block # only one class
|
||||||
from .result import Result # noqa
|
from .result import Result # noqa
|
|
@ -493,8 +493,8 @@ class ASCIItable():
|
||||||
(d if str(c) != str(labels[present[i]]) else
|
(d if str(c) != str(labels[present[i]]) else
|
||||||
1)))
|
1)))
|
||||||
use = np.array(columns) if len(columns) > 0 else None
|
use = np.array(columns) if len(columns) > 0 else None
|
||||||
|
|
||||||
self.tags = list(np.array(self.tags)[use]) # update labels with valid subset
|
self.tags = list(np.array(self.__IO__['tags'])[use]) # update labels with valid subset
|
||||||
|
|
||||||
self.data = np.loadtxt(self.__IO__['in'],usecols=use,ndmin=2)
|
self.data = np.loadtxt(self.__IO__['in'],usecols=use,ndmin=2)
|
||||||
# self.data = np.genfromtxt(self.__IO__['in'],dtype=None,names=self.tags,usecols=use)
|
# self.data = np.genfromtxt(self.__IO__['in'],dtype=None,names=self.tags,usecols=use)
|
|
@ -7,24 +7,6 @@
|
||||||
import math,os
|
import math,os
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
# ******************************************************************************************
|
|
||||||
class Rodrigues:
|
|
||||||
|
|
||||||
def __init__(self, vector = np.zeros(3)):
|
|
||||||
self.vector = vector
|
|
||||||
|
|
||||||
def asQuaternion(self):
|
|
||||||
norm = np.linalg.norm(self.vector)
|
|
||||||
halfAngle = np.arctan(norm)
|
|
||||||
return Quaternion(np.cos(halfAngle),np.sin(halfAngle)*self.vector/norm)
|
|
||||||
|
|
||||||
def asAngleAxis(self):
|
|
||||||
norm = np.linalg.norm(self.vector)
|
|
||||||
halfAngle = np.arctan(norm)
|
|
||||||
return (2.0*halfAngle,self.vector/norm)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ******************************************************************************************
|
# ******************************************************************************************
|
||||||
class Quaternion:
|
class Quaternion:
|
||||||
u"""
|
u"""
|
||||||
|
@ -87,11 +69,11 @@ class Quaternion:
|
||||||
"""Multiplication"""
|
"""Multiplication"""
|
||||||
# Rowenhorst_etal2015 MSMSE: value of P is selected as -1
|
# Rowenhorst_etal2015 MSMSE: value of P is selected as -1
|
||||||
P = -1.0
|
P = -1.0
|
||||||
try: # quaternion
|
try: # quaternion
|
||||||
return self.__class__(q=self.q*other.q - np.dot(self.p,other.p),
|
return self.__class__(q=self.q*other.q - np.dot(self.p,other.p),
|
||||||
p=self.q*other.p + other.q*self.p + P * np.cross(self.p,other.p))
|
p=self.q*other.p + other.q*self.p + P * np.cross(self.p,other.p))
|
||||||
except: pass
|
except: pass
|
||||||
try: # vector (perform passive rotation)
|
try: # vector (perform passive rotation)
|
||||||
( x, y, z) = self.p
|
( x, y, z) = self.p
|
||||||
(Vx,Vy,Vz) = other[0:3]
|
(Vx,Vy,Vz) = other[0:3]
|
||||||
A = self.q*self.q - np.dot(self.p,self.p)
|
A = self.q*self.q - np.dot(self.p,self.p)
|
||||||
|
@ -104,7 +86,7 @@ class Quaternion:
|
||||||
A*Vz + B*z + C*(x*Vy - y*Vx),
|
A*Vz + B*z + C*(x*Vy - y*Vx),
|
||||||
])
|
])
|
||||||
except: pass
|
except: pass
|
||||||
try: # scalar
|
try: # scalar
|
||||||
return self.__class__(q=self.q*other,
|
return self.__class__(q=self.q*other,
|
||||||
p=self.p*other)
|
p=self.p*other)
|
||||||
except:
|
except:
|
||||||
|
@ -114,7 +96,7 @@ class Quaternion:
|
||||||
"""In-place multiplication"""
|
"""In-place multiplication"""
|
||||||
# Rowenhorst_etal2015 MSMSE: value of P is selected as -1
|
# Rowenhorst_etal2015 MSMSE: value of P is selected as -1
|
||||||
P = -1.0
|
P = -1.0
|
||||||
try: # Quaternion
|
try: # Quaternion
|
||||||
self.q = self.q*other.q - np.dot(self.p,other.p)
|
self.q = self.q*other.q - np.dot(self.p,other.p)
|
||||||
self.p = self.q*other.p + other.q*self.p + P * np.cross(self.p,other.p)
|
self.p = self.q*other.p + other.q*self.p + P * np.cross(self.p,other.p)
|
||||||
except: pass
|
except: pass
|
||||||
|
@ -178,12 +160,13 @@ class Quaternion:
|
||||||
magnitude = __abs__
|
magnitude = __abs__
|
||||||
|
|
||||||
def __eq__(self,other):
|
def __eq__(self,other):
|
||||||
"""Equal at e-8 precision"""
|
"""Equal (sufficiently close) to each other"""
|
||||||
return (self-other).magnitude() < 1e-8 or (-self-other).magnitude() < 1e-8
|
return np.isclose(( self-other).magnitude(),0.0) \
|
||||||
|
or np.isclose((-self-other).magnitude(),0.0)
|
||||||
|
|
||||||
def __ne__(self,other):
|
def __ne__(self,other):
|
||||||
"""Not equal at e-8 precision"""
|
"""Not equal (sufficiently close) to each other"""
|
||||||
return not self.__eq__(self,other)
|
return not self.__eq__(other)
|
||||||
|
|
||||||
def __cmp__(self,other):
|
def __cmp__(self,other):
|
||||||
"""Linear ordering"""
|
"""Linear ordering"""
|
||||||
|
@ -193,11 +176,6 @@ class Quaternion:
|
||||||
def magnitude_squared(self):
|
def magnitude_squared(self):
|
||||||
return self.q ** 2 + np.dot(self.p,self.p)
|
return self.q ** 2 + np.dot(self.p,self.p)
|
||||||
|
|
||||||
def identity(self):
|
|
||||||
self.q = 1.
|
|
||||||
self.p = np.zeros(3,dtype=float)
|
|
||||||
return self
|
|
||||||
|
|
||||||
def normalize(self):
|
def normalize(self):
|
||||||
d = self.magnitude()
|
d = self.magnitude()
|
||||||
if d > 0.0:
|
if d > 0.0:
|
||||||
|
@ -209,13 +187,6 @@ class Quaternion:
|
||||||
self.p = -self.p
|
self.p = -self.p
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def inverse(self):
|
|
||||||
d = self.magnitude()
|
|
||||||
if d > 0.0:
|
|
||||||
self.conjugate()
|
|
||||||
self /= d
|
|
||||||
return self
|
|
||||||
|
|
||||||
def homomorph(self):
|
def homomorph(self):
|
||||||
if self.q < 0.0:
|
if self.q < 0.0:
|
||||||
self.q = -self.q
|
self.q = -self.q
|
||||||
|
@ -228,16 +199,13 @@ class Quaternion:
|
||||||
def conjugated(self):
|
def conjugated(self):
|
||||||
return self.copy().conjugate()
|
return self.copy().conjugate()
|
||||||
|
|
||||||
def inversed(self):
|
|
||||||
return self.copy().inverse()
|
|
||||||
|
|
||||||
def homomorphed(self):
|
def homomorphed(self):
|
||||||
return self.copy().homomorph()
|
return self.copy().homomorph()
|
||||||
|
|
||||||
def asList(self):
|
def asList(self):
|
||||||
return [self.q]+list(self.p)
|
return [self.q]+list(self.p)
|
||||||
|
|
||||||
def asM(self): # to find Averaging Quaternions (see F. Landis Markley et al.)
|
def asM(self): # to find Averaging Quaternions (see F. Landis Markley et al.)
|
||||||
return np.outer(self.asList(),self.asList())
|
return np.outer(self.asList(),self.asList())
|
||||||
|
|
||||||
def asMatrix(self):
|
def asMatrix(self):
|
||||||
|
@ -257,24 +225,26 @@ class Quaternion:
|
||||||
])
|
])
|
||||||
|
|
||||||
def asAngleAxis(self,
|
def asAngleAxis(self,
|
||||||
degrees = False):
|
degrees = False,
|
||||||
if self.q > 1.:
|
flat = False):
|
||||||
self.normalize()
|
|
||||||
|
|
||||||
s = math.sqrt(1. - self.q**2)
|
angle = 2.0*math.acos(self.q)
|
||||||
x = 2*self.q**2 - 1.
|
|
||||||
y = 2*self.q * s
|
|
||||||
|
|
||||||
angle = math.atan2(y,x)
|
if np.isclose(angle,0.0):
|
||||||
if angle < 0.0:
|
angle = 0.0
|
||||||
angle *= -1.
|
axis = np.array([0.0,0.0,1.0])
|
||||||
s *= -1.
|
elif np.isclose(self.q,0.0):
|
||||||
|
angle = math.pi
|
||||||
|
axis = self.p
|
||||||
|
else:
|
||||||
|
axis = np.sign(self.q)*self.p/np.linalg.norm(self.p)
|
||||||
|
|
||||||
return (np.degrees(angle) if degrees else angle,
|
angle = np.degrees(angle) if degrees else angle
|
||||||
np.array([1.0, 0.0, 0.0] if np.abs(angle) < 1e-6 else self.p / s))
|
|
||||||
|
return np.hstack((angle,axis)) if flat else (angle,axis)
|
||||||
|
|
||||||
def asRodrigues(self):
|
def asRodrigues(self):
|
||||||
return np.inf*np.ones(3) if self.q == 0.0 else self.p/self.q
|
return np.inf*np.ones(3) if np.isclose(self.q,0.0) else self.p/self.q
|
||||||
|
|
||||||
def asEulers(self,
|
def asEulers(self,
|
||||||
degrees = False):
|
degrees = False):
|
||||||
|
@ -285,9 +255,9 @@ class Quaternion:
|
||||||
q12 = self.p[0]**2 + self.p[1]**2
|
q12 = self.p[0]**2 + self.p[1]**2
|
||||||
chi = np.sqrt(q03*q12)
|
chi = np.sqrt(q03*q12)
|
||||||
|
|
||||||
if abs(chi) < 1e-10 and abs(q12) < 1e-10:
|
if np.isclose(chi,0.0) and np.isclose(q12,0.0):
|
||||||
eulers = np.array([math.atan2(-2*P*self.q*self.p[2],self.q**2-self.p[2]**2),0,0])
|
eulers = np.array([math.atan2(-2*P*self.q*self.p[2],self.q**2-self.p[2]**2),0,0])
|
||||||
elif abs(chi) < 1e-10 and abs(q03) < 1e-10:
|
elif np.isclose(chi,0.0) and np.isclose(q03,0.0):
|
||||||
eulers = np.array([math.atan2( 2 *self.p[0]*self.p[1],self.p[0]**2-self.p[1]**2),np.pi,0])
|
eulers = np.array([math.atan2( 2 *self.p[0]*self.p[1],self.p[0]**2-self.p[1]**2),np.pi,0])
|
||||||
else:
|
else:
|
||||||
eulers = np.array([math.atan2((self.p[0]*self.p[2]-P*self.q*self.p[1])/chi,(-P*self.q*self.p[0]-self.p[1]*self.p[2])/chi),
|
eulers = np.array([math.atan2((self.p[0]*self.p[2]-P*self.q*self.p[1])/chi,(-P*self.q*self.p[0]-self.p[1]*self.p[2])/chi),
|
||||||
|
@ -295,6 +265,7 @@ class Quaternion:
|
||||||
math.atan2((P*self.q*self.p[1]+self.p[0]*self.p[2])/chi,( self.p[1]*self.p[2]-P*self.q*self.p[0])/chi),
|
math.atan2((P*self.q*self.p[1]+self.p[0]*self.p[2])/chi,( self.p[1]*self.p[2]-P*self.q*self.p[0])/chi),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
eulers %= 2.0*math.pi # enforce positive angles
|
||||||
return np.degrees(eulers) if degrees else eulers
|
return np.degrees(eulers) if degrees else eulers
|
||||||
|
|
||||||
|
|
||||||
|
@ -311,10 +282,12 @@ class Quaternion:
|
||||||
randomSeed = int(binascii.hexlify(os.urandom(4)),16)
|
randomSeed = int(binascii.hexlify(os.urandom(4)),16)
|
||||||
np.random.seed(randomSeed)
|
np.random.seed(randomSeed)
|
||||||
r = np.random.random(3)
|
r = np.random.random(3)
|
||||||
w = math.cos(2.0*math.pi*r[0])*math.sqrt(r[2])
|
A = math.sqrt(max(0.0,r[2]))
|
||||||
x = math.sin(2.0*math.pi*r[1])*math.sqrt(1.0-r[2])
|
B = math.sqrt(max(0.0,1.0-r[2]))
|
||||||
y = math.cos(2.0*math.pi*r[1])*math.sqrt(1.0-r[2])
|
w = math.cos(2.0*math.pi*r[0])*A
|
||||||
z = math.sin(2.0*math.pi*r[0])*math.sqrt(r[2])
|
x = math.sin(2.0*math.pi*r[1])*B
|
||||||
|
y = math.cos(2.0*math.pi*r[1])*B
|
||||||
|
z = math.sin(2.0*math.pi*r[0])*A
|
||||||
return cls(quat=[w,x,y,z])
|
return cls(quat=[w,x,y,z])
|
||||||
|
|
||||||
|
|
||||||
|
@ -372,10 +345,10 @@ class Quaternion:
|
||||||
|
|
||||||
# Rowenhorst_etal2015 MSMSE: value of P is selected as -1
|
# Rowenhorst_etal2015 MSMSE: value of P is selected as -1
|
||||||
P = -1.0
|
P = -1.0
|
||||||
w = 0.5*math.sqrt(1.+m[0,0]+m[1,1]+m[2,2])
|
w = 0.5*math.sqrt(max(0.0,1.0+m[0,0]+m[1,1]+m[2,2]))
|
||||||
x = P*0.5*math.sqrt(1.+m[0,0]-m[1,1]-m[2,2])
|
x = P*0.5*math.sqrt(max(0.0,1.0+m[0,0]-m[1,1]-m[2,2]))
|
||||||
y = P*0.5*math.sqrt(1.-m[0,0]+m[1,1]-m[2,2])
|
y = P*0.5*math.sqrt(max(0.0,1.0-m[0,0]+m[1,1]-m[2,2]))
|
||||||
z = P*0.5*math.sqrt(1.-m[0,0]-m[1,1]+m[2,2])
|
z = P*0.5*math.sqrt(max(0.0,1.0-m[0,0]-m[1,1]+m[2,2]))
|
||||||
|
|
||||||
x *= -1 if m[2,1] < m[1,2] else 1
|
x *= -1 if m[2,1] < m[1,2] else 1
|
||||||
y *= -1 if m[0,2] < m[2,0] else 1
|
y *= -1 if m[0,2] < m[2,0] else 1
|
||||||
|
@ -443,16 +416,16 @@ class Symmetry:
|
||||||
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
"""Readbable string"""
|
"""Readable string"""
|
||||||
return '{}'.format(self.lattice)
|
return '{}'.format(self.lattice)
|
||||||
|
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
"""Equal"""
|
"""Equal to other"""
|
||||||
return self.lattice == other.lattice
|
return self.lattice == other.lattice
|
||||||
|
|
||||||
def __neq__(self, other):
|
def __neq__(self, other):
|
||||||
"""Not equal"""
|
"""Not equal to other"""
|
||||||
return not self.__eq__(other)
|
return not self.__eq__(other)
|
||||||
|
|
||||||
def __cmp__(self,other):
|
def __cmp__(self,other):
|
||||||
|
@ -529,7 +502,7 @@ class Symmetry:
|
||||||
]
|
]
|
||||||
|
|
||||||
return list(map(Quaternion,
|
return list(map(Quaternion,
|
||||||
np.array(symQuats)[np.atleast_1d(np.array(who)) if who != [] else range(len(symQuats))]))
|
np.array(symQuats)[np.atleast_1d(np.array(who)) if who != [] else range(len(symQuats))]))
|
||||||
|
|
||||||
|
|
||||||
def equivalentQuaternions(self,
|
def equivalentQuaternions(self,
|
||||||
|
@ -541,7 +514,7 @@ class Symmetry:
|
||||||
|
|
||||||
def inFZ(self,R):
|
def inFZ(self,R):
|
||||||
"""Check whether given Rodrigues vector falls into fundamental zone of own symmetry."""
|
"""Check whether given Rodrigues vector falls into fundamental zone of own symmetry."""
|
||||||
if isinstance(R, Quaternion): R = R.asRodrigues() # translate accidentially passed quaternion
|
if isinstance(R, Quaternion): R = R.asRodrigues() # translate accidentally passed quaternion
|
||||||
# fundamental zone in Rodrigues space is point symmetric around origin
|
# fundamental zone in Rodrigues space is point symmetric around origin
|
||||||
R = abs(R)
|
R = abs(R)
|
||||||
if self.lattice == 'cubic':
|
if self.lattice == 'cubic':
|
||||||
|
@ -668,7 +641,7 @@ class Symmetry:
|
||||||
if color: # have to return color array
|
if color: # have to return color array
|
||||||
if inSST:
|
if inSST:
|
||||||
rgb = np.power(theComponents/np.linalg.norm(theComponents),0.5) # smoothen color ramps
|
rgb = np.power(theComponents/np.linalg.norm(theComponents),0.5) # smoothen color ramps
|
||||||
rgb = np.minimum(np.ones(3,dtype=float),rgb) # limit to maximum intensity
|
rgb = np.minimum(np.ones(3,dtype=float),rgb) # limit to maximum intensity
|
||||||
rgb /= max(rgb) # normalize to (HS)V = 1
|
rgb /= max(rgb) # normalize to (HS)V = 1
|
||||||
else:
|
else:
|
||||||
rgb = np.zeros(3,dtype=float)
|
rgb = np.zeros(3,dtype=float)
|
||||||
|
@ -747,8 +720,9 @@ class Orientation:
|
||||||
rodrigues = property(asRodrigues)
|
rodrigues = property(asRodrigues)
|
||||||
|
|
||||||
def asAngleAxis(self,
|
def asAngleAxis(self,
|
||||||
degrees = False):
|
degrees = False,
|
||||||
return self.quaternion.asAngleAxis(degrees)
|
flat = False):
|
||||||
|
return self.quaternion.asAngleAxis(degrees,flat)
|
||||||
angleAxis = property(asAngleAxis)
|
angleAxis = property(asAngleAxis)
|
||||||
|
|
||||||
def asMatrix(self):
|
def asMatrix(self):
|
|
@ -132,6 +132,43 @@ class extendableOption(Option):
|
||||||
else:
|
else:
|
||||||
Option.take_action(self, action, dest, opt, value, values, parser)
|
Option.take_action(self, action, dest, opt, value, values, parser)
|
||||||
|
|
||||||
|
# Print iterations progress
|
||||||
|
# from https://gist.github.com/aubricus/f91fb55dc6ba5557fbab06119420dd6a
|
||||||
|
def progressBar(iteration, total, prefix='', bar_length=50):
|
||||||
|
"""
|
||||||
|
Call in a loop to create terminal progress bar
|
||||||
|
|
||||||
|
@params:
|
||||||
|
iteration - Required : current iteration (Int)
|
||||||
|
total - Required : total iterations (Int)
|
||||||
|
prefix - Optional : prefix string (Str)
|
||||||
|
bar_length - Optional : character length of bar (Int)
|
||||||
|
"""
|
||||||
|
fraction = iteration / float(total)
|
||||||
|
if not hasattr(progressBar, "last_fraction"): # first call to function
|
||||||
|
progressBar.start_time = time.time()
|
||||||
|
progressBar.last_fraction = -1.0
|
||||||
|
remaining_time = ' n/a'
|
||||||
|
else:
|
||||||
|
if fraction <= progressBar.last_fraction or iteration == 0: # reset: called within a new loop
|
||||||
|
progressBar.start_time = time.time()
|
||||||
|
progressBar.last_fraction = -1.0
|
||||||
|
remaining_time = ' n/a'
|
||||||
|
else:
|
||||||
|
progressBar.last_fraction = fraction
|
||||||
|
remainder = (total - iteration) * (time.time()-progressBar.start_time)/iteration
|
||||||
|
remaining_time = '{: 3d}:'.format(int( remainder//3600)) + \
|
||||||
|
'{:02d}:'.format(int((remainder//60)%60)) + \
|
||||||
|
'{:02d}' .format(int( remainder %60))
|
||||||
|
|
||||||
|
filled_length = int(round(bar_length * fraction))
|
||||||
|
bar = '█' * filled_length + '░' * (bar_length - filled_length)
|
||||||
|
|
||||||
|
sys.stderr.write('\r{} {} {}'.format(prefix, bar, remaining_time)),
|
||||||
|
|
||||||
|
if iteration == total: sys.stderr.write('\n\n')
|
||||||
|
sys.stderr.flush()
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
class backgroundMessage(threading.Thread):
|
class backgroundMessage(threading.Thread):
|
||||||
"""Reporting with animation to indicate progress"""
|
"""Reporting with animation to indicate progress"""
|
|
@ -94,9 +94,7 @@ list(APPEND OBJECTFILES $<TARGET_OBJECTS:PLASTIC>)
|
||||||
add_library (KINEMATICS OBJECT
|
add_library (KINEMATICS OBJECT
|
||||||
"kinematics_cleavage_opening.f90"
|
"kinematics_cleavage_opening.f90"
|
||||||
"kinematics_slipplane_opening.f90"
|
"kinematics_slipplane_opening.f90"
|
||||||
"kinematics_thermal_expansion.f90"
|
"kinematics_thermal_expansion.f90")
|
||||||
"kinematics_vacancy_strain.f90"
|
|
||||||
"kinematics_hydrogen_strain.f90")
|
|
||||||
add_dependencies(KINEMATICS DAMASK_HELPERS)
|
add_dependencies(KINEMATICS DAMASK_HELPERS)
|
||||||
list(APPEND OBJECTFILES $<TARGET_OBJECTS:KINEMATICS>)
|
list(APPEND OBJECTFILES $<TARGET_OBJECTS:KINEMATICS>)
|
||||||
|
|
||||||
|
@ -106,10 +104,7 @@ add_library (SOURCE OBJECT
|
||||||
"source_damage_isoBrittle.f90"
|
"source_damage_isoBrittle.f90"
|
||||||
"source_damage_isoDuctile.f90"
|
"source_damage_isoDuctile.f90"
|
||||||
"source_damage_anisoBrittle.f90"
|
"source_damage_anisoBrittle.f90"
|
||||||
"source_damage_anisoDuctile.f90"
|
"source_damage_anisoDuctile.f90")
|
||||||
"source_vacancy_phenoplasticity.f90"
|
|
||||||
"source_vacancy_irradiation.f90"
|
|
||||||
"source_vacancy_thermalfluc.f90")
|
|
||||||
add_dependencies(SOURCE DAMASK_HELPERS)
|
add_dependencies(SOURCE DAMASK_HELPERS)
|
||||||
list(APPEND OBJECTFILES $<TARGET_OBJECTS:SOURCE>)
|
list(APPEND OBJECTFILES $<TARGET_OBJECTS:SOURCE>)
|
||||||
|
|
||||||
|
@ -128,25 +123,6 @@ add_library(HOMOGENIZATION OBJECT
|
||||||
add_dependencies(HOMOGENIZATION CRYSTALLITE)
|
add_dependencies(HOMOGENIZATION CRYSTALLITE)
|
||||||
list(APPEND OBJECTFILES $<TARGET_OBJECTS:HOMOGENIZATION>)
|
list(APPEND OBJECTFILES $<TARGET_OBJECTS:HOMOGENIZATION>)
|
||||||
|
|
||||||
add_library(HYDROGENFLUX OBJECT
|
|
||||||
"hydrogenflux_isoconc.f90"
|
|
||||||
"hydrogenflux_cahnhilliard.f90")
|
|
||||||
add_dependencies(HYDROGENFLUX CRYSTALLITE)
|
|
||||||
list(APPEND OBJECTFILES $<TARGET_OBJECTS:HYDROGENFLUX>)
|
|
||||||
|
|
||||||
add_library(POROSITY OBJECT
|
|
||||||
"porosity_none.f90"
|
|
||||||
"porosity_phasefield.f90")
|
|
||||||
add_dependencies(POROSITY CRYSTALLITE)
|
|
||||||
list(APPEND OBJECTFILES $<TARGET_OBJECTS:POROSITY>)
|
|
||||||
|
|
||||||
add_library(VACANCYFLUX OBJECT
|
|
||||||
"vacancyflux_isoconc.f90"
|
|
||||||
"vacancyflux_isochempot.f90"
|
|
||||||
"vacancyflux_cahnhilliard.f90")
|
|
||||||
add_dependencies(VACANCYFLUX CRYSTALLITE)
|
|
||||||
list(APPEND OBJECTFILES $<TARGET_OBJECTS:VACANCYFLUX>)
|
|
||||||
|
|
||||||
add_library(DAMAGE OBJECT
|
add_library(DAMAGE OBJECT
|
||||||
"damage_none.f90"
|
"damage_none.f90"
|
||||||
"damage_local.f90"
|
"damage_local.f90"
|
||||||
|
@ -162,7 +138,7 @@ add_dependencies(THERMAL CRYSTALLITE)
|
||||||
list(APPEND OBJECTFILES $<TARGET_OBJECTS:THERMAL>)
|
list(APPEND OBJECTFILES $<TARGET_OBJECTS:THERMAL>)
|
||||||
|
|
||||||
add_library(DAMASK_ENGINE OBJECT "homogenization.f90")
|
add_library(DAMASK_ENGINE OBJECT "homogenization.f90")
|
||||||
add_dependencies(DAMASK_ENGINE THERMAL DAMAGE VACANCYFLUX POROSITY HYDROGENFLUX HOMOGENIZATION)
|
add_dependencies(DAMASK_ENGINE THERMAL DAMAGE HOMOGENIZATION)
|
||||||
list(APPEND OBJECTFILES $<TARGET_OBJECTS:DAMASK_ENGINE>)
|
list(APPEND OBJECTFILES $<TARGET_OBJECTS:DAMASK_ENGINE>)
|
||||||
|
|
||||||
add_library(DAMASK_CPFE OBJECT "CPFEM2.f90")
|
add_library(DAMASK_CPFE OBJECT "CPFEM2.f90")
|
||||||
|
|
|
@ -304,8 +304,6 @@ subroutine CPFEM_general(mode, parallelExecution, ffn, ffn1, temperature_inp, dt
|
||||||
homogState, &
|
homogState, &
|
||||||
thermalState, &
|
thermalState, &
|
||||||
damageState, &
|
damageState, &
|
||||||
vacancyfluxState, &
|
|
||||||
hydrogenfluxState, &
|
|
||||||
phaseAt, phasememberAt, &
|
phaseAt, phasememberAt, &
|
||||||
material_phase, &
|
material_phase, &
|
||||||
phase_plasticity, &
|
phase_plasticity, &
|
||||||
|
@ -421,8 +419,6 @@ subroutine CPFEM_general(mode, parallelExecution, ffn, ffn1, temperature_inp, dt
|
||||||
homogState (homog)%state0 = homogState (homog)%state
|
homogState (homog)%state0 = homogState (homog)%state
|
||||||
thermalState (homog)%state0 = thermalState (homog)%state
|
thermalState (homog)%state0 = thermalState (homog)%state
|
||||||
damageState (homog)%state0 = damageState (homog)%state
|
damageState (homog)%state0 = damageState (homog)%state
|
||||||
vacancyfluxState (homog)%state0 = vacancyfluxState (homog)%state
|
|
||||||
hydrogenfluxState(homog)%state0 = hydrogenfluxState(homog)%state
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,6 @@ subroutine CPFEM_init
|
||||||
enddo
|
enddo
|
||||||
call HDF5_closeGroup(groupHomogID)
|
call HDF5_closeGroup(groupHomogID)
|
||||||
|
|
||||||
|
|
||||||
call HDF5_closeFile(fileHandle)
|
call HDF5_closeFile(fileHandle)
|
||||||
|
|
||||||
restartRead = .false.
|
restartRead = .false.
|
||||||
|
@ -209,8 +208,6 @@ subroutine CPFEM_age()
|
||||||
homogState, &
|
homogState, &
|
||||||
thermalState, &
|
thermalState, &
|
||||||
damageState, &
|
damageState, &
|
||||||
vacancyfluxState, &
|
|
||||||
hydrogenfluxState, &
|
|
||||||
material_phase, &
|
material_phase, &
|
||||||
phase_plasticity, &
|
phase_plasticity, &
|
||||||
phase_Nsources
|
phase_Nsources
|
||||||
|
@ -271,8 +268,6 @@ subroutine CPFEM_age()
|
||||||
homogState (homog)%state0 = homogState (homog)%state
|
homogState (homog)%state0 = homogState (homog)%state
|
||||||
thermalState (homog)%state0 = thermalState (homog)%state
|
thermalState (homog)%state0 = thermalState (homog)%state
|
||||||
damageState (homog)%state0 = damageState (homog)%state
|
damageState (homog)%state0 = damageState (homog)%state
|
||||||
vacancyfluxState (homog)%state0 = vacancyfluxState (homog)%state
|
|
||||||
hydrogenfluxState(homog)%state0 = hydrogenfluxState(homog)%state
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
if (restartWrite) then
|
if (restartWrite) then
|
||||||
|
@ -332,7 +327,7 @@ subroutine CPFEM_results(inc,time)
|
||||||
call results_openJobFile
|
call results_openJobFile
|
||||||
call results_addIncrement(inc,time)
|
call results_addIncrement(inc,time)
|
||||||
call constitutive_results()
|
call constitutive_results()
|
||||||
call results_removeLink('current') ! put this into closeJobFile
|
call results_removeLink('current') ! ToDo: put this into closeJobFile
|
||||||
call results_closeJobFile
|
call results_closeJobFile
|
||||||
|
|
||||||
end subroutine CPFEM_results
|
end subroutine CPFEM_results
|
||||||
|
|
|
@ -1251,6 +1251,8 @@ subroutine IO_error(error_ID,el,ip,g,instance,ext_msg)
|
||||||
msg = 'negative number systems requested'
|
msg = 'negative number systems requested'
|
||||||
case (145_pInt)
|
case (145_pInt)
|
||||||
msg = 'too many systems requested'
|
msg = 'too many systems requested'
|
||||||
|
case (146_pInt)
|
||||||
|
msg = 'number of values does not match'
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! material error messages and related messages in mesh
|
! material error messages and related messages in mesh
|
||||||
|
|
|
@ -21,14 +21,9 @@
|
||||||
#include "source_damage_isoDuctile.f90"
|
#include "source_damage_isoDuctile.f90"
|
||||||
#include "source_damage_anisoBrittle.f90"
|
#include "source_damage_anisoBrittle.f90"
|
||||||
#include "source_damage_anisoDuctile.f90"
|
#include "source_damage_anisoDuctile.f90"
|
||||||
#include "source_vacancy_phenoplasticity.f90"
|
|
||||||
#include "source_vacancy_irradiation.f90"
|
|
||||||
#include "source_vacancy_thermalfluc.f90"
|
|
||||||
#include "kinematics_cleavage_opening.f90"
|
#include "kinematics_cleavage_opening.f90"
|
||||||
#include "kinematics_slipplane_opening.f90"
|
#include "kinematics_slipplane_opening.f90"
|
||||||
#include "kinematics_thermal_expansion.f90"
|
#include "kinematics_thermal_expansion.f90"
|
||||||
#include "kinematics_vacancy_strain.f90"
|
|
||||||
#include "kinematics_hydrogen_strain.f90"
|
|
||||||
#include "plastic_none.f90"
|
#include "plastic_none.f90"
|
||||||
#include "plastic_isotropic.f90"
|
#include "plastic_isotropic.f90"
|
||||||
#include "plastic_phenopowerlaw.f90"
|
#include "plastic_phenopowerlaw.f90"
|
||||||
|
@ -47,12 +42,5 @@
|
||||||
#include "damage_none.f90"
|
#include "damage_none.f90"
|
||||||
#include "damage_local.f90"
|
#include "damage_local.f90"
|
||||||
#include "damage_nonlocal.f90"
|
#include "damage_nonlocal.f90"
|
||||||
#include "vacancyflux_isoconc.f90"
|
|
||||||
#include "vacancyflux_isochempot.f90"
|
|
||||||
#include "vacancyflux_cahnhilliard.f90"
|
|
||||||
#include "porosity_none.f90"
|
|
||||||
#include "porosity_phasefield.f90"
|
|
||||||
#include "hydrogenflux_isoconc.f90"
|
|
||||||
#include "hydrogenflux_cahnhilliard.f90"
|
|
||||||
#include "homogenization.f90"
|
#include "homogenization.f90"
|
||||||
#include "CPFEM.f90"
|
#include "CPFEM.f90"
|
||||||
|
|
|
@ -142,7 +142,7 @@ subroutine config_init()
|
||||||
|
|
||||||
case (trim(material_partPhase))
|
case (trim(material_partPhase))
|
||||||
call parseFile(phase_name,config_phase,line,fileContent(i+1:))
|
call parseFile(phase_name,config_phase,line,fileContent(i+1:))
|
||||||
if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Phase parsed'; flush(6)
|
if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Phase parsed'; flush(6)
|
||||||
|
|
||||||
case (trim(material_partMicrostructure))
|
case (trim(material_partMicrostructure))
|
||||||
call parseFile(microstructure_name,config_microstructure,line,fileContent(i+1:))
|
call parseFile(microstructure_name,config_microstructure,line,fileContent(i+1:))
|
||||||
|
@ -150,7 +150,7 @@ subroutine config_init()
|
||||||
|
|
||||||
case (trim(material_partCrystallite))
|
case (trim(material_partCrystallite))
|
||||||
call parseFile(crystallite_name,config_crystallite,line,fileContent(i+1:))
|
call parseFile(crystallite_name,config_crystallite,line,fileContent(i+1:))
|
||||||
if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Crystallite parsed'; flush(6)
|
if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Crystallite parsed'; flush(6)
|
||||||
|
|
||||||
case (trim(material_partHomogenization))
|
case (trim(material_partHomogenization))
|
||||||
call parseFile(homogenization_name,config_homogenization,line,fileContent(i+1:))
|
call parseFile(homogenization_name,config_homogenization,line,fileContent(i+1:))
|
||||||
|
@ -158,7 +158,7 @@ subroutine config_init()
|
||||||
|
|
||||||
case (trim(material_partTexture))
|
case (trim(material_partTexture))
|
||||||
call parseFile(texture_name,config_texture,line,fileContent(i+1:))
|
call parseFile(texture_name,config_texture,line,fileContent(i+1:))
|
||||||
if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Texture parsed'; flush(6)
|
if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Texture parsed'; flush(6)
|
||||||
|
|
||||||
end select
|
end select
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ subroutine show(this)
|
||||||
do while (associated(item%next))
|
do while (associated(item%next))
|
||||||
write(6,'(a)') ' '//trim(item%string%val)
|
write(6,'(a)') ' '//trim(item%string%val)
|
||||||
item => item%next
|
item => item%next
|
||||||
end do
|
enddo
|
||||||
|
|
||||||
end subroutine show
|
end subroutine show
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ logical function keyExists(this,key)
|
||||||
do while (associated(item%next) .and. .not. keyExists)
|
do while (associated(item%next) .and. .not. keyExists)
|
||||||
keyExists = trim(IO_stringValue(item%string%val,item%string%pos,1)) == trim(key)
|
keyExists = trim(IO_stringValue(item%string%val,item%string%pos,1)) == trim(key)
|
||||||
item => item%next
|
item => item%next
|
||||||
end do
|
enddo
|
||||||
|
|
||||||
end function keyExists
|
end function keyExists
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ integer(pInt) function countKeys(this,key)
|
||||||
if (trim(IO_stringValue(item%string%val,item%string%pos,1)) == trim(key)) &
|
if (trim(IO_stringValue(item%string%val,item%string%pos,1)) == trim(key)) &
|
||||||
countKeys = countKeys + 1_pInt
|
countKeys = countKeys + 1_pInt
|
||||||
item => item%next
|
item => item%next
|
||||||
end do
|
enddo
|
||||||
|
|
||||||
end function countKeys
|
end function countKeys
|
||||||
|
|
||||||
|
@ -451,7 +451,7 @@ real(pReal) function getFloat(this,key,defaultVal)
|
||||||
getFloat = IO_FloatValue(item%string%val,item%string%pos,2)
|
getFloat = IO_FloatValue(item%string%val,item%string%pos,2)
|
||||||
endif
|
endif
|
||||||
item => item%next
|
item => item%next
|
||||||
end do
|
enddo
|
||||||
|
|
||||||
if (.not. found) call IO_error(140_pInt,ext_msg=key)
|
if (.not. found) call IO_error(140_pInt,ext_msg=key)
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ integer(pInt) function getInt(this,key,defaultVal)
|
||||||
getInt = IO_IntValue(item%string%val,item%string%pos,2)
|
getInt = IO_IntValue(item%string%val,item%string%pos,2)
|
||||||
endif
|
endif
|
||||||
item => item%next
|
item => item%next
|
||||||
end do
|
enddo
|
||||||
|
|
||||||
if (.not. found) call IO_error(140_pInt,ext_msg=key)
|
if (.not. found) call IO_error(140_pInt,ext_msg=key)
|
||||||
|
|
||||||
|
@ -538,7 +538,7 @@ character(len=65536) function getString(this,key,defaultVal,raw)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
item => item%next
|
item => item%next
|
||||||
end do
|
enddo
|
||||||
|
|
||||||
if (.not. found) call IO_error(140_pInt,ext_msg=key)
|
if (.not. found) call IO_error(140_pInt,ext_msg=key)
|
||||||
|
|
||||||
|
@ -550,7 +550,7 @@ end function getString
|
||||||
!> @details for cumulative keys, "()", values from all occurrences are return. Otherwise only all
|
!> @details for cumulative keys, "()", values from all occurrences are return. Otherwise only all
|
||||||
!! values from the last occurrence. If key is not found exits with error unless default is given.
|
!! values from the last occurrence. If key is not found exits with error unless default is given.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
function getFloats(this,key,defaultVal,requiredShape)
|
function getFloats(this,key,defaultVal,requiredShape,requiredSize)
|
||||||
use IO, only: &
|
use IO, only: &
|
||||||
IO_error, &
|
IO_error, &
|
||||||
IO_stringValue, &
|
IO_stringValue, &
|
||||||
|
@ -561,7 +561,8 @@ function getFloats(this,key,defaultVal,requiredShape)
|
||||||
class(tPartitionedStringList), target, intent(in) :: this
|
class(tPartitionedStringList), target, intent(in) :: this
|
||||||
character(len=*), intent(in) :: key
|
character(len=*), intent(in) :: key
|
||||||
real(pReal), dimension(:), intent(in), optional :: defaultVal
|
real(pReal), dimension(:), intent(in), optional :: defaultVal
|
||||||
integer(pInt), dimension(:), intent(in), optional :: requiredShape
|
integer(pInt), dimension(:), intent(in), optional :: requiredShape ! not useful (is always 1D array)
|
||||||
|
integer(pInt), intent(in), optional :: requiredSize
|
||||||
type(tPartitionedStringList), pointer :: item
|
type(tPartitionedStringList), pointer :: item
|
||||||
integer(pInt) :: i
|
integer(pInt) :: i
|
||||||
logical :: found, &
|
logical :: found, &
|
||||||
|
@ -583,11 +584,14 @@ function getFloats(this,key,defaultVal,requiredShape)
|
||||||
enddo
|
enddo
|
||||||
endif
|
endif
|
||||||
item => item%next
|
item => item%next
|
||||||
end do
|
enddo
|
||||||
|
|
||||||
if (.not. found) then
|
if (.not. found) then
|
||||||
if (present(defaultVal)) then; getFloats = defaultVal; else; call IO_error(140_pInt,ext_msg=key); endif
|
if (present(defaultVal)) then; getFloats = defaultVal; else; call IO_error(140_pInt,ext_msg=key); endif
|
||||||
endif
|
endif
|
||||||
|
if (present(requiredSize)) then
|
||||||
|
if(requiredSize /= size(getFloats)) call IO_error(146,ext_msg=key)
|
||||||
|
endif
|
||||||
|
|
||||||
end function getFloats
|
end function getFloats
|
||||||
|
|
||||||
|
@ -597,7 +601,7 @@ end function getFloats
|
||||||
!> @details for cumulative keys, "()", values from all occurrences are return. Otherwise only all
|
!> @details for cumulative keys, "()", values from all occurrences are return. Otherwise only all
|
||||||
!! values from the last occurrence. If key is not found exits with error unless default is given.
|
!! values from the last occurrence. If key is not found exits with error unless default is given.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
function getInts(this,key,defaultVal,requiredShape)
|
function getInts(this,key,defaultVal,requiredShape,requiredSize)
|
||||||
use IO, only: &
|
use IO, only: &
|
||||||
IO_error, &
|
IO_error, &
|
||||||
IO_stringValue, &
|
IO_stringValue, &
|
||||||
|
@ -608,7 +612,8 @@ function getInts(this,key,defaultVal,requiredShape)
|
||||||
class(tPartitionedStringList), target, intent(in) :: this
|
class(tPartitionedStringList), target, intent(in) :: this
|
||||||
character(len=*), intent(in) :: key
|
character(len=*), intent(in) :: key
|
||||||
integer(pInt), dimension(:), intent(in), optional :: defaultVal, &
|
integer(pInt), dimension(:), intent(in), optional :: defaultVal, &
|
||||||
requiredShape
|
requiredShape ! not useful (is always 1D array)
|
||||||
|
integer(pInt), intent(in), optional :: requiredSize
|
||||||
type(tPartitionedStringList), pointer :: item
|
type(tPartitionedStringList), pointer :: item
|
||||||
integer(pInt) :: i
|
integer(pInt) :: i
|
||||||
logical :: found, &
|
logical :: found, &
|
||||||
|
@ -630,11 +635,14 @@ function getInts(this,key,defaultVal,requiredShape)
|
||||||
enddo
|
enddo
|
||||||
endif
|
endif
|
||||||
item => item%next
|
item => item%next
|
||||||
end do
|
enddo
|
||||||
|
|
||||||
if (.not. found) then
|
if (.not. found) then
|
||||||
if (present(defaultVal)) then; getInts = defaultVal; else; call IO_error(140_pInt,ext_msg=key); endif
|
if (present(defaultVal)) then; getInts = defaultVal; else; call IO_error(140_pInt,ext_msg=key); endif
|
||||||
endif
|
endif
|
||||||
|
if (present(requiredSize)) then
|
||||||
|
if(requiredSize /= size(getInts)) call IO_error(146,ext_msg=key)
|
||||||
|
endif
|
||||||
|
|
||||||
end function getInts
|
end function getInts
|
||||||
|
|
||||||
|
@ -704,7 +712,7 @@ function getStrings(this,key,defaultVal,requiredShape,raw)
|
||||||
endif notAllocated
|
endif notAllocated
|
||||||
endif
|
endif
|
||||||
item => item%next
|
item => item%next
|
||||||
end do
|
enddo
|
||||||
|
|
||||||
if (.not. found) then
|
if (.not. found) then
|
||||||
if (present(defaultVal)) then; getStrings = defaultVal; else; call IO_error(140_pInt,ext_msg=key); endif
|
if (present(defaultVal)) then; getStrings = defaultVal; else; call IO_error(140_pInt,ext_msg=key); endif
|
||||||
|
|
|
@ -89,14 +89,9 @@ subroutine constitutive_init()
|
||||||
SOURCE_damage_isoDuctile_ID, &
|
SOURCE_damage_isoDuctile_ID, &
|
||||||
SOURCE_damage_anisoBrittle_ID, &
|
SOURCE_damage_anisoBrittle_ID, &
|
||||||
SOURCE_damage_anisoDuctile_ID, &
|
SOURCE_damage_anisoDuctile_ID, &
|
||||||
SOURCE_vacancy_phenoplasticity_ID, &
|
|
||||||
SOURCE_vacancy_irradiation_ID, &
|
|
||||||
SOURCE_vacancy_thermalfluc_ID, &
|
|
||||||
KINEMATICS_cleavage_opening_ID, &
|
KINEMATICS_cleavage_opening_ID, &
|
||||||
KINEMATICS_slipplane_opening_ID, &
|
KINEMATICS_slipplane_opening_ID, &
|
||||||
KINEMATICS_thermal_expansion_ID, &
|
KINEMATICS_thermal_expansion_ID, &
|
||||||
KINEMATICS_vacancy_strain_ID, &
|
|
||||||
KINEMATICS_hydrogen_strain_ID, &
|
|
||||||
ELASTICITY_HOOKE_label, &
|
ELASTICITY_HOOKE_label, &
|
||||||
PLASTICITY_NONE_label, &
|
PLASTICITY_NONE_label, &
|
||||||
PLASTICITY_ISOTROPIC_label, &
|
PLASTICITY_ISOTROPIC_label, &
|
||||||
|
@ -111,9 +106,6 @@ subroutine constitutive_init()
|
||||||
SOURCE_damage_isoDuctile_label, &
|
SOURCE_damage_isoDuctile_label, &
|
||||||
SOURCE_damage_anisoBrittle_label, &
|
SOURCE_damage_anisoBrittle_label, &
|
||||||
SOURCE_damage_anisoDuctile_label, &
|
SOURCE_damage_anisoDuctile_label, &
|
||||||
SOURCE_vacancy_phenoplasticity_label, &
|
|
||||||
SOURCE_vacancy_irradiation_label, &
|
|
||||||
SOURCE_vacancy_thermalfluc_label, &
|
|
||||||
plasticState, &
|
plasticState, &
|
||||||
sourceState
|
sourceState
|
||||||
|
|
||||||
|
@ -130,14 +122,9 @@ subroutine constitutive_init()
|
||||||
use source_damage_isoDuctile
|
use source_damage_isoDuctile
|
||||||
use source_damage_anisoBrittle
|
use source_damage_anisoBrittle
|
||||||
use source_damage_anisoDuctile
|
use source_damage_anisoDuctile
|
||||||
use source_vacancy_phenoplasticity
|
|
||||||
use source_vacancy_irradiation
|
|
||||||
use source_vacancy_thermalfluc
|
|
||||||
use kinematics_cleavage_opening
|
use kinematics_cleavage_opening
|
||||||
use kinematics_slipplane_opening
|
use kinematics_slipplane_opening
|
||||||
use kinematics_thermal_expansion
|
use kinematics_thermal_expansion
|
||||||
use kinematics_vacancy_strain
|
|
||||||
use kinematics_hydrogen_strain
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
integer(pInt), parameter :: FILEUNIT = 204_pInt
|
integer(pInt), parameter :: FILEUNIT = 204_pInt
|
||||||
|
@ -165,7 +152,7 @@ subroutine constitutive_init()
|
||||||
if (any(phase_plasticity == PLASTICITY_PHENOPOWERLAW_ID)) call plastic_phenopowerlaw_init
|
if (any(phase_plasticity == PLASTICITY_PHENOPOWERLAW_ID)) call plastic_phenopowerlaw_init
|
||||||
if (any(phase_plasticity == PLASTICITY_KINEHARDENING_ID)) call plastic_kinehardening_init(FILEUNIT)
|
if (any(phase_plasticity == PLASTICITY_KINEHARDENING_ID)) call plastic_kinehardening_init(FILEUNIT)
|
||||||
if (any(phase_plasticity == PLASTICITY_DISLOTWIN_ID)) call plastic_dislotwin_init(FILEUNIT)
|
if (any(phase_plasticity == PLASTICITY_DISLOTWIN_ID)) call plastic_dislotwin_init(FILEUNIT)
|
||||||
if (any(phase_plasticity == PLASTICITY_DISLOUCLA_ID)) call plastic_disloucla_init(FILEUNIT)
|
if (any(phase_plasticity == PLASTICITY_DISLOUCLA_ID)) call plastic_disloucla_init
|
||||||
if (any(phase_plasticity == PLASTICITY_NONLOCAL_ID)) then
|
if (any(phase_plasticity == PLASTICITY_NONLOCAL_ID)) then
|
||||||
call plastic_nonlocal_init(FILEUNIT)
|
call plastic_nonlocal_init(FILEUNIT)
|
||||||
call plastic_nonlocal_stateInit()
|
call plastic_nonlocal_stateInit()
|
||||||
|
@ -180,9 +167,6 @@ subroutine constitutive_init()
|
||||||
if (any(phase_source == SOURCE_damage_isoDuctile_ID)) call source_damage_isoDuctile_init(FILEUNIT)
|
if (any(phase_source == SOURCE_damage_isoDuctile_ID)) call source_damage_isoDuctile_init(FILEUNIT)
|
||||||
if (any(phase_source == SOURCE_damage_anisoBrittle_ID)) call source_damage_anisoBrittle_init(FILEUNIT)
|
if (any(phase_source == SOURCE_damage_anisoBrittle_ID)) call source_damage_anisoBrittle_init(FILEUNIT)
|
||||||
if (any(phase_source == SOURCE_damage_anisoDuctile_ID)) call source_damage_anisoDuctile_init(FILEUNIT)
|
if (any(phase_source == SOURCE_damage_anisoDuctile_ID)) call source_damage_anisoDuctile_init(FILEUNIT)
|
||||||
if (any(phase_source == SOURCE_vacancy_phenoplasticity_ID)) call source_vacancy_phenoplasticity_init(FILEUNIT)
|
|
||||||
if (any(phase_source == SOURCE_vacancy_irradiation_ID)) call source_vacancy_irradiation_init(FILEUNIT)
|
|
||||||
if (any(phase_source == SOURCE_vacancy_thermalfluc_ID)) call source_vacancy_thermalfluc_init(FILEUNIT)
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! parse kinematic mechanisms from config file
|
! parse kinematic mechanisms from config file
|
||||||
|
@ -190,8 +174,6 @@ subroutine constitutive_init()
|
||||||
if (any(phase_kinematics == KINEMATICS_cleavage_opening_ID)) call kinematics_cleavage_opening_init(FILEUNIT)
|
if (any(phase_kinematics == KINEMATICS_cleavage_opening_ID)) call kinematics_cleavage_opening_init(FILEUNIT)
|
||||||
if (any(phase_kinematics == KINEMATICS_slipplane_opening_ID)) call kinematics_slipplane_opening_init(FILEUNIT)
|
if (any(phase_kinematics == KINEMATICS_slipplane_opening_ID)) call kinematics_slipplane_opening_init(FILEUNIT)
|
||||||
if (any(phase_kinematics == KINEMATICS_thermal_expansion_ID)) call kinematics_thermal_expansion_init(FILEUNIT)
|
if (any(phase_kinematics == KINEMATICS_thermal_expansion_ID)) call kinematics_thermal_expansion_init(FILEUNIT)
|
||||||
if (any(phase_kinematics == KINEMATICS_vacancy_strain_ID)) call kinematics_vacancy_strain_init(FILEUNIT)
|
|
||||||
if (any(phase_kinematics == KINEMATICS_hydrogen_strain_ID)) call kinematics_hydrogen_strain_init(FILEUNIT)
|
|
||||||
close(FILEUNIT)
|
close(FILEUNIT)
|
||||||
|
|
||||||
call config_deallocate('material.config/phase')
|
call config_deallocate('material.config/phase')
|
||||||
|
@ -284,21 +266,6 @@ subroutine constitutive_init()
|
||||||
outputName = SOURCE_damage_anisoDuctile_label
|
outputName = SOURCE_damage_anisoDuctile_label
|
||||||
thisOutput => source_damage_anisoDuctile_output
|
thisOutput => source_damage_anisoDuctile_output
|
||||||
thisSize => source_damage_anisoDuctile_sizePostResult
|
thisSize => source_damage_anisoDuctile_sizePostResult
|
||||||
case (SOURCE_vacancy_phenoplasticity_ID) sourceType
|
|
||||||
ins = source_vacancy_phenoplasticity_instance(ph)
|
|
||||||
outputName = SOURCE_vacancy_phenoplasticity_label
|
|
||||||
thisOutput => source_vacancy_phenoplasticity_output
|
|
||||||
thisSize => source_vacancy_phenoplasticity_sizePostResult
|
|
||||||
case (SOURCE_vacancy_irradiation_ID) sourceType
|
|
||||||
ins = source_vacancy_irradiation_instance(ph)
|
|
||||||
outputName = SOURCE_vacancy_irradiation_label
|
|
||||||
thisOutput => source_vacancy_irradiation_output
|
|
||||||
thisSize => source_vacancy_irradiation_sizePostResult
|
|
||||||
case (SOURCE_vacancy_thermalfluc_ID) sourceType
|
|
||||||
ins = source_vacancy_thermalfluc_instance(ph)
|
|
||||||
outputName = SOURCE_vacancy_thermalfluc_label
|
|
||||||
thisOutput => source_vacancy_thermalfluc_output
|
|
||||||
thisSize => source_vacancy_thermalfluc_sizePostResult
|
|
||||||
case default sourceType
|
case default sourceType
|
||||||
knownSource = .false.
|
knownSource = .false.
|
||||||
end select sourceType
|
end select sourceType
|
||||||
|
@ -385,7 +352,9 @@ subroutine constitutive_microstructure(orientations, Fe, Fp, ipc, ip, el)
|
||||||
use prec, only: &
|
use prec, only: &
|
||||||
pReal
|
pReal
|
||||||
use material, only: &
|
use material, only: &
|
||||||
|
phasememberAt, &
|
||||||
phase_plasticity, &
|
phase_plasticity, &
|
||||||
|
phase_plasticityInstance, &
|
||||||
material_phase, &
|
material_phase, &
|
||||||
material_homogenizationAt, &
|
material_homogenizationAt, &
|
||||||
temperature, &
|
temperature, &
|
||||||
|
@ -397,8 +366,8 @@ subroutine constitutive_microstructure(orientations, Fe, Fp, ipc, ip, el)
|
||||||
plastic_nonlocal_microstructure
|
plastic_nonlocal_microstructure
|
||||||
use plastic_dislotwin, only: &
|
use plastic_dislotwin, only: &
|
||||||
plastic_dislotwin_microstructure
|
plastic_dislotwin_microstructure
|
||||||
use plastic_disloucla, only: &
|
use plastic_disloUCLA, only: &
|
||||||
plastic_disloucla_microstructure
|
plastic_disloUCLA_dependentState
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
integer(pInt), intent(in) :: &
|
integer(pInt), intent(in) :: &
|
||||||
|
@ -410,7 +379,8 @@ subroutine constitutive_microstructure(orientations, Fe, Fp, ipc, ip, el)
|
||||||
Fp !< plastic deformation gradient
|
Fp !< plastic deformation gradient
|
||||||
integer(pInt) :: &
|
integer(pInt) :: &
|
||||||
ho, & !< homogenization
|
ho, & !< homogenization
|
||||||
tme !< thermal member position
|
tme, & !< thermal member position
|
||||||
|
instance, of
|
||||||
real(pReal), intent(in), dimension(:,:,:,:) :: &
|
real(pReal), intent(in), dimension(:,:,:,:) :: &
|
||||||
orientations !< crystal orientations as quaternions
|
orientations !< crystal orientations as quaternions
|
||||||
|
|
||||||
|
@ -421,7 +391,9 @@ subroutine constitutive_microstructure(orientations, Fe, Fp, ipc, ip, el)
|
||||||
case (PLASTICITY_DISLOTWIN_ID) plasticityType
|
case (PLASTICITY_DISLOTWIN_ID) plasticityType
|
||||||
call plastic_dislotwin_microstructure(temperature(ho)%p(tme),ipc,ip,el)
|
call plastic_dislotwin_microstructure(temperature(ho)%p(tme),ipc,ip,el)
|
||||||
case (PLASTICITY_DISLOUCLA_ID) plasticityType
|
case (PLASTICITY_DISLOUCLA_ID) plasticityType
|
||||||
call plastic_disloucla_microstructure(temperature(ho)%p(tme),ipc,ip,el)
|
of = phasememberAt(ipc,ip,el)
|
||||||
|
instance = phase_plasticityInstance(material_phase(ipc,ip,el))
|
||||||
|
call plastic_disloUCLA_dependentState(instance,of)
|
||||||
case (PLASTICITY_NONLOCAL_ID) plasticityType
|
case (PLASTICITY_NONLOCAL_ID) plasticityType
|
||||||
call plastic_nonlocal_microstructure (Fe,Fp,ip,el)
|
call plastic_nonlocal_microstructure (Fe,Fp,ip,el)
|
||||||
end select plasticityType
|
end select plasticityType
|
||||||
|
@ -508,8 +480,9 @@ subroutine constitutive_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, S6, Fi, ipc, ip, e
|
||||||
dLp_dMp = 0.0_pReal
|
dLp_dMp = 0.0_pReal
|
||||||
|
|
||||||
case (PLASTICITY_ISOTROPIC_ID) plasticityType
|
case (PLASTICITY_ISOTROPIC_ID) plasticityType
|
||||||
call plastic_isotropic_LpAndItsTangent (Lp,dLp_dMp99, math_Mandel33to6(Mp),ipc,ip,el)
|
of = phasememberAt(ipc,ip,el)
|
||||||
dLp_dMp = math_Plain99to3333(dLp_dMp99) ! ToDo: We revert here the last statement in plastic_xx_LpAndItsTanget
|
instance = phase_plasticityInstance(material_phase(ipc,ip,el))
|
||||||
|
call plastic_isotropic_LpAndItsTangent (Lp,dLp_dMp,Mp,instance,of)
|
||||||
|
|
||||||
case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType
|
case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType
|
||||||
of = phasememberAt(ipc,ip,el)
|
of = phasememberAt(ipc,ip,el)
|
||||||
|
@ -531,9 +504,9 @@ subroutine constitutive_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, S6, Fi, ipc, ip, e
|
||||||
call plastic_dislotwin_LpAndItsTangent (Lp,dLp_dMp,Mp,temperature(ho)%p(tme),instance,of)
|
call plastic_dislotwin_LpAndItsTangent (Lp,dLp_dMp,Mp,temperature(ho)%p(tme),instance,of)
|
||||||
|
|
||||||
case (PLASTICITY_DISLOUCLA_ID) plasticityType
|
case (PLASTICITY_DISLOUCLA_ID) plasticityType
|
||||||
call plastic_disloucla_LpAndItsTangent (Lp,dLp_dMp99, math_Mandel33to6(Mp), &
|
of = phasememberAt(ipc,ip,el)
|
||||||
temperature(ho)%p(tme), ipc,ip,el)
|
instance = phase_plasticityInstance(material_phase(ipc,ip,el))
|
||||||
dLp_dMp = math_Plain99to3333(dLp_dMp99) ! ToDo: We revert here the last statement in plastic_xx_LpAndItsTanget
|
call plastic_disloucla_LpAndItsTangent (Lp,dLp_dMp,Mp,temperature(ho)%p(tme),instance,of)
|
||||||
|
|
||||||
end select plasticityType
|
end select plasticityType
|
||||||
|
|
||||||
|
@ -556,6 +529,7 @@ end subroutine constitutive_LpAndItsTangents
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief contains the constitutive equation for calculating the velocity gradient
|
!> @brief contains the constitutive equation for calculating the velocity gradient
|
||||||
|
! ToDo: MD: S is Mi?
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, el)
|
subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, el)
|
||||||
use prec, only: &
|
use prec, only: &
|
||||||
|
@ -564,8 +538,12 @@ subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, e
|
||||||
math_I3, &
|
math_I3, &
|
||||||
math_inv33, &
|
math_inv33, &
|
||||||
math_det33, &
|
math_det33, &
|
||||||
math_mul33x33
|
math_mul33x33, &
|
||||||
|
math_Mandel6to33
|
||||||
use material, only: &
|
use material, only: &
|
||||||
|
phasememberAt, &
|
||||||
|
phase_plasticity, &
|
||||||
|
phase_plasticityInstance, &
|
||||||
phase_plasticity, &
|
phase_plasticity, &
|
||||||
material_phase, &
|
material_phase, &
|
||||||
phase_kinematics, &
|
phase_kinematics, &
|
||||||
|
@ -573,9 +551,7 @@ subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, e
|
||||||
PLASTICITY_isotropic_ID, &
|
PLASTICITY_isotropic_ID, &
|
||||||
KINEMATICS_cleavage_opening_ID, &
|
KINEMATICS_cleavage_opening_ID, &
|
||||||
KINEMATICS_slipplane_opening_ID, &
|
KINEMATICS_slipplane_opening_ID, &
|
||||||
KINEMATICS_thermal_expansion_ID, &
|
KINEMATICS_thermal_expansion_ID
|
||||||
KINEMATICS_vacancy_strain_ID, &
|
|
||||||
KINEMATICS_hydrogen_strain_ID
|
|
||||||
use plastic_isotropic, only: &
|
use plastic_isotropic, only: &
|
||||||
plastic_isotropic_LiAndItsTangent
|
plastic_isotropic_LiAndItsTangent
|
||||||
use kinematics_cleavage_opening, only: &
|
use kinematics_cleavage_opening, only: &
|
||||||
|
@ -584,10 +560,6 @@ subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, e
|
||||||
kinematics_slipplane_opening_LiAndItsTangent
|
kinematics_slipplane_opening_LiAndItsTangent
|
||||||
use kinematics_thermal_expansion, only: &
|
use kinematics_thermal_expansion, only: &
|
||||||
kinematics_thermal_expansion_LiAndItsTangent
|
kinematics_thermal_expansion_LiAndItsTangent
|
||||||
use kinematics_vacancy_strain, only: &
|
|
||||||
kinematics_vacancy_strain_LiAndItsTangent
|
|
||||||
use kinematics_hydrogen_strain, only: &
|
|
||||||
kinematics_hydrogen_strain_LiAndItsTangent
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
integer(pInt), intent(in) :: &
|
integer(pInt), intent(in) :: &
|
||||||
|
@ -603,19 +575,18 @@ subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, e
|
||||||
real(pReal), intent(out), dimension(3,3,3,3) :: &
|
real(pReal), intent(out), dimension(3,3,3,3) :: &
|
||||||
dLi_dS, & !< derivative of Li with respect to S
|
dLi_dS, & !< derivative of Li with respect to S
|
||||||
dLi_dFi
|
dLi_dFi
|
||||||
|
|
||||||
real(pReal), dimension(3,3) :: &
|
real(pReal), dimension(3,3) :: &
|
||||||
my_Li !< intermediate velocity gradient
|
my_Li, & !< intermediate velocity gradient
|
||||||
real(pReal), dimension(3,3,3,3) :: &
|
|
||||||
my_dLi_dS
|
|
||||||
real(pReal), dimension(3,3) :: &
|
|
||||||
FiInv, &
|
FiInv, &
|
||||||
temp_33
|
temp_33
|
||||||
|
real(pReal), dimension(3,3,3,3) :: &
|
||||||
|
my_dLi_dS
|
||||||
real(pReal) :: &
|
real(pReal) :: &
|
||||||
detFi
|
detFi
|
||||||
integer(pInt) :: &
|
integer(pInt) :: &
|
||||||
k !< counter in kinematics loop
|
k, i, j, &
|
||||||
integer(pInt) :: &
|
instance, of
|
||||||
i, j
|
|
||||||
|
|
||||||
Li = 0.0_pReal
|
Li = 0.0_pReal
|
||||||
dLi_dS = 0.0_pReal
|
dLi_dS = 0.0_pReal
|
||||||
|
@ -623,7 +594,9 @@ subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, e
|
||||||
|
|
||||||
plasticityType: select case (phase_plasticity(material_phase(ipc,ip,el)))
|
plasticityType: select case (phase_plasticity(material_phase(ipc,ip,el)))
|
||||||
case (PLASTICITY_isotropic_ID) plasticityType
|
case (PLASTICITY_isotropic_ID) plasticityType
|
||||||
call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, S6, ipc, ip, el)
|
of = phasememberAt(ipc,ip,el)
|
||||||
|
instance = phase_plasticityInstance(material_phase(ipc,ip,el))
|
||||||
|
call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, math_Mandel6to33(S6),instance,of)
|
||||||
case default plasticityType
|
case default plasticityType
|
||||||
my_Li = 0.0_pReal
|
my_Li = 0.0_pReal
|
||||||
my_dLi_dS = 0.0_pReal
|
my_dLi_dS = 0.0_pReal
|
||||||
|
@ -640,10 +613,6 @@ subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, e
|
||||||
call kinematics_slipplane_opening_LiAndItsTangent(my_Li, my_dLi_dS, S6, ipc, ip, el)
|
call kinematics_slipplane_opening_LiAndItsTangent(my_Li, my_dLi_dS, S6, ipc, ip, el)
|
||||||
case (KINEMATICS_thermal_expansion_ID) kinematicsType
|
case (KINEMATICS_thermal_expansion_ID) kinematicsType
|
||||||
call kinematics_thermal_expansion_LiAndItsTangent(my_Li, my_dLi_dS, ipc, ip, el)
|
call kinematics_thermal_expansion_LiAndItsTangent(my_Li, my_dLi_dS, ipc, ip, el)
|
||||||
case (KINEMATICS_vacancy_strain_ID) kinematicsType
|
|
||||||
call kinematics_vacancy_strain_LiAndItsTangent(my_Li, my_dLi_dS, ipc, ip, el)
|
|
||||||
case (KINEMATICS_hydrogen_strain_ID) kinematicsType
|
|
||||||
call kinematics_hydrogen_strain_LiAndItsTangent(my_Li, my_dLi_dS, ipc, ip, el)
|
|
||||||
case default kinematicsType
|
case default kinematicsType
|
||||||
my_Li = 0.0_pReal
|
my_Li = 0.0_pReal
|
||||||
my_dLi_dS = 0.0_pReal
|
my_dLi_dS = 0.0_pReal
|
||||||
|
@ -680,15 +649,9 @@ pure function constitutive_initialFi(ipc, ip, el)
|
||||||
phase_kinematics, &
|
phase_kinematics, &
|
||||||
phase_Nkinematics, &
|
phase_Nkinematics, &
|
||||||
material_phase, &
|
material_phase, &
|
||||||
KINEMATICS_thermal_expansion_ID, &
|
KINEMATICS_thermal_expansion_ID
|
||||||
KINEMATICS_vacancy_strain_ID, &
|
|
||||||
KINEMATICS_hydrogen_strain_ID
|
|
||||||
use kinematics_thermal_expansion, only: &
|
use kinematics_thermal_expansion, only: &
|
||||||
kinematics_thermal_expansion_initialStrain
|
kinematics_thermal_expansion_initialStrain
|
||||||
use kinematics_vacancy_strain, only: &
|
|
||||||
kinematics_vacancy_strain_initialStrain
|
|
||||||
use kinematics_hydrogen_strain, only: &
|
|
||||||
kinematics_hydrogen_strain_initialStrain
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
integer(pInt), intent(in) :: &
|
integer(pInt), intent(in) :: &
|
||||||
|
@ -707,12 +670,6 @@ pure function constitutive_initialFi(ipc, ip, el)
|
||||||
case (KINEMATICS_thermal_expansion_ID) kinematicsType
|
case (KINEMATICS_thermal_expansion_ID) kinematicsType
|
||||||
constitutive_initialFi = &
|
constitutive_initialFi = &
|
||||||
constitutive_initialFi + kinematics_thermal_expansion_initialStrain(ipc, ip, el)
|
constitutive_initialFi + kinematics_thermal_expansion_initialStrain(ipc, ip, el)
|
||||||
case (KINEMATICS_vacancy_strain_ID) kinematicsType
|
|
||||||
constitutive_initialFi = &
|
|
||||||
constitutive_initialFi + kinematics_vacancy_strain_initialStrain(ipc, ip, el)
|
|
||||||
case (KINEMATICS_hydrogen_strain_ID) kinematicsType
|
|
||||||
constitutive_initialFi = &
|
|
||||||
constitutive_initialFi + kinematics_hydrogen_strain_initialStrain(ipc, ip, el)
|
|
||||||
end select kinematicsType
|
end select kinematicsType
|
||||||
enddo KinematicsLoop
|
enddo KinematicsLoop
|
||||||
|
|
||||||
|
@ -767,10 +724,7 @@ subroutine constitutive_hooke_SandItsTangents(S, dS_dFe, dS_dFi, Fe, Fi, ipc, ip
|
||||||
phase_stiffnessDegradation, &
|
phase_stiffnessDegradation, &
|
||||||
damage, &
|
damage, &
|
||||||
damageMapping, &
|
damageMapping, &
|
||||||
porosity, &
|
STIFFNESS_DEGRADATION_damage_ID
|
||||||
porosityMapping, &
|
|
||||||
STIFFNESS_DEGRADATION_damage_ID, &
|
|
||||||
STIFFNESS_DEGRADATION_porosity_ID
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
integer(pInt), intent(in) :: &
|
integer(pInt), intent(in) :: &
|
||||||
|
@ -800,8 +754,6 @@ subroutine constitutive_hooke_SandItsTangents(S, dS_dFe, dS_dFi, Fe, Fi, ipc, ip
|
||||||
degradationType: select case(phase_stiffnessDegradation(d,material_phase(ipc,ip,el)))
|
degradationType: select case(phase_stiffnessDegradation(d,material_phase(ipc,ip,el)))
|
||||||
case (STIFFNESS_DEGRADATION_damage_ID) degradationType
|
case (STIFFNESS_DEGRADATION_damage_ID) degradationType
|
||||||
C = C * damage(ho)%p(damageMapping(ho)%p(ip,el))**2_pInt
|
C = C * damage(ho)%p(damageMapping(ho)%p(ip,el))**2_pInt
|
||||||
case (STIFFNESS_DEGRADATION_porosity_ID) degradationType
|
|
||||||
C = C * porosity(ho)%p(porosityMapping(ho)%p(ip,el))**2_pInt
|
|
||||||
end select degradationType
|
end select degradationType
|
||||||
enddo DegradationLoop
|
enddo DegradationLoop
|
||||||
|
|
||||||
|
@ -912,7 +864,9 @@ subroutine constitutive_collectDotState(S6, FeArray, Fi, FpArray, subdt, subfrac
|
||||||
plasticityType: select case (phase_plasticity(material_phase(ipc,ip,el)))
|
plasticityType: select case (phase_plasticity(material_phase(ipc,ip,el)))
|
||||||
|
|
||||||
case (PLASTICITY_ISOTROPIC_ID) plasticityType
|
case (PLASTICITY_ISOTROPIC_ID) plasticityType
|
||||||
call plastic_isotropic_dotState (math_Mandel33to6(Mp),ipc,ip,el)
|
of = phasememberAt(ipc,ip,el)
|
||||||
|
instance = phase_plasticityInstance(material_phase(ipc,ip,el))
|
||||||
|
call plastic_isotropic_dotState (Mp,instance,of)
|
||||||
|
|
||||||
case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType
|
case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType
|
||||||
of = phasememberAt(ipc,ip,el)
|
of = phasememberAt(ipc,ip,el)
|
||||||
|
@ -928,8 +882,9 @@ subroutine constitutive_collectDotState(S6, FeArray, Fi, FpArray, subdt, subfrac
|
||||||
call plastic_dislotwin_dotState (Mp,temperature(ho)%p(tme),instance,of)
|
call plastic_dislotwin_dotState (Mp,temperature(ho)%p(tme),instance,of)
|
||||||
|
|
||||||
case (PLASTICITY_DISLOUCLA_ID) plasticityType
|
case (PLASTICITY_DISLOUCLA_ID) plasticityType
|
||||||
call plastic_disloucla_dotState (math_Mandel33to6(Mp),temperature(ho)%p(tme), &
|
of = phasememberAt(ipc,ip,el)
|
||||||
ipc,ip,el)
|
instance = phase_plasticityInstance(material_phase(ipc,ip,el))
|
||||||
|
call plastic_disloucla_dotState (Mp,temperature(ho)%p(tme),instance,of)
|
||||||
|
|
||||||
case (PLASTICITY_NONLOCAL_ID) plasticityType
|
case (PLASTICITY_NONLOCAL_ID) plasticityType
|
||||||
call plastic_nonlocal_dotState (math_Mandel33to6(Mp),FeArray,FpArray,temperature(ho)%p(tme), &
|
call plastic_nonlocal_dotState (math_Mandel33to6(Mp),FeArray,FpArray,temperature(ho)%p(tme), &
|
||||||
|
@ -981,19 +936,13 @@ subroutine constitutive_collectDeltaState(S6, Fe, Fi, ipc, ip, el)
|
||||||
material_phase, &
|
material_phase, &
|
||||||
PLASTICITY_KINEHARDENING_ID, &
|
PLASTICITY_KINEHARDENING_ID, &
|
||||||
PLASTICITY_NONLOCAL_ID, &
|
PLASTICITY_NONLOCAL_ID, &
|
||||||
SOURCE_damage_isoBrittle_ID, &
|
SOURCE_damage_isoBrittle_ID
|
||||||
SOURCE_vacancy_irradiation_ID, &
|
|
||||||
SOURCE_vacancy_thermalfluc_ID
|
|
||||||
use plastic_kinehardening, only: &
|
use plastic_kinehardening, only: &
|
||||||
plastic_kinehardening_deltaState
|
plastic_kinehardening_deltaState
|
||||||
use plastic_nonlocal, only: &
|
use plastic_nonlocal, only: &
|
||||||
plastic_nonlocal_deltaState
|
plastic_nonlocal_deltaState
|
||||||
use source_damage_isoBrittle, only: &
|
use source_damage_isoBrittle, only: &
|
||||||
source_damage_isoBrittle_deltaState
|
source_damage_isoBrittle_deltaState
|
||||||
use source_vacancy_irradiation, only: &
|
|
||||||
source_vacancy_irradiation_deltaState
|
|
||||||
use source_vacancy_thermalfluc, only: &
|
|
||||||
source_vacancy_thermalfluc_deltaState
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
integer(pInt), intent(in) :: &
|
integer(pInt), intent(in) :: &
|
||||||
|
@ -1030,12 +979,6 @@ subroutine constitutive_collectDeltaState(S6, Fe, Fi, ipc, ip, el)
|
||||||
call source_damage_isoBrittle_deltaState (constitutive_homogenizedC(ipc,ip,el), Fe, &
|
call source_damage_isoBrittle_deltaState (constitutive_homogenizedC(ipc,ip,el), Fe, &
|
||||||
ipc, ip, el)
|
ipc, ip, el)
|
||||||
|
|
||||||
case (SOURCE_vacancy_irradiation_ID) sourceType
|
|
||||||
call source_vacancy_irradiation_deltaState(ipc, ip, el)
|
|
||||||
|
|
||||||
case (SOURCE_vacancy_thermalfluc_ID) sourceType
|
|
||||||
call source_vacancy_thermalfluc_deltaState(ipc, ip, el)
|
|
||||||
|
|
||||||
end select sourceType
|
end select sourceType
|
||||||
|
|
||||||
enddo SourceLoop
|
enddo SourceLoop
|
||||||
|
@ -1135,8 +1078,10 @@ function constitutive_postResults(S6, Fi, FeArray, ipc, ip, el)
|
||||||
|
|
||||||
plasticityType: select case (phase_plasticity(material_phase(ipc,ip,el)))
|
plasticityType: select case (phase_plasticity(material_phase(ipc,ip,el)))
|
||||||
case (PLASTICITY_ISOTROPIC_ID) plasticityType
|
case (PLASTICITY_ISOTROPIC_ID) plasticityType
|
||||||
|
of = phasememberAt(ipc,ip,el)
|
||||||
|
instance = phase_plasticityInstance(material_phase(ipc,ip,el))
|
||||||
constitutive_postResults(startPos:endPos) = &
|
constitutive_postResults(startPos:endPos) = &
|
||||||
plastic_isotropic_postResults(S6,ipc,ip,el)
|
plastic_isotropic_postResults(Mp,instance,of)
|
||||||
|
|
||||||
case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType
|
case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType
|
||||||
of = phasememberAt(ipc,ip,el)
|
of = phasememberAt(ipc,ip,el)
|
||||||
|
@ -1155,8 +1100,10 @@ function constitutive_postResults(S6, Fi, FeArray, ipc, ip, el)
|
||||||
plastic_dislotwin_postResults(Mp,temperature(ho)%p(tme),instance,of)
|
plastic_dislotwin_postResults(Mp,temperature(ho)%p(tme),instance,of)
|
||||||
|
|
||||||
case (PLASTICITY_DISLOUCLA_ID) plasticityType
|
case (PLASTICITY_DISLOUCLA_ID) plasticityType
|
||||||
|
of = phasememberAt(ipc,ip,el)
|
||||||
|
instance = phase_plasticityInstance(material_phase(ipc,ip,el))
|
||||||
constitutive_postResults(startPos:endPos) = &
|
constitutive_postResults(startPos:endPos) = &
|
||||||
plastic_disloucla_postResults(S6,temperature(ho)%p(tme),ipc,ip,el)
|
plastic_disloucla_postResults(Mp,temperature(ho)%p(tme),instance,of)
|
||||||
|
|
||||||
case (PLASTICITY_NONLOCAL_ID) plasticityType
|
case (PLASTICITY_NONLOCAL_ID) plasticityType
|
||||||
constitutive_postResults(startPos:endPos) = &
|
constitutive_postResults(startPos:endPos) = &
|
||||||
|
|
|
@ -25,10 +25,7 @@ module homogenization
|
||||||
materialpoint_sizeResults, &
|
materialpoint_sizeResults, &
|
||||||
homogenization_maxSizePostResults, &
|
homogenization_maxSizePostResults, &
|
||||||
thermal_maxSizePostResults, &
|
thermal_maxSizePostResults, &
|
||||||
damage_maxSizePostResults, &
|
damage_maxSizePostResults
|
||||||
vacancyflux_maxSizePostResults, &
|
|
||||||
porosity_maxSizePostResults, &
|
|
||||||
hydrogenflux_maxSizePostResults
|
|
||||||
|
|
||||||
real(pReal), dimension(:,:,:,:), allocatable, private :: &
|
real(pReal), dimension(:,:,:,:), allocatable, private :: &
|
||||||
materialpoint_subF0, & !< def grad of IP at beginning of homogenization increment
|
materialpoint_subF0, & !< def grad of IP at beginning of homogenization increment
|
||||||
|
@ -100,13 +97,6 @@ subroutine homogenization_init
|
||||||
use damage_none
|
use damage_none
|
||||||
use damage_local
|
use damage_local
|
||||||
use damage_nonlocal
|
use damage_nonlocal
|
||||||
use vacancyflux_isoconc
|
|
||||||
use vacancyflux_isochempot
|
|
||||||
use vacancyflux_cahnhilliard
|
|
||||||
use porosity_none
|
|
||||||
use porosity_phasefield
|
|
||||||
use hydrogenflux_isoconc
|
|
||||||
use hydrogenflux_cahnhilliard
|
|
||||||
use IO
|
use IO
|
||||||
use numerics, only: &
|
use numerics, only: &
|
||||||
worldrank
|
worldrank
|
||||||
|
@ -155,33 +145,6 @@ subroutine homogenization_init
|
||||||
if (any(damage_type == DAMAGE_nonlocal_ID)) &
|
if (any(damage_type == DAMAGE_nonlocal_ID)) &
|
||||||
call damage_nonlocal_init(FILEUNIT)
|
call damage_nonlocal_init(FILEUNIT)
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! parse vacancy transport from config file
|
|
||||||
call IO_checkAndRewind(FILEUNIT)
|
|
||||||
if (any(vacancyflux_type == VACANCYFLUX_isoconc_ID)) &
|
|
||||||
call vacancyflux_isoconc_init()
|
|
||||||
if (any(vacancyflux_type == VACANCYFLUX_isochempot_ID)) &
|
|
||||||
call vacancyflux_isochempot_init(FILEUNIT)
|
|
||||||
if (any(vacancyflux_type == VACANCYFLUX_cahnhilliard_ID)) &
|
|
||||||
call vacancyflux_cahnhilliard_init(FILEUNIT)
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! parse porosity from config file
|
|
||||||
call IO_checkAndRewind(FILEUNIT)
|
|
||||||
if (any(porosity_type == POROSITY_none_ID)) &
|
|
||||||
call porosity_none_init()
|
|
||||||
if (any(porosity_type == POROSITY_phasefield_ID)) &
|
|
||||||
call porosity_phasefield_init(FILEUNIT)
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! parse hydrogen transport from config file
|
|
||||||
call IO_checkAndRewind(FILEUNIT)
|
|
||||||
if (any(hydrogenflux_type == HYDROGENFLUX_isoconc_ID)) &
|
|
||||||
call hydrogenflux_isoconc_init()
|
|
||||||
if (any(hydrogenflux_type == HYDROGENFLUX_cahnhilliard_ID)) &
|
|
||||||
call hydrogenflux_cahnhilliard_init(FILEUNIT)
|
|
||||||
close(FILEUNIT)
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! write description file for homogenization output
|
! write description file for homogenization output
|
||||||
mainProcess2: if (worldrank == 0) then
|
mainProcess2: if (worldrank == 0) then
|
||||||
|
@ -277,83 +240,6 @@ subroutine homogenization_init
|
||||||
enddo
|
enddo
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
i = vacancyflux_typeInstance(p) ! which instance of this vacancy flux type
|
|
||||||
valid = .true. ! assume valid
|
|
||||||
select case(vacancyflux_type(p)) ! split per vacancy flux type
|
|
||||||
case (VACANCYFLUX_isoconc_ID)
|
|
||||||
outputName = VACANCYFLUX_isoconc_label
|
|
||||||
thisNoutput => null()
|
|
||||||
thisOutput => null()
|
|
||||||
thisSize => null()
|
|
||||||
case (VACANCYFLUX_isochempot_ID)
|
|
||||||
outputName = VACANCYFLUX_isochempot_label
|
|
||||||
thisNoutput => vacancyflux_isochempot_Noutput
|
|
||||||
thisOutput => vacancyflux_isochempot_output
|
|
||||||
thisSize => vacancyflux_isochempot_sizePostResult
|
|
||||||
case (VACANCYFLUX_cahnhilliard_ID)
|
|
||||||
outputName = VACANCYFLUX_cahnhilliard_label
|
|
||||||
thisNoutput => vacancyflux_cahnhilliard_Noutput
|
|
||||||
thisOutput => vacancyflux_cahnhilliard_output
|
|
||||||
thisSize => vacancyflux_cahnhilliard_sizePostResult
|
|
||||||
case default
|
|
||||||
valid = .false.
|
|
||||||
end select
|
|
||||||
if (valid) then
|
|
||||||
write(FILEUNIT,'(a)') '(vacancyflux)'//char(9)//trim(outputName)
|
|
||||||
if (vacancyflux_type(p) /= VACANCYFLUX_isoconc_ID) then
|
|
||||||
do e = 1,thisNoutput(i)
|
|
||||||
write(FILEUNIT,'(a,i4)') trim(thisOutput(e,i))//char(9),thisSize(e,i)
|
|
||||||
enddo
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
i = porosity_typeInstance(p) ! which instance of this porosity type
|
|
||||||
valid = .true. ! assume valid
|
|
||||||
select case(porosity_type(p)) ! split per porosity type
|
|
||||||
case (POROSITY_none_ID)
|
|
||||||
outputName = POROSITY_none_label
|
|
||||||
thisNoutput => null()
|
|
||||||
thisOutput => null()
|
|
||||||
thisSize => null()
|
|
||||||
case (POROSITY_phasefield_ID)
|
|
||||||
outputName = POROSITY_phasefield_label
|
|
||||||
thisNoutput => porosity_phasefield_Noutput
|
|
||||||
thisOutput => porosity_phasefield_output
|
|
||||||
thisSize => porosity_phasefield_sizePostResult
|
|
||||||
case default
|
|
||||||
valid = .false.
|
|
||||||
end select
|
|
||||||
if (valid) then
|
|
||||||
write(FILEUNIT,'(a)') '(porosity)'//char(9)//trim(outputName)
|
|
||||||
if (porosity_type(p) /= POROSITY_none_ID) then
|
|
||||||
do e = 1,thisNoutput(i)
|
|
||||||
write(FILEUNIT,'(a,i4)') trim(thisOutput(e,i))//char(9),thisSize(e,i)
|
|
||||||
enddo
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
i = hydrogenflux_typeInstance(p) ! which instance of this hydrogen flux type
|
|
||||||
valid = .true. ! assume valid
|
|
||||||
select case(hydrogenflux_type(p)) ! split per hydrogen flux type
|
|
||||||
case (HYDROGENFLUX_isoconc_ID)
|
|
||||||
outputName = HYDROGENFLUX_isoconc_label
|
|
||||||
thisNoutput => null()
|
|
||||||
thisOutput => null()
|
|
||||||
thisSize => null()
|
|
||||||
case (HYDROGENFLUX_cahnhilliard_ID)
|
|
||||||
outputName = HYDROGENFLUX_cahnhilliard_label
|
|
||||||
thisNoutput => hydrogenflux_cahnhilliard_Noutput
|
|
||||||
thisOutput => hydrogenflux_cahnhilliard_output
|
|
||||||
thisSize => hydrogenflux_cahnhilliard_sizePostResult
|
|
||||||
case default
|
|
||||||
valid = .false.
|
|
||||||
end select
|
|
||||||
if (valid) then
|
|
||||||
write(FILEUNIT,'(a)') '(hydrogenflux)'//char(9)//trim(outputName)
|
|
||||||
if (hydrogenflux_type(p) /= HYDROGENFLUX_isoconc_ID) then
|
|
||||||
do e = 1,thisNoutput(i)
|
|
||||||
write(FILEUNIT,'(a,i4)') trim(thisOutput(e,i))//char(9),thisSize(e,i)
|
|
||||||
enddo
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
close(FILEUNIT)
|
close(FILEUNIT)
|
||||||
|
@ -383,25 +269,16 @@ subroutine homogenization_init
|
||||||
homogenization_maxSizePostResults = 0_pInt
|
homogenization_maxSizePostResults = 0_pInt
|
||||||
thermal_maxSizePostResults = 0_pInt
|
thermal_maxSizePostResults = 0_pInt
|
||||||
damage_maxSizePostResults = 0_pInt
|
damage_maxSizePostResults = 0_pInt
|
||||||
vacancyflux_maxSizePostResults = 0_pInt
|
|
||||||
porosity_maxSizePostResults = 0_pInt
|
|
||||||
hydrogenflux_maxSizePostResults = 0_pInt
|
|
||||||
do p = 1,size(config_homogenization)
|
do p = 1,size(config_homogenization)
|
||||||
homogenization_maxSizePostResults = max(homogenization_maxSizePostResults,homogState (p)%sizePostResults)
|
homogenization_maxSizePostResults = max(homogenization_maxSizePostResults,homogState (p)%sizePostResults)
|
||||||
thermal_maxSizePostResults = max(thermal_maxSizePostResults, thermalState (p)%sizePostResults)
|
thermal_maxSizePostResults = max(thermal_maxSizePostResults, thermalState (p)%sizePostResults)
|
||||||
damage_maxSizePostResults = max(damage_maxSizePostResults ,damageState (p)%sizePostResults)
|
damage_maxSizePostResults = max(damage_maxSizePostResults ,damageState (p)%sizePostResults)
|
||||||
vacancyflux_maxSizePostResults = max(vacancyflux_maxSizePostResults ,vacancyfluxState (p)%sizePostResults)
|
|
||||||
porosity_maxSizePostResults = max(porosity_maxSizePostResults ,porosityState (p)%sizePostResults)
|
|
||||||
hydrogenflux_maxSizePostResults = max(hydrogenflux_maxSizePostResults ,hydrogenfluxState(p)%sizePostResults)
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
materialpoint_sizeResults = 1 & ! grain count
|
materialpoint_sizeResults = 1 & ! grain count
|
||||||
+ 1 + homogenization_maxSizePostResults & ! homogSize & homogResult
|
+ 1 + homogenization_maxSizePostResults & ! homogSize & homogResult
|
||||||
+ thermal_maxSizePostResults &
|
+ thermal_maxSizePostResults &
|
||||||
+ damage_maxSizePostResults &
|
+ damage_maxSizePostResults &
|
||||||
+ vacancyflux_maxSizePostResults &
|
|
||||||
+ porosity_maxSizePostResults &
|
|
||||||
+ hydrogenflux_maxSizePostResults &
|
|
||||||
+ homogenization_maxNgrains * (1 + crystallite_maxSizePostResults & ! crystallite size & crystallite results
|
+ homogenization_maxNgrains * (1 + crystallite_maxSizePostResults & ! crystallite size & crystallite results
|
||||||
+ 1 + constitutive_plasticity_maxSizePostResults & ! constitutive size & constitutive results
|
+ 1 + constitutive_plasticity_maxSizePostResults & ! constitutive size & constitutive results
|
||||||
+ constitutive_source_maxSizePostResults)
|
+ constitutive_source_maxSizePostResults)
|
||||||
|
@ -460,9 +337,6 @@ subroutine materialpoint_stressAndItsTangent(updateJaco,dt)
|
||||||
homogState, &
|
homogState, &
|
||||||
thermalState, &
|
thermalState, &
|
||||||
damageState, &
|
damageState, &
|
||||||
vacancyfluxState, &
|
|
||||||
porosityState, &
|
|
||||||
hydrogenfluxState, &
|
|
||||||
phase_Nsources, &
|
phase_Nsources, &
|
||||||
mappingHomogenization, &
|
mappingHomogenization, &
|
||||||
phaseAt, phasememberAt, &
|
phaseAt, phasememberAt, &
|
||||||
|
@ -569,18 +443,6 @@ subroutine materialpoint_stressAndItsTangent(updateJaco,dt)
|
||||||
damageState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) &
|
damageState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) &
|
||||||
damageState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = &
|
damageState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = &
|
||||||
damageState(mappingHomogenization(2,i,e))%State0( :,mappingHomogenization(1,i,e)) ! ...internal damage state
|
damageState(mappingHomogenization(2,i,e))%State0( :,mappingHomogenization(1,i,e)) ! ...internal damage state
|
||||||
forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), &
|
|
||||||
vacancyfluxState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) &
|
|
||||||
vacancyfluxState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = &
|
|
||||||
vacancyfluxState(mappingHomogenization(2,i,e))%State0( :,mappingHomogenization(1,i,e)) ! ...internal vacancy transport state
|
|
||||||
forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), &
|
|
||||||
porosityState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) &
|
|
||||||
porosityState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = &
|
|
||||||
porosityState(mappingHomogenization(2,i,e))%State0( :,mappingHomogenization(1,i,e)) ! ...internal porosity state
|
|
||||||
forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), &
|
|
||||||
hydrogenfluxState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) &
|
|
||||||
hydrogenfluxState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = &
|
|
||||||
hydrogenfluxState(mappingHomogenization(2,i,e))%State0( :,mappingHomogenization(1,i,e)) ! ...internal hydrogen transport state
|
|
||||||
enddo
|
enddo
|
||||||
NiterationHomog = 0_pInt
|
NiterationHomog = 0_pInt
|
||||||
|
|
||||||
|
@ -654,18 +516,6 @@ subroutine materialpoint_stressAndItsTangent(updateJaco,dt)
|
||||||
damageState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) &
|
damageState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) &
|
||||||
damageState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = &
|
damageState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = &
|
||||||
damageState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) ! ...internal damage state
|
damageState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) ! ...internal damage state
|
||||||
forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), &
|
|
||||||
vacancyfluxState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) &
|
|
||||||
vacancyfluxState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = &
|
|
||||||
vacancyfluxState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e))! ...internal vacancy transport state
|
|
||||||
forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), &
|
|
||||||
porosityState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) &
|
|
||||||
porosityState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = &
|
|
||||||
porosityState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e))! ...internal porosity state
|
|
||||||
forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), &
|
|
||||||
hydrogenfluxState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) &
|
|
||||||
hydrogenfluxState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = &
|
|
||||||
hydrogenfluxState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e))! ...internal hydrogen transport state
|
|
||||||
materialpoint_subF0(1:3,1:3,i,e) = materialpoint_subF(1:3,1:3,i,e) ! ...def grad
|
materialpoint_subF0(1:3,1:3,i,e) = materialpoint_subF(1:3,1:3,i,e) ! ...def grad
|
||||||
endif steppingNeeded
|
endif steppingNeeded
|
||||||
|
|
||||||
|
@ -729,18 +579,6 @@ subroutine materialpoint_stressAndItsTangent(updateJaco,dt)
|
||||||
damageState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) &
|
damageState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) &
|
||||||
damageState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) = &
|
damageState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) = &
|
||||||
damageState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) ! ...internal damage state
|
damageState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) ! ...internal damage state
|
||||||
forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), &
|
|
||||||
vacancyfluxState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) &
|
|
||||||
vacancyfluxState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) = &
|
|
||||||
vacancyfluxState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e))! ...internal vacancy transport state
|
|
||||||
forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), &
|
|
||||||
porosityState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) &
|
|
||||||
porosityState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) = &
|
|
||||||
porosityState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e))! ...internal porosity state
|
|
||||||
forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), &
|
|
||||||
hydrogenfluxState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) &
|
|
||||||
hydrogenfluxState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) = &
|
|
||||||
hydrogenfluxState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e))! ...internal hydrogen transport state
|
|
||||||
endif
|
endif
|
||||||
endif converged
|
endif converged
|
||||||
|
|
||||||
|
@ -846,9 +684,6 @@ subroutine materialpoint_postResults
|
||||||
homogState, &
|
homogState, &
|
||||||
thermalState, &
|
thermalState, &
|
||||||
damageState, &
|
damageState, &
|
||||||
vacancyfluxState, &
|
|
||||||
porosityState, &
|
|
||||||
hydrogenfluxState, &
|
|
||||||
plasticState, &
|
plasticState, &
|
||||||
sourceState, &
|
sourceState, &
|
||||||
material_phase, &
|
material_phase, &
|
||||||
|
@ -877,10 +712,7 @@ subroutine materialpoint_postResults
|
||||||
|
|
||||||
theSize = homogState (mappingHomogenization(2,i,e))%sizePostResults &
|
theSize = homogState (mappingHomogenization(2,i,e))%sizePostResults &
|
||||||
+ thermalState (mappingHomogenization(2,i,e))%sizePostResults &
|
+ thermalState (mappingHomogenization(2,i,e))%sizePostResults &
|
||||||
+ damageState (mappingHomogenization(2,i,e))%sizePostResults &
|
+ damageState (mappingHomogenization(2,i,e))%sizePostResults
|
||||||
+ vacancyfluxState (mappingHomogenization(2,i,e))%sizePostResults &
|
|
||||||
+ porosityState (mappingHomogenization(2,i,e))%sizePostResults &
|
|
||||||
+ hydrogenfluxState(mappingHomogenization(2,i,e))%sizePostResults
|
|
||||||
materialpoint_results(thePos+1,i,e) = real(theSize,pReal) ! tell size of homogenization results
|
materialpoint_results(thePos+1,i,e) = real(theSize,pReal) ! tell size of homogenization results
|
||||||
thePos = thePos + 1_pInt
|
thePos = thePos + 1_pInt
|
||||||
|
|
||||||
|
@ -964,12 +796,10 @@ function homogenization_updateState(ip,el)
|
||||||
homogenization_type, &
|
homogenization_type, &
|
||||||
thermal_type, &
|
thermal_type, &
|
||||||
damage_type, &
|
damage_type, &
|
||||||
vacancyflux_type, &
|
|
||||||
homogenization_maxNgrains, &
|
homogenization_maxNgrains, &
|
||||||
HOMOGENIZATION_RGC_ID, &
|
HOMOGENIZATION_RGC_ID, &
|
||||||
THERMAL_adiabatic_ID, &
|
THERMAL_adiabatic_ID, &
|
||||||
DAMAGE_local_ID, &
|
DAMAGE_local_ID
|
||||||
VACANCYFLUX_isochempot_ID
|
|
||||||
use crystallite, only: &
|
use crystallite, only: &
|
||||||
crystallite_P, &
|
crystallite_P, &
|
||||||
crystallite_dPdF, &
|
crystallite_dPdF, &
|
||||||
|
@ -981,8 +811,6 @@ function homogenization_updateState(ip,el)
|
||||||
thermal_adiabatic_updateState
|
thermal_adiabatic_updateState
|
||||||
use damage_local, only: &
|
use damage_local, only: &
|
||||||
damage_local_updateState
|
damage_local_updateState
|
||||||
use vacancyflux_isochempot, only: &
|
|
||||||
vacancyflux_isochempot_updateState
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
integer(pInt), intent(in) :: &
|
integer(pInt), intent(in) :: &
|
||||||
|
@ -1023,15 +851,6 @@ function homogenization_updateState(ip,el)
|
||||||
el)
|
el)
|
||||||
end select chosenDamage
|
end select chosenDamage
|
||||||
|
|
||||||
chosenVacancyflux: select case (vacancyflux_type(mesh_element(3,el)))
|
|
||||||
case (VACANCYFLUX_isochempot_ID) chosenVacancyflux
|
|
||||||
homogenization_updateState = &
|
|
||||||
homogenization_updateState .and. &
|
|
||||||
vacancyflux_isochempot_updateState(materialpoint_subdt(ip,el), &
|
|
||||||
ip, &
|
|
||||||
el)
|
|
||||||
end select chosenVacancyflux
|
|
||||||
|
|
||||||
end function homogenization_updateState
|
end function homogenization_updateState
|
||||||
|
|
||||||
|
|
||||||
|
@ -1095,15 +914,9 @@ function homogenization_postResults(ip,el)
|
||||||
homogState, &
|
homogState, &
|
||||||
thermalState, &
|
thermalState, &
|
||||||
damageState, &
|
damageState, &
|
||||||
vacancyfluxState, &
|
|
||||||
porosityState, &
|
|
||||||
hydrogenfluxState, &
|
|
||||||
homogenization_type, &
|
homogenization_type, &
|
||||||
thermal_type, &
|
thermal_type, &
|
||||||
damage_type, &
|
damage_type, &
|
||||||
vacancyflux_type, &
|
|
||||||
porosity_type, &
|
|
||||||
hydrogenflux_type, &
|
|
||||||
HOMOGENIZATION_NONE_ID, &
|
HOMOGENIZATION_NONE_ID, &
|
||||||
HOMOGENIZATION_ISOSTRAIN_ID, &
|
HOMOGENIZATION_ISOSTRAIN_ID, &
|
||||||
HOMOGENIZATION_RGC_ID, &
|
HOMOGENIZATION_RGC_ID, &
|
||||||
|
@ -1112,14 +925,7 @@ function homogenization_postResults(ip,el)
|
||||||
THERMAL_conduction_ID, &
|
THERMAL_conduction_ID, &
|
||||||
DAMAGE_none_ID, &
|
DAMAGE_none_ID, &
|
||||||
DAMAGE_local_ID, &
|
DAMAGE_local_ID, &
|
||||||
DAMAGE_nonlocal_ID, &
|
DAMAGE_nonlocal_ID
|
||||||
VACANCYFLUX_isoconc_ID, &
|
|
||||||
VACANCYFLUX_isochempot_ID, &
|
|
||||||
VACANCYFLUX_cahnhilliard_ID, &
|
|
||||||
POROSITY_none_ID, &
|
|
||||||
POROSITY_phasefield_ID, &
|
|
||||||
HYDROGENFLUX_isoconc_ID, &
|
|
||||||
HYDROGENFLUX_cahnhilliard_ID
|
|
||||||
use homogenization_isostrain, only: &
|
use homogenization_isostrain, only: &
|
||||||
homogenization_isostrain_postResults
|
homogenization_isostrain_postResults
|
||||||
use homogenization_RGC, only: &
|
use homogenization_RGC, only: &
|
||||||
|
@ -1132,14 +938,6 @@ function homogenization_postResults(ip,el)
|
||||||
damage_local_postResults
|
damage_local_postResults
|
||||||
use damage_nonlocal, only: &
|
use damage_nonlocal, only: &
|
||||||
damage_nonlocal_postResults
|
damage_nonlocal_postResults
|
||||||
use vacancyflux_isochempot, only: &
|
|
||||||
vacancyflux_isochempot_postResults
|
|
||||||
use vacancyflux_cahnhilliard, only: &
|
|
||||||
vacancyflux_cahnhilliard_postResults
|
|
||||||
use porosity_phasefield, only: &
|
|
||||||
porosity_phasefield_postResults
|
|
||||||
use hydrogenflux_cahnhilliard, only: &
|
|
||||||
hydrogenflux_cahnhilliard_postResults
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
integer(pInt), intent(in) :: &
|
integer(pInt), intent(in) :: &
|
||||||
|
@ -1147,10 +945,7 @@ function homogenization_postResults(ip,el)
|
||||||
el !< element number
|
el !< element number
|
||||||
real(pReal), dimension( homogState (mappingHomogenization(2,ip,el))%sizePostResults &
|
real(pReal), dimension( homogState (mappingHomogenization(2,ip,el))%sizePostResults &
|
||||||
+ thermalState (mappingHomogenization(2,ip,el))%sizePostResults &
|
+ thermalState (mappingHomogenization(2,ip,el))%sizePostResults &
|
||||||
+ damageState (mappingHomogenization(2,ip,el))%sizePostResults &
|
+ damageState (mappingHomogenization(2,ip,el))%sizePostResults) :: &
|
||||||
+ vacancyfluxState (mappingHomogenization(2,ip,el))%sizePostResults &
|
|
||||||
+ porosityState (mappingHomogenization(2,ip,el))%sizePostResults &
|
|
||||||
+ hydrogenfluxState(mappingHomogenization(2,ip,el))%sizePostResults) :: &
|
|
||||||
homogenization_postResults
|
homogenization_postResults
|
||||||
integer(pInt) :: &
|
integer(pInt) :: &
|
||||||
startPos, endPos
|
startPos, endPos
|
||||||
|
@ -1205,39 +1000,6 @@ function homogenization_postResults(ip,el)
|
||||||
damage_nonlocal_postResults(ip, el)
|
damage_nonlocal_postResults(ip, el)
|
||||||
end select chosenDamage
|
end select chosenDamage
|
||||||
|
|
||||||
startPos = endPos + 1_pInt
|
|
||||||
endPos = endPos + vacancyfluxState(mappingHomogenization(2,ip,el))%sizePostResults
|
|
||||||
chosenVacancyflux: select case (vacancyflux_type(mesh_element(3,el)))
|
|
||||||
case (VACANCYFLUX_isoconc_ID) chosenVacancyflux
|
|
||||||
|
|
||||||
case (VACANCYFLUX_isochempot_ID) chosenVacancyflux
|
|
||||||
homogenization_postResults(startPos:endPos) = &
|
|
||||||
vacancyflux_isochempot_postResults(ip, el)
|
|
||||||
case (VACANCYFLUX_cahnhilliard_ID) chosenVacancyflux
|
|
||||||
homogenization_postResults(startPos:endPos) = &
|
|
||||||
vacancyflux_cahnhilliard_postResults(ip, el)
|
|
||||||
end select chosenVacancyflux
|
|
||||||
|
|
||||||
startPos = endPos + 1_pInt
|
|
||||||
endPos = endPos + porosityState(mappingHomogenization(2,ip,el))%sizePostResults
|
|
||||||
chosenPorosity: select case (porosity_type(mesh_element(3,el)))
|
|
||||||
case (POROSITY_none_ID) chosenPorosity
|
|
||||||
|
|
||||||
case (POROSITY_phasefield_ID) chosenPorosity
|
|
||||||
homogenization_postResults(startPos:endPos) = &
|
|
||||||
porosity_phasefield_postResults(ip, el)
|
|
||||||
end select chosenPorosity
|
|
||||||
|
|
||||||
startPos = endPos + 1_pInt
|
|
||||||
endPos = endPos + hydrogenfluxState(mappingHomogenization(2,ip,el))%sizePostResults
|
|
||||||
chosenHydrogenflux: select case (hydrogenflux_type(mesh_element(3,el)))
|
|
||||||
case (HYDROGENFLUX_isoconc_ID) chosenHydrogenflux
|
|
||||||
|
|
||||||
case (HYDROGENFLUX_cahnhilliard_ID) chosenHydrogenflux
|
|
||||||
homogenization_postResults(startPos:endPos) = &
|
|
||||||
hydrogenflux_cahnhilliard_postResults(ip, el)
|
|
||||||
end select chosenHydrogenflux
|
|
||||||
|
|
||||||
end function homogenization_postResults
|
end function homogenization_postResults
|
||||||
|
|
||||||
end module homogenization
|
end module homogenization
|
||||||
|
|
|
@ -1,508 +0,0 @@
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
|
||||||
!> @brief material subroutine for conservative transport of solute hydrogen
|
|
||||||
!> @details to be done
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
module hydrogenflux_cahnhilliard
|
|
||||||
use prec, only: &
|
|
||||||
pReal, &
|
|
||||||
pInt
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
private
|
|
||||||
integer(pInt), dimension(:), allocatable, public, protected :: &
|
|
||||||
hydrogenflux_cahnhilliard_sizePostResults !< cumulative size of post results
|
|
||||||
|
|
||||||
integer(pInt), dimension(:,:), allocatable, target, public :: &
|
|
||||||
hydrogenflux_cahnhilliard_sizePostResult !< size of each post result output
|
|
||||||
|
|
||||||
character(len=64), dimension(:,:), allocatable, target, public :: &
|
|
||||||
hydrogenflux_cahnhilliard_output !< name of each post result output
|
|
||||||
|
|
||||||
integer(pInt), dimension(:), allocatable, target, public :: &
|
|
||||||
hydrogenflux_cahnhilliard_Noutput !< number of outputs per instance of this damage
|
|
||||||
|
|
||||||
real(pReal), parameter, private :: &
|
|
||||||
kB = 1.3806488e-23_pReal !< Boltzmann constant in J/Kelvin
|
|
||||||
|
|
||||||
enum, bind(c)
|
|
||||||
enumerator :: undefined_ID, &
|
|
||||||
hydrogenConc_ID
|
|
||||||
end enum
|
|
||||||
integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: &
|
|
||||||
hydrogenflux_cahnhilliard_outputID !< ID of each post result output
|
|
||||||
|
|
||||||
|
|
||||||
public :: &
|
|
||||||
hydrogenflux_cahnhilliard_init, &
|
|
||||||
hydrogenflux_cahnhilliard_getMobility33, &
|
|
||||||
hydrogenflux_cahnhilliard_getDiffusion33, &
|
|
||||||
hydrogenflux_cahnhilliard_getFormationEnergy, &
|
|
||||||
hydrogenflux_cahnhilliard_KinematicChemPotAndItsTangent, &
|
|
||||||
hydrogenflux_cahnhilliard_getChemPotAndItsTangent, &
|
|
||||||
hydrogenflux_cahnhilliard_putHydrogenConcAndItsRate, &
|
|
||||||
hydrogenflux_cahnhilliard_postResults
|
|
||||||
|
|
||||||
contains
|
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief module initialization
|
|
||||||
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine hydrogenflux_cahnhilliard_init(fileUnit)
|
|
||||||
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
|
||||||
use, intrinsic :: iso_fortran_env, only: &
|
|
||||||
compiler_version, &
|
|
||||||
compiler_options
|
|
||||||
#endif
|
|
||||||
use IO, only: &
|
|
||||||
IO_read, &
|
|
||||||
IO_lc, &
|
|
||||||
IO_getTag, &
|
|
||||||
IO_isBlank, &
|
|
||||||
IO_stringPos, &
|
|
||||||
IO_stringValue, &
|
|
||||||
IO_floatValue, &
|
|
||||||
IO_intValue, &
|
|
||||||
IO_warning, &
|
|
||||||
IO_error, &
|
|
||||||
IO_timeStamp, &
|
|
||||||
IO_EOF
|
|
||||||
use material, only: &
|
|
||||||
hydrogenflux_type, &
|
|
||||||
hydrogenflux_typeInstance, &
|
|
||||||
homogenization_Noutput, &
|
|
||||||
HYDROGENFLUX_cahnhilliard_label, &
|
|
||||||
HYDROGENFLUX_cahnhilliard_ID, &
|
|
||||||
material_homog, &
|
|
||||||
mappingHomogenization, &
|
|
||||||
hydrogenfluxState, &
|
|
||||||
hydrogenfluxMapping, &
|
|
||||||
hydrogenConc, &
|
|
||||||
hydrogenConcRate, &
|
|
||||||
hydrogenflux_initialCh
|
|
||||||
use config, only: &
|
|
||||||
material_partHomogenization, &
|
|
||||||
material_partPhase
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: fileUnit
|
|
||||||
|
|
||||||
integer(pInt), allocatable, dimension(:) :: chunkPos
|
|
||||||
integer(pInt) :: maxNinstance,mySize=0_pInt,section,instance,o
|
|
||||||
integer(pInt) :: sizeState
|
|
||||||
integer(pInt) :: NofMyHomog
|
|
||||||
character(len=65536) :: &
|
|
||||||
tag = '', &
|
|
||||||
line = ''
|
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- hydrogenflux_'//HYDROGENFLUX_cahnhilliard_label//' init -+>>>'
|
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
|
||||||
#include "compilation_info.f90"
|
|
||||||
|
|
||||||
maxNinstance = int(count(hydrogenflux_type == HYDROGENFLUX_cahnhilliard_ID),pInt)
|
|
||||||
if (maxNinstance == 0_pInt) return
|
|
||||||
|
|
||||||
allocate(hydrogenflux_cahnhilliard_sizePostResults(maxNinstance), source=0_pInt)
|
|
||||||
allocate(hydrogenflux_cahnhilliard_sizePostResult (maxval(homogenization_Noutput),maxNinstance),source=0_pInt)
|
|
||||||
allocate(hydrogenflux_cahnhilliard_output (maxval(homogenization_Noutput),maxNinstance))
|
|
||||||
hydrogenflux_cahnhilliard_output = ''
|
|
||||||
allocate(hydrogenflux_cahnhilliard_outputID (maxval(homogenization_Noutput),maxNinstance),source=undefined_ID)
|
|
||||||
allocate(hydrogenflux_cahnhilliard_Noutput (maxNinstance), source=0_pInt)
|
|
||||||
|
|
||||||
rewind(fileUnit)
|
|
||||||
section = 0_pInt
|
|
||||||
do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= material_partHomogenization)! wind forward to <homogenization>
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
parsingHomog: do while (trim(line) /= IO_EOF) ! read through sections of homog part
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
|
||||||
if (IO_getTag(line,'<','>') /= '') then ! stop at next part
|
|
||||||
line = IO_read(fileUnit, .true.) ! reset IO_read
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
if (IO_getTag(line,'[',']') /= '') then ! next homog section
|
|
||||||
section = section + 1_pInt ! advance homog section counter
|
|
||||||
cycle ! skip to next line
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (section > 0_pInt ) then; if (hydrogenflux_type(section) == HYDROGENFLUX_cahnhilliard_ID) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
|
||||||
|
|
||||||
instance = hydrogenflux_typeInstance(section) ! which instance of my hydrogenflux is present homog
|
|
||||||
chunkPos = IO_stringPos(line)
|
|
||||||
tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key
|
|
||||||
select case(tag)
|
|
||||||
case ('(output)')
|
|
||||||
select case(IO_lc(IO_stringValue(line,chunkPos,2_pInt)))
|
|
||||||
case ('hydrogenconc')
|
|
||||||
hydrogenflux_cahnhilliard_Noutput(instance) = hydrogenflux_cahnhilliard_Noutput(instance) + 1_pInt
|
|
||||||
hydrogenflux_cahnhilliard_outputID(hydrogenflux_cahnhilliard_Noutput(instance),instance) = hydrogenConc_ID
|
|
||||||
hydrogenflux_cahnhilliard_output(hydrogenflux_cahnhilliard_Noutput(instance),instance) = &
|
|
||||||
IO_lc(IO_stringValue(line,chunkPos,2_pInt))
|
|
||||||
end select
|
|
||||||
|
|
||||||
end select
|
|
||||||
endif; endif
|
|
||||||
enddo parsingHomog
|
|
||||||
|
|
||||||
rewind(fileUnit)
|
|
||||||
section = 0_pInt
|
|
||||||
do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= material_partPhase) ! wind forward to <homogenization>
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
initializeInstances: do section = 1_pInt, size(hydrogenflux_type)
|
|
||||||
if (hydrogenflux_type(section) == HYDROGENFLUX_cahnhilliard_ID) then
|
|
||||||
NofMyHomog=count(material_homog==section)
|
|
||||||
instance = hydrogenflux_typeInstance(section)
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! Determine size of postResults array
|
|
||||||
outputsLoop: do o = 1_pInt,hydrogenflux_cahnhilliard_Noutput(instance)
|
|
||||||
select case(hydrogenflux_cahnhilliard_outputID(o,instance))
|
|
||||||
case(hydrogenConc_ID)
|
|
||||||
mySize = 1_pInt
|
|
||||||
end select
|
|
||||||
|
|
||||||
if (mySize > 0_pInt) then ! any meaningful output found
|
|
||||||
hydrogenflux_cahnhilliard_sizePostResult(o,instance) = mySize
|
|
||||||
hydrogenflux_cahnhilliard_sizePostResults(instance) = hydrogenflux_cahnhilliard_sizePostResults(instance) + mySize
|
|
||||||
endif
|
|
||||||
enddo outputsLoop
|
|
||||||
|
|
||||||
! allocate state arrays
|
|
||||||
sizeState = 0_pInt
|
|
||||||
hydrogenfluxState(section)%sizeState = sizeState
|
|
||||||
hydrogenfluxState(section)%sizePostResults = hydrogenflux_cahnhilliard_sizePostResults(instance)
|
|
||||||
allocate(hydrogenfluxState(section)%state0 (sizeState,NofMyHomog))
|
|
||||||
allocate(hydrogenfluxState(section)%subState0(sizeState,NofMyHomog))
|
|
||||||
allocate(hydrogenfluxState(section)%state (sizeState,NofMyHomog))
|
|
||||||
|
|
||||||
nullify(hydrogenfluxMapping(section)%p)
|
|
||||||
hydrogenfluxMapping(section)%p => mappingHomogenization(1,:,:)
|
|
||||||
deallocate(hydrogenConc (section)%p)
|
|
||||||
deallocate(hydrogenConcRate(section)%p)
|
|
||||||
allocate (hydrogenConc (section)%p(NofMyHomog), source=hydrogenflux_initialCh(section))
|
|
||||||
allocate (hydrogenConcRate(section)%p(NofMyHomog), source=0.0_pReal)
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
enddo initializeInstances
|
|
||||||
|
|
||||||
end subroutine hydrogenflux_cahnhilliard_init
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns homogenized solute mobility tensor in reference configuration
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
function hydrogenflux_cahnhilliard_getMobility33(ip,el)
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_hydrogenfluxMobility33
|
|
||||||
use material, only: &
|
|
||||||
homogenization_Ngrains, &
|
|
||||||
material_phase
|
|
||||||
use mesh, only: &
|
|
||||||
mesh_element
|
|
||||||
use crystallite, only: &
|
|
||||||
crystallite_push33ToRef
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), dimension(3,3) :: &
|
|
||||||
hydrogenflux_cahnhilliard_getMobility33
|
|
||||||
integer(pInt) :: &
|
|
||||||
grain
|
|
||||||
|
|
||||||
hydrogenflux_cahnhilliard_getMobility33 = 0.0_pReal
|
|
||||||
do grain = 1, homogenization_Ngrains(mesh_element(3,el))
|
|
||||||
hydrogenflux_cahnhilliard_getMobility33 = hydrogenflux_cahnhilliard_getMobility33 + &
|
|
||||||
crystallite_push33ToRef(grain,ip,el,lattice_hydrogenfluxMobility33(:,:,material_phase(grain,ip,el)))
|
|
||||||
enddo
|
|
||||||
|
|
||||||
hydrogenflux_cahnhilliard_getMobility33 = &
|
|
||||||
hydrogenflux_cahnhilliard_getMobility33/real(homogenization_Ngrains(mesh_element(3,el)),pReal)
|
|
||||||
|
|
||||||
end function hydrogenflux_cahnhilliard_getMobility33
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns homogenized solute nonlocal diffusion tensor in reference configuration
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
function hydrogenflux_cahnhilliard_getDiffusion33(ip,el)
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_hydrogenfluxDiffusion33
|
|
||||||
use material, only: &
|
|
||||||
homogenization_Ngrains, &
|
|
||||||
material_phase
|
|
||||||
use mesh, only: &
|
|
||||||
mesh_element
|
|
||||||
use crystallite, only: &
|
|
||||||
crystallite_push33ToRef
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), dimension(3,3) :: &
|
|
||||||
hydrogenflux_cahnhilliard_getDiffusion33
|
|
||||||
integer(pInt) :: &
|
|
||||||
grain
|
|
||||||
|
|
||||||
hydrogenflux_cahnhilliard_getDiffusion33 = 0.0_pReal
|
|
||||||
do grain = 1, homogenization_Ngrains(mesh_element(3,el))
|
|
||||||
hydrogenflux_cahnhilliard_getDiffusion33 = hydrogenflux_cahnhilliard_getDiffusion33 + &
|
|
||||||
crystallite_push33ToRef(grain,ip,el,lattice_hydrogenfluxDiffusion33(:,:,material_phase(grain,ip,el)))
|
|
||||||
enddo
|
|
||||||
|
|
||||||
hydrogenflux_cahnhilliard_getDiffusion33 = &
|
|
||||||
hydrogenflux_cahnhilliard_getDiffusion33/real(homogenization_Ngrains(mesh_element(3,el)),pReal)
|
|
||||||
|
|
||||||
end function hydrogenflux_cahnhilliard_getDiffusion33
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns homogenized solution energy
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
function hydrogenflux_cahnhilliard_getFormationEnergy(ip,el)
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_hydrogenFormationEnergy, &
|
|
||||||
lattice_hydrogenVol, &
|
|
||||||
lattice_hydrogenSurfaceEnergy
|
|
||||||
use material, only: &
|
|
||||||
homogenization_Ngrains, &
|
|
||||||
material_phase
|
|
||||||
use mesh, only: &
|
|
||||||
mesh_element
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal) :: &
|
|
||||||
hydrogenflux_cahnhilliard_getFormationEnergy
|
|
||||||
integer(pInt) :: &
|
|
||||||
grain
|
|
||||||
|
|
||||||
hydrogenflux_cahnhilliard_getFormationEnergy = 0.0_pReal
|
|
||||||
do grain = 1, homogenization_Ngrains(mesh_element(3,el))
|
|
||||||
hydrogenflux_cahnhilliard_getFormationEnergy = hydrogenflux_cahnhilliard_getFormationEnergy + &
|
|
||||||
lattice_hydrogenFormationEnergy(material_phase(grain,ip,el))/ &
|
|
||||||
lattice_hydrogenVol(material_phase(grain,ip,el))/ &
|
|
||||||
lattice_hydrogenSurfaceEnergy(material_phase(grain,ip,el))
|
|
||||||
enddo
|
|
||||||
|
|
||||||
hydrogenflux_cahnhilliard_getFormationEnergy = &
|
|
||||||
hydrogenflux_cahnhilliard_getFormationEnergy/real(homogenization_Ngrains(mesh_element(3,el)),pReal)
|
|
||||||
|
|
||||||
end function hydrogenflux_cahnhilliard_getFormationEnergy
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns homogenized hydrogen entropy coefficient
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
function hydrogenflux_cahnhilliard_getEntropicCoeff(ip,el)
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_hydrogenVol, &
|
|
||||||
lattice_hydrogenSurfaceEnergy
|
|
||||||
use material, only: &
|
|
||||||
homogenization_Ngrains, &
|
|
||||||
material_homog, &
|
|
||||||
material_phase, &
|
|
||||||
temperature, &
|
|
||||||
thermalMapping
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal) :: &
|
|
||||||
hydrogenflux_cahnhilliard_getEntropicCoeff
|
|
||||||
integer(pInt) :: &
|
|
||||||
grain
|
|
||||||
|
|
||||||
hydrogenflux_cahnhilliard_getEntropicCoeff = 0.0_pReal
|
|
||||||
do grain = 1, homogenization_Ngrains(material_homog(ip,el))
|
|
||||||
hydrogenflux_cahnhilliard_getEntropicCoeff = hydrogenflux_cahnhilliard_getEntropicCoeff + &
|
|
||||||
kB/ &
|
|
||||||
lattice_hydrogenVol(material_phase(grain,ip,el))/ &
|
|
||||||
lattice_hydrogenSurfaceEnergy(material_phase(grain,ip,el))
|
|
||||||
enddo
|
|
||||||
|
|
||||||
hydrogenflux_cahnhilliard_getEntropicCoeff = hydrogenflux_cahnhilliard_getEntropicCoeff* &
|
|
||||||
temperature(material_homog(ip,el))%p(thermalMapping(material_homog(ip,el))%p(ip,el))/ &
|
|
||||||
real(homogenization_Ngrains(material_homog(ip,el)),pReal)
|
|
||||||
|
|
||||||
end function hydrogenflux_cahnhilliard_getEntropicCoeff
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns homogenized kinematic contribution to chemical potential
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine hydrogenflux_cahnhilliard_KinematicChemPotAndItsTangent(KPot, dKPot_dCh, Ch, ip, el)
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_hydrogenSurfaceEnergy
|
|
||||||
use material, only: &
|
|
||||||
homogenization_Ngrains, &
|
|
||||||
material_homog, &
|
|
||||||
phase_kinematics, &
|
|
||||||
phase_Nkinematics, &
|
|
||||||
material_phase, &
|
|
||||||
KINEMATICS_hydrogen_strain_ID
|
|
||||||
use crystallite, only: &
|
|
||||||
crystallite_Tstar_v, &
|
|
||||||
crystallite_Fi0, &
|
|
||||||
crystallite_Fi
|
|
||||||
use kinematics_hydrogen_strain, only: &
|
|
||||||
kinematics_hydrogen_strain_ChemPotAndItsTangent
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(in) :: &
|
|
||||||
Ch
|
|
||||||
real(pReal), intent(out) :: &
|
|
||||||
KPot, dKPot_dCh
|
|
||||||
real(pReal) :: &
|
|
||||||
my_KPot, my_dKPot_dCh
|
|
||||||
integer(pInt) :: &
|
|
||||||
grain, kinematics
|
|
||||||
|
|
||||||
KPot = 0.0_pReal
|
|
||||||
dKPot_dCh = 0.0_pReal
|
|
||||||
do grain = 1_pInt,homogenization_Ngrains(material_homog(ip,el))
|
|
||||||
do kinematics = 1_pInt, phase_Nkinematics(material_phase(grain,ip,el))
|
|
||||||
select case (phase_kinematics(kinematics,material_phase(grain,ip,el)))
|
|
||||||
case (KINEMATICS_hydrogen_strain_ID)
|
|
||||||
call kinematics_hydrogen_strain_ChemPotAndItsTangent(my_KPot, my_dKPot_dCh, &
|
|
||||||
crystallite_Tstar_v(1:6,grain,ip,el), &
|
|
||||||
crystallite_Fi0(1:3,1:3,grain,ip,el), &
|
|
||||||
crystallite_Fi (1:3,1:3,grain,ip,el), &
|
|
||||||
grain,ip, el)
|
|
||||||
|
|
||||||
case default
|
|
||||||
my_KPot = 0.0_pReal
|
|
||||||
my_dKPot_dCh = 0.0_pReal
|
|
||||||
|
|
||||||
end select
|
|
||||||
KPot = KPot + my_KPot/lattice_hydrogenSurfaceEnergy(material_phase(grain,ip,el))
|
|
||||||
dKPot_dCh = dKPot_dCh + my_dKPot_dCh/lattice_hydrogenSurfaceEnergy(material_phase(grain,ip,el))
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
KPot = KPot/real(homogenization_Ngrains(material_homog(ip,el)),pReal)
|
|
||||||
dKPot_dCh = dKPot_dCh/real(homogenization_Ngrains(material_homog(ip,el)),pReal)
|
|
||||||
|
|
||||||
end subroutine hydrogenflux_cahnhilliard_KinematicChemPotAndItsTangent
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns homogenized chemical potential
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine hydrogenflux_cahnhilliard_getChemPotAndItsTangent(ChemPot,dChemPot_dCh,Ch,ip,el)
|
|
||||||
use numerics, only: &
|
|
||||||
hydrogenBoundPenalty, &
|
|
||||||
hydrogenPolyOrder
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(in) :: &
|
|
||||||
Ch
|
|
||||||
real(pReal), intent(out) :: &
|
|
||||||
ChemPot, &
|
|
||||||
dChemPot_dCh
|
|
||||||
real(pReal) :: &
|
|
||||||
kBT, KPot, dKPot_dCh
|
|
||||||
integer(pInt) :: &
|
|
||||||
o
|
|
||||||
|
|
||||||
ChemPot = hydrogenflux_cahnhilliard_getFormationEnergy(ip,el)
|
|
||||||
dChemPot_dCh = 0.0_pReal
|
|
||||||
kBT = hydrogenflux_cahnhilliard_getEntropicCoeff(ip,el)
|
|
||||||
do o = 1_pInt, hydrogenPolyOrder
|
|
||||||
ChemPot = ChemPot + kBT*((2.0_pReal*Ch - 1.0_pReal)**real(2_pInt*o-1_pInt,pReal))/ &
|
|
||||||
real(2_pInt*o-1_pInt,pReal)
|
|
||||||
dChemPot_dCh = dChemPot_dCh + 2.0_pReal*kBT*(2.0_pReal*Ch - 1.0_pReal)**real(2_pInt*o-2_pInt,pReal)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
call hydrogenflux_cahnhilliard_KinematicChemPotAndItsTangent(KPot, dKPot_dCh, Ch, ip, el)
|
|
||||||
ChemPot = ChemPot + KPot
|
|
||||||
dChemPot_dCh = dChemPot_dCh + dKPot_dCh
|
|
||||||
|
|
||||||
if (Ch < 0.0_pReal) then
|
|
||||||
ChemPot = ChemPot - 3.0_pReal*hydrogenBoundPenalty*Ch*Ch
|
|
||||||
dChemPot_dCh = dChemPot_dCh - 6.0_pReal*hydrogenBoundPenalty*Ch
|
|
||||||
elseif (Ch > 1.0_pReal) then
|
|
||||||
ChemPot = ChemPot + 3.0_pReal*hydrogenBoundPenalty*(1.0_pReal - Ch)*(1.0_pReal - Ch)
|
|
||||||
dChemPot_dCh = dChemPot_dCh - 6.0_pReal*hydrogenBoundPenalty*(1.0_pReal - Ch)
|
|
||||||
endif
|
|
||||||
|
|
||||||
end subroutine hydrogenflux_cahnhilliard_getChemPotAndItsTangent
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief updates hydrogen concentration with solution from Cahn-Hilliard PDE for solute transport
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine hydrogenflux_cahnhilliard_putHydrogenConcAndItsRate(Ch,Chdot,ip,el)
|
|
||||||
use material, only: &
|
|
||||||
mappingHomogenization, &
|
|
||||||
hydrogenConc, &
|
|
||||||
hydrogenConcRate, &
|
|
||||||
hydrogenfluxMapping
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(in) :: &
|
|
||||||
Ch, &
|
|
||||||
Chdot
|
|
||||||
integer(pInt) :: &
|
|
||||||
homog, &
|
|
||||||
offset
|
|
||||||
|
|
||||||
homog = mappingHomogenization(2,ip,el)
|
|
||||||
offset = hydrogenfluxMapping(homog)%p(ip,el)
|
|
||||||
hydrogenConc (homog)%p(offset) = Ch
|
|
||||||
hydrogenConcRate(homog)%p(offset) = Chdot
|
|
||||||
|
|
||||||
end subroutine hydrogenflux_cahnhilliard_putHydrogenConcAndItsRate
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief return array of hydrogen transport results
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
function hydrogenflux_cahnhilliard_postResults(ip,el)
|
|
||||||
use material, only: &
|
|
||||||
mappingHomogenization, &
|
|
||||||
hydrogenflux_typeInstance, &
|
|
||||||
hydrogenConc, &
|
|
||||||
hydrogenfluxMapping
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point
|
|
||||||
el !< element
|
|
||||||
real(pReal), dimension(hydrogenflux_cahnhilliard_sizePostResults(hydrogenflux_typeInstance(mappingHomogenization(2,ip,el)))) :: &
|
|
||||||
hydrogenflux_cahnhilliard_postResults
|
|
||||||
|
|
||||||
integer(pInt) :: &
|
|
||||||
instance, homog, offset, o, c
|
|
||||||
|
|
||||||
homog = mappingHomogenization(2,ip,el)
|
|
||||||
offset = hydrogenfluxMapping(homog)%p(ip,el)
|
|
||||||
instance = hydrogenflux_typeInstance(homog)
|
|
||||||
|
|
||||||
c = 0_pInt
|
|
||||||
hydrogenflux_cahnhilliard_postResults = 0.0_pReal
|
|
||||||
|
|
||||||
do o = 1_pInt,hydrogenflux_cahnhilliard_Noutput(instance)
|
|
||||||
select case(hydrogenflux_cahnhilliard_outputID(o,instance))
|
|
||||||
|
|
||||||
case (hydrogenConc_ID)
|
|
||||||
hydrogenflux_cahnhilliard_postResults(c+1_pInt) = hydrogenConc(homog)%p(offset)
|
|
||||||
c = c + 1
|
|
||||||
end select
|
|
||||||
enddo
|
|
||||||
end function hydrogenflux_cahnhilliard_postResults
|
|
||||||
|
|
||||||
end module hydrogenflux_cahnhilliard
|
|
|
@ -1,62 +0,0 @@
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
|
||||||
!> @brief material subroutine for constant hydrogen concentration
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
module hydrogenflux_isoconc
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
private
|
|
||||||
|
|
||||||
public :: &
|
|
||||||
hydrogenflux_isoconc_init
|
|
||||||
|
|
||||||
contains
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief allocates all neccessary fields, reads information from material configuration file
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine hydrogenflux_isoconc_init()
|
|
||||||
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
|
||||||
use, intrinsic :: iso_fortran_env, only: &
|
|
||||||
compiler_version, &
|
|
||||||
compiler_options
|
|
||||||
#endif
|
|
||||||
use prec, only: &
|
|
||||||
pReal, &
|
|
||||||
pInt
|
|
||||||
use IO, only: &
|
|
||||||
IO_timeStamp
|
|
||||||
use material
|
|
||||||
use config
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt) :: &
|
|
||||||
homog, &
|
|
||||||
NofMyHomog
|
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- hydrogenflux_'//HYDROGENFLUX_isoconc_label//' init -+>>>'
|
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
|
||||||
#include "compilation_info.f90"
|
|
||||||
|
|
||||||
initializeInstances: do homog = 1_pInt, material_Nhomogenization
|
|
||||||
|
|
||||||
myhomog: if (hydrogenflux_type(homog) == HYDROGENFLUX_isoconc_ID) then
|
|
||||||
NofMyHomog = count(material_homog == homog)
|
|
||||||
hydrogenfluxState(homog)%sizeState = 0_pInt
|
|
||||||
hydrogenfluxState(homog)%sizePostResults = 0_pInt
|
|
||||||
allocate(hydrogenfluxState(homog)%state0 (0_pInt,NofMyHomog), source=0.0_pReal)
|
|
||||||
allocate(hydrogenfluxState(homog)%subState0(0_pInt,NofMyHomog), source=0.0_pReal)
|
|
||||||
allocate(hydrogenfluxState(homog)%state (0_pInt,NofMyHomog), source=0.0_pReal)
|
|
||||||
|
|
||||||
deallocate(hydrogenConc (homog)%p)
|
|
||||||
deallocate(hydrogenConcRate(homog)%p)
|
|
||||||
allocate (hydrogenConc (homog)%p(1), source=hydrogenflux_initialCh(homog))
|
|
||||||
allocate (hydrogenConcRate(homog)%p(1), source=0.0_pReal)
|
|
||||||
|
|
||||||
endif myhomog
|
|
||||||
enddo initializeInstances
|
|
||||||
|
|
||||||
|
|
||||||
end subroutine hydrogenflux_isoconc_init
|
|
||||||
|
|
||||||
end module hydrogenflux_isoconc
|
|
|
@ -1,263 +0,0 @@
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
|
||||||
!> @brief material subroutine incorporating kinematics resulting from interstitial hydrogen
|
|
||||||
!> @details to be done
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
module kinematics_hydrogen_strain
|
|
||||||
use prec, only: &
|
|
||||||
pReal, &
|
|
||||||
pInt
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
private
|
|
||||||
integer(pInt), dimension(:), allocatable, public, protected :: &
|
|
||||||
kinematics_hydrogen_strain_sizePostResults, & !< cumulative size of post results
|
|
||||||
kinematics_hydrogen_strain_offset, & !< which kinematics is my current damage mechanism?
|
|
||||||
kinematics_hydrogen_strain_instance !< instance of damage kinematics mechanism
|
|
||||||
|
|
||||||
integer(pInt), dimension(:,:), allocatable, target, public :: &
|
|
||||||
kinematics_hydrogen_strain_sizePostResult !< size of each post result output
|
|
||||||
|
|
||||||
character(len=64), dimension(:,:), allocatable, target, public :: &
|
|
||||||
kinematics_hydrogen_strain_output !< name of each post result output
|
|
||||||
|
|
||||||
integer(pInt), dimension(:), allocatable, target, public :: &
|
|
||||||
kinematics_hydrogen_strain_Noutput !< number of outputs per instance of this damage
|
|
||||||
|
|
||||||
real(pReal), dimension(:), allocatable, private :: &
|
|
||||||
kinematics_hydrogen_strain_coeff
|
|
||||||
|
|
||||||
public :: &
|
|
||||||
kinematics_hydrogen_strain_init, &
|
|
||||||
kinematics_hydrogen_strain_initialStrain, &
|
|
||||||
kinematics_hydrogen_strain_LiAndItsTangent, &
|
|
||||||
kinematics_hydrogen_strain_ChemPotAndItsTangent
|
|
||||||
|
|
||||||
contains
|
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief module initialization
|
|
||||||
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine kinematics_hydrogen_strain_init(fileUnit)
|
|
||||||
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
|
||||||
use, intrinsic :: iso_fortran_env, only: &
|
|
||||||
compiler_version, &
|
|
||||||
compiler_options
|
|
||||||
#endif
|
|
||||||
use debug, only: &
|
|
||||||
debug_level,&
|
|
||||||
debug_constitutive,&
|
|
||||||
debug_levelBasic
|
|
||||||
use IO, only: &
|
|
||||||
IO_read, &
|
|
||||||
IO_lc, &
|
|
||||||
IO_getTag, &
|
|
||||||
IO_isBlank, &
|
|
||||||
IO_stringPos, &
|
|
||||||
IO_stringValue, &
|
|
||||||
IO_floatValue, &
|
|
||||||
IO_intValue, &
|
|
||||||
IO_warning, &
|
|
||||||
IO_error, &
|
|
||||||
IO_timeStamp, &
|
|
||||||
IO_EOF
|
|
||||||
use material, only: &
|
|
||||||
phase_kinematics, &
|
|
||||||
phase_Nkinematics, &
|
|
||||||
phase_Noutput, &
|
|
||||||
KINEMATICS_hydrogen_strain_label, &
|
|
||||||
KINEMATICS_hydrogen_strain_ID
|
|
||||||
use config, only: &
|
|
||||||
material_Nphase, &
|
|
||||||
MATERIAL_partPhase
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: fileUnit
|
|
||||||
|
|
||||||
integer(pInt), allocatable, dimension(:) :: chunkPos
|
|
||||||
integer(pInt) :: maxNinstance,phase,instance,kinematics
|
|
||||||
character(len=65536) :: &
|
|
||||||
tag = '', &
|
|
||||||
line = ''
|
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- kinematics_'//KINEMATICS_hydrogen_strain_LABEL//' init -+>>>'
|
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
|
||||||
#include "compilation_info.f90"
|
|
||||||
|
|
||||||
maxNinstance = int(count(phase_kinematics == KINEMATICS_hydrogen_strain_ID),pInt)
|
|
||||||
if (maxNinstance == 0_pInt) return
|
|
||||||
|
|
||||||
if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) &
|
|
||||||
write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance
|
|
||||||
|
|
||||||
allocate(kinematics_hydrogen_strain_offset(material_Nphase), source=0_pInt)
|
|
||||||
allocate(kinematics_hydrogen_strain_instance(material_Nphase), source=0_pInt)
|
|
||||||
do phase = 1, material_Nphase
|
|
||||||
kinematics_hydrogen_strain_instance(phase) = count(phase_kinematics(:,1:phase) == kinematics_hydrogen_strain_ID)
|
|
||||||
do kinematics = 1, phase_Nkinematics(phase)
|
|
||||||
if (phase_kinematics(kinematics,phase) == kinematics_hydrogen_strain_ID) &
|
|
||||||
kinematics_hydrogen_strain_offset(phase) = kinematics
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
allocate(kinematics_hydrogen_strain_sizePostResults(maxNinstance), source=0_pInt)
|
|
||||||
allocate(kinematics_hydrogen_strain_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0_pInt)
|
|
||||||
allocate(kinematics_hydrogen_strain_output(maxval(phase_Noutput),maxNinstance))
|
|
||||||
kinematics_hydrogen_strain_output = ''
|
|
||||||
allocate(kinematics_hydrogen_strain_Noutput(maxNinstance), source=0_pInt)
|
|
||||||
allocate(kinematics_hydrogen_strain_coeff(maxNinstance), source=0.0_pReal)
|
|
||||||
|
|
||||||
rewind(fileUnit)
|
|
||||||
phase = 0_pInt
|
|
||||||
do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= MATERIAL_partPhase) ! wind forward to <phase>
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of phase part
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
|
||||||
if (IO_getTag(line,'<','>') /= '') then ! stop at next part
|
|
||||||
line = IO_read(fileUnit, .true.) ! reset IO_read
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
if (IO_getTag(line,'[',']') /= '') then ! next phase section
|
|
||||||
phase = phase + 1_pInt ! advance phase section counter
|
|
||||||
cycle ! skip to next line
|
|
||||||
endif
|
|
||||||
if (phase > 0_pInt ) then; if (any(phase_kinematics(:,phase) == KINEMATICS_hydrogen_strain_ID)) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
|
||||||
instance = kinematics_hydrogen_strain_instance(phase) ! which instance of my damage is present phase
|
|
||||||
chunkPos = IO_stringPos(line)
|
|
||||||
tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key
|
|
||||||
select case(tag)
|
|
||||||
case ('hydrogen_strain_coeff')
|
|
||||||
kinematics_hydrogen_strain_coeff(instance) = IO_floatValue(line,chunkPos,2_pInt)
|
|
||||||
|
|
||||||
end select
|
|
||||||
endif; endif
|
|
||||||
enddo parsingFile
|
|
||||||
|
|
||||||
end subroutine kinematics_hydrogen_strain_init
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief report initial hydrogen strain based on current hydrogen conc deviation from
|
|
||||||
!> equillibrium (0)
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
pure function kinematics_hydrogen_strain_initialStrain(ipc, ip, el)
|
|
||||||
use math, only: &
|
|
||||||
math_I3
|
|
||||||
use material, only: &
|
|
||||||
material_phase, &
|
|
||||||
material_homog, &
|
|
||||||
hydrogenConc, &
|
|
||||||
hydrogenfluxMapping
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_equilibriumHydrogenConcentration
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ipc, & !< grain number
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), dimension(3,3) :: &
|
|
||||||
kinematics_hydrogen_strain_initialStrain !< initial thermal strain (should be small strain, though)
|
|
||||||
integer(pInt) :: &
|
|
||||||
phase, &
|
|
||||||
homog, offset, instance
|
|
||||||
|
|
||||||
phase = material_phase(ipc,ip,el)
|
|
||||||
instance = kinematics_hydrogen_strain_instance(phase)
|
|
||||||
homog = material_homog(ip,el)
|
|
||||||
offset = hydrogenfluxMapping(homog)%p(ip,el)
|
|
||||||
|
|
||||||
kinematics_hydrogen_strain_initialStrain = &
|
|
||||||
(hydrogenConc(homog)%p(offset) - lattice_equilibriumHydrogenConcentration(phase)) * &
|
|
||||||
kinematics_hydrogen_strain_coeff(instance)* math_I3
|
|
||||||
|
|
||||||
end function kinematics_hydrogen_strain_initialStrain
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief contains the constitutive equation for calculating the velocity gradient
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine kinematics_hydrogen_strain_LiAndItsTangent(Li, dLi_dTstar3333, ipc, ip, el)
|
|
||||||
use material, only: &
|
|
||||||
material_phase, &
|
|
||||||
material_homog, &
|
|
||||||
hydrogenConc, &
|
|
||||||
hydrogenConcRate, &
|
|
||||||
hydrogenfluxMapping
|
|
||||||
use math, only: &
|
|
||||||
math_I3
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_equilibriumHydrogenConcentration
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ipc, & !< grain number
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(out), dimension(3,3) :: &
|
|
||||||
Li !< thermal velocity gradient
|
|
||||||
real(pReal), intent(out), dimension(3,3,3,3) :: &
|
|
||||||
dLi_dTstar3333 !< derivative of Li with respect to Tstar (4th-order tensor)
|
|
||||||
integer(pInt) :: &
|
|
||||||
phase, &
|
|
||||||
instance, &
|
|
||||||
homog, offset
|
|
||||||
real(pReal) :: &
|
|
||||||
Ch, ChEq, ChDot
|
|
||||||
|
|
||||||
phase = material_phase(ipc,ip,el)
|
|
||||||
instance = kinematics_hydrogen_strain_instance(phase)
|
|
||||||
homog = material_homog(ip,el)
|
|
||||||
offset = hydrogenfluxMapping(homog)%p(ip,el)
|
|
||||||
Ch = hydrogenConc(homog)%p(offset)
|
|
||||||
ChDot = hydrogenConcRate(homog)%p(offset)
|
|
||||||
ChEq = lattice_equilibriumHydrogenConcentration(phase)
|
|
||||||
|
|
||||||
Li = ChDot*math_I3* &
|
|
||||||
kinematics_hydrogen_strain_coeff(instance)/ &
|
|
||||||
(1.0_pReal + kinematics_hydrogen_strain_coeff(instance)*(Ch - ChEq))
|
|
||||||
dLi_dTstar3333 = 0.0_pReal
|
|
||||||
|
|
||||||
end subroutine kinematics_hydrogen_strain_LiAndItsTangent
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief contains the kinematic contribution to hydrogen chemical potential
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine kinematics_hydrogen_strain_ChemPotAndItsTangent(ChemPot, dChemPot_dCh, Tstar_v, Fi0, Fi, ipc, ip, el)
|
|
||||||
use material, only: &
|
|
||||||
material_phase
|
|
||||||
use math, only: &
|
|
||||||
math_inv33, &
|
|
||||||
math_mul33x33, &
|
|
||||||
math_Mandel6to33, &
|
|
||||||
math_transpose33
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ipc, & !< grain number
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(in), dimension(6) :: &
|
|
||||||
Tstar_v
|
|
||||||
real(pReal), intent(in), dimension(3,3) :: &
|
|
||||||
Fi0, Fi
|
|
||||||
real(pReal), intent(out) :: &
|
|
||||||
ChemPot, dChemPot_dCh
|
|
||||||
integer(pInt) :: &
|
|
||||||
phase, &
|
|
||||||
instance
|
|
||||||
|
|
||||||
phase = material_phase(ipc,ip,el)
|
|
||||||
instance = kinematics_hydrogen_strain_instance(phase)
|
|
||||||
|
|
||||||
ChemPot = -kinematics_hydrogen_strain_coeff(instance)* &
|
|
||||||
sum(math_mul33x33(Fi,math_Mandel6to33(Tstar_v))* &
|
|
||||||
math_mul33x33(math_mul33x33(Fi,math_inv33(Fi0)),Fi))
|
|
||||||
dChemPot_dCh = 0.0_pReal
|
|
||||||
|
|
||||||
end subroutine kinematics_hydrogen_strain_ChemPotAndItsTangent
|
|
||||||
|
|
||||||
end module kinematics_hydrogen_strain
|
|
|
@ -1,264 +0,0 @@
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
|
||||||
!> @brief material subroutine incorporating kinematics resulting from vacancy point defects
|
|
||||||
!> @details to be done
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
module kinematics_vacancy_strain
|
|
||||||
use prec, only: &
|
|
||||||
pReal, &
|
|
||||||
pInt
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
private
|
|
||||||
integer(pInt), dimension(:), allocatable, public, protected :: &
|
|
||||||
kinematics_vacancy_strain_sizePostResults, & !< cumulative size of post results
|
|
||||||
kinematics_vacancy_strain_offset, & !< which kinematics is my current damage mechanism?
|
|
||||||
kinematics_vacancy_strain_instance !< instance of damage kinematics mechanism
|
|
||||||
|
|
||||||
integer(pInt), dimension(:,:), allocatable, target, public :: &
|
|
||||||
kinematics_vacancy_strain_sizePostResult !< size of each post result output
|
|
||||||
|
|
||||||
character(len=64), dimension(:,:), allocatable, target, public :: &
|
|
||||||
kinematics_vacancy_strain_output !< name of each post result output
|
|
||||||
|
|
||||||
integer(pInt), dimension(:), allocatable, target, public :: &
|
|
||||||
kinematics_vacancy_strain_Noutput !< number of outputs per instance of this damage
|
|
||||||
|
|
||||||
real(pReal), dimension(:), allocatable, private :: &
|
|
||||||
kinematics_vacancy_strain_coeff
|
|
||||||
|
|
||||||
public :: &
|
|
||||||
kinematics_vacancy_strain_init, &
|
|
||||||
kinematics_vacancy_strain_initialStrain, &
|
|
||||||
kinematics_vacancy_strain_LiAndItsTangent, &
|
|
||||||
kinematics_vacancy_strain_ChemPotAndItsTangent
|
|
||||||
|
|
||||||
contains
|
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief module initialization
|
|
||||||
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine kinematics_vacancy_strain_init(fileUnit)
|
|
||||||
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
|
||||||
use, intrinsic :: iso_fortran_env, only: &
|
|
||||||
compiler_version, &
|
|
||||||
compiler_options
|
|
||||||
#endif
|
|
||||||
use debug, only: &
|
|
||||||
debug_level,&
|
|
||||||
debug_constitutive,&
|
|
||||||
debug_levelBasic
|
|
||||||
use IO, only: &
|
|
||||||
IO_read, &
|
|
||||||
IO_lc, &
|
|
||||||
IO_getTag, &
|
|
||||||
IO_isBlank, &
|
|
||||||
IO_stringPos, &
|
|
||||||
IO_stringValue, &
|
|
||||||
IO_floatValue, &
|
|
||||||
IO_intValue, &
|
|
||||||
IO_warning, &
|
|
||||||
IO_error, &
|
|
||||||
IO_timeStamp, &
|
|
||||||
IO_EOF
|
|
||||||
use material, only: &
|
|
||||||
phase_kinematics, &
|
|
||||||
phase_Nkinematics, &
|
|
||||||
phase_Noutput, &
|
|
||||||
KINEMATICS_vacancy_strain_label, &
|
|
||||||
KINEMATICS_vacancy_strain_ID
|
|
||||||
use config, only: &
|
|
||||||
material_Nphase, &
|
|
||||||
MATERIAL_partPhase
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: fileUnit
|
|
||||||
|
|
||||||
integer(pInt), allocatable, dimension(:) :: chunkPos
|
|
||||||
integer(pInt) :: maxNinstance,phase,instance,kinematics
|
|
||||||
character(len=65536) :: &
|
|
||||||
tag = '', &
|
|
||||||
line = ''
|
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- kinematics_'//KINEMATICS_vacancy_strain_LABEL//' init -+>>>'
|
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
|
||||||
#include "compilation_info.f90"
|
|
||||||
|
|
||||||
maxNinstance = int(count(phase_kinematics == KINEMATICS_vacancy_strain_ID),pInt)
|
|
||||||
if (maxNinstance == 0_pInt) return
|
|
||||||
|
|
||||||
if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) &
|
|
||||||
write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance
|
|
||||||
|
|
||||||
allocate(kinematics_vacancy_strain_offset(material_Nphase), source=0_pInt)
|
|
||||||
allocate(kinematics_vacancy_strain_instance(material_Nphase), source=0_pInt)
|
|
||||||
do phase = 1, material_Nphase
|
|
||||||
kinematics_vacancy_strain_instance(phase) = count(phase_kinematics(:,1:phase) == kinematics_vacancy_strain_ID)
|
|
||||||
do kinematics = 1, phase_Nkinematics(phase)
|
|
||||||
if (phase_kinematics(kinematics,phase) == kinematics_vacancy_strain_ID) &
|
|
||||||
kinematics_vacancy_strain_offset(phase) = kinematics
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
allocate(kinematics_vacancy_strain_sizePostResults(maxNinstance), source=0_pInt)
|
|
||||||
allocate(kinematics_vacancy_strain_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0_pInt)
|
|
||||||
allocate(kinematics_vacancy_strain_output(maxval(phase_Noutput),maxNinstance))
|
|
||||||
kinematics_vacancy_strain_output = ''
|
|
||||||
allocate(kinematics_vacancy_strain_Noutput(maxNinstance), source=0_pInt)
|
|
||||||
allocate(kinematics_vacancy_strain_coeff(maxNinstance), source=0.0_pReal)
|
|
||||||
|
|
||||||
rewind(fileUnit)
|
|
||||||
phase = 0_pInt
|
|
||||||
do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= MATERIAL_partPhase) ! wind forward to <phase>
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of phase part
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
|
||||||
if (IO_getTag(line,'<','>') /= '') then ! stop at next part
|
|
||||||
line = IO_read(fileUnit, .true.) ! reset IO_read
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
if (IO_getTag(line,'[',']') /= '') then ! next phase section
|
|
||||||
phase = phase + 1_pInt ! advance phase section counter
|
|
||||||
cycle ! skip to next line
|
|
||||||
endif
|
|
||||||
if (phase > 0_pInt ) then; if (any(phase_kinematics(:,phase) == KINEMATICS_vacancy_strain_ID)) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
|
||||||
instance = kinematics_vacancy_strain_instance(phase) ! which instance of my damage is present phase
|
|
||||||
chunkPos = IO_stringPos(line)
|
|
||||||
tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key
|
|
||||||
select case(tag)
|
|
||||||
case ('vacancy_strain_coeff')
|
|
||||||
kinematics_vacancy_strain_coeff(instance) = IO_floatValue(line,chunkPos,2_pInt)
|
|
||||||
|
|
||||||
end select
|
|
||||||
endif; endif
|
|
||||||
enddo parsingFile
|
|
||||||
|
|
||||||
end subroutine kinematics_vacancy_strain_init
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief report initial vacancy strain based on current vacancy conc deviation from equillibrium
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
pure function kinematics_vacancy_strain_initialStrain(ipc, ip, el)
|
|
||||||
use math, only: &
|
|
||||||
math_I3
|
|
||||||
use material, only: &
|
|
||||||
material_phase, &
|
|
||||||
material_homog, &
|
|
||||||
vacancyConc, &
|
|
||||||
vacancyfluxMapping
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_equilibriumVacancyConcentration
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ipc, & !< grain number
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), dimension(3,3) :: &
|
|
||||||
kinematics_vacancy_strain_initialStrain !< initial thermal strain (should be small strain, though)
|
|
||||||
integer(pInt) :: &
|
|
||||||
phase, &
|
|
||||||
homog, offset, instance
|
|
||||||
|
|
||||||
phase = material_phase(ipc,ip,el)
|
|
||||||
instance = kinematics_vacancy_strain_instance(phase)
|
|
||||||
homog = material_homog(ip,el)
|
|
||||||
offset = vacancyfluxMapping(homog)%p(ip,el)
|
|
||||||
|
|
||||||
kinematics_vacancy_strain_initialStrain = &
|
|
||||||
(vacancyConc(homog)%p(offset) - lattice_equilibriumVacancyConcentration(phase)) * &
|
|
||||||
kinematics_vacancy_strain_coeff(instance)* math_I3
|
|
||||||
|
|
||||||
end function kinematics_vacancy_strain_initialStrain
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief contains the constitutive equation for calculating the velocity gradient
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine kinematics_vacancy_strain_LiAndItsTangent(Li, dLi_dTstar3333, ipc, ip, el)
|
|
||||||
use material, only: &
|
|
||||||
material_phase, &
|
|
||||||
material_homog, &
|
|
||||||
vacancyConc, &
|
|
||||||
vacancyConcRate, &
|
|
||||||
vacancyfluxMapping
|
|
||||||
use math, only: &
|
|
||||||
math_I3
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_equilibriumVacancyConcentration
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ipc, & !< grain number
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(out), dimension(3,3) :: &
|
|
||||||
Li !< thermal velocity gradient
|
|
||||||
real(pReal), intent(out), dimension(3,3,3,3) :: &
|
|
||||||
dLi_dTstar3333 !< derivative of Li with respect to Tstar (4th-order tensor)
|
|
||||||
integer(pInt) :: &
|
|
||||||
phase, &
|
|
||||||
instance, &
|
|
||||||
homog, offset
|
|
||||||
real(pReal) :: &
|
|
||||||
Cv, CvEq, CvDot
|
|
||||||
|
|
||||||
phase = material_phase(ipc,ip,el)
|
|
||||||
instance = kinematics_vacancy_strain_instance(phase)
|
|
||||||
homog = material_homog(ip,el)
|
|
||||||
offset = vacancyfluxMapping(homog)%p(ip,el)
|
|
||||||
|
|
||||||
Cv = vacancyConc(homog)%p(offset)
|
|
||||||
CvDot = vacancyConcRate(homog)%p(offset)
|
|
||||||
CvEq = lattice_equilibriumvacancyConcentration(phase)
|
|
||||||
|
|
||||||
Li = CvDot*math_I3* &
|
|
||||||
kinematics_vacancy_strain_coeff(instance)/ &
|
|
||||||
(1.0_pReal + kinematics_vacancy_strain_coeff(instance)*(Cv - CvEq))
|
|
||||||
|
|
||||||
dLi_dTstar3333 = 0.0_pReal
|
|
||||||
|
|
||||||
end subroutine kinematics_vacancy_strain_LiAndItsTangent
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief contains the kinematic contribution to vacancy chemical potential
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine kinematics_vacancy_strain_ChemPotAndItsTangent(ChemPot, dChemPot_dCv, Tstar_v, Fi0, Fi, ipc, ip, el)
|
|
||||||
use material, only: &
|
|
||||||
material_phase
|
|
||||||
use math, only: &
|
|
||||||
math_inv33, &
|
|
||||||
math_mul33x33, &
|
|
||||||
math_Mandel6to33, &
|
|
||||||
math_transpose33
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ipc, & !< grain number
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(in), dimension(6) :: &
|
|
||||||
Tstar_v
|
|
||||||
real(pReal), intent(in), dimension(3,3) :: &
|
|
||||||
Fi0, Fi
|
|
||||||
real(pReal), intent(out) :: &
|
|
||||||
ChemPot, dChemPot_dCv
|
|
||||||
integer(pInt) :: &
|
|
||||||
phase, &
|
|
||||||
instance
|
|
||||||
|
|
||||||
phase = material_phase(ipc,ip,el)
|
|
||||||
instance = kinematics_vacancy_strain_instance(phase)
|
|
||||||
|
|
||||||
ChemPot = -kinematics_vacancy_strain_coeff(instance)* &
|
|
||||||
sum(math_mul33x33(Fi,math_Mandel6to33(Tstar_v))* &
|
|
||||||
math_mul33x33(math_mul33x33(Fi,math_inv33(Fi0)),Fi))
|
|
||||||
dChemPot_dCv = 0.0_pReal
|
|
||||||
|
|
||||||
end subroutine kinematics_vacancy_strain_ChemPotAndItsTangent
|
|
||||||
|
|
||||||
end module kinematics_vacancy_strain
|
|
174
src/material.f90
174
src/material.f90
|
@ -36,29 +36,16 @@ module material
|
||||||
SOURCE_damage_isoDuctile_label = 'damage_isoductile', &
|
SOURCE_damage_isoDuctile_label = 'damage_isoductile', &
|
||||||
SOURCE_damage_anisoBrittle_label = 'damage_anisobrittle', &
|
SOURCE_damage_anisoBrittle_label = 'damage_anisobrittle', &
|
||||||
SOURCE_damage_anisoDuctile_label = 'damage_anisoductile', &
|
SOURCE_damage_anisoDuctile_label = 'damage_anisoductile', &
|
||||||
SOURCE_vacancy_phenoplasticity_label = 'vacancy_phenoplasticity', &
|
|
||||||
SOURCE_vacancy_irradiation_label = 'vacancy_irradiation', &
|
|
||||||
SOURCE_vacancy_thermalfluc_label = 'vacancy_thermalfluctuation', &
|
|
||||||
KINEMATICS_thermal_expansion_label = 'thermal_expansion', &
|
KINEMATICS_thermal_expansion_label = 'thermal_expansion', &
|
||||||
KINEMATICS_cleavage_opening_label = 'cleavage_opening', &
|
KINEMATICS_cleavage_opening_label = 'cleavage_opening', &
|
||||||
KINEMATICS_slipplane_opening_label = 'slipplane_opening', &
|
KINEMATICS_slipplane_opening_label = 'slipplane_opening', &
|
||||||
KINEMATICS_vacancy_strain_label = 'vacancy_strain', &
|
|
||||||
KINEMATICS_hydrogen_strain_label = 'hydrogen_strain', &
|
|
||||||
STIFFNESS_DEGRADATION_damage_label = 'damage', &
|
STIFFNESS_DEGRADATION_damage_label = 'damage', &
|
||||||
STIFFNESS_DEGRADATION_porosity_label = 'porosity', &
|
|
||||||
THERMAL_isothermal_label = 'isothermal', &
|
THERMAL_isothermal_label = 'isothermal', &
|
||||||
THERMAL_adiabatic_label = 'adiabatic', &
|
THERMAL_adiabatic_label = 'adiabatic', &
|
||||||
THERMAL_conduction_label = 'conduction', &
|
THERMAL_conduction_label = 'conduction', &
|
||||||
DAMAGE_none_label = 'none', &
|
DAMAGE_none_label = 'none', &
|
||||||
DAMAGE_local_label = 'local', &
|
DAMAGE_local_label = 'local', &
|
||||||
DAMAGE_nonlocal_label = 'nonlocal', &
|
DAMAGE_nonlocal_label = 'nonlocal', &
|
||||||
VACANCYFLUX_isoconc_label = 'isoconcentration', &
|
|
||||||
VACANCYFLUX_isochempot_label = 'isochemicalpotential', &
|
|
||||||
VACANCYFLUX_cahnhilliard_label = 'cahnhilliard', &
|
|
||||||
POROSITY_none_label = 'none', &
|
|
||||||
POROSITY_phasefield_label = 'phasefield', &
|
|
||||||
HYDROGENFLUX_isoconc_label = 'isoconcentration', &
|
|
||||||
HYDROGENFLUX_cahnhilliard_label = 'cahnhilliard', &
|
|
||||||
HOMOGENIZATION_none_label = 'none', &
|
HOMOGENIZATION_none_label = 'none', &
|
||||||
HOMOGENIZATION_isostrain_label = 'isostrain', &
|
HOMOGENIZATION_isostrain_label = 'isostrain', &
|
||||||
HOMOGENIZATION_rgc_label = 'rgc'
|
HOMOGENIZATION_rgc_label = 'rgc'
|
||||||
|
@ -87,25 +74,19 @@ module material
|
||||||
SOURCE_damage_isoBrittle_ID, &
|
SOURCE_damage_isoBrittle_ID, &
|
||||||
SOURCE_damage_isoDuctile_ID, &
|
SOURCE_damage_isoDuctile_ID, &
|
||||||
SOURCE_damage_anisoBrittle_ID, &
|
SOURCE_damage_anisoBrittle_ID, &
|
||||||
SOURCE_damage_anisoDuctile_ID, &
|
SOURCE_damage_anisoDuctile_ID
|
||||||
SOURCE_vacancy_phenoplasticity_ID, &
|
|
||||||
SOURCE_vacancy_irradiation_ID, &
|
|
||||||
SOURCE_vacancy_thermalfluc_ID
|
|
||||||
end enum
|
end enum
|
||||||
|
|
||||||
enum, bind(c)
|
enum, bind(c)
|
||||||
enumerator :: KINEMATICS_undefined_ID, &
|
enumerator :: KINEMATICS_undefined_ID, &
|
||||||
KINEMATICS_cleavage_opening_ID, &
|
KINEMATICS_cleavage_opening_ID, &
|
||||||
KINEMATICS_slipplane_opening_ID, &
|
KINEMATICS_slipplane_opening_ID, &
|
||||||
KINEMATICS_thermal_expansion_ID, &
|
KINEMATICS_thermal_expansion_ID
|
||||||
KINEMATICS_vacancy_strain_ID, &
|
|
||||||
KINEMATICS_hydrogen_strain_ID
|
|
||||||
end enum
|
end enum
|
||||||
|
|
||||||
enum, bind(c)
|
enum, bind(c)
|
||||||
enumerator :: STIFFNESS_DEGRADATION_undefined_ID, &
|
enumerator :: STIFFNESS_DEGRADATION_undefined_ID, &
|
||||||
STIFFNESS_DEGRADATION_damage_ID, &
|
STIFFNESS_DEGRADATION_damage_ID
|
||||||
STIFFNESS_DEGRADATION_porosity_ID
|
|
||||||
end enum
|
end enum
|
||||||
|
|
||||||
enum, bind(c)
|
enum, bind(c)
|
||||||
|
@ -120,21 +101,6 @@ module material
|
||||||
DAMAGE_nonlocal_ID
|
DAMAGE_nonlocal_ID
|
||||||
end enum
|
end enum
|
||||||
|
|
||||||
enum, bind(c)
|
|
||||||
enumerator :: VACANCYFLUX_isoconc_ID, &
|
|
||||||
VACANCYFLUX_isochempot_ID, &
|
|
||||||
VACANCYFLUX_cahnhilliard_ID
|
|
||||||
end enum
|
|
||||||
|
|
||||||
enum, bind(c)
|
|
||||||
enumerator :: POROSITY_none_ID, &
|
|
||||||
POROSITY_phasefield_ID
|
|
||||||
end enum
|
|
||||||
enum, bind(c)
|
|
||||||
enumerator :: HYDROGENFLUX_isoconc_ID, &
|
|
||||||
HYDROGENFLUX_cahnhilliard_ID
|
|
||||||
end enum
|
|
||||||
|
|
||||||
enum, bind(c)
|
enum, bind(c)
|
||||||
enumerator :: HOMOGENIZATION_undefined_ID, &
|
enumerator :: HOMOGENIZATION_undefined_ID, &
|
||||||
HOMOGENIZATION_none_ID, &
|
HOMOGENIZATION_none_ID, &
|
||||||
|
@ -150,12 +116,6 @@ module material
|
||||||
thermal_type !< thermal transport model
|
thermal_type !< thermal transport model
|
||||||
integer(kind(DAMAGE_none_ID)), dimension(:), allocatable, public, protected :: &
|
integer(kind(DAMAGE_none_ID)), dimension(:), allocatable, public, protected :: &
|
||||||
damage_type !< nonlocal damage model
|
damage_type !< nonlocal damage model
|
||||||
integer(kind(VACANCYFLUX_isoconc_ID)), dimension(:), allocatable, public, protected :: &
|
|
||||||
vacancyflux_type !< vacancy transport model
|
|
||||||
integer(kind(POROSITY_none_ID)), dimension(:), allocatable, public, protected :: &
|
|
||||||
porosity_type !< porosity evolution model
|
|
||||||
integer(kind(HYDROGENFLUX_isoconc_ID)), dimension(:), allocatable, public, protected :: &
|
|
||||||
hydrogenflux_type !< hydrogen transport model
|
|
||||||
|
|
||||||
integer(kind(SOURCE_undefined_ID)), dimension(:,:), allocatable, public, protected :: &
|
integer(kind(SOURCE_undefined_ID)), dimension(:,:), allocatable, public, protected :: &
|
||||||
phase_source, & !< active sources mechanisms of each phase
|
phase_source, & !< active sources mechanisms of each phase
|
||||||
|
@ -181,17 +141,11 @@ module material
|
||||||
homogenization_typeInstance, & !< instance of particular type of each homogenization
|
homogenization_typeInstance, & !< instance of particular type of each homogenization
|
||||||
thermal_typeInstance, & !< instance of particular type of each thermal transport
|
thermal_typeInstance, & !< instance of particular type of each thermal transport
|
||||||
damage_typeInstance, & !< instance of particular type of each nonlocal damage
|
damage_typeInstance, & !< instance of particular type of each nonlocal damage
|
||||||
vacancyflux_typeInstance, & !< instance of particular type of each vacancy flux
|
|
||||||
porosity_typeInstance, & !< instance of particular type of each porosity model
|
|
||||||
hydrogenflux_typeInstance, & !< instance of particular type of each hydrogen flux
|
|
||||||
microstructure_crystallite !< crystallite setting ID of each microstructure ! DEPRECATED !!!!
|
microstructure_crystallite !< crystallite setting ID of each microstructure ! DEPRECATED !!!!
|
||||||
|
|
||||||
real(pReal), dimension(:), allocatable, public, protected :: &
|
real(pReal), dimension(:), allocatable, public, protected :: &
|
||||||
thermal_initialT, & !< initial temperature per each homogenization
|
thermal_initialT, & !< initial temperature per each homogenization
|
||||||
damage_initialPhi, & !< initial damage per each homogenization
|
damage_initialPhi !< initial damage per each homogenization
|
||||||
vacancyflux_initialCv, & !< initial vacancy concentration per each homogenization
|
|
||||||
porosity_initialPhi, & !< initial posority per each homogenization
|
|
||||||
hydrogenflux_initialCh !< initial hydrogen concentration per each homogenization
|
|
||||||
|
|
||||||
! NEW MAPPINGS
|
! NEW MAPPINGS
|
||||||
integer(pInt), dimension(:), allocatable, public, protected :: &
|
integer(pInt), dimension(:), allocatable, public, protected :: &
|
||||||
|
@ -221,10 +175,7 @@ module material
|
||||||
type(tState), allocatable, dimension(:), public :: &
|
type(tState), allocatable, dimension(:), public :: &
|
||||||
homogState, &
|
homogState, &
|
||||||
thermalState, &
|
thermalState, &
|
||||||
damageState, &
|
damageState
|
||||||
vacancyfluxState, &
|
|
||||||
porosityState, &
|
|
||||||
hydrogenfluxState
|
|
||||||
|
|
||||||
integer(pInt), dimension(:,:,:), allocatable, public, protected :: &
|
integer(pInt), dimension(:,:,:), allocatable, public, protected :: &
|
||||||
material_texture !< texture (index) of each grain,IP,element
|
material_texture !< texture (index) of each grain,IP,element
|
||||||
|
@ -274,20 +225,12 @@ module material
|
||||||
|
|
||||||
type(tHomogMapping), allocatable, dimension(:), public :: &
|
type(tHomogMapping), allocatable, dimension(:), public :: &
|
||||||
thermalMapping, & !< mapping for thermal state/fields
|
thermalMapping, & !< mapping for thermal state/fields
|
||||||
damageMapping, & !< mapping for damage state/fields
|
damageMapping !< mapping for damage state/fields
|
||||||
vacancyfluxMapping, & !< mapping for vacancy conc state/fields
|
|
||||||
porosityMapping, & !< mapping for porosity state/fields
|
|
||||||
hydrogenfluxMapping !< mapping for hydrogen conc state/fields
|
|
||||||
|
|
||||||
type(group_float), allocatable, dimension(:), public :: &
|
type(group_float), allocatable, dimension(:), public :: &
|
||||||
temperature, & !< temperature field
|
temperature, & !< temperature field
|
||||||
damage, & !< damage field
|
damage, & !< damage field
|
||||||
vacancyConc, & !< vacancy conc field
|
temperatureRate !< temperature change rate field
|
||||||
porosity, & !< porosity field
|
|
||||||
hydrogenConc, & !< hydrogen conc field
|
|
||||||
temperatureRate, & !< temperature change rate field
|
|
||||||
vacancyConcRate, & !< vacancy conc change field
|
|
||||||
hydrogenConcRate !< hydrogen conc change field
|
|
||||||
|
|
||||||
public :: &
|
public :: &
|
||||||
material_init, &
|
material_init, &
|
||||||
|
@ -306,29 +249,16 @@ module material
|
||||||
SOURCE_damage_isoDuctile_ID, &
|
SOURCE_damage_isoDuctile_ID, &
|
||||||
SOURCE_damage_anisoBrittle_ID, &
|
SOURCE_damage_anisoBrittle_ID, &
|
||||||
SOURCE_damage_anisoDuctile_ID, &
|
SOURCE_damage_anisoDuctile_ID, &
|
||||||
SOURCE_vacancy_phenoplasticity_ID, &
|
|
||||||
SOURCE_vacancy_irradiation_ID, &
|
|
||||||
SOURCE_vacancy_thermalfluc_ID, &
|
|
||||||
KINEMATICS_cleavage_opening_ID, &
|
KINEMATICS_cleavage_opening_ID, &
|
||||||
KINEMATICS_slipplane_opening_ID, &
|
KINEMATICS_slipplane_opening_ID, &
|
||||||
KINEMATICS_thermal_expansion_ID, &
|
KINEMATICS_thermal_expansion_ID, &
|
||||||
KINEMATICS_vacancy_strain_ID, &
|
|
||||||
KINEMATICS_hydrogen_strain_ID, &
|
|
||||||
STIFFNESS_DEGRADATION_damage_ID, &
|
STIFFNESS_DEGRADATION_damage_ID, &
|
||||||
STIFFNESS_DEGRADATION_porosity_ID, &
|
|
||||||
THERMAL_isothermal_ID, &
|
THERMAL_isothermal_ID, &
|
||||||
THERMAL_adiabatic_ID, &
|
THERMAL_adiabatic_ID, &
|
||||||
THERMAL_conduction_ID, &
|
THERMAL_conduction_ID, &
|
||||||
DAMAGE_none_ID, &
|
DAMAGE_none_ID, &
|
||||||
DAMAGE_local_ID, &
|
DAMAGE_local_ID, &
|
||||||
DAMAGE_nonlocal_ID, &
|
DAMAGE_nonlocal_ID, &
|
||||||
VACANCYFLUX_isoconc_ID, &
|
|
||||||
VACANCYFLUX_isochempot_ID, &
|
|
||||||
VACANCYFLUX_cahnhilliard_ID, &
|
|
||||||
POROSITY_none_ID, &
|
|
||||||
POROSITY_phasefield_ID, &
|
|
||||||
HYDROGENFLUX_isoconc_ID, &
|
|
||||||
HYDROGENFLUX_cahnhilliard_ID, &
|
|
||||||
HOMOGENIZATION_none_ID, &
|
HOMOGENIZATION_none_ID, &
|
||||||
HOMOGENIZATION_isostrain_ID, &
|
HOMOGENIZATION_isostrain_ID, &
|
||||||
HOMOGENIZATION_RGC_ID
|
HOMOGENIZATION_RGC_ID
|
||||||
|
@ -420,25 +350,14 @@ subroutine material_init()
|
||||||
allocate(homogState (size(config_homogenization)))
|
allocate(homogState (size(config_homogenization)))
|
||||||
allocate(thermalState (size(config_homogenization)))
|
allocate(thermalState (size(config_homogenization)))
|
||||||
allocate(damageState (size(config_homogenization)))
|
allocate(damageState (size(config_homogenization)))
|
||||||
allocate(vacancyfluxState (size(config_homogenization)))
|
|
||||||
allocate(porosityState (size(config_homogenization)))
|
|
||||||
allocate(hydrogenfluxState (size(config_homogenization)))
|
|
||||||
|
|
||||||
allocate(thermalMapping (size(config_homogenization)))
|
allocate(thermalMapping (size(config_homogenization)))
|
||||||
allocate(damageMapping (size(config_homogenization)))
|
allocate(damageMapping (size(config_homogenization)))
|
||||||
allocate(vacancyfluxMapping (size(config_homogenization)))
|
|
||||||
allocate(porosityMapping (size(config_homogenization)))
|
|
||||||
allocate(hydrogenfluxMapping(size(config_homogenization)))
|
|
||||||
|
|
||||||
allocate(temperature (size(config_homogenization)))
|
allocate(temperature (size(config_homogenization)))
|
||||||
allocate(damage (size(config_homogenization)))
|
allocate(damage (size(config_homogenization)))
|
||||||
allocate(vacancyConc (size(config_homogenization)))
|
|
||||||
allocate(porosity (size(config_homogenization)))
|
|
||||||
allocate(hydrogenConc (size(config_homogenization)))
|
|
||||||
|
|
||||||
allocate(temperatureRate (size(config_homogenization)))
|
allocate(temperatureRate (size(config_homogenization)))
|
||||||
allocate(vacancyConcRate (size(config_homogenization)))
|
|
||||||
allocate(hydrogenConcRate (size(config_homogenization)))
|
|
||||||
|
|
||||||
do m = 1_pInt,size(config_microstructure)
|
do m = 1_pInt,size(config_microstructure)
|
||||||
if(microstructure_crystallite(m) < 1_pInt .or. &
|
if(microstructure_crystallite(m) < 1_pInt .or. &
|
||||||
|
@ -511,17 +430,9 @@ subroutine material_init()
|
||||||
do myHomog = 1,size(config_homogenization)
|
do myHomog = 1,size(config_homogenization)
|
||||||
thermalMapping (myHomog)%p => mappingHomogenizationConst
|
thermalMapping (myHomog)%p => mappingHomogenizationConst
|
||||||
damageMapping (myHomog)%p => mappingHomogenizationConst
|
damageMapping (myHomog)%p => mappingHomogenizationConst
|
||||||
vacancyfluxMapping (myHomog)%p => mappingHomogenizationConst
|
|
||||||
porosityMapping (myHomog)%p => mappingHomogenizationConst
|
|
||||||
hydrogenfluxMapping(myHomog)%p => mappingHomogenizationConst
|
|
||||||
allocate(temperature (myHomog)%p(1), source=thermal_initialT(myHomog))
|
allocate(temperature (myHomog)%p(1), source=thermal_initialT(myHomog))
|
||||||
allocate(damage (myHomog)%p(1), source=damage_initialPhi(myHomog))
|
allocate(damage (myHomog)%p(1), source=damage_initialPhi(myHomog))
|
||||||
allocate(vacancyConc (myHomog)%p(1), source=vacancyflux_initialCv(myHomog))
|
|
||||||
allocate(porosity (myHomog)%p(1), source=porosity_initialPhi(myHomog))
|
|
||||||
allocate(hydrogenConc (myHomog)%p(1), source=hydrogenflux_initialCh(myHomog))
|
|
||||||
allocate(temperatureRate (myHomog)%p(1), source=0.0_pReal)
|
allocate(temperatureRate (myHomog)%p(1), source=0.0_pReal)
|
||||||
allocate(vacancyConcRate (myHomog)%p(1), source=0.0_pReal)
|
|
||||||
allocate(hydrogenConcRate(myHomog)%p(1), source=0.0_pReal)
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
end subroutine material_init
|
end subroutine material_init
|
||||||
|
@ -545,23 +456,14 @@ subroutine material_parseHomogenization
|
||||||
allocate(homogenization_type(size(config_homogenization)), source=HOMOGENIZATION_undefined_ID)
|
allocate(homogenization_type(size(config_homogenization)), source=HOMOGENIZATION_undefined_ID)
|
||||||
allocate(thermal_type(size(config_homogenization)), source=THERMAL_isothermal_ID)
|
allocate(thermal_type(size(config_homogenization)), source=THERMAL_isothermal_ID)
|
||||||
allocate(damage_type (size(config_homogenization)), source=DAMAGE_none_ID)
|
allocate(damage_type (size(config_homogenization)), source=DAMAGE_none_ID)
|
||||||
allocate(vacancyflux_type(size(config_homogenization)), source=VACANCYFLUX_isoconc_ID)
|
|
||||||
allocate(porosity_type (size(config_homogenization)), source=POROSITY_none_ID)
|
|
||||||
allocate(hydrogenflux_type(size(config_homogenization)), source=HYDROGENFLUX_isoconc_ID)
|
|
||||||
allocate(homogenization_typeInstance(size(config_homogenization)), source=0_pInt)
|
allocate(homogenization_typeInstance(size(config_homogenization)), source=0_pInt)
|
||||||
allocate(thermal_typeInstance(size(config_homogenization)), source=0_pInt)
|
allocate(thermal_typeInstance(size(config_homogenization)), source=0_pInt)
|
||||||
allocate(damage_typeInstance(size(config_homogenization)), source=0_pInt)
|
allocate(damage_typeInstance(size(config_homogenization)), source=0_pInt)
|
||||||
allocate(vacancyflux_typeInstance(size(config_homogenization)), source=0_pInt)
|
|
||||||
allocate(porosity_typeInstance(size(config_homogenization)), source=0_pInt)
|
|
||||||
allocate(hydrogenflux_typeInstance(size(config_homogenization)), source=0_pInt)
|
|
||||||
allocate(homogenization_Ngrains(size(config_homogenization)), source=0_pInt)
|
allocate(homogenization_Ngrains(size(config_homogenization)), source=0_pInt)
|
||||||
allocate(homogenization_Noutput(size(config_homogenization)), source=0_pInt)
|
allocate(homogenization_Noutput(size(config_homogenization)), source=0_pInt)
|
||||||
allocate(homogenization_active(size(config_homogenization)), source=.false.) !!!!!!!!!!!!!!!
|
allocate(homogenization_active(size(config_homogenization)), source=.false.) !!!!!!!!!!!!!!!
|
||||||
allocate(thermal_initialT(size(config_homogenization)), source=300.0_pReal)
|
allocate(thermal_initialT(size(config_homogenization)), source=300.0_pReal)
|
||||||
allocate(damage_initialPhi(size(config_homogenization)), source=1.0_pReal)
|
allocate(damage_initialPhi(size(config_homogenization)), source=1.0_pReal)
|
||||||
allocate(vacancyflux_initialCv(size(config_homogenization)), source=0.0_pReal)
|
|
||||||
allocate(porosity_initialPhi(size(config_homogenization)), source=1.0_pReal)
|
|
||||||
allocate(hydrogenflux_initialCh(size(config_homogenization)), source=0.0_pReal)
|
|
||||||
|
|
||||||
forall (h = 1_pInt:size(config_homogenization)) &
|
forall (h = 1_pInt:size(config_homogenization)) &
|
||||||
homogenization_active(h) = any(mesh_homogenizationAt == h)
|
homogenization_active(h) = any(mesh_homogenizationAt == h)
|
||||||
|
@ -620,53 +522,6 @@ subroutine material_parseHomogenization
|
||||||
end select
|
end select
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if (config_homogenization(h)%keyExists('vacancyflux')) then
|
|
||||||
vacancyflux_initialCv(h) = config_homogenization(h)%getFloat('cv0',defaultVal=0.0_pReal)
|
|
||||||
|
|
||||||
tag = config_homogenization(h)%getString('vacancyflux')
|
|
||||||
select case (trim(tag))
|
|
||||||
case(VACANCYFLUX_isoconc_label)
|
|
||||||
vacancyflux_type(h) = VACANCYFLUX_isoconc_ID
|
|
||||||
case(VACANCYFLUX_isochempot_label)
|
|
||||||
vacancyflux_type(h) = VACANCYFLUX_isochempot_ID
|
|
||||||
case(VACANCYFLUX_cahnhilliard_label)
|
|
||||||
vacancyflux_type(h) = VACANCYFLUX_cahnhilliard_ID
|
|
||||||
case default
|
|
||||||
call IO_error(500_pInt,ext_msg=trim(tag))
|
|
||||||
end select
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (config_homogenization(h)%keyExists('porosity')) then
|
|
||||||
!ToDo?
|
|
||||||
|
|
||||||
tag = config_homogenization(h)%getString('porosity')
|
|
||||||
select case (trim(tag))
|
|
||||||
case(POROSITY_NONE_label)
|
|
||||||
porosity_type(h) = POROSITY_none_ID
|
|
||||||
case(POROSITY_phasefield_label)
|
|
||||||
porosity_type(h) = POROSITY_phasefield_ID
|
|
||||||
case default
|
|
||||||
call IO_error(500_pInt,ext_msg=trim(tag))
|
|
||||||
end select
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (config_homogenization(h)%keyExists('hydrogenflux')) then
|
|
||||||
hydrogenflux_initialCh(h) = config_homogenization(h)%getFloat('ch0',defaultVal=0.0_pReal)
|
|
||||||
|
|
||||||
tag = config_homogenization(h)%getString('hydrogenflux')
|
|
||||||
select case (trim(tag))
|
|
||||||
case(HYDROGENFLUX_isoconc_label)
|
|
||||||
hydrogenflux_type(h) = HYDROGENFLUX_isoconc_ID
|
|
||||||
case(HYDROGENFLUX_cahnhilliard_label)
|
|
||||||
hydrogenflux_type(h) = HYDROGENFLUX_cahnhilliard_ID
|
|
||||||
case default
|
|
||||||
call IO_error(500_pInt,ext_msg=trim(tag))
|
|
||||||
end select
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
@ -674,9 +529,6 @@ subroutine material_parseHomogenization
|
||||||
homogenization_typeInstance(h) = count(homogenization_type(1:h) == homogenization_type(h))
|
homogenization_typeInstance(h) = count(homogenization_type(1:h) == homogenization_type(h))
|
||||||
thermal_typeInstance(h) = count(thermal_type (1:h) == thermal_type (h))
|
thermal_typeInstance(h) = count(thermal_type (1:h) == thermal_type (h))
|
||||||
damage_typeInstance(h) = count(damage_type (1:h) == damage_type (h))
|
damage_typeInstance(h) = count(damage_type (1:h) == damage_type (h))
|
||||||
vacancyflux_typeInstance(h) = count(vacancyflux_type (1:h) == vacancyflux_type (h))
|
|
||||||
porosity_typeInstance(h) = count(porosity_type (1:h) == porosity_type (h))
|
|
||||||
hydrogenflux_typeInstance(h) = count(hydrogenflux_type (1:h) == hydrogenflux_type (h))
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
homogenization_maxNgrains = maxval(homogenization_Ngrains,homogenization_active)
|
homogenization_maxNgrains = maxval(homogenization_Ngrains,homogenization_active)
|
||||||
|
@ -866,12 +718,6 @@ subroutine material_parsePhase
|
||||||
phase_source(sourceCtr,p) = SOURCE_damage_anisoBrittle_ID
|
phase_source(sourceCtr,p) = SOURCE_damage_anisoBrittle_ID
|
||||||
case (SOURCE_damage_anisoDuctile_label)
|
case (SOURCE_damage_anisoDuctile_label)
|
||||||
phase_source(sourceCtr,p) = SOURCE_damage_anisoDuctile_ID
|
phase_source(sourceCtr,p) = SOURCE_damage_anisoDuctile_ID
|
||||||
case (SOURCE_vacancy_phenoplasticity_label)
|
|
||||||
phase_source(sourceCtr,p) = SOURCE_vacancy_phenoplasticity_ID
|
|
||||||
case (SOURCE_vacancy_irradiation_label)
|
|
||||||
phase_source(sourceCtr,p) = SOURCE_vacancy_irradiation_ID
|
|
||||||
case (SOURCE_vacancy_thermalfluc_label)
|
|
||||||
phase_source(sourceCtr,p) = SOURCE_vacancy_thermalfluc_ID
|
|
||||||
end select
|
end select
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
@ -890,10 +736,6 @@ subroutine material_parsePhase
|
||||||
phase_kinematics(kinematicsCtr,p) = KINEMATICS_slipplane_opening_ID
|
phase_kinematics(kinematicsCtr,p) = KINEMATICS_slipplane_opening_ID
|
||||||
case (KINEMATICS_thermal_expansion_label)
|
case (KINEMATICS_thermal_expansion_label)
|
||||||
phase_kinematics(kinematicsCtr,p) = KINEMATICS_thermal_expansion_ID
|
phase_kinematics(kinematicsCtr,p) = KINEMATICS_thermal_expansion_ID
|
||||||
case (KINEMATICS_vacancy_strain_label)
|
|
||||||
phase_kinematics(kinematicsCtr,p) = KINEMATICS_vacancy_strain_ID
|
|
||||||
case (KINEMATICS_hydrogen_strain_label)
|
|
||||||
phase_kinematics(kinematicsCtr,p) = KINEMATICS_hydrogen_strain_ID
|
|
||||||
end select
|
end select
|
||||||
enddo
|
enddo
|
||||||
#if defined(__GFORTRAN__)
|
#if defined(__GFORTRAN__)
|
||||||
|
@ -907,8 +749,6 @@ subroutine material_parsePhase
|
||||||
select case (trim(str(stiffDegradationCtr)))
|
select case (trim(str(stiffDegradationCtr)))
|
||||||
case (STIFFNESS_DEGRADATION_damage_label)
|
case (STIFFNESS_DEGRADATION_damage_label)
|
||||||
phase_stiffnessDegradation(stiffDegradationCtr,p) = STIFFNESS_DEGRADATION_damage_ID
|
phase_stiffnessDegradation(stiffDegradationCtr,p) = STIFFNESS_DEGRADATION_damage_ID
|
||||||
case (STIFFNESS_DEGRADATION_porosity_label)
|
|
||||||
phase_stiffnessDegradation(stiffDegradationCtr,p) = STIFFNESS_DEGRADATION_porosity_ID
|
|
||||||
end select
|
end select
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
|
|
|
@ -2617,7 +2617,7 @@ end function math_rotate_forward3333
|
||||||
!> @brief limits a scalar value to a certain range (either one or two sided)
|
!> @brief limits a scalar value to a certain range (either one or two sided)
|
||||||
! Will return NaN if left > right
|
! Will return NaN if left > right
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
real(pReal) pure function math_clip(a, left, right)
|
real(pReal) pure elemental function math_clip(a, left, right)
|
||||||
use, intrinsic :: &
|
use, intrinsic :: &
|
||||||
IEEE_arithmetic
|
IEEE_arithmetic
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,66 +1,68 @@
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
|
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
|
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
!> @brief material subroutine for isotropic (ISOTROPIC) plasticity
|
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
!> @details Isotropic (ISOTROPIC) Plasticity which resembles the phenopowerlaw plasticity without
|
!> @brief material subroutine for isotropic plasticity
|
||||||
|
!> @details Isotropic Plasticity which resembles the phenopowerlaw plasticity without
|
||||||
!! resolving the stress on the slip systems. Will give the response of phenopowerlaw for an
|
!! resolving the stress on the slip systems. Will give the response of phenopowerlaw for an
|
||||||
!! untextured polycrystal
|
!! untextured polycrystal
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
module plastic_isotropic
|
module plastic_isotropic
|
||||||
use prec, only: &
|
use prec, only: &
|
||||||
pReal,&
|
pReal, &
|
||||||
pInt
|
pInt
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
private
|
private
|
||||||
integer(pInt), dimension(:,:), allocatable, target, public :: &
|
integer(pInt), dimension(:,:), allocatable, target, public :: &
|
||||||
plastic_isotropic_sizePostResult !< size of each post result output
|
plastic_isotropic_sizePostResult !< size of each post result output
|
||||||
character(len=64), dimension(:,:), allocatable, target, public :: &
|
character(len=64), dimension(:,:), allocatable, target, public :: &
|
||||||
plastic_isotropic_output !< name of each post result output
|
plastic_isotropic_output !< name of each post result output
|
||||||
integer(pInt), dimension(:), allocatable, target, public :: &
|
|
||||||
plastic_isotropic_Noutput !< number of outputs per instance
|
enum, bind(c)
|
||||||
|
enumerator :: &
|
||||||
enum, bind(c)
|
undefined_ID, &
|
||||||
enumerator :: undefined_ID, &
|
flowstress_ID, &
|
||||||
flowstress_ID, &
|
strainrate_ID
|
||||||
strainrate_ID
|
|
||||||
end enum
|
end enum
|
||||||
|
|
||||||
type, private :: tParameters !< container type for internal constitutive parameters
|
type, private :: tParameters
|
||||||
integer(kind(undefined_ID)), allocatable, dimension(:) :: &
|
real(pReal) :: &
|
||||||
outputID
|
fTaylor, & !< Taylor factor
|
||||||
real(pReal) :: &
|
tau0, & !< initial critical stress
|
||||||
fTaylor, &
|
gdot0, & !< reference strain rate
|
||||||
tau0, &
|
n, & !< stress exponent
|
||||||
gdot0, &
|
|
||||||
n, &
|
|
||||||
h0, &
|
h0, &
|
||||||
h0_slopeLnRate, &
|
h0_slopeLnRate, &
|
||||||
tausat, &
|
tausat, & !< maximum critical stress
|
||||||
a, &
|
a, &
|
||||||
aTolFlowstress, &
|
|
||||||
aTolShear, &
|
|
||||||
tausat_SinhFitA, &
|
tausat_SinhFitA, &
|
||||||
tausat_SinhFitB, &
|
tausat_SinhFitB, &
|
||||||
tausat_SinhFitC, &
|
tausat_SinhFitC, &
|
||||||
tausat_SinhFitD
|
tausat_SinhFitD, &
|
||||||
logical :: &
|
aTolFlowstress, &
|
||||||
|
aTolShear
|
||||||
|
integer(pInt) :: &
|
||||||
|
of_debug = 0_pInt
|
||||||
|
integer(kind(undefined_ID)), allocatable, dimension(:) :: &
|
||||||
|
outputID
|
||||||
|
logical :: &
|
||||||
dilatation
|
dilatation
|
||||||
end type
|
end type
|
||||||
|
|
||||||
type(tParameters), dimension(:), allocatable, target, private :: param !< containers of constitutive parameters (len Ninstance)
|
type(tParameters), dimension(:), allocatable, private :: param !< containers of constitutive parameters (len Ninstance)
|
||||||
|
|
||||||
type, private :: tIsotropicState !< internal state aliases
|
type, private :: tIsotropicState
|
||||||
real(pReal), pointer, dimension(:) :: & ! scalars along NipcMyInstance
|
real(pReal), pointer, dimension(:) :: &
|
||||||
flowstress, &
|
flowstress, &
|
||||||
accumulatedShear
|
accumulatedShear
|
||||||
end type
|
end type
|
||||||
|
|
||||||
type(tIsotropicState), allocatable, dimension(:), private :: & !< state aliases per instance
|
type(tIsotropicState), allocatable, dimension(:), private :: &
|
||||||
state, &
|
dotState, &
|
||||||
dotState
|
state
|
||||||
|
|
||||||
public :: &
|
public :: &
|
||||||
plastic_isotropic_init, &
|
plastic_isotropic_init, &
|
||||||
plastic_isotropic_LpAndItsTangent, &
|
plastic_isotropic_LpAndItsTangent, &
|
||||||
plastic_isotropic_LiAndItsTangent, &
|
plastic_isotropic_LiAndItsTangent, &
|
||||||
|
@ -69,7 +71,6 @@ module plastic_isotropic
|
||||||
|
|
||||||
contains
|
contains
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief module initialization
|
!> @brief module initialization
|
||||||
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
||||||
|
@ -80,20 +81,29 @@ subroutine plastic_isotropic_init()
|
||||||
compiler_version, &
|
compiler_version, &
|
||||||
compiler_options
|
compiler_options
|
||||||
#endif
|
#endif
|
||||||
use IO
|
use prec, only: &
|
||||||
|
pStringLen
|
||||||
use debug, only: &
|
use debug, only: &
|
||||||
|
#ifdef DEBUG
|
||||||
|
debug_e, &
|
||||||
|
debug_i, &
|
||||||
|
debug_g, &
|
||||||
|
debug_levelExtensive, &
|
||||||
|
#endif
|
||||||
debug_level, &
|
debug_level, &
|
||||||
debug_constitutive, &
|
debug_constitutive, &
|
||||||
debug_levelBasic
|
debug_levelBasic
|
||||||
use numerics, only: &
|
use IO, only: &
|
||||||
numerics_integrator
|
IO_error, &
|
||||||
use math, only: &
|
IO_timeStamp
|
||||||
math_Mandel3333to66, &
|
|
||||||
math_Voigt66to3333
|
|
||||||
use material, only: &
|
use material, only: &
|
||||||
|
#ifdef DEBUG
|
||||||
|
phasememberAt, &
|
||||||
|
#endif
|
||||||
phase_plasticity, &
|
phase_plasticity, &
|
||||||
phase_plasticityInstance, &
|
phase_plasticityInstance, &
|
||||||
phase_Noutput, &
|
phase_Noutput, &
|
||||||
|
material_allocatePlasticState, &
|
||||||
PLASTICITY_ISOTROPIC_label, &
|
PLASTICITY_ISOTROPIC_label, &
|
||||||
PLASTICITY_ISOTROPIC_ID, &
|
PLASTICITY_ISOTROPIC_ID, &
|
||||||
material_phase, &
|
material_phase, &
|
||||||
|
@ -101,148 +111,142 @@ use IO
|
||||||
use config, only: &
|
use config, only: &
|
||||||
MATERIAL_partPhase, &
|
MATERIAL_partPhase, &
|
||||||
config_phase
|
config_phase
|
||||||
|
use lattice
|
||||||
use lattice
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
type(tParameters), pointer :: prm
|
|
||||||
|
|
||||||
integer(pInt) :: &
|
integer(pInt) :: &
|
||||||
phase, &
|
Ninstance, &
|
||||||
instance, &
|
p, i, &
|
||||||
maxNinstance, &
|
NipcMyPhase, &
|
||||||
sizeDotState, &
|
sizeState, sizeDotState
|
||||||
sizeState, &
|
|
||||||
sizeDeltaState
|
character(len=65536), dimension(0), parameter :: emptyStringArray = [character(len=65536)::]
|
||||||
character(len=65536) :: &
|
|
||||||
extmsg = ''
|
|
||||||
integer(pInt) :: NipcMyPhase,i
|
|
||||||
character(len=65536), dimension(:), allocatable :: outputs
|
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_ISOTROPIC_label//' init -+>>>'
|
integer(kind(undefined_ID)) :: &
|
||||||
|
outputID
|
||||||
|
|
||||||
|
character(len=pStringLen) :: &
|
||||||
|
extmsg = ''
|
||||||
|
character(len=65536), dimension(:), allocatable :: &
|
||||||
|
outputs
|
||||||
|
|
||||||
|
write(6,'(/,a)') ' <<<+- plastic_'//PLASTICITY_ISOTROPIC_label//' init -+>>>'
|
||||||
|
write(6,'(/,a)') ' Maiti and Eisenlohr, Scripta Materialia, 145:37-40, 2018'
|
||||||
|
write(6,'(/,a)') ' https://doi.org/10.1016/j.scriptamat.2017.09.047'
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
||||||
#include "compilation_info.f90"
|
#include "compilation_info.f90"
|
||||||
|
|
||||||
maxNinstance = int(count(phase_plasticity == PLASTICITY_ISOTROPIC_ID),pInt)
|
Ninstance = int(count(phase_plasticity == PLASTICITY_ISOTROPIC_ID),pInt)
|
||||||
if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) &
|
if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) &
|
||||||
write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance
|
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance
|
||||||
|
|
||||||
! public variables
|
allocate(plastic_isotropic_sizePostResult(maxval(phase_Noutput), Ninstance),source=0_pInt)
|
||||||
allocate(plastic_isotropic_sizePostResult(maxval(phase_Noutput), maxNinstance),source=0_pInt)
|
allocate(plastic_isotropic_output(maxval(phase_Noutput), Ninstance))
|
||||||
allocate(plastic_isotropic_output(maxval(phase_Noutput), maxNinstance))
|
|
||||||
plastic_isotropic_output = ''
|
plastic_isotropic_output = ''
|
||||||
allocate(plastic_isotropic_Noutput(maxNinstance), source=0_pInt)
|
|
||||||
|
|
||||||
allocate(param(maxNinstance)) ! one container of parameters per instance
|
allocate(param(Ninstance))
|
||||||
allocate(state(maxNinstance)) ! internal state aliases
|
allocate(state(Ninstance))
|
||||||
allocate(dotState(maxNinstance))
|
allocate(dotState(Ninstance))
|
||||||
|
|
||||||
do phase = 1_pInt, size(phase_plasticityInstance)
|
do p = 1_pInt, size(phase_plasticity)
|
||||||
if (phase_plasticity(phase) == PLASTICITY_ISOTROPIC_ID) then
|
if (phase_plasticity(p) /= PLASTICITY_ISOTROPIC_ID) cycle
|
||||||
instance = phase_plasticityInstance(phase)
|
associate(prm => param(phase_plasticityInstance(p)), &
|
||||||
prm => param(instance) ! shorthand pointer to parameter object of my constitutive law
|
dot => dotState(phase_plasticityInstance(p)), &
|
||||||
prm%tau0 = config_phase(phase)%getFloat('tau0')
|
stt => state(phase_plasticityInstance(p)), &
|
||||||
prm%tausat = config_phase(phase)%getFloat('tausat')
|
config => config_phase(p))
|
||||||
prm%gdot0 = config_phase(phase)%getFloat('gdot0')
|
|
||||||
prm%n = config_phase(phase)%getFloat('n')
|
#ifdef DEBUG
|
||||||
prm%h0 = config_phase(phase)%getFloat('h0')
|
if (p==material_phase(debug_g,debug_i,debug_e)) then
|
||||||
prm%fTaylor = config_phase(phase)%getFloat('m')
|
prm%of_debug = phasememberAt(debug_g,debug_i,debug_e)
|
||||||
prm%h0_slopeLnRate = config_phase(phase)%getFloat('h0_slopelnrate', defaultVal=0.0_pReal)
|
endif
|
||||||
prm%tausat_SinhFitA = config_phase(phase)%getFloat('tausat_sinhfita',defaultVal=0.0_pReal)
|
|
||||||
prm%tausat_SinhFitB = config_phase(phase)%getFloat('tausat_sinhfitb',defaultVal=0.0_pReal)
|
|
||||||
prm%tausat_SinhFitC = config_phase(phase)%getFloat('tausat_sinhfitc',defaultVal=0.0_pReal)
|
|
||||||
prm%tausat_SinhFitD = config_phase(phase)%getFloat('tausat_sinhfitd',defaultVal=0.0_pReal)
|
|
||||||
prm%a = config_phase(phase)%getFloat('a')
|
|
||||||
prm%aTolFlowStress = config_phase(phase)%getFloat('atol_flowstress',defaultVal=1.0_pReal)
|
|
||||||
prm%aTolShear = config_phase(phase)%getFloat('atol_shear',defaultVal=1.0e-6_pReal)
|
|
||||||
|
|
||||||
prm%dilatation = config_phase(phase)%keyExists('/dilatation/')
|
|
||||||
|
|
||||||
#if defined(__GFORTRAN__)
|
|
||||||
outputs = ['GfortranBug86277']
|
|
||||||
outputs = config_phase(phase)%getStrings('(output)',defaultVal=outputs)
|
|
||||||
if (outputs(1) == 'GfortranBug86277') outputs = [character(len=65536)::]
|
|
||||||
#else
|
|
||||||
outputs = config_phase(phase)%getStrings('(output)',defaultVal=[character(len=65536)::])
|
|
||||||
#endif
|
#endif
|
||||||
allocate(prm%outputID(0))
|
|
||||||
do i=1_pInt, size(outputs)
|
prm%tau0 = config%getFloat('tau0')
|
||||||
select case(outputs(i))
|
prm%tausat = config%getFloat('tausat')
|
||||||
case ('flowstress')
|
prm%gdot0 = config%getFloat('gdot0')
|
||||||
plastic_isotropic_Noutput(instance) = plastic_isotropic_Noutput(instance) + 1_pInt
|
prm%n = config%getFloat('n')
|
||||||
plastic_isotropic_output(plastic_isotropic_Noutput(instance),instance) = outputs(i)
|
prm%h0 = config%getFloat('h0')
|
||||||
plasticState(phase)%sizePostResults = plasticState(phase)%sizePostResults + 1_pInt
|
prm%fTaylor = config%getFloat('m')
|
||||||
plastic_isotropic_sizePostResult(i,instance) = 1_pInt
|
prm%h0_slopeLnRate = config%getFloat('h0_slopelnrate', defaultVal=0.0_pReal)
|
||||||
prm%outputID = [prm%outputID,flowstress_ID]
|
prm%tausat_SinhFitA = config%getFloat('tausat_sinhfita',defaultVal=0.0_pReal)
|
||||||
case ('strainrate')
|
prm%tausat_SinhFitB = config%getFloat('tausat_sinhfitb',defaultVal=0.0_pReal)
|
||||||
plastic_isotropic_Noutput(instance) = plastic_isotropic_Noutput(instance) + 1_pInt
|
prm%tausat_SinhFitC = config%getFloat('tausat_sinhfitc',defaultVal=0.0_pReal)
|
||||||
plastic_isotropic_output(plastic_isotropic_Noutput(instance),instance) = outputs(i)
|
prm%tausat_SinhFitD = config%getFloat('tausat_sinhfitd',defaultVal=0.0_pReal)
|
||||||
plasticState(phase)%sizePostResults = &
|
prm%a = config%getFloat('a')
|
||||||
plasticState(phase)%sizePostResults + 1_pInt
|
prm%aTolFlowStress = config%getFloat('atol_flowstress',defaultVal=1.0_pReal)
|
||||||
plastic_isotropic_sizePostResult(i,instance) = 1_pInt
|
prm%aTolShear = config%getFloat('atol_shear', defaultVal=1.0e-6_pReal)
|
||||||
prm%outputID = [prm%outputID,strainrate_ID]
|
|
||||||
end select
|
prm%dilatation = config%keyExists('/dilatation/')
|
||||||
enddo
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! sanity checks
|
! sanity checks
|
||||||
extmsg = ''
|
extmsg = ''
|
||||||
if (prm%aTolShear <= 0.0_pReal) extmsg = trim(extmsg)//"'aTolShear' "
|
if (prm%aTolShear <= 0.0_pReal) extmsg = trim(extmsg)//'aTolShear '
|
||||||
if (prm%tau0 < 0.0_pReal) extmsg = trim(extmsg)//"'tau0' "
|
if (prm%tau0 < 0.0_pReal) extmsg = trim(extmsg)//'tau0 '
|
||||||
if (prm%gdot0 <= 0.0_pReal) extmsg = trim(extmsg)//"'gdot0' "
|
if (prm%gdot0 <= 0.0_pReal) extmsg = trim(extmsg)//'gdot0 '
|
||||||
if (prm%n <= 0.0_pReal) extmsg = trim(extmsg)//"'n' "
|
if (prm%n <= 0.0_pReal) extmsg = trim(extmsg)//'n '
|
||||||
if (prm%tausat <= prm%tau0) extmsg = trim(extmsg)//"'tausat' "
|
if (prm%tausat <= prm%tau0) extmsg = trim(extmsg)//'tausat '
|
||||||
if (prm%a <= 0.0_pReal) extmsg = trim(extmsg)//"'a' "
|
if (prm%a <= 0.0_pReal) extmsg = trim(extmsg)//'a '
|
||||||
if (prm%fTaylor <= 0.0_pReal) extmsg = trim(extmsg)//"'m' "
|
if (prm%fTaylor <= 0.0_pReal) extmsg = trim(extmsg)//'m '
|
||||||
if (prm%aTolFlowstress <= 0.0_pReal) extmsg = trim(extmsg)//"'atol_flowstress' "
|
if (prm%aTolFlowstress <= 0.0_pReal) extmsg = trim(extmsg)//'atol_flowstress '
|
||||||
if (extmsg /= '') call IO_error(211_pInt,ip=instance,&
|
if (prm%aTolShear <= 0.0_pReal) extmsg = trim(extmsg)//'atol_shear '
|
||||||
ext_msg=trim(extmsg)//'('//PLASTICITY_ISOTROPIC_label//')')
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
! exit if any parameter is out of range
|
||||||
|
if (extmsg /= '') &
|
||||||
|
call IO_error(211_pInt,ext_msg=trim(extmsg)//'('//PLASTICITY_ISOTROPIC_label//')')
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
! output pararameters
|
||||||
|
outputs = config%getStrings('(output)',defaultVal=emptyStringArray)
|
||||||
|
allocate(prm%outputID(0))
|
||||||
|
do i=1_pInt, size(outputs)
|
||||||
|
outputID = undefined_ID
|
||||||
|
select case(outputs(i))
|
||||||
|
|
||||||
|
case ('flowstress')
|
||||||
|
outputID = flowstress_ID
|
||||||
|
case ('strainrate')
|
||||||
|
outputID = strainrate_ID
|
||||||
|
|
||||||
|
end select
|
||||||
|
|
||||||
|
if (outputID /= undefined_ID) then
|
||||||
|
plastic_isotropic_output(i,phase_plasticityInstance(p)) = outputs(i)
|
||||||
|
plastic_isotropic_sizePostResult(i,phase_plasticityInstance(p)) = 1_pInt
|
||||||
|
prm%outputID = [prm%outputID, outputID]
|
||||||
|
endif
|
||||||
|
|
||||||
|
enddo
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! allocate state arrays
|
! allocate state arrays
|
||||||
NipcMyPhase = count(material_phase == phase) ! number of own material points (including point components ipc)
|
NipcMyPhase = count(material_phase == p)
|
||||||
|
sizeDotState = size(['flowstress ','accumulated_shear'])
|
||||||
|
sizeState = sizeDotState
|
||||||
|
|
||||||
sizeDotState = size(["flowstress ","accumulated_shear"])
|
call material_allocatePlasticState(p,NipcMyPhase,sizeState,sizeDotState,0_pInt, &
|
||||||
sizeDeltaState = 0_pInt ! no sudden jumps in state
|
1_pInt,0_pInt,0_pInt)
|
||||||
sizeState = sizeDotState + sizeDeltaState
|
plasticState(p)%sizePostResults = sum(plastic_isotropic_sizePostResult(:,phase_plasticityInstance(p)))
|
||||||
plasticState(phase)%sizeState = sizeState
|
|
||||||
plasticState(phase)%sizeDotState = sizeDotState
|
|
||||||
plasticState(phase)%sizeDeltaState = sizeDeltaState
|
|
||||||
plasticState(phase)%nSlip = 1
|
|
||||||
allocate(plasticState(phase)%aTolState ( sizeState))
|
|
||||||
allocate(plasticState(phase)%state0 ( sizeState,NipcMyPhase),source=0.0_pReal)
|
|
||||||
allocate(plasticState(phase)%partionedState0 ( sizeState,NipcMyPhase),source=0.0_pReal)
|
|
||||||
allocate(plasticState(phase)%subState0 ( sizeState,NipcMyPhase),source=0.0_pReal)
|
|
||||||
allocate(plasticState(phase)%state ( sizeState,NipcMyPhase),source=0.0_pReal)
|
|
||||||
allocate(plasticState(phase)%dotState (sizeDotState,NipcMyPhase),source=0.0_pReal)
|
|
||||||
allocate(plasticState(phase)%deltaState (sizeDeltaState,NipcMyPhase),source=0.0_pReal)
|
|
||||||
if (any(numerics_integrator == 1_pInt)) then
|
|
||||||
allocate(plasticState(phase)%previousDotState (sizeDotState,NipcMyPhase),source=0.0_pReal)
|
|
||||||
allocate(plasticState(phase)%previousDotState2(sizeDotState,NipcMyPhase),source=0.0_pReal)
|
|
||||||
endif
|
|
||||||
if (any(numerics_integrator == 4_pInt)) &
|
|
||||||
allocate(plasticState(phase)%RK4dotState (sizeDotState,NipcMyPhase),source=0.0_pReal)
|
|
||||||
if (any(numerics_integrator == 5_pInt)) &
|
|
||||||
allocate(plasticState(phase)%RKCK45dotState (6,sizeDotState,NipcMyPhase),source=0.0_pReal)
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! locally defined state aliases and initialization of state0 and aTolState
|
! locally defined state aliases and initialization of state0 and aTolState
|
||||||
|
stt%flowstress => plasticState(p)%state (1,1:NipcMyPhase)
|
||||||
|
stt%flowstress = prm%tau0
|
||||||
|
dot%flowstress => plasticState(p)%dotState (1,1:NipcMyPhase)
|
||||||
|
plasticState(p)%aTolState(1) = prm%aTolFlowstress
|
||||||
|
|
||||||
state(instance)%flowstress => plasticState(phase)%state (1,1:NipcMyPhase)
|
stt%accumulatedShear => plasticState(p)%state (2,1:NipcMyPhase)
|
||||||
dotState(instance)%flowstress => plasticState(phase)%dotState (1,1:NipcMyPhase)
|
dot%accumulatedShear => plasticState(p)%dotState (2,1:NipcMyPhase)
|
||||||
plasticState(phase)%state0(1,1:NipcMyPhase) = prm%tau0
|
plasticState(p)%aTolState(2) = prm%aTolShear
|
||||||
plasticState(phase)%aTolState(1) = prm%aTolFlowstress
|
! global alias
|
||||||
|
plasticState(p)%slipRate => plasticState(p)%dotState(2:2,1:NipcMyPhase)
|
||||||
|
plasticState(p)%accumulatedSlip => plasticState(p)%state (2:2,1:NipcMyPhase)
|
||||||
|
|
||||||
|
plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally
|
||||||
|
|
||||||
state(instance)%accumulatedShear => plasticState(phase)%state (2,1:NipcMyPhase)
|
end associate
|
||||||
dotState(instance)%accumulatedShear => plasticState(phase)%dotState (2,1:NipcMyPhase)
|
|
||||||
plasticState(phase)%state0 (2,1:NipcMyPhase) = 0.0_pReal
|
|
||||||
plasticState(phase)%aTolState(2) = prm%aTolShear
|
|
||||||
! global alias
|
|
||||||
plasticState(phase)%slipRate => plasticState(phase)%dotState(2:2,1:NipcMyPhase)
|
|
||||||
plasticState(phase)%accumulatedSlip => plasticState(phase)%state (2:2,1:NipcMyPhase)
|
|
||||||
|
|
||||||
endif
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
end subroutine plastic_isotropic_init
|
end subroutine plastic_isotropic_init
|
||||||
|
@ -251,308 +255,236 @@ end subroutine plastic_isotropic_init
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief calculates plastic velocity gradient and its tangent
|
!> @brief calculates plastic velocity gradient and its tangent
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip,el)
|
subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of)
|
||||||
|
#ifdef DEBUG
|
||||||
use debug, only: &
|
use debug, only: &
|
||||||
debug_level, &
|
debug_level, &
|
||||||
debug_constitutive, &
|
debug_constitutive,&
|
||||||
debug_levelBasic, &
|
|
||||||
debug_levelExtensive, &
|
debug_levelExtensive, &
|
||||||
debug_levelSelective, &
|
debug_levelSelective
|
||||||
debug_e, &
|
#endif
|
||||||
debug_i, &
|
|
||||||
debug_g
|
|
||||||
use math, only: &
|
use math, only: &
|
||||||
math_mul6x6, &
|
|
||||||
math_Mandel6to33, &
|
|
||||||
math_Plain3333to99, &
|
|
||||||
math_deviatoric33, &
|
math_deviatoric33, &
|
||||||
math_mul33xx33
|
math_mul33xx33
|
||||||
use material, only: &
|
|
||||||
phasememberAt, &
|
|
||||||
material_phase, &
|
|
||||||
phase_plasticityInstance
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
real(pReal), dimension(3,3), intent(out) :: &
|
real(pReal), dimension(3,3), intent(out) :: &
|
||||||
Lp !< plastic velocity gradient
|
Lp !< plastic velocity gradient
|
||||||
real(pReal), dimension(9,9), intent(out) :: &
|
real(pReal), dimension(3,3,3,3), intent(out) :: &
|
||||||
dLp_dTstar99 !< derivative of Lp with respect to 2nd Piola Kirchhoff stress
|
dLp_dMp !< derivative of Lp with respect to the Mandel stress
|
||||||
|
|
||||||
real(pReal), dimension(6), intent(in) :: &
|
real(pReal), dimension(3,3), intent(in) :: &
|
||||||
Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation
|
Mp !< Mandel stress
|
||||||
integer(pInt), intent(in) :: &
|
integer(pInt), intent(in) :: &
|
||||||
ipc, & !< component-ID of integration point
|
instance, &
|
||||||
ip, & !< integration point
|
of
|
||||||
el !< element
|
|
||||||
|
|
||||||
type(tParameters), pointer :: prm
|
|
||||||
|
|
||||||
real(pReal), dimension(3,3) :: &
|
real(pReal), dimension(3,3) :: &
|
||||||
Tstar_dev_33 !< deviatoric part of the 2nd Piola Kirchhoff stress tensor as 2nd order tensor
|
Mp_dev !< deviatoric part of the Mandel stress
|
||||||
real(pReal), dimension(3,3,3,3) :: &
|
|
||||||
dLp_dTstar_3333 !< derivative of Lp with respect to Tstar as 4th order tensor
|
|
||||||
real(pReal) :: &
|
real(pReal) :: &
|
||||||
gamma_dot, & !< strainrate
|
gamma_dot, & !< strainrate
|
||||||
norm_Tstar_dev, & !< euclidean norm of Tstar_dev
|
norm_Mp_dev, & !< norm of the deviatoric part of the Mandel stress
|
||||||
squarenorm_Tstar_dev !< square of the euclidean norm of Tstar_dev
|
squarenorm_Mp_dev !< square of the norm of the deviatoric part of the Mandel stress
|
||||||
integer(pInt) :: &
|
integer(pInt) :: &
|
||||||
instance, of, &
|
|
||||||
k, l, m, n
|
k, l, m, n
|
||||||
|
|
||||||
of = phasememberAt(ipc,ip,el) ! phasememberAt should be tackled by material and be renamed to material_phasemember
|
associate(prm => param(instance), stt => state(instance))
|
||||||
instance = phase_plasticityInstance(material_phase(ipc,ip,el))
|
|
||||||
prm => param(instance)
|
|
||||||
|
|
||||||
Tstar_dev_33 = math_deviatoric33(math_Mandel6to33(Tstar_v)) ! deviatoric part of 2nd Piola-Kirchhoff stress
|
Mp_dev = math_deviatoric33(Mp)
|
||||||
squarenorm_Tstar_dev = math_mul33xx33(Tstar_dev_33,Tstar_dev_33)
|
squarenorm_Mp_dev = math_mul33xx33(Mp_dev,Mp_dev)
|
||||||
norm_Tstar_dev = sqrt(squarenorm_Tstar_dev)
|
norm_Mp_dev = sqrt(squarenorm_Mp_dev)
|
||||||
|
|
||||||
if (norm_Tstar_dev <= 0.0_pReal) then ! Tstar == 0 --> both Lp and dLp_dTstar are zero
|
if (norm_Mp_dev > 0.0_pReal) then
|
||||||
Lp = 0.0_pReal
|
gamma_dot = prm%gdot0 * (sqrt(1.5_pReal) * norm_Mp_dev/(prm%fTaylor*stt%flowstress(of))) **prm%n
|
||||||
dLp_dTstar99 = 0.0_pReal
|
|
||||||
else
|
|
||||||
gamma_dot = prm%gdot0 &
|
|
||||||
* ( sqrt(1.5_pReal) * norm_Tstar_dev / prm%fTaylor / state(instance)%flowstress(of) ) &
|
|
||||||
**prm%n
|
|
||||||
|
|
||||||
Lp = Tstar_dev_33/norm_Tstar_dev * gamma_dot/prm%fTaylor
|
|
||||||
|
|
||||||
|
Lp = Mp_dev/norm_Mp_dev * gamma_dot/prm%fTaylor
|
||||||
|
#ifdef DEBUG
|
||||||
if (iand(debug_level(debug_constitutive), debug_levelExtensive) /= 0_pInt &
|
if (iand(debug_level(debug_constitutive), debug_levelExtensive) /= 0_pInt &
|
||||||
.and. ((el == debug_e .and. ip == debug_i .and. ipc == debug_g) &
|
.and. (of == prm%of_debug .or. .not. iand(debug_level(debug_constitutive),debug_levelSelective) /= 0_pInt)) then
|
||||||
.or. .not. iand(debug_level(debug_constitutive),debug_levelSelective) /= 0_pInt)) then
|
|
||||||
write(6,'(a,i8,1x,i2,1x,i3)') '<< CONST isotropic >> at el ip g ',el,ip,ipc
|
|
||||||
write(6,'(/,a,/,3(12x,3(f12.4,1x)/))') '<< CONST isotropic >> Tstar (dev) / MPa', &
|
write(6,'(/,a,/,3(12x,3(f12.4,1x)/))') '<< CONST isotropic >> Tstar (dev) / MPa', &
|
||||||
transpose(Tstar_dev_33(1:3,1:3))*1.0e-6_pReal
|
transpose(Mp_dev)*1.0e-6_pReal
|
||||||
write(6,'(/,a,/,f12.5)') '<< CONST isotropic >> norm Tstar / MPa', norm_Tstar_dev*1.0e-6_pReal
|
write(6,'(/,a,/,f12.5)') '<< CONST isotropic >> norm Tstar / MPa', norm_Mp_dev*1.0e-6_pReal
|
||||||
write(6,'(/,a,/,f12.5)') '<< CONST isotropic >> gdot', gamma_dot
|
write(6,'(/,a,/,f12.5)') '<< CONST isotropic >> gdot', gamma_dot
|
||||||
end if
|
end if
|
||||||
!--------------------------------------------------------------------------------------------------
|
#endif
|
||||||
! Calculation of the tangent of Lp
|
|
||||||
forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) &
|
forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) &
|
||||||
dLp_dTstar_3333(k,l,m,n) = (prm%n-1.0_pReal) * &
|
dLp_dMp(k,l,m,n) = (prm%n-1.0_pReal) * Mp_dev(k,l)*Mp_dev(m,n) / squarenorm_Mp_dev
|
||||||
Tstar_dev_33(k,l)*Tstar_dev_33(m,n) / squarenorm_Tstar_dev
|
|
||||||
forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt) &
|
forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt) &
|
||||||
dLp_dTstar_3333(k,l,k,l) = dLp_dTstar_3333(k,l,k,l) + 1.0_pReal
|
dLp_dMp(k,l,k,l) = dLp_dMp(k,l,k,l) + 1.0_pReal
|
||||||
forall (k=1_pInt:3_pInt,m=1_pInt:3_pInt) &
|
forall (k=1_pInt:3_pInt,m=1_pInt:3_pInt) &
|
||||||
dLp_dTstar_3333(k,k,m,m) = dLp_dTstar_3333(k,k,m,m) - 1.0_pReal/3.0_pReal
|
dLp_dMp(k,k,m,m) = dLp_dMp(k,k,m,m) - 1.0_pReal/3.0_pReal
|
||||||
dLp_dTstar99 = math_Plain3333to99(gamma_dot / prm%fTaylor * &
|
dLp_dMp = gamma_dot / prm%fTaylor * dLp_dMp / norm_Mp_dev
|
||||||
dLp_dTstar_3333 / norm_Tstar_dev)
|
else
|
||||||
|
Lp = 0.0_pReal
|
||||||
|
dLp_dMp = 0.0_pReal
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
end associate
|
||||||
|
|
||||||
end subroutine plastic_isotropic_LpAndItsTangent
|
end subroutine plastic_isotropic_LpAndItsTangent
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief calculates plastic velocity gradient and its tangent
|
!> @brief calculates plastic velocity gradient and its tangent
|
||||||
|
! ToDo: Rename Tstar to Mi?
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar_3333,Tstar_v,ipc,ip,el)
|
subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar,Tstar,instance,of)
|
||||||
use math, only: &
|
use math, only: &
|
||||||
math_mul6x6, &
|
|
||||||
math_Mandel6to33, &
|
|
||||||
math_Plain3333to99, &
|
|
||||||
math_spherical33, &
|
math_spherical33, &
|
||||||
math_mul33xx33
|
math_mul33xx33
|
||||||
use material, only: &
|
|
||||||
phasememberAt, &
|
|
||||||
material_phase, &
|
|
||||||
phase_plasticityInstance
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
real(pReal), dimension(3,3), intent(out) :: &
|
real(pReal), dimension(3,3), intent(out) :: &
|
||||||
Li !< plastic velocity gradient
|
Li !< inleastic velocity gradient
|
||||||
real(pReal), dimension(3,3,3,3), intent(out) :: &
|
real(pReal), dimension(3,3,3,3), intent(out) :: &
|
||||||
dLi_dTstar_3333 !< derivative of Li with respect to Tstar as 4th order tensor
|
dLi_dTstar !< derivative of Li with respect to the Mandel stress
|
||||||
real(pReal), dimension(6), intent(in) :: &
|
|
||||||
Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ipc, & !< component-ID of integration point
|
|
||||||
ip, & !< integration point
|
|
||||||
el !< element
|
|
||||||
|
|
||||||
type(tParameters), pointer :: prm
|
|
||||||
|
|
||||||
|
real(pReal), dimension(3,3), intent(in) :: &
|
||||||
|
Tstar !< Mandel stress ToDo: Mi?
|
||||||
|
integer(pInt), intent(in) :: &
|
||||||
|
instance, &
|
||||||
|
of
|
||||||
|
|
||||||
real(pReal), dimension(3,3) :: &
|
real(pReal), dimension(3,3) :: &
|
||||||
Tstar_sph_33 !< sphiatoric part of the 2nd Piola Kirchhoff stress tensor as 2nd order tensor
|
Tstar_sph !< sphiatoric part of the Mandel stress
|
||||||
real(pReal) :: &
|
real(pReal) :: &
|
||||||
gamma_dot, & !< strainrate
|
gamma_dot, & !< strainrate
|
||||||
norm_Tstar_sph, & !< euclidean norm of Tstar_sph
|
norm_Tstar_sph, & !< euclidean norm of Tstar_sph
|
||||||
squarenorm_Tstar_sph !< square of the euclidean norm of Tstar_sph
|
squarenorm_Tstar_sph !< square of the euclidean norm of Tstar_sph
|
||||||
integer(pInt) :: &
|
integer(pInt) :: &
|
||||||
instance, of, &
|
|
||||||
k, l, m, n
|
k, l, m, n
|
||||||
|
|
||||||
of = phasememberAt(ipc,ip,el) ! phasememberAt should be tackled by material and be renamed to material_phasemember
|
associate(prm => param(instance), stt => state(instance))
|
||||||
instance = phase_plasticityInstance(material_phase(ipc,ip,el))
|
|
||||||
prm => param(instance)
|
|
||||||
|
|
||||||
Tstar_sph_33 = math_spherical33(math_Mandel6to33(Tstar_v)) ! spherical part of 2nd Piola-Kirchhoff stress
|
Tstar_sph = math_spherical33(Tstar)
|
||||||
squarenorm_Tstar_sph = math_mul33xx33(Tstar_sph_33,Tstar_sph_33)
|
squarenorm_Tstar_sph = math_mul33xx33(Tstar_sph,Tstar_sph)
|
||||||
norm_Tstar_sph = sqrt(squarenorm_Tstar_sph)
|
norm_Tstar_sph = sqrt(squarenorm_Tstar_sph)
|
||||||
|
|
||||||
if (prm%dilatation .and. norm_Tstar_sph > 0.0_pReal) then ! Tstar == 0 or J2 plascitiy --> both Li and dLi_dTstar are zero
|
if (prm%dilatation .and. norm_Tstar_sph > 0.0_pReal) then ! no stress or J2 plastitiy --> Li and its derivative are zero
|
||||||
gamma_dot = prm%gdot0 &
|
gamma_dot = prm%gdot0 * (sqrt(1.5_pReal) * norm_Tstar_sph /(prm%fTaylor*stt%flowstress(of))) **prm%n
|
||||||
* (sqrt(1.5_pReal) * norm_Tstar_sph / prm%fTaylor / state(instance)%flowstress(of) ) &
|
|
||||||
**prm%n
|
|
||||||
|
|
||||||
Li = Tstar_sph_33/norm_Tstar_sph * gamma_dot/prm%fTaylor
|
Li = Tstar_sph/norm_Tstar_sph * gamma_dot/prm%fTaylor
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! Calculation of the tangent of Li
|
|
||||||
forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) &
|
forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) &
|
||||||
dLi_dTstar_3333(k,l,m,n) = (prm%n-1.0_pReal) * &
|
dLi_dTstar(k,l,m,n) = (prm%n-1.0_pReal) * Tstar_sph(k,l)*Tstar_sph(m,n) / squarenorm_Tstar_sph
|
||||||
Tstar_sph_33(k,l)*Tstar_sph_33(m,n) / squarenorm_Tstar_sph
|
|
||||||
forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt) &
|
forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt) &
|
||||||
dLi_dTstar_3333(k,l,k,l) = dLi_dTstar_3333(k,l,k,l) + 1.0_pReal
|
dLi_dTstar(k,l,k,l) = dLi_dTstar(k,l,k,l) + 1.0_pReal
|
||||||
|
|
||||||
dLi_dTstar_3333 = gamma_dot / prm%fTaylor * &
|
dLi_dTstar = gamma_dot / prm%fTaylor * dLi_dTstar / norm_Tstar_sph
|
||||||
dLi_dTstar_3333 / norm_Tstar_sph
|
|
||||||
else
|
else
|
||||||
Li = 0.0_pReal
|
Li = 0.0_pReal
|
||||||
dLi_dTstar_3333 = 0.0_pReal
|
dLi_dTstar = 0.0_pReal
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
end associate
|
||||||
|
|
||||||
end subroutine plastic_isotropic_LiAndItsTangent
|
end subroutine plastic_isotropic_LiAndItsTangent
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief calculates the rate of change of microstructure
|
!> @brief calculates the rate of change of microstructure
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine plastic_isotropic_dotState(Tstar_v,ipc,ip,el)
|
subroutine plastic_isotropic_dotState(Mp,instance,of)
|
||||||
use prec, only: &
|
use prec, only: &
|
||||||
dEq0
|
dEq0
|
||||||
use math, only: &
|
use math, only: &
|
||||||
math_mul6x6
|
math_mul33xx33, &
|
||||||
use material, only: &
|
math_deviatoric33
|
||||||
phasememberAt, &
|
|
||||||
material_phase, &
|
|
||||||
phase_plasticityInstance
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
real(pReal), dimension(6), intent(in):: &
|
real(pReal), dimension(3,3), intent(in) :: &
|
||||||
Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation
|
Mp !< Mandel stress
|
||||||
integer(pInt), intent(in) :: &
|
integer(pInt), intent(in) :: &
|
||||||
ipc, & !< component-ID of integration point
|
instance, &
|
||||||
ip, & !< integration point
|
of
|
||||||
el !< element
|
|
||||||
type(tParameters), pointer :: prm
|
|
||||||
real(pReal), dimension(6) :: &
|
|
||||||
Tstar_dev_v !< deviatoric 2nd Piola Kirchhoff stress tensor in Mandel notation
|
|
||||||
real(pReal) :: &
|
real(pReal) :: &
|
||||||
gamma_dot, & !< strainrate
|
gamma_dot, & !< strainrate
|
||||||
hardening, & !< hardening coefficient
|
hardening, & !< hardening coefficient
|
||||||
saturation, & !< saturation flowstress
|
saturation, & !< saturation flowstress
|
||||||
norm_Tstar_v !< euclidean norm of Tstar_dev
|
norm_Mp !< norm of the (deviatoric) Mandel stress
|
||||||
integer(pInt) :: &
|
|
||||||
instance, & !< instance of my instance (unique number of my constitutive model)
|
|
||||||
of !< shortcut notation for offset position in state array
|
|
||||||
|
|
||||||
of = phasememberAt(ipc,ip,el) ! phasememberAt should be tackled by material and be renamed to material_phasemember
|
associate(prm => param(instance), stt => state(instance), dot => dotState(instance))
|
||||||
instance = phase_plasticityInstance(material_phase(ipc,ip,el))
|
|
||||||
prm => param(instance)
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! norm of (deviatoric) 2nd Piola-Kirchhoff stress
|
|
||||||
if (prm%dilatation) then
|
if (prm%dilatation) then
|
||||||
norm_Tstar_v = sqrt(math_mul6x6(Tstar_v,Tstar_v))
|
norm_Mp = sqrt(math_mul33xx33(Mp,Mp))
|
||||||
else
|
else
|
||||||
Tstar_dev_v(1:3) = Tstar_v(1:3) - sum(Tstar_v(1:3))/3.0_pReal
|
norm_Mp = sqrt(math_mul33xx33(math_deviatoric33(Mp),math_deviatoric33(Mp)))
|
||||||
Tstar_dev_v(4:6) = Tstar_v(4:6)
|
endif
|
||||||
norm_Tstar_v = sqrt(math_mul6x6(Tstar_dev_v,Tstar_dev_v))
|
|
||||||
end if
|
gamma_dot = prm%gdot0 * (sqrt(1.5_pReal) * norm_Mp /(prm%fTaylor*stt%flowstress(of))) **prm%n
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! strain rate
|
|
||||||
gamma_dot = prm%gdot0 * ( sqrt(1.5_pReal) * norm_Tstar_v &
|
|
||||||
/ &!-----------------------------------------------------------------------------------
|
|
||||||
(prm%fTaylor*state(instance)%flowstress(of) ))**prm%n
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! hardening coefficient
|
|
||||||
if (abs(gamma_dot) > 1e-12_pReal) then
|
if (abs(gamma_dot) > 1e-12_pReal) then
|
||||||
if (dEq0(prm%tausat_SinhFitA)) then
|
if (dEq0(prm%tausat_SinhFitA)) then
|
||||||
saturation = prm%tausat
|
saturation = prm%tausat
|
||||||
else
|
else
|
||||||
saturation = prm%tausat &
|
saturation = prm%tausat &
|
||||||
+ asinh( (gamma_dot / prm%tausat_SinhFitA&
|
+ asinh( (gamma_dot / prm%tausat_SinhFitA)**(1.0_pReal / prm%tausat_SinhFitD) &
|
||||||
)**(1.0_pReal / prm%tausat_SinhFitD)&
|
|
||||||
)**(1.0_pReal / prm%tausat_SinhFitC) &
|
)**(1.0_pReal / prm%tausat_SinhFitC) &
|
||||||
/ ( prm%tausat_SinhFitB &
|
/ prm%tausat_SinhFitB * (gamma_dot / prm%gdot0)**(1.0_pReal / prm%n)
|
||||||
* (gamma_dot / prm%gdot0)**(1.0_pReal / prm%n) &
|
|
||||||
)
|
|
||||||
endif
|
endif
|
||||||
hardening = ( prm%h0 + prm%h0_slopeLnRate * log(gamma_dot) ) &
|
hardening = ( prm%h0 + prm%h0_slopeLnRate * log(gamma_dot) ) &
|
||||||
* abs( 1.0_pReal - state(instance)%flowstress(of)/saturation )**prm%a &
|
* abs( 1.0_pReal - stt%flowstress(of)/saturation )**prm%a &
|
||||||
* sign(1.0_pReal, 1.0_pReal - state(instance)%flowstress(of)/saturation)
|
* sign(1.0_pReal, 1.0_pReal - stt%flowstress(of)/saturation)
|
||||||
else
|
else
|
||||||
hardening = 0.0_pReal
|
hardening = 0.0_pReal
|
||||||
endif
|
endif
|
||||||
|
|
||||||
dotState(instance)%flowstress (of) = hardening * gamma_dot
|
dot%flowstress (of) = hardening * gamma_dot
|
||||||
dotState(instance)%accumulatedShear(of) = gamma_dot
|
dot%accumulatedShear(of) = gamma_dot
|
||||||
|
|
||||||
|
end associate
|
||||||
|
|
||||||
end subroutine plastic_isotropic_dotState
|
end subroutine plastic_isotropic_dotState
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief return array of constitutive results
|
!> @brief return array of constitutive results
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
function plastic_isotropic_postResults(Tstar_v,ipc,ip,el)
|
function plastic_isotropic_postResults(Mp,instance,of) result(postResults)
|
||||||
use math, only: &
|
use math, only: &
|
||||||
math_mul6x6
|
math_mul33xx33, &
|
||||||
use material, only: &
|
math_deviatoric33
|
||||||
plasticState, &
|
|
||||||
material_phase, &
|
|
||||||
phasememberAt, &
|
|
||||||
phase_plasticityInstance
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
real(pReal), dimension(6), intent(in) :: &
|
real(pReal), dimension(3,3), intent(in) :: &
|
||||||
Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation
|
Mp !< Mandel stress
|
||||||
integer(pInt), intent(in) :: &
|
integer(pInt), intent(in) :: &
|
||||||
ipc, & !< component-ID of integration point
|
instance, &
|
||||||
ip, & !< integration point
|
of
|
||||||
el !< element
|
|
||||||
|
|
||||||
type(tParameters), pointer :: prm
|
real(pReal), dimension(sum(plastic_isotropic_sizePostResult(:,instance))) :: &
|
||||||
|
postResults
|
||||||
real(pReal), dimension(plasticState(material_phase(ipc,ip,el))%sizePostResults) :: &
|
|
||||||
plastic_isotropic_postResults
|
|
||||||
|
|
||||||
real(pReal), dimension(6) :: &
|
|
||||||
Tstar_dev_v !< deviatoric 2nd Piola Kirchhoff stress tensor in Mandel notation
|
|
||||||
real(pReal) :: &
|
real(pReal) :: &
|
||||||
norm_Tstar_v ! euclidean norm of Tstar_dev
|
norm_Mp !< norm of the Mandel stress
|
||||||
integer(pInt) :: &
|
integer(pInt) :: &
|
||||||
instance, & !< instance of my instance (unique number of my constitutive model)
|
o,c
|
||||||
of, & !< shortcut notation for offset position in state array
|
|
||||||
c, &
|
|
||||||
o
|
|
||||||
|
|
||||||
of = phasememberAt(ipc,ip,el) ! phasememberAt should be tackled by material and be renamed to material_phasemember
|
associate(prm => param(instance), stt => state(instance))
|
||||||
instance = phase_plasticityInstance(material_phase(ipc,ip,el))
|
|
||||||
prm => param(instance)
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! norm of (deviatoric) 2nd Piola-Kirchhoff stress
|
|
||||||
if (prm%dilatation) then
|
if (prm%dilatation) then
|
||||||
norm_Tstar_v = sqrt(math_mul6x6(Tstar_v,Tstar_v))
|
norm_Mp = sqrt(math_mul33xx33(Mp,Mp))
|
||||||
else
|
else
|
||||||
Tstar_dev_v(1:3) = Tstar_v(1:3) - sum(Tstar_v(1:3))/3.0_pReal
|
norm_Mp = sqrt(math_mul33xx33(math_deviatoric33(Mp),math_deviatoric33(Mp)))
|
||||||
Tstar_dev_v(4:6) = Tstar_v(4:6)
|
endif
|
||||||
norm_Tstar_v = sqrt(math_mul6x6(Tstar_dev_v,Tstar_dev_v))
|
|
||||||
end if
|
|
||||||
|
|
||||||
c = 0_pInt
|
c = 0_pInt
|
||||||
plastic_isotropic_postResults = 0.0_pReal
|
|
||||||
|
|
||||||
outputsLoop: do o = 1_pInt,plastic_isotropic_Noutput(instance)
|
outputsLoop: do o = 1_pInt,size(prm%outputID)
|
||||||
select case(prm%outputID(o))
|
select case(prm%outputID(o))
|
||||||
|
|
||||||
case (flowstress_ID)
|
case (flowstress_ID)
|
||||||
plastic_isotropic_postResults(c+1_pInt) = state(instance)%flowstress(of)
|
postResults(c+1_pInt) = stt%flowstress(of)
|
||||||
c = c + 1_pInt
|
c = c + 1_pInt
|
||||||
case (strainrate_ID)
|
case (strainrate_ID)
|
||||||
plastic_isotropic_postResults(c+1_pInt) = &
|
postResults(c+1_pInt) = prm%gdot0 &
|
||||||
prm%gdot0 * ( sqrt(1.5_pReal) * norm_Tstar_v &
|
* (sqrt(1.5_pReal) * norm_Mp /(prm%fTaylor * stt%flowstress(of)))**prm%n
|
||||||
/ &!----------------------------------------------------------------------------------
|
|
||||||
(prm%fTaylor * state(instance)%flowstress(of)) ) ** prm%n
|
|
||||||
c = c + 1_pInt
|
c = c + 1_pInt
|
||||||
|
|
||||||
end select
|
end select
|
||||||
enddo outputsLoop
|
enddo outputsLoop
|
||||||
|
|
||||||
|
end associate
|
||||||
|
|
||||||
end function plastic_isotropic_postResults
|
end function plastic_isotropic_postResults
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
|
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
|
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
!> @brief material subroutine for purely elastic material
|
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
|
!> @brief Dummy plasticity for purely elastic material
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
module plastic_none
|
module plastic_none
|
||||||
|
|
||||||
|
@ -13,7 +14,6 @@ module plastic_none
|
||||||
|
|
||||||
contains
|
contains
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief module initialization
|
!> @brief module initialization
|
||||||
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
||||||
|
@ -32,52 +32,40 @@ subroutine plastic_none_init
|
||||||
debug_levelBasic
|
debug_levelBasic
|
||||||
use IO, only: &
|
use IO, only: &
|
||||||
IO_timeStamp
|
IO_timeStamp
|
||||||
use numerics, only: &
|
|
||||||
numerics_integrator
|
|
||||||
use material, only: &
|
use material, only: &
|
||||||
phase_plasticity, &
|
phase_plasticity, &
|
||||||
|
material_allocatePlasticState, &
|
||||||
PLASTICITY_NONE_label, &
|
PLASTICITY_NONE_label, &
|
||||||
|
PLASTICITY_NONE_ID, &
|
||||||
material_phase, &
|
material_phase, &
|
||||||
plasticState, &
|
plasticState
|
||||||
PLASTICITY_none_ID
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer(pInt) :: &
|
integer(pInt) :: &
|
||||||
maxNinstance, &
|
Ninstance, &
|
||||||
phase, &
|
p, &
|
||||||
NofMyPhase
|
NipcMyPhase
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_NONE_label//' init -+>>>'
|
write(6,'(/,a)') ' <<<+- plastic_'//PLASTICITY_NONE_label//' init -+>>>'
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
||||||
#include "compilation_info.f90"
|
#include "compilation_info.f90"
|
||||||
|
|
||||||
maxNinstance = int(count(phase_plasticity == PLASTICITY_none_ID),pInt)
|
Ninstance = int(count(phase_plasticity == PLASTICITY_NONE_ID),pInt)
|
||||||
if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) &
|
if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) &
|
||||||
write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance
|
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance
|
||||||
|
|
||||||
initializeInstances: do phase = 1_pInt, size(phase_plasticity)
|
do p = 1_pInt, size(phase_plasticity)
|
||||||
if (phase_plasticity(phase) == PLASTICITY_none_ID) then
|
if (phase_plasticity(p) /= PLASTICITY_NONE_ID) cycle
|
||||||
NofMyPhase=count(material_phase==phase)
|
|
||||||
|
|
||||||
allocate(plasticState(phase)%aTolState (0_pInt))
|
!--------------------------------------------------------------------------------------------------
|
||||||
allocate(plasticState(phase)%state0 (0_pInt,NofMyPhase))
|
! allocate state arrays
|
||||||
allocate(plasticState(phase)%partionedState0 (0_pInt,NofMyPhase))
|
NipcMyPhase = count(material_phase == p)
|
||||||
allocate(plasticState(phase)%subState0 (0_pInt,NofMyPhase))
|
|
||||||
allocate(plasticState(phase)%state (0_pInt,NofMyPhase))
|
|
||||||
|
|
||||||
allocate(plasticState(phase)%dotState (0_pInt,NofMyPhase))
|
call material_allocatePlasticState(p,NipcMyPhase,0_pInt,0_pInt,0_pInt, &
|
||||||
allocate(plasticState(phase)%deltaState (0_pInt,NofMyPhase))
|
0_pInt,0_pInt,0_pInt)
|
||||||
if (any(numerics_integrator == 1_pInt)) then
|
plasticState(p)%sizePostResults = 0_pInt
|
||||||
allocate(plasticState(phase)%previousDotState (0_pInt,NofMyPhase))
|
|
||||||
allocate(plasticState(phase)%previousDotState2(0_pInt,NofMyPhase))
|
enddo
|
||||||
endif
|
|
||||||
if (any(numerics_integrator == 4_pInt)) &
|
|
||||||
allocate(plasticState(phase)%RK4dotState (0_pInt,NofMyPhase))
|
|
||||||
if (any(numerics_integrator == 5_pInt)) &
|
|
||||||
allocate(plasticState(phase)%RKCK45dotState (6,0_pInt,NofMyPhase))
|
|
||||||
endif
|
|
||||||
enddo initializeInstances
|
|
||||||
|
|
||||||
end subroutine plastic_none_init
|
end subroutine plastic_none_init
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,11 @@
|
||||||
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
|
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
|
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
!> @brief material subroutine for phenomenological crystal plasticity formulation using a powerlaw
|
!> @brief phenomenological crystal plasticity formulation using a powerlaw fitting
|
||||||
!! fitting
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
module plastic_phenopowerlaw
|
module plastic_phenopowerlaw
|
||||||
use prec, only: &
|
use prec, only: &
|
||||||
pReal,&
|
pReal, &
|
||||||
pInt
|
pInt
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
@ -24,12 +23,10 @@ module plastic_phenopowerlaw
|
||||||
accumulatedshear_slip_ID, &
|
accumulatedshear_slip_ID, &
|
||||||
shearrate_slip_ID, &
|
shearrate_slip_ID, &
|
||||||
resolvedstress_slip_ID, &
|
resolvedstress_slip_ID, &
|
||||||
totalshear_ID, &
|
|
||||||
resistance_twin_ID, &
|
resistance_twin_ID, &
|
||||||
accumulatedshear_twin_ID, &
|
accumulatedshear_twin_ID, &
|
||||||
shearrate_twin_ID, &
|
shearrate_twin_ID, &
|
||||||
resolvedstress_twin_ID, &
|
resolvedstress_twin_ID
|
||||||
totalvolfrac_twin_ID
|
|
||||||
end enum
|
end enum
|
||||||
|
|
||||||
type, private :: tParameters
|
type, private :: tParameters
|
||||||
|
@ -55,7 +52,7 @@ module plastic_phenopowerlaw
|
||||||
xi_twin_0, & !< initial critical shear stress for twin
|
xi_twin_0, & !< initial critical shear stress for twin
|
||||||
xi_slip_sat, & !< maximum critical shear stress for slip
|
xi_slip_sat, & !< maximum critical shear stress for slip
|
||||||
nonSchmidCoeff, &
|
nonSchmidCoeff, &
|
||||||
H_int, & !< per family hardening activity (optional) !ToDo: Better name!
|
H_int, & !< per family hardening activity (optional)
|
||||||
gamma_twin_char !< characteristic shear for twins
|
gamma_twin_char !< characteristic shear for twins
|
||||||
real(pReal), allocatable, dimension(:,:) :: &
|
real(pReal), allocatable, dimension(:,:) :: &
|
||||||
interaction_SlipSlip, & !< slip resistance from slip activity
|
interaction_SlipSlip, & !< slip resistance from slip activity
|
||||||
|
@ -80,15 +77,11 @@ module plastic_phenopowerlaw
|
||||||
type(tParameters), dimension(:), allocatable, private :: param !< containers of constitutive parameters (len Ninstance)
|
type(tParameters), dimension(:), allocatable, private :: param !< containers of constitutive parameters (len Ninstance)
|
||||||
|
|
||||||
type, private :: tPhenopowerlawState
|
type, private :: tPhenopowerlawState
|
||||||
real(pReal), pointer, dimension(:) :: &
|
|
||||||
sumGamma, & ! ToDo: why not make a dependent state?
|
|
||||||
sumF ! ToDo: why not make a dependent state?
|
|
||||||
real(pReal), pointer, dimension(:,:) :: &
|
real(pReal), pointer, dimension(:,:) :: &
|
||||||
xi_slip, &
|
xi_slip, &
|
||||||
xi_twin, &
|
xi_twin, &
|
||||||
gamma_slip, &
|
gamma_slip, &
|
||||||
gamma_twin, &
|
gamma_twin
|
||||||
whole
|
|
||||||
end type
|
end type
|
||||||
|
|
||||||
type(tPhenopowerlawState), allocatable, dimension(:), private :: &
|
type(tPhenopowerlawState), allocatable, dimension(:), private :: &
|
||||||
|
@ -101,6 +94,9 @@ module plastic_phenopowerlaw
|
||||||
plastic_phenopowerlaw_dotState, &
|
plastic_phenopowerlaw_dotState, &
|
||||||
plastic_phenopowerlaw_postResults, &
|
plastic_phenopowerlaw_postResults, &
|
||||||
plastic_phenopowerlaw_results
|
plastic_phenopowerlaw_results
|
||||||
|
private :: &
|
||||||
|
kinetics_slip, &
|
||||||
|
kinetics_twin
|
||||||
|
|
||||||
contains
|
contains
|
||||||
|
|
||||||
|
@ -116,8 +112,7 @@ subroutine plastic_phenopowerlaw_init
|
||||||
compiler_options
|
compiler_options
|
||||||
#endif
|
#endif
|
||||||
use prec, only: &
|
use prec, only: &
|
||||||
pStringLen, &
|
pStringLen
|
||||||
dEq0
|
|
||||||
use debug, only: &
|
use debug, only: &
|
||||||
debug_level, &
|
debug_level, &
|
||||||
debug_constitutive,&
|
debug_constitutive,&
|
||||||
|
@ -125,7 +120,6 @@ subroutine plastic_phenopowerlaw_init
|
||||||
use math, only: &
|
use math, only: &
|
||||||
math_expand
|
math_expand
|
||||||
use IO, only: &
|
use IO, only: &
|
||||||
IO_warning, &
|
|
||||||
IO_error, &
|
IO_error, &
|
||||||
IO_timeStamp
|
IO_timeStamp
|
||||||
use material, only: &
|
use material, only: &
|
||||||
|
@ -154,22 +148,16 @@ subroutine plastic_phenopowerlaw_init
|
||||||
real(pReal), dimension(0), parameter :: emptyRealArray = [real(pReal)::]
|
real(pReal), dimension(0), parameter :: emptyRealArray = [real(pReal)::]
|
||||||
character(len=65536), dimension(0), parameter :: emptyStringArray = [character(len=65536)::]
|
character(len=65536), dimension(0), parameter :: emptyStringArray = [character(len=65536)::]
|
||||||
|
|
||||||
type(tParameters) :: &
|
|
||||||
prm
|
|
||||||
type(tPhenopowerlawState) :: &
|
|
||||||
stt, &
|
|
||||||
dot
|
|
||||||
|
|
||||||
integer(kind(undefined_ID)) :: &
|
integer(kind(undefined_ID)) :: &
|
||||||
outputID !< ID of each post result output
|
outputID
|
||||||
|
|
||||||
character(len=pStringLen) :: &
|
character(len=pStringLen) :: &
|
||||||
structure = '',&
|
structure = '',&
|
||||||
extmsg = ''
|
extmsg = ''
|
||||||
character(len=65536), dimension(:), allocatable :: &
|
character(len=65536), dimension(:), allocatable :: &
|
||||||
outputs
|
outputs
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_PHENOPOWERLAW_label//' init -+>>>'
|
write(6,'(/,a)') ' <<<+- plastic_'//PLASTICITY_PHENOPOWERLAW_label//' init -+>>>'
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
||||||
#include "compilation_info.f90"
|
#include "compilation_info.f90"
|
||||||
|
|
||||||
|
@ -185,40 +173,41 @@ subroutine plastic_phenopowerlaw_init
|
||||||
allocate(state(Ninstance))
|
allocate(state(Ninstance))
|
||||||
allocate(dotState(Ninstance))
|
allocate(dotState(Ninstance))
|
||||||
|
|
||||||
do p = 1_pInt, size(phase_plasticityInstance)
|
do p = 1_pInt, size(phase_plasticity)
|
||||||
if (phase_plasticity(p) /= PLASTICITY_PHENOPOWERLAW_ID) cycle
|
if (phase_plasticity(p) /= PLASTICITY_PHENOPOWERLAW_ID) cycle
|
||||||
associate(prm => param(phase_plasticityInstance(p)), &
|
associate(prm => param(phase_plasticityInstance(p)), &
|
||||||
dot => dotState(phase_plasticityInstance(p)), &
|
dot => dotState(phase_plasticityInstance(p)), &
|
||||||
stt => state(phase_plasticityInstance(p)))
|
stt => state(phase_plasticityInstance(p)), &
|
||||||
|
config => config_phase(p))
|
||||||
|
|
||||||
structure = config_phase(p)%getString('lattice_structure')
|
structure = config%getString('lattice_structure')
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! optional parameters that need to be defined
|
! optional parameters that need to be defined
|
||||||
prm%twinB = config_phase(p)%getFloat('twin_b',defaultVal=1.0_pReal)
|
prm%twinB = config%getFloat('twin_b',defaultVal=1.0_pReal)
|
||||||
prm%twinC = config_phase(p)%getFloat('twin_c',defaultVal=0.0_pReal)
|
prm%twinC = config%getFloat('twin_c',defaultVal=0.0_pReal)
|
||||||
prm%twinD = config_phase(p)%getFloat('twin_d',defaultVal=0.0_pReal)
|
prm%twinD = config%getFloat('twin_d',defaultVal=0.0_pReal)
|
||||||
prm%twinE = config_phase(p)%getFloat('twin_e',defaultVal=0.0_pReal)
|
prm%twinE = config%getFloat('twin_e',defaultVal=0.0_pReal)
|
||||||
|
|
||||||
prm%aTolResistance = config_phase(p)%getFloat('atol_resistance',defaultVal=1.0_pReal)
|
prm%aTolResistance = config%getFloat('atol_resistance',defaultVal=1.0_pReal)
|
||||||
prm%aTolShear = config_phase(p)%getFloat('atol_shear', defaultVal=1.0e-6_pReal)
|
prm%aTolShear = config%getFloat('atol_shear', defaultVal=1.0e-6_pReal)
|
||||||
prm%aTolTwinfrac = config_phase(p)%getFloat('atol_twinfrac', defaultVal=1.0e-6_pReal)
|
prm%aTolTwinfrac = config%getFloat('atol_twinfrac', defaultVal=1.0e-6_pReal)
|
||||||
|
|
||||||
! sanity checks
|
! sanity checks
|
||||||
if (prm%aTolResistance <= 0.0_pReal) extmsg = trim(extmsg)//'aTolresistance '
|
if (prm%aTolResistance <= 0.0_pReal) extmsg = trim(extmsg)//' aTolresistance'
|
||||||
if (prm%aTolShear <= 0.0_pReal) extmsg = trim(extmsg)//'aTolShear '
|
if (prm%aTolShear <= 0.0_pReal) extmsg = trim(extmsg)//' aTolShear'
|
||||||
if (prm%aTolTwinfrac <= 0.0_pReal) extmsg = trim(extmsg)//'atoltwinfrac '
|
if (prm%aTolTwinfrac <= 0.0_pReal) extmsg = trim(extmsg)//' atoltwinfrac'
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! slip related parameters
|
! slip related parameters
|
||||||
prm%Nslip = config_phase(p)%getInts('nslip',defaultVal=emptyIntArray)
|
prm%Nslip = config%getInts('nslip',defaultVal=emptyIntArray)
|
||||||
prm%totalNslip = sum(prm%Nslip)
|
prm%totalNslip = sum(prm%Nslip)
|
||||||
slipActive: if (prm%totalNslip > 0_pInt) then
|
slipActive: if (prm%totalNslip > 0_pInt) then
|
||||||
prm%Schmid_slip = lattice_SchmidMatrix_slip(prm%Nslip,structure(1:3),&
|
prm%Schmid_slip = lattice_SchmidMatrix_slip(prm%Nslip,structure(1:3),&
|
||||||
config_phase(p)%getFloat('c/a',defaultVal=0.0_pReal))
|
config%getFloat('c/a',defaultVal=0.0_pReal))
|
||||||
if(structure=='bcc') then
|
if(structure=='bcc') then
|
||||||
prm%nonSchmidCoeff = config_phase(p)%getFloats('nonschmid_coefficients',&
|
prm%nonSchmidCoeff = config%getFloats('nonschmid_coefficients',&
|
||||||
defaultVal = emptyRealArray)
|
defaultVal = emptyRealArray)
|
||||||
prm%nonSchmid_pos = lattice_nonSchmidMatrix(prm%Nslip,prm%nonSchmidCoeff,+1_pInt)
|
prm%nonSchmid_pos = lattice_nonSchmidMatrix(prm%Nslip,prm%nonSchmidCoeff,+1_pInt)
|
||||||
prm%nonSchmid_neg = lattice_nonSchmidMatrix(prm%Nslip,prm%nonSchmidCoeff,-1_pInt)
|
prm%nonSchmid_neg = lattice_nonSchmidMatrix(prm%Nslip,prm%nonSchmidCoeff,-1_pInt)
|
||||||
else
|
else
|
||||||
|
@ -226,18 +215,18 @@ subroutine plastic_phenopowerlaw_init
|
||||||
prm%nonSchmid_neg = prm%Schmid_slip
|
prm%nonSchmid_neg = prm%Schmid_slip
|
||||||
endif
|
endif
|
||||||
prm%interaction_SlipSlip = lattice_interaction_SlipSlip(prm%Nslip, &
|
prm%interaction_SlipSlip = lattice_interaction_SlipSlip(prm%Nslip, &
|
||||||
config_phase(p)%getFloats('interaction_slipslip'), &
|
config%getFloats('interaction_slipslip'), &
|
||||||
structure(1:3))
|
structure(1:3))
|
||||||
|
|
||||||
prm%xi_slip_0 = config_phase(p)%getFloats('tau0_slip', requiredShape=shape(prm%Nslip))
|
prm%xi_slip_0 = config%getFloats('tau0_slip', requiredSize=size(prm%Nslip))
|
||||||
prm%xi_slip_sat = config_phase(p)%getFloats('tausat_slip', requiredShape=shape(prm%Nslip))
|
prm%xi_slip_sat = config%getFloats('tausat_slip', requiredSize=size(prm%Nslip))
|
||||||
prm%H_int = config_phase(p)%getFloats('h_int', requiredShape=shape(prm%Nslip), &
|
prm%H_int = config%getFloats('h_int', requiredSize=size(prm%Nslip), &
|
||||||
defaultVal=[(0.0_pReal,i=1_pInt,size(prm%Nslip))])
|
defaultVal=[(0.0_pReal,i=1_pInt,size(prm%Nslip))])
|
||||||
|
|
||||||
prm%gdot0_slip = config_phase(p)%getFloat('gdot0_slip')
|
prm%gdot0_slip = config%getFloat('gdot0_slip')
|
||||||
prm%n_slip = config_phase(p)%getFloat('n_slip')
|
prm%n_slip = config%getFloat('n_slip')
|
||||||
prm%a_slip = config_phase(p)%getFloat('a_slip')
|
prm%a_slip = config%getFloat('a_slip')
|
||||||
prm%h0_SlipSlip = config_phase(p)%getFloat('h0_slipslip')
|
prm%h0_SlipSlip = config%getFloat('h0_slipslip')
|
||||||
|
|
||||||
! expand: family => system
|
! expand: family => system
|
||||||
prm%xi_slip_0 = math_expand(prm%xi_slip_0, prm%Nslip)
|
prm%xi_slip_0 = math_expand(prm%xi_slip_0, prm%Nslip)
|
||||||
|
@ -245,11 +234,11 @@ subroutine plastic_phenopowerlaw_init
|
||||||
prm%H_int = math_expand(prm%H_int, prm%Nslip)
|
prm%H_int = math_expand(prm%H_int, prm%Nslip)
|
||||||
|
|
||||||
! sanity checks
|
! sanity checks
|
||||||
if (prm%gdot0_slip <= 0.0_pReal) extmsg = trim(extmsg)//'gdot0_slip '
|
if (prm%gdot0_slip <= 0.0_pReal) extmsg = trim(extmsg)//' gdot0_slip'
|
||||||
if (dEq0(prm%a_slip)) extmsg = trim(extmsg)//'a_slip ' ! ToDo: negative values ok?
|
if (prm%a_slip <= 0.0_pReal) extmsg = trim(extmsg)//' a_slip'
|
||||||
if (dEq0(prm%n_slip)) extmsg = trim(extmsg)//'n_slip ' ! ToDo: negative values ok?
|
if (prm%n_slip <= 0.0_pReal) extmsg = trim(extmsg)//' n_slip'
|
||||||
if (any(prm%xi_slip_0 <= 0.0_pReal)) extmsg = trim(extmsg)//'xi_slip_0 '
|
if (any(prm%xi_slip_0 <= 0.0_pReal)) extmsg = trim(extmsg)//' xi_slip_0'
|
||||||
if (any(prm%xi_slip_sat < prm%xi_slip_0)) extmsg = trim(extmsg)//'xi_slip_sat '
|
if (any(prm%xi_slip_sat < prm%xi_slip_0)) extmsg = trim(extmsg)//' xi_slip_sat'
|
||||||
else slipActive
|
else slipActive
|
||||||
allocate(prm%interaction_SlipSlip(0,0))
|
allocate(prm%interaction_SlipSlip(0,0))
|
||||||
allocate(prm%xi_slip_0(0))
|
allocate(prm%xi_slip_0(0))
|
||||||
|
@ -257,47 +246,48 @@ subroutine plastic_phenopowerlaw_init
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! twin related parameters
|
! twin related parameters
|
||||||
prm%Ntwin = config_phase(p)%getInts('ntwin', defaultVal=emptyIntArray)
|
prm%Ntwin = config%getInts('ntwin', defaultVal=emptyIntArray)
|
||||||
prm%totalNtwin = sum(prm%Ntwin)
|
prm%totalNtwin = sum(prm%Ntwin)
|
||||||
twinActive: if (prm%totalNtwin > 0_pInt) then
|
twinActive: if (prm%totalNtwin > 0_pInt) then
|
||||||
prm%Schmid_twin = lattice_SchmidMatrix_twin(prm%Ntwin,structure(1:3),&
|
prm%Schmid_twin = lattice_SchmidMatrix_twin(prm%Ntwin,structure(1:3),&
|
||||||
config_phase(p)%getFloat('c/a',defaultVal=0.0_pReal))
|
config%getFloat('c/a',defaultVal=0.0_pReal))
|
||||||
prm%interaction_TwinTwin = lattice_interaction_TwinTwin(prm%Ntwin,&
|
prm%interaction_TwinTwin = lattice_interaction_TwinTwin(prm%Ntwin,&
|
||||||
config_phase(p)%getFloats('interaction_twintwin'), &
|
config%getFloats('interaction_twintwin'), &
|
||||||
structure(1:3))
|
structure(1:3))
|
||||||
prm%gamma_twin_char = lattice_characteristicShear_twin(prm%Ntwin,structure(1:3),&
|
prm%gamma_twin_char = lattice_characteristicShear_twin(prm%Ntwin,structure(1:3),&
|
||||||
config_phase(p)%getFloat('c/a'))
|
config%getFloat('c/a'))
|
||||||
|
|
||||||
prm%xi_twin_0 = config_phase(p)%getFloats('tau0_twin',requiredShape=shape(prm%Ntwin))
|
prm%xi_twin_0 = config%getFloats('tau0_twin',requiredSize=size(prm%Ntwin))
|
||||||
|
|
||||||
prm%gdot0_twin = config_phase(p)%getFloat('gdot0_twin')
|
prm%gdot0_twin = config%getFloat('gdot0_twin')
|
||||||
prm%n_twin = config_phase(p)%getFloat('n_twin')
|
prm%n_twin = config%getFloat('n_twin')
|
||||||
prm%spr = config_phase(p)%getFloat('s_pr')
|
prm%spr = config%getFloat('s_pr')
|
||||||
prm%h0_TwinTwin = config_phase(p)%getFloat('h0_twintwin')
|
prm%h0_TwinTwin = config%getFloat('h0_twintwin')
|
||||||
|
|
||||||
! expand: family => system
|
! expand: family => system
|
||||||
prm%xi_twin_0 = math_expand(prm%xi_twin_0, prm%Ntwin)
|
prm%xi_twin_0 = math_expand(prm%xi_twin_0, prm%Ntwin)
|
||||||
|
|
||||||
! sanity checks
|
! sanity checks
|
||||||
if (prm%gdot0_twin <= 0.0_pReal) extmsg = trim(extmsg)//'gdot0_twin '
|
if (prm%gdot0_twin <= 0.0_pReal) extmsg = trim(extmsg)//' gdot0_twin'
|
||||||
if (dEq0(prm%n_twin)) extmsg = trim(extmsg)//'n_twin ' ! ToDo: negative values ok?
|
if (prm%n_twin <= 0.0_pReal) extmsg = trim(extmsg)//' n_twin'
|
||||||
else twinActive
|
else twinActive
|
||||||
allocate(prm%interaction_TwinTwin(0,0))
|
allocate(prm%interaction_TwinTwin(0,0))
|
||||||
allocate(prm%xi_twin_0(0))
|
allocate(prm%xi_twin_0(0))
|
||||||
|
allocate(prm%gamma_twin_char(0))
|
||||||
endif twinActive
|
endif twinActive
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! slip-twin related parameters
|
! slip-twin related parameters
|
||||||
slipAndTwinActive: if (prm%totalNslip > 0_pInt .and. prm%totalNtwin > 0_pInt) then
|
slipAndTwinActive: if (prm%totalNslip > 0_pInt .and. prm%totalNtwin > 0_pInt) then
|
||||||
prm%interaction_SlipTwin = lattice_interaction_SlipTwin(prm%Nslip,prm%Ntwin,&
|
prm%interaction_SlipTwin = lattice_interaction_SlipTwin(prm%Nslip,prm%Ntwin,&
|
||||||
config_phase(p)%getFloats('interaction_sliptwin'), &
|
config%getFloats('interaction_sliptwin'), &
|
||||||
structure(1:3))
|
structure(1:3))
|
||||||
prm%interaction_TwinSlip = lattice_interaction_TwinSlip(prm%Ntwin,prm%Nslip,&
|
prm%interaction_TwinSlip = lattice_interaction_TwinSlip(prm%Ntwin,prm%Nslip,&
|
||||||
config_phase(p)%getFloats('interaction_twinslip'), &
|
config%getFloats('interaction_twinslip'), &
|
||||||
structure(1:3))
|
structure(1:3))
|
||||||
else slipAndTwinActive
|
else slipAndTwinActive
|
||||||
allocate(prm%interaction_SlipTwin(prm%totalNslip,prm%TotalNtwin)) ! at least one dimension is 0
|
allocate(prm%interaction_SlipTwin(prm%totalNslip,prm%TotalNtwin)) ! at least one dimension is 0
|
||||||
allocate(prm%interaction_TwinSlip(prm%totalNtwin,prm%TotalNslip)) ! at least one dimension is 0
|
allocate(prm%interaction_TwinSlip(prm%totalNtwin,prm%TotalNslip)) ! at least one dimension is 0
|
||||||
prm%h0_TwinSlip = 0.0_pReal
|
prm%h0_TwinSlip = 0.0_pReal
|
||||||
endif slipAndTwinActive
|
endif slipAndTwinActive
|
||||||
|
|
||||||
|
@ -308,66 +298,59 @@ subroutine plastic_phenopowerlaw_init
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! output pararameters
|
! output pararameters
|
||||||
outputs = config_phase(p)%getStrings('(output)',defaultVal=emptyStringArray)
|
outputs = config%getStrings('(output)',defaultVal=emptyStringArray)
|
||||||
allocate(prm%outputID(0))
|
allocate(prm%outputID(0))
|
||||||
do i=1_pInt, size(outputs)
|
do i=1_pInt, size(outputs)
|
||||||
outputID = undefined_ID
|
outputID = undefined_ID
|
||||||
select case(outputs(i))
|
select case(outputs(i))
|
||||||
case ('resistance_slip')
|
|
||||||
outputID = merge(resistance_slip_ID,undefined_ID,prm%totalNslip>0_pInt)
|
|
||||||
outputSize = prm%totalNslip
|
|
||||||
case ('accumulatedshear_slip')
|
|
||||||
outputID = merge(accumulatedshear_slip_ID,undefined_ID,prm%totalNslip>0_pInt)
|
|
||||||
outputSize = prm%totalNslip
|
|
||||||
case ('shearrate_slip')
|
|
||||||
outputID = merge(shearrate_slip_ID,undefined_ID,prm%totalNslip>0_pInt)
|
|
||||||
outputSize = prm%totalNslip
|
|
||||||
case ('resolvedstress_slip')
|
|
||||||
outputID = merge(resolvedstress_slip_ID,undefined_ID,prm%totalNslip>0_pInt)
|
|
||||||
outputSize = prm%totalNslip
|
|
||||||
|
|
||||||
case ('resistance_twin')
|
case ('resistance_slip')
|
||||||
outputID = merge(resistance_twin_ID,undefined_ID,prm%totalNtwin>0_pInt)
|
outputID = merge(resistance_slip_ID,undefined_ID,prm%totalNslip>0_pInt)
|
||||||
outputSize = prm%totalNtwin
|
outputSize = prm%totalNslip
|
||||||
case ('accumulatedshear_twin')
|
case ('accumulatedshear_slip')
|
||||||
outputID = merge(accumulatedshear_twin_ID,undefined_ID,prm%totalNtwin>0_pInt)
|
outputID = merge(accumulatedshear_slip_ID,undefined_ID,prm%totalNslip>0_pInt)
|
||||||
outputSize = prm%totalNtwin
|
outputSize = prm%totalNslip
|
||||||
case ('shearrate_twin')
|
case ('shearrate_slip')
|
||||||
outputID = merge(shearrate_twin_ID,undefined_ID,prm%totalNtwin>0_pInt)
|
outputID = merge(shearrate_slip_ID,undefined_ID,prm%totalNslip>0_pInt)
|
||||||
outputSize = prm%totalNtwin
|
outputSize = prm%totalNslip
|
||||||
case ('resolvedstress_twin')
|
case ('resolvedstress_slip')
|
||||||
outputID = merge(resolvedstress_twin_ID,undefined_ID,prm%totalNtwin>0_pInt)
|
outputID = merge(resolvedstress_slip_ID,undefined_ID,prm%totalNslip>0_pInt)
|
||||||
outputSize = prm%totalNtwin
|
outputSize = prm%totalNslip
|
||||||
|
|
||||||
case ('totalshear')
|
case ('resistance_twin')
|
||||||
outputID = merge(totalshear_ID,undefined_ID,prm%totalNslip>0_pInt)
|
outputID = merge(resistance_twin_ID,undefined_ID,prm%totalNtwin>0_pInt)
|
||||||
outputSize = 1_pInt
|
outputSize = prm%totalNtwin
|
||||||
case ('totalvolfrac_twin')
|
case ('accumulatedshear_twin')
|
||||||
outputID = merge(totalvolfrac_twin_ID,undefined_ID,prm%totalNtwin>0_pInt)
|
outputID = merge(accumulatedshear_twin_ID,undefined_ID,prm%totalNtwin>0_pInt)
|
||||||
outputSize = 1_pInt
|
outputSize = prm%totalNtwin
|
||||||
end select
|
case ('shearrate_twin')
|
||||||
|
outputID = merge(shearrate_twin_ID,undefined_ID,prm%totalNtwin>0_pInt)
|
||||||
|
outputSize = prm%totalNtwin
|
||||||
|
case ('resolvedstress_twin')
|
||||||
|
outputID = merge(resolvedstress_twin_ID,undefined_ID,prm%totalNtwin>0_pInt)
|
||||||
|
outputSize = prm%totalNtwin
|
||||||
|
|
||||||
if (outputID /= undefined_ID) then
|
end select
|
||||||
plastic_phenopowerlaw_output(i,phase_plasticityInstance(p)) = outputs(i)
|
|
||||||
plastic_phenopowerlaw_sizePostResult(i,phase_plasticityInstance(p)) = outputSize
|
|
||||||
prm%outputID = [prm%outputID , outputID]
|
|
||||||
endif
|
|
||||||
|
|
||||||
end do
|
if (outputID /= undefined_ID) then
|
||||||
|
plastic_phenopowerlaw_output(i,phase_plasticityInstance(p)) = outputs(i)
|
||||||
|
plastic_phenopowerlaw_sizePostResult(i,phase_plasticityInstance(p)) = outputSize
|
||||||
|
prm%outputID = [prm%outputID, outputID]
|
||||||
|
endif
|
||||||
|
|
||||||
|
enddo
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! allocate state arrays
|
! allocate state arrays
|
||||||
NipcMyPhase = count(material_phase == p) ! number of IPCs containing my phase
|
NipcMyPhase = count(material_phase == p)
|
||||||
sizeState = size(['tau_slip ','gamma_slip']) * prm%TotalNslip &
|
sizeDotState = size(['tau_slip ','gamma_slip']) * prm%TotalNslip &
|
||||||
+ size(['tau_twin ','gamma_twin']) * prm%TotalNtwin &
|
+ size(['tau_twin ','gamma_twin']) * prm%TotalNtwin
|
||||||
+ size(['sum(gamma)','sum(f) ']) ! ToDo: only needed if either twin or slip active!
|
sizeState = sizeDotState
|
||||||
sizeDotState = sizeState
|
|
||||||
|
|
||||||
call material_allocatePlasticState(p,NipcMyPhase,sizeState,sizeDotState,0_pInt, &
|
call material_allocatePlasticState(p,NipcMyPhase,sizeState,sizeDotState,0_pInt, &
|
||||||
prm%totalNslip,prm%totalNtwin,0_pInt)
|
prm%totalNslip,prm%totalNtwin,0_pInt)
|
||||||
plasticState(p)%sizePostResults = sum(plastic_phenopowerlaw_sizePostResult(:,phase_plasticityInstance(p)))
|
plasticState(p)%sizePostResults = sum(plastic_phenopowerlaw_sizePostResult(:,phase_plasticityInstance(p)))
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! locally defined state aliases and initialization of state0 and aTolState
|
! locally defined state aliases and initialization of state0 and aTolState
|
||||||
startIndex = 1_pInt
|
startIndex = 1_pInt
|
||||||
|
@ -384,18 +367,6 @@ subroutine plastic_phenopowerlaw_init
|
||||||
dot%xi_twin => plasticState(p)%dotState(startIndex:endIndex,:)
|
dot%xi_twin => plasticState(p)%dotState(startIndex:endIndex,:)
|
||||||
plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolResistance
|
plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolResistance
|
||||||
|
|
||||||
startIndex = endIndex + 1_pInt
|
|
||||||
endIndex = endIndex + 1_pInt
|
|
||||||
stt%sumGamma => plasticState(p)%state (startIndex,:)
|
|
||||||
dot%sumGamma => plasticState(p)%dotState(startIndex,:)
|
|
||||||
plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolShear
|
|
||||||
|
|
||||||
startIndex = endIndex + 1_pInt
|
|
||||||
endIndex = endIndex + 1_pInt
|
|
||||||
stt%sumF=>plasticState(p)%state (startIndex,:)
|
|
||||||
dot%sumF=>plasticState(p)%dotState(startIndex,:)
|
|
||||||
plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolTwinFrac
|
|
||||||
|
|
||||||
startIndex = endIndex + 1_pInt
|
startIndex = endIndex + 1_pInt
|
||||||
endIndex = endIndex + prm%totalNslip
|
endIndex = endIndex + prm%totalNslip
|
||||||
stt%gamma_slip => plasticState(p)%state (startIndex:endIndex,:)
|
stt%gamma_slip => plasticState(p)%state (startIndex:endIndex,:)
|
||||||
|
@ -411,10 +382,10 @@ subroutine plastic_phenopowerlaw_init
|
||||||
dot%gamma_twin => plasticState(p)%dotState(startIndex:endIndex,:)
|
dot%gamma_twin => plasticState(p)%dotState(startIndex:endIndex,:)
|
||||||
plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolShear
|
plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolShear
|
||||||
|
|
||||||
plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally
|
plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally
|
||||||
dot%whole => plasticState(p)%dotState
|
|
||||||
|
|
||||||
end associate
|
end associate
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
end subroutine plastic_phenopowerlaw_init
|
end subroutine plastic_phenopowerlaw_init
|
||||||
|
@ -422,11 +393,13 @@ end subroutine plastic_phenopowerlaw_init
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief calculates plastic velocity gradient and its tangent
|
!> @brief calculates plastic velocity gradient and its tangent
|
||||||
|
!> @details asumme that deformation by dislocation glide affects twinned and untwinned volume
|
||||||
|
! equally (Taylor assumption). Twinning happens only in untwinned volume (
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of)
|
pure subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of)
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
real(pReal), dimension(3,3), intent(out) :: &
|
real(pReal), dimension(3,3), intent(out) :: &
|
||||||
Lp !< plastic velocity gradient
|
Lp !< plastic velocity gradient
|
||||||
real(pReal), dimension(3,3,3,3), intent(out) :: &
|
real(pReal), dimension(3,3,3,3), intent(out) :: &
|
||||||
dLp_dMp !< derivative of Lp with respect to the Mandel stress
|
dLp_dMp !< derivative of Lp with respect to the Mandel stress
|
||||||
|
@ -444,34 +417,31 @@ subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of)
|
||||||
gdot_slip_pos,gdot_slip_neg
|
gdot_slip_pos,gdot_slip_neg
|
||||||
real(pReal), dimension(param(instance)%totalNtwin) :: &
|
real(pReal), dimension(param(instance)%totalNtwin) :: &
|
||||||
gdot_twin,dgdot_dtautwin
|
gdot_twin,dgdot_dtautwin
|
||||||
|
|
||||||
type(tParameters) :: prm
|
|
||||||
type(tPhenopowerlawState) :: stt
|
|
||||||
|
|
||||||
associate(prm => param(instance), stt => state(instance))
|
|
||||||
|
|
||||||
Lp = 0.0_pReal
|
Lp = 0.0_pReal
|
||||||
dLp_dMp = 0.0_pReal
|
dLp_dMp = 0.0_pReal
|
||||||
|
|
||||||
call kinetics_slip(prm,stt,of,Mp,gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg)
|
associate(prm => param(instance))
|
||||||
|
|
||||||
|
call kinetics_slip(Mp,instance,of,gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg)
|
||||||
slipSystems: do i = 1_pInt, prm%totalNslip
|
slipSystems: do i = 1_pInt, prm%totalNslip
|
||||||
Lp = Lp + (1.0_pReal-stt%sumF(of))*(gdot_slip_pos(i)+gdot_slip_neg(i))*prm%Schmid_slip(1:3,1:3,i)
|
Lp = Lp + (gdot_slip_pos(i)+gdot_slip_neg(i))*prm%Schmid_slip(1:3,1:3,i)
|
||||||
forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) &
|
forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) &
|
||||||
dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) &
|
dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) &
|
||||||
+ dgdot_dtauslip_pos(i) * prm%Schmid_slip(k,l,i) * prm%nonSchmid_pos(m,n,i) &
|
+ dgdot_dtauslip_pos(i) * prm%Schmid_slip(k,l,i) * prm%nonSchmid_pos(m,n,i) &
|
||||||
+ dgdot_dtauslip_neg(i) * prm%Schmid_slip(k,l,i) * prm%nonSchmid_neg(m,n,i)
|
+ dgdot_dtauslip_neg(i) * prm%Schmid_slip(k,l,i) * prm%nonSchmid_neg(m,n,i)
|
||||||
enddo slipSystems
|
enddo slipSystems
|
||||||
|
|
||||||
call kinetics_twin(prm,stt,of,Mp,gdot_twin,dgdot_dtautwin)
|
call kinetics_twin(Mp,instance,of,gdot_twin,dgdot_dtautwin)
|
||||||
twinSystems: do i = 1_pInt, prm%totalNtwin
|
twinSystems: do i = 1_pInt, prm%totalNtwin
|
||||||
Lp = Lp + gdot_twin(i)*prm%Schmid_twin(1:3,1:3,i)
|
Lp = Lp + gdot_twin(i)*prm%Schmid_twin(1:3,1:3,i)
|
||||||
forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) &
|
forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) &
|
||||||
dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) &
|
dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) &
|
||||||
+ dgdot_dtautwin(i)*prm%Schmid_twin(k,l,i)*prm%Schmid_twin(m,n,i)
|
+ dgdot_dtautwin(i)*prm%Schmid_twin(k,l,i)*prm%Schmid_twin(m,n,i)
|
||||||
enddo twinSystems
|
enddo twinSystems
|
||||||
|
|
||||||
end associate
|
end associate
|
||||||
|
|
||||||
|
|
||||||
end subroutine plastic_phenopowerlaw_LpAndItsTangent
|
end subroutine plastic_phenopowerlaw_LpAndItsTangent
|
||||||
|
|
||||||
|
|
||||||
|
@ -483,7 +453,7 @@ subroutine plastic_phenopowerlaw_dotState(Mp,instance,of)
|
||||||
implicit none
|
implicit none
|
||||||
real(pReal), dimension(3,3), intent(in) :: &
|
real(pReal), dimension(3,3), intent(in) :: &
|
||||||
Mp !< Mandel stress
|
Mp !< Mandel stress
|
||||||
integer(pInt), intent(in) :: &
|
integer(pInt), intent(in) :: &
|
||||||
instance, &
|
instance, &
|
||||||
of
|
of
|
||||||
|
|
||||||
|
@ -491,47 +461,41 @@ subroutine plastic_phenopowerlaw_dotState(Mp,instance,of)
|
||||||
i
|
i
|
||||||
real(pReal) :: &
|
real(pReal) :: &
|
||||||
c_SlipSlip,c_TwinSlip,c_TwinTwin, &
|
c_SlipSlip,c_TwinSlip,c_TwinTwin, &
|
||||||
xi_slip_sat_offset
|
xi_slip_sat_offset,&
|
||||||
|
sumGamma,sumF
|
||||||
real(pReal), dimension(param(instance)%totalNslip) :: &
|
real(pReal), dimension(param(instance)%totalNslip) :: &
|
||||||
left_SlipSlip,right_SlipSlip, &
|
left_SlipSlip,right_SlipSlip, &
|
||||||
gdot_slip_pos,gdot_slip_neg
|
gdot_slip_pos,gdot_slip_neg
|
||||||
|
|
||||||
type(tParameters) :: prm
|
|
||||||
type(tPhenopowerlawState) :: dot,stt
|
|
||||||
|
|
||||||
associate(prm => param(instance), stt => state(instance), dot => dotState(instance))
|
associate(prm => param(instance), stt => state(instance), dot => dotState(instance))
|
||||||
|
|
||||||
dot%whole(:,of) = 0.0_pReal
|
sumGamma = sum(stt%gamma_slip(:,of))
|
||||||
|
sumF = sum(stt%gamma_twin(:,of)/prm%gamma_twin_char)
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! system-independent (nonlinear) prefactors to M_Xx (X influenced by x) matrices
|
! system-independent (nonlinear) prefactors to M_Xx (X influenced by x) matrices
|
||||||
c_SlipSlip = prm%h0_slipslip * (1.0_pReal + prm%twinC*stt%sumF(of)** prm%twinB)
|
c_SlipSlip = prm%h0_slipslip * (1.0_pReal + prm%twinC*sumF** prm%twinB)
|
||||||
c_TwinSlip = prm%h0_TwinSlip * stt%sumGamma(of)**prm%twinE
|
c_TwinSlip = prm%h0_TwinSlip * sumGamma**prm%twinE
|
||||||
c_TwinTwin = prm%h0_TwinTwin * stt%sumF(of)**prm%twinD
|
c_TwinTwin = prm%h0_TwinTwin * sumF**prm%twinD
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! calculate left and right vectors
|
! calculate left and right vectors
|
||||||
left_SlipSlip = 1.0_pReal + prm%H_int
|
left_SlipSlip = 1.0_pReal + prm%H_int
|
||||||
xi_slip_sat_offset = prm%spr*sqrt(stt%sumF(of))
|
xi_slip_sat_offset = prm%spr*sqrt(sumF)
|
||||||
right_SlipSlip = abs(1.0_pReal-stt%xi_slip(:,of) / (prm%xi_slip_sat+xi_slip_sat_offset)) **prm%a_slip &
|
right_SlipSlip = abs(1.0_pReal-stt%xi_slip(:,of) / (prm%xi_slip_sat+xi_slip_sat_offset)) **prm%a_slip &
|
||||||
* sign(1.0_pReal,1.0_pReal-stt%xi_slip(:,of) / (prm%xi_slip_sat+xi_slip_sat_offset))
|
* sign(1.0_pReal,1.0_pReal-stt%xi_slip(:,of) / (prm%xi_slip_sat+xi_slip_sat_offset))
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! shear rates
|
! shear rates
|
||||||
call kinetics_slip(prm,stt,of,Mp,gdot_slip_pos,gdot_slip_neg)
|
call kinetics_slip(Mp,instance,of,gdot_slip_pos,gdot_slip_neg)
|
||||||
dot%gamma_slip(:,of) = abs(gdot_slip_pos+gdot_slip_neg)
|
dot%gamma_slip(:,of) = abs(gdot_slip_pos+gdot_slip_neg)
|
||||||
dot%sumGamma(of) = sum(dot%gamma_slip(:,of))
|
call kinetics_twin(Mp,instance,of,dot%gamma_twin(:,of))
|
||||||
call kinetics_twin(prm,stt,of,Mp,dot%gamma_twin(:,of))
|
|
||||||
if (prm%totalNtwin > 0_pInt) dot%sumF(of) = merge(sum(dot%gamma_twin(:,of)/prm%gamma_twin_char), &
|
|
||||||
0.0_pReal, &
|
|
||||||
stt%sumF(of) < 0.98_pReal)
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! hardening
|
! hardening
|
||||||
hardeningSlip: do i = 1_pInt, prm%totalNslip
|
hardeningSlip: do i = 1_pInt, prm%totalNslip
|
||||||
dot%xi_slip(i,of) = dot_product(prm%interaction_SlipSlip(i,:),right_SlipSlip*dot%gamma_slip(:,of)) &
|
dot%xi_slip(i,of) = dot_product(prm%interaction_SlipSlip(i,:),right_SlipSlip*dot%gamma_slip(:,of)) &
|
||||||
* c_SlipSlip * left_SlipSlip(i) &
|
* c_SlipSlip * left_SlipSlip(i) &
|
||||||
+ dot_product(prm%interaction_SlipTwin(i,:),dot%gamma_twin(:,of))
|
+ dot_product(prm%interaction_SlipTwin(i,:),dot%gamma_twin(:,of))
|
||||||
enddo hardeningSlip
|
enddo hardeningSlip
|
||||||
|
|
||||||
|
@ -546,39 +510,136 @@ end subroutine plastic_phenopowerlaw_dotState
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief calculates shear rates on slip systems and derivatives with respect to resolved stress
|
!> @brief return array of constitutive results
|
||||||
!> @details: Shear rates are calculated only optionally. NOTE: Against the common convention, the
|
|
||||||
!> result (i.e. intent(out)) variables are the last to have the optional arguments at the end
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
pure subroutine kinetics_slip(prm,stt,of,Mp,gdot_slip_pos,gdot_slip_neg, &
|
function plastic_phenopowerlaw_postResults(Mp,instance,of) result(postResults)
|
||||||
dgdot_dtau_slip_pos,dgdot_dtau_slip_neg)
|
|
||||||
use prec, only: &
|
|
||||||
dNeq0
|
|
||||||
use math, only: &
|
use math, only: &
|
||||||
math_mul33xx33
|
math_mul33xx33
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
type(tParameters), intent(in) :: &
|
real(pReal), dimension(3,3), intent(in) :: &
|
||||||
prm
|
Mp !< Mandel stress
|
||||||
type(tPhenopowerlawState), intent(in) :: &
|
integer(pInt), intent(in) :: &
|
||||||
stt
|
instance, &
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
of
|
of
|
||||||
real(pReal), dimension(prm%totalNslip), intent(out) :: &
|
|
||||||
|
real(pReal), dimension(sum(plastic_phenopowerlaw_sizePostResult(:,instance))) :: &
|
||||||
|
postResults
|
||||||
|
|
||||||
|
integer(pInt) :: &
|
||||||
|
o,c,i
|
||||||
|
real(pReal), dimension(param(instance)%totalNslip) :: &
|
||||||
|
gdot_slip_pos,gdot_slip_neg
|
||||||
|
|
||||||
|
c = 0_pInt
|
||||||
|
|
||||||
|
associate(prm => param(instance), stt => state(instance))
|
||||||
|
|
||||||
|
outputsLoop: do o = 1_pInt,size(prm%outputID)
|
||||||
|
select case(prm%outputID(o))
|
||||||
|
|
||||||
|
case (resistance_slip_ID)
|
||||||
|
postResults(c+1_pInt:c+prm%totalNslip) = stt%xi_slip(1:prm%totalNslip,of)
|
||||||
|
c = c + prm%totalNslip
|
||||||
|
case (accumulatedshear_slip_ID)
|
||||||
|
postResults(c+1_pInt:c+prm%totalNslip) = stt%gamma_slip(1:prm%totalNslip,of)
|
||||||
|
c = c + prm%totalNslip
|
||||||
|
case (shearrate_slip_ID)
|
||||||
|
call kinetics_slip(Mp,instance,of,gdot_slip_pos,gdot_slip_neg)
|
||||||
|
postResults(c+1_pInt:c+prm%totalNslip) = gdot_slip_pos+gdot_slip_neg
|
||||||
|
c = c + prm%totalNslip
|
||||||
|
case (resolvedstress_slip_ID)
|
||||||
|
do i = 1_pInt, prm%totalNslip
|
||||||
|
postResults(c+i) = math_mul33xx33(Mp,prm%Schmid_slip(1:3,1:3,i))
|
||||||
|
enddo
|
||||||
|
c = c + prm%totalNslip
|
||||||
|
|
||||||
|
case (resistance_twin_ID)
|
||||||
|
postResults(c+1_pInt:c+prm%totalNtwin) = stt%xi_twin(1:prm%totalNtwin,of)
|
||||||
|
c = c + prm%totalNtwin
|
||||||
|
case (accumulatedshear_twin_ID)
|
||||||
|
postResults(c+1_pInt:c+prm%totalNtwin) = stt%gamma_twin(1:prm%totalNtwin,of)
|
||||||
|
c = c + prm%totalNtwin
|
||||||
|
case (shearrate_twin_ID)
|
||||||
|
call kinetics_twin(Mp,instance,of,postResults(c+1_pInt:c+prm%totalNtwin))
|
||||||
|
c = c + prm%totalNtwin
|
||||||
|
case (resolvedstress_twin_ID)
|
||||||
|
do i = 1_pInt, prm%totalNtwin
|
||||||
|
postResults(c+i) = math_mul33xx33(Mp,prm%Schmid_twin(1:3,1:3,i))
|
||||||
|
enddo
|
||||||
|
c = c + prm%totalNtwin
|
||||||
|
|
||||||
|
end select
|
||||||
|
enddo outputsLoop
|
||||||
|
|
||||||
|
end associate
|
||||||
|
|
||||||
|
end function plastic_phenopowerlaw_postResults
|
||||||
|
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
!> @brief writes results to HDF5 output file
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
subroutine plastic_phenopowerlaw_results(instance,group)
|
||||||
|
#if defined(PETSc) || defined(DAMASKHDF5)
|
||||||
|
use results
|
||||||
|
|
||||||
|
implicit none
|
||||||
|
integer(pInt), intent(in) :: instance
|
||||||
|
character(len=*) :: group
|
||||||
|
integer(pInt) :: o
|
||||||
|
|
||||||
|
associate(prm => param(instance), stt => state(instance))
|
||||||
|
outputsLoop: do o = 1_pInt,size(prm%outputID)
|
||||||
|
select case(prm%outputID(o))
|
||||||
|
case (resistance_slip_ID)
|
||||||
|
call results_writeVectorDataset(group,stt%xi_slip,'xi_slip','Pa')
|
||||||
|
case (accumulatedshear_slip_ID)
|
||||||
|
call results_writeVectorDataset(group,stt%gamma_slip,'gamma_slip','1/s')
|
||||||
|
end select
|
||||||
|
enddo outputsLoop
|
||||||
|
end associate
|
||||||
|
#else
|
||||||
|
integer(pInt), intent(in) :: instance
|
||||||
|
character(len=*) :: group
|
||||||
|
#endif
|
||||||
|
end subroutine plastic_phenopowerlaw_results
|
||||||
|
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
!> @brief Shear rates on slip systems and their derivatives with respect to resolved stress
|
||||||
|
!> @details Derivatives are calculated only optionally.
|
||||||
|
! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to
|
||||||
|
! have the optional arguments at the end
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
pure subroutine kinetics_slip(Mp,instance,of, &
|
||||||
|
gdot_slip_pos,gdot_slip_neg,dgdot_dtau_slip_pos,dgdot_dtau_slip_neg)
|
||||||
|
use prec, only: &
|
||||||
|
dNeq0
|
||||||
|
use math, only: &
|
||||||
|
math_mul33xx33
|
||||||
|
|
||||||
|
implicit none
|
||||||
|
real(pReal), dimension(3,3), intent(in) :: &
|
||||||
|
Mp !< Mandel stress
|
||||||
|
integer(pInt), intent(in) :: &
|
||||||
|
instance, &
|
||||||
|
of
|
||||||
|
|
||||||
|
real(pReal), intent(out), dimension(param(instance)%totalNslip) :: &
|
||||||
gdot_slip_pos, &
|
gdot_slip_pos, &
|
||||||
gdot_slip_neg
|
gdot_slip_neg
|
||||||
real(pReal), dimension(prm%totalNslip), optional, intent(out) :: &
|
real(pReal), intent(out), optional, dimension(param(instance)%totalNslip) :: &
|
||||||
dgdot_dtau_slip_pos, &
|
dgdot_dtau_slip_pos, &
|
||||||
dgdot_dtau_slip_neg
|
dgdot_dtau_slip_neg
|
||||||
real(pReal), dimension(3,3), intent(in) :: &
|
real(pReal), dimension(param(instance)%totalNslip) :: &
|
||||||
Mp
|
|
||||||
|
|
||||||
real(pReal), dimension(prm%totalNslip) :: &
|
|
||||||
tau_slip_pos, &
|
tau_slip_pos, &
|
||||||
tau_slip_neg
|
tau_slip_neg
|
||||||
integer(pInt) :: i
|
integer(pInt) :: i
|
||||||
logical :: nonSchmidActive
|
logical :: nonSchmidActive
|
||||||
|
|
||||||
|
associate(prm => param(instance), stt => state(instance))
|
||||||
|
|
||||||
nonSchmidActive = size(prm%nonSchmidCoeff) > 0_pInt
|
nonSchmidActive = size(prm%nonSchmidCoeff) > 0_pInt
|
||||||
|
|
||||||
do i = 1_pInt, prm%totalNslip
|
do i = 1_pInt, prm%totalNslip
|
||||||
|
@ -615,45 +676,50 @@ pure subroutine kinetics_slip(prm,stt,of,Mp,gdot_slip_pos,gdot_slip_neg, &
|
||||||
dgdot_dtau_slip_neg = 0.0_pReal
|
dgdot_dtau_slip_neg = 0.0_pReal
|
||||||
end where
|
end where
|
||||||
endif
|
endif
|
||||||
|
end associate
|
||||||
|
|
||||||
end subroutine kinetics_slip
|
end subroutine kinetics_slip
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief calculates shear rates on twin systems and derivatives with respect to resolved stress
|
!> @brief Shear rates on twin systems and their derivatives with respect to resolved stress.
|
||||||
!> @details: Shear rates are calculated only optionally. NOTE: Against the common convention, the
|
! twinning is assumed to take place only in untwinned volume.
|
||||||
!> result (i.e. intent(out)) variables are the last to have the optional arguments at the end
|
!> @details Derivates are calculated only optionally.
|
||||||
|
! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to
|
||||||
|
! have the optional arguments at the end.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
pure subroutine kinetics_twin(prm,stt,of,Mp,gdot_twin,dgdot_dtau_twin)
|
pure subroutine kinetics_twin(Mp,instance,of,&
|
||||||
|
gdot_twin,dgdot_dtau_twin)
|
||||||
use prec, only: &
|
use prec, only: &
|
||||||
dNeq0
|
dNeq0
|
||||||
use math, only: &
|
use math, only: &
|
||||||
math_mul33xx33
|
math_mul33xx33
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
type(tParameters), intent(in) :: &
|
real(pReal), dimension(3,3), intent(in) :: &
|
||||||
prm
|
Mp !< Mandel stress
|
||||||
type(tPhenopowerlawState), intent(in) :: &
|
integer(pInt), intent(in) :: &
|
||||||
stt
|
instance, &
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
of
|
of
|
||||||
real(pReal), dimension(3,3), intent(in) :: &
|
|
||||||
Mp
|
real(pReal), dimension(param(instance)%totalNtwin), intent(out) :: &
|
||||||
real(pReal), dimension(prm%totalNtwin), intent(out) :: &
|
|
||||||
gdot_twin
|
gdot_twin
|
||||||
real(pReal), dimension(prm%totalNtwin), optional, intent(out) :: &
|
real(pReal), dimension(param(instance)%totalNtwin), intent(out), optional :: &
|
||||||
dgdot_dtau_twin
|
dgdot_dtau_twin
|
||||||
|
|
||||||
real(pReal), dimension(prm%totalNtwin) :: &
|
real(pReal), dimension(param(instance)%totalNtwin) :: &
|
||||||
tau_twin
|
tau_twin
|
||||||
integer(pInt) :: i
|
integer(pInt) :: i
|
||||||
|
|
||||||
|
associate(prm => param(instance), stt => state(instance))
|
||||||
|
|
||||||
do i = 1_pInt, prm%totalNtwin
|
do i = 1_pInt, prm%totalNtwin
|
||||||
tau_twin(i) = math_mul33xx33(Mp,prm%Schmid_twin(1:3,1:3,i))
|
tau_twin(i) = math_mul33xx33(Mp,prm%Schmid_twin(1:3,1:3,i))
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
where(tau_twin > 0.0_pReal)
|
where(tau_twin > 0.0_pReal)
|
||||||
gdot_twin = (1.0_pReal-stt%sumF(of))*prm%gdot0_twin*(abs(tau_twin)/stt%xi_twin(:,of))**prm%n_twin
|
gdot_twin = (1.0_pReal-sum(stt%gamma_twin(:,of)/prm%gamma_twin_char)) & ! only twin in untwinned volume fraction
|
||||||
|
* prm%gdot0_twin*(abs(tau_twin)/stt%xi_twin(:,of))**prm%n_twin
|
||||||
else where
|
else where
|
||||||
gdot_twin = 0.0_pReal
|
gdot_twin = 0.0_pReal
|
||||||
end where
|
end where
|
||||||
|
@ -665,113 +731,9 @@ pure subroutine kinetics_twin(prm,stt,of,Mp,gdot_twin,dgdot_dtau_twin)
|
||||||
dgdot_dtau_twin = 0.0_pReal
|
dgdot_dtau_twin = 0.0_pReal
|
||||||
end where
|
end where
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
end associate
|
||||||
|
|
||||||
end subroutine kinetics_twin
|
end subroutine kinetics_twin
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief return array of constitutive results
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
function plastic_phenopowerlaw_postResults(Mp,instance,of) result(postResults)
|
|
||||||
use math, only: &
|
|
||||||
math_mul33xx33
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
real(pReal), dimension(3,3), intent(in) :: &
|
|
||||||
Mp !< Mandel stress
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
instance, &
|
|
||||||
of
|
|
||||||
|
|
||||||
real(pReal), dimension(sum(plastic_phenopowerlaw_sizePostResult(:,instance))) :: &
|
|
||||||
postResults
|
|
||||||
|
|
||||||
integer(pInt) :: &
|
|
||||||
o,c,i
|
|
||||||
real(pReal), dimension(param(instance)%totalNslip) :: &
|
|
||||||
gdot_slip_pos,gdot_slip_neg
|
|
||||||
|
|
||||||
type(tParameters) :: prm
|
|
||||||
type(tPhenopowerlawState) :: stt
|
|
||||||
|
|
||||||
associate( prm => param(instance), stt => state(instance))
|
|
||||||
|
|
||||||
postResults = 0.0_pReal
|
|
||||||
c = 0_pInt
|
|
||||||
|
|
||||||
outputsLoop: do o = 1_pInt,size(prm%outputID)
|
|
||||||
select case(prm%outputID(o))
|
|
||||||
|
|
||||||
case (resistance_slip_ID)
|
|
||||||
postResults(c+1_pInt:c+prm%totalNslip) = stt%xi_slip(1:prm%totalNslip,of)
|
|
||||||
c = c + prm%totalNslip
|
|
||||||
case (accumulatedshear_slip_ID)
|
|
||||||
postResults(c+1_pInt:c+prm%totalNslip) = stt%gamma_slip(1:prm%totalNslip,of)
|
|
||||||
c = c + prm%totalNslip
|
|
||||||
case (shearrate_slip_ID)
|
|
||||||
call kinetics_slip(prm,stt,of,Mp,gdot_slip_pos,gdot_slip_neg)
|
|
||||||
postResults(c+1_pInt:c+prm%totalNslip) = gdot_slip_pos+gdot_slip_neg
|
|
||||||
c = c + prm%totalNslip
|
|
||||||
case (resolvedstress_slip_ID)
|
|
||||||
do i = 1_pInt, prm%totalNslip
|
|
||||||
postResults(c+i) = math_mul33xx33(Mp,prm%Schmid_slip(1:3,1:3,i))
|
|
||||||
enddo
|
|
||||||
c = c + prm%totalNslip
|
|
||||||
|
|
||||||
case (resistance_twin_ID)
|
|
||||||
postResults(c+1_pInt:c+prm%totalNtwin) = stt%xi_twin(1:prm%totalNtwin,of)
|
|
||||||
c = c + prm%totalNtwin
|
|
||||||
case (accumulatedshear_twin_ID)
|
|
||||||
postResults(c+1_pInt:c+prm%totalNtwin) = stt%gamma_twin(1:prm%totalNtwin,of)
|
|
||||||
c = c + prm%totalNtwin
|
|
||||||
case (shearrate_twin_ID)
|
|
||||||
call kinetics_twin(prm,stt,of,Mp,postResults(c+1_pInt:c+prm%totalNtwin))
|
|
||||||
c = c + prm%totalNtwin
|
|
||||||
case (resolvedstress_twin_ID)
|
|
||||||
do i = 1_pInt, prm%totalNtwin
|
|
||||||
postResults(c+i) = math_mul33xx33(Mp,prm%Schmid_twin(1:3,1:3,i))
|
|
||||||
enddo
|
|
||||||
c = c + prm%totalNtwin
|
|
||||||
|
|
||||||
case (totalshear_ID)
|
|
||||||
postResults(c+1_pInt) = stt%sumGamma(of)
|
|
||||||
c = c + 1_pInt
|
|
||||||
case (totalvolfrac_twin_ID)
|
|
||||||
postResults(c+1_pInt) = stt%sumF(of)
|
|
||||||
c = c + 1_pInt
|
|
||||||
|
|
||||||
end select
|
|
||||||
enddo outputsLoop
|
|
||||||
end associate
|
|
||||||
|
|
||||||
end function plastic_phenopowerlaw_postResults
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief writes results to HDF5 output file
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine plastic_phenopowerlaw_results(instance,group)
|
|
||||||
#if defined(PETSc) || defined(DAMASKHDF5)
|
|
||||||
use results
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: instance
|
|
||||||
character(len=*) :: group
|
|
||||||
integer(pInt) :: o
|
|
||||||
|
|
||||||
associate(prm => param(instance), stt => state(instance))
|
|
||||||
outputsLoop: do o = 1_pInt,size(prm%outputID)
|
|
||||||
select case(prm%outputID(o))
|
|
||||||
case (resistance_slip_ID)
|
|
||||||
call results_writeVectorDataset(group,stt%xi_slip,'xi_slip','Pa')
|
|
||||||
case (accumulatedshear_slip_ID)
|
|
||||||
call results_writeVectorDataset(group,stt%gamma_slip,'gamma_slip','1/s')
|
|
||||||
end select
|
|
||||||
enddo outputsLoop
|
|
||||||
end associate
|
|
||||||
#else
|
|
||||||
integer(pInt), intent(in) :: instance
|
|
||||||
character(len=*) :: group
|
|
||||||
#endif
|
|
||||||
end subroutine plastic_phenopowerlaw_results
|
|
||||||
|
|
||||||
end module plastic_phenopowerlaw
|
end module plastic_phenopowerlaw
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
|
||||||
!> @brief material subroutine for constant porosity
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
module porosity_none
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
private
|
|
||||||
|
|
||||||
public :: &
|
|
||||||
porosity_none_init
|
|
||||||
|
|
||||||
contains
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief allocates all neccessary fields, reads information from material configuration file
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine porosity_none_init()
|
|
||||||
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
|
||||||
use, intrinsic :: iso_fortran_env, only: &
|
|
||||||
compiler_version, &
|
|
||||||
compiler_options
|
|
||||||
#endif
|
|
||||||
use prec, only: &
|
|
||||||
pReal, &
|
|
||||||
pInt
|
|
||||||
use IO, only: &
|
|
||||||
IO_timeStamp
|
|
||||||
use material
|
|
||||||
use config
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt) :: &
|
|
||||||
homog, &
|
|
||||||
NofMyHomog
|
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- porosity_'//POROSITY_none_label//' init -+>>>'
|
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
|
||||||
#include "compilation_info.f90"
|
|
||||||
|
|
||||||
initializeInstances: do homog = 1_pInt, material_Nhomogenization
|
|
||||||
|
|
||||||
myhomog: if (porosity_type(homog) == POROSITY_none_ID) then
|
|
||||||
NofMyHomog = count(material_homog == homog)
|
|
||||||
porosityState(homog)%sizeState = 0_pInt
|
|
||||||
porosityState(homog)%sizePostResults = 0_pInt
|
|
||||||
allocate(porosityState(homog)%state0 (0_pInt,NofMyHomog), source=0.0_pReal)
|
|
||||||
allocate(porosityState(homog)%subState0(0_pInt,NofMyHomog), source=0.0_pReal)
|
|
||||||
allocate(porosityState(homog)%state (0_pInt,NofMyHomog), source=0.0_pReal)
|
|
||||||
|
|
||||||
deallocate(porosity(homog)%p)
|
|
||||||
allocate (porosity(homog)%p(1), source=porosity_initialPhi(homog))
|
|
||||||
|
|
||||||
endif myhomog
|
|
||||||
enddo initializeInstances
|
|
||||||
|
|
||||||
|
|
||||||
end subroutine porosity_none_init
|
|
||||||
|
|
||||||
end module porosity_none
|
|
|
@ -1,448 +0,0 @@
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
|
||||||
!> @brief material subroutine for phase field modelling of pore nucleation and growth
|
|
||||||
!> @details phase field model for pore nucleation and growth based on vacancy clustering
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
module porosity_phasefield
|
|
||||||
use prec, only: &
|
|
||||||
pReal, &
|
|
||||||
pInt
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
private
|
|
||||||
integer(pInt), dimension(:), allocatable, public, protected :: &
|
|
||||||
porosity_phasefield_sizePostResults !< cumulative size of post results
|
|
||||||
|
|
||||||
integer(pInt), dimension(:,:), allocatable, target, public :: &
|
|
||||||
porosity_phasefield_sizePostResult !< size of each post result output
|
|
||||||
|
|
||||||
character(len=64), dimension(:,:), allocatable, target, public :: &
|
|
||||||
porosity_phasefield_output !< name of each post result output
|
|
||||||
|
|
||||||
integer(pInt), dimension(:), allocatable, target, public :: &
|
|
||||||
porosity_phasefield_Noutput !< number of outputs per instance of this porosity
|
|
||||||
|
|
||||||
enum, bind(c)
|
|
||||||
enumerator :: undefined_ID, &
|
|
||||||
porosity_ID
|
|
||||||
end enum
|
|
||||||
integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: &
|
|
||||||
porosity_phasefield_outputID !< ID of each post result output
|
|
||||||
|
|
||||||
|
|
||||||
public :: &
|
|
||||||
porosity_phasefield_init, &
|
|
||||||
porosity_phasefield_getFormationEnergy, &
|
|
||||||
porosity_phasefield_getSurfaceEnergy, &
|
|
||||||
porosity_phasefield_getSourceAndItsTangent, &
|
|
||||||
porosity_phasefield_getDiffusion33, &
|
|
||||||
porosity_phasefield_getMobility, &
|
|
||||||
porosity_phasefield_putPorosity, &
|
|
||||||
porosity_phasefield_postResults
|
|
||||||
|
|
||||||
contains
|
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief module initialization
|
|
||||||
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine porosity_phasefield_init(fileUnit)
|
|
||||||
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
|
||||||
use, intrinsic :: iso_fortran_env, only: &
|
|
||||||
compiler_version, &
|
|
||||||
compiler_options
|
|
||||||
#endif
|
|
||||||
use IO, only: &
|
|
||||||
IO_read, &
|
|
||||||
IO_lc, &
|
|
||||||
IO_getTag, &
|
|
||||||
IO_isBlank, &
|
|
||||||
IO_stringPos, &
|
|
||||||
IO_stringValue, &
|
|
||||||
IO_floatValue, &
|
|
||||||
IO_intValue, &
|
|
||||||
IO_warning, &
|
|
||||||
IO_error, &
|
|
||||||
IO_timeStamp, &
|
|
||||||
IO_EOF
|
|
||||||
use material, only: &
|
|
||||||
porosity_type, &
|
|
||||||
porosity_typeInstance, &
|
|
||||||
homogenization_Noutput, &
|
|
||||||
POROSITY_phasefield_label, &
|
|
||||||
POROSITY_phasefield_ID, &
|
|
||||||
material_homog, &
|
|
||||||
mappingHomogenization, &
|
|
||||||
porosityState, &
|
|
||||||
porosityMapping, &
|
|
||||||
porosity, &
|
|
||||||
porosity_initialPhi
|
|
||||||
use config, only: &
|
|
||||||
material_partHomogenization, &
|
|
||||||
material_partPhase
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: fileUnit
|
|
||||||
|
|
||||||
integer(pInt), allocatable, dimension(:) :: chunkPos
|
|
||||||
integer(pInt) :: maxNinstance,mySize=0_pInt,section,instance,o
|
|
||||||
integer(pInt) :: sizeState
|
|
||||||
integer(pInt) :: NofMyHomog
|
|
||||||
character(len=65536) :: &
|
|
||||||
tag = '', &
|
|
||||||
line = ''
|
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- porosity_'//POROSITY_phasefield_label//' init -+>>>'
|
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
|
||||||
#include "compilation_info.f90"
|
|
||||||
|
|
||||||
maxNinstance = int(count(porosity_type == POROSITY_phasefield_ID),pInt)
|
|
||||||
if (maxNinstance == 0_pInt) return
|
|
||||||
|
|
||||||
allocate(porosity_phasefield_sizePostResults(maxNinstance), source=0_pInt)
|
|
||||||
allocate(porosity_phasefield_sizePostResult (maxval(homogenization_Noutput),maxNinstance),source=0_pInt)
|
|
||||||
allocate(porosity_phasefield_output (maxval(homogenization_Noutput),maxNinstance))
|
|
||||||
porosity_phasefield_output = ''
|
|
||||||
allocate(porosity_phasefield_outputID (maxval(homogenization_Noutput),maxNinstance),source=undefined_ID)
|
|
||||||
allocate(porosity_phasefield_Noutput (maxNinstance), source=0_pInt)
|
|
||||||
|
|
||||||
rewind(fileUnit)
|
|
||||||
section = 0_pInt
|
|
||||||
do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= material_partHomogenization)! wind forward to <homogenization>
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
parsingHomog: do while (trim(line) /= IO_EOF) ! read through sections of homog part
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
|
||||||
if (IO_getTag(line,'<','>') /= '') then ! stop at next part
|
|
||||||
line = IO_read(fileUnit, .true.) ! reset IO_read
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
if (IO_getTag(line,'[',']') /= '') then ! next homog section
|
|
||||||
section = section + 1_pInt ! advance homog section counter
|
|
||||||
cycle ! skip to next line
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (section > 0_pInt ) then; if (porosity_type(section) == POROSITY_phasefield_ID) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
|
||||||
|
|
||||||
instance = porosity_typeInstance(section) ! which instance of my porosity is present homog
|
|
||||||
chunkPos = IO_stringPos(line)
|
|
||||||
tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key
|
|
||||||
select case(tag)
|
|
||||||
case ('(output)')
|
|
||||||
select case(IO_lc(IO_stringValue(line,chunkPos,2_pInt)))
|
|
||||||
case ('porosity')
|
|
||||||
porosity_phasefield_Noutput(instance) = porosity_phasefield_Noutput(instance) + 1_pInt
|
|
||||||
porosity_phasefield_outputID(porosity_phasefield_Noutput(instance),instance) = porosity_ID
|
|
||||||
porosity_phasefield_output(porosity_phasefield_Noutput(instance),instance) = &
|
|
||||||
IO_lc(IO_stringValue(line,chunkPos,2_pInt))
|
|
||||||
end select
|
|
||||||
|
|
||||||
end select
|
|
||||||
endif; endif
|
|
||||||
enddo parsingHomog
|
|
||||||
|
|
||||||
initializeInstances: do section = 1_pInt, size(porosity_type)
|
|
||||||
if (porosity_type(section) == POROSITY_phasefield_ID) then
|
|
||||||
NofMyHomog=count(material_homog==section)
|
|
||||||
instance = porosity_typeInstance(section)
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! Determine size of postResults array
|
|
||||||
outputsLoop: do o = 1_pInt,porosity_phasefield_Noutput(instance)
|
|
||||||
select case(porosity_phasefield_outputID(o,instance))
|
|
||||||
case(porosity_ID)
|
|
||||||
mySize = 1_pInt
|
|
||||||
end select
|
|
||||||
|
|
||||||
if (mySize > 0_pInt) then ! any meaningful output found
|
|
||||||
porosity_phasefield_sizePostResult(o,instance) = mySize
|
|
||||||
porosity_phasefield_sizePostResults(instance) = porosity_phasefield_sizePostResults(instance) + mySize
|
|
||||||
endif
|
|
||||||
enddo outputsLoop
|
|
||||||
|
|
||||||
! allocate state arrays
|
|
||||||
sizeState = 0_pInt
|
|
||||||
porosityState(section)%sizeState = sizeState
|
|
||||||
porosityState(section)%sizePostResults = porosity_phasefield_sizePostResults(instance)
|
|
||||||
allocate(porosityState(section)%state0 (sizeState,NofMyHomog))
|
|
||||||
allocate(porosityState(section)%subState0(sizeState,NofMyHomog))
|
|
||||||
allocate(porosityState(section)%state (sizeState,NofMyHomog))
|
|
||||||
|
|
||||||
nullify(porosityMapping(section)%p)
|
|
||||||
porosityMapping(section)%p => mappingHomogenization(1,:,:)
|
|
||||||
deallocate(porosity(section)%p)
|
|
||||||
allocate(porosity(section)%p(NofMyHomog), source=porosity_initialPhi(section))
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
enddo initializeInstances
|
|
||||||
end subroutine porosity_phasefield_init
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns homogenized vacancy formation energy
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
function porosity_phasefield_getFormationEnergy(ip,el)
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_vacancyFormationEnergy, &
|
|
||||||
lattice_vacancyVol
|
|
||||||
use material, only: &
|
|
||||||
homogenization_Ngrains, &
|
|
||||||
material_phase
|
|
||||||
use mesh, only: &
|
|
||||||
mesh_element
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal) :: &
|
|
||||||
porosity_phasefield_getFormationEnergy
|
|
||||||
integer(pInt) :: &
|
|
||||||
grain
|
|
||||||
|
|
||||||
porosity_phasefield_getFormationEnergy = 0.0_pReal
|
|
||||||
do grain = 1, homogenization_Ngrains(mesh_element(3,el))
|
|
||||||
porosity_phasefield_getFormationEnergy = porosity_phasefield_getFormationEnergy + &
|
|
||||||
lattice_vacancyFormationEnergy(material_phase(grain,ip,el))/ &
|
|
||||||
lattice_vacancyVol(material_phase(grain,ip,el))
|
|
||||||
enddo
|
|
||||||
|
|
||||||
porosity_phasefield_getFormationEnergy = &
|
|
||||||
porosity_phasefield_getFormationEnergy/real(homogenization_Ngrains(mesh_element(3,el)),pReal)
|
|
||||||
|
|
||||||
end function porosity_phasefield_getFormationEnergy
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns homogenized pore surface energy (normalized by characteristic length)
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
function porosity_phasefield_getSurfaceEnergy(ip,el)
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_vacancySurfaceEnergy
|
|
||||||
use material, only: &
|
|
||||||
homogenization_Ngrains, &
|
|
||||||
material_phase
|
|
||||||
use mesh, only: &
|
|
||||||
mesh_element
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal) :: &
|
|
||||||
porosity_phasefield_getSurfaceEnergy
|
|
||||||
integer(pInt) :: &
|
|
||||||
grain
|
|
||||||
|
|
||||||
porosity_phasefield_getSurfaceEnergy = 0.0_pReal
|
|
||||||
do grain = 1, homogenization_Ngrains(mesh_element(3,el))
|
|
||||||
porosity_phasefield_getSurfaceEnergy = porosity_phasefield_getSurfaceEnergy + &
|
|
||||||
lattice_vacancySurfaceEnergy(material_phase(grain,ip,el))
|
|
||||||
enddo
|
|
||||||
|
|
||||||
porosity_phasefield_getSurfaceEnergy = &
|
|
||||||
porosity_phasefield_getSurfaceEnergy/real(homogenization_Ngrains(mesh_element(3,el)),pReal)
|
|
||||||
|
|
||||||
end function porosity_phasefield_getSurfaceEnergy
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief calculates homogenized local driving force for pore nucleation and growth
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine porosity_phasefield_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ip, el)
|
|
||||||
use math, only : &
|
|
||||||
math_mul33x33, &
|
|
||||||
math_mul66x6, &
|
|
||||||
math_Mandel33to6, &
|
|
||||||
math_transpose33, &
|
|
||||||
math_I3
|
|
||||||
use material, only: &
|
|
||||||
homogenization_Ngrains, &
|
|
||||||
material_homog, &
|
|
||||||
material_phase, &
|
|
||||||
phase_NstiffnessDegradations, &
|
|
||||||
phase_stiffnessDegradation, &
|
|
||||||
vacancyConc, &
|
|
||||||
vacancyfluxMapping, &
|
|
||||||
damage, &
|
|
||||||
damageMapping, &
|
|
||||||
STIFFNESS_DEGRADATION_damage_ID
|
|
||||||
use crystallite, only: &
|
|
||||||
crystallite_Fe
|
|
||||||
use constitutive, only: &
|
|
||||||
constitutive_homogenizedC
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(in) :: &
|
|
||||||
phi
|
|
||||||
integer(pInt) :: &
|
|
||||||
phase, &
|
|
||||||
grain, &
|
|
||||||
homog, &
|
|
||||||
mech
|
|
||||||
real(pReal) :: &
|
|
||||||
phiDot, dPhiDot_dPhi, Cv, W_e, strain(6), C(6,6)
|
|
||||||
|
|
||||||
homog = material_homog(ip,el)
|
|
||||||
Cv = vacancyConc(homog)%p(vacancyfluxMapping(homog)%p(ip,el))
|
|
||||||
|
|
||||||
W_e = 0.0_pReal
|
|
||||||
do grain = 1, homogenization_Ngrains(homog)
|
|
||||||
phase = material_phase(grain,ip,el)
|
|
||||||
strain = math_Mandel33to6(math_mul33x33(math_transpose33(crystallite_Fe(1:3,1:3,grain,ip,el)), &
|
|
||||||
crystallite_Fe(1:3,1:3,grain,ip,el)) - math_I3)/2.0_pReal
|
|
||||||
C = constitutive_homogenizedC(grain,ip,el)
|
|
||||||
do mech = 1_pInt, phase_NstiffnessDegradations(phase)
|
|
||||||
select case(phase_stiffnessDegradation(mech,phase))
|
|
||||||
case (STIFFNESS_DEGRADATION_damage_ID)
|
|
||||||
C = damage(homog)%p(damageMapping(homog)%p(ip,el))* &
|
|
||||||
damage(homog)%p(damageMapping(homog)%p(ip,el))* &
|
|
||||||
C
|
|
||||||
|
|
||||||
end select
|
|
||||||
enddo
|
|
||||||
W_e = W_e + sum(abs(strain*math_mul66x6(C,strain)))
|
|
||||||
enddo
|
|
||||||
W_e = W_e/real(homogenization_Ngrains(homog),pReal)
|
|
||||||
|
|
||||||
phiDot = 2.0_pReal*(1.0_pReal - phi)*(1.0_pReal - Cv)*(1.0_pReal - Cv) - &
|
|
||||||
2.0_pReal*phi*(W_e + Cv*porosity_phasefield_getFormationEnergy(ip,el))/ &
|
|
||||||
porosity_phasefield_getSurfaceEnergy (ip,el)
|
|
||||||
dPhiDot_dPhi = - 2.0_pReal*(1.0_pReal - Cv)*(1.0_pReal - Cv) &
|
|
||||||
- 2.0_pReal*(W_e + Cv*porosity_phasefield_getFormationEnergy(ip,el))/ &
|
|
||||||
porosity_phasefield_getSurfaceEnergy (ip,el)
|
|
||||||
|
|
||||||
end subroutine porosity_phasefield_getSourceAndItsTangent
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns homogenized nonlocal diffusion tensor in reference configuration
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
function porosity_phasefield_getDiffusion33(ip,el)
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_PorosityDiffusion33
|
|
||||||
use material, only: &
|
|
||||||
homogenization_Ngrains, &
|
|
||||||
material_phase, &
|
|
||||||
mappingHomogenization
|
|
||||||
use crystallite, only: &
|
|
||||||
crystallite_push33ToRef
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), dimension(3,3) :: &
|
|
||||||
porosity_phasefield_getDiffusion33
|
|
||||||
integer(pInt) :: &
|
|
||||||
homog, &
|
|
||||||
grain
|
|
||||||
|
|
||||||
homog = mappingHomogenization(2,ip,el)
|
|
||||||
porosity_phasefield_getDiffusion33 = 0.0_pReal
|
|
||||||
do grain = 1, homogenization_Ngrains(homog)
|
|
||||||
porosity_phasefield_getDiffusion33 = porosity_phasefield_getDiffusion33 + &
|
|
||||||
crystallite_push33ToRef(grain,ip,el,lattice_PorosityDiffusion33(1:3,1:3,material_phase(grain,ip,el)))
|
|
||||||
enddo
|
|
||||||
|
|
||||||
porosity_phasefield_getDiffusion33 = &
|
|
||||||
porosity_phasefield_getDiffusion33/real(homogenization_Ngrains(homog),pReal)
|
|
||||||
|
|
||||||
end function porosity_phasefield_getDiffusion33
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief Returns homogenized phase field mobility
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
real(pReal) function porosity_phasefield_getMobility(ip,el)
|
|
||||||
use mesh, only: &
|
|
||||||
mesh_element
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_PorosityMobility
|
|
||||||
use material, only: &
|
|
||||||
material_phase, &
|
|
||||||
homogenization_Ngrains
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
integer(pInt) :: &
|
|
||||||
ipc
|
|
||||||
|
|
||||||
porosity_phasefield_getMobility = 0.0_pReal
|
|
||||||
|
|
||||||
do ipc = 1, homogenization_Ngrains(mesh_element(3,el))
|
|
||||||
porosity_phasefield_getMobility = porosity_phasefield_getMobility &
|
|
||||||
+ lattice_PorosityMobility(material_phase(ipc,ip,el))
|
|
||||||
enddo
|
|
||||||
|
|
||||||
porosity_phasefield_getMobility = &
|
|
||||||
porosity_phasefield_getMobility/real(homogenization_Ngrains(mesh_element(3,el)),pReal)
|
|
||||||
|
|
||||||
end function porosity_phasefield_getMobility
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief updates porosity with solution from phasefield PDE
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine porosity_phasefield_putPorosity(phi,ip,el)
|
|
||||||
use material, only: &
|
|
||||||
material_homog, &
|
|
||||||
porosityMapping, &
|
|
||||||
porosity
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(in) :: &
|
|
||||||
phi
|
|
||||||
integer(pInt) :: &
|
|
||||||
homog, &
|
|
||||||
offset
|
|
||||||
|
|
||||||
homog = material_homog(ip,el)
|
|
||||||
offset = porosityMapping(homog)%p(ip,el)
|
|
||||||
porosity(homog)%p(offset) = phi
|
|
||||||
|
|
||||||
end subroutine porosity_phasefield_putPorosity
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief return array of porosity results
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
function porosity_phasefield_postResults(ip,el)
|
|
||||||
use material, only: &
|
|
||||||
mappingHomogenization, &
|
|
||||||
porosity_typeInstance, &
|
|
||||||
porosity
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point
|
|
||||||
el !< element
|
|
||||||
real(pReal), dimension(porosity_phasefield_sizePostResults(porosity_typeInstance(mappingHomogenization(2,ip,el)))) :: &
|
|
||||||
porosity_phasefield_postResults
|
|
||||||
|
|
||||||
integer(pInt) :: &
|
|
||||||
instance, homog, offset, o, c
|
|
||||||
|
|
||||||
homog = mappingHomogenization(2,ip,el)
|
|
||||||
offset = mappingHomogenization(1,ip,el)
|
|
||||||
instance = porosity_typeInstance(homog)
|
|
||||||
|
|
||||||
c = 0_pInt
|
|
||||||
porosity_phasefield_postResults = 0.0_pReal
|
|
||||||
|
|
||||||
do o = 1_pInt,porosity_phasefield_Noutput(instance)
|
|
||||||
select case(porosity_phasefield_outputID(o,instance))
|
|
||||||
|
|
||||||
case (porosity_ID)
|
|
||||||
porosity_phasefield_postResults(c+1_pInt) = porosity(homog)%p(offset)
|
|
||||||
c = c + 1
|
|
||||||
end select
|
|
||||||
enddo
|
|
||||||
end function porosity_phasefield_postResults
|
|
||||||
|
|
||||||
end module porosity_phasefield
|
|
|
@ -246,10 +246,7 @@ subroutine source_damage_isoBrittle_deltaState(C, Fe, ipc, ip, el)
|
||||||
sourceState, &
|
sourceState, &
|
||||||
material_homog, &
|
material_homog, &
|
||||||
phase_NstiffnessDegradations, &
|
phase_NstiffnessDegradations, &
|
||||||
phase_stiffnessDegradation, &
|
phase_stiffnessDegradation
|
||||||
porosity, &
|
|
||||||
porosityMapping, &
|
|
||||||
STIFFNESS_DEGRADATION_porosity_ID
|
|
||||||
use math, only : &
|
use math, only : &
|
||||||
math_mul33x33, &
|
math_mul33x33, &
|
||||||
math_mul66x6, &
|
math_mul66x6, &
|
||||||
|
@ -279,15 +276,7 @@ subroutine source_damage_isoBrittle_deltaState(C, Fe, ipc, ip, el)
|
||||||
instance = source_damage_isoBrittle_instance(phase) !< instance of damage_isoBrittle source
|
instance = source_damage_isoBrittle_instance(phase) !< instance of damage_isoBrittle source
|
||||||
sourceOffset = source_damage_isoBrittle_offset(phase)
|
sourceOffset = source_damage_isoBrittle_offset(phase)
|
||||||
|
|
||||||
stiffness = C
|
stiffness = C
|
||||||
do mech = 1_pInt, phase_NstiffnessDegradations(phase)
|
|
||||||
select case(phase_stiffnessDegradation(mech,phase))
|
|
||||||
case (STIFFNESS_DEGRADATION_porosity_ID)
|
|
||||||
stiffness = porosity(material_homog(ip,el))%p(porosityMapping(material_homog(ip,el))%p(ip,el))* &
|
|
||||||
porosity(material_homog(ip,el))%p(porosityMapping(material_homog(ip,el))%p(ip,el))* &
|
|
||||||
stiffness
|
|
||||||
end select
|
|
||||||
enddo
|
|
||||||
strain = 0.5_pReal*math_Mandel33to6(math_mul33x33(math_transpose33(Fe),Fe)-math_I3)
|
strain = 0.5_pReal*math_Mandel33to6(math_mul33x33(math_transpose33(Fe),Fe)-math_I3)
|
||||||
|
|
||||||
strainenergy = 2.0_pReal*sum(strain*math_mul66x6(stiffness,strain))/ &
|
strainenergy = 2.0_pReal*sum(strain*math_mul66x6(stiffness,strain))/ &
|
||||||
|
|
|
@ -1,248 +0,0 @@
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
|
||||||
!> @brief material subroutine for vacancy generation due to irradiation
|
|
||||||
!> @details to be done
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
module source_vacancy_irradiation
|
|
||||||
use prec, only: &
|
|
||||||
pReal, &
|
|
||||||
pInt
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
private
|
|
||||||
integer(pInt), dimension(:), allocatable, public, protected :: &
|
|
||||||
source_vacancy_irradiation_sizePostResults, & !< cumulative size of post results
|
|
||||||
source_vacancy_irradiation_offset, & !< which source is my current damage mechanism?
|
|
||||||
source_vacancy_irradiation_instance !< instance of damage source mechanism
|
|
||||||
|
|
||||||
integer(pInt), dimension(:,:), allocatable, target, public :: &
|
|
||||||
source_vacancy_irradiation_sizePostResult !< size of each post result output
|
|
||||||
|
|
||||||
character(len=64), dimension(:,:), allocatable, target, public :: &
|
|
||||||
source_vacancy_irradiation_output !< name of each post result output
|
|
||||||
|
|
||||||
integer(pInt), dimension(:), allocatable, target, public :: &
|
|
||||||
source_vacancy_irradiation_Noutput !< number of outputs per instance of this damage
|
|
||||||
|
|
||||||
real(pReal), dimension(:), allocatable, private :: &
|
|
||||||
source_vacancy_irradiation_cascadeProb, &
|
|
||||||
source_vacancy_irradiation_cascadeVolume
|
|
||||||
|
|
||||||
public :: &
|
|
||||||
source_vacancy_irradiation_init, &
|
|
||||||
source_vacancy_irradiation_deltaState, &
|
|
||||||
source_vacancy_irradiation_getRateAndItsTangent
|
|
||||||
|
|
||||||
contains
|
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief module initialization
|
|
||||||
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine source_vacancy_irradiation_init(fileUnit)
|
|
||||||
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
|
||||||
use, intrinsic :: iso_fortran_env, only: &
|
|
||||||
compiler_version, &
|
|
||||||
compiler_options
|
|
||||||
#endif
|
|
||||||
use debug, only: &
|
|
||||||
debug_level,&
|
|
||||||
debug_constitutive,&
|
|
||||||
debug_levelBasic
|
|
||||||
use IO, only: &
|
|
||||||
IO_read, &
|
|
||||||
IO_lc, &
|
|
||||||
IO_getTag, &
|
|
||||||
IO_isBlank, &
|
|
||||||
IO_stringPos, &
|
|
||||||
IO_stringValue, &
|
|
||||||
IO_floatValue, &
|
|
||||||
IO_intValue, &
|
|
||||||
IO_warning, &
|
|
||||||
IO_error, &
|
|
||||||
IO_timeStamp, &
|
|
||||||
IO_EOF
|
|
||||||
use material, only: &
|
|
||||||
phase_source, &
|
|
||||||
phase_Nsources, &
|
|
||||||
phase_Noutput, &
|
|
||||||
SOURCE_vacancy_irradiation_label, &
|
|
||||||
SOURCE_vacancy_irradiation_ID, &
|
|
||||||
material_phase, &
|
|
||||||
sourceState
|
|
||||||
use config, only: &
|
|
||||||
material_Nphase, &
|
|
||||||
MATERIAL_partPhase
|
|
||||||
use numerics,only: &
|
|
||||||
numerics_integrator
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: fileUnit
|
|
||||||
|
|
||||||
integer(pInt), allocatable, dimension(:) :: chunkPos
|
|
||||||
integer(pInt) :: maxNinstance,phase,instance,source,sourceOffset
|
|
||||||
integer(pInt) :: sizeState, sizeDotState, sizeDeltaState
|
|
||||||
integer(pInt) :: NofMyPhase
|
|
||||||
character(len=65536) :: &
|
|
||||||
tag = '', &
|
|
||||||
line = ''
|
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_irradiation_label//' init -+>>>'
|
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
|
||||||
#include "compilation_info.f90"
|
|
||||||
|
|
||||||
maxNinstance = int(count(phase_source == SOURCE_vacancy_irradiation_ID),pInt)
|
|
||||||
if (maxNinstance == 0_pInt) return
|
|
||||||
if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) &
|
|
||||||
write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance
|
|
||||||
|
|
||||||
allocate(source_vacancy_irradiation_offset(material_Nphase), source=0_pInt)
|
|
||||||
allocate(source_vacancy_irradiation_instance(material_Nphase), source=0_pInt)
|
|
||||||
do phase = 1, material_Nphase
|
|
||||||
source_vacancy_irradiation_instance(phase) = count(phase_source(:,1:phase) == source_vacancy_irradiation_ID)
|
|
||||||
do source = 1, phase_Nsources(phase)
|
|
||||||
if (phase_source(source,phase) == source_vacancy_irradiation_ID) &
|
|
||||||
source_vacancy_irradiation_offset(phase) = source
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
allocate(source_vacancy_irradiation_sizePostResults(maxNinstance), source=0_pInt)
|
|
||||||
allocate(source_vacancy_irradiation_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0_pInt)
|
|
||||||
allocate(source_vacancy_irradiation_output(maxval(phase_Noutput),maxNinstance))
|
|
||||||
source_vacancy_irradiation_output = ''
|
|
||||||
allocate(source_vacancy_irradiation_Noutput(maxNinstance), source=0_pInt)
|
|
||||||
allocate(source_vacancy_irradiation_cascadeProb(maxNinstance), source=0.0_pReal)
|
|
||||||
allocate(source_vacancy_irradiation_cascadeVolume(maxNinstance), source=0.0_pReal)
|
|
||||||
|
|
||||||
rewind(fileUnit)
|
|
||||||
phase = 0_pInt
|
|
||||||
do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= MATERIAL_partPhase) ! wind forward to <phase>
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of phase part
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
|
||||||
if (IO_getTag(line,'<','>') /= '') then ! stop at next part
|
|
||||||
line = IO_read(fileUnit, .true.) ! reset IO_read
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
if (IO_getTag(line,'[',']') /= '') then ! next phase section
|
|
||||||
phase = phase + 1_pInt ! advance phase section counter
|
|
||||||
cycle ! skip to next line
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (phase > 0_pInt ) then; if (any(phase_source(:,phase) == SOURCE_vacancy_irradiation_ID)) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
|
||||||
|
|
||||||
instance = source_vacancy_irradiation_instance(phase) ! which instance of my vacancy is present phase
|
|
||||||
chunkPos = IO_stringPos(line)
|
|
||||||
tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key
|
|
||||||
select case(tag)
|
|
||||||
case ('irradiation_cascadeprobability')
|
|
||||||
source_vacancy_irradiation_cascadeProb(instance) = IO_floatValue(line,chunkPos,2_pInt)
|
|
||||||
|
|
||||||
case ('irradiation_cascadevolume')
|
|
||||||
source_vacancy_irradiation_cascadeVolume(instance) = IO_floatValue(line,chunkPos,2_pInt)
|
|
||||||
|
|
||||||
end select
|
|
||||||
endif; endif
|
|
||||||
enddo parsingFile
|
|
||||||
|
|
||||||
initializeInstances: do phase = 1_pInt, material_Nphase
|
|
||||||
if (any(phase_source(:,phase) == SOURCE_vacancy_irradiation_ID)) then
|
|
||||||
NofMyPhase=count(material_phase==phase)
|
|
||||||
instance = source_vacancy_irradiation_instance(phase)
|
|
||||||
sourceOffset = source_vacancy_irradiation_offset(phase)
|
|
||||||
|
|
||||||
sizeDotState = 2_pInt
|
|
||||||
sizeDeltaState = 2_pInt
|
|
||||||
sizeState = 2_pInt
|
|
||||||
sourceState(phase)%p(sourceOffset)%sizeState = sizeState
|
|
||||||
sourceState(phase)%p(sourceOffset)%sizeDotState = sizeDotState
|
|
||||||
sourceState(phase)%p(sourceOffset)%sizeDeltaState = sizeDeltaState
|
|
||||||
sourceState(phase)%p(sourceOffset)%sizePostResults = source_vacancy_irradiation_sizePostResults(instance)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%aTolState (sizeState), source=0.1_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%state0 (sizeState,NofMyPhase), source=0.0_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%partionedState0 (sizeState,NofMyPhase), source=0.0_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%subState0 (sizeState,NofMyPhase), source=0.0_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%state (sizeState,NofMyPhase), source=0.0_pReal)
|
|
||||||
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal)
|
|
||||||
if (any(numerics_integrator == 1_pInt)) then
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal)
|
|
||||||
endif
|
|
||||||
if (any(numerics_integrator == 4_pInt)) &
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%RK4dotState (sizeDotState,NofMyPhase), source=0.0_pReal)
|
|
||||||
if (any(numerics_integrator == 5_pInt)) &
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%RKCK45dotState (6,sizeDotState,NofMyPhase),source=0.0_pReal)
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
enddo initializeInstances
|
|
||||||
end subroutine source_vacancy_irradiation_init
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief calculates derived quantities from state
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine source_vacancy_irradiation_deltaState(ipc, ip, el)
|
|
||||||
use material, only: &
|
|
||||||
phaseAt, phasememberAt, &
|
|
||||||
sourceState
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ipc, & !< component-ID of integration point
|
|
||||||
ip, & !< integration point
|
|
||||||
el !< element
|
|
||||||
integer(pInt) :: &
|
|
||||||
phase, constituent, sourceOffset
|
|
||||||
real(pReal) :: &
|
|
||||||
randNo
|
|
||||||
|
|
||||||
phase = phaseAt(ipc,ip,el)
|
|
||||||
constituent = phasememberAt(ipc,ip,el)
|
|
||||||
sourceOffset = source_vacancy_irradiation_offset(phase)
|
|
||||||
|
|
||||||
call random_number(randNo)
|
|
||||||
sourceState(phase)%p(sourceOffset)%deltaState(1,constituent) = &
|
|
||||||
randNo - sourceState(phase)%p(sourceOffset)%state(1,constituent)
|
|
||||||
call random_number(randNo)
|
|
||||||
sourceState(phase)%p(sourceOffset)%deltaState(2,constituent) = &
|
|
||||||
randNo - sourceState(phase)%p(sourceOffset)%state(2,constituent)
|
|
||||||
|
|
||||||
end subroutine source_vacancy_irradiation_deltaState
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns local vacancy generation rate
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine source_vacancy_irradiation_getRateAndItsTangent(CvDot, dCvDot_dCv, ipc, ip, el)
|
|
||||||
use material, only: &
|
|
||||||
phaseAt, phasememberAt, &
|
|
||||||
sourceState
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ipc, & !< grain number
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(out) :: &
|
|
||||||
CvDot, dCvDot_dCv
|
|
||||||
integer(pInt) :: &
|
|
||||||
instance, phase, constituent, sourceOffset
|
|
||||||
|
|
||||||
phase = phaseAt(ipc,ip,el)
|
|
||||||
constituent = phasememberAt(ipc,ip,el)
|
|
||||||
instance = source_vacancy_irradiation_instance(phase)
|
|
||||||
sourceOffset = source_vacancy_irradiation_offset(phase)
|
|
||||||
|
|
||||||
CvDot = 0.0_pReal
|
|
||||||
dCvDot_dCv = 0.0_pReal
|
|
||||||
if (sourceState(phase)%p(sourceOffset)%state0(1,constituent) < source_vacancy_irradiation_cascadeProb(instance)) &
|
|
||||||
CvDot = sourceState(phase)%p(sourceOffset)%state0(2,constituent)*source_vacancy_irradiation_cascadeVolume(instance)
|
|
||||||
|
|
||||||
end subroutine source_vacancy_irradiation_getRateAndItsTangent
|
|
||||||
|
|
||||||
end module source_vacancy_irradiation
|
|
|
@ -1,210 +0,0 @@
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
|
||||||
!> @brief material subroutine for vacancy generation due to plasticity
|
|
||||||
!> @details to be done
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
module source_vacancy_phenoplasticity
|
|
||||||
use prec, only: &
|
|
||||||
pReal, &
|
|
||||||
pInt
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
private
|
|
||||||
integer(pInt), dimension(:), allocatable, public, protected :: &
|
|
||||||
source_vacancy_phenoplasticity_sizePostResults, & !< cumulative size of post results
|
|
||||||
source_vacancy_phenoplasticity_offset, & !< which source is my current damage mechanism?
|
|
||||||
source_vacancy_phenoplasticity_instance !< instance of damage source mechanism
|
|
||||||
|
|
||||||
integer(pInt), dimension(:,:), allocatable, target, public :: &
|
|
||||||
source_vacancy_phenoplasticity_sizePostResult !< size of each post result output
|
|
||||||
|
|
||||||
character(len=64), dimension(:,:), allocatable, target, public :: &
|
|
||||||
source_vacancy_phenoplasticity_output !< name of each post result output
|
|
||||||
|
|
||||||
integer(pInt), dimension(:), allocatable, target, public :: &
|
|
||||||
source_vacancy_phenoplasticity_Noutput !< number of outputs per instance of this damage
|
|
||||||
|
|
||||||
real(pReal), dimension(:), allocatable, private :: &
|
|
||||||
source_vacancy_phenoplasticity_rateCoeff
|
|
||||||
|
|
||||||
public :: &
|
|
||||||
source_vacancy_phenoplasticity_init, &
|
|
||||||
source_vacancy_phenoplasticity_getRateAndItsTangent
|
|
||||||
|
|
||||||
contains
|
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief module initialization
|
|
||||||
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine source_vacancy_phenoplasticity_init(fileUnit)
|
|
||||||
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
|
||||||
use, intrinsic :: iso_fortran_env, only: &
|
|
||||||
compiler_version, &
|
|
||||||
compiler_options
|
|
||||||
#endif
|
|
||||||
use debug, only: &
|
|
||||||
debug_level,&
|
|
||||||
debug_constitutive,&
|
|
||||||
debug_levelBasic
|
|
||||||
use IO, only: &
|
|
||||||
IO_read, &
|
|
||||||
IO_lc, &
|
|
||||||
IO_getTag, &
|
|
||||||
IO_isBlank, &
|
|
||||||
IO_stringPos, &
|
|
||||||
IO_stringValue, &
|
|
||||||
IO_floatValue, &
|
|
||||||
IO_intValue, &
|
|
||||||
IO_warning, &
|
|
||||||
IO_error, &
|
|
||||||
IO_timeStamp, &
|
|
||||||
IO_EOF
|
|
||||||
use material, only: &
|
|
||||||
phase_source, &
|
|
||||||
phase_Nsources, &
|
|
||||||
phase_Noutput, &
|
|
||||||
SOURCE_vacancy_phenoplasticity_label, &
|
|
||||||
SOURCE_vacancy_phenoplasticity_ID, &
|
|
||||||
material_phase, &
|
|
||||||
sourceState
|
|
||||||
use config, only: &
|
|
||||||
material_Nphase, &
|
|
||||||
MATERIAL_partPhase
|
|
||||||
use numerics,only: &
|
|
||||||
numerics_integrator
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: fileUnit
|
|
||||||
|
|
||||||
integer(pInt), allocatable, dimension(:) :: chunkPos
|
|
||||||
integer(pInt) :: maxNinstance,phase,instance,source,sourceOffset
|
|
||||||
integer(pInt) :: sizeState, sizeDotState, sizeDeltaState
|
|
||||||
integer(pInt) :: NofMyPhase
|
|
||||||
character(len=65536) :: &
|
|
||||||
tag = '', &
|
|
||||||
line = ''
|
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_phenoplasticity_label//' init -+>>>'
|
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
|
||||||
#include "compilation_info.f90"
|
|
||||||
|
|
||||||
maxNinstance = int(count(phase_source == SOURCE_vacancy_phenoplasticity_ID),pInt)
|
|
||||||
if (maxNinstance == 0_pInt) return
|
|
||||||
if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) &
|
|
||||||
write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance
|
|
||||||
|
|
||||||
allocate(source_vacancy_phenoplasticity_offset(material_Nphase), source=0_pInt)
|
|
||||||
allocate(source_vacancy_phenoplasticity_instance(material_Nphase), source=0_pInt)
|
|
||||||
do phase = 1, material_Nphase
|
|
||||||
source_vacancy_phenoplasticity_instance(phase) = count(phase_source(:,1:phase) == source_vacancy_phenoplasticity_ID)
|
|
||||||
do source = 1, phase_Nsources(phase)
|
|
||||||
if (phase_source(source,phase) == source_vacancy_phenoplasticity_ID) &
|
|
||||||
source_vacancy_phenoplasticity_offset(phase) = source
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
allocate(source_vacancy_phenoplasticity_sizePostResults(maxNinstance), source=0_pInt)
|
|
||||||
allocate(source_vacancy_phenoplasticity_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0_pInt)
|
|
||||||
allocate(source_vacancy_phenoplasticity_output(maxval(phase_Noutput),maxNinstance))
|
|
||||||
source_vacancy_phenoplasticity_output = ''
|
|
||||||
allocate(source_vacancy_phenoplasticity_Noutput(maxNinstance), source=0_pInt)
|
|
||||||
allocate(source_vacancy_phenoplasticity_rateCoeff(maxNinstance), source=0.0_pReal)
|
|
||||||
|
|
||||||
rewind(fileUnit)
|
|
||||||
phase = 0_pInt
|
|
||||||
do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= MATERIAL_partPhase) ! wind forward to <phase>
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of phase part
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
|
||||||
if (IO_getTag(line,'<','>') /= '') then ! stop at next part
|
|
||||||
line = IO_read(fileUnit, .true.) ! reset IO_read
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
if (IO_getTag(line,'[',']') /= '') then ! next phase section
|
|
||||||
phase = phase + 1_pInt ! advance phase section counter
|
|
||||||
cycle ! skip to next line
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (phase > 0_pInt ) then; if (any(phase_source(:,phase) == SOURCE_vacancy_phenoplasticity_ID)) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
|
||||||
|
|
||||||
instance = source_vacancy_phenoplasticity_instance(phase) ! which instance of my vacancy is present phase
|
|
||||||
chunkPos = IO_stringPos(line)
|
|
||||||
tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key
|
|
||||||
select case(tag)
|
|
||||||
case ('phenoplasticity_ratecoeff')
|
|
||||||
source_vacancy_phenoplasticity_rateCoeff(instance) = IO_floatValue(line,chunkPos,2_pInt)
|
|
||||||
|
|
||||||
end select
|
|
||||||
endif; endif
|
|
||||||
enddo parsingFile
|
|
||||||
|
|
||||||
initializeInstances: do phase = 1_pInt, material_Nphase
|
|
||||||
if (any(phase_source(:,phase) == SOURCE_vacancy_phenoplasticity_ID)) then
|
|
||||||
NofMyPhase=count(material_phase==phase)
|
|
||||||
instance = source_vacancy_phenoplasticity_instance(phase)
|
|
||||||
sourceOffset = source_vacancy_phenoplasticity_offset(phase)
|
|
||||||
|
|
||||||
sizeDotState = 0_pInt
|
|
||||||
sizeDeltaState = 0_pInt
|
|
||||||
sizeState = 0_pInt
|
|
||||||
sourceState(phase)%p(sourceOffset)%sizeState = sizeState
|
|
||||||
sourceState(phase)%p(sourceOffset)%sizeDotState = sizeDotState
|
|
||||||
sourceState(phase)%p(sourceOffset)%sizeDeltaState = sizeDeltaState
|
|
||||||
sourceState(phase)%p(sourceOffset)%sizePostResults = source_vacancy_phenoplasticity_sizePostResults(instance)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%aTolState (sizeState), source=0.0_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%state0 (sizeState,NofMyPhase), source=0.0_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%partionedState0 (sizeState,NofMyPhase), source=0.0_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%subState0 (sizeState,NofMyPhase), source=0.0_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%state (sizeState,NofMyPhase), source=0.0_pReal)
|
|
||||||
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal)
|
|
||||||
if (any(numerics_integrator == 1_pInt)) then
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal)
|
|
||||||
endif
|
|
||||||
if (any(numerics_integrator == 4_pInt)) &
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%RK4dotState (sizeDotState,NofMyPhase), source=0.0_pReal)
|
|
||||||
if (any(numerics_integrator == 5_pInt)) &
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%RKCK45dotState (6,sizeDotState,NofMyPhase),source=0.0_pReal)
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
enddo initializeInstances
|
|
||||||
end subroutine source_vacancy_phenoplasticity_init
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns local vacancy generation rate
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine source_vacancy_phenoplasticity_getRateAndItsTangent(CvDot, dCvDot_dCv, ipc, ip, el)
|
|
||||||
use material, only: &
|
|
||||||
phaseAt, phasememberAt, &
|
|
||||||
plasticState
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ipc, & !< grain number
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(out) :: &
|
|
||||||
CvDot, dCvDot_dCv
|
|
||||||
integer(pInt) :: &
|
|
||||||
instance, phase, constituent
|
|
||||||
|
|
||||||
phase = phaseAt(ipc,ip,el)
|
|
||||||
constituent = phasememberAt(ipc,ip,el)
|
|
||||||
instance = source_vacancy_phenoplasticity_instance(phase)
|
|
||||||
|
|
||||||
CvDot = &
|
|
||||||
source_vacancy_phenoplasticity_rateCoeff(instance)* &
|
|
||||||
sum(plasticState(phase)%slipRate(:,constituent))
|
|
||||||
dCvDot_dCv = 0.0_pReal
|
|
||||||
|
|
||||||
end subroutine source_vacancy_phenoplasticity_getRateAndItsTangent
|
|
||||||
|
|
||||||
end module source_vacancy_phenoplasticity
|
|
|
@ -1,250 +0,0 @@
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
|
||||||
!> @brief material subroutine for vacancy generation due to thermal fluctuations
|
|
||||||
!> @details to be done
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
module source_vacancy_thermalfluc
|
|
||||||
use prec, only: &
|
|
||||||
pReal, &
|
|
||||||
pInt
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
private
|
|
||||||
integer(pInt), dimension(:), allocatable, public, protected :: &
|
|
||||||
source_vacancy_thermalfluc_sizePostResults, & !< cumulative size of post results
|
|
||||||
source_vacancy_thermalfluc_offset, & !< which source is my current damage mechanism?
|
|
||||||
source_vacancy_thermalfluc_instance !< instance of damage source mechanism
|
|
||||||
|
|
||||||
integer(pInt), dimension(:,:), allocatable, target, public :: &
|
|
||||||
source_vacancy_thermalfluc_sizePostResult !< size of each post result output
|
|
||||||
|
|
||||||
character(len=64), dimension(:,:), allocatable, target, public :: &
|
|
||||||
source_vacancy_thermalfluc_output !< name of each post result output
|
|
||||||
|
|
||||||
integer(pInt), dimension(:), allocatable, target, public :: &
|
|
||||||
source_vacancy_thermalfluc_Noutput !< number of outputs per instance of this damage
|
|
||||||
|
|
||||||
real(pReal), dimension(:), allocatable, private :: &
|
|
||||||
source_vacancy_thermalfluc_amplitude, &
|
|
||||||
source_vacancy_thermalfluc_normVacancyEnergy
|
|
||||||
|
|
||||||
public :: &
|
|
||||||
source_vacancy_thermalfluc_init, &
|
|
||||||
source_vacancy_thermalfluc_deltaState, &
|
|
||||||
source_vacancy_thermalfluc_getRateAndItsTangent
|
|
||||||
|
|
||||||
contains
|
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief module initialization
|
|
||||||
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine source_vacancy_thermalfluc_init(fileUnit)
|
|
||||||
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
|
||||||
use, intrinsic :: iso_fortran_env, only: &
|
|
||||||
compiler_version, &
|
|
||||||
compiler_options
|
|
||||||
#endif
|
|
||||||
use debug, only: &
|
|
||||||
debug_level,&
|
|
||||||
debug_constitutive,&
|
|
||||||
debug_levelBasic
|
|
||||||
use IO, only: &
|
|
||||||
IO_read, &
|
|
||||||
IO_lc, &
|
|
||||||
IO_getTag, &
|
|
||||||
IO_isBlank, &
|
|
||||||
IO_stringPos, &
|
|
||||||
IO_stringValue, &
|
|
||||||
IO_floatValue, &
|
|
||||||
IO_intValue, &
|
|
||||||
IO_warning, &
|
|
||||||
IO_error, &
|
|
||||||
IO_timeStamp, &
|
|
||||||
IO_EOF
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_vacancyFormationEnergy
|
|
||||||
use material, only: &
|
|
||||||
phase_source, &
|
|
||||||
phase_Nsources, &
|
|
||||||
phase_Noutput, &
|
|
||||||
SOURCE_vacancy_thermalfluc_label, &
|
|
||||||
SOURCE_vacancy_thermalfluc_ID, &
|
|
||||||
material_phase, &
|
|
||||||
sourceState
|
|
||||||
use config, only: &
|
|
||||||
material_Nphase, &
|
|
||||||
MATERIAL_partPhase
|
|
||||||
use numerics,only: &
|
|
||||||
numerics_integrator
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: fileUnit
|
|
||||||
|
|
||||||
integer(pInt), allocatable, dimension(:) :: chunkPos
|
|
||||||
integer(pInt) :: maxNinstance,phase,instance,source,sourceOffset
|
|
||||||
integer(pInt) :: sizeState, sizeDotState, sizeDeltaState
|
|
||||||
integer(pInt) :: NofMyPhase
|
|
||||||
character(len=65536) :: &
|
|
||||||
tag = '', &
|
|
||||||
line = ''
|
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_thermalfluc_label//' init -+>>>'
|
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
|
||||||
#include "compilation_info.f90"
|
|
||||||
|
|
||||||
maxNinstance = int(count(phase_source == SOURCE_vacancy_thermalfluc_ID),pInt)
|
|
||||||
if (maxNinstance == 0_pInt) return
|
|
||||||
if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) &
|
|
||||||
write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance
|
|
||||||
|
|
||||||
allocate(source_vacancy_thermalfluc_offset(material_Nphase), source=0_pInt)
|
|
||||||
allocate(source_vacancy_thermalfluc_instance(material_Nphase), source=0_pInt)
|
|
||||||
do phase = 1, material_Nphase
|
|
||||||
source_vacancy_thermalfluc_instance(phase) = count(phase_source(:,1:phase) == source_vacancy_thermalfluc_ID)
|
|
||||||
do source = 1, phase_Nsources(phase)
|
|
||||||
if (phase_source(source,phase) == source_vacancy_thermalfluc_ID) &
|
|
||||||
source_vacancy_thermalfluc_offset(phase) = source
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
allocate(source_vacancy_thermalfluc_sizePostResults(maxNinstance), source=0_pInt)
|
|
||||||
allocate(source_vacancy_thermalfluc_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0_pInt)
|
|
||||||
allocate(source_vacancy_thermalfluc_output(maxval(phase_Noutput),maxNinstance))
|
|
||||||
source_vacancy_thermalfluc_output = ''
|
|
||||||
allocate(source_vacancy_thermalfluc_Noutput(maxNinstance), source=0_pInt)
|
|
||||||
allocate(source_vacancy_thermalfluc_amplitude(maxNinstance), source=0.0_pReal)
|
|
||||||
allocate(source_vacancy_thermalfluc_normVacancyEnergy(maxNinstance), source=0.0_pReal)
|
|
||||||
|
|
||||||
rewind(fileUnit)
|
|
||||||
phase = 0_pInt
|
|
||||||
do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= MATERIAL_partPhase) ! wind forward to <phase>
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of phase part
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
|
||||||
if (IO_getTag(line,'<','>') /= '') then ! stop at next part
|
|
||||||
line = IO_read(fileUnit, .true.) ! reset IO_read
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
if (IO_getTag(line,'[',']') /= '') then ! next phase section
|
|
||||||
phase = phase + 1_pInt ! advance phase section counter
|
|
||||||
cycle ! skip to next line
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (phase > 0_pInt ) then; if (any(phase_source(:,phase) == SOURCE_vacancy_thermalfluc_ID)) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
|
||||||
|
|
||||||
instance = source_vacancy_thermalfluc_instance(phase) ! which instance of my vacancy is present phase
|
|
||||||
chunkPos = IO_stringPos(line)
|
|
||||||
tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key
|
|
||||||
select case(tag)
|
|
||||||
case ('thermalfluctuation_amplitude')
|
|
||||||
source_vacancy_thermalfluc_amplitude(instance) = IO_floatValue(line,chunkPos,2_pInt)
|
|
||||||
|
|
||||||
end select
|
|
||||||
endif; endif
|
|
||||||
enddo parsingFile
|
|
||||||
|
|
||||||
initializeInstances: do phase = 1_pInt, material_Nphase
|
|
||||||
if (any(phase_source(:,phase) == SOURCE_vacancy_thermalfluc_ID)) then
|
|
||||||
NofMyPhase=count(material_phase==phase)
|
|
||||||
instance = source_vacancy_thermalfluc_instance(phase)
|
|
||||||
source_vacancy_thermalfluc_normVacancyEnergy(instance) = &
|
|
||||||
lattice_vacancyFormationEnergy(phase)/1.3806488e-23_pReal
|
|
||||||
sourceOffset = source_vacancy_thermalfluc_offset(phase)
|
|
||||||
|
|
||||||
sizeDotState = 1_pInt
|
|
||||||
sizeDeltaState = 1_pInt
|
|
||||||
sizeState = 1_pInt
|
|
||||||
sourceState(phase)%p(sourceOffset)%sizeState = sizeState
|
|
||||||
sourceState(phase)%p(sourceOffset)%sizeDotState = sizeDotState
|
|
||||||
sourceState(phase)%p(sourceOffset)%sizeDeltaState = sizeDeltaState
|
|
||||||
sourceState(phase)%p(sourceOffset)%sizePostResults = source_vacancy_thermalfluc_sizePostResults(instance)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%aTolState (sizeState), source=0.1_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%state0 (sizeState,NofMyPhase), source=0.0_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%partionedState0 (sizeState,NofMyPhase), source=0.0_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%subState0 (sizeState,NofMyPhase), source=0.0_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%state (sizeState,NofMyPhase), source=0.0_pReal)
|
|
||||||
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal)
|
|
||||||
if (any(numerics_integrator == 1_pInt)) then
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal)
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal)
|
|
||||||
endif
|
|
||||||
if (any(numerics_integrator == 4_pInt)) &
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%RK4dotState (sizeDotState,NofMyPhase), source=0.0_pReal)
|
|
||||||
if (any(numerics_integrator == 5_pInt)) &
|
|
||||||
allocate(sourceState(phase)%p(sourceOffset)%RKCK45dotState (6,sizeDotState,NofMyPhase),source=0.0_pReal)
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
enddo initializeInstances
|
|
||||||
end subroutine source_vacancy_thermalfluc_init
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief calculates derived quantities from state
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine source_vacancy_thermalfluc_deltaState(ipc, ip, el)
|
|
||||||
use material, only: &
|
|
||||||
phaseAt, phasememberAt, &
|
|
||||||
sourceState
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ipc, & !< component-ID of integration point
|
|
||||||
ip, & !< integration point
|
|
||||||
el !< element
|
|
||||||
integer(pInt) :: &
|
|
||||||
phase, constituent, sourceOffset
|
|
||||||
real(pReal) :: &
|
|
||||||
randNo
|
|
||||||
|
|
||||||
phase = phaseAt(ipc,ip,el)
|
|
||||||
constituent = phasememberAt(ipc,ip,el)
|
|
||||||
sourceOffset = source_vacancy_thermalfluc_offset(phase)
|
|
||||||
|
|
||||||
call random_number(randNo)
|
|
||||||
sourceState(phase)%p(sourceOffset)%deltaState(1,constituent) = &
|
|
||||||
randNo - 0.5_pReal - sourceState(phase)%p(sourceOffset)%state(1,constituent)
|
|
||||||
|
|
||||||
end subroutine source_vacancy_thermalfluc_deltaState
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns local vacancy generation rate
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine source_vacancy_thermalfluc_getRateAndItsTangent(CvDot, dCvDot_dCv, ipc, ip, el)
|
|
||||||
use material, only: &
|
|
||||||
phaseAt, phasememberAt, &
|
|
||||||
material_homog, &
|
|
||||||
temperature, &
|
|
||||||
thermalMapping, &
|
|
||||||
sourceState
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ipc, & !< grain number
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(out) :: &
|
|
||||||
CvDot, dCvDot_dCv
|
|
||||||
integer(pInt) :: &
|
|
||||||
instance, phase, constituent, sourceOffset
|
|
||||||
|
|
||||||
phase = phaseAt(ipc,ip,el)
|
|
||||||
constituent = phasememberAt(ipc,ip,el)
|
|
||||||
instance = source_vacancy_thermalfluc_instance(phase)
|
|
||||||
sourceOffset = source_vacancy_thermalfluc_offset(phase)
|
|
||||||
|
|
||||||
CvDot = source_vacancy_thermalfluc_amplitude(instance)* &
|
|
||||||
sourceState(phase)%p(sourceOffset)%state0(2,constituent)* &
|
|
||||||
exp(-source_vacancy_thermalfluc_normVacancyEnergy(instance)/ &
|
|
||||||
temperature(material_homog(ip,el))%p(thermalMapping(material_homog(ip,el))%p(ip,el)))
|
|
||||||
dCvDot_dCv = 0.0_pReal
|
|
||||||
|
|
||||||
end subroutine source_vacancy_thermalfluc_getRateAndItsTangent
|
|
||||||
|
|
||||||
end module source_vacancy_thermalfluc
|
|
|
@ -1,602 +0,0 @@
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
|
||||||
!> @brief material subroutine for conservative transport of vacancy concentration field
|
|
||||||
!> @details to be done
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
module vacancyflux_cahnhilliard
|
|
||||||
use prec, only: &
|
|
||||||
pReal, &
|
|
||||||
pInt, &
|
|
||||||
group_float
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
private
|
|
||||||
integer(pInt), dimension(:), allocatable, public, protected :: &
|
|
||||||
vacancyflux_cahnhilliard_sizePostResults !< cumulative size of post results
|
|
||||||
|
|
||||||
integer(pInt), dimension(:,:), allocatable, target, public :: &
|
|
||||||
vacancyflux_cahnhilliard_sizePostResult !< size of each post result output
|
|
||||||
|
|
||||||
character(len=64), dimension(:,:), allocatable, target, public :: &
|
|
||||||
vacancyflux_cahnhilliard_output !< name of each post result output
|
|
||||||
|
|
||||||
integer(pInt), dimension(:), allocatable, target, public :: &
|
|
||||||
vacancyflux_cahnhilliard_Noutput !< number of outputs per instance of this damage
|
|
||||||
|
|
||||||
real(pReal), dimension(:), allocatable, private :: &
|
|
||||||
vacancyflux_cahnhilliard_flucAmplitude
|
|
||||||
|
|
||||||
type(group_float), dimension(:), allocatable, private :: &
|
|
||||||
vacancyflux_cahnhilliard_thermalFluc
|
|
||||||
|
|
||||||
real(pReal), parameter, private :: &
|
|
||||||
kB = 1.3806488e-23_pReal !< Boltzmann constant in J/Kelvin
|
|
||||||
|
|
||||||
enum, bind(c)
|
|
||||||
enumerator :: undefined_ID, &
|
|
||||||
vacancyConc_ID
|
|
||||||
end enum
|
|
||||||
integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: &
|
|
||||||
vacancyflux_cahnhilliard_outputID !< ID of each post result output
|
|
||||||
|
|
||||||
|
|
||||||
public :: &
|
|
||||||
vacancyflux_cahnhilliard_init, &
|
|
||||||
vacancyflux_cahnhilliard_getSourceAndItsTangent, &
|
|
||||||
vacancyflux_cahnhilliard_getMobility33, &
|
|
||||||
vacancyflux_cahnhilliard_getDiffusion33, &
|
|
||||||
vacancyflux_cahnhilliard_getChemPotAndItsTangent, &
|
|
||||||
vacancyflux_cahnhilliard_putVacancyConcAndItsRate, &
|
|
||||||
vacancyflux_cahnhilliard_postResults
|
|
||||||
private :: &
|
|
||||||
vacancyflux_cahnhilliard_getFormationEnergy, &
|
|
||||||
vacancyflux_cahnhilliard_getEntropicCoeff, &
|
|
||||||
vacancyflux_cahnhilliard_KinematicChemPotAndItsTangent
|
|
||||||
|
|
||||||
contains
|
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief module initialization
|
|
||||||
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine vacancyflux_cahnhilliard_init(fileUnit)
|
|
||||||
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
|
||||||
use, intrinsic :: iso_fortran_env, only: &
|
|
||||||
compiler_version, &
|
|
||||||
compiler_options
|
|
||||||
#endif
|
|
||||||
use IO, only: &
|
|
||||||
IO_read, &
|
|
||||||
IO_lc, &
|
|
||||||
IO_getTag, &
|
|
||||||
IO_isBlank, &
|
|
||||||
IO_stringPos, &
|
|
||||||
IO_stringValue, &
|
|
||||||
IO_floatValue, &
|
|
||||||
IO_intValue, &
|
|
||||||
IO_warning, &
|
|
||||||
IO_error, &
|
|
||||||
IO_timeStamp, &
|
|
||||||
IO_EOF
|
|
||||||
use material, only: &
|
|
||||||
vacancyflux_type, &
|
|
||||||
vacancyflux_typeInstance, &
|
|
||||||
homogenization_Noutput, &
|
|
||||||
VACANCYFLUX_cahnhilliard_label, &
|
|
||||||
VACANCYFLUX_cahnhilliard_ID, &
|
|
||||||
material_homog, &
|
|
||||||
mappingHomogenization, &
|
|
||||||
vacancyfluxState, &
|
|
||||||
vacancyfluxMapping, &
|
|
||||||
vacancyConc, &
|
|
||||||
vacancyConcRate, &
|
|
||||||
vacancyflux_initialCv
|
|
||||||
use config, only: &
|
|
||||||
material_partPhase, &
|
|
||||||
material_partHomogenization
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: fileUnit
|
|
||||||
|
|
||||||
integer(pInt), allocatable, dimension(:) :: chunkPos
|
|
||||||
integer(pInt) :: maxNinstance,mySize=0_pInt,section,instance,o,offset
|
|
||||||
integer(pInt) :: sizeState
|
|
||||||
integer(pInt) :: NofMyHomog
|
|
||||||
character(len=65536) :: &
|
|
||||||
tag = '', &
|
|
||||||
line = ''
|
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- vacancyflux_'//VACANCYFLUX_cahnhilliard_label//' init -+>>>'
|
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
|
||||||
#include "compilation_info.f90"
|
|
||||||
|
|
||||||
maxNinstance = int(count(vacancyflux_type == VACANCYFLUX_cahnhilliard_ID),pInt)
|
|
||||||
if (maxNinstance == 0_pInt) return
|
|
||||||
|
|
||||||
allocate(vacancyflux_cahnhilliard_sizePostResults(maxNinstance), source=0_pInt)
|
|
||||||
allocate(vacancyflux_cahnhilliard_sizePostResult (maxval(homogenization_Noutput),maxNinstance),source=0_pInt)
|
|
||||||
allocate(vacancyflux_cahnhilliard_output (maxval(homogenization_Noutput),maxNinstance))
|
|
||||||
vacancyflux_cahnhilliard_output = ''
|
|
||||||
allocate(vacancyflux_cahnhilliard_outputID (maxval(homogenization_Noutput),maxNinstance),source=undefined_ID)
|
|
||||||
allocate(vacancyflux_cahnhilliard_Noutput (maxNinstance), source=0_pInt)
|
|
||||||
|
|
||||||
allocate(vacancyflux_cahnhilliard_flucAmplitude (maxNinstance))
|
|
||||||
allocate(vacancyflux_cahnhilliard_thermalFluc (maxNinstance))
|
|
||||||
|
|
||||||
rewind(fileUnit)
|
|
||||||
section = 0_pInt
|
|
||||||
do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= material_partHomogenization)! wind forward to <homogenization>
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
parsingHomog: do while (trim(line) /= IO_EOF) ! read through sections of homog part
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
|
||||||
if (IO_getTag(line,'<','>') /= '') then ! stop at next part
|
|
||||||
line = IO_read(fileUnit, .true.) ! reset IO_read
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
if (IO_getTag(line,'[',']') /= '') then ! next homog section
|
|
||||||
section = section + 1_pInt ! advance homog section counter
|
|
||||||
cycle ! skip to next line
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (section > 0_pInt ) then; if (vacancyflux_type(section) == VACANCYFLUX_cahnhilliard_ID) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
|
||||||
|
|
||||||
instance = vacancyflux_typeInstance(section) ! which instance of my vacancyflux is present homog
|
|
||||||
chunkPos = IO_stringPos(line)
|
|
||||||
tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key
|
|
||||||
select case(tag)
|
|
||||||
case ('(output)')
|
|
||||||
select case(IO_lc(IO_stringValue(line,chunkPos,2_pInt)))
|
|
||||||
case ('vacancyconc')
|
|
||||||
vacancyflux_cahnhilliard_Noutput(instance) = vacancyflux_cahnhilliard_Noutput(instance) + 1_pInt
|
|
||||||
vacancyflux_cahnhilliard_outputID(vacancyflux_cahnhilliard_Noutput(instance),instance) = vacancyConc_ID
|
|
||||||
vacancyflux_cahnhilliard_output(vacancyflux_cahnhilliard_Noutput(instance),instance) = &
|
|
||||||
IO_lc(IO_stringValue(line,chunkPos,2_pInt))
|
|
||||||
end select
|
|
||||||
|
|
||||||
case ('vacancyflux_flucamplitude')
|
|
||||||
vacancyflux_cahnhilliard_flucAmplitude(instance) = IO_floatValue(line,chunkPos,2_pInt)
|
|
||||||
|
|
||||||
end select
|
|
||||||
endif; endif
|
|
||||||
enddo parsingHomog
|
|
||||||
|
|
||||||
initializeInstances: do section = 1_pInt, size(vacancyflux_type)
|
|
||||||
if (vacancyflux_type(section) == VACANCYFLUX_cahnhilliard_ID) then
|
|
||||||
NofMyHomog=count(material_homog==section)
|
|
||||||
instance = vacancyflux_typeInstance(section)
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! Determine size of postResults array
|
|
||||||
outputsLoop: do o = 1_pInt,vacancyflux_cahnhilliard_Noutput(instance)
|
|
||||||
select case(vacancyflux_cahnhilliard_outputID(o,instance))
|
|
||||||
case(vacancyConc_ID)
|
|
||||||
mySize = 1_pInt
|
|
||||||
end select
|
|
||||||
|
|
||||||
if (mySize > 0_pInt) then ! any meaningful output found
|
|
||||||
vacancyflux_cahnhilliard_sizePostResult(o,instance) = mySize
|
|
||||||
vacancyflux_cahnhilliard_sizePostResults(instance) = vacancyflux_cahnhilliard_sizePostResults(instance) + mySize
|
|
||||||
endif
|
|
||||||
enddo outputsLoop
|
|
||||||
|
|
||||||
! allocate state arrays
|
|
||||||
sizeState = 0_pInt
|
|
||||||
vacancyfluxState(section)%sizeState = sizeState
|
|
||||||
vacancyfluxState(section)%sizePostResults = vacancyflux_cahnhilliard_sizePostResults(instance)
|
|
||||||
allocate(vacancyfluxState(section)%state0 (sizeState,NofMyHomog))
|
|
||||||
allocate(vacancyfluxState(section)%subState0(sizeState,NofMyHomog))
|
|
||||||
allocate(vacancyfluxState(section)%state (sizeState,NofMyHomog))
|
|
||||||
|
|
||||||
allocate(vacancyflux_cahnhilliard_thermalFluc(instance)%p(NofMyHomog))
|
|
||||||
do offset = 1_pInt, NofMyHomog
|
|
||||||
call random_number(vacancyflux_cahnhilliard_thermalFluc(instance)%p(offset))
|
|
||||||
vacancyflux_cahnhilliard_thermalFluc(instance)%p(offset) = &
|
|
||||||
1.0_pReal - &
|
|
||||||
vacancyflux_cahnhilliard_flucAmplitude(instance)* &
|
|
||||||
(vacancyflux_cahnhilliard_thermalFluc(instance)%p(offset) - 0.5_pReal)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
nullify(vacancyfluxMapping(section)%p)
|
|
||||||
vacancyfluxMapping(section)%p => mappingHomogenization(1,:,:)
|
|
||||||
deallocate(vacancyConc (section)%p)
|
|
||||||
allocate (vacancyConc (section)%p(NofMyHomog), source=vacancyflux_initialCv(section))
|
|
||||||
deallocate(vacancyConcRate(section)%p)
|
|
||||||
allocate (vacancyConcRate(section)%p(NofMyHomog), source=0.0_pReal)
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
enddo initializeInstances
|
|
||||||
|
|
||||||
end subroutine vacancyflux_cahnhilliard_init
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief calculates homogenized vacancy driving forces
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine vacancyflux_cahnhilliard_getSourceAndItsTangent(CvDot, dCvDot_dCv, Cv, ip, el)
|
|
||||||
use material, only: &
|
|
||||||
homogenization_Ngrains, &
|
|
||||||
mappingHomogenization, &
|
|
||||||
phaseAt, &
|
|
||||||
phase_source, &
|
|
||||||
phase_Nsources, &
|
|
||||||
SOURCE_vacancy_phenoplasticity_ID, &
|
|
||||||
SOURCE_vacancy_irradiation_ID, &
|
|
||||||
SOURCE_vacancy_thermalfluc_ID
|
|
||||||
use source_vacancy_phenoplasticity, only: &
|
|
||||||
source_vacancy_phenoplasticity_getRateAndItsTangent
|
|
||||||
use source_vacancy_irradiation, only: &
|
|
||||||
source_vacancy_irradiation_getRateAndItsTangent
|
|
||||||
use source_vacancy_thermalfluc, only: &
|
|
||||||
source_vacancy_thermalfluc_getRateAndItsTangent
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(in) :: &
|
|
||||||
Cv
|
|
||||||
integer(pInt) :: &
|
|
||||||
phase, &
|
|
||||||
grain, &
|
|
||||||
source
|
|
||||||
real(pReal) :: &
|
|
||||||
CvDot, dCvDot_dCv, localCvDot, dLocalCvDot_dCv
|
|
||||||
|
|
||||||
CvDot = 0.0_pReal
|
|
||||||
dCvDot_dCv = 0.0_pReal
|
|
||||||
do grain = 1, homogenization_Ngrains(mappingHomogenization(2,ip,el))
|
|
||||||
phase = phaseAt(grain,ip,el)
|
|
||||||
do source = 1_pInt, phase_Nsources(phase)
|
|
||||||
select case(phase_source(source,phase))
|
|
||||||
case (SOURCE_vacancy_phenoplasticity_ID)
|
|
||||||
call source_vacancy_phenoplasticity_getRateAndItsTangent (localCvDot, dLocalCvDot_dCv, grain, ip, el)
|
|
||||||
|
|
||||||
case (SOURCE_vacancy_irradiation_ID)
|
|
||||||
call source_vacancy_irradiation_getRateAndItsTangent (localCvDot, dLocalCvDot_dCv, grain, ip, el)
|
|
||||||
|
|
||||||
case (SOURCE_vacancy_thermalfluc_ID)
|
|
||||||
call source_vacancy_thermalfluc_getRateAndItsTangent(localCvDot, dLocalCvDot_dCv, grain, ip, el)
|
|
||||||
|
|
||||||
end select
|
|
||||||
CvDot = CvDot + localCvDot
|
|
||||||
dCvDot_dCv = dCvDot_dCv + dLocalCvDot_dCv
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
CvDot = CvDot/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal)
|
|
||||||
dCvDot_dCv = dCvDot_dCv/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal)
|
|
||||||
|
|
||||||
end subroutine vacancyflux_cahnhilliard_getSourceAndItsTangent
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns homogenized vacancy mobility tensor in reference configuration
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
function vacancyflux_cahnhilliard_getMobility33(ip,el)
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_vacancyfluxMobility33
|
|
||||||
use material, only: &
|
|
||||||
homogenization_Ngrains, &
|
|
||||||
material_phase
|
|
||||||
use mesh, only: &
|
|
||||||
mesh_element
|
|
||||||
use crystallite, only: &
|
|
||||||
crystallite_push33ToRef
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), dimension(3,3) :: &
|
|
||||||
vacancyflux_cahnhilliard_getMobility33
|
|
||||||
integer(pInt) :: &
|
|
||||||
grain
|
|
||||||
|
|
||||||
vacancyflux_cahnhilliard_getMobility33 = 0.0_pReal
|
|
||||||
do grain = 1, homogenization_Ngrains(mesh_element(3,el))
|
|
||||||
vacancyflux_cahnhilliard_getMobility33 = vacancyflux_cahnhilliard_getMobility33 + &
|
|
||||||
crystallite_push33ToRef(grain,ip,el,lattice_vacancyfluxMobility33(:,:,material_phase(grain,ip,el)))
|
|
||||||
enddo
|
|
||||||
|
|
||||||
vacancyflux_cahnhilliard_getMobility33 = &
|
|
||||||
vacancyflux_cahnhilliard_getMobility33/real(homogenization_Ngrains(mesh_element(3,el)),pReal)
|
|
||||||
|
|
||||||
end function vacancyflux_cahnhilliard_getMobility33
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns homogenized vacancy diffusion tensor in reference configuration
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
function vacancyflux_cahnhilliard_getDiffusion33(ip,el)
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_vacancyfluxDiffusion33
|
|
||||||
use material, only: &
|
|
||||||
homogenization_Ngrains, &
|
|
||||||
material_phase
|
|
||||||
use mesh, only: &
|
|
||||||
mesh_element
|
|
||||||
use crystallite, only: &
|
|
||||||
crystallite_push33ToRef
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), dimension(3,3) :: &
|
|
||||||
vacancyflux_cahnhilliard_getDiffusion33
|
|
||||||
integer(pInt) :: &
|
|
||||||
grain
|
|
||||||
|
|
||||||
vacancyflux_cahnhilliard_getDiffusion33 = 0.0_pReal
|
|
||||||
do grain = 1, homogenization_Ngrains(mesh_element(3,el))
|
|
||||||
vacancyflux_cahnhilliard_getDiffusion33 = vacancyflux_cahnhilliard_getDiffusion33 + &
|
|
||||||
crystallite_push33ToRef(grain,ip,el,lattice_vacancyfluxDiffusion33(:,:,material_phase(grain,ip,el)))
|
|
||||||
enddo
|
|
||||||
|
|
||||||
vacancyflux_cahnhilliard_getDiffusion33 = &
|
|
||||||
vacancyflux_cahnhilliard_getDiffusion33/real(homogenization_Ngrains(mesh_element(3,el)),pReal)
|
|
||||||
|
|
||||||
end function vacancyflux_cahnhilliard_getDiffusion33
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns homogenized vacancy formation energy
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
real(pReal) function vacancyflux_cahnhilliard_getFormationEnergy(ip,el)
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_vacancyFormationEnergy, &
|
|
||||||
lattice_vacancyVol, &
|
|
||||||
lattice_vacancySurfaceEnergy
|
|
||||||
use material, only: &
|
|
||||||
homogenization_Ngrains, &
|
|
||||||
material_phase
|
|
||||||
use mesh, only: &
|
|
||||||
mesh_element
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
integer(pInt) :: &
|
|
||||||
grain
|
|
||||||
|
|
||||||
vacancyflux_cahnhilliard_getFormationEnergy = 0.0_pReal
|
|
||||||
do grain = 1, homogenization_Ngrains(mesh_element(3,el))
|
|
||||||
vacancyflux_cahnhilliard_getFormationEnergy = vacancyflux_cahnhilliard_getFormationEnergy + &
|
|
||||||
lattice_vacancyFormationEnergy(material_phase(grain,ip,el))/ &
|
|
||||||
lattice_vacancyVol(material_phase(grain,ip,el))/ &
|
|
||||||
lattice_vacancySurfaceEnergy(material_phase(grain,ip,el))
|
|
||||||
enddo
|
|
||||||
|
|
||||||
vacancyflux_cahnhilliard_getFormationEnergy = &
|
|
||||||
vacancyflux_cahnhilliard_getFormationEnergy/real(homogenization_Ngrains(mesh_element(3,el)),pReal)
|
|
||||||
|
|
||||||
end function vacancyflux_cahnhilliard_getFormationEnergy
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns homogenized vacancy entropy coefficient
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
real(pReal) function vacancyflux_cahnhilliard_getEntropicCoeff(ip,el)
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_vacancyVol, &
|
|
||||||
lattice_vacancySurfaceEnergy
|
|
||||||
use material, only: &
|
|
||||||
homogenization_Ngrains, &
|
|
||||||
material_homog, &
|
|
||||||
material_phase, &
|
|
||||||
temperature, &
|
|
||||||
thermalMapping
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
integer(pInt) :: &
|
|
||||||
grain
|
|
||||||
|
|
||||||
vacancyflux_cahnhilliard_getEntropicCoeff = 0.0_pReal
|
|
||||||
do grain = 1, homogenization_Ngrains(material_homog(ip,el))
|
|
||||||
vacancyflux_cahnhilliard_getEntropicCoeff = vacancyflux_cahnhilliard_getEntropicCoeff + &
|
|
||||||
kB/ &
|
|
||||||
lattice_vacancyVol(material_phase(grain,ip,el))/ &
|
|
||||||
lattice_vacancySurfaceEnergy(material_phase(grain,ip,el))
|
|
||||||
enddo
|
|
||||||
|
|
||||||
vacancyflux_cahnhilliard_getEntropicCoeff = &
|
|
||||||
vacancyflux_cahnhilliard_getEntropicCoeff* &
|
|
||||||
temperature(material_homog(ip,el))%p(thermalMapping(material_homog(ip,el))%p(ip,el))/ &
|
|
||||||
real(homogenization_Ngrains(material_homog(ip,el)),pReal)
|
|
||||||
|
|
||||||
end function vacancyflux_cahnhilliard_getEntropicCoeff
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns homogenized kinematic contribution to chemical potential
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine vacancyflux_cahnhilliard_KinematicChemPotAndItsTangent(KPot, dKPot_dCv, Cv, ip, el)
|
|
||||||
use lattice, only: &
|
|
||||||
lattice_vacancySurfaceEnergy
|
|
||||||
use material, only: &
|
|
||||||
homogenization_Ngrains, &
|
|
||||||
material_homog, &
|
|
||||||
phase_kinematics, &
|
|
||||||
phase_Nkinematics, &
|
|
||||||
material_phase, &
|
|
||||||
KINEMATICS_vacancy_strain_ID
|
|
||||||
use crystallite, only: &
|
|
||||||
crystallite_Tstar_v, &
|
|
||||||
crystallite_Fi0, &
|
|
||||||
crystallite_Fi
|
|
||||||
use kinematics_vacancy_strain, only: &
|
|
||||||
kinematics_vacancy_strain_ChemPotAndItsTangent
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(in) :: &
|
|
||||||
Cv
|
|
||||||
real(pReal), intent(out) :: &
|
|
||||||
KPot, dKPot_dCv
|
|
||||||
real(pReal) :: &
|
|
||||||
my_KPot, my_dKPot_dCv
|
|
||||||
integer(pInt) :: &
|
|
||||||
grain, kinematics
|
|
||||||
|
|
||||||
KPot = 0.0_pReal
|
|
||||||
dKPot_dCv = 0.0_pReal
|
|
||||||
do grain = 1_pInt,homogenization_Ngrains(material_homog(ip,el))
|
|
||||||
do kinematics = 1_pInt, phase_Nkinematics(material_phase(grain,ip,el))
|
|
||||||
select case (phase_kinematics(kinematics,material_phase(grain,ip,el)))
|
|
||||||
case (KINEMATICS_vacancy_strain_ID)
|
|
||||||
call kinematics_vacancy_strain_ChemPotAndItsTangent(my_KPot, my_dKPot_dCv, &
|
|
||||||
crystallite_Tstar_v(1:6,grain,ip,el), &
|
|
||||||
crystallite_Fi0(1:3,1:3,grain,ip,el), &
|
|
||||||
crystallite_Fi (1:3,1:3,grain,ip,el), &
|
|
||||||
grain,ip, el)
|
|
||||||
|
|
||||||
case default
|
|
||||||
my_KPot = 0.0_pReal
|
|
||||||
my_dKPot_dCv = 0.0_pReal
|
|
||||||
|
|
||||||
end select
|
|
||||||
KPot = KPot + my_KPot/lattice_vacancySurfaceEnergy(material_phase(grain,ip,el))
|
|
||||||
dKPot_dCv = dKPot_dCv + my_dKPot_dCv/lattice_vacancySurfaceEnergy(material_phase(grain,ip,el))
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
KPot = KPot/real(homogenization_Ngrains(material_homog(ip,el)),pReal)
|
|
||||||
dKPot_dCv = dKPot_dCv/real(homogenization_Ngrains(material_homog(ip,el)),pReal)
|
|
||||||
|
|
||||||
end subroutine vacancyflux_cahnhilliard_KinematicChemPotAndItsTangent
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief returns homogenized chemical potential and its tangent
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine vacancyflux_cahnhilliard_getChemPotAndItsTangent(ChemPot,dChemPot_dCv,Cv,ip,el)
|
|
||||||
use numerics, only: &
|
|
||||||
vacancyBoundPenalty, &
|
|
||||||
vacancyPolyOrder
|
|
||||||
use material, only: &
|
|
||||||
mappingHomogenization, &
|
|
||||||
vacancyflux_typeInstance, &
|
|
||||||
porosity, &
|
|
||||||
porosityMapping
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(in) :: &
|
|
||||||
Cv
|
|
||||||
real(pReal), intent(out) :: &
|
|
||||||
ChemPot, &
|
|
||||||
dChemPot_dCv
|
|
||||||
real(pReal) :: &
|
|
||||||
VoidPhaseFrac, kBT, KPot, dKPot_dCv
|
|
||||||
integer(pInt) :: &
|
|
||||||
homog, o
|
|
||||||
|
|
||||||
homog = mappingHomogenization(2,ip,el)
|
|
||||||
VoidPhaseFrac = porosity(homog)%p(porosityMapping(homog)%p(ip,el))
|
|
||||||
kBT = vacancyflux_cahnhilliard_getEntropicCoeff(ip,el)
|
|
||||||
|
|
||||||
ChemPot = vacancyflux_cahnhilliard_getFormationEnergy(ip,el)
|
|
||||||
dChemPot_dCv = 0.0_pReal
|
|
||||||
do o = 1_pInt, vacancyPolyOrder
|
|
||||||
ChemPot = ChemPot + kBT*((2.0_pReal*Cv - 1.0_pReal)**real(2_pInt*o-1_pInt,pReal))/ &
|
|
||||||
real(2_pInt*o-1_pInt,pReal)
|
|
||||||
dChemPot_dCv = dChemPot_dCv + 2.0_pReal*kBT*(2.0_pReal*Cv - 1.0_pReal)**real(2_pInt*o-2_pInt,pReal)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
ChemPot = VoidPhaseFrac*VoidPhaseFrac*ChemPot &
|
|
||||||
- 2.0_pReal*(1.0_pReal - Cv)*(1.0_pReal - VoidPhaseFrac)*(1.0_pReal - VoidPhaseFrac)
|
|
||||||
|
|
||||||
dChemPot_dCv = VoidPhaseFrac*VoidPhaseFrac*dChemPot_dCv &
|
|
||||||
+ 2.0_pReal*(1.0_pReal - VoidPhaseFrac)*(1.0_pReal - VoidPhaseFrac)
|
|
||||||
|
|
||||||
call vacancyflux_cahnhilliard_KinematicChemPotAndItsTangent(KPot, dKPot_dCv, Cv, ip, el)
|
|
||||||
ChemPot = ChemPot + KPot
|
|
||||||
dChemPot_dCv = dChemPot_dCv + dKPot_dCv
|
|
||||||
|
|
||||||
if (Cv < 0.0_pReal) then
|
|
||||||
ChemPot = ChemPot - 3.0_pReal*vacancyBoundPenalty*Cv*Cv
|
|
||||||
dChemPot_dCv = dChemPot_dCv - 6.0_pReal*vacancyBoundPenalty*Cv
|
|
||||||
elseif (Cv > 1.0_pReal) then
|
|
||||||
ChemPot = ChemPot + 3.0_pReal*vacancyBoundPenalty*(1.0_pReal - Cv)*(1.0_pReal - Cv)
|
|
||||||
dChemPot_dCv = dChemPot_dCv - 6.0_pReal*vacancyBoundPenalty*(1.0_pReal - Cv)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ChemPot = ChemPot* &
|
|
||||||
vacancyflux_cahnhilliard_thermalFluc(vacancyflux_typeInstance(homog))%p(mappingHomogenization(1,ip,el))
|
|
||||||
dChemPot_dCv = dChemPot_dCv* &
|
|
||||||
vacancyflux_cahnhilliard_thermalFluc(vacancyflux_typeInstance(homog))%p(mappingHomogenization(1,ip,el))
|
|
||||||
|
|
||||||
end subroutine vacancyflux_cahnhilliard_getChemPotAndItsTangent
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief updated vacancy concentration and its rate with solution from transport PDE
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine vacancyflux_cahnhilliard_putVacancyConcAndItsRate(Cv,Cvdot,ip,el)
|
|
||||||
use material, only: &
|
|
||||||
mappingHomogenization, &
|
|
||||||
vacancyConc, &
|
|
||||||
vacancyConcRate, &
|
|
||||||
vacancyfluxMapping
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(in) :: &
|
|
||||||
Cv, &
|
|
||||||
Cvdot
|
|
||||||
integer(pInt) :: &
|
|
||||||
homog, &
|
|
||||||
offset
|
|
||||||
|
|
||||||
homog = mappingHomogenization(2,ip,el)
|
|
||||||
offset = vacancyfluxMapping(homog)%p(ip,el)
|
|
||||||
vacancyConc (homog)%p(offset) = Cv
|
|
||||||
vacancyConcRate(homog)%p(offset) = Cvdot
|
|
||||||
|
|
||||||
end subroutine vacancyflux_cahnhilliard_putVacancyConcAndItsRate
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief return array of vacancy transport results
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
function vacancyflux_cahnhilliard_postResults(ip,el)
|
|
||||||
use material, only: &
|
|
||||||
mappingHomogenization, &
|
|
||||||
vacancyflux_typeInstance, &
|
|
||||||
vacancyConc, &
|
|
||||||
vacancyfluxMapping
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point
|
|
||||||
el !< element
|
|
||||||
real(pReal), dimension(vacancyflux_cahnhilliard_sizePostResults(vacancyflux_typeInstance(mappingHomogenization(2,ip,el)))) :: &
|
|
||||||
vacancyflux_cahnhilliard_postResults
|
|
||||||
|
|
||||||
integer(pInt) :: &
|
|
||||||
instance, homog, offset, o, c
|
|
||||||
|
|
||||||
homog = mappingHomogenization(2,ip,el)
|
|
||||||
offset = vacancyfluxMapping(homog)%p(ip,el)
|
|
||||||
instance = vacancyflux_typeInstance(homog)
|
|
||||||
|
|
||||||
c = 0_pInt
|
|
||||||
vacancyflux_cahnhilliard_postResults = 0.0_pReal
|
|
||||||
|
|
||||||
do o = 1_pInt,vacancyflux_cahnhilliard_Noutput(instance)
|
|
||||||
select case(vacancyflux_cahnhilliard_outputID(o,instance))
|
|
||||||
|
|
||||||
case (vacancyConc_ID)
|
|
||||||
vacancyflux_cahnhilliard_postResults(c+1_pInt) = vacancyConc(homog)%p(offset)
|
|
||||||
c = c + 1
|
|
||||||
end select
|
|
||||||
enddo
|
|
||||||
end function vacancyflux_cahnhilliard_postResults
|
|
||||||
|
|
||||||
end module vacancyflux_cahnhilliard
|
|
|
@ -1,328 +0,0 @@
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
|
||||||
!> @brief material subroutine for locally evolving vacancy concentration
|
|
||||||
!> @details to be done
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
module vacancyflux_isochempot
|
|
||||||
use prec, only: &
|
|
||||||
pReal, &
|
|
||||||
pInt
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
private
|
|
||||||
integer(pInt), dimension(:), allocatable, public, protected :: &
|
|
||||||
vacancyflux_isochempot_sizePostResults !< cumulative size of post results
|
|
||||||
|
|
||||||
integer(pInt), dimension(:,:), allocatable, target, public :: &
|
|
||||||
vacancyflux_isochempot_sizePostResult !< size of each post result output
|
|
||||||
|
|
||||||
character(len=64), dimension(:,:), allocatable, target, public :: &
|
|
||||||
vacancyflux_isochempot_output !< name of each post result output
|
|
||||||
|
|
||||||
integer(pInt), dimension(:), allocatable, target, public :: &
|
|
||||||
vacancyflux_isochempot_Noutput !< number of outputs per instance of this damage
|
|
||||||
|
|
||||||
enum, bind(c)
|
|
||||||
enumerator :: undefined_ID, &
|
|
||||||
vacancyconc_ID
|
|
||||||
end enum
|
|
||||||
integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: &
|
|
||||||
vacancyflux_isochempot_outputID !< ID of each post result output
|
|
||||||
|
|
||||||
|
|
||||||
public :: &
|
|
||||||
vacancyflux_isochempot_init, &
|
|
||||||
vacancyflux_isochempot_updateState, &
|
|
||||||
vacancyflux_isochempot_getSourceAndItsTangent, &
|
|
||||||
vacancyflux_isochempot_postResults
|
|
||||||
|
|
||||||
contains
|
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief module initialization
|
|
||||||
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine vacancyflux_isochempot_init(fileUnit)
|
|
||||||
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
|
||||||
use, intrinsic :: iso_fortran_env, only: &
|
|
||||||
compiler_version, &
|
|
||||||
compiler_options
|
|
||||||
#endif
|
|
||||||
use IO, only: &
|
|
||||||
IO_read, &
|
|
||||||
IO_lc, &
|
|
||||||
IO_getTag, &
|
|
||||||
IO_isBlank, &
|
|
||||||
IO_stringPos, &
|
|
||||||
IO_stringValue, &
|
|
||||||
IO_floatValue, &
|
|
||||||
IO_intValue, &
|
|
||||||
IO_warning, &
|
|
||||||
IO_error, &
|
|
||||||
IO_timeStamp, &
|
|
||||||
IO_EOF
|
|
||||||
use material, only: &
|
|
||||||
vacancyflux_type, &
|
|
||||||
vacancyflux_typeInstance, &
|
|
||||||
homogenization_Noutput, &
|
|
||||||
VACANCYFLUX_isochempot_label, &
|
|
||||||
VACANCYFLUX_isochempot_ID, &
|
|
||||||
material_homog, &
|
|
||||||
mappingHomogenization, &
|
|
||||||
vacancyfluxState, &
|
|
||||||
vacancyfluxMapping, &
|
|
||||||
vacancyConc, &
|
|
||||||
vacancyConcRate, &
|
|
||||||
vacancyflux_initialCv
|
|
||||||
use config, only: &
|
|
||||||
material_partHomogenization
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: fileUnit
|
|
||||||
|
|
||||||
integer(pInt), allocatable, dimension(:) :: chunkPos
|
|
||||||
integer(pInt) :: maxNinstance,mySize=0_pInt,section,instance,o
|
|
||||||
integer(pInt) :: sizeState
|
|
||||||
integer(pInt) :: NofMyHomog
|
|
||||||
character(len=65536) :: &
|
|
||||||
tag = '', &
|
|
||||||
line = ''
|
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- vacancyflux_'//VACANCYFLUX_isochempot_label//' init -+>>>'
|
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
|
||||||
#include "compilation_info.f90"
|
|
||||||
|
|
||||||
maxNinstance = int(count(vacancyflux_type == VACANCYFLUX_isochempot_ID),pInt)
|
|
||||||
if (maxNinstance == 0_pInt) return
|
|
||||||
|
|
||||||
allocate(vacancyflux_isochempot_sizePostResults(maxNinstance), source=0_pInt)
|
|
||||||
allocate(vacancyflux_isochempot_sizePostResult (maxval(homogenization_Noutput),maxNinstance),source=0_pInt)
|
|
||||||
allocate(vacancyflux_isochempot_output (maxval(homogenization_Noutput),maxNinstance))
|
|
||||||
vacancyflux_isochempot_output = ''
|
|
||||||
allocate(vacancyflux_isochempot_outputID (maxval(homogenization_Noutput),maxNinstance),source=undefined_ID)
|
|
||||||
allocate(vacancyflux_isochempot_Noutput (maxNinstance), source=0_pInt)
|
|
||||||
|
|
||||||
rewind(fileUnit)
|
|
||||||
section = 0_pInt
|
|
||||||
do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= material_partHomogenization)! wind forward to <homogenization>
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of homog part
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
|
||||||
if (IO_getTag(line,'<','>') /= '') then ! stop at next part
|
|
||||||
line = IO_read(fileUnit, .true.) ! reset IO_read
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
if (IO_getTag(line,'[',']') /= '') then ! next homog section
|
|
||||||
section = section + 1_pInt ! advance homog section counter
|
|
||||||
cycle ! skip to next line
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (section > 0_pInt ) then; if (vacancyflux_type(section) == VACANCYFLUX_isochempot_ID) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
|
||||||
|
|
||||||
instance = vacancyflux_typeInstance(section) ! which instance of my vacancyflux is present homog
|
|
||||||
chunkPos = IO_stringPos(line)
|
|
||||||
tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key
|
|
||||||
select case(tag)
|
|
||||||
case ('(output)')
|
|
||||||
select case(IO_lc(IO_stringValue(line,chunkPos,2_pInt)))
|
|
||||||
case ('vacancyconc')
|
|
||||||
vacancyflux_isochempot_Noutput(instance) = vacancyflux_isochempot_Noutput(instance) + 1_pInt
|
|
||||||
vacancyflux_isochempot_outputID(vacancyflux_isochempot_Noutput(instance),instance) = vacancyconc_ID
|
|
||||||
vacancyflux_isochempot_output(vacancyflux_isochempot_Noutput(instance),instance) = &
|
|
||||||
IO_lc(IO_stringValue(line,chunkPos,2_pInt))
|
|
||||||
end select
|
|
||||||
|
|
||||||
end select
|
|
||||||
endif; endif
|
|
||||||
enddo parsingFile
|
|
||||||
|
|
||||||
initializeInstances: do section = 1_pInt, size(vacancyflux_type)
|
|
||||||
if (vacancyflux_type(section) == VACANCYFLUX_isochempot_ID) then
|
|
||||||
NofMyHomog=count(material_homog==section)
|
|
||||||
instance = vacancyflux_typeInstance(section)
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! Determine size of postResults array
|
|
||||||
outputsLoop: do o = 1_pInt,vacancyflux_isochempot_Noutput(instance)
|
|
||||||
select case(vacancyflux_isochempot_outputID(o,instance))
|
|
||||||
case(vacancyconc_ID)
|
|
||||||
mySize = 1_pInt
|
|
||||||
end select
|
|
||||||
|
|
||||||
if (mySize > 0_pInt) then ! any meaningful output found
|
|
||||||
vacancyflux_isochempot_sizePostResult(o,instance) = mySize
|
|
||||||
vacancyflux_isochempot_sizePostResults(instance) = vacancyflux_isochempot_sizePostResults(instance) + mySize
|
|
||||||
endif
|
|
||||||
enddo outputsLoop
|
|
||||||
|
|
||||||
! allocate state arrays
|
|
||||||
sizeState = 1_pInt
|
|
||||||
vacancyfluxState(section)%sizeState = sizeState
|
|
||||||
vacancyfluxState(section)%sizePostResults = vacancyflux_isochempot_sizePostResults(instance)
|
|
||||||
allocate(vacancyfluxState(section)%state0 (sizeState,NofMyHomog), source=vacancyflux_initialCv(section))
|
|
||||||
allocate(vacancyfluxState(section)%subState0(sizeState,NofMyHomog), source=vacancyflux_initialCv(section))
|
|
||||||
allocate(vacancyfluxState(section)%state (sizeState,NofMyHomog), source=vacancyflux_initialCv(section))
|
|
||||||
|
|
||||||
nullify(vacancyfluxMapping(section)%p)
|
|
||||||
vacancyfluxMapping(section)%p => mappingHomogenization(1,:,:)
|
|
||||||
deallocate(vacancyConc(section)%p)
|
|
||||||
vacancyConc(section)%p => vacancyfluxState(section)%state(1,:)
|
|
||||||
deallocate(vacancyConcRate(section)%p)
|
|
||||||
allocate(vacancyConcRate(section)%p(NofMyHomog), source=0.0_pReal)
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
enddo initializeInstances
|
|
||||||
end subroutine vacancyflux_isochempot_init
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief calculates change in vacancy concentration based on local vacancy generation model
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
function vacancyflux_isochempot_updateState(subdt, ip, el)
|
|
||||||
use numerics, only: &
|
|
||||||
err_vacancyflux_tolAbs, &
|
|
||||||
err_vacancyflux_tolRel
|
|
||||||
use material, only: &
|
|
||||||
mappingHomogenization, &
|
|
||||||
vacancyflux_typeInstance, &
|
|
||||||
vacancyfluxState, &
|
|
||||||
vacancyConc, &
|
|
||||||
vacancyConcRate, &
|
|
||||||
vacancyfluxMapping
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(in) :: &
|
|
||||||
subdt
|
|
||||||
logical, dimension(2) :: &
|
|
||||||
vacancyflux_isochempot_updateState
|
|
||||||
integer(pInt) :: &
|
|
||||||
homog, &
|
|
||||||
offset, &
|
|
||||||
instance
|
|
||||||
real(pReal) :: &
|
|
||||||
Cv, Cvdot, dCvDot_dCv
|
|
||||||
|
|
||||||
homog = mappingHomogenization(2,ip,el)
|
|
||||||
offset = mappingHomogenization(1,ip,el)
|
|
||||||
instance = vacancyflux_typeInstance(homog)
|
|
||||||
|
|
||||||
Cv = vacancyfluxState(homog)%subState0(1,offset)
|
|
||||||
call vacancyflux_isochempot_getSourceAndItsTangent(CvDot, dCvDot_dCv, Cv, ip, el)
|
|
||||||
Cv = Cv + subdt*Cvdot
|
|
||||||
|
|
||||||
vacancyflux_isochempot_updateState = [ abs(Cv - vacancyfluxState(homog)%state(1,offset)) &
|
|
||||||
<= err_vacancyflux_tolAbs &
|
|
||||||
.or. abs(Cv - vacancyfluxState(homog)%state(1,offset)) &
|
|
||||||
<= err_vacancyflux_tolRel*abs(vacancyfluxState(homog)%state(1,offset)), &
|
|
||||||
.true.]
|
|
||||||
|
|
||||||
vacancyConc (homog)%p(vacancyfluxMapping(homog)%p(ip,el)) = Cv
|
|
||||||
vacancyConcRate(homog)%p(vacancyfluxMapping(homog)%p(ip,el)) = &
|
|
||||||
(vacancyfluxState(homog)%state(1,offset) - vacancyfluxState(homog)%subState0(1,offset))/(subdt+tiny(0.0_pReal))
|
|
||||||
|
|
||||||
end function vacancyflux_isochempot_updateState
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief calculates homogenized vacancy driving forces
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine vacancyflux_isochempot_getSourceAndItsTangent(CvDot, dCvDot_dCv, Cv, ip, el)
|
|
||||||
use material, only: &
|
|
||||||
homogenization_Ngrains, &
|
|
||||||
mappingHomogenization, &
|
|
||||||
phaseAt, &
|
|
||||||
phase_source, &
|
|
||||||
phase_Nsources, &
|
|
||||||
SOURCE_vacancy_phenoplasticity_ID, &
|
|
||||||
SOURCE_vacancy_irradiation_ID, &
|
|
||||||
SOURCE_vacancy_thermalfluc_ID
|
|
||||||
use source_vacancy_phenoplasticity, only: &
|
|
||||||
source_vacancy_phenoplasticity_getRateAndItsTangent
|
|
||||||
use source_vacancy_irradiation, only: &
|
|
||||||
source_vacancy_irradiation_getRateAndItsTangent
|
|
||||||
use source_vacancy_thermalfluc, only: &
|
|
||||||
source_vacancy_thermalfluc_getRateAndItsTangent
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point number
|
|
||||||
el !< element number
|
|
||||||
real(pReal), intent(in) :: &
|
|
||||||
Cv
|
|
||||||
integer(pInt) :: &
|
|
||||||
phase, &
|
|
||||||
grain, &
|
|
||||||
source
|
|
||||||
real(pReal) :: &
|
|
||||||
CvDot, dCvDot_dCv, localCvDot, dLocalCvDot_dCv
|
|
||||||
|
|
||||||
CvDot = 0.0_pReal
|
|
||||||
dCvDot_dCv = 0.0_pReal
|
|
||||||
do grain = 1, homogenization_Ngrains(mappingHomogenization(2,ip,el))
|
|
||||||
phase = phaseAt(grain,ip,el)
|
|
||||||
do source = 1_pInt, phase_Nsources(phase)
|
|
||||||
select case(phase_source(source,phase))
|
|
||||||
case (SOURCE_vacancy_phenoplasticity_ID)
|
|
||||||
call source_vacancy_phenoplasticity_getRateAndItsTangent (localCvDot, dLocalCvDot_dCv, grain, ip, el)
|
|
||||||
|
|
||||||
case (SOURCE_vacancy_irradiation_ID)
|
|
||||||
call source_vacancy_irradiation_getRateAndItsTangent (localCvDot, dLocalCvDot_dCv, grain, ip, el)
|
|
||||||
|
|
||||||
case (SOURCE_vacancy_thermalfluc_ID)
|
|
||||||
call source_vacancy_thermalfluc_getRateAndItsTangent(localCvDot, dLocalCvDot_dCv, grain, ip, el)
|
|
||||||
|
|
||||||
end select
|
|
||||||
CvDot = CvDot + localCvDot
|
|
||||||
dCvDot_dCv = dCvDot_dCv + dLocalCvDot_dCv
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
CvDot = CvDot/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal)
|
|
||||||
dCvDot_dCv = dCvDot_dCv/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal)
|
|
||||||
|
|
||||||
end subroutine vacancyflux_isochempot_getSourceAndItsTangent
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief return array of vacancy transport results
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
function vacancyflux_isochempot_postResults(ip,el)
|
|
||||||
use material, only: &
|
|
||||||
mappingHomogenization, &
|
|
||||||
vacancyflux_typeInstance, &
|
|
||||||
vacancyConc, &
|
|
||||||
vacancyfluxMapping
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt), intent(in) :: &
|
|
||||||
ip, & !< integration point
|
|
||||||
el !< element
|
|
||||||
real(pReal), dimension(vacancyflux_isochempot_sizePostResults(vacancyflux_typeInstance(mappingHomogenization(2,ip,el)))) :: &
|
|
||||||
vacancyflux_isochempot_postResults
|
|
||||||
|
|
||||||
integer(pInt) :: &
|
|
||||||
instance, homog, offset, o, c
|
|
||||||
|
|
||||||
homog = mappingHomogenization(2,ip,el)
|
|
||||||
offset = vacancyfluxMapping(homog)%p(ip,el)
|
|
||||||
instance = vacancyflux_typeInstance(homog)
|
|
||||||
|
|
||||||
c = 0_pInt
|
|
||||||
vacancyflux_isochempot_postResults = 0.0_pReal
|
|
||||||
|
|
||||||
do o = 1_pInt,vacancyflux_isochempot_Noutput(instance)
|
|
||||||
select case(vacancyflux_isochempot_outputID(o,instance))
|
|
||||||
|
|
||||||
case (vacancyconc_ID)
|
|
||||||
vacancyflux_isochempot_postResults(c+1_pInt) = vacancyConc(homog)%p(offset)
|
|
||||||
c = c + 1
|
|
||||||
end select
|
|
||||||
enddo
|
|
||||||
end function vacancyflux_isochempot_postResults
|
|
||||||
|
|
||||||
end module vacancyflux_isochempot
|
|
|
@ -1,62 +0,0 @@
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
|
||||||
!> @brief material subroutine for constant vacancy concentration
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
module vacancyflux_isoconc
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
private
|
|
||||||
|
|
||||||
public :: &
|
|
||||||
vacancyflux_isoconc_init
|
|
||||||
|
|
||||||
contains
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief allocates all neccessary fields, reads information from material configuration file
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine vacancyflux_isoconc_init()
|
|
||||||
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
|
||||||
use, intrinsic :: iso_fortran_env, only: &
|
|
||||||
compiler_version, &
|
|
||||||
compiler_options
|
|
||||||
#endif
|
|
||||||
use prec, only: &
|
|
||||||
pReal, &
|
|
||||||
pInt
|
|
||||||
use IO, only: &
|
|
||||||
IO_timeStamp
|
|
||||||
use material
|
|
||||||
use config
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
integer(pInt) :: &
|
|
||||||
homog, &
|
|
||||||
NofMyHomog
|
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- vacancyflux_'//VACANCYFLUX_isoconc_label//' init -+>>>'
|
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
|
||||||
#include "compilation_info.f90"
|
|
||||||
|
|
||||||
initializeInstances: do homog = 1_pInt, material_Nhomogenization
|
|
||||||
|
|
||||||
myhomog: if (vacancyflux_type(homog) == VACANCYFLUX_isoconc_ID) then
|
|
||||||
NofMyHomog = count(material_homog == homog)
|
|
||||||
vacancyfluxState(homog)%sizeState = 0_pInt
|
|
||||||
vacancyfluxState(homog)%sizePostResults = 0_pInt
|
|
||||||
allocate(vacancyfluxState(homog)%state0 (0_pInt,NofMyHomog))
|
|
||||||
allocate(vacancyfluxState(homog)%subState0(0_pInt,NofMyHomog))
|
|
||||||
allocate(vacancyfluxState(homog)%state (0_pInt,NofMyHomog))
|
|
||||||
|
|
||||||
deallocate(vacancyConc (homog)%p)
|
|
||||||
allocate (vacancyConc (homog)%p(1), source=vacancyflux_initialCv(homog))
|
|
||||||
deallocate(vacancyConcRate(homog)%p)
|
|
||||||
allocate (vacancyConcRate(homog)%p(1), source=0.0_pReal)
|
|
||||||
|
|
||||||
endif myhomog
|
|
||||||
enddo initializeInstances
|
|
||||||
|
|
||||||
|
|
||||||
end subroutine vacancyflux_isoconc_init
|
|
||||||
|
|
||||||
end module vacancyflux_isoconc
|
|
Loading…
Reference in New Issue